@progress/kendo-angular-navigation 2.0.3-dev.202210121055 → 2.1.0-dev.202210170736
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/actionsheet/actionsheet.component.d.ts +92 -0
- package/actionsheet/item.component.d.ts +19 -0
- package/actionsheet/list.component.d.ts +27 -0
- package/actionsheet/models/actionsheet-item.interface.d.ts +57 -0
- package/actionsheet/models/group.d.ts +5 -0
- package/actionsheet/models/index.d.ts +9 -0
- package/actionsheet/models/item-click.event.d.ts +18 -0
- package/actionsheet/templates/item-template.directive.d.ts +17 -0
- package/actionsheet/templates/title-template.directive.d.ts +17 -0
- package/actionsheet.module.d.ts +48 -0
- package/bundles/kendo-angular-navigation.umd.js +1 -1
- package/common/util.d.ts +16 -0
- package/esm2015/actionsheet/actionsheet.component.js +290 -0
- package/esm2015/actionsheet/item.component.js +108 -0
- package/esm2015/actionsheet/list.component.js +91 -0
- package/esm2015/actionsheet/models/actionsheet-item.interface.js +5 -0
- package/esm2015/actionsheet/models/group.js +5 -0
- package/esm2015/actionsheet/models/index.js +7 -0
- package/esm2015/actionsheet/models/item-click.event.js +9 -0
- package/esm2015/actionsheet/templates/item-template.directive.js +26 -0
- package/esm2015/actionsheet/templates/title-template.directive.js +26 -0
- package/esm2015/actionsheet.module.js +72 -0
- package/esm2015/common/util.js +63 -0
- package/esm2015/main.js +6 -0
- package/esm2015/navigation.module.js +7 -3
- package/esm2015/package-metadata.js +1 -1
- package/fesm2015/kendo-angular-navigation.js +656 -23
- package/main.d.ts +5 -0
- package/navigation.module.d.ts +2 -1
- package/package.json +1 -1
package/common/util.d.ts
CHANGED
|
@@ -10,3 +10,19 @@ export declare const isPresent: (value: any) => boolean;
|
|
|
10
10
|
* @hidden
|
|
11
11
|
*/
|
|
12
12
|
export declare const outerWidth: (element: HTMLElement) => number;
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export declare const getFirstAndLastFocusable: (parent: any) => Array<HTMLElement>;
|
|
17
|
+
/**
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
export declare const hexColorRegex: RegExp;
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export declare const getId: (prefix: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export declare const getActionSheetItemIndex: (target: HTMLElement) => number;
|
|
@@ -0,0 +1,290 @@
|
|
|
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 { Component, ContentChild, EventEmitter, HostBinding, Input, Output } from '@angular/core';
|
|
6
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
7
|
+
import { packageMetadata } from '../package-metadata';
|
|
8
|
+
import { Subscription } from 'rxjs';
|
|
9
|
+
import { ActionSheetTitleTemplateDirective, ActionSheetItemTemplateDirective } from './models';
|
|
10
|
+
import { Keys } from '@progress/kendo-angular-common';
|
|
11
|
+
import { getId, getActionSheetItemIndex, getFirstAndLastFocusable } from '../common/util';
|
|
12
|
+
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
15
|
+
import * as i2 from "./list.component";
|
|
16
|
+
import * as i3 from "@angular/common";
|
|
17
|
+
/**
|
|
18
|
+
* Represents the [Kendo UI ActionSheet component for Angular]({% slug overview_actionsheet %}).
|
|
19
|
+
* Used to display a set of choices related to a task the user initiates.
|
|
20
|
+
*/
|
|
21
|
+
export class ActionSheetComponent {
|
|
22
|
+
constructor(element, ngZone, renderer, localizationService) {
|
|
23
|
+
this.element = element;
|
|
24
|
+
this.ngZone = ngZone;
|
|
25
|
+
this.renderer = renderer;
|
|
26
|
+
this.localizationService = localizationService;
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
this.hostClass = true;
|
|
31
|
+
/**
|
|
32
|
+
* Fires when an ActionSheet item is clicked.
|
|
33
|
+
*/
|
|
34
|
+
this.itemClick = new EventEmitter();
|
|
35
|
+
/**
|
|
36
|
+
* Fires when the modal overlay is clicked.
|
|
37
|
+
*/
|
|
38
|
+
this.overlayClick = new EventEmitter();
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
this.titleId = null;
|
|
43
|
+
this.rtl = false;
|
|
44
|
+
this.domSubs = new Subscription();
|
|
45
|
+
validatePackage(packageMetadata);
|
|
46
|
+
this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
|
|
47
|
+
this.rtl = rtl;
|
|
48
|
+
this.direction = this.rtl ? 'rtl' : 'ltr';
|
|
49
|
+
});
|
|
50
|
+
this.titleId = getId('k-actionsheet-title');
|
|
51
|
+
}
|
|
52
|
+
ngAfterViewInit() {
|
|
53
|
+
this.handleInitialFocus();
|
|
54
|
+
this.initDomEvents();
|
|
55
|
+
}
|
|
56
|
+
ngOnDestroy() {
|
|
57
|
+
this.domSubs.unsubscribe();
|
|
58
|
+
if (this.dynamicRTLSubscription) {
|
|
59
|
+
this.dynamicRTLSubscription.unsubscribe();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @hidden
|
|
64
|
+
*/
|
|
65
|
+
get topGroupItems() {
|
|
66
|
+
var _a;
|
|
67
|
+
return (_a = this.items) === null || _a === void 0 ? void 0 : _a.filter(item => !item.group || item.group === 'top');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @hidden
|
|
71
|
+
*/
|
|
72
|
+
get bottomGroupItems() {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = this.items) === null || _a === void 0 ? void 0 : _a.filter(item => item.group === 'bottom');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @hidden
|
|
78
|
+
*/
|
|
79
|
+
onItemClick(ev) {
|
|
80
|
+
this.itemClick.emit(ev);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @hidden
|
|
84
|
+
*/
|
|
85
|
+
onOverlayClick() {
|
|
86
|
+
this.overlayClick.emit();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @hidden
|
|
90
|
+
*/
|
|
91
|
+
get shouldRenderSeparator() {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
return ((_a = this.topGroupItems) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((_b = this.bottomGroupItems) === null || _b === void 0 ? void 0 : _b.length) > 0;
|
|
94
|
+
}
|
|
95
|
+
initDomEvents() {
|
|
96
|
+
if (!this.element) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.ngZone.runOutsideAngular(() => {
|
|
100
|
+
this.domSubs.add(this.renderer.listen(this.element.nativeElement, 'keydown', (ev) => {
|
|
101
|
+
this.onKeyDown(ev);
|
|
102
|
+
}));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
onKeyDown(event) {
|
|
106
|
+
const target = event.target;
|
|
107
|
+
if (event.keyCode === Keys.Tab) {
|
|
108
|
+
this.ngZone.run(() => {
|
|
109
|
+
this.keepFocusWithinComponent(target, event);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (event.keyCode === Keys.Escape) {
|
|
113
|
+
this.ngZone.run(() => {
|
|
114
|
+
this.overlayClick.emit();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (event.keyCode === Keys.Enter) {
|
|
118
|
+
this.ngZone.run(() => {
|
|
119
|
+
this.triggerItemClick(target, event);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
handleInitialFocus() {
|
|
124
|
+
const [firstFocusable] = getFirstAndLastFocusable(this.element.nativeElement);
|
|
125
|
+
if (firstFocusable) {
|
|
126
|
+
firstFocusable.focus();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
keepFocusWithinComponent(target, event) {
|
|
130
|
+
const wrapper = this.element.nativeElement;
|
|
131
|
+
const [firstFocusable, lastFocusable] = getFirstAndLastFocusable(wrapper);
|
|
132
|
+
const tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
|
|
133
|
+
const shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
|
|
134
|
+
if (tabAfterLastFocusable) {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
firstFocusable.focus();
|
|
137
|
+
}
|
|
138
|
+
if (shiftTabAfterFirstFocusable) {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
lastFocusable.focus();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
triggerItemClick(target, event) {
|
|
144
|
+
const itemIndex = getActionSheetItemIndex(target);
|
|
145
|
+
const item = this.items[itemIndex];
|
|
146
|
+
if (!item || item.disabled) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.itemClick.emit({ item, originalEvent: event });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
ActionSheetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
153
|
+
ActionSheetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ActionSheetComponent, selector: "kendo-actionsheet", inputs: { title: "title", subtitle: "subtitle", items: "items" }, outputs: { itemClick: "itemClick", overlayClick: "overlayClick" }, host: { properties: { "class.k-actionsheet-container": "this.hostClass", "attr.dir": "this.direction" } }, providers: [
|
|
154
|
+
LocalizationService,
|
|
155
|
+
{
|
|
156
|
+
provide: L10N_PREFIX,
|
|
157
|
+
useValue: 'kendo.actionsheet.component'
|
|
158
|
+
}
|
|
159
|
+
], queries: [{ propertyName: "titleTemplate", first: true, predicate: ActionSheetTitleTemplateDirective, descendants: true }, { propertyName: "itemTemplate", first: true, predicate: ActionSheetItemTemplateDirective, descendants: true }], exportAs: ["kendoActionSheet"], ngImport: i0, template: `
|
|
160
|
+
<div class="k-overlay" (click)="onOverlayClick()"></div>
|
|
161
|
+
<div class="k-animation-container">
|
|
162
|
+
<div class="k-child-animation-container">
|
|
163
|
+
<div class="k-actionsheet k-actionsheet-bottom"
|
|
164
|
+
role="dialog"
|
|
165
|
+
aria-modal="true"
|
|
166
|
+
[attr.aria-labelledby]="titleId">
|
|
167
|
+
|
|
168
|
+
<div *ngIf="title || titleTemplate" class="k-actionsheet-titlebar">
|
|
169
|
+
<div class="k-actionsheet-titlebar-group k-hbox">
|
|
170
|
+
<div class="k-actionsheet-title" [id]="titleId">
|
|
171
|
+
<ng-template *ngIf="titleTemplate; else defaultTemplate"
|
|
172
|
+
[ngTemplateOutlet]="titleTemplate?.templateRef">
|
|
173
|
+
</ng-template>
|
|
174
|
+
<ng-template #defaultTemplate>
|
|
175
|
+
<div *ngIf="title" class="k-text-center">{{title}}</div>
|
|
176
|
+
<div *ngIf="subtitle" class="k-actionsheet-subtitle k-text-center">{{subtitle}}</div>
|
|
177
|
+
</ng-template>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<div *ngIf="topGroupItems || bottomGroupItems" class="k-actionsheet-content">
|
|
183
|
+
<ul *ngIf="topGroupItems" kendoActionSheetList
|
|
184
|
+
class="k-list-ul"
|
|
185
|
+
role="group"
|
|
186
|
+
[groupItems]="topGroupItems"
|
|
187
|
+
[allItems]="items"
|
|
188
|
+
[itemTemplate]="itemTemplate?.templateRef"
|
|
189
|
+
(itemClick)="onItemClick($event)">
|
|
190
|
+
</ul>
|
|
191
|
+
|
|
192
|
+
<hr *ngIf="shouldRenderSeparator" class="k-hr"/>
|
|
193
|
+
|
|
194
|
+
<ul *ngIf="bottomGroupItems" kendoActionSheetList
|
|
195
|
+
class="k-list-ul"
|
|
196
|
+
role="group"
|
|
197
|
+
[groupItems]="bottomGroupItems"
|
|
198
|
+
[allItems]="items"
|
|
199
|
+
[itemTemplate]="itemTemplate?.templateRef"
|
|
200
|
+
(itemClick)="onItemClick($event)">
|
|
201
|
+
</ul>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
`, isInline: true, components: [{ type: i2.ActionSheetListComponent, selector: "[kendoActionSheetList]", inputs: ["groupItems", "allItems", "itemTemplate"], outputs: ["itemClick"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetComponent, decorators: [{
|
|
208
|
+
type: Component,
|
|
209
|
+
args: [{
|
|
210
|
+
exportAs: 'kendoActionSheet',
|
|
211
|
+
selector: 'kendo-actionsheet',
|
|
212
|
+
template: `
|
|
213
|
+
<div class="k-overlay" (click)="onOverlayClick()"></div>
|
|
214
|
+
<div class="k-animation-container">
|
|
215
|
+
<div class="k-child-animation-container">
|
|
216
|
+
<div class="k-actionsheet k-actionsheet-bottom"
|
|
217
|
+
role="dialog"
|
|
218
|
+
aria-modal="true"
|
|
219
|
+
[attr.aria-labelledby]="titleId">
|
|
220
|
+
|
|
221
|
+
<div *ngIf="title || titleTemplate" class="k-actionsheet-titlebar">
|
|
222
|
+
<div class="k-actionsheet-titlebar-group k-hbox">
|
|
223
|
+
<div class="k-actionsheet-title" [id]="titleId">
|
|
224
|
+
<ng-template *ngIf="titleTemplate; else defaultTemplate"
|
|
225
|
+
[ngTemplateOutlet]="titleTemplate?.templateRef">
|
|
226
|
+
</ng-template>
|
|
227
|
+
<ng-template #defaultTemplate>
|
|
228
|
+
<div *ngIf="title" class="k-text-center">{{title}}</div>
|
|
229
|
+
<div *ngIf="subtitle" class="k-actionsheet-subtitle k-text-center">{{subtitle}}</div>
|
|
230
|
+
</ng-template>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<div *ngIf="topGroupItems || bottomGroupItems" class="k-actionsheet-content">
|
|
236
|
+
<ul *ngIf="topGroupItems" kendoActionSheetList
|
|
237
|
+
class="k-list-ul"
|
|
238
|
+
role="group"
|
|
239
|
+
[groupItems]="topGroupItems"
|
|
240
|
+
[allItems]="items"
|
|
241
|
+
[itemTemplate]="itemTemplate?.templateRef"
|
|
242
|
+
(itemClick)="onItemClick($event)">
|
|
243
|
+
</ul>
|
|
244
|
+
|
|
245
|
+
<hr *ngIf="shouldRenderSeparator" class="k-hr"/>
|
|
246
|
+
|
|
247
|
+
<ul *ngIf="bottomGroupItems" kendoActionSheetList
|
|
248
|
+
class="k-list-ul"
|
|
249
|
+
role="group"
|
|
250
|
+
[groupItems]="bottomGroupItems"
|
|
251
|
+
[allItems]="items"
|
|
252
|
+
[itemTemplate]="itemTemplate?.templateRef"
|
|
253
|
+
(itemClick)="onItemClick($event)">
|
|
254
|
+
</ul>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
`,
|
|
260
|
+
providers: [
|
|
261
|
+
LocalizationService,
|
|
262
|
+
{
|
|
263
|
+
provide: L10N_PREFIX,
|
|
264
|
+
useValue: 'kendo.actionsheet.component'
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
}]
|
|
268
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.LocalizationService }]; }, propDecorators: { hostClass: [{
|
|
269
|
+
type: HostBinding,
|
|
270
|
+
args: ['class.k-actionsheet-container']
|
|
271
|
+
}], direction: [{
|
|
272
|
+
type: HostBinding,
|
|
273
|
+
args: ['attr.dir']
|
|
274
|
+
}], title: [{
|
|
275
|
+
type: Input
|
|
276
|
+
}], subtitle: [{
|
|
277
|
+
type: Input
|
|
278
|
+
}], items: [{
|
|
279
|
+
type: Input
|
|
280
|
+
}], itemClick: [{
|
|
281
|
+
type: Output
|
|
282
|
+
}], overlayClick: [{
|
|
283
|
+
type: Output
|
|
284
|
+
}], titleTemplate: [{
|
|
285
|
+
type: ContentChild,
|
|
286
|
+
args: [ActionSheetTitleTemplateDirective]
|
|
287
|
+
}], itemTemplate: [{
|
|
288
|
+
type: ContentChild,
|
|
289
|
+
args: [ActionSheetItemTemplateDirective]
|
|
290
|
+
}] } });
|
|
@@ -0,0 +1,108 @@
|
|
|
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 { Component, Input, HostBinding } from "@angular/core";
|
|
6
|
+
import { isPresent, hexColorRegex } from "../common/util";
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "@angular/common";
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export class ActionSheetItemComponent {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.pointerClass = true;
|
|
15
|
+
}
|
|
16
|
+
manageIconClasses(item) {
|
|
17
|
+
let classes = ['k-actionsheet-item-icon'];
|
|
18
|
+
if (item.icon) {
|
|
19
|
+
classes.push(`k-icon k-i-${item.icon}`);
|
|
20
|
+
}
|
|
21
|
+
if (item.iconClass) {
|
|
22
|
+
classes.push(`${item.iconClass}`);
|
|
23
|
+
}
|
|
24
|
+
const isHexColor = isPresent(item.iconColor) && hexColorRegex.test(item.iconColor);
|
|
25
|
+
const isThemeColor = isPresent(item.iconColor) && item.iconColor !== '' && !isHexColor;
|
|
26
|
+
if (isThemeColor) {
|
|
27
|
+
classes.push(`k-text-${item.iconColor}`);
|
|
28
|
+
}
|
|
29
|
+
return classes.join(' ');
|
|
30
|
+
}
|
|
31
|
+
manageIconStyles(item) {
|
|
32
|
+
const isHexColor = isPresent(item.iconColor) && hexColorRegex.test(item.iconColor);
|
|
33
|
+
const isSizeSet = isPresent(item.iconSize) && item.iconSize !== '';
|
|
34
|
+
const styles = {};
|
|
35
|
+
if (isHexColor) {
|
|
36
|
+
styles.color = item.iconColor;
|
|
37
|
+
}
|
|
38
|
+
if (isSizeSet) {
|
|
39
|
+
styles.fontSize = item.iconSize;
|
|
40
|
+
}
|
|
41
|
+
return styles;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
ActionSheetItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
45
|
+
ActionSheetItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ActionSheetItemComponent, selector: "[kendoActionSheetItem]", inputs: { itemTemplate: "itemTemplate", item: "item" }, host: { properties: { "class.k-cursor-pointer": "this.pointerClass" } }, ngImport: i0, template: `
|
|
46
|
+
<span class="k-actionsheet-action"
|
|
47
|
+
tabindex="0"
|
|
48
|
+
role="button"
|
|
49
|
+
[attr.aria-disabled]="item.disabled">
|
|
50
|
+
<ng-template *ngIf="itemTemplate; else defaultTemplate"
|
|
51
|
+
[ngTemplateOutlet]="itemTemplate"
|
|
52
|
+
[ngTemplateOutletContext]="{
|
|
53
|
+
$implicit: item
|
|
54
|
+
}">
|
|
55
|
+
</ng-template>
|
|
56
|
+
<ng-template #defaultTemplate>
|
|
57
|
+
<span *ngIf="item.icon || item.iconClass" class="k-icon-wrap">
|
|
58
|
+
<span
|
|
59
|
+
[class]="manageIconClasses(item)"
|
|
60
|
+
[style]="manageIconStyles(item)">
|
|
61
|
+
</span>
|
|
62
|
+
</span>
|
|
63
|
+
<span *ngIf="item.title || item.description" class="k-actionsheet-item-text">
|
|
64
|
+
<span *ngIf="item.title" class="k-actionsheet-item-title">{{item.title}}</span>
|
|
65
|
+
<span *ngIf="item.description" class="k-actionsheet-item-description">{{item.description}}</span>
|
|
66
|
+
</span>
|
|
67
|
+
</ng-template>
|
|
68
|
+
</span>
|
|
69
|
+
`, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetItemComponent, decorators: [{
|
|
71
|
+
type: Component,
|
|
72
|
+
args: [{
|
|
73
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
74
|
+
selector: '[kendoActionSheetItem]',
|
|
75
|
+
template: `
|
|
76
|
+
<span class="k-actionsheet-action"
|
|
77
|
+
tabindex="0"
|
|
78
|
+
role="button"
|
|
79
|
+
[attr.aria-disabled]="item.disabled">
|
|
80
|
+
<ng-template *ngIf="itemTemplate; else defaultTemplate"
|
|
81
|
+
[ngTemplateOutlet]="itemTemplate"
|
|
82
|
+
[ngTemplateOutletContext]="{
|
|
83
|
+
$implicit: item
|
|
84
|
+
}">
|
|
85
|
+
</ng-template>
|
|
86
|
+
<ng-template #defaultTemplate>
|
|
87
|
+
<span *ngIf="item.icon || item.iconClass" class="k-icon-wrap">
|
|
88
|
+
<span
|
|
89
|
+
[class]="manageIconClasses(item)"
|
|
90
|
+
[style]="manageIconStyles(item)">
|
|
91
|
+
</span>
|
|
92
|
+
</span>
|
|
93
|
+
<span *ngIf="item.title || item.description" class="k-actionsheet-item-text">
|
|
94
|
+
<span *ngIf="item.title" class="k-actionsheet-item-title">{{item.title}}</span>
|
|
95
|
+
<span *ngIf="item.description" class="k-actionsheet-item-description">{{item.description}}</span>
|
|
96
|
+
</span>
|
|
97
|
+
</ng-template>
|
|
98
|
+
</span>
|
|
99
|
+
`
|
|
100
|
+
}]
|
|
101
|
+
}], propDecorators: { itemTemplate: [{
|
|
102
|
+
type: Input
|
|
103
|
+
}], item: [{
|
|
104
|
+
type: Input
|
|
105
|
+
}], pointerClass: [{
|
|
106
|
+
type: HostBinding,
|
|
107
|
+
args: ['class.k-cursor-pointer']
|
|
108
|
+
}] } });
|
|
@@ -0,0 +1,91 @@
|
|
|
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 { Component, Input, Output, EventEmitter } from "@angular/core";
|
|
6
|
+
import { Subscription } from "rxjs";
|
|
7
|
+
import { getActionSheetItemIndex } from "../common/util";
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
import * as i1 from "./item.component";
|
|
10
|
+
import * as i2 from "@angular/common";
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export class ActionSheetListComponent {
|
|
15
|
+
constructor(renderer, ngZone, element) {
|
|
16
|
+
this.renderer = renderer;
|
|
17
|
+
this.ngZone = ngZone;
|
|
18
|
+
this.element = element;
|
|
19
|
+
this.groupItems = [];
|
|
20
|
+
this.allItems = [];
|
|
21
|
+
this.itemClick = new EventEmitter();
|
|
22
|
+
this.subscriptions = new Subscription();
|
|
23
|
+
}
|
|
24
|
+
ngAfterViewInit() {
|
|
25
|
+
this.initDomEvents();
|
|
26
|
+
}
|
|
27
|
+
ngOnDestroy() {
|
|
28
|
+
this.subscriptions.unsubscribe();
|
|
29
|
+
}
|
|
30
|
+
initDomEvents() {
|
|
31
|
+
if (!this.element) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.ngZone.runOutsideAngular(() => {
|
|
35
|
+
const nativeElement = this.element.nativeElement;
|
|
36
|
+
this.subscriptions.add(this.renderer.listen(nativeElement, 'click', this.clickHandler.bind(this)));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
clickHandler(e) {
|
|
40
|
+
const itemIndex = getActionSheetItemIndex(e.target);
|
|
41
|
+
const item = this.allItems[itemIndex];
|
|
42
|
+
if (!item) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (item.disabled) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.ngZone.run(() => {
|
|
50
|
+
this.itemClick.emit({ item, originalEvent: e });
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
ActionSheetListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetListComponent, deps: [{ token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
55
|
+
ActionSheetListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ActionSheetListComponent, selector: "[kendoActionSheetList]", inputs: { groupItems: "groupItems", allItems: "allItems", itemTemplate: "itemTemplate" }, outputs: { itemClick: "itemClick" }, ngImport: i0, template: `
|
|
56
|
+
<li *ngFor="let item of groupItems" kendoActionSheetItem
|
|
57
|
+
role="none"
|
|
58
|
+
[class.k-actionsheet-item]="true"
|
|
59
|
+
[class.k-disabled]="item.disabled"
|
|
60
|
+
[ngClass]="item.cssClass"
|
|
61
|
+
[ngStyle]="item.cssStyle"
|
|
62
|
+
[itemTemplate]="itemTemplate"
|
|
63
|
+
[item]="item">
|
|
64
|
+
</li>
|
|
65
|
+
`, isInline: true, components: [{ type: i1.ActionSheetItemComponent, selector: "[kendoActionSheetItem]", inputs: ["itemTemplate", "item"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetListComponent, decorators: [{
|
|
67
|
+
type: Component,
|
|
68
|
+
args: [{
|
|
69
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
70
|
+
selector: '[kendoActionSheetList]',
|
|
71
|
+
template: `
|
|
72
|
+
<li *ngFor="let item of groupItems" kendoActionSheetItem
|
|
73
|
+
role="none"
|
|
74
|
+
[class.k-actionsheet-item]="true"
|
|
75
|
+
[class.k-disabled]="item.disabled"
|
|
76
|
+
[ngClass]="item.cssClass"
|
|
77
|
+
[ngStyle]="item.cssStyle"
|
|
78
|
+
[itemTemplate]="itemTemplate"
|
|
79
|
+
[item]="item">
|
|
80
|
+
</li>
|
|
81
|
+
`
|
|
82
|
+
}]
|
|
83
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { groupItems: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}], allItems: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}], itemTemplate: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}], itemClick: [{
|
|
90
|
+
type: Output
|
|
91
|
+
}] } });
|
|
@@ -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
|
+
export {};
|
|
@@ -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
|
+
export {};
|
|
@@ -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 { ActionSheetItemClickEvent } from './item-click.event';
|
|
6
|
+
export { ActionSheetTitleTemplateDirective } from '../templates/title-template.directive';
|
|
7
|
+
export { ActionSheetItemTemplateDirective } from '../templates/item-template.directive';
|
|
@@ -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
|
+
* Arguments for the `itemClick` event of the ActionSheet.
|
|
7
|
+
*/
|
|
8
|
+
export class ActionSheetItemClickEvent {
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { Directive, Optional } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Represents a template that defines the item content of the ActionSheet.
|
|
9
|
+
* To define the template, nest an `<ng-template>` tag
|
|
10
|
+
* with the `kendoActionSheetItemTemplate` directive inside the `<kendo-actionsheet>` tag.
|
|
11
|
+
*/
|
|
12
|
+
export class ActionSheetItemTemplateDirective {
|
|
13
|
+
constructor(templateRef) {
|
|
14
|
+
this.templateRef = templateRef;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
ActionSheetItemTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetItemTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
18
|
+
ActionSheetItemTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ActionSheetItemTemplateDirective, selector: "[kendoActionSheetItemTemplate]", ngImport: i0 });
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetItemTemplateDirective, decorators: [{
|
|
20
|
+
type: Directive,
|
|
21
|
+
args: [{
|
|
22
|
+
selector: '[kendoActionSheetItemTemplate]'
|
|
23
|
+
}]
|
|
24
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
25
|
+
type: Optional
|
|
26
|
+
}] }]; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { Directive, Optional } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Represents a template that defines the title content of the ActionSheet. Utilizing the template overrides both the `title` and `subtitle` of the ActionSheet.
|
|
9
|
+
* To define the template, nest an `<ng-template>` tag
|
|
10
|
+
* with the `kendoActionSheetTitleTemplate` directive inside the `<kendo-actionsheet>` tag.
|
|
11
|
+
*/
|
|
12
|
+
export class ActionSheetTitleTemplateDirective {
|
|
13
|
+
constructor(templateRef) {
|
|
14
|
+
this.templateRef = templateRef;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
ActionSheetTitleTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetTitleTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
18
|
+
ActionSheetTitleTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ActionSheetTitleTemplateDirective, selector: "[kendoActionSheetTitleTemplate]", ngImport: i0 });
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionSheetTitleTemplateDirective, decorators: [{
|
|
20
|
+
type: Directive,
|
|
21
|
+
args: [{
|
|
22
|
+
selector: '[kendoActionSheetTitleTemplate]'
|
|
23
|
+
}]
|
|
24
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
25
|
+
type: Optional
|
|
26
|
+
}] }]; } });
|