@progress/kendo-angular-dropdowns 6.0.1 → 6.0.2-dev.202202171128

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.
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
6
  import { Input } from '@angular/core';
7
- import { getHierarchicalItemLevel, valueFrom } from '../../common/util';
7
+ import { getHierarchicalItemLevel, isArray, valueFrom } from '../../common/util';
8
8
  /**
9
9
  * @hidden
10
10
  *
@@ -20,7 +20,7 @@ var BaseCheckDirective = /** @class */ (function () {
20
20
  var level = getHierarchicalItemLevel(item.index);
21
21
  var candidate = tslib_1.__assign({}, item, { level: level });
22
22
  this.checkedItems.push(candidate);
23
- this.checkedKeys.add(valueFrom(candidate, this.valueField));
23
+ this.checkedKeys.add(this.getKey(candidate));
24
24
  };
25
25
  BaseCheckDirective.prototype.removeItem = function (item) {
26
26
  var _this = this;
@@ -31,15 +31,29 @@ var BaseCheckDirective = /** @class */ (function () {
31
31
  var candidate = tslib_1.__assign({}, item, { level: level });
32
32
  this.checkedItems = this.checkedItems
33
33
  .filter(function (item) { return valueFrom(item, _this.valueField) !== valueFrom(candidate, _this.valueField); });
34
- this.checkedKeys.delete(valueFrom(candidate, this.valueField));
34
+ this.checkedKeys.delete(this.getKey(candidate));
35
35
  };
36
36
  BaseCheckDirective.prototype.isItemChecked = function (item) {
37
- return this.checkedKeys.has(valueFrom(item, this.valueField));
37
+ var level = item.index.split('_').length - 1;
38
+ item.level = level;
39
+ return this.checkedKeys.has(this.getKey(item));
38
40
  };
39
41
  BaseCheckDirective.prototype.updateItems = function () {
40
42
  var _this = this;
41
43
  this.checkedItems = this.checkedItems || [];
42
- this.checkedKeys = new Set(this.checkedItems.map(function (item) { return valueFrom(item, _this.valueField); }));
44
+ this.checkedKeys = new Set(this.checkedItems.map(function (item) { return _this.getKey(item); }));
45
+ };
46
+ /**
47
+ * Adds the item's depth to the item's value to allow duplicate values on different levels.
48
+ *
49
+ * @param item - The checked key.
50
+ * @returns { string } - A string key consisting of the item's `valueField` value and its depth.
51
+ */
52
+ BaseCheckDirective.prototype.getKey = function (item) {
53
+ if (isArray(this.valueField)) {
54
+ return valueFrom(item, this.valueField) + '_' + item.level;
55
+ }
56
+ return valueFrom(item, this.valueField);
43
57
  };
44
58
  tslib_1.__decorate([
45
59
  Input(),
@@ -120,7 +120,8 @@ var MultiSelectComponent = /** @class */ (function () {
120
120
  */
121
121
  this.clearButton = true;
122
122
  /**
123
- * A user-defined callback function which receives an array of selected data items and maps them to an array of tags.
123
+ * A user-defined callback function which receives an array of selected data items and maps them to an array of tags
124
+ * ([see examples]({% slug summarytagmode_multiselect %}#toc-rendering-of-tags)).
124
125
  *
125
126
  * @param { Any[] } dataItems - The selected data items from the list.
126
127
  * @returns { Any[] } - The tags that will be rendered by the component.
@@ -9,7 +9,7 @@ export var packageMetadata = {
9
9
  name: '@progress/kendo-angular-dropdowns',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1642685068,
12
+ publishDate: 1645097139,
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
  };
@@ -29,4 +29,11 @@ export declare abstract class BaseCheckDirective {
29
29
  protected removeItem(item: TreeItem): void;
30
30
  protected isItemChecked(item: CheckedItem): boolean;
31
31
  protected updateItems(): void;
32
+ /**
33
+ * Adds the item's depth to the item's value to allow duplicate values on different levels.
34
+ *
35
+ * @param item - The checked key.
36
+ * @returns { string } - A string key consisting of the item's `valueField` value and its depth.
37
+ */
38
+ private getKey;
32
39
  }
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
6
  import { Input } from '@angular/core';
7
- import { getHierarchicalItemLevel, valueFrom } from '../../common/util';
7
+ import { getHierarchicalItemLevel, isArray, valueFrom } from '../../common/util';
8
8
  /**
9
9
  * @hidden
10
10
  *
@@ -18,7 +18,7 @@ export class BaseCheckDirective {
18
18
  const level = getHierarchicalItemLevel(item.index);
19
19
  const candidate = Object.assign({}, item, { level });
20
20
  this.checkedItems.push(candidate);
21
- this.checkedKeys.add(valueFrom(candidate, this.valueField));
21
+ this.checkedKeys.add(this.getKey(candidate));
22
22
  }
23
23
  removeItem(item) {
24
24
  if (!this.isItemChecked(item)) {
@@ -28,14 +28,28 @@ export class BaseCheckDirective {
28
28
  const candidate = Object.assign({}, item, { level });
29
29
  this.checkedItems = this.checkedItems
30
30
  .filter(item => valueFrom(item, this.valueField) !== valueFrom(candidate, this.valueField));
31
- this.checkedKeys.delete(valueFrom(candidate, this.valueField));
31
+ this.checkedKeys.delete(this.getKey(candidate));
32
32
  }
33
33
  isItemChecked(item) {
34
- return this.checkedKeys.has(valueFrom(item, this.valueField));
34
+ const level = item.index.split('_').length - 1;
35
+ item.level = level;
36
+ return this.checkedKeys.has(this.getKey(item));
35
37
  }
36
38
  updateItems() {
37
39
  this.checkedItems = this.checkedItems || [];
38
- this.checkedKeys = new Set(this.checkedItems.map(item => valueFrom(item, this.valueField)));
40
+ this.checkedKeys = new Set(this.checkedItems.map(item => this.getKey(item)));
41
+ }
42
+ /**
43
+ * Adds the item's depth to the item's value to allow duplicate values on different levels.
44
+ *
45
+ * @param item - The checked key.
46
+ * @returns { string } - A string key consisting of the item's `valueField` value and its depth.
47
+ */
48
+ getKey(item) {
49
+ if (isArray(this.valueField)) {
50
+ return valueFrom(item, this.valueField) + '_' + item.level;
51
+ }
52
+ return valueFrom(item, this.valueField);
39
53
  }
40
54
  }
41
55
  tslib_1.__decorate([