@progress/kendo-angular-treeview 6.0.0 → 6.0.2-dev.202202251428

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.
@@ -24,8 +24,8 @@ var NavigationService = /** @class */ (function () {
24
24
  this.loadMore = new Subject();
25
25
  this.navigable = true;
26
26
  this.actions = (_a = {},
27
- _a[Keys.ArrowUp] = function () { return _this.activate(_this.model.findVisiblePrev(_this.focusableItem)); },
28
- _a[Keys.ArrowDown] = function () { return _this.activate(_this.model.findVisibleNext(_this.focusableItem)); },
27
+ _a[Keys.ArrowUp] = function () { return _this.activate(_this.model.findVisiblePrev(_this.focusableItem), true); },
28
+ _a[Keys.ArrowDown] = function () { return _this.activate(_this.model.findVisibleNext(_this.focusableItem), true); },
29
29
  _a[Keys.ArrowLeft] = function () { return !_this.isLoadMoreButton && (_this.expand({
30
30
  expand: _this.localization.rtl,
31
31
  intercept: _this.localization.rtl ? _this.moveToFirstVisibleChild : _this.moveToParent
@@ -34,12 +34,13 @@ var NavigationService = /** @class */ (function () {
34
34
  expand: !_this.localization.rtl,
35
35
  intercept: _this.localization.rtl ? _this.moveToParent : _this.moveToFirstVisibleChild
36
36
  })); },
37
- _a[Keys.Home] = function () { return _this.activate(_this.model.firstVisibleNode()); },
38
- _a[Keys.End] = function () { return _this.activate(_this.model.lastVisibleNode()); },
37
+ _a[Keys.Home] = function () { return _this.activate(_this.model.firstVisibleNode(), true); },
38
+ _a[Keys.End] = function () { return _this.activate(_this.model.lastVisibleNode(), true); },
39
39
  _a[Keys.Enter] = function () { return _this.handleEnter(); },
40
40
  _a[Keys.Space] = function () { return _this.handleSpace(); },
41
41
  _a);
42
42
  this.isFocused = false;
43
+ this.shouldScroll = false;
43
44
  this._model = new NavigationModel();
44
45
  this.moveToFirstVisibleChild = this.moveToFirstVisibleChild.bind(this);
45
46
  this.moveToParent = this.moveToParent.bind(this);
@@ -82,12 +83,14 @@ var NavigationService = /** @class */ (function () {
82
83
  enumerable: true,
83
84
  configurable: true
84
85
  });
85
- NavigationService.prototype.activate = function (item) {
86
+ NavigationService.prototype.activate = function (item, shouldScroll) {
87
+ if (shouldScroll === void 0) { shouldScroll = false; }
86
88
  if (!this.navigable || !item || this.isActive(nodeIndex(item))) {
87
89
  return;
88
90
  }
89
91
  this.isFocused = true;
90
92
  this.activeItem = item || this.activeItem;
93
+ this.shouldScroll = shouldScroll;
91
94
  this.notifyMove();
92
95
  };
93
96
  NavigationService.prototype.activateParent = function (index) {
@@ -207,7 +210,7 @@ var NavigationService = /** @class */ (function () {
207
210
  };
208
211
  NavigationService.prototype.navigationState = function (expand) {
209
212
  if (expand === void 0) { expand = false; }
210
- return ({ expand: expand, index: this.activeIndex, isFocused: this.isFocused });
213
+ return ({ expand: expand, index: this.activeIndex, isFocused: this.isFocused, shouldScroll: this.shouldScroll });
211
214
  };
212
215
  NavigationService.prototype.handleEnter = function () {
213
216
  if (!this.navigable) {
@@ -9,7 +9,7 @@ export var packageMetadata = {
9
9
  name: '@progress/kendo-angular-treeview',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1642578286,
12
+ publishDate: 1645799161,
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
  };
@@ -135,9 +135,9 @@ var TreeViewItemDirective = /** @class */ (function () {
135
135
  var _this = this;
136
136
  this.subscriptions = [
137
137
  this.navigationService.moves
138
- .subscribe(function () {
138
+ .subscribe(function (navState) {
139
139
  _this.updateTabIndex();
140
- _this.focusItem();
140
+ _this.focusItem(navState.shouldScroll);
141
141
  }),
142
142
  this.navigationService.expands
143
143
  .pipe(filter(function (_a) {
@@ -172,9 +172,10 @@ var TreeViewItemDirective = /** @class */ (function () {
172
172
  TreeViewItemDirective.prototype.isFocusable = function () {
173
173
  return !this.isDisabled && this.navigationService.isFocusable(this.index);
174
174
  };
175
- TreeViewItemDirective.prototype.focusItem = function () {
175
+ TreeViewItemDirective.prototype.focusItem = function (scrollIntoView) {
176
+ if (scrollIntoView === void 0) { scrollIntoView = false; }
176
177
  if (this.isInitialized && this.navigationService.isActive(this.index)) {
177
- this.element.nativeElement.focus();
178
+ this.element.nativeElement.focus({ preventScroll: !scrollIntoView });
178
179
  }
179
180
  };
180
181
  TreeViewItemDirective.prototype.moveLookupItem = function (changes) {