@progress/kendo-angular-layout 6.4.2-dev.202201271101 → 6.5.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/dist/cdn/js/kendo-angular-layout.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/common/util.js +4 -0
- package/dist/es/gridlayout.module.js +31 -0
- package/dist/es/layout.module.js +5 -1
- package/dist/es/layouts/grid-layout.component.js +155 -0
- package/dist/es/layouts/gridlayout-item.component.js +52 -0
- package/dist/es/layouts/models/gridlayout-gap-settings.js +4 -0
- package/dist/es/layouts/models/gridlayout-row-col-size.js +4 -0
- package/dist/es/layouts/models/layout-align-settings.js +4 -0
- package/dist/es/layouts/models/layout-horizontal-align.js +4 -0
- package/dist/es/layouts/models/layout-vertical-align.js +4 -0
- package/dist/es/layouts/models.js +4 -0
- package/dist/es/layouts/stack-layout.component.js +171 -0
- package/dist/es/layouts/util.js +102 -0
- package/dist/es/main.js +7 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/stacklayout.module.js +29 -0
- package/dist/es2015/common/orientation.d.ts +1 -1
- package/dist/es2015/common/util.d.ts +4 -0
- package/dist/es2015/common/util.js +4 -0
- package/dist/es2015/gridlayout.module.d.ts +10 -0
- package/dist/es2015/gridlayout.module.js +30 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/layout.module.js +5 -1
- package/dist/es2015/layouts/grid-layout.component.d.ts +63 -0
- package/dist/es2015/layouts/grid-layout.component.js +144 -0
- package/dist/es2015/layouts/gridlayout-item.component.d.ts +33 -0
- package/dist/es2015/layouts/gridlayout-item.component.js +53 -0
- package/dist/es2015/layouts/models/gridlayout-gap-settings.d.ts +17 -0
- package/dist/es2015/layouts/models/gridlayout-gap-settings.js +4 -0
- package/dist/es2015/layouts/models/gridlayout-row-col-size.d.ts +22 -0
- package/dist/es2015/layouts/models/gridlayout-row-col-size.js +4 -0
- package/dist/es2015/layouts/models/layout-align-settings.d.ts +18 -0
- package/dist/es2015/layouts/models/layout-align-settings.js +4 -0
- package/dist/es2015/layouts/models/layout-horizontal-align.d.ts +8 -0
- package/dist/es2015/layouts/models/layout-horizontal-align.js +4 -0
- package/dist/es2015/layouts/models/layout-vertical-align.d.ts +8 -0
- package/dist/es2015/layouts/models/layout-vertical-align.js +4 -0
- package/dist/es2015/layouts/models.d.ts +10 -0
- package/dist/es2015/layouts/models.js +4 -0
- package/dist/es2015/layouts/stack-layout.component.d.ts +47 -0
- package/dist/es2015/layouts/stack-layout.component.js +152 -0
- package/dist/es2015/layouts/util.d.ts +42 -0
- package/dist/es2015/layouts/util.js +101 -0
- package/dist/es2015/main.d.ts +7 -0
- package/dist/es2015/main.js +7 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/stacklayout.module.d.ts +10 -0
- package/dist/es2015/stacklayout.module.js +28 -0
- package/dist/fesm2015/index.js +468 -4
- package/dist/fesm5/index.js +500 -4
- package/dist/npm/common/util.js +4 -0
- package/dist/npm/gridlayout.module.js +33 -0
- package/dist/npm/layout.module.js +5 -1
- package/dist/npm/layouts/grid-layout.component.js +157 -0
- package/dist/npm/layouts/gridlayout-item.component.js +54 -0
- package/dist/npm/layouts/models/gridlayout-gap-settings.js +6 -0
- package/dist/npm/layouts/models/gridlayout-row-col-size.js +6 -0
- package/dist/npm/layouts/models/layout-align-settings.js +6 -0
- package/dist/npm/layouts/models/layout-horizontal-align.js +6 -0
- package/dist/npm/layouts/models/layout-vertical-align.js +6 -0
- package/dist/npm/layouts/models.js +6 -0
- package/dist/npm/layouts/stack-layout.component.js +173 -0
- package/dist/npm/layouts/util.js +104 -0
- package/dist/npm/main.js +12 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/stacklayout.module.js +31 -0
- package/dist/systemjs/kendo-angular-layout.js +1 -1
- 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,63 @@
|
|
|
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 { 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
|
+
* Accepts an array, which serves two purposes:
|
|
22
|
+
*
|
|
23
|
+
* The number of elements in the array defines the number of rows.
|
|
24
|
+
* Each array element defines the size of the corresponding row. The possible array values are:
|
|
25
|
+
* * `number` - Defines the size in pixels.
|
|
26
|
+
* * `string` - Enables the usage of arbitrary units e.g. `20%` or `auto`.
|
|
27
|
+
* * [GridLayoutRowSize]({% slug api_layout_gridlayoutrowsize %}) - Configuration object, which accepts a `height` key.
|
|
28
|
+
*/
|
|
29
|
+
rows: Array<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Specifies the number of columns and their widths
|
|
32
|
+
* ([More details]({% slug layout_gridlayout %}#toc-rows-and-columns)).
|
|
33
|
+
*
|
|
34
|
+
* Accepts an array, which serves two purposes:
|
|
35
|
+
*
|
|
36
|
+
* The number of elements in the array defines the number of columns.
|
|
37
|
+
* Each array element defines the size of the corresponding column. The possible array values are:
|
|
38
|
+
* * `number` - Defines the size in pixels.
|
|
39
|
+
* * `string` - Enables the usage of arbitrary units e.g. `20%` or `auto`.
|
|
40
|
+
* * [GridLayoutColSize]({% slug api_layout_gridlayoutcolsize %}) - Configuration object, which accepts a `width` key.
|
|
41
|
+
*/
|
|
42
|
+
cols: Array<any>;
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the gaps between the elements. The default value is `0`
|
|
45
|
+
* ([see example]({% slug layout_gridlayout %}#toc-gaps)).
|
|
46
|
+
*/
|
|
47
|
+
gap: number | string | GridLayoutGapSettings;
|
|
48
|
+
/**
|
|
49
|
+
* Specifies the horizontal and vertical alignment of the inner GridLayout elements
|
|
50
|
+
* ([see example]({% slug layout_gridlayout %}#toc-alignment)).
|
|
51
|
+
*/
|
|
52
|
+
align: AlignSettings;
|
|
53
|
+
private _align;
|
|
54
|
+
private justifyClass;
|
|
55
|
+
private alignClass;
|
|
56
|
+
constructor(renderer: Renderer2, element: ElementRef, localization: LocalizationService);
|
|
57
|
+
ngAfterViewInit(): void;
|
|
58
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
59
|
+
private handleAlignClasses;
|
|
60
|
+
private setGap;
|
|
61
|
+
private handleGridTemplateStyling;
|
|
62
|
+
private readonly direction;
|
|
63
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
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, isDevMode } 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, validateGridLayoutRowsCols } 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 isValid = validateGridLayoutRowsCols(this[type]);
|
|
87
|
+
if (!isValid && isDevMode()) {
|
|
88
|
+
const valueType = type === 'rows' ? 'GridLayoutRowSize' : 'GridLayoutColSize';
|
|
89
|
+
throw new Error(`The provided ${type} value contains invalid elements. The array supports values of type number, string or ${valueType}.`);
|
|
90
|
+
}
|
|
91
|
+
const gridTemplateStyle = type === 'rows' ? 'grid-template-rows' : 'grid-template-columns';
|
|
92
|
+
const gridStyle = generateGridStyle(this[type], type);
|
|
93
|
+
this.renderer.setStyle(this.element.nativeElement, gridTemplateStyle, gridStyle.join(' '));
|
|
94
|
+
}
|
|
95
|
+
get direction() {
|
|
96
|
+
return this.localization.rtl ? 'rtl' : 'ltr';
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
tslib_1.__decorate([
|
|
100
|
+
HostBinding('class.k-grid-layout'),
|
|
101
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
102
|
+
], GridLayoutComponent.prototype, "hostClass", void 0);
|
|
103
|
+
tslib_1.__decorate([
|
|
104
|
+
HostBinding('attr.dir'),
|
|
105
|
+
tslib_1.__metadata("design:type", String),
|
|
106
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
107
|
+
], GridLayoutComponent.prototype, "dir", null);
|
|
108
|
+
tslib_1.__decorate([
|
|
109
|
+
Input(),
|
|
110
|
+
tslib_1.__metadata("design:type", Array)
|
|
111
|
+
], GridLayoutComponent.prototype, "rows", void 0);
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
Input(),
|
|
114
|
+
tslib_1.__metadata("design:type", Array)
|
|
115
|
+
], GridLayoutComponent.prototype, "cols", void 0);
|
|
116
|
+
tslib_1.__decorate([
|
|
117
|
+
Input(),
|
|
118
|
+
tslib_1.__metadata("design:type", Object)
|
|
119
|
+
], GridLayoutComponent.prototype, "gap", void 0);
|
|
120
|
+
tslib_1.__decorate([
|
|
121
|
+
Input(),
|
|
122
|
+
tslib_1.__metadata("design:type", Object),
|
|
123
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
124
|
+
], GridLayoutComponent.prototype, "align", null);
|
|
125
|
+
GridLayoutComponent = tslib_1.__decorate([
|
|
126
|
+
Component({
|
|
127
|
+
exportAs: 'kendoGridLayout',
|
|
128
|
+
selector: 'kendo-gridlayout',
|
|
129
|
+
providers: [
|
|
130
|
+
LocalizationService,
|
|
131
|
+
{
|
|
132
|
+
provide: L10N_PREFIX,
|
|
133
|
+
useValue: 'kendo.gridlayout'
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
template: `
|
|
137
|
+
<ng-content></ng-content>
|
|
138
|
+
`
|
|
139
|
+
}),
|
|
140
|
+
tslib_1.__metadata("design:paramtypes", [Renderer2,
|
|
141
|
+
ElementRef,
|
|
142
|
+
LocalizationService])
|
|
143
|
+
], GridLayoutComponent);
|
|
144
|
+
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 };
|