@progress/kendo-angular-layout 6.4.2 → 6.5.0-dev.202202091626

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 (70) 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/common/util.js +4 -0
  4. package/dist/es/gridlayout.module.js +31 -0
  5. package/dist/es/layout.module.js +5 -1
  6. package/dist/es/layouts/grid-layout.component.js +150 -0
  7. package/dist/es/layouts/gridlayout-item.component.js +52 -0
  8. package/dist/es/layouts/models/gridlayout-gap-settings.js +4 -0
  9. package/dist/es/layouts/models/gridlayout-row-col-size.js +4 -0
  10. package/dist/es/layouts/models/layout-align-settings.js +4 -0
  11. package/dist/es/layouts/models/layout-horizontal-align.js +4 -0
  12. package/dist/es/layouts/models/layout-vertical-align.js +4 -0
  13. package/dist/es/layouts/models.js +4 -0
  14. package/dist/es/layouts/stack-layout.component.js +171 -0
  15. package/dist/es/layouts/util.js +87 -0
  16. package/dist/es/main.js +7 -0
  17. package/dist/es/package-metadata.js +1 -1
  18. package/dist/es/stacklayout.module.js +29 -0
  19. package/dist/es2015/common/orientation.d.ts +1 -1
  20. package/dist/es2015/common/util.d.ts +4 -0
  21. package/dist/es2015/common/util.js +4 -0
  22. package/dist/es2015/gridlayout.module.d.ts +10 -0
  23. package/dist/es2015/gridlayout.module.js +30 -0
  24. package/dist/es2015/index.metadata.json +1 -1
  25. package/dist/es2015/layout.module.js +5 -1
  26. package/dist/es2015/layouts/grid-layout.component.d.ts +47 -0
  27. package/dist/es2015/layouts/grid-layout.component.js +139 -0
  28. package/dist/es2015/layouts/gridlayout-item.component.d.ts +33 -0
  29. package/dist/es2015/layouts/gridlayout-item.component.js +53 -0
  30. package/dist/es2015/layouts/models/gridlayout-gap-settings.d.ts +17 -0
  31. package/dist/es2015/layouts/models/gridlayout-gap-settings.js +4 -0
  32. package/dist/es2015/layouts/models/gridlayout-row-col-size.d.ts +22 -0
  33. package/dist/es2015/layouts/models/gridlayout-row-col-size.js +4 -0
  34. package/dist/es2015/layouts/models/layout-align-settings.d.ts +18 -0
  35. package/dist/es2015/layouts/models/layout-align-settings.js +4 -0
  36. package/dist/es2015/layouts/models/layout-horizontal-align.d.ts +8 -0
  37. package/dist/es2015/layouts/models/layout-horizontal-align.js +4 -0
  38. package/dist/es2015/layouts/models/layout-vertical-align.d.ts +8 -0
  39. package/dist/es2015/layouts/models/layout-vertical-align.js +4 -0
  40. package/dist/es2015/layouts/models.d.ts +10 -0
  41. package/dist/es2015/layouts/models.js +4 -0
  42. package/dist/es2015/layouts/stack-layout.component.d.ts +47 -0
  43. package/dist/es2015/layouts/stack-layout.component.js +152 -0
  44. package/dist/es2015/layouts/util.d.ts +38 -0
  45. package/dist/es2015/layouts/util.js +87 -0
  46. package/dist/es2015/main.d.ts +7 -0
  47. package/dist/es2015/main.js +7 -0
  48. package/dist/es2015/package-metadata.js +1 -1
  49. package/dist/es2015/stacklayout.module.d.ts +10 -0
  50. package/dist/es2015/stacklayout.module.js +28 -0
  51. package/dist/fesm2015/index.js +449 -4
  52. package/dist/fesm5/index.js +480 -4
  53. package/dist/npm/common/util.js +4 -0
  54. package/dist/npm/gridlayout.module.js +33 -0
  55. package/dist/npm/layout.module.js +5 -1
  56. package/dist/npm/layouts/grid-layout.component.js +152 -0
  57. package/dist/npm/layouts/gridlayout-item.component.js +54 -0
  58. package/dist/npm/layouts/models/gridlayout-gap-settings.js +6 -0
  59. package/dist/npm/layouts/models/gridlayout-row-col-size.js +6 -0
  60. package/dist/npm/layouts/models/layout-align-settings.js +6 -0
  61. package/dist/npm/layouts/models/layout-horizontal-align.js +6 -0
  62. package/dist/npm/layouts/models/layout-vertical-align.js +6 -0
  63. package/dist/npm/layouts/models.js +6 -0
  64. package/dist/npm/layouts/stack-layout.component.js +173 -0
  65. package/dist/npm/layouts/util.js +89 -0
  66. package/dist/npm/main.js +12 -0
  67. package/dist/npm/package-metadata.js +1 -1
  68. package/dist/npm/stacklayout.module.js +31 -0
  69. package/dist/systemjs/kendo-angular-layout.js +1 -1
  70. package/package.json +10 -8
@@ -13,6 +13,8 @@ import { SplitterModule } from './splitter.module';
13
13
  import { StepperModule } from './stepper.module';
14
14
  import { TabStripModule } from './tabstrip.module';
15
15
  import { TileLayoutModule } from './tilelayout.module';
16
+ import { StackLayoutModule } from './stacklayout.module';
17
+ import { GridLayoutModule } from './gridlayout.module';
16
18
  /**
17
19
  * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
18
20
  * definition for the Layout components.
@@ -57,7 +59,9 @@ LayoutModule = tslib_1.__decorate([
57
59
  SplitterModule,
58
60
  StepperModule,
59
61
  TabStripModule,
60
- TileLayoutModule
62
+ TileLayoutModule,
63
+ StackLayoutModule,
64
+ GridLayoutModule
61
65
  ]
62
66
  })
63
67
  ], LayoutModule);
@@ -0,0 +1,47 @@
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 { Renderer2, ElementRef, AfterViewInit, SimpleChanges, OnChanges } from '@angular/core';
6
+ import { GridLayoutRowSize, GridLayoutColSize, GridLayoutGapSettings, AlignSettings } from './models';
7
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
8
+ /**
9
+ * Represents the [Kendo UI GridLayout component for Angular]({% slug overview_gridlayout %}).
10
+ */
11
+ export declare class GridLayoutComponent implements AfterViewInit, OnChanges {
12
+ private renderer;
13
+ private element;
14
+ private localization;
15
+ hostClass: boolean;
16
+ readonly dir: string;
17
+ /**
18
+ * Specifies the number of rows and their height
19
+ * ([More details]({% slug layout_gridlayout %}#toc-rows-and-columns)).
20
+ */
21
+ rows: Array<number | string | GridLayoutRowSize>;
22
+ /**
23
+ * Specifies the number of columns and their widths
24
+ * ([More details]({% slug layout_gridlayout %}#toc-rows-and-columns)).
25
+ */
26
+ cols: Array<number | string | GridLayoutColSize>;
27
+ /**
28
+ * Specifies the gaps between the elements. The default value is `0`
29
+ * ([see example]({% slug layout_gridlayout %}#toc-gaps)).
30
+ */
31
+ gap: number | string | GridLayoutGapSettings;
32
+ /**
33
+ * Specifies the horizontal and vertical alignment of the inner GridLayout elements
34
+ * ([see example]({% slug layout_gridlayout %}#toc-alignment)).
35
+ */
36
+ align: AlignSettings;
37
+ private _align;
38
+ private justifyClass;
39
+ private alignClass;
40
+ constructor(renderer: Renderer2, element: ElementRef, localization: LocalizationService);
41
+ ngAfterViewInit(): void;
42
+ ngOnChanges(changes: SimpleChanges): void;
43
+ private handleAlignClasses;
44
+ private setGap;
45
+ private handleGridTemplateStyling;
46
+ private readonly direction;
47
+ }
@@ -0,0 +1,139 @@
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, HostBinding, Input, Renderer2, ElementRef } from '@angular/core';
7
+ import { validatePackage } from '@progress/kendo-licensing';
8
+ import { packageMetadata } from '../package-metadata';
9
+ import { ALIGN_PREFIX, generateGapStyle, generateGridStyle, GRID_JUSTIFY_PREFIX, normalizeGap, VERTICAL_SUFFIX } from './util';
10
+ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
11
+ import { isPresent } from '../common/util';
12
+ import { isChanged } from '@progress/kendo-angular-common';
13
+ /**
14
+ * Represents the [Kendo UI GridLayout component for Angular]({% slug overview_gridlayout %}).
15
+ */
16
+ let GridLayoutComponent = class GridLayoutComponent {
17
+ constructor(renderer, element, localization) {
18
+ this.renderer = renderer;
19
+ this.element = element;
20
+ this.localization = localization;
21
+ this.hostClass = true;
22
+ /**
23
+ * Specifies the gaps between the elements. The default value is `0`
24
+ * ([see example]({% slug layout_gridlayout %}#toc-gaps)).
25
+ */
26
+ this.gap = 0;
27
+ this._align = {
28
+ horizontal: 'stretch',
29
+ vertical: 'stretch'
30
+ };
31
+ validatePackage(packageMetadata);
32
+ }
33
+ get dir() {
34
+ return this.direction;
35
+ }
36
+ /**
37
+ * Specifies the horizontal and vertical alignment of the inner GridLayout elements
38
+ * ([see example]({% slug layout_gridlayout %}#toc-alignment)).
39
+ */
40
+ set align(align) {
41
+ this._align = Object.assign({}, this._align, align);
42
+ this.handleAlignClasses();
43
+ }
44
+ get align() {
45
+ return this._align;
46
+ }
47
+ ngAfterViewInit() {
48
+ this.handleAlignClasses();
49
+ this.handleGridTemplateStyling('rows');
50
+ this.handleGridTemplateStyling('cols');
51
+ this.setGap();
52
+ }
53
+ ngOnChanges(changes) {
54
+ if (isChanged('gap', changes)) {
55
+ this.setGap();
56
+ }
57
+ if (isChanged('rows', changes)) {
58
+ this.handleGridTemplateStyling('rows');
59
+ }
60
+ if (isChanged('cols', changes)) {
61
+ this.handleGridTemplateStyling('cols');
62
+ }
63
+ }
64
+ handleAlignClasses() {
65
+ const elem = this.element.nativeElement;
66
+ if (isPresent(this.justifyClass)) {
67
+ this.renderer.removeClass(elem, this.justifyClass);
68
+ }
69
+ if (isPresent(this.alignClass)) {
70
+ this.renderer.removeClass(elem, this.alignClass);
71
+ }
72
+ this.justifyClass = `${GRID_JUSTIFY_PREFIX}-${this.align.horizontal}`;
73
+ this.alignClass = `${ALIGN_PREFIX}-${VERTICAL_SUFFIX[this.align.vertical]}`;
74
+ this.renderer.addClass(elem, this.justifyClass);
75
+ this.renderer.addClass(elem, this.alignClass);
76
+ }
77
+ setGap() {
78
+ let parsedGap = normalizeGap(this.gap);
79
+ let gapStyle = generateGapStyle(parsedGap);
80
+ this.renderer.setStyle(this.element.nativeElement, 'gap', gapStyle);
81
+ }
82
+ handleGridTemplateStyling(type) {
83
+ if (!isPresent(this[type])) {
84
+ return;
85
+ }
86
+ const gridTemplateStyle = type === 'rows' ? 'grid-template-rows' : 'grid-template-columns';
87
+ const gridStyle = generateGridStyle(this[type], type);
88
+ this.renderer.setStyle(this.element.nativeElement, gridTemplateStyle, gridStyle.join(' '));
89
+ }
90
+ get direction() {
91
+ return this.localization.rtl ? 'rtl' : 'ltr';
92
+ }
93
+ };
94
+ tslib_1.__decorate([
95
+ HostBinding('class.k-grid-layout'),
96
+ tslib_1.__metadata("design:type", Boolean)
97
+ ], GridLayoutComponent.prototype, "hostClass", void 0);
98
+ tslib_1.__decorate([
99
+ HostBinding('attr.dir'),
100
+ tslib_1.__metadata("design:type", String),
101
+ tslib_1.__metadata("design:paramtypes", [])
102
+ ], GridLayoutComponent.prototype, "dir", null);
103
+ tslib_1.__decorate([
104
+ Input(),
105
+ tslib_1.__metadata("design:type", Array)
106
+ ], GridLayoutComponent.prototype, "rows", void 0);
107
+ tslib_1.__decorate([
108
+ Input(),
109
+ tslib_1.__metadata("design:type", Array)
110
+ ], GridLayoutComponent.prototype, "cols", void 0);
111
+ tslib_1.__decorate([
112
+ Input(),
113
+ tslib_1.__metadata("design:type", Object)
114
+ ], GridLayoutComponent.prototype, "gap", void 0);
115
+ tslib_1.__decorate([
116
+ Input(),
117
+ tslib_1.__metadata("design:type", Object),
118
+ tslib_1.__metadata("design:paramtypes", [Object])
119
+ ], GridLayoutComponent.prototype, "align", null);
120
+ GridLayoutComponent = tslib_1.__decorate([
121
+ Component({
122
+ exportAs: 'kendoGridLayout',
123
+ selector: 'kendo-gridlayout',
124
+ providers: [
125
+ LocalizationService,
126
+ {
127
+ provide: L10N_PREFIX,
128
+ useValue: 'kendo.gridlayout'
129
+ }
130
+ ],
131
+ template: `
132
+ <ng-content></ng-content>
133
+ `
134
+ }),
135
+ tslib_1.__metadata("design:paramtypes", [Renderer2,
136
+ ElementRef,
137
+ LocalizationService])
138
+ ], GridLayoutComponent);
139
+ export { GridLayoutComponent };
@@ -0,0 +1,33 @@
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 { Renderer2, ElementRef, OnChanges } from '@angular/core';
6
+ export declare class GridLayoutItemComponent implements OnChanges {
7
+ private renderer;
8
+ private element;
9
+ /**
10
+ * Sets the row of the item in the GridLayout
11
+ * ([see example]({% slug items_gridlayout %}#toc-size-and-position)).
12
+ */
13
+ row: number;
14
+ /**
15
+ * Sets the column of the item in the GridLayout
16
+ * ([see example]({% slug items_gridlayout %}#toc-size-and-position)).
17
+ */
18
+ col: number;
19
+ /**
20
+ * Determines how many rows will the item span. The default size is one row
21
+ * ([see example]({% slug items_gridlayout %}#toc-size-and-position)).
22
+ */
23
+ rowSpan: number;
24
+ /**
25
+ * Determines how many columns will the item span. The default size is one column
26
+ * ([see example]({% slug items_gridlayout %}#toc-size-and-position)).
27
+ */
28
+ colSpan: number;
29
+ constructor(renderer: Renderer2, element: ElementRef);
30
+ ngOnInit(): void;
31
+ ngOnChanges(): void;
32
+ private setItemStyle;
33
+ }
@@ -0,0 +1,53 @@
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, Input, Renderer2, ElementRef } from '@angular/core';
7
+ let GridLayoutItemComponent = class GridLayoutItemComponent {
8
+ constructor(renderer, element) {
9
+ this.renderer = renderer;
10
+ this.element = element;
11
+ }
12
+ ngOnInit() {
13
+ this.setItemStyle();
14
+ }
15
+ ngOnChanges() {
16
+ this.setItemStyle();
17
+ }
18
+ setItemStyle() {
19
+ const row = this.row || 'auto';
20
+ const col = this.col || 'auto';
21
+ const rowSpan = this.rowSpan ? `span ${this.rowSpan}` : 'auto';
22
+ const colSpan = this.colSpan ? `span ${this.colSpan}` : 'auto';
23
+ const gridAreaStyle = `${row} / ${col} / ${rowSpan} / ${colSpan}`;
24
+ this.renderer.setStyle(this.element.nativeElement, 'grid-area', gridAreaStyle);
25
+ }
26
+ };
27
+ tslib_1.__decorate([
28
+ Input(),
29
+ tslib_1.__metadata("design:type", Number)
30
+ ], GridLayoutItemComponent.prototype, "row", void 0);
31
+ tslib_1.__decorate([
32
+ Input(),
33
+ tslib_1.__metadata("design:type", Number)
34
+ ], GridLayoutItemComponent.prototype, "col", void 0);
35
+ tslib_1.__decorate([
36
+ Input(),
37
+ tslib_1.__metadata("design:type", Number)
38
+ ], GridLayoutItemComponent.prototype, "rowSpan", void 0);
39
+ tslib_1.__decorate([
40
+ Input(),
41
+ tslib_1.__metadata("design:type", Number)
42
+ ], GridLayoutItemComponent.prototype, "colSpan", void 0);
43
+ GridLayoutItemComponent = tslib_1.__decorate([
44
+ Component({
45
+ selector: 'kendo-gridlayout-item',
46
+ template: `
47
+ <ng-content></ng-content>
48
+ `
49
+ }),
50
+ tslib_1.__metadata("design:paramtypes", [Renderer2,
51
+ ElementRef])
52
+ ], GridLayoutItemComponent);
53
+ export { GridLayoutItemComponent };
@@ -0,0 +1,17 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ /**
6
+ * Specifies the gaps between the elements of the GridLayout.
7
+ */
8
+ export interface GridLayoutGapSettings {
9
+ /**
10
+ * Defines the row gap between the elements.
11
+ */
12
+ rows?: number | string;
13
+ /**
14
+ * Defines the column gap between the elements.
15
+ */
16
+ cols?: number | string;
17
+ }
@@ -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,22 @@
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 size of the GridLayout row.
7
+ */
8
+ export interface GridLayoutRowSize {
9
+ /**
10
+ * Defines the height of the row.
11
+ */
12
+ height?: number | string;
13
+ }
14
+ /**
15
+ * Specifies the size of the GridLayout column.
16
+ */
17
+ export interface GridLayoutColSize {
18
+ /**
19
+ * Defines the width of the column.
20
+ */
21
+ width?: number | string;
22
+ }
@@ -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,18 @@
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 { VerticalAlign, HorizontalAlign } from '../models';
6
+ /**
7
+ * Represents the possible align options of the StackLayout and GridLayout components.
8
+ */
9
+ export interface AlignSettings {
10
+ /**
11
+ * Defines the horizontal alignment of the inner GridLayout and StackLayout elements.
12
+ */
13
+ horizontal?: HorizontalAlign;
14
+ /**
15
+ * Defines the vertical alignment of the inner GridLayout and StackLayout elements.
16
+ */
17
+ vertical?: VerticalAlign;
18
+ }
@@ -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
+ * Represents the possible horizontal alignment options of the StackLayout and GridLayout.
7
+ */
8
+ export declare type HorizontalAlign = 'start' | 'center' | 'end' | 'stretch';
@@ -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
+ * Represents the possible vertical alignment options of the StackLayout and GridLayout.
7
+ */
8
+ export declare type VerticalAlign = 'top' | 'middle' | 'bottom' | 'stretch';
@@ -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,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
+ export * from './models/layout-align-settings';
6
+ export * from './models/layout-horizontal-align';
7
+ export * from './models/layout-vertical-align';
8
+ export * from './models/gridlayout-gap-settings';
9
+ export * from './models/gridlayout-row-col-size';
10
+ export * from '../common/orientation';
@@ -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,47 @@
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 { Renderer2, ElementRef, AfterViewInit, SimpleChanges, OnChanges } from '@angular/core';
6
+ import { AlignSettings, Orientation } from './models';
7
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
8
+ /**
9
+ * Represents the [Kendo UI StackLayout component for Angular]({% slug overview_stacklayout %}).
10
+ */
11
+ export declare class StackLayoutComponent implements AfterViewInit, OnChanges {
12
+ private renderer;
13
+ private element;
14
+ private localization;
15
+ hostClass: boolean;
16
+ readonly horizontalClass: boolean;
17
+ readonly verticalClass: boolean;
18
+ readonly dir: string;
19
+ /**
20
+ * Specifies the horizontal and vertical alignment of the inner StackLayout elements
21
+ * ([see example]({% slug layout_stacklayout %}#toc-alignment)).
22
+ */
23
+ align: AlignSettings;
24
+ /**
25
+ * Specifies the gap between the inner StackLayout elements. The default value is `0`
26
+ * ([see example]({% slug layout_stacklayout %}#toc-gaps)).
27
+ */
28
+ gap: number | string;
29
+ /**
30
+ * Specifies the orientation of the StackLayout
31
+ * ([see example]({% slug layout_stacklayout %}#toc-orientation)).
32
+ *
33
+ * The possible values are:
34
+ * (Default) `horizontal`
35
+ * `vertical`
36
+ */
37
+ orientation: Orientation;
38
+ private _align;
39
+ private justifyClass;
40
+ private alignClass;
41
+ constructor(renderer: Renderer2, element: ElementRef, localization: LocalizationService);
42
+ ngAfterViewInit(): void;
43
+ ngOnChanges(changes: SimpleChanges): void;
44
+ private handleAlignClasses;
45
+ private setGap;
46
+ private readonly direction;
47
+ }
@@ -0,0 +1,152 @@
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, HostBinding, Input, Renderer2, ElementRef } from '@angular/core';
7
+ import { VERTICAL_SUFFIX, ALIGN_PREFIX, JUSTIFY_PREFIX } from './util';
8
+ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
9
+ import { isNumber, isPresent } from '../common/util';
10
+ import { validatePackage } from '@progress/kendo-licensing';
11
+ import { packageMetadata } from '../package-metadata';
12
+ import { isChanged } from '@progress/kendo-angular-common';
13
+ /**
14
+ * Represents the [Kendo UI StackLayout component for Angular]({% slug overview_stacklayout %}).
15
+ */
16
+ let StackLayoutComponent = class StackLayoutComponent {
17
+ constructor(renderer, element, localization) {
18
+ this.renderer = renderer;
19
+ this.element = element;
20
+ this.localization = localization;
21
+ this.hostClass = true;
22
+ /**
23
+ * Specifies the gap between the inner StackLayout elements. The default value is `0`
24
+ * ([see example]({% slug layout_stacklayout %}#toc-gaps)).
25
+ */
26
+ this.gap = 0;
27
+ /**
28
+ * Specifies the orientation of the StackLayout
29
+ * ([see example]({% slug layout_stacklayout %}#toc-orientation)).
30
+ *
31
+ * The possible values are:
32
+ * (Default) `horizontal`
33
+ * `vertical`
34
+ */
35
+ this.orientation = 'horizontal';
36
+ this._align = {
37
+ horizontal: 'stretch',
38
+ vertical: 'stretch'
39
+ };
40
+ validatePackage(packageMetadata);
41
+ }
42
+ get horizontalClass() {
43
+ return this.orientation === 'horizontal';
44
+ }
45
+ get verticalClass() {
46
+ return this.orientation === 'vertical';
47
+ }
48
+ get dir() {
49
+ return this.direction;
50
+ }
51
+ /**
52
+ * Specifies the horizontal and vertical alignment of the inner StackLayout elements
53
+ * ([see example]({% slug layout_stacklayout %}#toc-alignment)).
54
+ */
55
+ set align(align) {
56
+ this._align = Object.assign({}, this._align, align);
57
+ this.handleAlignClasses();
58
+ }
59
+ get align() {
60
+ return this._align;
61
+ }
62
+ ngAfterViewInit() {
63
+ this.handleAlignClasses();
64
+ this.setGap();
65
+ }
66
+ ngOnChanges(changes) {
67
+ if (isChanged('gap', changes)) {
68
+ this.setGap();
69
+ }
70
+ if (isChanged('orientation', changes)) {
71
+ this.handleAlignClasses();
72
+ }
73
+ }
74
+ handleAlignClasses() {
75
+ const elem = this.element.nativeElement;
76
+ if (isPresent(this.justifyClass)) {
77
+ this.renderer.removeClass(elem, this.justifyClass);
78
+ }
79
+ if (isPresent(this.alignClass)) {
80
+ this.renderer.removeClass(elem, this.alignClass);
81
+ }
82
+ if (this.orientation === 'horizontal') {
83
+ this.justifyClass = `${JUSTIFY_PREFIX}-${this.align.horizontal}`;
84
+ this.alignClass = `${ALIGN_PREFIX}-${VERTICAL_SUFFIX[this.align.vertical]}`;
85
+ }
86
+ else {
87
+ this.justifyClass = `${JUSTIFY_PREFIX}-${VERTICAL_SUFFIX[this.align.vertical]}`;
88
+ this.alignClass = `${ALIGN_PREFIX}-${this.align.horizontal}`;
89
+ }
90
+ this.renderer.addClass(elem, this.justifyClass);
91
+ this.renderer.addClass(elem, this.alignClass);
92
+ }
93
+ setGap() {
94
+ const parsedGap = isNumber(this.gap) ? `${this.gap}px` : this.gap;
95
+ this.renderer.setStyle(this.element.nativeElement, 'gap', parsedGap);
96
+ }
97
+ get direction() {
98
+ return this.localization.rtl ? 'rtl' : 'ltr';
99
+ }
100
+ };
101
+ tslib_1.__decorate([
102
+ HostBinding('class.k-stack-layout'),
103
+ tslib_1.__metadata("design:type", Boolean)
104
+ ], StackLayoutComponent.prototype, "hostClass", void 0);
105
+ tslib_1.__decorate([
106
+ HostBinding('class.k-hstack'),
107
+ tslib_1.__metadata("design:type", Boolean),
108
+ tslib_1.__metadata("design:paramtypes", [])
109
+ ], StackLayoutComponent.prototype, "horizontalClass", null);
110
+ tslib_1.__decorate([
111
+ HostBinding('class.k-vstack'),
112
+ tslib_1.__metadata("design:type", Boolean),
113
+ tslib_1.__metadata("design:paramtypes", [])
114
+ ], StackLayoutComponent.prototype, "verticalClass", null);
115
+ tslib_1.__decorate([
116
+ HostBinding('attr.dir'),
117
+ tslib_1.__metadata("design:type", String),
118
+ tslib_1.__metadata("design:paramtypes", [])
119
+ ], StackLayoutComponent.prototype, "dir", null);
120
+ tslib_1.__decorate([
121
+ Input(),
122
+ tslib_1.__metadata("design:type", Object),
123
+ tslib_1.__metadata("design:paramtypes", [Object])
124
+ ], StackLayoutComponent.prototype, "align", null);
125
+ tslib_1.__decorate([
126
+ Input(),
127
+ tslib_1.__metadata("design:type", Object)
128
+ ], StackLayoutComponent.prototype, "gap", void 0);
129
+ tslib_1.__decorate([
130
+ Input(),
131
+ tslib_1.__metadata("design:type", String)
132
+ ], StackLayoutComponent.prototype, "orientation", void 0);
133
+ StackLayoutComponent = tslib_1.__decorate([
134
+ Component({
135
+ exportAs: 'kendoStackLayout',
136
+ selector: 'kendo-stacklayout',
137
+ providers: [
138
+ LocalizationService,
139
+ {
140
+ provide: L10N_PREFIX,
141
+ useValue: 'kendo.stacklayout'
142
+ }
143
+ ],
144
+ template: `
145
+ <ng-content></ng-content>
146
+ `
147
+ }),
148
+ tslib_1.__metadata("design:paramtypes", [Renderer2,
149
+ ElementRef,
150
+ LocalizationService])
151
+ ], StackLayoutComponent);
152
+ export { StackLayoutComponent };
@@ -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 { GridLayoutColSize, GridLayoutGapSettings, GridLayoutRowSize } from "./models";
6
+ /**
7
+ * @hidden
8
+ */
9
+ export declare const VERTICAL_SUFFIX: {
10
+ top: string;
11
+ middle: string;
12
+ bottom: string;
13
+ stretch: string;
14
+ };
15
+ /**
16
+ * @hidden
17
+ */
18
+ export declare const JUSTIFY_PREFIX = "k-justify-content";
19
+ /**
20
+ * @hidden
21
+ */
22
+ export declare const GRID_JUSTIFY_PREFIX = "k-justify-items";
23
+ /**
24
+ * @hidden
25
+ */
26
+ export declare const ALIGN_PREFIX = "k-align-items";
27
+ /**
28
+ * @hidden
29
+ */
30
+ export declare const normalizeGap: (gap: string | number | GridLayoutGapSettings) => GridLayoutGapSettings;
31
+ /**
32
+ * @hidden
33
+ */
34
+ export declare const generateGapStyle: (gap: GridLayoutGapSettings) => string;
35
+ /**
36
+ * @hidden
37
+ */
38
+ export declare const generateGridStyle: (items: (string | number | GridLayoutRowSize | GridLayoutColSize)[], itemType: string) => string[];