@progress/kendo-angular-layout 7.0.0-next.202204011521 → 7.0.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/avatar/avatar.component.d.ts +4 -5
- package/avatar/models/fill.d.ts +1 -1
- package/avatar/models/rounded.d.ts +1 -1
- package/avatar/models/size.d.ts +1 -1
- package/avatar/models/theme-color.d.ts +1 -1
- package/bundles/kendo-angular-layout.umd.js +1 -1
- package/common/preventable-event.d.ts +28 -0
- package/esm2015/avatar/avatar.component.js +24 -17
- package/esm2015/common/preventable-event.js +34 -0
- package/esm2015/common/util.js +3 -3
- package/esm2015/main.js +1 -0
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/panelbar/events/collapse-event.js +10 -0
- package/esm2015/panelbar/events/expand-event.js +10 -0
- package/esm2015/panelbar/events/select-event.js +10 -0
- package/esm2015/panelbar/events/state-change-event.js +9 -0
- package/esm2015/panelbar/events.js +8 -0
- package/esm2015/panelbar/panelbar-item.component.js +32 -2
- package/esm2015/panelbar/panelbar.component.js +145 -55
- package/fesm2015/kendo-angular-layout.js +270 -89
- package/main.d.ts +1 -0
- package/package.json +9 -11
- package/panelbar/events/collapse-event.d.ts +15 -0
- package/panelbar/events/expand-event.d.ts +15 -0
- package/panelbar/events/select-event.d.ts +15 -0
- package/panelbar/events/state-change-event.d.ts +14 -0
- package/panelbar/events.d.ts +8 -0
- package/panelbar/panelbar.component.d.ts +26 -3
|
@@ -0,0 +1,28 @@
|
|
|
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 declare class PreventableEvent {
|
|
9
|
+
private prevented;
|
|
10
|
+
/**
|
|
11
|
+
* Prevents the default action for a specified event.
|
|
12
|
+
* In this way, the source component suppresses
|
|
13
|
+
* the built-in behavior that follows the event.
|
|
14
|
+
*/
|
|
15
|
+
preventDefault(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Returns `true` if the event was prevented
|
|
18
|
+
* by any of its subscribers.
|
|
19
|
+
*
|
|
20
|
+
* @returns `true` if the default action was prevented.
|
|
21
|
+
* Otherwise, returns `false`.
|
|
22
|
+
*/
|
|
23
|
+
isDefaultPrevented(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
constructor(args?: any);
|
|
28
|
+
}
|
|
@@ -8,6 +8,10 @@ import { getStylingClasses, mapShapeToRounded } from '../common/util';
|
|
|
8
8
|
import { packageMetadata } from '../package-metadata';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
10
|
import * as i1 from "@angular/common";
|
|
11
|
+
const DEFAULT_ROUNDED = 'full';
|
|
12
|
+
const DEFAULT_SIZE = 'medium';
|
|
13
|
+
const DEFAULT_THEME_COLOR = 'primary';
|
|
14
|
+
const DEFAULT_FILL_MODE = 'solid';
|
|
11
15
|
/**
|
|
12
16
|
* Displays images, icons or initials representing people or other entities.
|
|
13
17
|
*/
|
|
@@ -20,10 +24,10 @@ export class AvatarComponent {
|
|
|
20
24
|
* Sets a border to the avatar.
|
|
21
25
|
*/
|
|
22
26
|
this.border = false;
|
|
23
|
-
this._themeColor =
|
|
24
|
-
this._size =
|
|
25
|
-
this._fillMode =
|
|
26
|
-
this._rounded =
|
|
27
|
+
this._themeColor = DEFAULT_THEME_COLOR;
|
|
28
|
+
this._size = DEFAULT_SIZE;
|
|
29
|
+
this._fillMode = DEFAULT_FILL_MODE;
|
|
30
|
+
this._rounded = DEFAULT_ROUNDED;
|
|
27
31
|
validatePackage(packageMetadata);
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
@@ -53,12 +57,13 @@ export class AvatarComponent {
|
|
|
53
57
|
* * `small`
|
|
54
58
|
* * `medium` (Default)
|
|
55
59
|
* * `large`
|
|
56
|
-
*
|
|
60
|
+
* * `none`
|
|
57
61
|
*/
|
|
58
62
|
set size(size) {
|
|
59
63
|
if (size !== this._size) {
|
|
60
|
-
|
|
61
|
-
this.
|
|
64
|
+
const newSize = size ? size : DEFAULT_SIZE;
|
|
65
|
+
this.handleClasses('size', newSize);
|
|
66
|
+
this._size = newSize;
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
get size() {
|
|
@@ -73,13 +78,13 @@ export class AvatarComponent {
|
|
|
73
78
|
* * `medium`
|
|
74
79
|
* * `large`
|
|
75
80
|
* * `full` (Default)
|
|
76
|
-
* *
|
|
77
|
-
*
|
|
81
|
+
* * `none`
|
|
78
82
|
*/
|
|
79
83
|
set rounded(rounded) {
|
|
80
84
|
if (rounded !== this._rounded) {
|
|
81
|
-
|
|
82
|
-
this.
|
|
85
|
+
const newRounded = rounded ? rounded : DEFAULT_ROUNDED;
|
|
86
|
+
this.handleClasses('rounded', newRounded);
|
|
87
|
+
this._rounded = newRounded;
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
90
|
get rounded() {
|
|
@@ -101,10 +106,12 @@ export class AvatarComponent {
|
|
|
101
106
|
* * `dark`— Applies coloring based on dark theme color.
|
|
102
107
|
* * `light`— Applies coloring based on light theme color.
|
|
103
108
|
* * `inverse`— Applies coloring based on inverted theme color.
|
|
109
|
+
* * `none`— Removes the styling associated with the theme color.
|
|
104
110
|
*/
|
|
105
111
|
set themeColor(themeColor) {
|
|
106
112
|
if (themeColor !== this._themeColor) {
|
|
107
|
-
|
|
113
|
+
const newThemeColor = themeColor ? themeColor : DEFAULT_THEME_COLOR;
|
|
114
|
+
this._themeColor = newThemeColor;
|
|
108
115
|
this.handleFillModeAndThemeColorClasses(this.fillMode, this.themeColor);
|
|
109
116
|
}
|
|
110
117
|
}
|
|
@@ -117,12 +124,12 @@ export class AvatarComponent {
|
|
|
117
124
|
* The possible values are:
|
|
118
125
|
* * `solid` (Default)
|
|
119
126
|
* * `outline`
|
|
120
|
-
* *
|
|
121
|
-
*
|
|
127
|
+
* * `none`
|
|
122
128
|
*/
|
|
123
129
|
set fillMode(fillMode) {
|
|
124
130
|
if (fillMode !== this.fillMode) {
|
|
125
|
-
|
|
131
|
+
const newFillMode = fillMode ? fillMode : DEFAULT_FILL_MODE;
|
|
132
|
+
this._fillMode = newFillMode;
|
|
126
133
|
this.handleFillModeAndThemeColorClasses(this.fillMode, this.themeColor);
|
|
127
134
|
}
|
|
128
135
|
}
|
|
@@ -210,11 +217,11 @@ export class AvatarComponent {
|
|
|
210
217
|
});
|
|
211
218
|
classesToRemove.forEach((cl => this.renderer.removeClass(wrapperElement, cl)));
|
|
212
219
|
// add fill if needed
|
|
213
|
-
if (fill !==
|
|
220
|
+
if (fill !== 'none') {
|
|
214
221
|
this.renderer.addClass(wrapperElement, `k-avatar-${fill}`);
|
|
215
222
|
}
|
|
216
223
|
// add theme color class if fill and theme color
|
|
217
|
-
if (fill !==
|
|
224
|
+
if (fill !== 'none' && themeColor !== 'none') {
|
|
218
225
|
this.renderer.addClass(wrapperElement, `k-avatar-${fill}-${themeColor}`);
|
|
219
226
|
}
|
|
220
227
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 class PreventableEvent {
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
constructor(args) {
|
|
13
|
+
this.prevented = false;
|
|
14
|
+
Object.assign(this, args);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Prevents the default action for a specified event.
|
|
18
|
+
* In this way, the source component suppresses
|
|
19
|
+
* the built-in behavior that follows the event.
|
|
20
|
+
*/
|
|
21
|
+
preventDefault() {
|
|
22
|
+
this.prevented = true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns `true` if the event was prevented
|
|
26
|
+
* by any of its subscribers.
|
|
27
|
+
*
|
|
28
|
+
* @returns `true` if the default action was prevented.
|
|
29
|
+
* Otherwise, returns `false`.
|
|
30
|
+
*/
|
|
31
|
+
isDefaultPrevented() {
|
|
32
|
+
return this.prevented;
|
|
33
|
+
}
|
|
34
|
+
}
|
package/esm2015/common/util.js
CHANGED
|
@@ -64,12 +64,12 @@ export const getStylingClasses = (componentType, stylingOption, previousValue, n
|
|
|
64
64
|
case 'size':
|
|
65
65
|
return {
|
|
66
66
|
toRemove: `k-${componentType}-${SIZES[previousValue]}`,
|
|
67
|
-
toAdd: newValue ? `k-${componentType}-${SIZES[newValue]}` :
|
|
67
|
+
toAdd: newValue !== 'none' ? `k-${componentType}-${SIZES[newValue]}` : ''
|
|
68
68
|
};
|
|
69
69
|
case 'rounded':
|
|
70
70
|
return {
|
|
71
71
|
toRemove: `k-rounded-${ROUNDNESS[previousValue]}`,
|
|
72
|
-
toAdd: newValue ? `k-rounded-${ROUNDNESS[newValue]}` :
|
|
72
|
+
toAdd: newValue !== 'none' ? `k-rounded-${ROUNDNESS[newValue]}` : ''
|
|
73
73
|
};
|
|
74
74
|
default:
|
|
75
75
|
break;
|
|
@@ -78,7 +78,7 @@ export const getStylingClasses = (componentType, stylingOption, previousValue, n
|
|
|
78
78
|
/**
|
|
79
79
|
* @hidden
|
|
80
80
|
*/
|
|
81
|
-
export const mapShapeToRounded = (shape) => SHAPE_TO_ROUNDED[shape] ||
|
|
81
|
+
export const mapShapeToRounded = (shape) => SHAPE_TO_ROUNDED[shape] || 'none';
|
|
82
82
|
/**
|
|
83
83
|
* @hidden
|
|
84
84
|
*/
|
package/esm2015/main.js
CHANGED
|
@@ -8,6 +8,7 @@ export { PanelBarContentDirective } from './panelbar/panelbar-content.directive'
|
|
|
8
8
|
export { PanelBarItemTemplateDirective } from './panelbar/panelbar-item-template.directive';
|
|
9
9
|
export { PanelBarItemTitleDirective } from './panelbar/panelbar-item-title.directive';
|
|
10
10
|
export { PanelBarExpandMode } from './panelbar/panelbar-expand-mode';
|
|
11
|
+
export * from './panelbar/events';
|
|
11
12
|
export { SplitterComponent } from './splitter/splitter.component';
|
|
12
13
|
export { SplitterPaneComponent } from './splitter/splitter-pane.component';
|
|
13
14
|
export { TabStripComponent } from './tabstrip/tabstrip.component';
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-layout',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1650441140,
|
|
13
13
|
version: '',
|
|
14
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
15
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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 { PreventableEvent } from '../../common/preventable-event';
|
|
6
|
+
/**
|
|
7
|
+
* Arguments for the `collapse` event of the PanelBar.
|
|
8
|
+
*/
|
|
9
|
+
export class PanelBarCollapseEvent extends PreventableEvent {
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 { PreventableEvent } from '../../common/preventable-event';
|
|
6
|
+
/**
|
|
7
|
+
* Arguments for the `expand` event of the PanelBar.
|
|
8
|
+
*/
|
|
9
|
+
export class PanelBarExpandEvent extends PreventableEvent {
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 { PreventableEvent } from '../../common/preventable-event';
|
|
6
|
+
/**
|
|
7
|
+
* Arguments for the `select` event of the PanelBar.
|
|
8
|
+
*/
|
|
9
|
+
export class PanelBarSelectEvent extends PreventableEvent {
|
|
10
|
+
}
|
|
@@ -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 `stateChange` event of the PanelBar.
|
|
7
|
+
*/
|
|
8
|
+
export class PanelBarStateChangeEvent {
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 { PanelBarCollapseEvent } from './events/collapse-event';
|
|
6
|
+
export { PanelBarExpandEvent } from './events/expand-event';
|
|
7
|
+
export { PanelBarSelectEvent } from './events/select-event';
|
|
8
|
+
export { PanelBarStateChangeEvent } from './events/state-change-event';
|
|
@@ -262,7 +262,22 @@ PanelBarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
|
|
|
262
262
|
[src]="imageUrl"
|
|
263
263
|
alt="">
|
|
264
264
|
<ng-container *ngIf="!titleTemplate"><span class="k-panelbar-item-text">{{title}}</span></ng-container>
|
|
265
|
-
<ng-template *ngIf="titleTemplate"
|
|
265
|
+
<ng-template *ngIf="titleTemplate"
|
|
266
|
+
[ngTemplateOutlet]="titleTemplate"
|
|
267
|
+
[ngTemplateOutletContext]="{
|
|
268
|
+
item: {
|
|
269
|
+
title: title,
|
|
270
|
+
id: id,
|
|
271
|
+
icon: icon,
|
|
272
|
+
iconClass: iconClass,
|
|
273
|
+
imageUrl: imageUrl,
|
|
274
|
+
selected: selected,
|
|
275
|
+
expanded: expanded,
|
|
276
|
+
disabled: disabled,
|
|
277
|
+
focused: focused,
|
|
278
|
+
content: content
|
|
279
|
+
}
|
|
280
|
+
}"></ng-template>
|
|
266
281
|
<span *ngIf="hasChildItems || hasContent"
|
|
267
282
|
class="k-icon k-panelbar-toggle"
|
|
268
283
|
[ngClass]="{'k-i-arrow-chevron-up k-panelbar-collapse': expanded, 'k-i-arrow-chevron-down k-panelbar-expand': !expanded}">
|
|
@@ -388,7 +403,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
388
403
|
[src]="imageUrl"
|
|
389
404
|
alt="">
|
|
390
405
|
<ng-container *ngIf="!titleTemplate"><span class="k-panelbar-item-text">{{title}}</span></ng-container>
|
|
391
|
-
<ng-template *ngIf="titleTemplate"
|
|
406
|
+
<ng-template *ngIf="titleTemplate"
|
|
407
|
+
[ngTemplateOutlet]="titleTemplate"
|
|
408
|
+
[ngTemplateOutletContext]="{
|
|
409
|
+
item: {
|
|
410
|
+
title: title,
|
|
411
|
+
id: id,
|
|
412
|
+
icon: icon,
|
|
413
|
+
iconClass: iconClass,
|
|
414
|
+
imageUrl: imageUrl,
|
|
415
|
+
selected: selected,
|
|
416
|
+
expanded: expanded,
|
|
417
|
+
disabled: disabled,
|
|
418
|
+
focused: focused,
|
|
419
|
+
content: content
|
|
420
|
+
}
|
|
421
|
+
}"></ng-template>
|
|
392
422
|
<span *ngIf="hasChildItems || hasContent"
|
|
393
423
|
class="k-icon k-panelbar-toggle"
|
|
394
424
|
[ngClass]="{'k-i-arrow-chevron-up k-panelbar-collapse': expanded, 'k-i-arrow-chevron-down k-panelbar-expand': !expanded}">
|
|
@@ -13,6 +13,7 @@ import { PanelBarService } from "./panelbar.service";
|
|
|
13
13
|
import { PanelBarItemTemplateDirective } from "./panelbar-item-template.directive";
|
|
14
14
|
import { parsePanelBarItems } from "../common/util";
|
|
15
15
|
import { isFocusable } from './../common/dom-queries';
|
|
16
|
+
import { PanelBarSelectEvent, PanelBarExpandEvent, PanelBarCollapseEvent, PanelBarStateChangeEvent } from './events';
|
|
16
17
|
import * as i0 from "@angular/core";
|
|
17
18
|
import * as i1 from "./panelbar.service";
|
|
18
19
|
import * as i2 from "@progress/kendo-angular-l10n";
|
|
@@ -48,17 +49,35 @@ export class PanelBarComponent {
|
|
|
48
49
|
* Sets the height of the component when the `"full"` expand mode is used.
|
|
49
50
|
* This option is ignored in the `"multiple"` and `"single"` expand modes.
|
|
50
51
|
*/
|
|
51
|
-
this.height =
|
|
52
|
+
this.height = '400px';
|
|
52
53
|
/**
|
|
53
54
|
* Fires each time the user interacts with a PanelBar item
|
|
54
55
|
* ([see example]({% slug routing_panelbar %}#toc-getting-the-selected-item)).
|
|
55
|
-
* The event data contains all items that are modified.
|
|
56
|
+
* The event data contains a collection of all items that are modified.
|
|
56
57
|
*/
|
|
57
58
|
this.stateChange = new EventEmitter();
|
|
59
|
+
/**
|
|
60
|
+
* Fires when an item is about to be selected.
|
|
61
|
+
* ([see example]({% slug events_panelbar %}))
|
|
62
|
+
* This event is preventable. If you cancel it, the item will not be selected.
|
|
63
|
+
*/
|
|
64
|
+
this.select = new EventEmitter();
|
|
65
|
+
/**
|
|
66
|
+
* Fires when an item is about to be expanded.
|
|
67
|
+
* ([see example]({% slug events_panelbar %}))
|
|
68
|
+
* This event is preventable. If you cancel it, the item will remain collapsed.
|
|
69
|
+
*/
|
|
70
|
+
this.expand = new EventEmitter();
|
|
71
|
+
/**
|
|
72
|
+
* Fires when an item is about to be collapsed.
|
|
73
|
+
* ([see example]({% slug events_panelbar %}))
|
|
74
|
+
* This event is preventable. If you cancel it, the item will remain expanded.
|
|
75
|
+
*/
|
|
76
|
+
this.collapse = new EventEmitter();
|
|
58
77
|
this.tabIndex = 0;
|
|
59
|
-
this.role =
|
|
78
|
+
this.role = 'tree';
|
|
60
79
|
this.hostClass = true;
|
|
61
|
-
this.activeDescendant =
|
|
80
|
+
this.activeDescendant = '';
|
|
62
81
|
this.isViewInit = true;
|
|
63
82
|
this.focused = false;
|
|
64
83
|
this._keepItemContent = false;
|
|
@@ -70,7 +89,7 @@ export class PanelBarComponent {
|
|
|
70
89
|
childrenHeight += item.headerHeight();
|
|
71
90
|
});
|
|
72
91
|
this.childrenItems.forEach(item => {
|
|
73
|
-
item.contentHeight = PanelBarExpandMode.Full === this.expandMode ? (panelbarHeight - childrenHeight) +
|
|
92
|
+
item.contentHeight = PanelBarExpandMode.Full === this.expandMode ? (panelbarHeight - childrenHeight) + 'px' : 'auto';
|
|
74
93
|
item.contentOverflow = contentOverflow;
|
|
75
94
|
});
|
|
76
95
|
};
|
|
@@ -109,7 +128,7 @@ export class PanelBarComponent {
|
|
|
109
128
|
return this.expandMode === PanelBarExpandMode.Full ? this.height : 'auto';
|
|
110
129
|
}
|
|
111
130
|
get overflow() {
|
|
112
|
-
return this.expandMode === PanelBarExpandMode.Full ?
|
|
131
|
+
return this.expandMode === PanelBarExpandMode.Full ? 'hidden' : 'visible';
|
|
113
132
|
}
|
|
114
133
|
get dir() {
|
|
115
134
|
return this.localization.rtl ? 'rtl' : 'ltr';
|
|
@@ -159,7 +178,7 @@ export class PanelBarComponent {
|
|
|
159
178
|
this.validateConfiguration();
|
|
160
179
|
}
|
|
161
180
|
ngOnChanges(changes) {
|
|
162
|
-
if (changes['height'] || changes['expandMode'] || changes[
|
|
181
|
+
if (changes['height'] || changes['expandMode'] || changes['items']) { // eslint-disable-line
|
|
163
182
|
if (this.childrenItems) {
|
|
164
183
|
setTimeout(this.updateChildrenHeight);
|
|
165
184
|
}
|
|
@@ -206,7 +225,7 @@ export class PanelBarComponent {
|
|
|
206
225
|
onComponentBlur() {
|
|
207
226
|
this.eventService.onBlur();
|
|
208
227
|
this.focused = false;
|
|
209
|
-
this.activeDescendant =
|
|
228
|
+
this.activeDescendant = '';
|
|
210
229
|
}
|
|
211
230
|
/**
|
|
212
231
|
* @hidden
|
|
@@ -225,6 +244,26 @@ export class PanelBarComponent {
|
|
|
225
244
|
}
|
|
226
245
|
}
|
|
227
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* @hidden
|
|
249
|
+
*/
|
|
250
|
+
emitEvent(event, item) {
|
|
251
|
+
let eventArgs;
|
|
252
|
+
switch (event) {
|
|
253
|
+
case 'select':
|
|
254
|
+
eventArgs = new PanelBarSelectEvent();
|
|
255
|
+
break;
|
|
256
|
+
case 'collapse':
|
|
257
|
+
eventArgs = new PanelBarCollapseEvent();
|
|
258
|
+
break;
|
|
259
|
+
default:
|
|
260
|
+
eventArgs = new PanelBarExpandEvent();
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
eventArgs.item = item.serialize();
|
|
264
|
+
this[event].emit(eventArgs);
|
|
265
|
+
return eventArgs;
|
|
266
|
+
}
|
|
228
267
|
get viewItems() {
|
|
229
268
|
let treeItems = [];
|
|
230
269
|
this.viewChildItems.toArray().forEach(item => {
|
|
@@ -236,7 +275,7 @@ export class PanelBarComponent {
|
|
|
236
275
|
validateConfiguration() {
|
|
237
276
|
if (isDevMode()) {
|
|
238
277
|
if (this.items && (this.contentItems && this.contentItems.length > 0)) {
|
|
239
|
-
throw new Error(
|
|
278
|
+
throw new Error('Invalid configuration: mixed template components and items property.');
|
|
240
279
|
}
|
|
241
280
|
}
|
|
242
281
|
}
|
|
@@ -251,37 +290,80 @@ export class PanelBarComponent {
|
|
|
251
290
|
let focusedState = selectedState;
|
|
252
291
|
selectedState = this.selectable ? selectedState : currentItem.selected;
|
|
253
292
|
if (currentItem.selected !== selectedState || currentItem.focused !== focusedState) {
|
|
254
|
-
currentItem.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
293
|
+
const isSelectPrevented = selectedState ? this.emitEvent('select', currentItem).isDefaultPrevented() : false;
|
|
294
|
+
if (!isSelectPrevented) {
|
|
295
|
+
currentItem.selected = selectedState;
|
|
296
|
+
currentItem.focused = focusedState;
|
|
297
|
+
this.activeDescendant = focusedState ? currentItem.itemId : '';
|
|
298
|
+
modifiedItems.push(currentItem);
|
|
299
|
+
}
|
|
258
300
|
}
|
|
259
301
|
});
|
|
260
302
|
if (this.expandMode === PanelBarExpandMode.Multiple) {
|
|
261
|
-
if (item.hasChildItems || item.hasContent) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
303
|
+
if ((item.hasChildItems || item.hasContent) && item.selected) {
|
|
304
|
+
const isEventPrevented = item.expanded ?
|
|
305
|
+
this.emitEvent('collapse', item).isDefaultPrevented() :
|
|
306
|
+
this.emitEvent('expand', item).isDefaultPrevented();
|
|
307
|
+
if (!isEventPrevented) {
|
|
308
|
+
item.expanded = !item.expanded;
|
|
309
|
+
if (modifiedItems.indexOf(item) < 0) {
|
|
310
|
+
modifiedItems.push(item);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
266
313
|
}
|
|
267
314
|
}
|
|
268
315
|
else {
|
|
269
316
|
let siblings = item.parent ? item.parent.childrenItems : this.childrenItems;
|
|
270
|
-
|
|
317
|
+
let preventedCollapseItem;
|
|
318
|
+
let expandedItems = [];
|
|
319
|
+
if ((item.hasChildItems || item.hasContent) && item.selected) {
|
|
271
320
|
siblings
|
|
272
321
|
.forEach((currentItem) => {
|
|
273
322
|
let expandedState = currentItem === item;
|
|
274
323
|
if (currentItem.expanded !== expandedState) {
|
|
275
|
-
currentItem.expanded
|
|
276
|
-
|
|
277
|
-
|
|
324
|
+
const isEventPrevented = currentItem.expanded ?
|
|
325
|
+
this.emitEvent('collapse', currentItem).isDefaultPrevented() :
|
|
326
|
+
this.emitEvent('expand', currentItem).isDefaultPrevented();
|
|
327
|
+
if (!isEventPrevented) {
|
|
328
|
+
currentItem.expanded = expandedState;
|
|
329
|
+
if (currentItem.expanded) {
|
|
330
|
+
expandedItems.push(currentItem);
|
|
331
|
+
}
|
|
332
|
+
if (modifiedItems.indexOf(currentItem) < 0) {
|
|
333
|
+
modifiedItems.push(currentItem);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
else if (isEventPrevented && currentItem.expanded) {
|
|
337
|
+
preventedCollapseItem = currentItem;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
else if (currentItem.expanded === expandedState && expandedState) {
|
|
341
|
+
const isCollapsePrevented = this.emitEvent('collapse', currentItem).isDefaultPrevented();
|
|
342
|
+
if (!isCollapsePrevented) {
|
|
343
|
+
currentItem.expanded = !currentItem.expanded;
|
|
344
|
+
if (modifiedItems.indexOf(currentItem) < 0) {
|
|
345
|
+
modifiedItems.push(currentItem);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
expandedItems.forEach(item => {
|
|
351
|
+
if (preventedCollapseItem && item.id !== preventedCollapseItem.id) {
|
|
352
|
+
item.expanded = false;
|
|
353
|
+
if (isDevMode()) {
|
|
354
|
+
const expandMode = PanelBarExpandMode[this.expandMode].toLowerCase();
|
|
355
|
+
console.warn(`
|
|
356
|
+
The ${expandMode} expandMode allows the expansion of only one item at a time.
|
|
357
|
+
See https://www.telerik.com/kendo-angular-ui-develop/components/layout/panelbar/expand-modes/`);
|
|
278
358
|
}
|
|
279
359
|
}
|
|
280
360
|
});
|
|
281
361
|
}
|
|
282
362
|
}
|
|
283
363
|
if (modifiedItems.length > 0) {
|
|
284
|
-
|
|
364
|
+
let eventArgs = new PanelBarStateChangeEvent();
|
|
365
|
+
eventArgs.items = modifiedItems.map(currentItem => currentItem.serialize());
|
|
366
|
+
this.stateChange.emit(eventArgs);
|
|
285
367
|
}
|
|
286
368
|
}
|
|
287
369
|
isVisible(item) {
|
|
@@ -307,16 +389,16 @@ export class PanelBarComponent {
|
|
|
307
389
|
currentIndex = visibleItems.findIndex(item => item === currentItem);
|
|
308
390
|
}
|
|
309
391
|
switch (action) {
|
|
310
|
-
case
|
|
392
|
+
case 'lastItem':
|
|
311
393
|
nextItem = visibleItems[visibleItems.length - 1];
|
|
312
394
|
break;
|
|
313
|
-
case
|
|
395
|
+
case 'firstItem':
|
|
314
396
|
nextItem = visibleItems[0];
|
|
315
397
|
break;
|
|
316
|
-
case
|
|
398
|
+
case 'nextItem':
|
|
317
399
|
nextItem = visibleItems[currentIndex < visibleItems.length - 1 ? currentIndex + 1 : 0];
|
|
318
400
|
break;
|
|
319
|
-
case
|
|
401
|
+
case 'previousItem':
|
|
320
402
|
nextItem = visibleItems[currentIndex > 0 ? currentIndex - 1 : visibleItems.length - 1];
|
|
321
403
|
break;
|
|
322
404
|
default:
|
|
@@ -330,19 +412,21 @@ export class PanelBarComponent {
|
|
|
330
412
|
to.focused = true;
|
|
331
413
|
this.activeDescendant = to.itemId;
|
|
332
414
|
const modifiedItems = new Array(from.serialize(), to.serialize());
|
|
333
|
-
|
|
415
|
+
let eventArgs = new PanelBarStateChangeEvent();
|
|
416
|
+
eventArgs.items = modifiedItems;
|
|
417
|
+
this.stateChange.emit(eventArgs);
|
|
334
418
|
}
|
|
335
419
|
focusLastItem() {
|
|
336
|
-
this.focusItem(
|
|
420
|
+
this.focusItem('lastItem');
|
|
337
421
|
}
|
|
338
422
|
focusFirstItem() {
|
|
339
|
-
this.focusItem(
|
|
423
|
+
this.focusItem('firstItem');
|
|
340
424
|
}
|
|
341
425
|
focusNextItem() {
|
|
342
|
-
this.focusItem(
|
|
426
|
+
this.focusItem('nextItem');
|
|
343
427
|
}
|
|
344
428
|
focusPreviousItem() {
|
|
345
|
-
this.focusItem(
|
|
429
|
+
this.focusItem('previousItem');
|
|
346
430
|
}
|
|
347
431
|
expandItem() {
|
|
348
432
|
let currentItem = this.allItems.filter(item => item.focused)[0];
|
|
@@ -395,7 +479,7 @@ export class PanelBarComponent {
|
|
|
395
479
|
}
|
|
396
480
|
}
|
|
397
481
|
PanelBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PanelBarComponent, deps: [{ token: i0.ElementRef }, { token: i1.PanelBarService }, { token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
398
|
-
PanelBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PanelBarComponent, selector: "kendo-panelbar", inputs: { expandMode: "expandMode", selectable: "selectable", animate: "animate", height: "height", keepItemContent: "keepItemContent", items: "items" }, outputs: { stateChange: "stateChange" }, host: { listeners: { "click": "onComponentClick($event)", "focus": "onComponentFocus()", "blur": "onComponentBlur()", "keydown": "onComponentKeyDown($event)" }, properties: { "attr.tabIndex": "this.tabIndex", "attr.role": "this.role", "class.k-panelbar": "this.hostClass", "attr.aria-activedescendant": "this.activeDescendant", "style.height": "this.hostHeight", "style.overflow": "this.overflow", "attr.dir": "this.dir" } }, providers: [
|
|
482
|
+
PanelBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PanelBarComponent, selector: "kendo-panelbar", inputs: { expandMode: "expandMode", selectable: "selectable", animate: "animate", height: "height", keepItemContent: "keepItemContent", items: "items" }, outputs: { stateChange: "stateChange", select: "select", expand: "expand", collapse: "collapse" }, host: { listeners: { "click": "onComponentClick($event)", "focus": "onComponentFocus()", "blur": "onComponentBlur()", "keydown": "onComponentKeyDown($event)" }, properties: { "attr.tabIndex": "this.tabIndex", "attr.role": "this.role", "class.k-panelbar": "this.hostClass", "attr.aria-activedescendant": "this.activeDescendant", "style.height": "this.hostHeight", "style.overflow": "this.overflow", "attr.dir": "this.dir" } }, providers: [
|
|
399
483
|
PanelBarService,
|
|
400
484
|
LocalizationService,
|
|
401
485
|
{
|
|
@@ -407,17 +491,17 @@ PanelBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
|
|
|
407
491
|
<ng-template [ngIf]="items?.length">
|
|
408
492
|
<ng-container *ngFor="let item of items">
|
|
409
493
|
<kendo-panelbar-item *ngIf="!item.hidden"
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
494
|
+
[title]="item.title"
|
|
495
|
+
[id]="item.id"
|
|
496
|
+
[icon]="item.icon"
|
|
497
|
+
[iconClass]="item.iconClass"
|
|
498
|
+
[imageUrl]="item.imageUrl"
|
|
499
|
+
[selected]="!!item.selected"
|
|
500
|
+
[expanded]="!!item.expanded"
|
|
501
|
+
[disabled]="!!item.disabled"
|
|
502
|
+
[template]="templateRef"
|
|
503
|
+
[items]="item.children"
|
|
504
|
+
[content]="item.content"
|
|
421
505
|
>
|
|
422
506
|
</kendo-panelbar-item>
|
|
423
507
|
</ng-container>
|
|
@@ -441,17 +525,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
441
525
|
<ng-template [ngIf]="items?.length">
|
|
442
526
|
<ng-container *ngFor="let item of items">
|
|
443
527
|
<kendo-panelbar-item *ngIf="!item.hidden"
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
528
|
+
[title]="item.title"
|
|
529
|
+
[id]="item.id"
|
|
530
|
+
[icon]="item.icon"
|
|
531
|
+
[iconClass]="item.iconClass"
|
|
532
|
+
[imageUrl]="item.imageUrl"
|
|
533
|
+
[selected]="!!item.selected"
|
|
534
|
+
[expanded]="!!item.expanded"
|
|
535
|
+
[disabled]="!!item.disabled"
|
|
536
|
+
[template]="templateRef"
|
|
537
|
+
[items]="item.children"
|
|
538
|
+
[content]="item.content"
|
|
455
539
|
>
|
|
456
540
|
</kendo-panelbar-item>
|
|
457
541
|
</ng-container>
|
|
@@ -472,6 +556,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
472
556
|
type: Input
|
|
473
557
|
}], stateChange: [{
|
|
474
558
|
type: Output
|
|
559
|
+
}], select: [{
|
|
560
|
+
type: Output
|
|
561
|
+
}], expand: [{
|
|
562
|
+
type: Output
|
|
563
|
+
}], collapse: [{
|
|
564
|
+
type: Output
|
|
475
565
|
}], tabIndex: [{
|
|
476
566
|
type: HostBinding,
|
|
477
567
|
args: ['attr.tabIndex']
|