@progress/kendo-angular-toolbar 21.4.1 → 22.0.0-develop.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.
- package/fesm2022/progress-kendo-angular-toolbar.mjs +62 -62
- package/localization/messages.d.ts +1 -1
- package/package.json +12 -20
- package/esm2022/common/fillmode.mjs +0 -5
- package/esm2022/common/overflow-mode.mjs +0 -5
- package/esm2022/common/overflow-settings.mjs +0 -5
- package/esm2022/common/preventable-event.mjs +0 -25
- package/esm2022/common/renderer-click.mjs +0 -5
- package/esm2022/common/scroll-buttons.mjs +0 -5
- package/esm2022/common/size.mjs +0 -5
- package/esm2022/direction.mjs +0 -5
- package/esm2022/directives.mjs +0 -45
- package/esm2022/display-mode.mjs +0 -5
- package/esm2022/group-selection-settings.mjs +0 -5
- package/esm2022/index.mjs +0 -17
- package/esm2022/localization/custom-messages.component.mjs +0 -56
- package/esm2022/localization/localized-toolbar-messages.directive.mjs +0 -39
- package/esm2022/localization/messages.mjs +0 -39
- package/esm2022/navigation.service.mjs +0 -159
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/popup-settings.mjs +0 -5
- package/esm2022/progress-kendo-angular-toolbar.mjs +0 -8
- package/esm2022/refresh.service.mjs +0 -20
- package/esm2022/render-location.mjs +0 -5
- package/esm2022/renderer.component.mjs +0 -191
- package/esm2022/renderer.service.mjs +0 -52
- package/esm2022/scroll.service.mjs +0 -110
- package/esm2022/scrollable-button.component.mjs +0 -152
- package/esm2022/tool-options.mjs +0 -5
- package/esm2022/toolbar.component.mjs +0 -1582
- package/esm2022/toolbar.module.mjs +0 -46
- package/esm2022/tools/toolbar-button.component.mjs +0 -712
- package/esm2022/tools/toolbar-buttongroup.component.mjs +0 -448
- package/esm2022/tools/toolbar-dropdownbutton.component.mjs +0 -595
- package/esm2022/tools/toolbar-separator.component.mjs +0 -96
- package/esm2022/tools/toolbar-spacer.component.mjs +0 -76
- package/esm2022/tools/toolbar-splitbutton.component.mjs +0 -607
- package/esm2022/tools/toolbar-tool.component.mjs +0 -106
- package/esm2022/tools/tools.service.mjs +0 -25
- package/esm2022/util.mjs +0 -244
|
@@ -1,1582 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/* eslint-disable no-case-declarations */
|
|
6
|
-
import { Component, HostBinding, ViewChild, TemplateRef, ElementRef, QueryList, ContentChildren, Input, HostListener, Output, EventEmitter, ViewContainerRef, NgZone, Renderer2, ChangeDetectorRef } from '@angular/core';
|
|
7
|
-
import { PopupService } from '@progress/kendo-angular-popup';
|
|
8
|
-
import { guid, normalizeKeys, parseCSSClassNames, ResizeSensorComponent } from '@progress/kendo-angular-common';
|
|
9
|
-
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
10
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
|
-
import { packageMetadata } from './package-metadata';
|
|
12
|
-
import { RefreshService } from './refresh.service';
|
|
13
|
-
import { NavigationService } from './navigation.service';
|
|
14
|
-
import { ToolBarToolComponent } from './tools/toolbar-tool.component';
|
|
15
|
-
import { innerWidth, closest, isPresent, getStylingClasses, SIZES, normalizeOverflowSettings } from './util';
|
|
16
|
-
import { Keys } from '@progress/kendo-angular-common';
|
|
17
|
-
import { PreventableEvent } from './common/preventable-event';
|
|
18
|
-
import { ToolBarRendererComponent } from './renderer.component';
|
|
19
|
-
import { Subscription, fromEvent, Subject, merge } from 'rxjs';
|
|
20
|
-
import { take, takeUntil } from 'rxjs/operators';
|
|
21
|
-
import { filter } from 'rxjs/operators';
|
|
22
|
-
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
23
|
-
import { caretAltLeftIcon, caretAltRightIcon, moreHorizontalIcon, moreVerticalIcon } from '@progress/kendo-svg-icons';
|
|
24
|
-
import { ButtonComponent } from '@progress/kendo-angular-buttons';
|
|
25
|
-
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
26
|
-
import { LocalizedToolbarMessagesDirective } from './localization/localized-toolbar-messages.directive';
|
|
27
|
-
import { ToolbarToolsService } from './tools/tools.service';
|
|
28
|
-
import { ScrollService } from './scroll.service';
|
|
29
|
-
import { ToolbarScrollableButtonComponent } from './scrollable-button.component';
|
|
30
|
-
import * as i0 from "@angular/core";
|
|
31
|
-
import * as i1 from "@progress/kendo-angular-l10n";
|
|
32
|
-
import * as i2 from "@progress/kendo-angular-popup";
|
|
33
|
-
import * as i3 from "./refresh.service";
|
|
34
|
-
import * as i4 from "./navigation.service";
|
|
35
|
-
import * as i5 from "./tools/tools.service";
|
|
36
|
-
import * as i6 from "./scroll.service";
|
|
37
|
-
const DEFAULT_SIZE = 'medium';
|
|
38
|
-
const DEFAULT_FILL_MODE = 'solid';
|
|
39
|
-
const immediateResizeThreshold = 300;
|
|
40
|
-
const getInitialPopupSettings = (isRtl) => ({
|
|
41
|
-
animate: true,
|
|
42
|
-
anchorAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'bottom' },
|
|
43
|
-
popupAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'top' }
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```html
|
|
50
|
-
* <kendo-toolbar>
|
|
51
|
-
* <kendo-toolbar-button text="Button"></kendo-toolbar-button>
|
|
52
|
-
* </kendo-toolbar>
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @remarks
|
|
56
|
-
* Supported children components are:
|
|
57
|
-
* {@link ToolBarButtonComponent},
|
|
58
|
-
* {@link ToolBarButtonGroupComponent},
|
|
59
|
-
* {@link ToolBarDropDownButtonComponent},
|
|
60
|
-
* {@link ToolBarSplitButtonComponent},
|
|
61
|
-
* {@link ToolBarSeparatorComponent},
|
|
62
|
-
* {@link ToolBarSpacerComponent},
|
|
63
|
-
* {@link ToolbarCustomMessagesComponent},
|
|
64
|
-
* {@link ToolBarToolComponent},
|
|
65
|
-
* {@link EditorColorPickerComponent},
|
|
66
|
-
* {@link EditorFontFamilyComponent},
|
|
67
|
-
* {@link EditorFontSizeComponent},
|
|
68
|
-
* {@link EditorFormatComponent},
|
|
69
|
-
* {@link EditorInsertTableButtonComponent},
|
|
70
|
-
* {@link SelectAllToolbarToolComponent}.
|
|
71
|
-
*/
|
|
72
|
-
export class ToolBarComponent {
|
|
73
|
-
localization;
|
|
74
|
-
popupService;
|
|
75
|
-
refreshService;
|
|
76
|
-
navigationService;
|
|
77
|
-
element;
|
|
78
|
-
zone;
|
|
79
|
-
renderer;
|
|
80
|
-
_cdr;
|
|
81
|
-
toolsService;
|
|
82
|
-
scrollService;
|
|
83
|
-
get overflowClass() {
|
|
84
|
-
return `k-button-${SIZES[this.size]}`;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Sets the overflow mode for the ToolBar.
|
|
88
|
-
* Use this property to control how tools render when their total size is greater than the ToolBar container.
|
|
89
|
-
* @default false
|
|
90
|
-
*/
|
|
91
|
-
set overflow(overflow) {
|
|
92
|
-
if (this.isScrollMode) {
|
|
93
|
-
this.removeSubscriptions(['scrollButtonStateChangeSub', 'scrollContainerScrollSub']);
|
|
94
|
-
}
|
|
95
|
-
this._overflow = overflow;
|
|
96
|
-
if (this.isScrollMode) {
|
|
97
|
-
this.handleScrollModeUpdates();
|
|
98
|
-
}
|
|
99
|
-
this.setScrollableOverlayClasses();
|
|
100
|
-
this.zone.onStable.pipe(take(1)).subscribe(() => this.onResize());
|
|
101
|
-
}
|
|
102
|
-
get overflow() {
|
|
103
|
-
return this._overflow;
|
|
104
|
-
}
|
|
105
|
-
get showScrollButtons() {
|
|
106
|
-
const buttonsVisibility = this.normalizedOverflow.scrollButtons;
|
|
107
|
-
const showAuto = buttonsVisibility === 'auto' && this.showAutoButtons;
|
|
108
|
-
const showAlways = buttonsVisibility === 'visible';
|
|
109
|
-
return this.isScrollMode && (showAuto || showAlways);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* @hidden
|
|
113
|
-
*/
|
|
114
|
-
set resizable(value) {
|
|
115
|
-
this.overflow = value;
|
|
116
|
-
}
|
|
117
|
-
get resizable() {
|
|
118
|
-
return this.showMenu;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @hidden
|
|
122
|
-
*/
|
|
123
|
-
get hasScrollButtons() {
|
|
124
|
-
const visible = this.normalizedOverflow.mode === 'scroll' && this.normalizedOverflow.scrollButtons !== 'hidden';
|
|
125
|
-
const position = this.normalizedOverflow.scrollButtonsPosition;
|
|
126
|
-
return {
|
|
127
|
-
visible,
|
|
128
|
-
position
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* @hidden
|
|
133
|
-
*/
|
|
134
|
-
get isScrollMode() {
|
|
135
|
-
return this.normalizedOverflow.mode === 'scroll';
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* @hidden
|
|
139
|
-
*/
|
|
140
|
-
get showMenu() {
|
|
141
|
-
return this.normalizedOverflow.mode === 'menu' || this.normalizedOverflow.mode === 'section';
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @hidden
|
|
145
|
-
*/
|
|
146
|
-
get overflowEnabled() {
|
|
147
|
-
return this.normalizedOverflow.mode !== 'none';
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Configures the popup for the ToolBar overflow button.
|
|
151
|
-
* Use this property to customize the overflow popup appearance and behavior
|
|
152
|
-
* ([see example](slug:responsive_toolbar#customizing-the-popup)).
|
|
153
|
-
*/
|
|
154
|
-
set popupSettings(settings) {
|
|
155
|
-
this._popupSettings = Object.assign({}, getInitialPopupSettings(this.localization.rtl), settings);
|
|
156
|
-
}
|
|
157
|
-
get popupSettings() {
|
|
158
|
-
return this._popupSettings || getInitialPopupSettings(this.localization.rtl);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Sets the fill mode for the ToolBar.
|
|
162
|
-
* This property controls the background and border styles of the ToolBar
|
|
163
|
-
* ([see example](slug:appearance_toolbar#toc-fill-mode)).
|
|
164
|
-
* @default 'solid'
|
|
165
|
-
*/
|
|
166
|
-
set fillMode(fillMode) {
|
|
167
|
-
const newFillMode = fillMode ? fillMode : DEFAULT_FILL_MODE;
|
|
168
|
-
this.handleClasses(newFillMode, 'fillMode');
|
|
169
|
-
this._fillMode = newFillMode;
|
|
170
|
-
}
|
|
171
|
-
get fillMode() {
|
|
172
|
-
return this._fillMode;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Sets the `tabindex` attribute of the ToolBar.
|
|
176
|
-
* Use this property to control the tab order of the ToolBar component.
|
|
177
|
-
* @default 0
|
|
178
|
-
*/
|
|
179
|
-
tabindex = 0;
|
|
180
|
-
/**
|
|
181
|
-
* Sets the size for all ToolBar elements.
|
|
182
|
-
* Use this property to control the padding of the ToolBar elements.
|
|
183
|
-
* @default 'medium'
|
|
184
|
-
*/
|
|
185
|
-
set size(size) {
|
|
186
|
-
const newSize = size ? size : DEFAULT_SIZE;
|
|
187
|
-
this.handleClasses(newSize, 'size');
|
|
188
|
-
this._size = newSize;
|
|
189
|
-
}
|
|
190
|
-
get size() {
|
|
191
|
-
return this._size;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* @hidden
|
|
195
|
-
*/
|
|
196
|
-
set tabIndex(tabIndex) {
|
|
197
|
-
this.tabindex = tabIndex;
|
|
198
|
-
}
|
|
199
|
-
get tabIndex() {
|
|
200
|
-
return this.tabindex;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Sets the icon visibility for all tools in the ToolBar.
|
|
204
|
-
* You can override this property for each tool using the `showIcon` property of the tool.
|
|
205
|
-
* @default 'always'
|
|
206
|
-
*/
|
|
207
|
-
set showIcon(value) {
|
|
208
|
-
if (this._showIcon === value) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
const normalizedValue = this.normalizeDisplayValue(value);
|
|
212
|
-
this._showIcon = value;
|
|
213
|
-
this.propertyChange.emit({
|
|
214
|
-
property: 'showIcon',
|
|
215
|
-
value: normalizedValue
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Sets the text visibility for all tools in the ToolBar.
|
|
220
|
-
* You can override this property for each tool using the `showText` property of the tool.
|
|
221
|
-
* @default 'always'
|
|
222
|
-
*/
|
|
223
|
-
set showText(value) {
|
|
224
|
-
if (this._showText === value) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
const normalizedValue = this.normalizeDisplayValue(value);
|
|
228
|
-
this._showText = value;
|
|
229
|
-
this.propertyChange.emit({
|
|
230
|
-
property: 'showText',
|
|
231
|
-
value: normalizedValue
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Emits when the overflow popup of the ToolBar opens.
|
|
236
|
-
*/
|
|
237
|
-
open = new EventEmitter();
|
|
238
|
-
/**
|
|
239
|
-
* Emits when the overflow popup of the ToolBar closes.
|
|
240
|
-
*/
|
|
241
|
-
close = new EventEmitter();
|
|
242
|
-
allTools;
|
|
243
|
-
overflowButton;
|
|
244
|
-
popupTemplate;
|
|
245
|
-
popupSectionTemplate;
|
|
246
|
-
scrollContainer;
|
|
247
|
-
resizeSensor;
|
|
248
|
-
container;
|
|
249
|
-
prevScrollButton;
|
|
250
|
-
nextScrollButton;
|
|
251
|
-
startButtonGroup;
|
|
252
|
-
endButtonGroup;
|
|
253
|
-
scrollSeparator;
|
|
254
|
-
popupRef;
|
|
255
|
-
direction;
|
|
256
|
-
get appendTo() {
|
|
257
|
-
const { appendTo } = this.popupSettings;
|
|
258
|
-
if (!appendTo || appendTo === 'root') {
|
|
259
|
-
return undefined;
|
|
260
|
-
}
|
|
261
|
-
return appendTo === 'component' ? this.container : appendTo;
|
|
262
|
-
}
|
|
263
|
-
set popupOpen(open) {
|
|
264
|
-
if (this.popupOpen === open) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const eventArgs = new PreventableEvent();
|
|
268
|
-
if (open) {
|
|
269
|
-
this.open.emit(eventArgs);
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
this.close.emit(eventArgs);
|
|
273
|
-
}
|
|
274
|
-
if (eventArgs.isDefaultPrevented()) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
this.toggle(open);
|
|
278
|
-
}
|
|
279
|
-
get popupOpen() {
|
|
280
|
-
return this._open;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* @hidden
|
|
284
|
-
*/
|
|
285
|
-
prevButtonIcon = caretAltLeftIcon;
|
|
286
|
-
/**
|
|
287
|
-
* @hidden
|
|
288
|
-
*/
|
|
289
|
-
nextButtonIcon = caretAltRightIcon;
|
|
290
|
-
/**
|
|
291
|
-
* @hidden
|
|
292
|
-
*/
|
|
293
|
-
propertyChange = new EventEmitter();
|
|
294
|
-
hostClass = true;
|
|
295
|
-
get scrollableClass() {
|
|
296
|
-
return this.isScrollMode;
|
|
297
|
-
}
|
|
298
|
-
get sectionClass() {
|
|
299
|
-
return this.normalizedOverflow.mode === 'section';
|
|
300
|
-
}
|
|
301
|
-
_overflow = false;
|
|
302
|
-
_popupSettings;
|
|
303
|
-
cachedOverflowAnchorWidth;
|
|
304
|
-
_open;
|
|
305
|
-
toolbarKeydownListener;
|
|
306
|
-
overflowKeydownListener;
|
|
307
|
-
sectionKeydownListener;
|
|
308
|
-
cancelRenderedToolsSubscription$ = new Subject();
|
|
309
|
-
cachedGap;
|
|
310
|
-
_size = DEFAULT_SIZE;
|
|
311
|
-
_fillMode = DEFAULT_FILL_MODE;
|
|
312
|
-
_showText = 'always';
|
|
313
|
-
_showIcon = 'always';
|
|
314
|
-
overflowButtonClickedTime = null;
|
|
315
|
-
showAutoButtons = false;
|
|
316
|
-
scrollButtonStateChangeSub;
|
|
317
|
-
scrollContainerScrollSub;
|
|
318
|
-
/**
|
|
319
|
-
* @hidden
|
|
320
|
-
*/
|
|
321
|
-
get normalizedOverflow() {
|
|
322
|
-
return normalizeOverflowSettings(this.overflow);
|
|
323
|
-
}
|
|
324
|
-
subscriptions = new Subscription();
|
|
325
|
-
popupSubs = new Subscription();
|
|
326
|
-
focusedByPointer = false;
|
|
327
|
-
/**
|
|
328
|
-
* @hidden
|
|
329
|
-
*/
|
|
330
|
-
onFocus(ev) {
|
|
331
|
-
if (this.focusedByPointer) {
|
|
332
|
-
this.focusedByPointer = false;
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
this.navigationService.resetNavigation();
|
|
336
|
-
this.navigationService.focusFirst(ev);
|
|
337
|
-
// prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
|
|
338
|
-
this.element.nativeElement.setAttribute('tabindex', '-1');
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* @hidden
|
|
342
|
-
*/
|
|
343
|
-
onFocusOut(event) {
|
|
344
|
-
// prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
|
|
345
|
-
if (closest(event.relatedTarget, (el) => el === this.element.nativeElement)) {
|
|
346
|
-
this.element.nativeElement.setAttribute('tabindex', '-1');
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
this.element.nativeElement.setAttribute('tabindex', this.tabindex.toString());
|
|
350
|
-
}
|
|
351
|
-
role = 'toolbar';
|
|
352
|
-
get getDir() {
|
|
353
|
-
return this.direction;
|
|
354
|
-
}
|
|
355
|
-
get resizableClass() {
|
|
356
|
-
return this.resizable;
|
|
357
|
-
}
|
|
358
|
-
constructor(localization, popupService, refreshService, navigationService,
|
|
359
|
-
// Needs to be public as it is being accessed in the Editor component
|
|
360
|
-
element, zone, renderer, _cdr, toolsService, scrollService) {
|
|
361
|
-
this.localization = localization;
|
|
362
|
-
this.popupService = popupService;
|
|
363
|
-
this.refreshService = refreshService;
|
|
364
|
-
this.navigationService = navigationService;
|
|
365
|
-
this.element = element;
|
|
366
|
-
this.zone = zone;
|
|
367
|
-
this.renderer = renderer;
|
|
368
|
-
this._cdr = _cdr;
|
|
369
|
-
this.toolsService = toolsService;
|
|
370
|
-
this.scrollService = scrollService;
|
|
371
|
-
validatePackage(packageMetadata);
|
|
372
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
373
|
-
this.scrollService.owner = this;
|
|
374
|
-
}
|
|
375
|
-
ngAfterContentInit() {
|
|
376
|
-
this.toolsService.allTools = this.allTools.toArray();
|
|
377
|
-
this.subscriptions.add(this.allTools.changes.subscribe(() => {
|
|
378
|
-
this.toolsService.reset();
|
|
379
|
-
this.toolsService.allTools = this.allTools.toArray();
|
|
380
|
-
this.allTools.forEach((tool) => {
|
|
381
|
-
this.refreshService.refresh(tool);
|
|
382
|
-
});
|
|
383
|
-
this.zone.onStable.pipe(take(1)).subscribe(() => this.onResize());
|
|
384
|
-
}));
|
|
385
|
-
}
|
|
386
|
-
ngAfterViewInit() {
|
|
387
|
-
this.toolsService.renderedToolsChange.next(this.toolsService.renderedTools);
|
|
388
|
-
this.toolsService.overflowToolsChange.next(this.toolsService.overflowTools);
|
|
389
|
-
const element = this.element.nativeElement;
|
|
390
|
-
if (!element.getAttribute('tabindex')) {
|
|
391
|
-
this.element.nativeElement.setAttribute('tabindex', '0');
|
|
392
|
-
}
|
|
393
|
-
this.zone.runOutsideAngular(() => {
|
|
394
|
-
this.toolbarKeydownListener = this.renderer.listen(this.element.nativeElement, 'keydown', (ev) => {
|
|
395
|
-
// on some keyboards arrow keys, PageUp/Down, and Home/End are mapped to Numpad keys
|
|
396
|
-
const code = normalizeKeys(ev);
|
|
397
|
-
switch (code) {
|
|
398
|
-
case Keys.ArrowLeft:
|
|
399
|
-
this.zone.run(() => {
|
|
400
|
-
ev.preventDefault();
|
|
401
|
-
if (this.direction === 'ltr') {
|
|
402
|
-
this.navigationService.focusPrev(ev);
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
this.navigationService.focusNext(ev);
|
|
406
|
-
}
|
|
407
|
-
// prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
|
|
408
|
-
this.element.nativeElement.setAttribute('tabindex', '-1');
|
|
409
|
-
});
|
|
410
|
-
break;
|
|
411
|
-
case Keys.ArrowRight:
|
|
412
|
-
this.zone.run(() => {
|
|
413
|
-
ev.preventDefault();
|
|
414
|
-
if (this.direction === 'ltr') {
|
|
415
|
-
this.navigationService.focusNext(ev);
|
|
416
|
-
}
|
|
417
|
-
else {
|
|
418
|
-
this.navigationService.focusPrev(ev);
|
|
419
|
-
}
|
|
420
|
-
// prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
|
|
421
|
-
this.element.nativeElement.setAttribute('tabindex', '-1');
|
|
422
|
-
});
|
|
423
|
-
break;
|
|
424
|
-
case Keys.Tab:
|
|
425
|
-
this.zone.run(() => this.navigationService.resetNavigation());
|
|
426
|
-
break;
|
|
427
|
-
case Keys.Escape:
|
|
428
|
-
this.zone.run(() => this.toggle(false));
|
|
429
|
-
break;
|
|
430
|
-
case Keys.Home:
|
|
431
|
-
this.zone.run(() => this.navigationService.focusFirst(ev));
|
|
432
|
-
break;
|
|
433
|
-
case Keys.End:
|
|
434
|
-
this.zone.run(() => this.navigationService.focusLast(ev));
|
|
435
|
-
break;
|
|
436
|
-
default:
|
|
437
|
-
break;
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
});
|
|
441
|
-
if (this.overflowEnabled) {
|
|
442
|
-
this.subscriptions.add(merge(this.resizeSensor.resize, this.toolsService.renderedToolsChange).subscribe(() => this.onResize()));
|
|
443
|
-
if (this.showMenu) {
|
|
444
|
-
this.navigationService.overflowButton = this.overflowButton;
|
|
445
|
-
}
|
|
446
|
-
// because of https://github.com/telerik/kendo-angular-buttons/pull/276
|
|
447
|
-
// button icons are not rendered until onResize() is called
|
|
448
|
-
this.zone.runOutsideAngular(() => {
|
|
449
|
-
setTimeout(() => {
|
|
450
|
-
this.zone.run(() => {
|
|
451
|
-
this.onResize();
|
|
452
|
-
});
|
|
453
|
-
});
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
if (this.isScrollMode) {
|
|
457
|
-
this.handleScrollModeUpdates();
|
|
458
|
-
}
|
|
459
|
-
this.subscriptions.add(this.renderer.listen(this.element.nativeElement, 'pointerdown', (ev) => {
|
|
460
|
-
if (!ev.target.closest('.k-toolbar-items')) {
|
|
461
|
-
this.focusedByPointer = true;
|
|
462
|
-
}
|
|
463
|
-
}));
|
|
464
|
-
this.navigationService.setRenderedTools(this.toolsService.renderedTools);
|
|
465
|
-
const stylingOptions = ['size', 'fillMode'];
|
|
466
|
-
stylingOptions.forEach(option => {
|
|
467
|
-
this.handleClasses(this[option], option);
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
ngOnInit() {
|
|
471
|
-
this.subscriptions.add(this.localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
|
|
472
|
-
this.zone.onStable.pipe(take(1)).subscribe(() => this.onResize());
|
|
473
|
-
if (isDocumentAvailable()) {
|
|
474
|
-
this.zone.runOutsideAngular(() => this.subscriptions.add(fromEvent(document, 'click')
|
|
475
|
-
.pipe(filter(() => !!this.popupRef), filter((ev) => !this.popupRef.popup.instance.container.nativeElement.contains(ev.target)), filter((ev) => !this.overflowButton.nativeElement.contains(ev.target)))
|
|
476
|
-
.subscribe(() => {
|
|
477
|
-
this.zone.run(() => {
|
|
478
|
-
this.popupOpen = false;
|
|
479
|
-
});
|
|
480
|
-
})));
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
ngOnChanges(changes) {
|
|
484
|
-
if (changes['tabindex']) {
|
|
485
|
-
// prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
|
|
486
|
-
this.element.nativeElement.setAttribute('tabindex', changes['tabindex'].currentValue.toString());
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
ngOnDestroy() {
|
|
490
|
-
this.destroyPopup();
|
|
491
|
-
if (this.toolbarKeydownListener) {
|
|
492
|
-
this.toolbarKeydownListener();
|
|
493
|
-
}
|
|
494
|
-
this.cancelRenderedToolsSubscription$.next(undefined);
|
|
495
|
-
this.subscriptions.unsubscribe();
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* @hidden
|
|
499
|
-
*/
|
|
500
|
-
showOverflowSeparator = false;
|
|
501
|
-
/**
|
|
502
|
-
* @hidden
|
|
503
|
-
*/
|
|
504
|
-
get moreToolsTitle() {
|
|
505
|
-
return this.localization.get('moreToolsTitle');
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* @hidden
|
|
509
|
-
*/
|
|
510
|
-
get cdr() {
|
|
511
|
-
return this._cdr;
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* @hidden
|
|
515
|
-
*/
|
|
516
|
-
get sectionSizeClass() {
|
|
517
|
-
return this.size === 'none' ? '' : `k-toolbar-items-list-${SIZES[this.size]}`;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* @hidden
|
|
521
|
-
*/
|
|
522
|
-
getScrollButtonTitle(buttonType) {
|
|
523
|
-
let currentButton;
|
|
524
|
-
if (this.localization.rtl) {
|
|
525
|
-
currentButton = buttonType === 'prev' ? 'nextToolButton' : 'previousToolButton';
|
|
526
|
-
}
|
|
527
|
-
else {
|
|
528
|
-
currentButton = buttonType === 'prev' ? 'previousToolButton' : 'nextToolButton';
|
|
529
|
-
}
|
|
530
|
-
return this.localization.get(currentButton);
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* @hidden
|
|
534
|
-
*/
|
|
535
|
-
scrollTools(dir) {
|
|
536
|
-
this.scrollService.scrollTools(dir);
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* @hidden
|
|
540
|
-
*/
|
|
541
|
-
onRendererClick(data) {
|
|
542
|
-
this.navigationService.click(data);
|
|
543
|
-
this.element.nativeElement.setAttribute('tabindex', '-1');
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* @hidden
|
|
547
|
-
*/
|
|
548
|
-
overflowButtonIcon(iconType) {
|
|
549
|
-
if (iconType === 'svg') {
|
|
550
|
-
return this.normalizedOverflow.mode === 'section' ? moreHorizontalIcon : moreVerticalIcon;
|
|
551
|
-
}
|
|
552
|
-
else {
|
|
553
|
-
return this.normalizedOverflow.mode === 'section' ? 'more-horizontal' : 'more-vertical';
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* @hidden
|
|
558
|
-
*/
|
|
559
|
-
showPopup() {
|
|
560
|
-
this.popupOpen = !this.popupOpen;
|
|
561
|
-
this.navigationService.click({ context: undefined, event: undefined });
|
|
562
|
-
this.overflowButtonClickedTime = Date.now();
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Toggles the visibility of the overflow popup.
|
|
566
|
-
*/
|
|
567
|
-
toggle(popupOpen) {
|
|
568
|
-
this._open = popupOpen !== undefined ? popupOpen : !this.popupOpen;
|
|
569
|
-
if (this.popupRef) {
|
|
570
|
-
this.popupRef.close();
|
|
571
|
-
this.popupRef = null;
|
|
572
|
-
}
|
|
573
|
-
if (this.popupOpen) {
|
|
574
|
-
let settings;
|
|
575
|
-
const isSection = this.normalizedOverflow.mode === 'section';
|
|
576
|
-
if (isSection) {
|
|
577
|
-
settings = {
|
|
578
|
-
anchor: this.element.nativeElement,
|
|
579
|
-
content: this.popupSectionTemplate,
|
|
580
|
-
popupClass: this.normalizePopupClasses(),
|
|
581
|
-
positionMode: 'absolute'
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
else {
|
|
585
|
-
settings = {
|
|
586
|
-
anchor: this.overflowButton,
|
|
587
|
-
anchorAlign: this.popupSettings.anchorAlign,
|
|
588
|
-
popupAlign: this.popupSettings.popupAlign,
|
|
589
|
-
content: this.popupTemplate,
|
|
590
|
-
appendTo: this.appendTo,
|
|
591
|
-
animate: this.popupSettings.animate,
|
|
592
|
-
popupClass: this.normalizePopupClasses(this.popupSettings.popupClass),
|
|
593
|
-
positionMode: 'absolute'
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
this.popupRef = this.popupService.open(settings);
|
|
597
|
-
this.setPopupContentDimensions(isSection);
|
|
598
|
-
this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.onPopupOpen.bind(this)));
|
|
599
|
-
this.popupSubs.add(this.popupRef.popupClose.subscribe(this.onPopupClose.bind(this)));
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* @hidden
|
|
604
|
-
*/
|
|
605
|
-
onResize() {
|
|
606
|
-
if (isDocumentAvailable()) {
|
|
607
|
-
if (this.showMenu) {
|
|
608
|
-
const containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
|
|
609
|
-
this.shrink(containerWidth, this.childrenWidth);
|
|
610
|
-
this.stretch(containerWidth, this.childrenWidth);
|
|
611
|
-
this.displayAnchor();
|
|
612
|
-
const isImmediateResize = (Date.now() - this.overflowButtonClickedTime) < immediateResizeThreshold;
|
|
613
|
-
if (this.popupOpen && !isImmediateResize) {
|
|
614
|
-
const eventArgs = new PreventableEvent();
|
|
615
|
-
this.close.emit(eventArgs);
|
|
616
|
-
if (eventArgs.isDefaultPrevented()) {
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
this.toggle();
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
else if (this.isScrollMode) {
|
|
623
|
-
if (this.normalizedOverflow.scrollButtons === 'auto') {
|
|
624
|
-
const containerWidth = innerWidth(this.element.nativeElement);
|
|
625
|
-
let scrollButtonsWidth = 0;
|
|
626
|
-
if (this.showAutoButtons) {
|
|
627
|
-
const separatorWidth = this.scrollSeparator.nativeElement.getBoundingClientRect().width + 2 * this.gap;
|
|
628
|
-
if (this.hasScrollButtons.position === 'split') {
|
|
629
|
-
scrollButtonsWidth = innerWidth(this.prevScrollButton.nativeElement) + innerWidth(this.nextScrollButton.nativeElement) + 2 * separatorWidth;
|
|
630
|
-
}
|
|
631
|
-
else if (this.hasScrollButtons.position === 'end') {
|
|
632
|
-
scrollButtonsWidth = innerWidth(this.endButtonGroup.nativeElement) + separatorWidth;
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
scrollButtonsWidth = innerWidth(this.startButtonGroup.nativeElement) + separatorWidth;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
const shouldShowButtons = (this.childrenWidth + scrollButtonsWidth) > containerWidth;
|
|
639
|
-
if (shouldShowButtons !== this.showAutoButtons) {
|
|
640
|
-
this.showAutoButtons = shouldShowButtons;
|
|
641
|
-
this.cdr.detectChanges();
|
|
642
|
-
}
|
|
643
|
-
this.scrollService.toggleScrollButtonsState();
|
|
644
|
-
}
|
|
645
|
-
else if (!this.hasScrollButtons.visible) {
|
|
646
|
-
this.setScrollableOverlayClasses();
|
|
647
|
-
}
|
|
648
|
-
else if (!this.scrollService.toolsOverflow) {
|
|
649
|
-
this.renderer.addClass(this.nextScrollButton.nativeElement, 'k-disabled');
|
|
650
|
-
this.renderer.addClass(this.prevScrollButton.nativeElement, 'k-disabled');
|
|
651
|
-
}
|
|
652
|
-
else {
|
|
653
|
-
this.scrollService.toggleScrollButtonsState();
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
this.resizeSensor?.acceptSize();
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* @hidden
|
|
661
|
-
*/
|
|
662
|
-
onPopupOpen() {
|
|
663
|
-
this.zone.runOutsideAngular(() => {
|
|
664
|
-
if (this.normalizedOverflow.mode === 'section') {
|
|
665
|
-
this.sectionKeydownListener = this.renderer.listen(this.popupRef.popupElement, 'keydown', (ev) => {
|
|
666
|
-
const code = normalizeKeys(ev);
|
|
667
|
-
switch (code) {
|
|
668
|
-
case Keys.ArrowLeft:
|
|
669
|
-
this.zone.run(() => {
|
|
670
|
-
ev.preventDefault();
|
|
671
|
-
if (this.direction === 'ltr') {
|
|
672
|
-
this.navigationService.focusPrev(ev);
|
|
673
|
-
}
|
|
674
|
-
else {
|
|
675
|
-
this.navigationService.focusNext(ev);
|
|
676
|
-
}
|
|
677
|
-
// prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
|
|
678
|
-
this.element.nativeElement.setAttribute('tabindex', '-1');
|
|
679
|
-
});
|
|
680
|
-
break;
|
|
681
|
-
case Keys.ArrowRight:
|
|
682
|
-
this.zone.run(() => {
|
|
683
|
-
ev.preventDefault();
|
|
684
|
-
if (this.direction === 'ltr') {
|
|
685
|
-
this.navigationService.focusNext(ev);
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
this.navigationService.focusPrev(ev);
|
|
689
|
-
}
|
|
690
|
-
// prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
|
|
691
|
-
this.element.nativeElement.setAttribute('tabindex', '-1');
|
|
692
|
-
});
|
|
693
|
-
break;
|
|
694
|
-
case Keys.Escape: {
|
|
695
|
-
this.zone.run(() => this.toggle(false));
|
|
696
|
-
const eventArgs = new PreventableEvent();
|
|
697
|
-
this.close.emit(eventArgs);
|
|
698
|
-
break;
|
|
699
|
-
}
|
|
700
|
-
case Keys.Tab:
|
|
701
|
-
this.zone.run(() => {
|
|
702
|
-
this.toggle(false);
|
|
703
|
-
this.navigationService.resetNavigation();
|
|
704
|
-
});
|
|
705
|
-
break;
|
|
706
|
-
default:
|
|
707
|
-
break;
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
else {
|
|
712
|
-
this.overflowKeydownListener = this.renderer.listen(this.popupRef.popupElement, 'keydown', (ev) => {
|
|
713
|
-
const code = normalizeKeys(ev);
|
|
714
|
-
switch (code) {
|
|
715
|
-
case Keys.ArrowUp:
|
|
716
|
-
this.zone.run(() => {
|
|
717
|
-
ev.preventDefault();
|
|
718
|
-
this.navigationService.focusPrev(ev);
|
|
719
|
-
});
|
|
720
|
-
break;
|
|
721
|
-
case Keys.ArrowDown:
|
|
722
|
-
this.zone.run(() => {
|
|
723
|
-
ev.preventDefault();
|
|
724
|
-
this.navigationService.focusNext(ev);
|
|
725
|
-
});
|
|
726
|
-
break;
|
|
727
|
-
case Keys.Escape: {
|
|
728
|
-
this.zone.run(() => this.toggle(false));
|
|
729
|
-
const eventArgs = new PreventableEvent();
|
|
730
|
-
this.close.emit(eventArgs);
|
|
731
|
-
break;
|
|
732
|
-
}
|
|
733
|
-
case Keys.Tab:
|
|
734
|
-
this.zone.run(() => {
|
|
735
|
-
this.toggle(false);
|
|
736
|
-
this.navigationService.resetNavigation();
|
|
737
|
-
});
|
|
738
|
-
break;
|
|
739
|
-
case Keys.NumpadEnter:
|
|
740
|
-
case Keys.Enter:
|
|
741
|
-
case Keys.Space:
|
|
742
|
-
this.zone.run(() => {
|
|
743
|
-
if (ev.target.closest('.k-menu-item')) {
|
|
744
|
-
ev.preventDefault();
|
|
745
|
-
ev.target.click();
|
|
746
|
-
ev.target.focus();
|
|
747
|
-
}
|
|
748
|
-
});
|
|
749
|
-
break;
|
|
750
|
-
default:
|
|
751
|
-
break;
|
|
752
|
-
}
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
this.cancelRenderedToolsSubscription$.next(undefined);
|
|
757
|
-
this.navigationService.setRenderedTools(this.toolsService.overflowTools);
|
|
758
|
-
this.navigationService.moveFocusToPopup();
|
|
759
|
-
this.toolsService.overflowToolsChange
|
|
760
|
-
.pipe(takeUntil(this.cancelRenderedToolsSubscription$))
|
|
761
|
-
.subscribe((rts) => this.navigationService.setRenderedTools(rts));
|
|
762
|
-
this.renderer.setAttribute(this.overflowButton.nativeElement, 'aria-controls', this.popupId);
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* @hidden
|
|
766
|
-
*/
|
|
767
|
-
onPopupClose() {
|
|
768
|
-
this.cancelRenderedToolsSubscription$.next(undefined);
|
|
769
|
-
this.navigationService.setRenderedTools(this.toolsService.renderedTools);
|
|
770
|
-
this.toolsService.renderedToolsChange
|
|
771
|
-
.pipe(takeUntil(this.cancelRenderedToolsSubscription$))
|
|
772
|
-
.subscribe((rts) => this.navigationService.setRenderedTools(rts));
|
|
773
|
-
this.navigationService.moveFocusToToolBar();
|
|
774
|
-
if (this.overflowKeydownListener) {
|
|
775
|
-
this.overflowKeydownListener();
|
|
776
|
-
}
|
|
777
|
-
if (this.sectionKeydownListener) {
|
|
778
|
-
this.sectionKeydownListener();
|
|
779
|
-
}
|
|
780
|
-
this.renderer.removeAttribute(this.overflowButton.nativeElement, 'aria-controls');
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* @hidden
|
|
784
|
-
*/
|
|
785
|
-
overflowBtnId = guid();
|
|
786
|
-
/**
|
|
787
|
-
* @hidden
|
|
788
|
-
*/
|
|
789
|
-
popupId = guid();
|
|
790
|
-
displayAnchor() {
|
|
791
|
-
const visibility = this.allTools.filter(t => t.overflows && t.responsive).length > 0 ? 'visible' : 'hidden';
|
|
792
|
-
this.overflowButton && this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
|
|
793
|
-
const isVisible = visibility === 'visible';
|
|
794
|
-
if (isVisible !== this.showOverflowSeparator) {
|
|
795
|
-
this.showOverflowSeparator = isVisible;
|
|
796
|
-
this.cdr.detectChanges();
|
|
797
|
-
}
|
|
798
|
-
if (!isVisible) {
|
|
799
|
-
this.destroyPopup();
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
get popupWidth() {
|
|
803
|
-
if (!this.popupSettings || !this.popupSettings.width) {
|
|
804
|
-
return 'auto';
|
|
805
|
-
}
|
|
806
|
-
return isNaN(this.popupSettings.width) ? this.popupSettings.width : `${this.popupSettings.width}px`;
|
|
807
|
-
}
|
|
808
|
-
get popupHeight() {
|
|
809
|
-
if (!this.popupSettings || !this.popupSettings.height) {
|
|
810
|
-
return;
|
|
811
|
-
}
|
|
812
|
-
return isNaN(this.popupSettings.height) ? this.popupSettings.height : `${this.popupSettings.height}px`;
|
|
813
|
-
}
|
|
814
|
-
get overflowAnchorWidth() {
|
|
815
|
-
if (!this.showMenu) {
|
|
816
|
-
return 0;
|
|
817
|
-
}
|
|
818
|
-
if (!this.cachedOverflowAnchorWidth) {
|
|
819
|
-
this.cachedOverflowAnchorWidth = this.overflowButton.nativeElement.offsetWidth;
|
|
820
|
-
}
|
|
821
|
-
return this.cachedOverflowAnchorWidth;
|
|
822
|
-
}
|
|
823
|
-
get gap() {
|
|
824
|
-
if (isPresent(this.cachedGap)) {
|
|
825
|
-
return this.cachedGap;
|
|
826
|
-
}
|
|
827
|
-
const computedGap = getComputedStyle(this.element.nativeElement).gap;
|
|
828
|
-
this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
|
|
829
|
-
return this.cachedGap;
|
|
830
|
-
}
|
|
831
|
-
get childrenWidth() {
|
|
832
|
-
const width = this.toolsService.renderedTools.reduce((totalWidth, tool) => tool.width + totalWidth + (tool.isDisplayed() ? this.gap : 0), 0);
|
|
833
|
-
return Math.ceil(width);
|
|
834
|
-
}
|
|
835
|
-
get visibleTools() {
|
|
836
|
-
return this.allTools.filter((tool) => {
|
|
837
|
-
return tool.overflows === false;
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
get overflowTools() {
|
|
841
|
-
return this.allTools.filter((tool) => {
|
|
842
|
-
return tool.overflows === true;
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
shrink(containerWidth, childrenWidth) {
|
|
846
|
-
let width;
|
|
847
|
-
if (containerWidth < childrenWidth) {
|
|
848
|
-
for (let i = this.visibleTools.length - 1; i >= 0; i--) {
|
|
849
|
-
if (containerWidth > childrenWidth) {
|
|
850
|
-
break;
|
|
851
|
-
}
|
|
852
|
-
else {
|
|
853
|
-
width = this.hideLastVisibleTool();
|
|
854
|
-
childrenWidth -= width;
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
stretch(containerWidth, childrenWidth) {
|
|
860
|
-
let width;
|
|
861
|
-
if (containerWidth > childrenWidth) {
|
|
862
|
-
for (let i = this.overflowTools.length - 1; i >= 0; i--) {
|
|
863
|
-
width = this.showFirstHiddenTool(containerWidth, childrenWidth);
|
|
864
|
-
if (width > 0) {
|
|
865
|
-
childrenWidth += width + this.gap;
|
|
866
|
-
}
|
|
867
|
-
else if (width === 0) {
|
|
868
|
-
break;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
hideLastVisibleTool() {
|
|
874
|
-
const tool = this.visibleTools[this.visibleTools.length - 1];
|
|
875
|
-
if (!tool) {
|
|
876
|
-
return null;
|
|
877
|
-
}
|
|
878
|
-
const renderedElement = this.toolsService.renderedTools.find((r) => {
|
|
879
|
-
return r.tool === tool;
|
|
880
|
-
});
|
|
881
|
-
const width = renderedElement.width;
|
|
882
|
-
tool.overflows = this.showMenu;
|
|
883
|
-
this.refreshService.refresh(tool);
|
|
884
|
-
return width;
|
|
885
|
-
}
|
|
886
|
-
showFirstHiddenTool(containerWidth, childrenWidth) {
|
|
887
|
-
const tool = this.overflowTools[0];
|
|
888
|
-
if (!tool) {
|
|
889
|
-
return null;
|
|
890
|
-
}
|
|
891
|
-
const renderedElement = this.toolsService.renderedTools.find((r) => r.tool === tool);
|
|
892
|
-
tool.overflows = false;
|
|
893
|
-
tool.visibility = 'hidden';
|
|
894
|
-
this.refreshService.refresh(tool);
|
|
895
|
-
if (containerWidth > childrenWidth + renderedElement.width) {
|
|
896
|
-
tool.visibility = 'visible';
|
|
897
|
-
}
|
|
898
|
-
else {
|
|
899
|
-
tool.overflows = true;
|
|
900
|
-
}
|
|
901
|
-
this.refreshService.refresh(tool);
|
|
902
|
-
return tool.isHidden ? -1 : renderedElement.width; // returns 0 if `overflows` is true and -1 if the tool is hidden
|
|
903
|
-
}
|
|
904
|
-
setPopupContentDimensions(isSection) {
|
|
905
|
-
const popupContentContainer = this.popupRef.popup.instance.contentContainer.nativeElement;
|
|
906
|
-
if (isSection) {
|
|
907
|
-
const toolbarWidth = this.element.nativeElement.getBoundingClientRect().width;
|
|
908
|
-
popupContentContainer.style.width = `${toolbarWidth}px`;
|
|
909
|
-
}
|
|
910
|
-
else {
|
|
911
|
-
popupContentContainer.style.width = this.popupWidth;
|
|
912
|
-
popupContentContainer.style.height = this.popupHeight;
|
|
913
|
-
popupContentContainer.style.overflow = 'auto';
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
destroyPopup() {
|
|
917
|
-
if (this.popupRef) {
|
|
918
|
-
this.popupSubs.unsubscribe();
|
|
919
|
-
this.popupRef.close();
|
|
920
|
-
this.popupRef = null;
|
|
921
|
-
this._open = false;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
handleClasses(value, input) {
|
|
925
|
-
const elem = this.element.nativeElement;
|
|
926
|
-
const classes = getStylingClasses('toolbar', input, this[input], value);
|
|
927
|
-
if (classes.toRemove) {
|
|
928
|
-
this.renderer.removeClass(elem, classes.toRemove);
|
|
929
|
-
}
|
|
930
|
-
if (classes.toAdd) {
|
|
931
|
-
this.renderer.addClass(elem, classes.toAdd);
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
normalizePopupClasses(classList) {
|
|
935
|
-
const classes = ['k-toolbar-popup'];
|
|
936
|
-
if (this.normalizedOverflow.mode === 'menu') {
|
|
937
|
-
classes.push('k-menu-popup');
|
|
938
|
-
}
|
|
939
|
-
if (!classList) {
|
|
940
|
-
return classes;
|
|
941
|
-
}
|
|
942
|
-
const parsedClassList = parseCSSClassNames(classList);
|
|
943
|
-
if (parsedClassList.length) {
|
|
944
|
-
classes.push(...parsedClassList);
|
|
945
|
-
}
|
|
946
|
-
return classes;
|
|
947
|
-
}
|
|
948
|
-
setScrollableOverlayClasses() {
|
|
949
|
-
const wrapper = this.element.nativeElement;
|
|
950
|
-
const container = this.scrollContainer?.nativeElement;
|
|
951
|
-
if (!container) {
|
|
952
|
-
return;
|
|
953
|
-
}
|
|
954
|
-
const scrollOffset = container.scrollLeft;
|
|
955
|
-
const defaultOffset = 1;
|
|
956
|
-
if (this.scrollService.toolsOverflow && !this.hasScrollButtons.visible) {
|
|
957
|
-
this.renderer.addClass(wrapper, 'k-toolbar-scrollable-overlay');
|
|
958
|
-
if (scrollOffset === 0) {
|
|
959
|
-
this.renderer.removeClass(wrapper, 'k-toolbar-scrollable-end');
|
|
960
|
-
this.renderer.addClass(wrapper, 'k-toolbar-scrollable-start');
|
|
961
|
-
}
|
|
962
|
-
else if ((scrollOffset > 0 && scrollOffset < this.scrollService.scrollContainerOverflowSize - defaultOffset) || (scrollOffset < 0 && Math.abs(scrollOffset) < this.scrollService.scrollContainerOverflowSize - defaultOffset)) {
|
|
963
|
-
this.renderer.removeClass(wrapper, 'k-toolbar-scrollable-end');
|
|
964
|
-
this.renderer.removeClass(wrapper, 'k-toolbar-scrollable-start');
|
|
965
|
-
}
|
|
966
|
-
else {
|
|
967
|
-
this.renderer.removeClass(wrapper, 'k-toolbar-scrollable-start');
|
|
968
|
-
this.renderer.addClass(wrapper, 'k-toolbar-scrollable-end');
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
else {
|
|
972
|
-
this.renderer.removeClass(wrapper, 'k-toolbar-scrollable-overlay');
|
|
973
|
-
this.renderer.removeClass(wrapper, 'k-toolbar-scrollable-end');
|
|
974
|
-
this.renderer.removeClass(wrapper, 'k-toolbar-scrollable-start');
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
handleScrollModeUpdates() {
|
|
978
|
-
if (isPresent(this.scrollContainer)) {
|
|
979
|
-
this.scrollService.updateScrollPosition(this.scrollContainer.nativeElement);
|
|
980
|
-
this.zone.runOutsideAngular(() => {
|
|
981
|
-
this.scrollContainerScrollSub = this.renderer.listen(this.scrollContainer.nativeElement, 'scroll', (e) => {
|
|
982
|
-
if (!this.hasScrollButtons.visible) {
|
|
983
|
-
this.setScrollableOverlayClasses();
|
|
984
|
-
}
|
|
985
|
-
else {
|
|
986
|
-
this.scrollService.onScroll(e);
|
|
987
|
-
}
|
|
988
|
-
});
|
|
989
|
-
this.subscriptions.add(this.scrollContainerScrollSub);
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
if (this.showScrollButtons && this.nextScrollButton && this.prevScrollButton) {
|
|
993
|
-
if (this.normalizedOverflow.scrollButtons === 'visible' && !this.scrollService.toolsOverflow) {
|
|
994
|
-
this.renderer.addClass(this.nextScrollButton.nativeElement, 'k-disabled');
|
|
995
|
-
this.renderer.addClass(this.prevScrollButton.nativeElement, 'k-disabled');
|
|
996
|
-
}
|
|
997
|
-
else {
|
|
998
|
-
const buttonToDisable = this.direction === 'rtl' ? this.nextScrollButton : this.prevScrollButton;
|
|
999
|
-
this.renderer.addClass(buttonToDisable.nativeElement, 'k-disabled');
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
if (this.hasScrollButtons.visible) {
|
|
1003
|
-
this.scrollButtonStateChangeSub = this.scrollService.scrollButtonActiveStateChange.subscribe((activeButtonSettings) => {
|
|
1004
|
-
if (this.showScrollButtons) {
|
|
1005
|
-
const action = activeButtonSettings.active ? 'remove' : 'add';
|
|
1006
|
-
const scrollButton = this[`${activeButtonSettings.buttonType}ScrollButton`]?.nativeElement;
|
|
1007
|
-
scrollButton && this.renderer[`${action}Class`](scrollButton, 'k-disabled');
|
|
1008
|
-
}
|
|
1009
|
-
});
|
|
1010
|
-
this.subscriptions.add(this.scrollButtonStateChangeSub);
|
|
1011
|
-
this.scrollService.toggleScrollButtonsState();
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
removeSubscriptions(subsToRemove) {
|
|
1015
|
-
subsToRemove.forEach((sub) => {
|
|
1016
|
-
if (this[sub]) {
|
|
1017
|
-
this.subscriptions.remove(this[sub]);
|
|
1018
|
-
this[sub] = null;
|
|
1019
|
-
}
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
normalizeDisplayValue(value) {
|
|
1023
|
-
if (typeof value === 'boolean') {
|
|
1024
|
-
return value ? 'always' : 'never';
|
|
1025
|
-
}
|
|
1026
|
-
return value;
|
|
1027
|
-
}
|
|
1028
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ToolBarComponent, deps: [{ token: i1.LocalizationService }, { token: i2.PopupService }, { token: i3.RefreshService }, { token: i4.NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i5.ToolbarToolsService }, { token: i6.ScrollService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1029
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: ToolBarComponent, isStandalone: true, selector: "kendo-toolbar", inputs: { overflow: "overflow", resizable: "resizable", popupSettings: "popupSettings", fillMode: "fillMode", tabindex: "tabindex", size: "size", tabIndex: "tabIndex", showIcon: "showIcon", showText: "showText" }, outputs: { open: "open", close: "close" }, host: { listeners: { "focus": "onFocus($event)", "focusout": "onFocusOut($event)" }, properties: { "class.k-toolbar": "this.hostClass", "class.k-toolbar-scrollable": "this.scrollableClass", "class.k-toolbar-section": "this.sectionClass", "attr.role": "this.role", "attr.dir": "this.getDir", "class.k-toolbar-resizable": "this.resizableClass" } }, providers: [
|
|
1030
|
-
RefreshService,
|
|
1031
|
-
NavigationService,
|
|
1032
|
-
LocalizationService,
|
|
1033
|
-
ToolbarToolsService,
|
|
1034
|
-
ScrollService,
|
|
1035
|
-
{
|
|
1036
|
-
provide: L10N_PREFIX,
|
|
1037
|
-
useValue: 'kendo.toolbar'
|
|
1038
|
-
}
|
|
1039
|
-
], queries: [{ propertyName: "allTools", predicate: ToolBarToolComponent }], viewQueries: [{ propertyName: "overflowButton", first: true, predicate: ["overflowButton"], descendants: true, read: ElementRef }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "popupSectionTemplate", first: true, predicate: ["popupSectionTemplate"], descendants: true, static: true }, { propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true, read: ElementRef }, { propertyName: "resizeSensor", first: true, predicate: ["resizeSensor"], descendants: true }, { propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "prevScrollButton", first: true, predicate: ["prevScrollButton"], descendants: true, read: ElementRef }, { propertyName: "nextScrollButton", first: true, predicate: ["nextScrollButton"], descendants: true, read: ElementRef }, { propertyName: "startButtonGroup", first: true, predicate: ["startButtonGroup"], descendants: true, read: ElementRef }, { propertyName: "endButtonGroup", first: true, predicate: ["endButtonGroup"], descendants: true, read: ElementRef }, { propertyName: "scrollSeparator", first: true, predicate: ["scrollSeparator"], descendants: true, read: ElementRef }], exportAs: ["kendoToolBar"], usesOnChanges: true, ngImport: i0, template: `
|
|
1040
|
-
<ng-container kendoToolbarLocalizedMessages
|
|
1041
|
-
i18n-moreToolsTitle="kendo.toolbar.moreToolsTitle|The title of the **more tools** button in a responsive ToolBar"
|
|
1042
|
-
moreToolsTitle="More tools"
|
|
1043
|
-
|
|
1044
|
-
i18n-previousToolButton="kendo.toolbar.previousToolButton|The title for the **Previous Tool** button when the Toolbar is scrollable."
|
|
1045
|
-
previousToolButton="Scroll left"
|
|
1046
|
-
|
|
1047
|
-
i18n-nextToolButton="kendo.toolbar.nextToolButton|The title for the **Next Tool** button when the Toolbar is scrollable."
|
|
1048
|
-
nextToolButton="Scroll right"
|
|
1049
|
-
>
|
|
1050
|
-
</ng-container>
|
|
1051
|
-
@if (showScrollButtons && (hasScrollButtons.position === 'split' || hasScrollButtons.position === 'start')) {
|
|
1052
|
-
@if (hasScrollButtons.position === 'split') {
|
|
1053
|
-
<span #prevScrollButton
|
|
1054
|
-
kendoToolbarScrollableButton
|
|
1055
|
-
[prev]="true"
|
|
1056
|
-
[overflow]="normalizedOverflow"
|
|
1057
|
-
[title]="getScrollButtonTitle('prev')"
|
|
1058
|
-
class="k-toolbar-prev k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1059
|
-
[ngClass]="{
|
|
1060
|
-
'k-button-sm': size === 'small',
|
|
1061
|
-
'k-button-md': size === 'medium' || !size,
|
|
1062
|
-
'k-button-lg': size === 'large'
|
|
1063
|
-
}"
|
|
1064
|
-
(onClick)="scrollTools($event)">
|
|
1065
|
-
</span>
|
|
1066
|
-
}
|
|
1067
|
-
@if (hasScrollButtons.position === 'start') {
|
|
1068
|
-
<div class="k-button-group k-button-group-solid" #startButtonGroup>
|
|
1069
|
-
<span #prevScrollButton
|
|
1070
|
-
kendoToolbarScrollableButton
|
|
1071
|
-
[prev]="true"
|
|
1072
|
-
[overflow]="normalizedOverflow"
|
|
1073
|
-
[title]="getScrollButtonTitle('prev')"
|
|
1074
|
-
class="k-toolbar-prev k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1075
|
-
[ngClass]="{
|
|
1076
|
-
'k-button-sm': size === 'small',
|
|
1077
|
-
'k-button-md': size === 'medium' || !size,
|
|
1078
|
-
'k-button-lg': size === 'large'
|
|
1079
|
-
}"
|
|
1080
|
-
(onClick)="scrollTools($event)">
|
|
1081
|
-
</span>
|
|
1082
|
-
<span #nextScrollButton
|
|
1083
|
-
kendoToolbarScrollableButton
|
|
1084
|
-
[prev]="false"
|
|
1085
|
-
[overflow]="normalizedOverflow"
|
|
1086
|
-
[title]="getScrollButtonTitle('next')"
|
|
1087
|
-
class="k-toolbar-next k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1088
|
-
[ngClass]="{
|
|
1089
|
-
'k-button-sm': size === 'small',
|
|
1090
|
-
'k-button-md': size === 'medium' || !size,
|
|
1091
|
-
'k-button-lg': size === 'large'
|
|
1092
|
-
}"
|
|
1093
|
-
(onClick)="scrollTools($event)">
|
|
1094
|
-
</span>
|
|
1095
|
-
</div>
|
|
1096
|
-
}
|
|
1097
|
-
<div class="k-toolbar-separator k-toolbar-button-separator k-separator" #scrollSeparator></div>
|
|
1098
|
-
}
|
|
1099
|
-
@if (isScrollMode) {
|
|
1100
|
-
<div class="k-toolbar-items k-toolbar-items-scroll" tabindex="-1" #scrollContainer>
|
|
1101
|
-
@for (tool of allTools; track tool; let index = $index) {
|
|
1102
|
-
<ng-container
|
|
1103
|
-
kendoToolbarRenderer
|
|
1104
|
-
[tool]="tool"
|
|
1105
|
-
location="toolbar"
|
|
1106
|
-
[resizable]="resizable"
|
|
1107
|
-
(rendererClick)="onRendererClick($event)"
|
|
1108
|
-
[ngTemplateOutlet]="tool.isBuiltInTool ? tool.toolbarTemplate : wrapper">
|
|
1109
|
-
<ng-template #wrapper>
|
|
1110
|
-
<div class="k-toolbar-item">
|
|
1111
|
-
<ng-container [ngTemplateOutlet]="tool.toolbarTemplate"></ng-container>
|
|
1112
|
-
</div>
|
|
1113
|
-
</ng-template>
|
|
1114
|
-
</ng-container>
|
|
1115
|
-
}
|
|
1116
|
-
</div>
|
|
1117
|
-
} @else {
|
|
1118
|
-
@for (tool of allTools; track tool; let index = $index) {
|
|
1119
|
-
<ng-container
|
|
1120
|
-
kendoToolbarRenderer
|
|
1121
|
-
[tool]="tool"
|
|
1122
|
-
location="toolbar"
|
|
1123
|
-
[resizable]="resizable"
|
|
1124
|
-
(rendererClick)="onRendererClick($event)"
|
|
1125
|
-
[ngTemplateOutlet]="tool.isBuiltInTool ? tool.toolbarTemplate : wrapper">
|
|
1126
|
-
<ng-template #wrapper>
|
|
1127
|
-
<div class="k-toolbar-item">
|
|
1128
|
-
<ng-container [ngTemplateOutlet]="tool.toolbarTemplate"></ng-container>
|
|
1129
|
-
</div>
|
|
1130
|
-
</ng-template>
|
|
1131
|
-
</ng-container>
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
@if (showOverflowSeparator) {
|
|
1135
|
-
<div class="k-toolbar-separator k-toolbar-button-separator k-separator"></div>
|
|
1136
|
-
}
|
|
1137
|
-
@if (showMenu) {
|
|
1138
|
-
<button
|
|
1139
|
-
kendoButton
|
|
1140
|
-
fillMode="flat"
|
|
1141
|
-
#overflowButton
|
|
1142
|
-
type="button"
|
|
1143
|
-
[icon]="overflowButtonIcon('font')"
|
|
1144
|
-
[svgIcon]="overflowButtonIcon('svg')"
|
|
1145
|
-
tabindex="-1"
|
|
1146
|
-
[title]="moreToolsTitle"
|
|
1147
|
-
[attr.aria-label]="moreToolsTitle"
|
|
1148
|
-
[attr.aria-expanded]="popupOpen"
|
|
1149
|
-
[id]="overflowBtnId"
|
|
1150
|
-
[attr.aria-haspopup]="normalizedOverflow.mode === 'section' ? null : 'menu'"
|
|
1151
|
-
[style.visibility]="'hidden'"
|
|
1152
|
-
[style.position]="'relative'"
|
|
1153
|
-
class="k-toolbar-overflow-button"
|
|
1154
|
-
[ngClass]="overflowClass"
|
|
1155
|
-
(click)="showPopup()"
|
|
1156
|
-
>
|
|
1157
|
-
</button>
|
|
1158
|
-
}
|
|
1159
|
-
@if (showScrollButtons && (hasScrollButtons.position === 'split' || hasScrollButtons.position === 'end')) {
|
|
1160
|
-
<div class="k-toolbar-separator k-toolbar-button-separator k-separator" #scrollSeparator></div>
|
|
1161
|
-
@if (hasScrollButtons.position === 'split') {
|
|
1162
|
-
<span #nextScrollButton
|
|
1163
|
-
kendoToolbarScrollableButton
|
|
1164
|
-
[prev]="false"
|
|
1165
|
-
[overflow]="normalizedOverflow"
|
|
1166
|
-
[title]="getScrollButtonTitle('next')"
|
|
1167
|
-
class="k-toolbar-next k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1168
|
-
[ngClass]="{
|
|
1169
|
-
'k-button-sm': size === 'small',
|
|
1170
|
-
'k-button-md': size === 'medium' || !size,
|
|
1171
|
-
'k-button-lg': size === 'large'
|
|
1172
|
-
}"
|
|
1173
|
-
(onClick)="scrollTools($event)">
|
|
1174
|
-
</span>
|
|
1175
|
-
}
|
|
1176
|
-
@if (hasScrollButtons.position === 'end') {
|
|
1177
|
-
<div class="k-button-group k-button-group-solid" #endButtonGroup>
|
|
1178
|
-
<span #prevScrollButton
|
|
1179
|
-
kendoToolbarScrollableButton
|
|
1180
|
-
[prev]="true"
|
|
1181
|
-
[overflow]="normalizedOverflow"
|
|
1182
|
-
[title]="getScrollButtonTitle('prev')"
|
|
1183
|
-
class="k-toolbar-prev k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1184
|
-
[ngClass]="{
|
|
1185
|
-
'k-button-sm': size === 'small',
|
|
1186
|
-
'k-button-md': size === 'medium' || !size,
|
|
1187
|
-
'k-button-lg': size === 'large'
|
|
1188
|
-
}"
|
|
1189
|
-
(onClick)="scrollTools($event)">
|
|
1190
|
-
</span>
|
|
1191
|
-
<span #nextScrollButton
|
|
1192
|
-
kendoToolbarScrollableButton
|
|
1193
|
-
[prev]="false"
|
|
1194
|
-
[overflow]="normalizedOverflow"
|
|
1195
|
-
[title]="getScrollButtonTitle('next')"
|
|
1196
|
-
class="k-toolbar-next k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1197
|
-
[ngClass]="{
|
|
1198
|
-
'k-button-sm': size === 'small',
|
|
1199
|
-
'k-button-md': size === 'medium' || !size,
|
|
1200
|
-
'k-button-lg': size === 'large'
|
|
1201
|
-
}"
|
|
1202
|
-
(onClick)="scrollTools($event)">
|
|
1203
|
-
</span>
|
|
1204
|
-
</div>
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
<ng-template #popupTemplate>
|
|
1208
|
-
<div
|
|
1209
|
-
class="k-menu-group k-menu-group-md"
|
|
1210
|
-
role="menu"
|
|
1211
|
-
[id]="popupId"
|
|
1212
|
-
[attr.dir]="direction === 'rtl' ? 'rtl' : null"
|
|
1213
|
-
[attr.aria-labelledby]="overflowBtnId">
|
|
1214
|
-
@for (tool of overflowTools; track tool; let index = $index) {
|
|
1215
|
-
@if (tool.popupTemplate) {
|
|
1216
|
-
<ng-template
|
|
1217
|
-
kendoToolbarRenderer
|
|
1218
|
-
[tool]="tool"
|
|
1219
|
-
location="overflow"
|
|
1220
|
-
[resizable]="resizable"
|
|
1221
|
-
(rendererClick)="onRendererClick($event)"
|
|
1222
|
-
[ngTemplateOutlet]="tool.isBuiltInTool ? tool.popupTemplate : popupWrapper"></ng-template>
|
|
1223
|
-
}
|
|
1224
|
-
<ng-template #popupWrapper>
|
|
1225
|
-
<div role="menuitem" tabindex="-1" class="k-item k-menu-item">
|
|
1226
|
-
<ng-container [ngTemplateOutlet]="tool.popupTemplate"></ng-container>
|
|
1227
|
-
</div>
|
|
1228
|
-
</ng-template>
|
|
1229
|
-
}
|
|
1230
|
-
</div>
|
|
1231
|
-
</ng-template>
|
|
1232
|
-
<ng-template #popupSectionTemplate>
|
|
1233
|
-
<span class="k-toolbar-items-list k-toolbar-items-list-solid"
|
|
1234
|
-
[ngClass]="sectionSizeClass"
|
|
1235
|
-
role="toolbar"
|
|
1236
|
-
[id]="popupId"
|
|
1237
|
-
[attr.dir]="direction === 'rtl' ? 'rtl' : null"
|
|
1238
|
-
[attr.aria-labelledby]="overflowBtnId">
|
|
1239
|
-
@for (tool of overflowTools; track tool; let index = $index) {
|
|
1240
|
-
<ng-container
|
|
1241
|
-
kendoToolbarRenderer
|
|
1242
|
-
[tool]="tool"
|
|
1243
|
-
location="section"
|
|
1244
|
-
[resizable]="resizable"
|
|
1245
|
-
(rendererClick)="onRendererClick($event)"
|
|
1246
|
-
[ngTemplateOutlet]="tool.isBuiltInTool ? tool.sectionTemplate : wrapper">
|
|
1247
|
-
<ng-template #wrapper>
|
|
1248
|
-
<ng-container [ngTemplateOutlet]="tool.sectionTemplate"></ng-container>
|
|
1249
|
-
</ng-template>
|
|
1250
|
-
</ng-container>
|
|
1251
|
-
}
|
|
1252
|
-
</span>
|
|
1253
|
-
</ng-template>
|
|
1254
|
-
<ng-container #container></ng-container>
|
|
1255
|
-
@if (overflowEnabled) {
|
|
1256
|
-
<kendo-resize-sensor #resizeSensor></kendo-resize-sensor>
|
|
1257
|
-
}
|
|
1258
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: LocalizedToolbarMessagesDirective, selector: "[kendoToolbarLocalizedMessages]" }, { kind: "directive", type: ToolBarRendererComponent, selector: "[kendoToolbarRenderer]", inputs: ["tool", "location", "resizable"], outputs: ["rendererClick"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { kind: "component", type: ToolbarScrollableButtonComponent, selector: "[kendoToolbarScrollableButton]", inputs: ["prev", "overflow"], outputs: ["onClick"] }] });
|
|
1259
|
-
}
|
|
1260
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ToolBarComponent, decorators: [{
|
|
1261
|
-
type: Component,
|
|
1262
|
-
args: [{
|
|
1263
|
-
exportAs: 'kendoToolBar',
|
|
1264
|
-
providers: [
|
|
1265
|
-
RefreshService,
|
|
1266
|
-
NavigationService,
|
|
1267
|
-
LocalizationService,
|
|
1268
|
-
ToolbarToolsService,
|
|
1269
|
-
ScrollService,
|
|
1270
|
-
{
|
|
1271
|
-
provide: L10N_PREFIX,
|
|
1272
|
-
useValue: 'kendo.toolbar'
|
|
1273
|
-
}
|
|
1274
|
-
],
|
|
1275
|
-
selector: 'kendo-toolbar',
|
|
1276
|
-
template: `
|
|
1277
|
-
<ng-container kendoToolbarLocalizedMessages
|
|
1278
|
-
i18n-moreToolsTitle="kendo.toolbar.moreToolsTitle|The title of the **more tools** button in a responsive ToolBar"
|
|
1279
|
-
moreToolsTitle="More tools"
|
|
1280
|
-
|
|
1281
|
-
i18n-previousToolButton="kendo.toolbar.previousToolButton|The title for the **Previous Tool** button when the Toolbar is scrollable."
|
|
1282
|
-
previousToolButton="Scroll left"
|
|
1283
|
-
|
|
1284
|
-
i18n-nextToolButton="kendo.toolbar.nextToolButton|The title for the **Next Tool** button when the Toolbar is scrollable."
|
|
1285
|
-
nextToolButton="Scroll right"
|
|
1286
|
-
>
|
|
1287
|
-
</ng-container>
|
|
1288
|
-
@if (showScrollButtons && (hasScrollButtons.position === 'split' || hasScrollButtons.position === 'start')) {
|
|
1289
|
-
@if (hasScrollButtons.position === 'split') {
|
|
1290
|
-
<span #prevScrollButton
|
|
1291
|
-
kendoToolbarScrollableButton
|
|
1292
|
-
[prev]="true"
|
|
1293
|
-
[overflow]="normalizedOverflow"
|
|
1294
|
-
[title]="getScrollButtonTitle('prev')"
|
|
1295
|
-
class="k-toolbar-prev k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1296
|
-
[ngClass]="{
|
|
1297
|
-
'k-button-sm': size === 'small',
|
|
1298
|
-
'k-button-md': size === 'medium' || !size,
|
|
1299
|
-
'k-button-lg': size === 'large'
|
|
1300
|
-
}"
|
|
1301
|
-
(onClick)="scrollTools($event)">
|
|
1302
|
-
</span>
|
|
1303
|
-
}
|
|
1304
|
-
@if (hasScrollButtons.position === 'start') {
|
|
1305
|
-
<div class="k-button-group k-button-group-solid" #startButtonGroup>
|
|
1306
|
-
<span #prevScrollButton
|
|
1307
|
-
kendoToolbarScrollableButton
|
|
1308
|
-
[prev]="true"
|
|
1309
|
-
[overflow]="normalizedOverflow"
|
|
1310
|
-
[title]="getScrollButtonTitle('prev')"
|
|
1311
|
-
class="k-toolbar-prev k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1312
|
-
[ngClass]="{
|
|
1313
|
-
'k-button-sm': size === 'small',
|
|
1314
|
-
'k-button-md': size === 'medium' || !size,
|
|
1315
|
-
'k-button-lg': size === 'large'
|
|
1316
|
-
}"
|
|
1317
|
-
(onClick)="scrollTools($event)">
|
|
1318
|
-
</span>
|
|
1319
|
-
<span #nextScrollButton
|
|
1320
|
-
kendoToolbarScrollableButton
|
|
1321
|
-
[prev]="false"
|
|
1322
|
-
[overflow]="normalizedOverflow"
|
|
1323
|
-
[title]="getScrollButtonTitle('next')"
|
|
1324
|
-
class="k-toolbar-next k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1325
|
-
[ngClass]="{
|
|
1326
|
-
'k-button-sm': size === 'small',
|
|
1327
|
-
'k-button-md': size === 'medium' || !size,
|
|
1328
|
-
'k-button-lg': size === 'large'
|
|
1329
|
-
}"
|
|
1330
|
-
(onClick)="scrollTools($event)">
|
|
1331
|
-
</span>
|
|
1332
|
-
</div>
|
|
1333
|
-
}
|
|
1334
|
-
<div class="k-toolbar-separator k-toolbar-button-separator k-separator" #scrollSeparator></div>
|
|
1335
|
-
}
|
|
1336
|
-
@if (isScrollMode) {
|
|
1337
|
-
<div class="k-toolbar-items k-toolbar-items-scroll" tabindex="-1" #scrollContainer>
|
|
1338
|
-
@for (tool of allTools; track tool; let index = $index) {
|
|
1339
|
-
<ng-container
|
|
1340
|
-
kendoToolbarRenderer
|
|
1341
|
-
[tool]="tool"
|
|
1342
|
-
location="toolbar"
|
|
1343
|
-
[resizable]="resizable"
|
|
1344
|
-
(rendererClick)="onRendererClick($event)"
|
|
1345
|
-
[ngTemplateOutlet]="tool.isBuiltInTool ? tool.toolbarTemplate : wrapper">
|
|
1346
|
-
<ng-template #wrapper>
|
|
1347
|
-
<div class="k-toolbar-item">
|
|
1348
|
-
<ng-container [ngTemplateOutlet]="tool.toolbarTemplate"></ng-container>
|
|
1349
|
-
</div>
|
|
1350
|
-
</ng-template>
|
|
1351
|
-
</ng-container>
|
|
1352
|
-
}
|
|
1353
|
-
</div>
|
|
1354
|
-
} @else {
|
|
1355
|
-
@for (tool of allTools; track tool; let index = $index) {
|
|
1356
|
-
<ng-container
|
|
1357
|
-
kendoToolbarRenderer
|
|
1358
|
-
[tool]="tool"
|
|
1359
|
-
location="toolbar"
|
|
1360
|
-
[resizable]="resizable"
|
|
1361
|
-
(rendererClick)="onRendererClick($event)"
|
|
1362
|
-
[ngTemplateOutlet]="tool.isBuiltInTool ? tool.toolbarTemplate : wrapper">
|
|
1363
|
-
<ng-template #wrapper>
|
|
1364
|
-
<div class="k-toolbar-item">
|
|
1365
|
-
<ng-container [ngTemplateOutlet]="tool.toolbarTemplate"></ng-container>
|
|
1366
|
-
</div>
|
|
1367
|
-
</ng-template>
|
|
1368
|
-
</ng-container>
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
@if (showOverflowSeparator) {
|
|
1372
|
-
<div class="k-toolbar-separator k-toolbar-button-separator k-separator"></div>
|
|
1373
|
-
}
|
|
1374
|
-
@if (showMenu) {
|
|
1375
|
-
<button
|
|
1376
|
-
kendoButton
|
|
1377
|
-
fillMode="flat"
|
|
1378
|
-
#overflowButton
|
|
1379
|
-
type="button"
|
|
1380
|
-
[icon]="overflowButtonIcon('font')"
|
|
1381
|
-
[svgIcon]="overflowButtonIcon('svg')"
|
|
1382
|
-
tabindex="-1"
|
|
1383
|
-
[title]="moreToolsTitle"
|
|
1384
|
-
[attr.aria-label]="moreToolsTitle"
|
|
1385
|
-
[attr.aria-expanded]="popupOpen"
|
|
1386
|
-
[id]="overflowBtnId"
|
|
1387
|
-
[attr.aria-haspopup]="normalizedOverflow.mode === 'section' ? null : 'menu'"
|
|
1388
|
-
[style.visibility]="'hidden'"
|
|
1389
|
-
[style.position]="'relative'"
|
|
1390
|
-
class="k-toolbar-overflow-button"
|
|
1391
|
-
[ngClass]="overflowClass"
|
|
1392
|
-
(click)="showPopup()"
|
|
1393
|
-
>
|
|
1394
|
-
</button>
|
|
1395
|
-
}
|
|
1396
|
-
@if (showScrollButtons && (hasScrollButtons.position === 'split' || hasScrollButtons.position === 'end')) {
|
|
1397
|
-
<div class="k-toolbar-separator k-toolbar-button-separator k-separator" #scrollSeparator></div>
|
|
1398
|
-
@if (hasScrollButtons.position === 'split') {
|
|
1399
|
-
<span #nextScrollButton
|
|
1400
|
-
kendoToolbarScrollableButton
|
|
1401
|
-
[prev]="false"
|
|
1402
|
-
[overflow]="normalizedOverflow"
|
|
1403
|
-
[title]="getScrollButtonTitle('next')"
|
|
1404
|
-
class="k-toolbar-next k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1405
|
-
[ngClass]="{
|
|
1406
|
-
'k-button-sm': size === 'small',
|
|
1407
|
-
'k-button-md': size === 'medium' || !size,
|
|
1408
|
-
'k-button-lg': size === 'large'
|
|
1409
|
-
}"
|
|
1410
|
-
(onClick)="scrollTools($event)">
|
|
1411
|
-
</span>
|
|
1412
|
-
}
|
|
1413
|
-
@if (hasScrollButtons.position === 'end') {
|
|
1414
|
-
<div class="k-button-group k-button-group-solid" #endButtonGroup>
|
|
1415
|
-
<span #prevScrollButton
|
|
1416
|
-
kendoToolbarScrollableButton
|
|
1417
|
-
[prev]="true"
|
|
1418
|
-
[overflow]="normalizedOverflow"
|
|
1419
|
-
[title]="getScrollButtonTitle('prev')"
|
|
1420
|
-
class="k-toolbar-prev k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1421
|
-
[ngClass]="{
|
|
1422
|
-
'k-button-sm': size === 'small',
|
|
1423
|
-
'k-button-md': size === 'medium' || !size,
|
|
1424
|
-
'k-button-lg': size === 'large'
|
|
1425
|
-
}"
|
|
1426
|
-
(onClick)="scrollTools($event)">
|
|
1427
|
-
</span>
|
|
1428
|
-
<span #nextScrollButton
|
|
1429
|
-
kendoToolbarScrollableButton
|
|
1430
|
-
[prev]="false"
|
|
1431
|
-
[overflow]="normalizedOverflow"
|
|
1432
|
-
[title]="getScrollButtonTitle('next')"
|
|
1433
|
-
class="k-toolbar-next k-icon-button k-button k-button-solid k-button-solid-base k-rounded-md"
|
|
1434
|
-
[ngClass]="{
|
|
1435
|
-
'k-button-sm': size === 'small',
|
|
1436
|
-
'k-button-md': size === 'medium' || !size,
|
|
1437
|
-
'k-button-lg': size === 'large'
|
|
1438
|
-
}"
|
|
1439
|
-
(onClick)="scrollTools($event)">
|
|
1440
|
-
</span>
|
|
1441
|
-
</div>
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
<ng-template #popupTemplate>
|
|
1445
|
-
<div
|
|
1446
|
-
class="k-menu-group k-menu-group-md"
|
|
1447
|
-
role="menu"
|
|
1448
|
-
[id]="popupId"
|
|
1449
|
-
[attr.dir]="direction === 'rtl' ? 'rtl' : null"
|
|
1450
|
-
[attr.aria-labelledby]="overflowBtnId">
|
|
1451
|
-
@for (tool of overflowTools; track tool; let index = $index) {
|
|
1452
|
-
@if (tool.popupTemplate) {
|
|
1453
|
-
<ng-template
|
|
1454
|
-
kendoToolbarRenderer
|
|
1455
|
-
[tool]="tool"
|
|
1456
|
-
location="overflow"
|
|
1457
|
-
[resizable]="resizable"
|
|
1458
|
-
(rendererClick)="onRendererClick($event)"
|
|
1459
|
-
[ngTemplateOutlet]="tool.isBuiltInTool ? tool.popupTemplate : popupWrapper"></ng-template>
|
|
1460
|
-
}
|
|
1461
|
-
<ng-template #popupWrapper>
|
|
1462
|
-
<div role="menuitem" tabindex="-1" class="k-item k-menu-item">
|
|
1463
|
-
<ng-container [ngTemplateOutlet]="tool.popupTemplate"></ng-container>
|
|
1464
|
-
</div>
|
|
1465
|
-
</ng-template>
|
|
1466
|
-
}
|
|
1467
|
-
</div>
|
|
1468
|
-
</ng-template>
|
|
1469
|
-
<ng-template #popupSectionTemplate>
|
|
1470
|
-
<span class="k-toolbar-items-list k-toolbar-items-list-solid"
|
|
1471
|
-
[ngClass]="sectionSizeClass"
|
|
1472
|
-
role="toolbar"
|
|
1473
|
-
[id]="popupId"
|
|
1474
|
-
[attr.dir]="direction === 'rtl' ? 'rtl' : null"
|
|
1475
|
-
[attr.aria-labelledby]="overflowBtnId">
|
|
1476
|
-
@for (tool of overflowTools; track tool; let index = $index) {
|
|
1477
|
-
<ng-container
|
|
1478
|
-
kendoToolbarRenderer
|
|
1479
|
-
[tool]="tool"
|
|
1480
|
-
location="section"
|
|
1481
|
-
[resizable]="resizable"
|
|
1482
|
-
(rendererClick)="onRendererClick($event)"
|
|
1483
|
-
[ngTemplateOutlet]="tool.isBuiltInTool ? tool.sectionTemplate : wrapper">
|
|
1484
|
-
<ng-template #wrapper>
|
|
1485
|
-
<ng-container [ngTemplateOutlet]="tool.sectionTemplate"></ng-container>
|
|
1486
|
-
</ng-template>
|
|
1487
|
-
</ng-container>
|
|
1488
|
-
}
|
|
1489
|
-
</span>
|
|
1490
|
-
</ng-template>
|
|
1491
|
-
<ng-container #container></ng-container>
|
|
1492
|
-
@if (overflowEnabled) {
|
|
1493
|
-
<kendo-resize-sensor #resizeSensor></kendo-resize-sensor>
|
|
1494
|
-
}
|
|
1495
|
-
`,
|
|
1496
|
-
standalone: true,
|
|
1497
|
-
imports: [NgTemplateOutlet, LocalizedToolbarMessagesDirective, ToolBarRendererComponent, ButtonComponent, NgClass, ResizeSensorComponent, ToolbarScrollableButtonComponent]
|
|
1498
|
-
}]
|
|
1499
|
-
}], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i2.PopupService }, { type: i3.RefreshService }, { type: i4.NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i5.ToolbarToolsService }, { type: i6.ScrollService }], propDecorators: { overflow: [{
|
|
1500
|
-
type: Input
|
|
1501
|
-
}], resizable: [{
|
|
1502
|
-
type: Input
|
|
1503
|
-
}], popupSettings: [{
|
|
1504
|
-
type: Input
|
|
1505
|
-
}], fillMode: [{
|
|
1506
|
-
type: Input
|
|
1507
|
-
}], tabindex: [{
|
|
1508
|
-
type: Input
|
|
1509
|
-
}], size: [{
|
|
1510
|
-
type: Input
|
|
1511
|
-
}], tabIndex: [{
|
|
1512
|
-
type: Input,
|
|
1513
|
-
args: ['tabIndex']
|
|
1514
|
-
}], showIcon: [{
|
|
1515
|
-
type: Input
|
|
1516
|
-
}], showText: [{
|
|
1517
|
-
type: Input
|
|
1518
|
-
}], open: [{
|
|
1519
|
-
type: Output
|
|
1520
|
-
}], close: [{
|
|
1521
|
-
type: Output
|
|
1522
|
-
}], allTools: [{
|
|
1523
|
-
type: ContentChildren,
|
|
1524
|
-
args: [ToolBarToolComponent]
|
|
1525
|
-
}], overflowButton: [{
|
|
1526
|
-
type: ViewChild,
|
|
1527
|
-
args: ['overflowButton', { static: false, read: ElementRef }]
|
|
1528
|
-
}], popupTemplate: [{
|
|
1529
|
-
type: ViewChild,
|
|
1530
|
-
args: ['popupTemplate', { static: true }]
|
|
1531
|
-
}], popupSectionTemplate: [{
|
|
1532
|
-
type: ViewChild,
|
|
1533
|
-
args: ['popupSectionTemplate', { static: true }]
|
|
1534
|
-
}], scrollContainer: [{
|
|
1535
|
-
type: ViewChild,
|
|
1536
|
-
args: ['scrollContainer', { read: ElementRef, static: false }]
|
|
1537
|
-
}], resizeSensor: [{
|
|
1538
|
-
type: ViewChild,
|
|
1539
|
-
args: ['resizeSensor', { static: false }]
|
|
1540
|
-
}], container: [{
|
|
1541
|
-
type: ViewChild,
|
|
1542
|
-
args: ['container', { read: ViewContainerRef, static: true }]
|
|
1543
|
-
}], prevScrollButton: [{
|
|
1544
|
-
type: ViewChild,
|
|
1545
|
-
args: ['prevScrollButton', { read: ElementRef }]
|
|
1546
|
-
}], nextScrollButton: [{
|
|
1547
|
-
type: ViewChild,
|
|
1548
|
-
args: ['nextScrollButton', { read: ElementRef }]
|
|
1549
|
-
}], startButtonGroup: [{
|
|
1550
|
-
type: ViewChild,
|
|
1551
|
-
args: ['startButtonGroup', { read: ElementRef }]
|
|
1552
|
-
}], endButtonGroup: [{
|
|
1553
|
-
type: ViewChild,
|
|
1554
|
-
args: ['endButtonGroup', { read: ElementRef }]
|
|
1555
|
-
}], scrollSeparator: [{
|
|
1556
|
-
type: ViewChild,
|
|
1557
|
-
args: ['scrollSeparator', { read: ElementRef }]
|
|
1558
|
-
}], hostClass: [{
|
|
1559
|
-
type: HostBinding,
|
|
1560
|
-
args: ['class.k-toolbar']
|
|
1561
|
-
}], scrollableClass: [{
|
|
1562
|
-
type: HostBinding,
|
|
1563
|
-
args: ['class.k-toolbar-scrollable']
|
|
1564
|
-
}], sectionClass: [{
|
|
1565
|
-
type: HostBinding,
|
|
1566
|
-
args: ['class.k-toolbar-section']
|
|
1567
|
-
}], onFocus: [{
|
|
1568
|
-
type: HostListener,
|
|
1569
|
-
args: ['focus', ['$event']]
|
|
1570
|
-
}], onFocusOut: [{
|
|
1571
|
-
type: HostListener,
|
|
1572
|
-
args: ['focusout', ['$event']]
|
|
1573
|
-
}], role: [{
|
|
1574
|
-
type: HostBinding,
|
|
1575
|
-
args: ['attr.role']
|
|
1576
|
-
}], getDir: [{
|
|
1577
|
-
type: HostBinding,
|
|
1578
|
-
args: ['attr.dir']
|
|
1579
|
-
}], resizableClass: [{
|
|
1580
|
-
type: HostBinding,
|
|
1581
|
-
args: ['class.k-toolbar-resizable']
|
|
1582
|
-
}] } });
|