@progress/kendo-angular-layout 6.3.6 → 6.4.0-dev.202112211542

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cdn/js/kendo-angular-layout.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/avatar/avatar.component.js +120 -90
  4. package/dist/es/avatar/models/models.js +4 -0
  5. package/dist/es/avatar/models/rounded.js +4 -0
  6. package/dist/es/common/styling-classes.js +4 -0
  7. package/dist/es/common/util.js +40 -0
  8. package/dist/es/main.js +1 -0
  9. package/dist/es/package-metadata.js +1 -1
  10. package/dist/es2015/avatar/avatar.component.d.ts +30 -30
  11. package/dist/es2015/avatar/avatar.component.js +111 -81
  12. package/dist/es2015/avatar/models/fill.d.ts +2 -8
  13. package/dist/es2015/avatar/models/models.d.ts +9 -0
  14. package/dist/es2015/avatar/models/models.js +4 -0
  15. package/dist/es2015/avatar/models/rounded.d.ts +8 -0
  16. package/dist/es2015/avatar/models/rounded.js +4 -0
  17. package/dist/es2015/avatar/models/shape.d.ts +2 -8
  18. package/dist/es2015/avatar/models/size.d.ts +1 -8
  19. package/dist/es2015/avatar/models/theme-color.d.ts +2 -17
  20. package/dist/es2015/common/styling-classes.d.ts +11 -0
  21. package/dist/es2015/common/styling-classes.js +4 -0
  22. package/dist/es2015/common/util.d.ts +12 -0
  23. package/dist/es2015/common/util.js +40 -0
  24. package/dist/es2015/index.metadata.json +1 -1
  25. package/dist/es2015/main.d.ts +1 -4
  26. package/dist/es2015/main.js +1 -0
  27. package/dist/es2015/package-metadata.js +1 -1
  28. package/dist/es2015/tilelayout/tilelayout-item.component.d.ts +2 -2
  29. package/dist/es2015/tilelayout/tilelayout-resize-handle.directive.d.ts +2 -2
  30. package/dist/es2015/tilelayout/tilelayout.component.d.ts +2 -2
  31. package/dist/fesm2015/index.js +151 -82
  32. package/dist/fesm5/index.js +160 -91
  33. package/dist/npm/avatar/avatar.component.js +120 -90
  34. package/dist/npm/avatar/models/models.js +6 -0
  35. package/dist/npm/avatar/models/rounded.js +6 -0
  36. package/dist/npm/common/styling-classes.js +6 -0
  37. package/dist/npm/common/util.js +40 -0
  38. package/dist/npm/main.js +1 -0
  39. package/dist/npm/package-metadata.js +1 -1
  40. package/dist/systemjs/kendo-angular-layout.js +1 -1
  41. package/package.json +12 -10
@@ -5,18 +5,8 @@
5
5
  import * as tslib_1 from "tslib";
6
6
  import { Component, HostBinding, Input, isDevMode, Renderer2, ElementRef } from '@angular/core';
7
7
  import { validatePackage } from '@progress/kendo-licensing';
8
+ import { getStylingClasses, mapShapeToRounded } from '../common/util';
8
9
  import { packageMetadata } from '../package-metadata';
9
- const SIZE_CLASSES = {
10
- 'small': 'k-avatar-sm',
11
- 'medium': 'k-avatar-md',
12
- 'large': 'k-avatar-lg'
13
- };
14
- const SHAPE_CLASSES = {
15
- 'circle': 'k-avatar-circle',
16
- 'square': 'k-avatar-square',
17
- 'rectangle': 'k-avatar-rectangle',
18
- 'rounded': 'k-avatar-rounded'
19
- };
20
10
  /**
21
11
  * Displays images, icons or initials representing people or other entities.
22
12
  */
@@ -25,37 +15,16 @@ let AvatarComponent = class AvatarComponent {
25
15
  this.renderer = renderer;
26
16
  this.element = element;
27
17
  this.hostClass = true;
28
- /**
29
- * Specifies the appearance fill style of the avatar.
30
- *
31
- * The possible values are:
32
- * * `solid` (Default)
33
- * * `outline`
34
- *
35
- */
36
- this.fill = 'solid';
37
18
  /**
38
19
  * Sets a border to the avatar.
39
20
  */
40
21
  this.border = false;
41
22
  this._themeColor = 'primary';
42
23
  this._size = 'medium';
43
- this._shape = 'square';
44
- this.avatar = this.element.nativeElement;
24
+ this._fillMode = 'solid';
25
+ this._rounded = 'full';
45
26
  validatePackage(packageMetadata);
46
27
  }
47
- /**
48
- * @hidden
49
- */
50
- get solidClass() {
51
- return this.fill === 'solid';
52
- }
53
- /**
54
- * @hidden
55
- */
56
- get outlineClass() {
57
- return this.fill === 'outline';
58
- }
59
28
  /**
60
29
  * @hidden
61
30
  */
@@ -70,21 +39,10 @@ let AvatarComponent = class AvatarComponent {
70
39
  }
71
40
  /**
72
41
  * Sets the shape for the avatar.
73
- *
74
- * Possible values are:
75
- * * (Default) `square`
76
- * * `circle`
77
- * * `rectangle`
78
- * * `rounded`
79
- *
42
+ * @hidden
80
43
  */
81
44
  set shape(shape) {
82
- this.renderer.removeClass(this.avatar, SHAPE_CLASSES[this.shape]);
83
- this.renderer.addClass(this.avatar, SHAPE_CLASSES[shape]);
84
- this._shape = shape;
85
- }
86
- get shape() {
87
- return this._shape;
45
+ this.rounded = mapShapeToRounded(shape);
88
46
  }
89
47
  /**
90
48
  * Specifies the size of the avatar
@@ -97,22 +55,44 @@ let AvatarComponent = class AvatarComponent {
97
55
  *
98
56
  */
99
57
  set size(size) {
100
- this.renderer.removeClass(this.avatar, SIZE_CLASSES[this.size]);
101
- this.renderer.addClass(this.avatar, SIZE_CLASSES[size]);
102
- this._size = size;
58
+ if (size !== this._size) {
59
+ this.handleClasses('size', size);
60
+ this._size = size === null ? null : size || 'medium';
61
+ }
103
62
  }
104
63
  get size() {
105
64
  return this._size;
106
65
  }
66
+ /**
67
+ * Specifies the rounded styling of the avatar
68
+ * ([see example]({% slug appearance_avatar %}#toc-rounded-corners)).
69
+ *
70
+ * The possible values are:
71
+ * * `small`
72
+ * * `medium`
73
+ * * `large`
74
+ * * `full` (Default)
75
+ * * null
76
+ *
77
+ */
78
+ set rounded(rounded) {
79
+ if (rounded !== this._rounded) {
80
+ this.handleClasses('rounded', rounded);
81
+ this._rounded = rounded === null ? null : rounded || 'full';
82
+ }
83
+ }
84
+ get rounded() {
85
+ return this._rounded;
86
+ }
107
87
  /**
108
88
  * Specifies the theme color of the avatar.
109
89
  * The theme color will be applied as background and border color, while also amending the text color accordingly.
110
90
  *
111
91
  * The possible values are:
92
+ * * `base`— Applies the base coloring value.
112
93
  * * `primary` (Default)—Applies coloring based on primary theme color.
113
94
  * * `secondary`—Applies coloring based on secondary theme color.
114
95
  * * `tertiary`— Applies coloring based on tertiary theme color.
115
- * * `inherit`— Applies inherited coloring value.
116
96
  * * `info`—Applies coloring based on info theme color.
117
97
  * * `success`— Applies coloring based on success theme color.
118
98
  * * `warning`— Applies coloring based on warning theme color.
@@ -120,40 +100,65 @@ let AvatarComponent = class AvatarComponent {
120
100
  * * `dark`— Applies coloring based on dark theme color.
121
101
  * * `light`— Applies coloring based on light theme color.
122
102
  * * `inverse`— Applies coloring based on inverted theme color.
123
- *
124
103
  */
125
104
  set themeColor(themeColor) {
126
- this.renderer.removeClass(this.avatar, `k-avatar-${this.themeColor}`);
127
- this.renderer.addClass(this.avatar, `k-avatar-${themeColor}`);
128
- this._themeColor = themeColor;
105
+ if (themeColor !== this._themeColor) {
106
+ this._themeColor = themeColor === null ? null : (themeColor || 'primary');
107
+ this.handleFillModeAndThemeColorClasses(this.fillMode, this.themeColor);
108
+ }
129
109
  }
130
110
  get themeColor() {
131
111
  return this._themeColor;
132
112
  }
133
113
  /**
134
- * @hidden
114
+ * Specifies the appearance fill style of the avatar.
115
+ *
116
+ * The possible values are:
117
+ * * `solid` (Default)
118
+ * * `outline`
119
+ * * null
120
+ *
135
121
  */
136
- get avatarWidth() {
137
- return this.width;
122
+ set fillMode(fillMode) {
123
+ if (fillMode !== this.fillMode) {
124
+ this._fillMode = fillMode === null ? null : (fillMode || 'solid');
125
+ this.handleFillModeAndThemeColorClasses(this.fillMode, this.themeColor);
126
+ }
127
+ }
128
+ get fillMode() {
129
+ return this._fillMode;
138
130
  }
139
131
  /**
132
+ * Specifies the appearance fill style of the avatar.
133
+ * Deprecated, left for backward compatibility.
134
+ *
140
135
  * @hidden
141
136
  */
142
- get avatarHeight() {
143
- return this.height;
137
+ set fill(fillMode) {
138
+ this.fillMode = fillMode;
144
139
  }
145
- ngAfterViewInit() {
146
- this.setAvatarClasses();
140
+ /**
141
+ * @hidden
142
+ */
143
+ get avatarWidth() {
144
+ return this.width;
147
145
  }
148
146
  /**
149
147
  * @hidden
150
148
  */
151
- get imageUrl() {
152
- return `url(${this.imageSrc})`;
149
+ get avatarHeight() {
150
+ return this.height;
153
151
  }
154
152
  ngOnInit() {
155
153
  this.verifyProperties();
156
154
  }
155
+ ngAfterViewInit() {
156
+ const stylingInputs = ['size', 'rounded'];
157
+ stylingInputs.forEach(input => {
158
+ this.handleClasses(input, this[input]);
159
+ });
160
+ this.handleFillModeAndThemeColorClasses(this.fillMode, this.themeColor);
161
+ }
157
162
  /**
158
163
  * @hidden
159
164
  */
@@ -185,26 +190,38 @@ let AvatarComponent = class AvatarComponent {
185
190
  `);
186
191
  }
187
192
  }
188
- setAvatarClasses() {
189
- this.renderer.addClass(this.avatar, SHAPE_CLASSES[this.shape]);
190
- this.renderer.addClass(this.avatar, `k-avatar-${this.themeColor}`);
191
- this.renderer.addClass(this.avatar, SIZE_CLASSES[this.size]);
193
+ handleClasses(styleType, value) {
194
+ const elem = this.element.nativeElement;
195
+ const classes = getStylingClasses('avatar', styleType, this[styleType], value);
196
+ if (classes.toRemove) {
197
+ this.renderer.removeClass(elem, classes.toRemove);
198
+ }
199
+ if (classes.toAdd) {
200
+ this.renderer.addClass(elem, classes.toAdd);
201
+ }
202
+ }
203
+ handleFillModeAndThemeColorClasses(fill, themeColor) {
204
+ const wrapperElement = this.element.nativeElement;
205
+ // remove existing fill and theme color classes
206
+ const currentClasses = Array.from(wrapperElement.classList);
207
+ const classesToRemove = currentClasses.filter(cl => {
208
+ return cl.startsWith('k-avatar-solid') || cl.startsWith('k-avatar-outline');
209
+ });
210
+ classesToRemove.forEach((cl => this.renderer.removeClass(wrapperElement, cl)));
211
+ // add fill if needed
212
+ if (fill !== null) {
213
+ this.renderer.addClass(wrapperElement, `k-avatar-${fill}`);
214
+ }
215
+ // add theme color class if fill and theme color
216
+ if (fill !== null && themeColor !== null) {
217
+ this.renderer.addClass(wrapperElement, `k-avatar-${fill}-${themeColor}`);
218
+ }
192
219
  }
193
220
  };
194
221
  tslib_1.__decorate([
195
222
  HostBinding('class.k-avatar'),
196
223
  tslib_1.__metadata("design:type", Boolean)
197
224
  ], AvatarComponent.prototype, "hostClass", void 0);
198
- tslib_1.__decorate([
199
- HostBinding('class.k-avatar-solid'),
200
- tslib_1.__metadata("design:type", Boolean),
201
- tslib_1.__metadata("design:paramtypes", [])
202
- ], AvatarComponent.prototype, "solidClass", null);
203
- tslib_1.__decorate([
204
- HostBinding('class.k-avatar-outline'),
205
- tslib_1.__metadata("design:type", Boolean),
206
- tslib_1.__metadata("design:paramtypes", [])
207
- ], AvatarComponent.prototype, "outlineClass", null);
208
225
  tslib_1.__decorate([
209
226
  HostBinding('class.k-avatar-bordered'),
210
227
  tslib_1.__metadata("design:type", Boolean),
@@ -225,6 +242,11 @@ tslib_1.__decorate([
225
242
  tslib_1.__metadata("design:type", String),
226
243
  tslib_1.__metadata("design:paramtypes", [String])
227
244
  ], AvatarComponent.prototype, "size", null);
245
+ tslib_1.__decorate([
246
+ Input(),
247
+ tslib_1.__metadata("design:type", String),
248
+ tslib_1.__metadata("design:paramtypes", [String])
249
+ ], AvatarComponent.prototype, "rounded", null);
228
250
  tslib_1.__decorate([
229
251
  Input(),
230
252
  tslib_1.__metadata("design:type", String),
@@ -232,8 +254,14 @@ tslib_1.__decorate([
232
254
  ], AvatarComponent.prototype, "themeColor", null);
233
255
  tslib_1.__decorate([
234
256
  Input(),
235
- tslib_1.__metadata("design:type", String)
236
- ], AvatarComponent.prototype, "fill", void 0);
257
+ tslib_1.__metadata("design:type", String),
258
+ tslib_1.__metadata("design:paramtypes", [String])
259
+ ], AvatarComponent.prototype, "fillMode", null);
260
+ tslib_1.__decorate([
261
+ Input(),
262
+ tslib_1.__metadata("design:type", String),
263
+ tslib_1.__metadata("design:paramtypes", [String])
264
+ ], AvatarComponent.prototype, "fill", null);
237
265
  tslib_1.__decorate([
238
266
  Input(),
239
267
  tslib_1.__metadata("design:type", Boolean)
@@ -283,7 +311,9 @@ AvatarComponent = tslib_1.__decorate([
283
311
  <ng-content *ngIf="customAvatar"></ng-content>
284
312
 
285
313
  <ng-container *ngIf="imageSrc">
286
- <div class="k-avatar-image" [ngStyle]="cssStyle" [style.backgroundImage]="imageUrl"></div>
314
+ <span class="k-avatar-image">
315
+ <img src="{{imageSrc}}" [ngStyle]="cssStyle" />
316
+ </span>
287
317
  </ng-container>
288
318
 
289
319
  <ng-container *ngIf="initials">
@@ -3,12 +3,6 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /**
6
- * Specifies the appearance fill style of the аvatar
7
- * ([see example]({% slug appearance_avatar %}#toc-fill)).
8
- *
9
- * The possible values are:
10
- * * `solid` (Default)
11
- * * `outline`
12
- *
6
+ * Specifies the possible appearance fill styles of the аvatar ([see example]({% slug appearance_avatar %}#toc-fill)).
13
7
  */
14
- export declare type AvatarFill = 'solid' | 'outline';
8
+ export declare type AvatarFillMode = 'solid' | 'outline';
@@ -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
+ export * from './shape';
6
+ export * from './fill';
7
+ export * from './size';
8
+ export * from './rounded';
9
+ export * from './theme-color';
@@ -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,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
+ /**
6
+ * Specifies the possible rounded options of the аvatar ([see example]({% slug appearance_avatar %}#toc-rounded-corners)).
7
+ */
8
+ export declare type AvatarRounded = 'small' | 'medium' | 'large' | 'full';
@@ -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
+ *-------------------------------------------------------------------------------------------*/
@@ -3,14 +3,8 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /**
6
- * Sets the shape for the avatar.
7
- *
8
- * Possible values are:
9
- * * (Default) `square`
10
- * * `rounded`
11
- * * `rectangle`
12
- * * `circle`
13
- *
6
+ * @hidden
7
+ * Specifies the possible shapes of the avatar.
14
8
  */
15
9
  export declare type AvatarShape = 'square' | 'rectangle' | 'rounded' | 'circle';
16
10
  /**
@@ -3,13 +3,6 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /**
6
- * Specifies the size of the аvatar
7
- * ([see example]({% slug appearance_avatar %}#toc-size)).
8
- *
9
- * The possible values are:
10
- * * `small`
11
- * * `medium` (Default)
12
- * * `large`
13
- *
6
+ * Specifies the possible sizes of the аvatar ([see example]({% slug appearance_avatar %}#toc-size)).
14
7
  */
15
8
  export declare type AvatarSize = 'small' | 'medium' | 'large';
@@ -3,21 +3,6 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /**
6
- * Specifies the theme color of the аvatar
7
- * ([see example]({% slug appearance_avatar %}#toc-theme-color)).
8
- *
9
- * The possible values are:
10
- * * `primary` (Default)&mdash;Applies coloring based on primary theme color.
11
- * * `secondary`&mdash;Applies coloring based on secondary theme color.
12
- * * `tertiary`&mdash; Applies coloring based on tertiary theme color.
13
- * * `inherit`&mdash; Applies inherited coloring value.
14
- * * `info`&mdash;Applies coloring based on info theme color.
15
- * * `success`&mdash; Applies coloring based on success theme color.
16
- * * `warning`&mdash; Applies coloring based on warning theme color.
17
- * * `error`&mdash; Applies coloring based on error theme color.
18
- * * `dark`&mdash; Applies coloring based on dark theme color.
19
- * * `light`&mdash; Applies coloring based on light theme color.
20
- * * `inverse`&mdash; Applies coloring based on inverted theme color.
21
- *
6
+ * Specifies the possible theme colors of the аvatar ([see example]({% slug appearance_avatar %}#toc-theme-color)).
22
7
  */
23
- export declare type AvatarThemeColor = 'primary' | 'secondary' | 'tertiary' | 'inherit' | 'info' | 'success' | 'warning' | 'error' | 'dark' | 'light' | 'inverse';
8
+ export declare type AvatarThemeColor = 'primary' | 'secondary' | 'tertiary' | 'base' | 'info' | 'success' | 'warning' | 'error' | 'dark' | 'light' | 'inverse';
@@ -0,0 +1,11 @@
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 interface StylingClasses {
9
+ toRemove?: string;
10
+ toAdd?: string;
11
+ }
@@ -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
+ *-------------------------------------------------------------------------------------------*/
@@ -2,6 +2,8 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
+ import { AvatarRounded, AvatarShape } from '../avatar/models/models';
6
+ import { StylingClasses } from './styling-classes';
5
7
  declare const _default: {
6
8
  parsePanelBarItems: Function;
7
9
  };
@@ -26,3 +28,13 @@ export declare const isArrowKey: (keyCode: any) => boolean;
26
28
  * @hidden
27
29
  */
28
30
  export declare const isNavigationKey: (keyCode: any) => boolean;
31
+ /**
32
+ * @hidden
33
+ *
34
+ * Returns the styling classes to be added and removed
35
+ */
36
+ export declare const getStylingClasses: (componentType: any, stylingOption: string, previousValue: any, newValue: any) => StylingClasses;
37
+ /**
38
+ * @hidden
39
+ */
40
+ export declare const mapShapeToRounded: (shape: AvatarShape) => AvatarRounded;
@@ -4,6 +4,21 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Keys } from '@progress/kendo-angular-common';
6
6
  let nextId = 0;
7
+ const SIZES = {
8
+ small: 'sm',
9
+ medium: 'md',
10
+ large: 'lg'
11
+ };
12
+ const ROUNDNESS = {
13
+ small: 'sm',
14
+ medium: 'md',
15
+ large: 'lg',
16
+ full: 'full'
17
+ };
18
+ const SHAPE_TO_ROUNDED = {
19
+ rounded: 'large',
20
+ circle: 'full'
21
+ };
7
22
  const parsePanelBarItems = (data) => {
8
23
  return data.map((item) => {
9
24
  if (!item.id) {
@@ -40,4 +55,29 @@ export const isArrowKey = keyCode => isHorizontalArrowKey(keyCode) || isVertical
40
55
  */
41
56
  export const isNavigationKey = keyCode => keyCode === Keys.PageUp || keyCode === Keys.PageDown ||
42
57
  keyCode === Keys.Home || keyCode === Keys.End;
58
+ /**
59
+ * @hidden
60
+ *
61
+ * Returns the styling classes to be added and removed
62
+ */
63
+ export const getStylingClasses = (componentType, stylingOption, previousValue, newValue) => {
64
+ switch (stylingOption) {
65
+ case 'size':
66
+ return {
67
+ toRemove: `k-${componentType}-${SIZES[previousValue]}`,
68
+ toAdd: newValue ? `k-${componentType}-${SIZES[newValue]}` : null
69
+ };
70
+ case 'rounded':
71
+ return {
72
+ toRemove: `k-rounded-${ROUNDNESS[previousValue]}`,
73
+ toAdd: newValue ? `k-rounded-${ROUNDNESS[newValue]}` : null
74
+ };
75
+ default:
76
+ break;
77
+ }
78
+ };
79
+ /**
80
+ * @hidden
81
+ */
82
+ export const mapShapeToRounded = (shape) => SHAPE_TO_ROUNDED[shape] || null;
43
83
  export { ɵ0 };