@progress/kendo-angular-toolbar 18.1.0-develop.30 → 18.1.0-develop.4

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.
Files changed (36) hide show
  1. package/esm2022/localization/messages.mjs +2 -14
  2. package/esm2022/navigation.service.mjs +3 -5
  3. package/esm2022/package-metadata.mjs +2 -2
  4. package/esm2022/renderer.component.mjs +0 -8
  5. package/esm2022/toolbar.component.mjs +124 -716
  6. package/esm2022/tools/toolbar-button.component.mjs +2 -62
  7. package/esm2022/tools/toolbar-buttongroup.component.mjs +6 -87
  8. package/esm2022/tools/toolbar-dropdownbutton.component.mjs +11 -67
  9. package/esm2022/tools/toolbar-separator.component.mjs +0 -8
  10. package/esm2022/tools/toolbar-splitbutton.component.mjs +5 -61
  11. package/esm2022/tools/toolbar-tool.component.mjs +1 -9
  12. package/esm2022/tools/tools.service.mjs +0 -3
  13. package/esm2022/util.mjs +0 -17
  14. package/fesm2022/progress-kendo-angular-toolbar.mjs +155 -1300
  15. package/index.d.ts +0 -3
  16. package/localization/messages.d.ts +2 -10
  17. package/package.json +9 -9
  18. package/render-location.d.ts +1 -1
  19. package/toolbar.component.d.ts +6 -77
  20. package/tools/toolbar-button.component.d.ts +0 -1
  21. package/tools/toolbar-buttongroup.component.d.ts +0 -1
  22. package/tools/toolbar-dropdownbutton.component.d.ts +1 -2
  23. package/tools/toolbar-splitbutton.component.d.ts +0 -1
  24. package/tools/toolbar-tool.component.d.ts +0 -6
  25. package/tools/tools.service.d.ts +0 -1
  26. package/util.d.ts +0 -5
  27. package/common/overflow-mode.d.ts +0 -8
  28. package/common/overflow-settings.d.ts +0 -53
  29. package/common/scroll-buttons.d.ts +0 -12
  30. package/esm2022/common/overflow-mode.mjs +0 -5
  31. package/esm2022/common/overflow-settings.mjs +0 -5
  32. package/esm2022/common/scroll-buttons.mjs +0 -5
  33. package/esm2022/scroll.service.mjs +0 -102
  34. package/esm2022/scrollable-button.component.mjs +0 -162
  35. package/scroll.service.d.ts +0 -42
  36. package/scrollable-button.component.d.ts +0 -44
package/index.d.ts CHANGED
@@ -19,7 +19,4 @@ export { ToolbarCustomMessagesComponent } from './localization/custom-messages.c
19
19
  export { RefreshService } from './refresh.service';
20
20
  export { ToolbarSize } from './common/size';
21
21
  export { ToolbarFillMode } from './common/fillmode';
22
- export { OverflowMode } from './common/overflow-mode';
23
- export { ToolbarOverflowSettings } from './common/overflow-settings';
24
- export { ToolbarScrollButtonsPosition, ToolbarScrollButtonsVisibility } from './common/scroll-buttons';
25
22
  export * from './directives';
@@ -9,17 +9,9 @@ import * as i0 from "@angular/core";
9
9
  */
10
10
  export declare class ToolbarMessages extends ComponentMessages {
11
11
  /**
12
- * The title of the **More Tools** button in a responsive ToolBar
12
+ * The title of the **more tools** button in a responsive ToolBar
13
13
  */
14
14
  moreToolsTitle: string;
15
- /**
16
- * The title for the **Previous Tool** button when the Toolbar is scrollable.
17
- */
18
- previousToolButton: string;
19
- /**
20
- * The title for the **Next Tool** button when the Toolbar is scrollable.
21
- */
22
- nextToolButton: string;
23
15
  static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarMessages, never>;
24
- static ɵdir: i0.ɵɵDirectiveDeclaration<ToolbarMessages, "kendo-toolbar-messages-base", never, { "moreToolsTitle": { "alias": "moreToolsTitle"; "required": false; }; "previousToolButton": { "alias": "previousToolButton"; "required": false; }; "nextToolButton": { "alias": "nextToolButton"; "required": false; }; }, {}, never, never, false, never>;
16
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ToolbarMessages, "kendo-toolbar-messages-base", never, { "moreToolsTitle": { "alias": "moreToolsTitle"; "required": false; }; }, {}, never, never, false, never>;
25
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-toolbar",
3
- "version": "18.1.0-develop.30",
3
+ "version": "18.1.0-develop.4",
4
4
  "description": "Kendo UI Angular Toolbar component - a single UI element that organizes buttons and other navigation elements",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -25,7 +25,7 @@
25
25
  "package": {
26
26
  "productName": "Kendo UI for Angular",
27
27
  "productCode": "KENDOUIANGULAR",
28
- "publishDate": 1738961998,
28
+ "publishDate": 1738318239,
29
29
  "licensingDocsUrl": "https://www.telerik.com/kendo-angular-ui/my-license/"
30
30
  }
31
31
  },
@@ -34,17 +34,17 @@
34
34
  "@angular/common": "16 - 19",
35
35
  "@angular/core": "16 - 19",
36
36
  "@angular/platform-browser": "16 - 19",
37
- "@progress/kendo-licensing": "^1.4.0",
38
- "@progress/kendo-angular-buttons": "18.1.0-develop.30",
39
- "@progress/kendo-angular-common": "18.1.0-develop.30",
40
- "@progress/kendo-angular-l10n": "18.1.0-develop.30",
41
- "@progress/kendo-angular-icons": "18.1.0-develop.30",
42
- "@progress/kendo-angular-popup": "18.1.0-develop.30",
37
+ "@progress/kendo-licensing": "^1.0.2",
38
+ "@progress/kendo-angular-buttons": "18.1.0-develop.4",
39
+ "@progress/kendo-angular-common": "18.1.0-develop.4",
40
+ "@progress/kendo-angular-l10n": "18.1.0-develop.4",
41
+ "@progress/kendo-angular-icons": "18.1.0-develop.4",
42
+ "@progress/kendo-angular-popup": "18.1.0-develop.4",
43
43
  "rxjs": "^6.5.3 || ^7.0.0"
44
44
  },
45
45
  "dependencies": {
46
46
  "tslib": "^2.3.1",
47
- "@progress/kendo-angular-schematics": "18.1.0-develop.30"
47
+ "@progress/kendo-angular-schematics": "18.1.0-develop.4"
48
48
  },
49
49
  "schematics": "./schematics/collection.json",
50
50
  "module": "fesm2022/progress-kendo-angular-toolbar.mjs",
@@ -5,4 +5,4 @@
5
5
  /**
6
6
  * @hidden
7
7
  */
8
- export type RenderLocation = 'toolbar' | 'overflow' | 'section';
8
+ export type RenderLocation = "toolbar" | "overflow";
@@ -17,16 +17,12 @@ import { RendererClickPayload } from './common/renderer-click';
17
17
  import { SVGIcon } from '@progress/kendo-svg-icons';
18
18
  import { ToolbarToolsService } from './tools/tools.service';
19
19
  import { ToolbarFillMode } from './common/fillmode';
20
- import { OverflowMode } from './common/overflow-mode';
21
- import { ToolbarOverflowSettings } from './common/overflow-settings';
22
- import { ToolbarScrollButtonsPosition } from './common/scroll-buttons';
23
- import { ScrollService } from './scroll.service';
24
20
  import * as i0 from "@angular/core";
25
21
  /**
26
22
  * Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
27
23
  */
28
24
  export declare class ToolBarComponent {
29
- localization: LocalizationService;
25
+ private localization;
30
26
  private popupService;
31
27
  private refreshService;
32
28
  private navigationService;
@@ -35,41 +31,18 @@ export declare class ToolBarComponent {
35
31
  private renderer;
36
32
  private _cdr;
37
33
  private toolsService;
38
- private scrollService;
39
34
  get overflowClass(): string;
40
35
  /**
41
- * Configures the overflow mode. Used to specify how tools will be rendered when the total size of all tools is greater than the size of the Toolbar container.
42
- * @default false
36
+ * Hides the overflowing tools in a popup.
43
37
  */
44
- set overflow(overflow: boolean | OverflowMode | ToolbarOverflowSettings);
45
- get overflow(): boolean | OverflowMode | ToolbarOverflowSettings;
46
- get show(): boolean;
38
+ overflow: boolean;
47
39
  /**
48
40
  * @hidden
49
41
  */
50
42
  set resizable(value: boolean);
51
43
  get resizable(): boolean;
52
44
  /**
53
- * @hidden
54
- */
55
- get hasScrollButtons(): {
56
- visible: boolean;
57
- position: ToolbarScrollButtonsPosition;
58
- };
59
- /**
60
- * @hidden
61
- */
62
- get isScrollMode(): boolean;
63
- /**
64
- * @hidden
65
- */
66
- get showMenu(): boolean;
67
- /**
68
- * @hidden
69
- */
70
- get overflowEnabled(): boolean;
71
- /**
72
- * Configures the popup of the ToolBar overflow button ([see example](slug:responsive_toolbar#customizing-the-popup)).
45
+ * Configures the popup of the ToolBar overflow button ([see example]({% slug responsive_toolbar %}#toc-popup-customization)).
73
46
  *
74
47
  * The available options are:
75
48
  * - `animate: Boolean`&mdash;Controls the popup animation. By default, the open and close animations are enabled.
@@ -116,48 +89,24 @@ export declare class ToolBarComponent {
116
89
  allTools: QueryList<ToolBarToolComponent>;
117
90
  overflowButton: ElementRef;
118
91
  popupTemplate: TemplateRef<any>;
119
- popupSectionTemplate: TemplateRef<any>;
120
- scrollContainer: ElementRef;
121
92
  resizeSensor: ResizeSensorComponent;
122
93
  container: ViewContainerRef;
123
- prevScrollButton: ElementRef;
124
- nextScrollButton: ElementRef;
125
- startButtonGroup: ElementRef;
126
- endButtonGroup: ElementRef;
127
- scrollSeparator: ElementRef;
128
94
  popupRef: PopupRef;
129
95
  direction: Direction;
130
96
  get appendTo(): ViewContainerRef;
131
97
  set popupOpen(open: boolean);
132
98
  get popupOpen(): boolean;
133
- /**
134
- * @hidden
135
- */
136
- prevButtonIcon: SVGIcon;
137
- /**
138
- * @hidden
139
- */
140
- nextButtonIcon: SVGIcon;
141
99
  hostClass: boolean;
142
- get scrollableClass(): boolean;
143
- get sectionClass(): boolean;
144
- private _overflow;
145
100
  private _popupSettings;
146
101
  private cachedOverflowAnchorWidth;
147
102
  private _open;
148
103
  private toolbarKeydownListener;
149
104
  private overflowKeydownListener;
150
- private sectionKeydownListener;
151
105
  private cancelRenderedToolsSubscription$;
152
106
  private cachedGap;
153
107
  private _size;
154
108
  private _fillMode;
155
109
  private overflowButtonClickedTime;
156
- private showAutoButtons;
157
- /**
158
- * @hidden
159
- */
160
- get normalizedOverflow(): ToolbarOverflowSettings;
161
110
  private subscriptions;
162
111
  private popupSubs;
163
112
  /**
@@ -171,16 +120,13 @@ export declare class ToolBarComponent {
171
120
  role: string;
172
121
  get getDir(): string;
173
122
  get resizableClass(): boolean;
174
- constructor(localization: LocalizationService, popupService: PopupService, refreshService: RefreshService, navigationService: NavigationService, element: ElementRef, zone: NgZone, renderer: Renderer2, _cdr: ChangeDetectorRef, toolsService: ToolbarToolsService, scrollService: ScrollService);
123
+ moreVerticalIcon: SVGIcon;
124
+ constructor(localization: LocalizationService, popupService: PopupService, refreshService: RefreshService, navigationService: NavigationService, element: ElementRef, zone: NgZone, renderer: Renderer2, _cdr: ChangeDetectorRef, toolsService: ToolbarToolsService);
175
125
  ngAfterContentInit(): void;
176
126
  ngAfterViewInit(): void;
177
127
  ngOnInit(): void;
178
128
  ngOnChanges(changes: SimpleChanges): void;
179
129
  ngOnDestroy(): void;
180
- /**
181
- * @hidden
182
- */
183
- showOverflowSeparator: boolean;
184
130
  /**
185
131
  * @hidden
186
132
  */
@@ -189,26 +135,10 @@ export declare class ToolBarComponent {
189
135
  * @hidden
190
136
  */
191
137
  get cdr(): ChangeDetectorRef;
192
- /**
193
- * @hidden
194
- */
195
- get sectionSizeClass(): string;
196
- /**
197
- * @hidden
198
- */
199
- getScrollButtonTitle(buttonType: string): string;
200
- /**
201
- * @hidden
202
- */
203
- scrollTools(dir: string): void;
204
138
  /**
205
139
  * @hidden
206
140
  */
207
141
  onRendererClick(data: RendererClickPayload): void;
208
- /**
209
- * @hidden
210
- */
211
- overflowButtonIcon(iconType: string): any;
212
142
  /**
213
143
  * @hidden
214
144
  */
@@ -253,7 +183,6 @@ export declare class ToolBarComponent {
253
183
  private destroyPopup;
254
184
  private handleClasses;
255
185
  private normalizePopupClasses;
256
- private setScrollableOverlayClasses;
257
186
  static ɵfac: i0.ɵɵFactoryDeclaration<ToolBarComponent, never>;
258
187
  static ɵcmp: i0.ɵɵComponentDeclaration<ToolBarComponent, "kendo-toolbar", ["kendoToolBar"], { "overflow": { "alias": "overflow"; "required": false; }; "resizable": { "alias": "resizable"; "required": false; }; "popupSettings": { "alias": "popupSettings"; "required": false; }; "fillMode": { "alias": "fillMode"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "size": { "alias": "size"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; }, { "open": "open"; "close": "close"; }, ["allTools"], never, true, never>;
259
188
  }
@@ -137,7 +137,6 @@ export declare class ToolBarButtonComponent extends ToolBarToolComponent {
137
137
  toolbarOptions: ToolOptions;
138
138
  overflowOptions: ToolOptions;
139
139
  toolbarButtonElement: ElementRef;
140
- sectionButtonElement: ElementRef;
141
140
  private overflowButtonElement;
142
141
  private _showText;
143
142
  private _text;
@@ -45,7 +45,6 @@ export declare class ToolBarButtonGroupComponent extends ToolBarToolComponent {
45
45
  */
46
46
  set look(look: 'default' | 'flat' | 'outline');
47
47
  private toolbarButtonGroup;
48
- private sectionButtonGroup;
49
48
  overflowListItems: QueryList<ElementRef>;
50
49
  buttonComponents: QueryList<ToolBarButtonComponent>;
51
50
  private get buttonElements();
@@ -145,8 +145,7 @@ export declare class ToolBarDropDownButtonComponent extends ToolBarToolComponent
145
145
  */
146
146
  close: EventEmitter<PreventableEvent>;
147
147
  dropdownButton: ElementRef;
148
- toolbarDropDownButton: DropDownButtonComponent;
149
- sectionDropDownButton: DropDownButtonComponent;
148
+ dropDownButtonComponent: DropDownButtonComponent;
150
149
  overflowListItems: QueryList<ElementRef>;
151
150
  toolbarOptions: ToolOptions;
152
151
  overflowOptions: ToolOptions;
@@ -156,7 +156,6 @@ export declare class ToolBarSplitButtonComponent extends ToolBarToolComponent im
156
156
  private getNextKey;
157
157
  private getPrevKey;
158
158
  private toolbarSplitButton;
159
- private sectionSplitButton;
160
159
  private overflowMainButton;
161
160
  overflowListItems: QueryList<ElementRef>;
162
161
  constructor();
@@ -3,7 +3,6 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { TemplateRef, ElementRef } from '@angular/core';
6
- import { RenderLocation } from '../render-location';
7
6
  import * as i0 from "@angular/core";
8
7
  /**
9
8
  * Represents the Base ToolBar Tool component for Angular.
@@ -11,17 +10,12 @@ import * as i0 from "@angular/core";
11
10
  */
12
11
  export declare class ToolBarToolComponent {
13
12
  toolbarTemplate: TemplateRef<any>;
14
- sectionTemplate: TemplateRef<any>;
15
13
  popupTemplate: TemplateRef<any>;
16
14
  tabIndex: number;
17
15
  overflows: boolean;
18
16
  visibility: string;
19
17
  element: ElementRef;
20
18
  isBuiltInTool: boolean;
21
- /**
22
- * @hidden
23
- */
24
- location: RenderLocation;
25
19
  constructor();
26
20
  /**
27
21
  * @hidden
@@ -15,7 +15,6 @@ export declare class ToolbarToolsService {
15
15
  renderedTools: ToolBarRendererComponent[];
16
16
  overflowTools: ToolBarRendererComponent[];
17
17
  allTools: ToolBarToolComponent[];
18
- reset(): void;
19
18
  static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarToolsService, never>;
20
19
  static ɵprov: i0.ɵɵInjectableDeclaration<ToolbarToolsService>;
21
20
  }
package/util.d.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Keys } from '@progress/kendo-angular-common';
6
6
  import { DisplayMode } from './display-mode';
7
- import { ToolbarOverflowSettings } from './common/overflow-settings';
8
7
  /**
9
8
  * @hidden
10
9
  */
@@ -105,7 +104,3 @@ export declare const getStylingClasses: (componentType: any, stylingOption: stri
105
104
  * nodeType 1 is Element, nodeType 3 is Text
106
105
  */
107
106
  export declare const isElementOrTextNode: (n: Node) => boolean;
108
- /**
109
- * @hidden
110
- */
111
- export declare const normalizeOverflowSettings: (overflow: any) => ToolbarOverflowSettings;
@@ -1,8 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 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 overflowMode options of the Toolbar. Applicable when there is not enough space to render all tools.
7
- */
8
- export type OverflowMode = 'scroll' | 'section' | 'menu' | 'none';
@@ -1,53 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { SVGIcon } from "@progress/kendo-svg-icons";
6
- import { OverflowMode } from "./overflow-mode";
7
- import { ToolbarScrollButtonsPosition, ToolbarScrollButtonsVisibility } from "./scroll-buttons";
8
- /**
9
- * The settings for the overflow functionality of the Toolbar.
10
- */
11
- export interface ToolbarOverflowSettings {
12
- /**
13
- * Determines the Toolbar overflow mode.
14
- * @default 'none'
15
- */
16
- mode?: OverflowMode;
17
- /**
18
- * Determines the Toolbar scroll buttons visibility mode. Applicable when the overflow mode is set to 'scroll'. The possible options are:
19
- * - 'auto' (default) - The scroll buttons will be rendered only when the tools list overflows its container.
20
- * - 'visible' - The scroll buttons will be always visible.
21
- * - 'hidden' - No scroll buttons will be rendered.
22
- */
23
- scrollButtons?: ToolbarScrollButtonsVisibility;
24
- /**
25
- * Determines the Toolbar scroll buttons position. Applicable when the overflow mode is set to 'scroll'. The possible options are:
26
- * - 'start'&mdash;The scroll buttons will be rendered at the start before all tools.
27
- * - 'end'&mdash;The scroll buttons will be rendered at the end after all tools.
28
- * - 'split'(default)&mdash;The scroll buttons will be rendered at each side of the tools list.
29
- */
30
- scrollButtonsPosition?: ToolbarScrollButtonsPosition;
31
- /**
32
- * Allows defining a custom CSS class, or multiple classes separated by spaces, which will be applied to the span element of the prev scroll button. Applicable when the overflow mode is set to 'scroll'.
33
- *
34
- * Allows the usage of custom icons.
35
- */
36
- prevButtonIcon?: string;
37
- /**
38
- * Allows defining a custom CSS class, or multiple classes separated by spaces, which will be applied to the span element of the next scroll button. Applicable when the overflow mode is set to 'scroll'.
39
- *
40
- * Allows the usage of custom icons.
41
- */
42
- nextButtonIcon?: string;
43
- /**
44
- * Defines an SVGIcon to be rendered for the previous button icon.
45
- * The input can take either an [existing Kendo SVG icon](slug:svgicon_list) or a custom one. Applicable when the overflow mode is set to 'scroll'.
46
- */
47
- prevSVGButtonIcon?: SVGIcon;
48
- /**
49
- * Defines an SVGIcon to be rendered for the next button icon.
50
- * The input can take either an [existing Kendo SVG icon](slug:svgicon_list) or a custom one. Applicable when the overflow mode is set to 'scroll'.
51
- */
52
- nextSVGButtonIcon?: SVGIcon;
53
- }
@@ -1,12 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 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 when the Toolbar scroll buttons will be rendered.
7
- */
8
- export type ToolbarScrollButtonsVisibility = 'hidden' | 'visible' | 'auto';
9
- /**
10
- * The available options for the `scrollButtonsPosition` option.
11
- */
12
- export type ToolbarScrollButtonsPosition = 'start' | 'end' | 'split';
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,102 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Injectable, NgZone } from '@angular/core';
6
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
7
- import { Subject } from 'rxjs';
8
- import { LocalizationService } from '@progress/kendo-angular-l10n';
9
- import * as i0 from "@angular/core";
10
- import * as i1 from "@progress/kendo-angular-l10n";
11
- const DEFAULT_SCROLL_BEHAVIOR = 'smooth';
12
- const DEFAULT_SCROLL_SPEED = 100;
13
- /**
14
- * @hidden
15
- */
16
- export class ScrollService {
17
- ngZone;
18
- localization;
19
- owner;
20
- position = 0;
21
- scrollButtonActiveStateChange = new Subject();
22
- get scrollElement() {
23
- return this.owner.scrollContainer?.nativeElement;
24
- }
25
- get scrollContainerOverflowSize() {
26
- if (!isDocumentAvailable()) {
27
- return 0;
28
- }
29
- if (!this.scrollElement) {
30
- return 0;
31
- }
32
- const overflowSize = Math.floor(this.scrollElement.scrollWidth - this.scrollElement.getBoundingClientRect().width);
33
- return overflowSize < 0 ? 0 : overflowSize;
34
- }
35
- get toolsOverflow() {
36
- return this.scrollContainerOverflowSize > 0;
37
- }
38
- constructor(ngZone, localization) {
39
- this.ngZone = ngZone;
40
- this.localization = localization;
41
- }
42
- toggleScrollButtonsState() {
43
- const toolbar = this.owner;
44
- if (!toolbar.hasScrollButtons) {
45
- return;
46
- }
47
- const currentPrevButtonActive = !this.isDisabled('prev');
48
- const currentNextButtonActive = !this.isDisabled('next');
49
- const defaultOffset = 1;
50
- const rtlDelta = this.localization.rtl ? -1 : 1;
51
- const calculatedPrevButtonActive = (this.position * rtlDelta) > 0 && this.scrollContainerOverflowSize > 0;
52
- const calculatedNextButtonActive = (this.position * rtlDelta) < this.scrollContainerOverflowSize - defaultOffset && this.scrollContainerOverflowSize > 0;
53
- if (calculatedPrevButtonActive !== currentPrevButtonActive) {
54
- this.ngZone.run(() => this.toggleButtonActiveState('prev', calculatedPrevButtonActive));
55
- }
56
- if (calculatedNextButtonActive !== currentNextButtonActive) {
57
- this.ngZone.run(() => this.toggleButtonActiveState('next', calculatedNextButtonActive));
58
- }
59
- }
60
- onScroll(e) {
61
- this.position = e.target.scrollLeft;
62
- this.toggleScrollButtonsState();
63
- }
64
- scrollTools(direction) {
65
- this.calculateListPosition(direction, DEFAULT_SCROLL_SPEED);
66
- if (this.scrollElement) {
67
- this.scrollElement.scrollTo({ left: this.position, behavior: DEFAULT_SCROLL_BEHAVIOR });
68
- }
69
- this.toggleScrollButtonsState();
70
- }
71
- calculateListPosition(direction, scrollSpeed) {
72
- if (direction === 'prev') {
73
- if (!this.localization.rtl) {
74
- this.position = this.position - scrollSpeed <= 0 ? 0 : this.position - scrollSpeed;
75
- }
76
- else {
77
- this.position = this.position + scrollSpeed >= 0 ? 0 : this.position + scrollSpeed;
78
- }
79
- }
80
- else if (direction === 'next' && this.position < this.scrollContainerOverflowSize) {
81
- if (this.position + scrollSpeed > this.scrollContainerOverflowSize) {
82
- this.position = this.scrollContainerOverflowSize;
83
- return;
84
- }
85
- if (this.localization.rtl) {
86
- this.position -= scrollSpeed;
87
- }
88
- else {
89
- this.position += scrollSpeed;
90
- }
91
- }
92
- }
93
- toggleButtonActiveState(buttonType, active) {
94
- this.scrollButtonActiveStateChange.next({ buttonType, active });
95
- }
96
- isDisabled = (buttonType) => this.owner[`${buttonType}ScrollButton`]?.nativeElement.classList.contains('k-disabled');
97
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScrollService, deps: [{ token: i0.NgZone }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable });
98
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScrollService });
99
- }
100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScrollService, decorators: [{
101
- type: Injectable
102
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i1.LocalizationService }]; } });