@progress/kendo-angular-treeview 6.0.0-dev.202201190736 → 6.0.1

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,13 +24,14 @@ export declare class NavigationService {
24
24
  };
25
25
  private activeItem;
26
26
  private isFocused;
27
+ private shouldScroll;
27
28
  private _model;
28
29
  private readonly activeIndex;
29
30
  private readonly isActiveExpanded;
30
31
  private readonly isLoadMoreButton;
31
32
  readonly focusableItem: NavigationItem;
32
33
  constructor(localization: LocalizationService);
33
- activate(item: NavigationItem): void;
34
+ activate(item: NavigationItem, shouldScroll?: boolean): void;
34
35
  activateParent(index: string): void;
35
36
  activateIndex(index: string): void;
36
37
  activateClosest(index: string): void;
@@ -22,8 +22,8 @@ let NavigationService = class NavigationService {
22
22
  this.loadMore = new Subject();
23
23
  this.navigable = true;
24
24
  this.actions = {
25
- [Keys.ArrowUp]: () => this.activate(this.model.findVisiblePrev(this.focusableItem)),
26
- [Keys.ArrowDown]: () => this.activate(this.model.findVisibleNext(this.focusableItem)),
25
+ [Keys.ArrowUp]: () => this.activate(this.model.findVisiblePrev(this.focusableItem), true),
26
+ [Keys.ArrowDown]: () => this.activate(this.model.findVisibleNext(this.focusableItem), true),
27
27
  [Keys.ArrowLeft]: () => !this.isLoadMoreButton && (this.expand({
28
28
  expand: this.localization.rtl,
29
29
  intercept: this.localization.rtl ? this.moveToFirstVisibleChild : this.moveToParent
@@ -32,12 +32,13 @@ let NavigationService = class NavigationService {
32
32
  expand: !this.localization.rtl,
33
33
  intercept: this.localization.rtl ? this.moveToParent : this.moveToFirstVisibleChild
34
34
  })),
35
- [Keys.Home]: () => this.activate(this.model.firstVisibleNode()),
36
- [Keys.End]: () => this.activate(this.model.lastVisibleNode()),
35
+ [Keys.Home]: () => this.activate(this.model.firstVisibleNode(), true),
36
+ [Keys.End]: () => this.activate(this.model.lastVisibleNode(), true),
37
37
  [Keys.Enter]: () => this.handleEnter(),
38
38
  [Keys.Space]: () => this.handleSpace()
39
39
  };
40
40
  this.isFocused = false;
41
+ this.shouldScroll = false;
41
42
  this._model = new NavigationModel();
42
43
  this.moveToFirstVisibleChild = this.moveToFirstVisibleChild.bind(this);
43
44
  this.moveToParent = this.moveToParent.bind(this);
@@ -60,12 +61,13 @@ let NavigationService = class NavigationService {
60
61
  get focusableItem() {
61
62
  return this.activeItem || this.model.firstFocusableNode();
62
63
  }
63
- activate(item) {
64
+ activate(item, shouldScroll = false) {
64
65
  if (!this.navigable || !item || this.isActive(nodeIndex(item))) {
65
66
  return;
66
67
  }
67
68
  this.isFocused = true;
68
69
  this.activeItem = item || this.activeItem;
70
+ this.shouldScroll = shouldScroll;
69
71
  this.notifyMove();
70
72
  }
71
73
  activateParent(index) {
@@ -181,7 +183,7 @@ let NavigationService = class NavigationService {
181
183
  this.moves.next(this.navigationState());
182
184
  }
183
185
  navigationState(expand = false) {
184
- return ({ expand, index: this.activeIndex, isFocused: this.isFocused });
186
+ return ({ expand, index: this.activeIndex, isFocused: this.isFocused, shouldScroll: this.shouldScroll });
185
187
  }
186
188
  handleEnter() {
187
189
  if (!this.navigable) {
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-treeview',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1642577609,
12
+ publishDate: 1645772610,
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
  };
@@ -110,9 +110,9 @@ let TreeViewItemDirective = class TreeViewItemDirective {
110
110
  subscribe() {
111
111
  this.subscriptions = [
112
112
  this.navigationService.moves
113
- .subscribe(() => {
113
+ .subscribe((navState) => {
114
114
  this.updateTabIndex();
115
- this.focusItem();
115
+ this.focusItem(navState.shouldScroll);
116
116
  }),
117
117
  this.navigationService.expands
118
118
  .pipe(filter(({ index }) => index === this.index && !this.isDisabled))
@@ -141,9 +141,9 @@ let TreeViewItemDirective = class TreeViewItemDirective {
141
141
  isFocusable() {
142
142
  return !this.isDisabled && this.navigationService.isFocusable(this.index);
143
143
  }
144
- focusItem() {
144
+ focusItem(scrollIntoView = false) {
145
145
  if (this.isInitialized && this.navigationService.isActive(this.index)) {
146
- this.element.nativeElement.focus();
146
+ this.element.nativeElement.focus({ preventScroll: !scrollIntoView });
147
147
  }
148
148
  }
149
149
  moveLookupItem(changes = {}) {
@@ -22,7 +22,7 @@ const packageMetadata = {
22
22
  name: '@progress/kendo-angular-treeview',
23
23
  productName: 'Kendo UI for Angular',
24
24
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
25
- publishDate: 1642577609,
25
+ publishDate: 1645772610,
26
26
  version: '',
27
27
  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'
28
28
  };
@@ -590,8 +590,8 @@ let NavigationService = class NavigationService {
590
590
  this.loadMore = new Subject();
591
591
  this.navigable = true;
592
592
  this.actions = {
593
- [Keys.ArrowUp]: () => this.activate(this.model.findVisiblePrev(this.focusableItem)),
594
- [Keys.ArrowDown]: () => this.activate(this.model.findVisibleNext(this.focusableItem)),
593
+ [Keys.ArrowUp]: () => this.activate(this.model.findVisiblePrev(this.focusableItem), true),
594
+ [Keys.ArrowDown]: () => this.activate(this.model.findVisibleNext(this.focusableItem), true),
595
595
  [Keys.ArrowLeft]: () => !this.isLoadMoreButton && (this.expand({
596
596
  expand: this.localization.rtl,
597
597
  intercept: this.localization.rtl ? this.moveToFirstVisibleChild : this.moveToParent
@@ -600,12 +600,13 @@ let NavigationService = class NavigationService {
600
600
  expand: !this.localization.rtl,
601
601
  intercept: this.localization.rtl ? this.moveToParent : this.moveToFirstVisibleChild
602
602
  })),
603
- [Keys.Home]: () => this.activate(this.model.firstVisibleNode()),
604
- [Keys.End]: () => this.activate(this.model.lastVisibleNode()),
603
+ [Keys.Home]: () => this.activate(this.model.firstVisibleNode(), true),
604
+ [Keys.End]: () => this.activate(this.model.lastVisibleNode(), true),
605
605
  [Keys.Enter]: () => this.handleEnter(),
606
606
  [Keys.Space]: () => this.handleSpace()
607
607
  };
608
608
  this.isFocused = false;
609
+ this.shouldScroll = false;
609
610
  this._model = new NavigationModel();
610
611
  this.moveToFirstVisibleChild = this.moveToFirstVisibleChild.bind(this);
611
612
  this.moveToParent = this.moveToParent.bind(this);
@@ -628,12 +629,13 @@ let NavigationService = class NavigationService {
628
629
  get focusableItem() {
629
630
  return this.activeItem || this.model.firstFocusableNode();
630
631
  }
631
- activate(item) {
632
+ activate(item, shouldScroll = false) {
632
633
  if (!this.navigable || !item || this.isActive(nodeIndex(item))) {
633
634
  return;
634
635
  }
635
636
  this.isFocused = true;
636
637
  this.activeItem = item || this.activeItem;
638
+ this.shouldScroll = shouldScroll;
637
639
  this.notifyMove();
638
640
  }
639
641
  activateParent(index) {
@@ -749,7 +751,7 @@ let NavigationService = class NavigationService {
749
751
  this.moves.next(this.navigationState());
750
752
  }
751
753
  navigationState(expand = false) {
752
- return ({ expand, index: this.activeIndex, isFocused: this.isFocused });
754
+ return ({ expand, index: this.activeIndex, isFocused: this.isFocused, shouldScroll: this.shouldScroll });
753
755
  }
754
756
  handleEnter() {
755
757
  if (!this.navigable) {
@@ -4669,9 +4671,9 @@ let TreeViewItemDirective = class TreeViewItemDirective {
4669
4671
  subscribe() {
4670
4672
  this.subscriptions = [
4671
4673
  this.navigationService.moves
4672
- .subscribe(() => {
4674
+ .subscribe((navState) => {
4673
4675
  this.updateTabIndex();
4674
- this.focusItem();
4676
+ this.focusItem(navState.shouldScroll);
4675
4677
  }),
4676
4678
  this.navigationService.expands
4677
4679
  .pipe(filter(({ index }) => index === this.index && !this.isDisabled))
@@ -4700,9 +4702,9 @@ let TreeViewItemDirective = class TreeViewItemDirective {
4700
4702
  isFocusable() {
4701
4703
  return !this.isDisabled && this.navigationService.isFocusable(this.index);
4702
4704
  }
4703
- focusItem() {
4705
+ focusItem(scrollIntoView = false) {
4704
4706
  if (this.isInitialized && this.navigationService.isActive(this.index)) {
4705
- this.element.nativeElement.focus();
4707
+ this.element.nativeElement.focus({ preventScroll: !scrollIntoView });
4706
4708
  }
4707
4709
  }
4708
4710
  moveLookupItem(changes = {}) {
@@ -22,7 +22,7 @@ var packageMetadata = {
22
22
  name: '@progress/kendo-angular-treeview',
23
23
  productName: 'Kendo UI for Angular',
24
24
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
25
- publishDate: 1642577609,
25
+ publishDate: 1645772610,
26
26
  version: '',
27
27
  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'
28
28
  };
@@ -597,8 +597,8 @@ var NavigationService = /** @class */ (function () {
597
597
  this.loadMore = new Subject();
598
598
  this.navigable = true;
599
599
  this.actions = (_a = {},
600
- _a[Keys.ArrowUp] = function () { return _this.activate(_this.model.findVisiblePrev(_this.focusableItem)); },
601
- _a[Keys.ArrowDown] = function () { return _this.activate(_this.model.findVisibleNext(_this.focusableItem)); },
600
+ _a[Keys.ArrowUp] = function () { return _this.activate(_this.model.findVisiblePrev(_this.focusableItem), true); },
601
+ _a[Keys.ArrowDown] = function () { return _this.activate(_this.model.findVisibleNext(_this.focusableItem), true); },
602
602
  _a[Keys.ArrowLeft] = function () { return !_this.isLoadMoreButton && (_this.expand({
603
603
  expand: _this.localization.rtl,
604
604
  intercept: _this.localization.rtl ? _this.moveToFirstVisibleChild : _this.moveToParent
@@ -607,12 +607,13 @@ var NavigationService = /** @class */ (function () {
607
607
  expand: !_this.localization.rtl,
608
608
  intercept: _this.localization.rtl ? _this.moveToParent : _this.moveToFirstVisibleChild
609
609
  })); },
610
- _a[Keys.Home] = function () { return _this.activate(_this.model.firstVisibleNode()); },
611
- _a[Keys.End] = function () { return _this.activate(_this.model.lastVisibleNode()); },
610
+ _a[Keys.Home] = function () { return _this.activate(_this.model.firstVisibleNode(), true); },
611
+ _a[Keys.End] = function () { return _this.activate(_this.model.lastVisibleNode(), true); },
612
612
  _a[Keys.Enter] = function () { return _this.handleEnter(); },
613
613
  _a[Keys.Space] = function () { return _this.handleSpace(); },
614
614
  _a);
615
615
  this.isFocused = false;
616
+ this.shouldScroll = false;
616
617
  this._model = new NavigationModel();
617
618
  this.moveToFirstVisibleChild = this.moveToFirstVisibleChild.bind(this);
618
619
  this.moveToParent = this.moveToParent.bind(this);
@@ -655,12 +656,14 @@ var NavigationService = /** @class */ (function () {
655
656
  enumerable: true,
656
657
  configurable: true
657
658
  });
658
- NavigationService.prototype.activate = function (item) {
659
+ NavigationService.prototype.activate = function (item, shouldScroll) {
660
+ if (shouldScroll === void 0) { shouldScroll = false; }
659
661
  if (!this.navigable || !item || this.isActive(nodeIndex(item))) {
660
662
  return;
661
663
  }
662
664
  this.isFocused = true;
663
665
  this.activeItem = item || this.activeItem;
666
+ this.shouldScroll = shouldScroll;
664
667
  this.notifyMove();
665
668
  };
666
669
  NavigationService.prototype.activateParent = function (index) {
@@ -780,7 +783,7 @@ var NavigationService = /** @class */ (function () {
780
783
  };
781
784
  NavigationService.prototype.navigationState = function (expand) {
782
785
  if (expand === void 0) { expand = false; }
783
- return ({ expand: expand, index: this.activeIndex, isFocused: this.isFocused });
786
+ return ({ expand: expand, index: this.activeIndex, isFocused: this.isFocused, shouldScroll: this.shouldScroll });
784
787
  };
785
788
  NavigationService.prototype.handleEnter = function () {
786
789
  if (!this.navigable) {
@@ -4797,9 +4800,9 @@ var TreeViewItemDirective = /** @class */ (function () {
4797
4800
  var _this = this;
4798
4801
  this.subscriptions = [
4799
4802
  this.navigationService.moves
4800
- .subscribe(function () {
4803
+ .subscribe(function (navState) {
4801
4804
  _this.updateTabIndex();
4802
- _this.focusItem();
4805
+ _this.focusItem(navState.shouldScroll);
4803
4806
  }),
4804
4807
  this.navigationService.expands
4805
4808
  .pipe(filter(function (_a) {
@@ -4834,9 +4837,10 @@ var TreeViewItemDirective = /** @class */ (function () {
4834
4837
  TreeViewItemDirective.prototype.isFocusable = function () {
4835
4838
  return !this.isDisabled && this.navigationService.isFocusable(this.index);
4836
4839
  };
4837
- TreeViewItemDirective.prototype.focusItem = function () {
4840
+ TreeViewItemDirective.prototype.focusItem = function (scrollIntoView) {
4841
+ if (scrollIntoView === void 0) { scrollIntoView = false; }
4838
4842
  if (this.isInitialized && this.navigationService.isActive(this.index)) {
4839
- this.element.nativeElement.focus();
4843
+ this.element.nativeElement.focus({ preventScroll: !scrollIntoView });
4840
4844
  }
4841
4845
  };
4842
4846
  TreeViewItemDirective.prototype.moveLookupItem = function (changes) {
@@ -26,8 +26,8 @@ var NavigationService = /** @class */ (function () {
26
26
  this.loadMore = new rxjs_1.Subject();
27
27
  this.navigable = true;
28
28
  this.actions = (_a = {},
29
- _a[kendo_angular_common_1.Keys.ArrowUp] = function () { return _this.activate(_this.model.findVisiblePrev(_this.focusableItem)); },
30
- _a[kendo_angular_common_1.Keys.ArrowDown] = function () { return _this.activate(_this.model.findVisibleNext(_this.focusableItem)); },
29
+ _a[kendo_angular_common_1.Keys.ArrowUp] = function () { return _this.activate(_this.model.findVisiblePrev(_this.focusableItem), true); },
30
+ _a[kendo_angular_common_1.Keys.ArrowDown] = function () { return _this.activate(_this.model.findVisibleNext(_this.focusableItem), true); },
31
31
  _a[kendo_angular_common_1.Keys.ArrowLeft] = function () { return !_this.isLoadMoreButton && (_this.expand({
32
32
  expand: _this.localization.rtl,
33
33
  intercept: _this.localization.rtl ? _this.moveToFirstVisibleChild : _this.moveToParent
@@ -36,12 +36,13 @@ var NavigationService = /** @class */ (function () {
36
36
  expand: !_this.localization.rtl,
37
37
  intercept: _this.localization.rtl ? _this.moveToParent : _this.moveToFirstVisibleChild
38
38
  })); },
39
- _a[kendo_angular_common_1.Keys.Home] = function () { return _this.activate(_this.model.firstVisibleNode()); },
40
- _a[kendo_angular_common_1.Keys.End] = function () { return _this.activate(_this.model.lastVisibleNode()); },
39
+ _a[kendo_angular_common_1.Keys.Home] = function () { return _this.activate(_this.model.firstVisibleNode(), true); },
40
+ _a[kendo_angular_common_1.Keys.End] = function () { return _this.activate(_this.model.lastVisibleNode(), true); },
41
41
  _a[kendo_angular_common_1.Keys.Enter] = function () { return _this.handleEnter(); },
42
42
  _a[kendo_angular_common_1.Keys.Space] = function () { return _this.handleSpace(); },
43
43
  _a);
44
44
  this.isFocused = false;
45
+ this.shouldScroll = false;
45
46
  this._model = new navigation_model_1.NavigationModel();
46
47
  this.moveToFirstVisibleChild = this.moveToFirstVisibleChild.bind(this);
47
48
  this.moveToParent = this.moveToParent.bind(this);
@@ -84,12 +85,14 @@ var NavigationService = /** @class */ (function () {
84
85
  enumerable: true,
85
86
  configurable: true
86
87
  });
87
- NavigationService.prototype.activate = function (item) {
88
+ NavigationService.prototype.activate = function (item, shouldScroll) {
89
+ if (shouldScroll === void 0) { shouldScroll = false; }
88
90
  if (!this.navigable || !item || this.isActive(utils_1.nodeIndex(item))) {
89
91
  return;
90
92
  }
91
93
  this.isFocused = true;
92
94
  this.activeItem = item || this.activeItem;
95
+ this.shouldScroll = shouldScroll;
93
96
  this.notifyMove();
94
97
  };
95
98
  NavigationService.prototype.activateParent = function (index) {
@@ -209,7 +212,7 @@ var NavigationService = /** @class */ (function () {
209
212
  };
210
213
  NavigationService.prototype.navigationState = function (expand) {
211
214
  if (expand === void 0) { expand = false; }
212
- return ({ expand: expand, index: this.activeIndex, isFocused: this.isFocused });
215
+ return ({ expand: expand, index: this.activeIndex, isFocused: this.isFocused, shouldScroll: this.shouldScroll });
213
216
  };
214
217
  NavigationService.prototype.handleEnter = function () {
215
218
  if (!this.navigable) {
@@ -11,7 +11,7 @@ exports.packageMetadata = {
11
11
  name: '@progress/kendo-angular-treeview',
12
12
  productName: 'Kendo UI for Angular',
13
13
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
14
- publishDate: 1642577609,
14
+ publishDate: 1645772610,
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
  };
@@ -138,9 +138,9 @@ var TreeViewItemDirective = /** @class */ (function () {
138
138
  var _this = this;
139
139
  this.subscriptions = [
140
140
  this.navigationService.moves
141
- .subscribe(function () {
141
+ .subscribe(function (navState) {
142
142
  _this.updateTabIndex();
143
- _this.focusItem();
143
+ _this.focusItem(navState.shouldScroll);
144
144
  }),
145
145
  this.navigationService.expands
146
146
  .pipe(operators_1.filter(function (_a) {
@@ -175,9 +175,10 @@ var TreeViewItemDirective = /** @class */ (function () {
175
175
  TreeViewItemDirective.prototype.isFocusable = function () {
176
176
  return !this.isDisabled && this.navigationService.isFocusable(this.index);
177
177
  };
178
- TreeViewItemDirective.prototype.focusItem = function () {
178
+ TreeViewItemDirective.prototype.focusItem = function (scrollIntoView) {
179
+ if (scrollIntoView === void 0) { scrollIntoView = false; }
179
180
  if (this.isInitialized && this.navigationService.isActive(this.index)) {
180
- this.element.nativeElement.focus();
181
+ this.element.nativeElement.focus({ preventScroll: !scrollIntoView });
181
182
  }
182
183
  };
183
184
  TreeViewItemDirective.prototype.moveLookupItem = function (changes) {