@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.
- package/LICENSE.md +11 -0
- package/NOTICE.txt +654 -0
- package/README.md +31 -0
- package/dist/cdn/js/kendo-angular-listbox.js +20 -0
- package/dist/cdn/main.js +5 -0
- package/dist/es/constants.js +65 -0
- package/dist/es/data-binding.directive.js +145 -0
- package/dist/es/index.js +11 -0
- package/dist/es/item-selectable.directive.js +49 -0
- package/dist/es/item-template.directive.js +38 -0
- package/dist/es/listbox.component.js +196 -0
- package/dist/es/listbox.module.js +28 -0
- package/dist/es/main.js +7 -0
- package/dist/es/package-metadata.js +15 -0
- package/dist/es/selection.service.js +30 -0
- package/dist/es/size.js +4 -0
- package/dist/es/toolbar.js +4 -0
- package/dist/es/util.js +38 -0
- package/dist/es2015/constants.d.ts +25 -0
- package/dist/es2015/constants.js +65 -0
- package/dist/es2015/data-binding.directive.d.ts +36 -0
- package/dist/es2015/data-binding.directive.js +140 -0
- package/dist/es2015/index.d.ts +11 -0
- package/dist/es2015/index.js +11 -0
- package/dist/es2015/index.metadata.json +1 -0
- package/dist/es2015/item-selectable.directive.d.ts +15 -0
- package/dist/es2015/item-selectable.directive.js +44 -0
- package/dist/es2015/item-template.directive.d.ts +28 -0
- package/dist/es2015/item-template.directive.js +37 -0
- package/dist/es2015/listbox.component.d.ts +93 -0
- package/dist/es2015/listbox.component.js +216 -0
- package/dist/es2015/listbox.module.d.ts +9 -0
- package/dist/es2015/listbox.module.js +25 -0
- package/dist/es2015/main.d.ts +12 -0
- package/dist/es2015/main.js +7 -0
- package/dist/es2015/package-metadata.d.ts +9 -0
- package/dist/es2015/package-metadata.js +15 -0
- package/dist/es2015/selection.service.d.ts +21 -0
- package/dist/es2015/selection.service.js +32 -0
- package/dist/es2015/size.d.ts +13 -0
- package/dist/es2015/size.js +4 -0
- package/dist/es2015/toolbar.d.ts +42 -0
- package/dist/es2015/toolbar.js +4 -0
- package/dist/es2015/util.d.ts +31 -0
- package/dist/es2015/util.js +38 -0
- package/dist/fesm2015/index.js +565 -0
- package/dist/fesm5/index.js +557 -0
- package/dist/npm/constants.js +67 -0
- package/dist/npm/data-binding.directive.js +147 -0
- package/dist/npm/index.js +17 -0
- package/dist/npm/item-selectable.directive.js +51 -0
- package/dist/npm/item-template.directive.js +40 -0
- package/dist/npm/listbox.component.js +198 -0
- package/dist/npm/listbox.module.js +30 -0
- package/dist/npm/main.js +12 -0
- package/dist/npm/package-metadata.js +17 -0
- package/dist/npm/selection.service.js +32 -0
- package/dist/npm/size.js +6 -0
- package/dist/npm/toolbar.js +6 -0
- package/dist/npm/util.js +40 -0
- package/dist/systemjs/kendo-angular-listbox.js +5 -0
- package/package.json +153 -0
- package/schematics/collection.json +12 -0
- package/schematics/ngAdd/index.js +18 -0
- package/schematics/ngAdd/index.js.map +1 -0
- package/schematics/ngAdd/schema.json +28 -0
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
import { ElementRef, EventEmitter, OnDestroy, Renderer2 } from '@angular/core';
|
|
6
|
+
import { ListBoxSelectionEvent, ListBoxSelectionService } from './selection.service';
|
|
7
|
+
import { ItemTemplateDirective } from './item-template.directive';
|
|
8
|
+
import { ListBoxSize } from './size';
|
|
9
|
+
import { ActionName, ListBoxToolbarConfig, Tool } from './toolbar';
|
|
10
|
+
/**
|
|
11
|
+
* Represents the [Kendo UI ListBox component for Angular]({% slug overview_listbox %}).
|
|
12
|
+
*/
|
|
13
|
+
export declare class ListBoxComponent implements OnDestroy {
|
|
14
|
+
selectionService: ListBoxSelectionService;
|
|
15
|
+
private renderer;
|
|
16
|
+
private hostElement;
|
|
17
|
+
/**
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
listboxClassName: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
itemTemplate: ItemTemplateDirective;
|
|
25
|
+
/**
|
|
26
|
+
* The fields of the data item that provide the text content of the nodes.
|
|
27
|
+
*/
|
|
28
|
+
textField: string;
|
|
29
|
+
/**
|
|
30
|
+
* The data which will be displayed by the ListBox.
|
|
31
|
+
*/
|
|
32
|
+
data: any[];
|
|
33
|
+
/**
|
|
34
|
+
* Sets the size of the component.
|
|
35
|
+
*
|
|
36
|
+
* The possible values are:
|
|
37
|
+
* - `'small'`
|
|
38
|
+
* - `'medium'` (default)
|
|
39
|
+
* - `'large'`
|
|
40
|
+
*/
|
|
41
|
+
size: ListBoxSize;
|
|
42
|
+
/**
|
|
43
|
+
* Sets whether a toolbar should be displayed with the ListBox, as well as what tools and position should be used.
|
|
44
|
+
*/
|
|
45
|
+
toolbar: ListBoxToolbarConfig;
|
|
46
|
+
/**
|
|
47
|
+
* A function which determines if a specific item is disabled.
|
|
48
|
+
*/
|
|
49
|
+
itemDisabled: (item: any) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Fires when the user selects a different ListBox item. Also fires when a node is moved, since that also changes its index.
|
|
52
|
+
*/
|
|
53
|
+
selectionChange: EventEmitter<ListBoxSelectionEvent>;
|
|
54
|
+
/**
|
|
55
|
+
* Fires when the user clicks a ListBox item.
|
|
56
|
+
*/
|
|
57
|
+
actionClick: EventEmitter<ActionName>;
|
|
58
|
+
/**
|
|
59
|
+
* @hidden
|
|
60
|
+
*/
|
|
61
|
+
readonly listClasses: string;
|
|
62
|
+
/**
|
|
63
|
+
* @hidden
|
|
64
|
+
*/
|
|
65
|
+
selectedTools: Tool[];
|
|
66
|
+
private sub;
|
|
67
|
+
constructor(selectionService: ListBoxSelectionService, renderer: Renderer2, hostElement: ElementRef);
|
|
68
|
+
/**
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
ngOnDestroy(): void;
|
|
72
|
+
/**
|
|
73
|
+
* @hidden
|
|
74
|
+
*/
|
|
75
|
+
performAction(actionName: ActionName): void;
|
|
76
|
+
/**
|
|
77
|
+
* Programmatically selects a ListBox node.
|
|
78
|
+
*/
|
|
79
|
+
selectItem(index: number): void;
|
|
80
|
+
/**
|
|
81
|
+
* Programmatically clears the ListBox selection.
|
|
82
|
+
*/
|
|
83
|
+
clearSelection(): void;
|
|
84
|
+
/**
|
|
85
|
+
* The index of the currently selected item in the ListBox.
|
|
86
|
+
*/
|
|
87
|
+
readonly selectedIndex: number;
|
|
88
|
+
/**
|
|
89
|
+
* @hidden
|
|
90
|
+
*/
|
|
91
|
+
getText(dataItem: any): string;
|
|
92
|
+
private setToolbarClass;
|
|
93
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
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
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { Component, ContentChild, ElementRef, EventEmitter, HostBinding, Input, isDevMode, Output, Renderer2 } from '@angular/core';
|
|
7
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
8
|
+
import { Subscription } from 'rxjs';
|
|
9
|
+
import { packageMetadata } from './package-metadata';
|
|
10
|
+
import { ListBoxSelectionService } from './selection.service';
|
|
11
|
+
import { ItemTemplateDirective } from './item-template.directive';
|
|
12
|
+
import { defaultItemDisabled, fieldAccessor, getTools } from './util';
|
|
13
|
+
import { allTools, DEFAULT_TOOLBAR_POSITION, sizeClassMap, toolbarClasses } from './constants';
|
|
14
|
+
/**
|
|
15
|
+
* Represents the [Kendo UI ListBox component for Angular]({% slug overview_listbox %}).
|
|
16
|
+
*/
|
|
17
|
+
let ListBoxComponent = class ListBoxComponent {
|
|
18
|
+
constructor(selectionService, renderer, hostElement) {
|
|
19
|
+
this.selectionService = selectionService;
|
|
20
|
+
this.renderer = renderer;
|
|
21
|
+
this.hostElement = hostElement;
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
this.listboxClassName = true;
|
|
26
|
+
/**
|
|
27
|
+
* The data which will be displayed by the ListBox.
|
|
28
|
+
*/
|
|
29
|
+
this.data = [];
|
|
30
|
+
/**
|
|
31
|
+
* Sets the size of the component.
|
|
32
|
+
*
|
|
33
|
+
* The possible values are:
|
|
34
|
+
* - `'small'`
|
|
35
|
+
* - `'medium'` (default)
|
|
36
|
+
* - `'large'`
|
|
37
|
+
*/
|
|
38
|
+
this.size = 'medium';
|
|
39
|
+
/**
|
|
40
|
+
* A function which determines if a specific item is disabled.
|
|
41
|
+
*/
|
|
42
|
+
this.itemDisabled = defaultItemDisabled;
|
|
43
|
+
/**
|
|
44
|
+
* Fires when the user selects a different ListBox item. Also fires when a node is moved, since that also changes its index.
|
|
45
|
+
*/
|
|
46
|
+
this.selectionChange = new EventEmitter();
|
|
47
|
+
/**
|
|
48
|
+
* Fires when the user clicks a ListBox item.
|
|
49
|
+
*/
|
|
50
|
+
this.actionClick = new EventEmitter();
|
|
51
|
+
/**
|
|
52
|
+
* @hidden
|
|
53
|
+
*/
|
|
54
|
+
this.selectedTools = allTools;
|
|
55
|
+
this.sub = new Subscription();
|
|
56
|
+
validatePackage(packageMetadata);
|
|
57
|
+
this.setToolbarClass(DEFAULT_TOOLBAR_POSITION);
|
|
58
|
+
this.sub.add(this.selectionService.onSelect.subscribe((e) => {
|
|
59
|
+
this.selectionChange.next(e);
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Sets whether a toolbar should be displayed with the ListBox, as well as what tools and position should be used.
|
|
64
|
+
*/
|
|
65
|
+
set toolbar(config) {
|
|
66
|
+
let position = DEFAULT_TOOLBAR_POSITION;
|
|
67
|
+
if (typeof config === 'boolean') {
|
|
68
|
+
this.selectedTools = config ? allTools : [];
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.selectedTools = config.tools ? getTools(config.tools) : allTools;
|
|
72
|
+
if (config.position) {
|
|
73
|
+
position = config.position;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.setToolbarClass(position);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @hidden
|
|
80
|
+
*/
|
|
81
|
+
get listClasses() {
|
|
82
|
+
return `k-list k-list-${sizeClassMap[this.size]}`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @hidden
|
|
86
|
+
*/
|
|
87
|
+
ngOnDestroy() {
|
|
88
|
+
this.sub.unsubscribe();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @hidden
|
|
92
|
+
*/
|
|
93
|
+
performAction(actionName) {
|
|
94
|
+
this.actionClick.next(actionName);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Programmatically selects a ListBox node.
|
|
98
|
+
*/
|
|
99
|
+
selectItem(index) {
|
|
100
|
+
this.selectionService.selectedIndex = index;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Programmatically clears the ListBox selection.
|
|
104
|
+
*/
|
|
105
|
+
clearSelection() {
|
|
106
|
+
this.selectionService.clearSelection();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The index of the currently selected item in the ListBox.
|
|
110
|
+
*/
|
|
111
|
+
get selectedIndex() {
|
|
112
|
+
return this.selectionService.selectedIndex;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @hidden
|
|
116
|
+
*/
|
|
117
|
+
getText(dataItem) {
|
|
118
|
+
if (typeof dataItem !== 'string' && !this.textField && isDevMode()) {
|
|
119
|
+
throw new Error('Missing textField input. When passing an array of objects as data, please set the textField input of the ListBox accordingly.');
|
|
120
|
+
}
|
|
121
|
+
return fieldAccessor(dataItem, this.textField);
|
|
122
|
+
}
|
|
123
|
+
setToolbarClass(pos) {
|
|
124
|
+
Object.keys(toolbarClasses).forEach((className) => {
|
|
125
|
+
if (pos === className) {
|
|
126
|
+
this.renderer.addClass(this.hostElement.nativeElement, toolbarClasses[className]);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.renderer.removeClass(this.hostElement.nativeElement, toolbarClasses[className]);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
tslib_1.__decorate([
|
|
135
|
+
HostBinding('class.k-listbox'),
|
|
136
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
137
|
+
], ListBoxComponent.prototype, "listboxClassName", void 0);
|
|
138
|
+
tslib_1.__decorate([
|
|
139
|
+
ContentChild(ItemTemplateDirective, { static: false }),
|
|
140
|
+
tslib_1.__metadata("design:type", ItemTemplateDirective)
|
|
141
|
+
], ListBoxComponent.prototype, "itemTemplate", void 0);
|
|
142
|
+
tslib_1.__decorate([
|
|
143
|
+
Input(),
|
|
144
|
+
tslib_1.__metadata("design:type", String)
|
|
145
|
+
], ListBoxComponent.prototype, "textField", void 0);
|
|
146
|
+
tslib_1.__decorate([
|
|
147
|
+
Input(),
|
|
148
|
+
tslib_1.__metadata("design:type", Array)
|
|
149
|
+
], ListBoxComponent.prototype, "data", void 0);
|
|
150
|
+
tslib_1.__decorate([
|
|
151
|
+
Input(),
|
|
152
|
+
tslib_1.__metadata("design:type", String)
|
|
153
|
+
], ListBoxComponent.prototype, "size", void 0);
|
|
154
|
+
tslib_1.__decorate([
|
|
155
|
+
Input(),
|
|
156
|
+
tslib_1.__metadata("design:type", Object),
|
|
157
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
158
|
+
], ListBoxComponent.prototype, "toolbar", null);
|
|
159
|
+
tslib_1.__decorate([
|
|
160
|
+
Input(),
|
|
161
|
+
tslib_1.__metadata("design:type", Function)
|
|
162
|
+
], ListBoxComponent.prototype, "itemDisabled", void 0);
|
|
163
|
+
tslib_1.__decorate([
|
|
164
|
+
Output(),
|
|
165
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
166
|
+
], ListBoxComponent.prototype, "selectionChange", void 0);
|
|
167
|
+
tslib_1.__decorate([
|
|
168
|
+
Output(),
|
|
169
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
170
|
+
], ListBoxComponent.prototype, "actionClick", void 0);
|
|
171
|
+
ListBoxComponent = tslib_1.__decorate([
|
|
172
|
+
Component({
|
|
173
|
+
selector: 'kendo-listbox',
|
|
174
|
+
providers: [ListBoxSelectionService],
|
|
175
|
+
template: `
|
|
176
|
+
<div class="k-listbox-toolbar" *ngIf="selectedTools.length > 0">
|
|
177
|
+
<ul class="k-reset">
|
|
178
|
+
<li *ngFor="let tool of selectedTools">
|
|
179
|
+
<button kendoButton [icon]="tool.icon" (click)="performAction(tool.name)"></button>
|
|
180
|
+
</li>
|
|
181
|
+
|
|
182
|
+
<!-- react moving items has a smoother removal of the style: https://www.telerik.com/kendo-react-ui/components/listbox/ -->
|
|
183
|
+
</ul>
|
|
184
|
+
</div>
|
|
185
|
+
<div class="k-list-scroller k-selectable">
|
|
186
|
+
<div class="{{ listClasses }}">
|
|
187
|
+
<div class="k-list-content">
|
|
188
|
+
<ul class="k-list-ul">
|
|
189
|
+
<li
|
|
190
|
+
class="k-list-item"
|
|
191
|
+
*ngFor="let item of data; let i = index;"
|
|
192
|
+
kendoListBoxItemSelectable
|
|
193
|
+
[index]="i"
|
|
194
|
+
[class.k-disabled]="itemDisabled(item)"
|
|
195
|
+
>
|
|
196
|
+
<ng-template *ngIf="itemTemplate; else defaultItemTemplate"
|
|
197
|
+
[templateContext]="{
|
|
198
|
+
templateRef: itemTemplate.templateRef,
|
|
199
|
+
$implicit: item
|
|
200
|
+
}">
|
|
201
|
+
</ng-template>
|
|
202
|
+
<ng-template #defaultItemTemplate>
|
|
203
|
+
<span class="k-list-item-text">{{ getText(item) }}</span>
|
|
204
|
+
</ng-template>
|
|
205
|
+
</li>
|
|
206
|
+
</ul>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
`
|
|
211
|
+
}),
|
|
212
|
+
tslib_1.__metadata("design:paramtypes", [ListBoxSelectionService,
|
|
213
|
+
Renderer2,
|
|
214
|
+
ElementRef])
|
|
215
|
+
], ListBoxComponent);
|
|
216
|
+
export { ListBoxComponent };
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the ListBox component.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ListBoxModule {
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { NgModule } from '@angular/core';
|
|
7
|
+
import { ListBoxComponent } from './listbox.component';
|
|
8
|
+
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
9
|
+
import { CommonModule } from '@angular/common';
|
|
10
|
+
import { ItemTemplateDirective } from './item-template.directive';
|
|
11
|
+
import { ItemSelectableDirective } from './item-selectable.directive';
|
|
12
|
+
import { DataBindingDirective } from './data-binding.directive';
|
|
13
|
+
/**
|
|
14
|
+
* Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the ListBox component.
|
|
15
|
+
*/
|
|
16
|
+
let ListBoxModule = class ListBoxModule {
|
|
17
|
+
};
|
|
18
|
+
ListBoxModule = tslib_1.__decorate([
|
|
19
|
+
NgModule({
|
|
20
|
+
imports: [ButtonsModule, CommonModule],
|
|
21
|
+
declarations: [ListBoxComponent, ItemTemplateDirective, ItemSelectableDirective, DataBindingDirective],
|
|
22
|
+
exports: [ListBoxComponent, ItemTemplateDirective, ItemSelectableDirective, DataBindingDirective]
|
|
23
|
+
})
|
|
24
|
+
], ListBoxModule);
|
|
25
|
+
export { 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
|
+
export { ListBoxComponent } from './listbox.component';
|
|
6
|
+
export { DataBindingDirective } from './data-binding.directive';
|
|
7
|
+
export { ListBoxModule } from './listbox.module';
|
|
8
|
+
export { ListBoxSize } from './size';
|
|
9
|
+
export { ActionName } from './toolbar';
|
|
10
|
+
export { ListBoxToolbarPosition } from './toolbar';
|
|
11
|
+
export { Toolbar } from './toolbar';
|
|
12
|
+
export { ListBoxToolbarConfig } from './toolbar';
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
export { ListBoxComponent } from './listbox.component';
|
|
6
|
+
export { DataBindingDirective } from './data-binding.directive';
|
|
7
|
+
export { ListBoxModule } from './listbox.module';
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
import { PackageMetadata } from '@progress/kendo-licensing';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export declare const packageMetadata: PackageMetadata;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
export const packageMetadata = {
|
|
9
|
+
name: '@progress/kendo-angular-listbox',
|
|
10
|
+
productName: 'Kendo UI for Angular',
|
|
11
|
+
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
+
publishDate: 1649835747,
|
|
13
|
+
version: '',
|
|
14
|
+
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'
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import { EventEmitter } from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* The event fired by the ListBox component when the user makes a new selection.
|
|
8
|
+
*/
|
|
9
|
+
export interface ListBoxSelectionEvent {
|
|
10
|
+
index: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export declare class ListBoxSelectionService {
|
|
16
|
+
onSelect: EventEmitter<ListBoxSelectionEvent>;
|
|
17
|
+
selectedIndex: number;
|
|
18
|
+
select(index: number): void;
|
|
19
|
+
isSelected(index: number): boolean;
|
|
20
|
+
clearSelection(): void;
|
|
21
|
+
}
|
|
@@ -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
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { EventEmitter, Injectable } from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
let ListBoxSelectionService = class ListBoxSelectionService {
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
constructor() {
|
|
15
|
+
this.onSelect = new EventEmitter();
|
|
16
|
+
this.selectedIndex = null;
|
|
17
|
+
}
|
|
18
|
+
select(index) {
|
|
19
|
+
this.selectedIndex = index;
|
|
20
|
+
this.onSelect.next({ index: this.selectedIndex });
|
|
21
|
+
}
|
|
22
|
+
isSelected(index) {
|
|
23
|
+
return index === this.selectedIndex;
|
|
24
|
+
}
|
|
25
|
+
clearSelection() {
|
|
26
|
+
this.selectedIndex = null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
ListBoxSelectionService = tslib_1.__decorate([
|
|
30
|
+
Injectable()
|
|
31
|
+
], ListBoxSelectionService);
|
|
32
|
+
export { ListBoxSelectionService };
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Represents the possible size options of the ListBox.
|
|
7
|
+
*
|
|
8
|
+
* The possible values are:
|
|
9
|
+
* - `'small'`
|
|
10
|
+
* - `'medium'`
|
|
11
|
+
* - `'large'`
|
|
12
|
+
*/
|
|
13
|
+
export declare type ListBoxSize = 'small' | 'medium' | 'large';
|
|
@@ -0,0 +1,4 @@
|
|
|
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
|
+
*-------------------------------------------------------------------------------------------*/
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Represents the possible toolbar buttons that the ListBox can display.
|
|
7
|
+
*/
|
|
8
|
+
export declare type ActionName = 'moveUp' | 'moveDown' | 'transferTo' | 'transferFrom' | 'transferAllTo' | 'transferAllFrom' | 'remove';
|
|
9
|
+
/**
|
|
10
|
+
* Represents the possible values for customizing the toolbar position of the ListBox component.
|
|
11
|
+
*/
|
|
12
|
+
export declare type ListBoxToolbarPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
13
|
+
/**
|
|
14
|
+
* The possible tool and position settings that the ListBox can accept for its built-in toolbar.
|
|
15
|
+
*/
|
|
16
|
+
export interface Toolbar {
|
|
17
|
+
/**
|
|
18
|
+
* The set of tools to be displayed in the toolbar.
|
|
19
|
+
* If not specified, all tools will be included.
|
|
20
|
+
*/
|
|
21
|
+
tools?: ActionName[];
|
|
22
|
+
/**
|
|
23
|
+
* The position of the toolbar.
|
|
24
|
+
*/
|
|
25
|
+
position?: ListBoxToolbarPosition;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The possible values that the ListBox can accept for its built-in toolbar.
|
|
29
|
+
*
|
|
30
|
+
* - Use `false` to hide the toolbar.
|
|
31
|
+
* - Omit the setting or use `true` to show the default settings, which are the full set of possible tools and position `"right"`.
|
|
32
|
+
* - Use a config object of type [`Toolbar`]({% slug api_listbox_toolbar %}) to specify tools or position. If only [`tools`]({% slug api_listbox_toolbar %}#toc-tools) or [`position`]({% slug api_listbox_toolbar %}#toc-position) is specified, the other will use its default value.
|
|
33
|
+
*/
|
|
34
|
+
export declare type ListBoxToolbarConfig = boolean | Toolbar;
|
|
35
|
+
/**
|
|
36
|
+
* @hidden
|
|
37
|
+
*/
|
|
38
|
+
export interface Tool {
|
|
39
|
+
name: ActionName;
|
|
40
|
+
label: string;
|
|
41
|
+
icon: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
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
|
+
*-------------------------------------------------------------------------------------------*/
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { ActionName } from './toolbar';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export declare const isPresent: Function;
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export declare const isObject: Function;
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export declare const fieldAccessor: (dataItem: any, field: string) => any;
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export declare const defaultItemDisabled: () => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
export declare type StringKeyObject = {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export declare const getTools: (names: ActionName[]) => import("./toolbar").Tool[];
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
import { getter } from '@progress/kendo-common';
|
|
6
|
+
import { allTools } from './constants';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export const isPresent = (value) => value !== null && value !== undefined;
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export const isObject = (value) => isPresent(value) && typeof value === 'object';
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export const fieldAccessor = (dataItem, field) => {
|
|
19
|
+
if (!isPresent(dataItem)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (!isPresent(field) || !isObject(dataItem)) {
|
|
23
|
+
return dataItem;
|
|
24
|
+
}
|
|
25
|
+
// creates a field accessor supporting nested fields processing
|
|
26
|
+
const valueFrom = getter(field);
|
|
27
|
+
return valueFrom(dataItem);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
export const defaultItemDisabled = () => false;
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
export const getTools = (names) => {
|
|
37
|
+
return names.map(tool => allTools.find(meta => meta.name === tool));
|
|
38
|
+
};
|