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

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.
@@ -3,7 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Renderer2, ElementRef, AfterViewInit, SimpleChanges, OnChanges } from '@angular/core';
6
- import { GridLayoutRowSize, GridLayoutColSize, GridLayoutGapSettings, AlignSettings } from './models';
6
+ import { GridLayoutGapSettings, AlignSettings } from './models';
7
7
  import { LocalizationService } from '@progress/kendo-angular-l10n';
8
8
  /**
9
9
  * Represents the [Kendo UI GridLayout component for Angular]({% slug overview_gridlayout %}).
@@ -17,13 +17,29 @@ export declare class GridLayoutComponent implements AfterViewInit, OnChanges {
17
17
  /**
18
18
  * Specifies the number of rows and their height
19
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.
20
28
  */
21
- rows: Array<number | string | GridLayoutRowSize>;
29
+ rows: Array<any>;
22
30
  /**
23
31
  * Specifies the number of columns and their widths
24
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.
25
41
  */
26
- cols: Array<number | string | GridLayoutColSize>;
42
+ cols: Array<any>;
27
43
  /**
28
44
  * Specifies the gaps between the elements. The default value is `0`
29
45
  * ([see example]({% slug layout_gridlayout %}#toc-gaps)).
@@ -3,10 +3,10 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
- import { Component, HostBinding, Input, Renderer2, ElementRef } from '@angular/core';
6
+ import { Component, HostBinding, Input, Renderer2, ElementRef, isDevMode } from '@angular/core';
7
7
  import { validatePackage } from '@progress/kendo-licensing';
8
8
  import { packageMetadata } from '../package-metadata';
9
- import { ALIGN_PREFIX, generateGapStyle, generateGridStyle, GRID_JUSTIFY_PREFIX, normalizeGap, VERTICAL_SUFFIX } from './util';
9
+ import { ALIGN_PREFIX, generateGapStyle, generateGridStyle, GRID_JUSTIFY_PREFIX, normalizeGap, VERTICAL_SUFFIX, validateGridLayoutRowsCols } from './util';
10
10
  import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
11
11
  import { isPresent } from '../common/util';
12
12
  import { isChanged } from '@progress/kendo-angular-common';
@@ -83,6 +83,11 @@ let GridLayoutComponent = class GridLayoutComponent {
83
83
  if (!isPresent(this[type])) {
84
84
  return;
85
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
+ }
86
91
  const gridTemplateStyle = type === 'rows' ? 'grid-template-rows' : 'grid-template-columns';
87
92
  const gridStyle = generateGridStyle(this[type], type);
88
93
  this.renderer.setStyle(this.element.nativeElement, gridTemplateStyle, gridStyle.join(' '));
@@ -36,3 +36,7 @@ export declare const generateGapStyle: (gap: GridLayoutGapSettings) => string;
36
36
  * @hidden
37
37
  */
38
38
  export declare const generateGridStyle: (items: (string | number | GridLayoutRowSize | GridLayoutColSize)[], itemType: string) => string[];
39
+ /**
40
+ * @hidden
41
+ */
42
+ export declare const validateGridLayoutRowsCols: (arr: any[]) => boolean;
@@ -85,3 +85,17 @@ export const generateGridStyle = (items, itemType) => {
85
85
  });
86
86
  return styling;
87
87
  };
88
+ /**
89
+ * @hidden
90
+ */
91
+ export const validateGridLayoutRowsCols = (arr) => {
92
+ for (const el of arr) {
93
+ const isNum = typeof el === 'number';
94
+ const isStr = typeof el === 'string';
95
+ const isObject = typeof el === 'object' && el !== null;
96
+ if (!isNum && !isStr && !isObject) {
97
+ return false;
98
+ }
99
+ }
100
+ return true;
101
+ };
@@ -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: 1644423873,
12
+ publishDate: 1644825801,
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
  };
@@ -21,7 +21,7 @@ const packageMetadata = {
21
21
  name: '@progress/kendo-angular-layout',
22
22
  productName: 'Kendo UI for Angular',
23
23
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
24
- publishDate: 1644423873,
24
+ publishDate: 1644825801,
25
25
  version: '',
26
26
  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'
27
27
  };
@@ -8356,6 +8356,20 @@ const generateGridStyle = (items, itemType) => {
8356
8356
  });
8357
8357
  return styling;
8358
8358
  };
8359
+ /**
8360
+ * @hidden
8361
+ */
8362
+ const validateGridLayoutRowsCols = (arr) => {
8363
+ for (const el of arr) {
8364
+ const isNum = typeof el === 'number';
8365
+ const isStr = typeof el === 'string';
8366
+ const isObject = typeof el === 'object' && el !== null;
8367
+ if (!isNum && !isStr && !isObject) {
8368
+ return false;
8369
+ }
8370
+ }
8371
+ return true;
8372
+ };
8359
8373
 
8360
8374
  /**
8361
8375
  * Represents the [Kendo UI StackLayout component for Angular]({% slug overview_stacklayout %}).
@@ -8590,6 +8604,11 @@ let GridLayoutComponent = class GridLayoutComponent {
8590
8604
  if (!isPresent(this[type])) {
8591
8605
  return;
8592
8606
  }
8607
+ const isValid = validateGridLayoutRowsCols(this[type]);
8608
+ if (!isValid && isDevMode()) {
8609
+ const valueType = type === 'rows' ? 'GridLayoutRowSize' : 'GridLayoutColSize';
8610
+ throw new Error(`The provided ${type} value contains invalid elements. The array supports values of type number, string or ${valueType}.`);
8611
+ }
8593
8612
  const gridTemplateStyle = type === 'rows' ? 'grid-template-rows' : 'grid-template-columns';
8594
8613
  const gridStyle = generateGridStyle(this[type], type);
8595
8614
  this.renderer.setStyle(this.element.nativeElement, gridTemplateStyle, gridStyle.join(' '));
@@ -21,7 +21,7 @@ var packageMetadata = {
21
21
  name: '@progress/kendo-angular-layout',
22
22
  productName: 'Kendo UI for Angular',
23
23
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
24
- publishDate: 1644423873,
24
+ publishDate: 1644825801,
25
25
  version: '',
26
26
  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'
27
27
  };
@@ -8711,6 +8711,21 @@ var generateGridStyle = function (items, itemType) {
8711
8711
  });
8712
8712
  return styling;
8713
8713
  };
8714
+ /**
8715
+ * @hidden
8716
+ */
8717
+ var validateGridLayoutRowsCols = function (arr) {
8718
+ for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) {
8719
+ var el = arr_1[_i];
8720
+ var isNum = typeof el === 'number';
8721
+ var isStr = typeof el === 'string';
8722
+ var isObject = typeof el === 'object' && el !== null;
8723
+ if (!isNum && !isStr && !isObject) {
8724
+ return false;
8725
+ }
8726
+ }
8727
+ return true;
8728
+ };
8714
8729
 
8715
8730
  /**
8716
8731
  * Represents the [Kendo UI StackLayout component for Angular]({% slug overview_stacklayout %}).
@@ -8973,6 +8988,11 @@ var GridLayoutComponent = /** @class */ (function () {
8973
8988
  if (!isPresent(this[type])) {
8974
8989
  return;
8975
8990
  }
8991
+ var isValid = validateGridLayoutRowsCols(this[type]);
8992
+ if (!isValid && isDevMode()) {
8993
+ var valueType = type === 'rows' ? 'GridLayoutRowSize' : 'GridLayoutColSize';
8994
+ throw new Error("The provided " + type + " value contains invalid elements. The array supports values of type number, string or " + valueType + ".");
8995
+ }
8976
8996
  var gridTemplateStyle = type === 'rows' ? 'grid-template-rows' : 'grid-template-columns';
8977
8997
  var gridStyle = generateGridStyle(this[type], type);
8978
8998
  this.renderer.setStyle(this.element.nativeElement, gridTemplateStyle, gridStyle.join(' '));
@@ -93,6 +93,11 @@ var GridLayoutComponent = /** @class */ (function () {
93
93
  if (!util_2.isPresent(this[type])) {
94
94
  return;
95
95
  }
96
+ var isValid = util_1.validateGridLayoutRowsCols(this[type]);
97
+ if (!isValid && core_1.isDevMode()) {
98
+ var valueType = type === 'rows' ? 'GridLayoutRowSize' : 'GridLayoutColSize';
99
+ throw new Error("The provided " + type + " value contains invalid elements. The array supports values of type number, string or " + valueType + ".");
100
+ }
96
101
  var gridTemplateStyle = type === 'rows' ? 'grid-template-rows' : 'grid-template-columns';
97
102
  var gridStyle = util_1.generateGridStyle(this[type], type);
98
103
  this.renderer.setStyle(this.element.nativeElement, gridTemplateStyle, gridStyle.join(' '));
@@ -87,3 +87,18 @@ exports.generateGridStyle = function (items, itemType) {
87
87
  });
88
88
  return styling;
89
89
  };
90
+ /**
91
+ * @hidden
92
+ */
93
+ exports.validateGridLayoutRowsCols = function (arr) {
94
+ for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) {
95
+ var el = arr_1[_i];
96
+ var isNum = typeof el === 'number';
97
+ var isStr = typeof el === 'string';
98
+ var isObject = typeof el === 'object' && el !== null;
99
+ if (!isNum && !isStr && !isObject) {
100
+ return false;
101
+ }
102
+ }
103
+ return true;
104
+ };
@@ -11,7 +11,7 @@ exports.packageMetadata = {
11
11
  name: '@progress/kendo-angular-layout',
12
12
  productName: 'Kendo UI for Angular',
13
13
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
14
- publishDate: 1644423873,
14
+ publishDate: 1644825801,
15
15
  version: '',
16
16
  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'
17
17
  };