@progress/kendo-angular-toolbar 17.0.0-develop.3 → 17.0.0-develop.31

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 (53) hide show
  1. package/README.md +28 -20
  2. package/common/fillmode.d.ts +8 -0
  3. package/common/size.d.ts +1 -1
  4. package/direction.d.ts +1 -1
  5. package/display-mode.d.ts +1 -1
  6. package/{esm2020 → esm2022}/common/preventable-event.mjs +1 -3
  7. package/{esm2020 → esm2022}/localization/custom-messages.component.mjs +9 -8
  8. package/{esm2020 → esm2022}/localization/localized-toolbar-messages.directive.mjs +9 -8
  9. package/{esm2020 → esm2022}/localization/messages.mjs +7 -3
  10. package/{esm2020 → esm2022}/navigation.service.mjs +9 -7
  11. package/{esm2020 → esm2022}/package-metadata.mjs +2 -2
  12. package/{esm2020 → esm2022}/refresh.service.mjs +4 -6
  13. package/{esm2020 → esm2022}/renderer.component.mjs +22 -10
  14. package/{esm2020 → esm2022}/renderer.service.mjs +5 -3
  15. package/esm2022/tool-options.mjs +5 -0
  16. package/{esm2020 → esm2022}/toolbar.component.mjs +105 -62
  17. package/{esm2020 → esm2022}/toolbar.module.mjs +4 -4
  18. package/{esm2020 → esm2022}/tools/toolbar-button.component.mjs +111 -99
  19. package/{esm2020 → esm2022}/tools/toolbar-buttongroup.component.mjs +50 -26
  20. package/{esm2020 → esm2022}/tools/toolbar-dropdownbutton.component.mjs +116 -97
  21. package/{esm2020 → esm2022}/tools/toolbar-separator.component.mjs +7 -12
  22. package/{esm2020 → esm2022}/tools/toolbar-spacer.component.mjs +10 -16
  23. package/{esm2020 → esm2022}/tools/toolbar-splitbutton.component.mjs +117 -102
  24. package/{esm2020 → esm2022}/tools/toolbar-tool.component.mjs +23 -13
  25. package/{esm2020 → esm2022}/tools/tools.service.mjs +8 -10
  26. package/{esm2020 → esm2022}/util.mjs +5 -0
  27. package/{fesm2020 → fesm2022}/progress-kendo-angular-toolbar.mjs +619 -486
  28. package/group-selection-settings.d.ts +1 -1
  29. package/index.d.ts +1 -0
  30. package/localization/messages.d.ts +1 -1
  31. package/package.json +15 -21
  32. package/render-location.d.ts +1 -1
  33. package/renderer.component.d.ts +1 -1
  34. package/toolbar.component.d.ts +11 -1
  35. package/tools/toolbar-button.component.d.ts +2 -8
  36. package/tools/toolbar-buttongroup.component.d.ts +8 -4
  37. package/tools/toolbar-dropdownbutton.component.d.ts +5 -5
  38. package/tools/toolbar-separator.component.d.ts +1 -3
  39. package/tools/toolbar-spacer.component.d.ts +1 -3
  40. package/tools/toolbar-splitbutton.component.d.ts +2 -4
  41. package/tools/toolbar-tool.component.d.ts +3 -3
  42. package/fesm2015/progress-kendo-angular-toolbar.mjs +0 -3369
  43. /package/{esm2020/common/renderer-click.mjs → esm2022/common/fillmode.mjs} +0 -0
  44. /package/{esm2020/common/size.mjs → esm2022/common/renderer-click.mjs} +0 -0
  45. /package/{esm2020/direction.mjs → esm2022/common/size.mjs} +0 -0
  46. /package/{esm2020/display-mode.mjs → esm2022/direction.mjs} +0 -0
  47. /package/{esm2020 → esm2022}/directives.mjs +0 -0
  48. /package/{esm2020/group-selection-settings.mjs → esm2022/display-mode.mjs} +0 -0
  49. /package/{esm2020/popup-settings.mjs → esm2022/group-selection-settings.mjs} +0 -0
  50. /package/{esm2020 → esm2022}/index.mjs +0 -0
  51. /package/{esm2020/render-location.mjs → esm2022/popup-settings.mjs} +0 -0
  52. /package/{esm2020 → esm2022}/progress-kendo-angular-toolbar.mjs +0 -0
  53. /package/{esm2020/tool-options.mjs → esm2022/render-location.mjs} +0 -0
@@ -1,3369 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as i0 from '@angular/core';
6
- import { EventEmitter, Injectable, inject, ElementRef, Directive, Input, Output, forwardRef, ViewContainerRef, Component, ContentChildren, ViewChild, HostBinding, HostListener, isDevMode, ViewChildren, NgModule } from '@angular/core';
7
- import { Keys, guid, isDocumentAvailable, ResizeSensorComponent, ResizeBatchService } from '@progress/kendo-angular-common';
8
- import * as i1 from '@progress/kendo-angular-l10n';
9
- import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
10
- import { validatePackage } from '@progress/kendo-licensing';
11
- import { take, filter, takeUntil } from 'rxjs/operators';
12
- import { Subject, Subscription, merge, fromEvent } from 'rxjs';
13
- import { moreVerticalIcon, caretAltDownIcon } from '@progress/kendo-svg-icons';
14
- import { ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, SplitButtonComponent } from '@progress/kendo-angular-buttons';
15
- import { NgTemplateOutlet, NgFor, NgIf, NgClass, NgStyle } from '@angular/common';
16
- import * as i2 from '@progress/kendo-angular-popup';
17
- import { PopupService } from '@progress/kendo-angular-popup';
18
- import { IconWrapperComponent, IconsService } from '@progress/kendo-angular-icons';
19
-
20
- /**
21
- * @hidden
22
- */
23
- const packageMetadata = {
24
- name: '@progress/kendo-angular-toolbar',
25
- productName: 'Kendo UI for Angular',
26
- productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
27
- publishDate: 1728917195,
28
- version: '17.0.0-develop.3',
29
- licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
30
- };
31
-
32
- /**
33
- * @hidden
34
- */
35
- class RefreshService {
36
- constructor() {
37
- this.onRefresh = new EventEmitter();
38
- }
39
- refresh(tool) {
40
- this.onRefresh.emit(tool);
41
- }
42
- }
43
- RefreshService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RefreshService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
44
- RefreshService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RefreshService });
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RefreshService, decorators: [{
46
- type: Injectable
47
- }] });
48
-
49
- /**
50
- * @hidden
51
- */
52
- const focusableRegex = /^(?:a|input|select|textarea|button|object)$/i;
53
- /**
54
- * @hidden
55
- */
56
- function outerWidth(element) {
57
- let width = element.offsetWidth;
58
- const style = getComputedStyle(element);
59
- width += parseFloat(style.marginLeft) || 0 + parseFloat(style.marginRight) || 0;
60
- return width;
61
- }
62
- /**
63
- * @hidden
64
- */
65
- function innerWidth(element) {
66
- let width = element.offsetWidth;
67
- const style = getComputedStyle(element);
68
- width -= parseFloat(style.paddingLeft) || 0 + parseFloat(style.borderLeftWidth) || 0;
69
- width -= parseFloat(style.paddingRight) || 0 + parseFloat(style.borderRightWidth) || 0;
70
- return width;
71
- }
72
- /**
73
- * @hidden
74
- */
75
- function outerHeight(element) {
76
- let width = element.offsetHeight;
77
- const style = getComputedStyle(element);
78
- width += parseFloat(style.marginTop) || 0 + parseFloat(style.marginBottom) || 0;
79
- return width;
80
- }
81
- /**
82
- * @hidden
83
- */
84
- const closest = (node, predicate) => {
85
- while (node && !predicate(node)) {
86
- node = node.parentNode;
87
- }
88
- return node;
89
- };
90
- /**
91
- * @hidden
92
- */
93
- const isVisible = (element) => {
94
- const rect = element.getBoundingClientRect();
95
- const hasSize = rect.width > 0 && rect.height > 0;
96
- const hasPosition = rect.x !== 0 && rect.y !== 0;
97
- // Elements can have zero size due to styling, but they should still count as visible.
98
- // For example, the selection checkbox has no size, but is made visible through styling.
99
- return (hasSize || hasPosition) && window.getComputedStyle(element).visibility !== 'hidden';
100
- };
101
- /**
102
- * @hidden
103
- */
104
- const findElement = (node, predicate, matchSelf = true) => {
105
- if (!node) {
106
- return;
107
- }
108
- if (matchSelf && predicate(node)) {
109
- return node;
110
- }
111
- node = node.firstChild;
112
- while (node) {
113
- if (node.nodeType === 1) {
114
- const element = findElement(node, predicate);
115
- if (element) {
116
- return element;
117
- }
118
- }
119
- node = node.nextSibling;
120
- }
121
- };
122
- /**
123
- * @hidden
124
- */
125
- const isFocusable = (element, checkVisibility = true) => {
126
- if (element.tagName) {
127
- const tagName = element.tagName.toLowerCase();
128
- const tabIndex = element.getAttribute('tabIndex');
129
- let focusable = tabIndex !== null;
130
- if (focusableRegex.test(tagName)) {
131
- focusable = !element.disabled;
132
- }
133
- return focusable && (!checkVisibility || isVisible(element));
134
- }
135
- return false;
136
- };
137
- /**
138
- * @hidden
139
- */
140
- const findFocusable = (element, checkVisibility = true) => {
141
- return findElement(element, node => isFocusable(node, checkVisibility));
142
- };
143
- /**
144
- * @hidden
145
- */
146
- const findFocusableChild = (element, checkVisibility = true) => {
147
- return findElement(element, node => isFocusable(node, checkVisibility), false);
148
- };
149
- /**
150
- * @hidden
151
- */
152
- const findFocusableSibling = (element, checkVisibility = true, reverse) => {
153
- let node = reverse ? element.prevSibling : element.nextSibling;
154
- while (node) {
155
- if (node.nodeType === 1) {
156
- const result = findElement(node, el => isFocusable(el, checkVisibility));
157
- if (result) {
158
- return result;
159
- }
160
- }
161
- node = reverse ? node.prevSibling : node.nextSibling;
162
- }
163
- };
164
- /**
165
- * @hidden
166
- */
167
- const isPresent = (value) => value !== null && value !== undefined;
168
- /**
169
- * @hidden
170
- */
171
- const makePeeker = (collection) => (index) => isPresent(collection[index]);
172
- /**
173
- * @hidden
174
- */
175
- const getIndexOfFocused = (prevKeyCode, nextKeyCode, collection) => (ev) => {
176
- switch (ev.type) {
177
- case 'keydown':
178
- if (ev.keyCode === prevKeyCode) {
179
- return collection.length - 1;
180
- }
181
- if (ev.keyCode === nextKeyCode) {
182
- return 0;
183
- }
184
- break;
185
- case 'click':
186
- return collection.findIndex(be => be === ev.target || be.contains(ev.target));
187
- case 'focus':
188
- return 0;
189
- default:
190
- return 0;
191
- }
192
- };
193
- /**
194
- * @hidden
195
- */
196
- const seekFocusedIndex = (prevKeyCode, nextKeyCode, seeker) => (startIndex, ev) => {
197
- switch (ev.keyCode) {
198
- case prevKeyCode:
199
- return seeker(startIndex - 1) ? startIndex - 1 : startIndex;
200
- case nextKeyCode:
201
- return seeker(startIndex + 1) ? startIndex + 1 : startIndex;
202
- default:
203
- return startIndex;
204
- }
205
- };
206
- /**
207
- * @hidden
208
- */
209
- const areEqual = (first) => (second) => first === second;
210
- /**
211
- * @hidden
212
- */
213
- const getNextKey = (rtl = false) => (overflows = true) => overflows ? Keys.ArrowDown : rtl ? Keys.ArrowLeft : Keys.ArrowRight;
214
- /**
215
- * @hidden
216
- */
217
- const getPrevKey = (rtl = false) => (overflows = true) => overflows ? Keys.ArrowUp : rtl ? Keys.ArrowRight : Keys.ArrowLeft;
218
- /**
219
- * @hidden
220
- */
221
- const getValueForLocation = (property, displayMode, overflows) => {
222
- switch (displayMode) {
223
- case 'toolbar':
224
- return overflows ? undefined : property;
225
- case 'overflow':
226
- return overflows ? property : undefined;
227
- default:
228
- return property;
229
- }
230
- };
231
- /**
232
- * @hidden
233
- */
234
- const SIZES = {
235
- small: 'sm',
236
- medium: 'md',
237
- large: 'lg'
238
- };
239
- /**
240
- * @hidden
241
- *
242
- * Returns the styling classes to be added and removed
243
- */
244
- const getStylingClasses = (componentType, stylingOption, previousValue, newValue) => {
245
- switch (stylingOption) {
246
- case 'size':
247
- return {
248
- toRemove: `k-${componentType}-${SIZES[previousValue]}`,
249
- toAdd: newValue !== 'none' ? `k-${componentType}-${SIZES[newValue]}` : ''
250
- };
251
- default:
252
- break;
253
- }
254
- };
255
- /**
256
- * @hidden
257
- *
258
- * Checks whether a Node is Text or Element node.
259
- * nodeType 1 is Element, nodeType 3 is Text
260
- */
261
- const isElementOrTextNode = n => n.nodeType === 1 || n.nodeType === 3;
262
-
263
- /**
264
- * @hidden
265
- */
266
- class NavigationService {
267
- constructor(zone) {
268
- this.zone = zone;
269
- this.focused = { renderedTool: null, index: -1 };
270
- this.renderedTools = [];
271
- this.isPopupFocused = false;
272
- this.isOverflowButtonFocused = false;
273
- }
274
- setRenderedTools(rts) {
275
- this.renderedTools = rts;
276
- }
277
- click({ context, event: ev }) {
278
- if (this.focused.renderedTool !== context && ev) {
279
- this.focus(context, ev);
280
- }
281
- }
282
- moveFocusToToolBar() {
283
- this.isPopupFocused = false;
284
- this.focusOverflowButton();
285
- }
286
- moveFocusToPopup() {
287
- this.isPopupFocused = true;
288
- this.resetNavigation();
289
- this.focus();
290
- }
291
- focusNext(ev) {
292
- if (this.isOverflowButtonFocused) {
293
- const firstFocusableRT = this.getFocusableTools()[0];
294
- this.focus(firstFocusableRT, ev);
295
- }
296
- else if (!this.isOverflowButtonFocused && this.focused.renderedTool && !this.focused.renderedTool.tool.handleKey(ev)) {
297
- const nextRT = this.getFocusableTools().slice(this.focused.index + 1)[0];
298
- if (nextRT) {
299
- this.focus(nextRT, ev);
300
- }
301
- else {
302
- if (this.isOverflowButtonVisible() && !this.isPopupFocused) {
303
- this.focusOverflowButton();
304
- }
305
- else {
306
- const firstRT = this.getFocusableTools()[0];
307
- this.focus(firstRT, ev);
308
- }
309
- }
310
- }
311
- }
312
- focusPrev(ev) {
313
- if (this.isOverflowButtonFocused) {
314
- const lastFocusableRT = this.getFocusableTools().reverse()[0];
315
- this.focus(lastFocusableRT, ev);
316
- }
317
- else if (!this.isOverflowButtonFocused && this.focused.renderedTool && !this.focused.renderedTool.tool.handleKey(ev)) {
318
- const prevRT = this.getFocusableTools()
319
- .slice(0, this.focused.index)
320
- .reverse()[0];
321
- if (prevRT) {
322
- this.focus(prevRT, ev);
323
- }
324
- else {
325
- if (this.isOverflowButtonVisible() && !this.isPopupFocused) {
326
- this.focusOverflowButton();
327
- }
328
- else {
329
- const lastRT = this.getFocusableTools().reverse()[0];
330
- this.focus(lastRT, ev);
331
- }
332
- }
333
- }
334
- }
335
- resetNavigation() {
336
- this.blurOverflowButton();
337
- this.focused.renderedTool = null;
338
- this.focused.index = -1;
339
- }
340
- focusFirst(ev) {
341
- const firstTool = this.getFocusableTools()[0];
342
- const overFlowButton = this.overflowButton;
343
- if (firstTool) {
344
- this.focused.renderedTool = firstTool;
345
- this.focused.index = this.getFocusableTools().findIndex(rt => rt === firstTool);
346
- this.focus(firstTool, ev);
347
- }
348
- else if (overFlowButton) {
349
- overFlowButton.nativeElement.focus();
350
- }
351
- }
352
- focusLast(ev) {
353
- const lastTool = this.getFocusableTools().reverse()[0];
354
- const overFlowButton = this.overflowButton;
355
- if (lastTool) {
356
- this.focused.renderedTool = lastTool;
357
- this.focused.index = this.getFocusableTools().findIndex(rt => rt === lastTool);
358
- this.focus(lastTool, ev);
359
- }
360
- else if (overFlowButton) {
361
- overFlowButton.nativeElement.focus();
362
- }
363
- }
364
- getFocusableTools() {
365
- return this.renderedTools.filter(rt => (rt.tool.overflows === this.isPopupFocused) && rt.tool.canFocus());
366
- }
367
- focus(renderedTool, ev) {
368
- // running the code below in onStable fixes issue #2939
369
- this.zone.onStable.pipe(take(1)).subscribe(() => {
370
- if (!renderedTool) {
371
- const focusableRTs = this.getFocusableTools();
372
- const lastFocusedRT = focusableRTs.find(rt => rt === this.focused.renderedTool) || focusableRTs[0];
373
- // guard against only disabled tools
374
- if (lastFocusedRT) {
375
- this.focused.renderedTool = lastFocusedRT;
376
- this.focused.index = this.getFocusableTools().findIndex(rt => rt === lastFocusedRT);
377
- // if event is undefined, then this means that the tool is the first one in the overflow popup
378
- lastFocusedRT.tool.focus(ev);
379
- }
380
- }
381
- else if (renderedTool.tool.canFocus && renderedTool.tool.canFocus()) {
382
- this.focused.renderedTool = renderedTool;
383
- this.focused.index = this.getFocusableTools().findIndex(rt => rt === renderedTool);
384
- renderedTool.tool.focus(ev);
385
- this.blurOverflowButton();
386
- }
387
- });
388
- }
389
- blurOverflowButton() {
390
- if (this.overflowButton) {
391
- this.isOverflowButtonFocused = false;
392
- this.overflowButton.nativeElement.tabIndex = -1;
393
- }
394
- }
395
- focusOverflowButton() {
396
- this.isOverflowButtonFocused = true;
397
- this.overflowButton.nativeElement.tabIndex = 0;
398
- this.overflowButton.nativeElement.focus();
399
- }
400
- isOverflowButtonVisible() {
401
- return (isPresent(this.overflowButton) &&
402
- window.getComputedStyle(this.overflowButton.nativeElement).getPropertyValue('visibility') === 'visible');
403
- }
404
- }
405
- NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NavigationService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
406
- NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NavigationService });
407
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NavigationService, decorators: [{
408
- type: Injectable
409
- }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
410
-
411
- /**
412
- * Represents the Base ToolBar Tool component for Angular.
413
- * Extend this class to create custom tools.
414
- */
415
- class ToolBarToolComponent {
416
- constructor() {
417
- this.tabIndex = -1; //Focus movement inside the toolbar is managed using roving tabindex.
418
- this.overflows = true;
419
- this.isBuiltInTool = false;
420
- // this should be replaced with showTool: DisplayMode = 'both';
421
- /**
422
- * @hidden
423
- */
424
- this.responsive = true;
425
- this.element = inject(ElementRef);
426
- }
427
- get toolbarDisplay() {
428
- return this.overflows ? 'none' : 'inline-flex';
429
- }
430
- get overflowDisplay() {
431
- return this.overflows ? 'block' : 'none';
432
- }
433
- /**
434
- * Determines if the tool can be focused.
435
- * If the returned value is `false`, the tool will not be part of the keyboard navigation.
436
- * @returns `true` if the tool should take part in keyboard navigation.
437
- */
438
- canFocus() {
439
- return false;
440
- }
441
- /**
442
- * Called when the tool is focused.
443
- * The method accepts as argument the original browser event, which can be a `KeyboardEvent`, `MouseEvent` or `FocusEvent`.
444
- * @param {Event} ev - This is the event that caused the tool to be focused.
445
- */
446
- focus(ev) {
447
- /* noop */
448
- }
449
- /**
450
- * Called when the tool is focused and one of the arrow keys is pressed.
451
- * The returned boolean value determines whether the `ToolBarComponent` will move the focus to the next/previous `ToolBarToolComponent`
452
- * ([see example]({% slug customcontroltypes_toolbar %}#toc-adding-keyboard-navigation)).
453
- * @param {KeyboardEvent} ev - The last pressed arrow key
454
- * @returns a boolean value determines whether the focus will move to the next/previous component.
455
- */
456
- handleKey(ev) {
457
- return false;
458
- }
459
- }
460
- ToolBarToolComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarToolComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
461
- ToolBarToolComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarToolComponent, isStandalone: true, inputs: { responsive: "responsive" }, ngImport: i0 });
462
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarToolComponent, decorators: [{
463
- type: Directive,
464
- args: [{
465
- standalone: true
466
- }]
467
- }], ctorParameters: function () { return []; }, propDecorators: { responsive: [{
468
- type: Input
469
- }] } });
470
-
471
- /**
472
- * @hidden
473
- */
474
- class PreventableEvent {
475
- constructor() {
476
- this.prevented = false;
477
- }
478
- /**
479
- * Prevents the default action for a specified event.
480
- * In this way, the source component suppresses the built-in behavior that follows the event.
481
- */
482
- preventDefault() {
483
- this.prevented = true;
484
- }
485
- /**
486
- * If the event is prevented by any of its subscribers, returns `true`.
487
- *
488
- * @returns `true` if the default action was prevented. Otherwise, returns `false`.
489
- */
490
- isDefaultPrevented() {
491
- return this.prevented;
492
- }
493
- }
494
-
495
- /**
496
- * @hidden
497
- */
498
- class RendererService {
499
- getElement() {
500
- return this.element.nativeElement;
501
- }
502
- querySelector(selector) {
503
- return this.element.nativeElement.querySelector(selector);
504
- }
505
- querySelectorAll(selector) {
506
- return this.element.nativeElement.querySelectorAll(selector);
507
- }
508
- findFocusable() {
509
- return findFocusable(this.element.nativeElement, false);
510
- }
511
- findFocusableChild(element) {
512
- if (!element) {
513
- element = this.findFocusable();
514
- }
515
- return findFocusableChild(element, false);
516
- }
517
- findNextFocusableSibling(element) {
518
- if (!element) {
519
- element = this.findFocusable();
520
- }
521
- return findFocusableSibling(element, false);
522
- }
523
- findPrevFocusableSibling(element) {
524
- if (!element) {
525
- element = this.findFocusable();
526
- }
527
- return findFocusableSibling(element, false, true);
528
- }
529
- setAttribute(element, attr, value) {
530
- this.renderer.setAttribute(element, attr, value);
531
- }
532
- }
533
- RendererService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RendererService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
534
- RendererService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RendererService });
535
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RendererService, decorators: [{
536
- type: Injectable
537
- }] });
538
-
539
- /**
540
- * @hidden
541
- */
542
- class ToolbarToolsService {
543
- constructor() {
544
- this.renderedToolsChange = new Subject();
545
- this.overflowToolsChange = new Subject();
546
- this.renderedTools = [];
547
- this.overflowTools = [];
548
- this.allTools = [];
549
- }
550
- }
551
- ToolbarToolsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarToolsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
552
- ToolbarToolsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarToolsService });
553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarToolsService, decorators: [{
554
- type: Injectable
555
- }] });
556
-
557
- const MIN_SPACER_WIDTH = 18;
558
- /**
559
- * @hidden
560
- */
561
- class ToolBarRendererComponent {
562
- constructor(renderer, rendererService, refreshService, toolsService, viewContainer) {
563
- this.renderer = renderer;
564
- this.rendererService = rendererService;
565
- this.refreshService = refreshService;
566
- this.toolsService = toolsService;
567
- this.viewContainer = viewContainer;
568
- this.rendererClick = new EventEmitter();
569
- this.onClick = (ev) => {
570
- this.rendererClick.emit({ context: this, event: ev });
571
- };
572
- }
573
- get isSpacer() {
574
- return this.tool && this.tool.__isSpacer;
575
- }
576
- ngOnInit() {
577
- var _a, _b;
578
- const viewContainerRootNodes = (_b = (_a = this.viewContainer.get(0)) === null || _a === void 0 ? void 0 : _a.rootNodes) === null || _b === void 0 ? void 0 : _b.filter(isElementOrTextNode);
579
- if (!viewContainerRootNodes || viewContainerRootNodes.length === 0) {
580
- return;
581
- }
582
- this.internalComponentRef = viewContainerRootNodes[0];
583
- this.element = this.tool.element;
584
- this.internalComponentRef.addEventListener('click', this.onClick);
585
- this.rendererService.element = this.element;
586
- this.rendererService.renderer = this;
587
- this.refreshSubscription = this.refreshService.onRefresh.subscribe((tool) => {
588
- if (this.tool === tool) {
589
- this.refresh();
590
- }
591
- });
592
- if (this.resizable) {
593
- if (this.location === 'toolbar') {
594
- this.template = this.tool.toolbarTemplate;
595
- this.renderer.setStyle(this.internalComponentRef, 'visibility', 'hidden');
596
- this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
597
- }
598
- else {
599
- this.template = this.tool.popupTemplate;
600
- this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
601
- }
602
- }
603
- else {
604
- this.tool.overflows = false;
605
- this.template = this.tool.toolbarTemplate;
606
- this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
607
- this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
608
- }
609
- }
610
- ngOnDestroy() {
611
- this.refreshSubscription && this.refreshSubscription.unsubscribe();
612
- this.internalComponentRef && this.internalComponentRef.removeEventListener('click', this.onClick);
613
- }
614
- ngAfterViewInit() {
615
- if (this.resizable) {
616
- this.refresh();
617
- }
618
- this.updateTools();
619
- }
620
- /**
621
- * @hidden
622
- */
623
- get width() {
624
- if (this.isSpacer) {
625
- return MIN_SPACER_WIDTH;
626
- }
627
- return this.tool.overflows ? 0 : outerWidth(this.internalComponentRef);
628
- }
629
- isDisplayed() {
630
- var _a, _b;
631
- return ((_b = (_a = this.internalComponentRef) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.display) !== 'none';
632
- }
633
- refresh() {
634
- if (this.resizable && this.internalComponentRef) {
635
- if (this.location === 'toolbar') {
636
- this.renderer.setStyle(this.internalComponentRef, 'visibility', this.tool.visibility);
637
- this.renderer.setStyle(this.internalComponentRef, 'display', this.tool.toolbarDisplay);
638
- }
639
- else {
640
- this.renderer.setStyle(this.internalComponentRef, 'display', this.tool.overflowDisplay);
641
- }
642
- this.updateTools();
643
- }
644
- }
645
- setAttribute(element, attr, value) {
646
- this.renderer.setAttribute(element, attr, value);
647
- }
648
- updateTools() {
649
- const isInToolbar = this.toolsService.renderedTools.some(t => t.tool === this.tool);
650
- const isInPopup = this.toolsService.overflowTools.some(t => t.tool === this.tool);
651
- if (this.location === 'toolbar') {
652
- isInPopup && (this.toolsService.overflowTools = this.toolsService.overflowTools.filter(t => t.tool !== this.tool));
653
- !isInToolbar && this.toolsService.renderedTools.push(this);
654
- }
655
- else {
656
- if (!isInPopup) {
657
- this.toolsService.overflowTools.push(this);
658
- this.toolsService.overflowTools.sort((t1, t2) => {
659
- // ensures correct navigation order in Popup
660
- return this.toolsService.allTools.indexOf(t1.tool) - this.toolsService.allTools.indexOf(t2.tool);
661
- });
662
- }
663
- }
664
- }
665
- }
666
- ToolBarRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarRendererComponent, deps: [{ token: i0.Renderer2 }, { token: RendererService }, { token: RefreshService }, { token: ToolbarToolsService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
667
- ToolBarRendererComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarRendererComponent, isStandalone: true, selector: "[kendoToolbarRenderer]", inputs: { tool: "tool", location: "location", resizable: "resizable" }, outputs: { rendererClick: "rendererClick" }, providers: [RendererService], ngImport: i0 });
668
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarRendererComponent, decorators: [{
669
- type: Directive,
670
- args: [{
671
- providers: [RendererService],
672
- standalone: true,
673
- selector: '[kendoToolbarRenderer]'
674
- }]
675
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: RendererService }, { type: RefreshService }, { type: ToolbarToolsService }, { type: i0.ViewContainerRef }]; }, propDecorators: { tool: [{
676
- type: Input
677
- }], location: [{
678
- type: Input
679
- }], resizable: [{
680
- type: Input
681
- }], rendererClick: [{
682
- type: Output
683
- }] } });
684
-
685
- /**
686
- * @hidden
687
- */
688
- class ToolbarMessages extends ComponentMessages {
689
- }
690
- ToolbarMessages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarMessages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
691
- ToolbarMessages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ToolbarMessages, selector: "kendo-toolbar-messages-base", inputs: { moreToolsTitle: "moreToolsTitle" }, usesInheritance: true, ngImport: i0 });
692
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarMessages, decorators: [{
693
- type: Directive,
694
- args: [{
695
- // eslint-disable-next-line @angular-eslint/directive-selector
696
- selector: 'kendo-toolbar-messages-base'
697
- }]
698
- }], propDecorators: { moreToolsTitle: [{
699
- type: Input
700
- }] } });
701
-
702
- /**
703
- * @hidden
704
- */
705
- class LocalizedToolbarMessagesDirective extends ToolbarMessages {
706
- constructor(service) {
707
- super();
708
- this.service = service;
709
- }
710
- }
711
- LocalizedToolbarMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LocalizedToolbarMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
712
- LocalizedToolbarMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LocalizedToolbarMessagesDirective, isStandalone: true, selector: "[kendoToolbarLocalizedMessages]", providers: [
713
- {
714
- provide: ToolbarMessages,
715
- useExisting: forwardRef(() => LocalizedToolbarMessagesDirective)
716
- }
717
- ], usesInheritance: true, ngImport: i0 });
718
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LocalizedToolbarMessagesDirective, decorators: [{
719
- type: Directive,
720
- args: [{
721
- providers: [
722
- {
723
- provide: ToolbarMessages,
724
- useExisting: forwardRef(() => LocalizedToolbarMessagesDirective)
725
- }
726
- ],
727
- selector: '[kendoToolbarLocalizedMessages]',
728
- standalone: true
729
- }]
730
- }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
731
-
732
- /* eslint-disable no-case-declarations */
733
- const DEFAULT_SIZE = 'medium';
734
- const immediateResizeThreshold = 300;
735
- const getInitialPopupSettings = (isRtl) => ({
736
- animate: true,
737
- anchorAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'bottom' },
738
- popupAlign: { horizontal: isRtl ? 'left' : 'right', vertical: 'top' }
739
- });
740
- /**
741
- * Represents the [Kendo UI ToolBar component for Angular]({% slug overview_toolbar %}).
742
- */
743
- class ToolBarComponent {
744
- constructor(localization, popupService, refreshService, navigationService,
745
- // Needs to be public as it is being accessed in the Editor component
746
- element, zone, renderer, _cdr, toolsService) {
747
- this.localization = localization;
748
- this.popupService = popupService;
749
- this.refreshService = refreshService;
750
- this.navigationService = navigationService;
751
- this.element = element;
752
- this.zone = zone;
753
- this.renderer = renderer;
754
- this._cdr = _cdr;
755
- this.toolsService = toolsService;
756
- /**
757
- * Hides the overflowing tools in a popup.
758
- */
759
- this.overflow = false;
760
- /**
761
- * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the ToolBar.
762
- */
763
- this.tabindex = 0;
764
- /**
765
- * Fires when the overflow popup of the ToolBar is opened.
766
- */
767
- this.open = new EventEmitter();
768
- /**
769
- * Fires when the overflow popup of the ToolBar is closed.
770
- */
771
- this.close = new EventEmitter();
772
- this.hostClass = true;
773
- this.cancelRenderedToolsSubscription$ = new Subject();
774
- this._size = DEFAULT_SIZE;
775
- this.overflowButtonClickedTime = null;
776
- this.subscriptions = new Subscription();
777
- this.popupSubs = new Subscription();
778
- this.role = 'toolbar';
779
- this.moreVerticalIcon = moreVerticalIcon;
780
- /**
781
- * @hidden
782
- */
783
- this.overflowBtnId = guid();
784
- /**
785
- * @hidden
786
- */
787
- this.popupId = guid();
788
- validatePackage(packageMetadata);
789
- this.direction = localization.rtl ? 'rtl' : 'ltr';
790
- }
791
- get overflowClass() {
792
- return `k-button-${SIZES[this.size]}`;
793
- }
794
- /**
795
- * @hidden
796
- */
797
- set resizable(value) {
798
- this.overflow = value;
799
- }
800
- get resizable() {
801
- return this.overflow;
802
- }
803
- /**
804
- * Configures the popup of the ToolBar overflow button ([see example]({% slug responsive_toolbar %}#toc-popup-customization)).
805
- *
806
- * The available options are:
807
- * - `animate: Boolean`—Controls the popup animation. By default, the open and close animations are enabled.
808
- * - `popupClass: String`—Specifies a list of CSS classes that are used to style the popup.
809
- */
810
- set popupSettings(settings) {
811
- this._popupSettings = Object.assign({}, getInitialPopupSettings(this.localization.rtl), settings);
812
- }
813
- get popupSettings() {
814
- return this._popupSettings || getInitialPopupSettings(this.localization.rtl);
815
- }
816
- /**
817
- * Specifies the padding of all Toolbar elements.
818
- *
819
- * The possible values are:
820
- * * `small`
821
- * * `medium` (default)
822
- * * `large`
823
- * * `none`
824
- */
825
- set size(size) {
826
- const newSize = size ? size : DEFAULT_SIZE;
827
- this.handleClasses(newSize, 'size');
828
- this._size = newSize;
829
- }
830
- get size() {
831
- return this._size;
832
- }
833
- /**
834
- * @hidden
835
- */
836
- set tabIndex(tabIndex) {
837
- this.tabindex = tabIndex;
838
- }
839
- get tabIndex() {
840
- return this.tabindex;
841
- }
842
- get appendTo() {
843
- const { appendTo } = this.popupSettings;
844
- if (!appendTo || appendTo === 'root') {
845
- return undefined;
846
- }
847
- return appendTo === 'component' ? this.container : appendTo;
848
- }
849
- set popupOpen(open) {
850
- if (this.popupOpen === open) {
851
- return;
852
- }
853
- const eventArgs = new PreventableEvent();
854
- if (open) {
855
- this.open.emit(eventArgs);
856
- }
857
- else {
858
- this.close.emit(eventArgs);
859
- }
860
- if (eventArgs.isDefaultPrevented()) {
861
- return;
862
- }
863
- this.toggle(open);
864
- }
865
- get popupOpen() {
866
- return this._open;
867
- }
868
- /**
869
- * @hidden
870
- */
871
- onFocus(ev) {
872
- this.navigationService.resetNavigation();
873
- this.navigationService.focusFirst(ev);
874
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
875
- this.element.nativeElement.setAttribute('tabindex', '-1');
876
- }
877
- /**
878
- * @hidden
879
- */
880
- onFocusOut(event) {
881
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
882
- if (closest(event.relatedTarget, (el) => el === this.element.nativeElement)) {
883
- this.element.nativeElement.setAttribute('tabindex', '-1');
884
- return;
885
- }
886
- this.element.nativeElement.setAttribute('tabindex', this.tabindex.toString());
887
- }
888
- get getDir() {
889
- return this.direction;
890
- }
891
- get resizableClass() {
892
- return this.overflow;
893
- }
894
- ngAfterContentInit() {
895
- this.toolsService.allTools = this.allTools.toArray();
896
- this.subscriptions.add(this.allTools.changes.subscribe(changes => {
897
- this.toolsService.allTools = this.allTools.toArray();
898
- this.zone.onStable.pipe(take(1)).subscribe(() => this.onResize());
899
- }));
900
- }
901
- ngAfterViewInit() {
902
- this.toolsService.renderedToolsChange.next(this.toolsService.renderedTools);
903
- this.toolsService.overflowToolsChange.next(this.toolsService.overflowTools);
904
- const element = this.element.nativeElement;
905
- if (!element.getAttribute('tabindex')) {
906
- this.element.nativeElement.setAttribute('tabindex', '0');
907
- }
908
- this.zone.runOutsideAngular(() => {
909
- this.toolbarKeydownListener = this.renderer.listen(this.element.nativeElement, 'keydown', (ev) => {
910
- switch (ev.keyCode) {
911
- case Keys.ArrowLeft:
912
- this.zone.run(() => {
913
- ev.preventDefault();
914
- if (this.direction === 'ltr') {
915
- this.navigationService.focusPrev(ev);
916
- }
917
- else {
918
- this.navigationService.focusNext(ev);
919
- }
920
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
921
- this.element.nativeElement.setAttribute('tabindex', '-1');
922
- });
923
- break;
924
- case Keys.ArrowRight:
925
- this.zone.run(() => {
926
- ev.preventDefault();
927
- if (this.direction === 'ltr') {
928
- this.navigationService.focusNext(ev);
929
- }
930
- else {
931
- this.navigationService.focusPrev(ev);
932
- }
933
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
934
- this.element.nativeElement.setAttribute('tabindex', '-1');
935
- });
936
- break;
937
- case Keys.Tab:
938
- this.zone.run(() => this.navigationService.resetNavigation());
939
- break;
940
- case Keys.Escape:
941
- this.zone.run(() => this.toggle(false));
942
- break;
943
- case Keys.Home:
944
- this.zone.run(() => this.navigationService.focusFirst(ev));
945
- break;
946
- case Keys.End:
947
- this.zone.run(() => this.navigationService.focusLast(ev));
948
- break;
949
- default:
950
- break;
951
- }
952
- });
953
- });
954
- if (this.overflow) {
955
- this.subscriptions.add(merge(this.resizeSensor.resize, this.toolsService.renderedToolsChange).subscribe(() => this.onResize()));
956
- this.navigationService.overflowButton = this.overflowButton;
957
- // because of https://github.com/telerik/kendo-angular-buttons/pull/276
958
- // button icons are not rendered until onResize() is called
959
- this.zone.runOutsideAngular(() => {
960
- setTimeout(() => {
961
- this.zone.run(() => {
962
- this.onResize();
963
- });
964
- });
965
- });
966
- }
967
- this.navigationService.setRenderedTools(this.toolsService.renderedTools);
968
- this.handleClasses(this.size, 'size');
969
- }
970
- ngOnInit() {
971
- this.subscriptions.add(this.localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
972
- this.zone.onStable.pipe(take(1)).subscribe(() => this.onResize());
973
- if (isDocumentAvailable()) {
974
- this.zone.runOutsideAngular(() => this.subscriptions.add(fromEvent(document, 'click')
975
- .pipe(filter(() => !!this.popupRef), filter((ev) => !this.popupRef.popup.instance.container.nativeElement.contains(ev.target)), filter((ev) => !this.overflowButton.nativeElement.contains(ev.target)))
976
- .subscribe(() => {
977
- this.zone.run(() => {
978
- this.popupOpen = false;
979
- });
980
- })));
981
- }
982
- }
983
- ngOnChanges(changes) {
984
- if (changes['tabindex']) {
985
- // prevents ExpressionChangedAfterItHasBeenCheckedError when tools with popup are opened/closed asynchronously
986
- this.element.nativeElement.setAttribute('tabindex', changes['tabindex'].currentValue.toString());
987
- }
988
- }
989
- ngOnDestroy() {
990
- this.destroyPopup();
991
- if (this.toolbarKeydownListener) {
992
- this.toolbarKeydownListener();
993
- }
994
- this.cancelRenderedToolsSubscription$.next();
995
- this.subscriptions.unsubscribe();
996
- }
997
- /**
998
- * @hidden
999
- */
1000
- get moreToolsTitle() {
1001
- return this.localization.get('moreToolsTitle');
1002
- }
1003
- /**
1004
- * @hidden
1005
- */
1006
- get cdr() {
1007
- return this._cdr;
1008
- }
1009
- /**
1010
- * @hidden
1011
- */
1012
- onRendererClick(data) {
1013
- this.navigationService.click(data);
1014
- this.element.nativeElement.setAttribute('tabindex', '-1');
1015
- }
1016
- /**
1017
- * @hidden
1018
- */
1019
- showPopup() {
1020
- this.popupOpen = !this.popupOpen;
1021
- this.navigationService.click({ context: undefined, event: undefined });
1022
- this.overflowButtonClickedTime = Date.now();
1023
- }
1024
- /**
1025
- * Toggles the visibility of the overflow popup.
1026
- */
1027
- toggle(popupOpen) {
1028
- this._open = popupOpen !== undefined ? popupOpen : !this.popupOpen;
1029
- if (this.popupRef) {
1030
- this.popupRef.close();
1031
- this.popupRef = null;
1032
- }
1033
- if (this.popupOpen) {
1034
- this.popupRef = this.popupService.open({
1035
- anchor: this.overflowButton,
1036
- anchorAlign: this.popupSettings.anchorAlign,
1037
- popupAlign: this.popupSettings.popupAlign,
1038
- content: this.popupTemplate,
1039
- appendTo: this.appendTo,
1040
- animate: this.popupSettings.animate,
1041
- popupClass: this.normalizePopupClasses(this.popupSettings.popupClass),
1042
- positionMode: 'absolute'
1043
- });
1044
- this.setPopupContentDimensions();
1045
- this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.onPopupOpen.bind(this)));
1046
- this.popupSubs.add(this.popupRef.popupClose.subscribe(this.onPopupClose.bind(this)));
1047
- }
1048
- }
1049
- /**
1050
- * @hidden
1051
- */
1052
- onResize() {
1053
- var _a;
1054
- if (isDocumentAvailable()) {
1055
- const containerWidth = innerWidth(this.element.nativeElement) - this.overflowAnchorWidth;
1056
- this.shrink(containerWidth, this.childrenWidth);
1057
- this.stretch(containerWidth, this.childrenWidth);
1058
- this.displayAnchor();
1059
- (_a = this.resizeSensor) === null || _a === void 0 ? void 0 : _a.acceptSize();
1060
- const isImmediateResize = (Date.now() - this.overflowButtonClickedTime) < immediateResizeThreshold;
1061
- if (this.popupOpen && !isImmediateResize) {
1062
- this.toggle();
1063
- }
1064
- }
1065
- }
1066
- /**
1067
- * @hidden
1068
- */
1069
- onPopupOpen() {
1070
- this.zone.runOutsideAngular(() => {
1071
- this.overflowKeydownListener = this.renderer.listen(this.popupRef.popupElement, 'keydown', (ev) => {
1072
- switch (ev.keyCode) {
1073
- case Keys.ArrowUp:
1074
- this.zone.run(() => {
1075
- ev.preventDefault();
1076
- this.navigationService.focusPrev(ev);
1077
- });
1078
- break;
1079
- case Keys.ArrowDown:
1080
- this.zone.run(() => {
1081
- ev.preventDefault();
1082
- this.navigationService.focusNext(ev);
1083
- });
1084
- break;
1085
- case Keys.Escape:
1086
- this.zone.run(() => this.toggle(false));
1087
- const eventArgs = new PreventableEvent();
1088
- this.close.emit(eventArgs);
1089
- break;
1090
- case Keys.Tab:
1091
- this.zone.run(() => {
1092
- this.toggle(false);
1093
- this.navigationService.resetNavigation();
1094
- });
1095
- break;
1096
- case Keys.Enter:
1097
- case Keys.Space:
1098
- this.zone.run(() => {
1099
- if (ev.target.closest('.k-menu-item')) {
1100
- ev.preventDefault();
1101
- ev.target.click();
1102
- ev.target.focus();
1103
- }
1104
- });
1105
- break;
1106
- default:
1107
- break;
1108
- }
1109
- });
1110
- });
1111
- this.cancelRenderedToolsSubscription$.next();
1112
- this.navigationService.setRenderedTools(this.toolsService.overflowTools);
1113
- this.navigationService.moveFocusToPopup();
1114
- this.toolsService.overflowToolsChange
1115
- .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
1116
- .subscribe((rts) => this.navigationService.setRenderedTools(rts));
1117
- this.renderer.setAttribute(this.overflowButton.nativeElement, 'aria-controls', this.popupId);
1118
- }
1119
- /**
1120
- * @hidden
1121
- */
1122
- onPopupClose() {
1123
- this.cancelRenderedToolsSubscription$.next();
1124
- this.navigationService.setRenderedTools(this.toolsService.renderedTools);
1125
- this.toolsService.renderedToolsChange
1126
- .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
1127
- .subscribe((rts) => this.navigationService.setRenderedTools(rts));
1128
- this.navigationService.moveFocusToToolBar();
1129
- if (this.overflowKeydownListener) {
1130
- this.overflowKeydownListener();
1131
- }
1132
- this.renderer.removeAttribute(this.overflowButton.nativeElement, 'aria-controls');
1133
- }
1134
- displayAnchor() {
1135
- const visibility = this.allTools.filter(t => t.overflows && t.responsive).length > 0 ? 'visible' : 'hidden';
1136
- this.overflowButton && this.renderer.setStyle(this.overflowButton.nativeElement, 'visibility', visibility);
1137
- }
1138
- get popupWidth() {
1139
- if (!this.popupSettings || !this.popupSettings.width) {
1140
- return 'auto';
1141
- }
1142
- return isNaN(this.popupSettings.width) ? this.popupSettings.width : `${this.popupSettings.width}px`;
1143
- }
1144
- get popupHeight() {
1145
- if (!this.popupSettings || !this.popupSettings.height) {
1146
- return;
1147
- }
1148
- return isNaN(this.popupSettings.height) ? this.popupSettings.height : `${this.popupSettings.height}px`;
1149
- }
1150
- get overflowAnchorWidth() {
1151
- if (!this.overflow) {
1152
- return 0;
1153
- }
1154
- if (!this.cachedOverflowAnchorWidth) {
1155
- this.cachedOverflowAnchorWidth = this.overflowButton.nativeElement.offsetWidth;
1156
- }
1157
- return this.cachedOverflowAnchorWidth;
1158
- }
1159
- get gap() {
1160
- if (isPresent(this.cachedGap)) {
1161
- return this.cachedGap;
1162
- }
1163
- const computedGap = getComputedStyle(this.element.nativeElement).gap;
1164
- this.cachedGap = isPresent(computedGap) ? parseInt(computedGap, 10) : 0;
1165
- return this.cachedGap;
1166
- }
1167
- get childrenWidth() {
1168
- const width = this.toolsService.renderedTools.reduce((totalWidth, tool) => tool.width + totalWidth + (tool.isDisplayed() ? this.gap : 0), 0);
1169
- return Math.ceil(width);
1170
- }
1171
- get visibleTools() {
1172
- return this.allTools.filter((tool) => {
1173
- return tool.overflows === false;
1174
- });
1175
- }
1176
- get overflowTools() {
1177
- return this.allTools.filter((tool) => {
1178
- return tool.overflows === true;
1179
- });
1180
- }
1181
- shrink(containerWidth, childrenWidth) {
1182
- let width;
1183
- if (containerWidth < childrenWidth) {
1184
- for (let i = this.visibleTools.length - 1; i >= 0; i--) {
1185
- if (containerWidth > childrenWidth) {
1186
- break;
1187
- }
1188
- else {
1189
- width = this.hideLastVisibleTool();
1190
- childrenWidth -= width;
1191
- }
1192
- }
1193
- }
1194
- }
1195
- stretch(containerWidth, childrenWidth) {
1196
- let width;
1197
- if (containerWidth > childrenWidth) {
1198
- for (let i = this.overflowTools.length - 1; i >= 0; i--) {
1199
- width = this.showFirstHiddenTool(containerWidth, childrenWidth);
1200
- if (width) {
1201
- childrenWidth += width + this.gap;
1202
- }
1203
- else {
1204
- break;
1205
- }
1206
- }
1207
- }
1208
- }
1209
- hideLastVisibleTool() {
1210
- const tool = this.visibleTools[this.visibleTools.length - 1];
1211
- if (!tool) {
1212
- return null;
1213
- }
1214
- const renderedElement = this.toolsService.renderedTools.find((r) => {
1215
- return r.tool === tool;
1216
- });
1217
- const width = renderedElement.width;
1218
- tool.overflows = this.overflow;
1219
- this.refreshService.refresh(tool);
1220
- return width;
1221
- }
1222
- showFirstHiddenTool(containerWidth, childrenWidth) {
1223
- const tool = this.overflowTools[0];
1224
- if (!tool) {
1225
- return null;
1226
- }
1227
- const renderedElement = this.toolsService.renderedTools.find((r) => r.tool === tool);
1228
- tool.overflows = false;
1229
- tool.visibility = 'hidden';
1230
- this.refreshService.refresh(tool);
1231
- if (containerWidth > childrenWidth + renderedElement.width) {
1232
- tool.visibility = 'visible';
1233
- }
1234
- else {
1235
- tool.overflows = true;
1236
- }
1237
- this.refreshService.refresh(tool);
1238
- return renderedElement.width; // returns 0 if `overflows` is true
1239
- }
1240
- setPopupContentDimensions() {
1241
- const popupContentContainer = this.popupRef.popup.instance.contentContainer.nativeElement;
1242
- popupContentContainer.style.width = this.popupWidth;
1243
- popupContentContainer.style.height = this.popupHeight;
1244
- popupContentContainer.style.overflow = 'auto';
1245
- }
1246
- destroyPopup() {
1247
- if (this.popupRef) {
1248
- this.popupSubs.unsubscribe();
1249
- this.popupRef.close();
1250
- this.popupRef = null;
1251
- }
1252
- }
1253
- handleClasses(value, input) {
1254
- const elem = this.element.nativeElement;
1255
- const classes = getStylingClasses('toolbar', input, this[input], value);
1256
- if (classes.toRemove) {
1257
- this.renderer.removeClass(elem, classes.toRemove);
1258
- }
1259
- if (classes.toAdd) {
1260
- this.renderer.addClass(elem, classes.toAdd);
1261
- }
1262
- }
1263
- normalizePopupClasses(classList) {
1264
- let classes = ['k-menu-popup', 'k-toolbar-popup'];
1265
- if (!classList) {
1266
- return classes;
1267
- }
1268
- if (typeof classList === 'string') {
1269
- classes.push(...classList.split(' '));
1270
- }
1271
- else if (Array.isArray(classList)) {
1272
- classes = [...classes, ...classList];
1273
- }
1274
- else {
1275
- for (const cl in classList) {
1276
- classes.push(classList[cl]);
1277
- }
1278
- }
1279
- return classes;
1280
- }
1281
- }
1282
- ToolBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarComponent, deps: [{ token: i1.LocalizationService }, { token: i2.PopupService }, { token: RefreshService }, { token: NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: ToolbarToolsService }], target: i0.ɵɵFactoryTarget.Component });
1283
- ToolBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarComponent, isStandalone: true, selector: "kendo-toolbar", inputs: { overflow: "overflow", resizable: "resizable", popupSettings: "popupSettings", tabindex: "tabindex", size: "size", tabIndex: "tabIndex" }, outputs: { open: "open", close: "close" }, host: { listeners: { "focus": "onFocus($event)", "focusout": "onFocusOut($event)" }, properties: { "class.k-toolbar": "this.hostClass", "attr.role": "this.role", "attr.dir": "this.getDir", "class.k-toolbar-resizable": "this.resizableClass" } }, providers: [
1284
- RefreshService,
1285
- NavigationService,
1286
- LocalizationService,
1287
- ToolbarToolsService,
1288
- {
1289
- provide: L10N_PREFIX,
1290
- useValue: 'kendo.toolbar'
1291
- }
1292
- ], 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: "resizeSensor", first: true, predicate: ["resizeSensor"], descendants: true }, { propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], exportAs: ["kendoToolBar"], usesOnChanges: true, ngImport: i0, template: `
1293
- <ng-container kendoToolbarLocalizedMessages
1294
- i18n-moreToolsTitle="kendo.toolbar.moreToolsTitle|The title of the **more tools** button in a responsive ToolBar"
1295
- moreToolsTitle="More tools"
1296
- >
1297
- </ng-container>
1298
- <ng-container *ngFor="let tool of allTools; let index = index"
1299
- kendoToolbarRenderer
1300
- [tool]="tool"
1301
- location="toolbar"
1302
- [resizable]="overflow"
1303
- (rendererClick)="onRendererClick($event)"
1304
- [ngTemplateOutlet]="tool.isBuiltInTool ? tool.toolbarTemplate : wrapper">
1305
- <ng-template #wrapper>
1306
- <div class="k-toolbar-item">
1307
- <ng-container [ngTemplateOutlet]="tool.toolbarTemplate"></ng-container>
1308
- </div>
1309
- </ng-template>
1310
- </ng-container>
1311
- <button
1312
- kendoButton
1313
- fillMode="flat"
1314
- #overflowButton
1315
- type="button"
1316
- icon="more-vertical"
1317
- [svgIcon]="moreVerticalIcon"
1318
- tabindex="-1"
1319
- [title]="moreToolsTitle"
1320
- [attr.aria-label]="moreToolsTitle"
1321
- [attr.aria-expanded]="popupOpen"
1322
- [id]="overflowBtnId"
1323
- aria-haspopup="menu"
1324
- *ngIf="overflow"
1325
- [style.visibility]="'hidden'"
1326
- [style.position]="'relative'"
1327
- [style.margin-inline-start]="'auto'"
1328
- class="k-toolbar-overflow-button"
1329
- [ngClass]="overflowClass"
1330
- (click)="showPopup()"
1331
- >
1332
- </button>
1333
- <ng-template #popupTemplate>
1334
- <div
1335
- class="k-menu-group k-menu-group-md"
1336
- role="menu"
1337
- [id]="popupId"
1338
- [attr.aria-labelledby]="overflowBtnId">
1339
- <ng-container *ngFor="let tool of overflowTools; let index = index">
1340
- <ng-template
1341
- *ngIf="tool.popupTemplate"
1342
- kendoToolbarRenderer
1343
- [tool]="tool"
1344
- location="overflow"
1345
- [resizable]="overflow"
1346
- (rendererClick)="onRendererClick($event)"
1347
- [ngTemplateOutlet]="tool.isBuiltInTool ? tool.popupTemplate : popupWrapper"></ng-template>
1348
- <ng-template #popupWrapper>
1349
- <div role="menuitem" tabindex="-1" class="k-item k-menu-item">
1350
- <ng-container [ngTemplateOutlet]="tool.popupTemplate"></ng-container>
1351
- </div>
1352
- </ng-template>
1353
- </ng-container>
1354
- </div>
1355
- </ng-template>
1356
- <ng-container #container></ng-container>
1357
- <kendo-resize-sensor *ngIf="overflow" #resizeSensor></kendo-resize-sensor>
1358
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: LocalizedToolbarMessagesDirective, selector: "[kendoToolbarLocalizedMessages]" }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: ToolBarRendererComponent, selector: "[kendoToolbarRenderer]", inputs: ["tool", "location", "resizable"], outputs: ["rendererClick"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "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"] }] });
1359
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarComponent, decorators: [{
1360
- type: Component,
1361
- args: [{
1362
- exportAs: 'kendoToolBar',
1363
- providers: [
1364
- RefreshService,
1365
- NavigationService,
1366
- LocalizationService,
1367
- ToolbarToolsService,
1368
- {
1369
- provide: L10N_PREFIX,
1370
- useValue: 'kendo.toolbar'
1371
- }
1372
- ],
1373
- selector: 'kendo-toolbar',
1374
- template: `
1375
- <ng-container kendoToolbarLocalizedMessages
1376
- i18n-moreToolsTitle="kendo.toolbar.moreToolsTitle|The title of the **more tools** button in a responsive ToolBar"
1377
- moreToolsTitle="More tools"
1378
- >
1379
- </ng-container>
1380
- <ng-container *ngFor="let tool of allTools; let index = index"
1381
- kendoToolbarRenderer
1382
- [tool]="tool"
1383
- location="toolbar"
1384
- [resizable]="overflow"
1385
- (rendererClick)="onRendererClick($event)"
1386
- [ngTemplateOutlet]="tool.isBuiltInTool ? tool.toolbarTemplate : wrapper">
1387
- <ng-template #wrapper>
1388
- <div class="k-toolbar-item">
1389
- <ng-container [ngTemplateOutlet]="tool.toolbarTemplate"></ng-container>
1390
- </div>
1391
- </ng-template>
1392
- </ng-container>
1393
- <button
1394
- kendoButton
1395
- fillMode="flat"
1396
- #overflowButton
1397
- type="button"
1398
- icon="more-vertical"
1399
- [svgIcon]="moreVerticalIcon"
1400
- tabindex="-1"
1401
- [title]="moreToolsTitle"
1402
- [attr.aria-label]="moreToolsTitle"
1403
- [attr.aria-expanded]="popupOpen"
1404
- [id]="overflowBtnId"
1405
- aria-haspopup="menu"
1406
- *ngIf="overflow"
1407
- [style.visibility]="'hidden'"
1408
- [style.position]="'relative'"
1409
- [style.margin-inline-start]="'auto'"
1410
- class="k-toolbar-overflow-button"
1411
- [ngClass]="overflowClass"
1412
- (click)="showPopup()"
1413
- >
1414
- </button>
1415
- <ng-template #popupTemplate>
1416
- <div
1417
- class="k-menu-group k-menu-group-md"
1418
- role="menu"
1419
- [id]="popupId"
1420
- [attr.aria-labelledby]="overflowBtnId">
1421
- <ng-container *ngFor="let tool of overflowTools; let index = index">
1422
- <ng-template
1423
- *ngIf="tool.popupTemplate"
1424
- kendoToolbarRenderer
1425
- [tool]="tool"
1426
- location="overflow"
1427
- [resizable]="overflow"
1428
- (rendererClick)="onRendererClick($event)"
1429
- [ngTemplateOutlet]="tool.isBuiltInTool ? tool.popupTemplate : popupWrapper"></ng-template>
1430
- <ng-template #popupWrapper>
1431
- <div role="menuitem" tabindex="-1" class="k-item k-menu-item">
1432
- <ng-container [ngTemplateOutlet]="tool.popupTemplate"></ng-container>
1433
- </div>
1434
- </ng-template>
1435
- </ng-container>
1436
- </div>
1437
- </ng-template>
1438
- <ng-container #container></ng-container>
1439
- <kendo-resize-sensor *ngIf="overflow" #resizeSensor></kendo-resize-sensor>
1440
- `,
1441
- standalone: true,
1442
- imports: [NgTemplateOutlet, LocalizedToolbarMessagesDirective, NgFor, ToolBarRendererComponent, NgIf, ButtonComponent, NgClass, ResizeSensorComponent]
1443
- }]
1444
- }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.PopupService }, { type: RefreshService }, { type: NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: ToolbarToolsService }]; }, propDecorators: { overflow: [{
1445
- type: Input
1446
- }], resizable: [{
1447
- type: Input
1448
- }], popupSettings: [{
1449
- type: Input
1450
- }], tabindex: [{
1451
- type: Input
1452
- }], size: [{
1453
- type: Input
1454
- }], tabIndex: [{
1455
- type: Input,
1456
- args: ['tabIndex']
1457
- }], open: [{
1458
- type: Output
1459
- }], close: [{
1460
- type: Output
1461
- }], allTools: [{
1462
- type: ContentChildren,
1463
- args: [ToolBarToolComponent]
1464
- }], overflowButton: [{
1465
- type: ViewChild,
1466
- args: ['overflowButton', { static: false, read: ElementRef }]
1467
- }], popupTemplate: [{
1468
- type: ViewChild,
1469
- args: ['popupTemplate', { static: true }]
1470
- }], resizeSensor: [{
1471
- type: ViewChild,
1472
- args: ['resizeSensor', { static: false }]
1473
- }], container: [{
1474
- type: ViewChild,
1475
- args: ['container', { read: ViewContainerRef, static: true }]
1476
- }], hostClass: [{
1477
- type: HostBinding,
1478
- args: ['class.k-toolbar']
1479
- }], onFocus: [{
1480
- type: HostListener,
1481
- args: ['focus', ['$event']]
1482
- }], onFocusOut: [{
1483
- type: HostListener,
1484
- args: ['focusout', ['$event']]
1485
- }], role: [{
1486
- type: HostBinding,
1487
- args: ['attr.role']
1488
- }], getDir: [{
1489
- type: HostBinding,
1490
- args: ['attr.dir']
1491
- }], resizableClass: [{
1492
- type: HostBinding,
1493
- args: ['class.k-toolbar-resizable']
1494
- }] } });
1495
-
1496
- /**
1497
- * Represents the [Kendo UI ToolBar Button tool for Angular]({% slug controltypes_toolbar %}#toc-buttons).
1498
- */
1499
- class ToolBarButtonComponent extends ToolBarToolComponent {
1500
- constructor(element, zone) {
1501
- super();
1502
- this.element = element;
1503
- this.zone = zone;
1504
- /**
1505
- * Specifies where button icon should be displayed
1506
- */
1507
- this.showIcon = 'both';
1508
- /**
1509
- * Provides visual styling that indicates if the Button is active
1510
- * ([see example]({% slug controltypes_toolbar %}#toc-toggle-buttons)).
1511
- * By default, `toggleable` is set to `false`.
1512
- */
1513
- this.toggleable = false;
1514
- /**
1515
- * Sets the selected state of the Button.
1516
- */
1517
- this.selected = false;
1518
- /**
1519
- * The fillMode property specifies the background and border styles of the Button.
1520
- *
1521
- * The available values are:
1522
- * * `solid` (default)
1523
- * * `flat`
1524
- * * `outline`
1525
- * * `link`
1526
- * * `null`
1527
- */
1528
- this.fillMode = 'solid';
1529
- /**
1530
- * The Button allows you to specify predefined theme colors.
1531
- * The theme color will be applied as a background and border color while also amending the text color accordingly
1532
- * ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-themeColor)).
1533
- *
1534
- * The possible values are:
1535
- * * `base` &mdash;Applies coloring based on the `base` theme color. (default)
1536
- * * `primary` &mdash;Applies coloring based on the `primary` theme color.
1537
- * * `secondary`&mdash;Applies coloring based on the `secondary` theme color.
1538
- * * `tertiary`&mdash; Applies coloring based on the `tertiary` theme color.
1539
- * * `info`&mdash;Applies coloring based on the `info` theme color.
1540
- * * `success`&mdash; Applies coloring based on the `success` theme color.
1541
- * * `warning`&mdash; Applies coloring based on the `warning` theme color.
1542
- * * `error`&mdash; Applies coloring based on the `error` theme color.
1543
- * * `dark`&mdash; Applies coloring based on the `dark` theme color.
1544
- * * `light`&mdash; Applies coloring based on the `light` theme color.
1545
- * * `inverse`&mdash; Applies coloring based on the `inverse` theme color.
1546
- * * `null` &mdash;Removes the default CSS class (no class would be rendered).
1547
- */
1548
- this.themeColor = 'base';
1549
- /**
1550
- * Fires each time the Button is clicked.
1551
- */
1552
- this.click = new EventEmitter();
1553
- /**
1554
- * Fires when the Button [pointerdown](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/pointerdown_event) event is triggered.
1555
- */
1556
- this.pointerdown = new EventEmitter();
1557
- /**
1558
- * Fires each time the selected state of a Toggle Button is changed.
1559
- * The event argument is the new selected state (Boolean).
1560
- */
1561
- this.selectedChange = new EventEmitter();
1562
- this.toolbarOptions = {
1563
- text: '',
1564
- icon: '',
1565
- iconClass: '',
1566
- svgIcon: null,
1567
- imageUrl: ''
1568
- };
1569
- this.overflowOptions = {
1570
- text: '',
1571
- icon: '',
1572
- iconClass: '',
1573
- svgIcon: null,
1574
- imageUrl: ''
1575
- };
1576
- this._showText = 'both';
1577
- this.isBuiltInTool = true;
1578
- }
1579
- // showText and showIcon showIcon should be declared first
1580
- /**
1581
- * Specifies where button text should be displayed
1582
- */
1583
- set showText(value) {
1584
- this._showText = value;
1585
- this.setTextDisplayMode();
1586
- }
1587
- get showText() {
1588
- return this._showText;
1589
- }
1590
- /**
1591
- * Specifies the text of the Button ([see example]({% slug controltypes_toolbar %}#toc-buttons)).
1592
- */
1593
- set text(text) {
1594
- this._text = text;
1595
- this.setTextDisplayMode();
1596
- }
1597
- get text() {
1598
- return this._text;
1599
- }
1600
- /**
1601
- * @hidden
1602
- */
1603
- set look(look) {
1604
- if (look) {
1605
- this.fillMode = look === 'default' ? 'solid' : look;
1606
- }
1607
- }
1608
- /**
1609
- * @hidden
1610
- */
1611
- get togglable() {
1612
- return this.toggleable;
1613
- }
1614
- set togglable(value) {
1615
- this.toggleable = value;
1616
- }
1617
- /**
1618
- * Defines the name for an existing icon in a Kendo UI theme
1619
- * ([see example]({% slug controltypes_toolbar %}#toc-buttons)).
1620
- * The icon is rendered inside the Button by a `span.k-icon` element.
1621
- */
1622
- set icon(icon) {
1623
- this.toolbarOptions.icon = getValueForLocation(icon, this.showIcon, false);
1624
- this.overflowOptions.icon = getValueForLocation(icon, this.showIcon, true);
1625
- }
1626
- /**
1627
- * Defines a CSS class&mdash;or multiple classes separated by spaces&mdash;
1628
- * which are applied to a `span` element inside the Button. Allows the usage of custom icons.
1629
- */
1630
- set iconClass(iconClass) {
1631
- this.toolbarOptions.iconClass = getValueForLocation(iconClass, this.showIcon, false);
1632
- this.overflowOptions.iconClass = getValueForLocation(iconClass, this.showIcon, true);
1633
- }
1634
- /**
1635
- * Defines an SVGIcon to be rendered within the button.
1636
- * The input can take either an [existing Kendo SVG icon](slug:svgicon_list) or a custom one.
1637
- */
1638
- set svgIcon(icon) {
1639
- const isIconSet = this.toolbarOptions.icon || this.overflowOptions.icon;
1640
- const isIconClassSet = this.toolbarOptions.iconClass || this.overflowOptions.iconClass;
1641
- if (isDevMode() &&
1642
- icon &&
1643
- isIconSet &&
1644
- isIconClassSet) {
1645
- throw new Error('Setting both icon/svgIcon and iconClass options at the same time is not supported.');
1646
- }
1647
- this.toolbarOptions.svgIcon = getValueForLocation(icon, this.showIcon, false);
1648
- this.overflowOptions.svgIcon = getValueForLocation(icon, this.showIcon, true);
1649
- }
1650
- /**
1651
- * Defines a URL which is used for an `img` element inside the Button.
1652
- * The URL can be relative or absolute. If relative, it is evaluated with relation to the web page URL.
1653
- */
1654
- set imageUrl(imageUrl) {
1655
- this.toolbarOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, false);
1656
- this.overflowOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, true);
1657
- }
1658
- ngOnInit() {
1659
- this.setTextDisplayMode();
1660
- }
1661
- /**
1662
- * @hidden
1663
- */
1664
- onBlur() {
1665
- this.getButton().tabIndex = -1;
1666
- }
1667
- /**
1668
- * @hidden
1669
- */
1670
- canFocus() {
1671
- return !this.disabled;
1672
- }
1673
- /**
1674
- * @hidden
1675
- */
1676
- focus(ev) {
1677
- // guard against focusing twice on mousedown.
1678
- if (!ev || ev.type === 'focus' || ev.type === 'keydown') {
1679
- this.getButton().focus();
1680
- }
1681
- this.getButton().tabIndex = 0;
1682
- }
1683
- /**
1684
- * @hidden
1685
- */
1686
- handleKey() {
1687
- this.getButton().tabIndex = -1;
1688
- return false;
1689
- }
1690
- /**
1691
- * @hidden
1692
- */
1693
- get toolbarButtonClass() {
1694
- return this.toggleable ? 'k-toolbar-toggle-button' : 'k-toolbar-button';
1695
- }
1696
- /**
1697
- * @hidden
1698
- */
1699
- handleClick(ev) {
1700
- this.click.emit(ev);
1701
- if (this.toggleable) {
1702
- this.selected = !this.selected;
1703
- this.selectedChange.emit(this.selected);
1704
- }
1705
- }
1706
- /**
1707
- * @hidden
1708
- */
1709
- selectedChangeHandler(state) {
1710
- this.selected = state;
1711
- this.selectedChange.emit(state);
1712
- }
1713
- getButton() {
1714
- return (this.overflowButtonElement || this.toolbarButtonElement).nativeElement;
1715
- }
1716
- setTextDisplayMode() {
1717
- this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
1718
- this.zone.onStable.pipe(take(1)).subscribe(() => {
1719
- this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
1720
- });
1721
- }
1722
- }
1723
- ToolBarButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1724
- ToolBarButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarButtonComponent, isStandalone: true, selector: "kendo-toolbar-button", inputs: { showText: "showText", showIcon: "showIcon", text: "text", style: "style", className: "className", title: "title", disabled: "disabled", toggleable: "toggleable", look: "look", togglable: "togglable", selected: "selected", fillMode: "fillMode", themeColor: "themeColor", icon: "icon", iconClass: "iconClass", svgIcon: "svgIcon", imageUrl: "imageUrl" }, outputs: { click: "click", pointerdown: "pointerdown", selectedChange: "selectedChange" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarButtonComponent) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "toolbarButtonElement", first: true, predicate: ["toolbarButton"], descendants: true, read: ElementRef }, { propertyName: "overflowButtonElement", first: true, predicate: ["overflowButton"], descendants: true, read: ElementRef }], exportAs: ["kendoToolBarButton"], usesInheritance: true, ngImport: i0, template: `
1725
- <ng-template #toolbarTemplate>
1726
- <button
1727
- #toolbarButton
1728
- [class]="toolbarButtonClass"
1729
- [tabindex]="tabIndex"
1730
- type="button"
1731
- kendoButton
1732
- [ngStyle]="style"
1733
- [ngClass]="className"
1734
- [attr.title]="title"
1735
- [disabled]="disabled"
1736
- [toggleable]="toggleable"
1737
- [fillMode]="fillMode"
1738
- [themeColor]="fillMode ? themeColor : null"
1739
- [selected]="selected"
1740
- [icon]="toolbarOptions.icon"
1741
- [iconClass]="toolbarOptions.iconClass"
1742
- [svgIcon]="toolbarOptions.svgIcon"
1743
- [imageUrl]="toolbarOptions.imageUrl"
1744
- (click)="click.emit($event)"
1745
- (pointerdown)="pointerdown.emit($event)"
1746
- (selectedChange)="selectedChangeHandler($event)"
1747
- (blur)="onBlur()"
1748
- >
1749
- {{ toolbarOptions.text }}
1750
- </button>
1751
- </ng-template>
1752
- <ng-template #popupTemplate>
1753
- <div
1754
- #overflowButton
1755
- tabindex="-1"
1756
- role="menuitem"
1757
- class="k-item k-menu-item"
1758
- [class.k-disabled]="disabled"
1759
- [ngClass]="className"
1760
- [ngStyle]="style"
1761
- (click)="handleClick($event)">
1762
- <span
1763
- class="k-link k-menu-link"
1764
- [class.k-selected]="selected"
1765
- >
1766
- <kendo-icon-wrapper
1767
- *ngIf="overflowOptions.icon || overflowOptions.iconClass || overflowOptions.svgIcon"
1768
- [name]="overflowOptions.icon"
1769
- [customFontClass]="overflowOptions.iconClass"
1770
- [svgIcon]="overflowOptions.svgIcon"
1771
- ></kendo-icon-wrapper>
1772
- <span *ngIf="overflowOptions.text" class="k-menu-link-text">{{overflowOptions.text}}</span>
1773
- </span>
1774
- </div>
1775
- </ng-template>
1776
- `, isInline: true, dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] });
1777
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarButtonComponent, decorators: [{
1778
- type: Component,
1779
- args: [{
1780
- exportAs: 'kendoToolBarButton',
1781
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarButtonComponent) }],
1782
- selector: 'kendo-toolbar-button',
1783
- template: `
1784
- <ng-template #toolbarTemplate>
1785
- <button
1786
- #toolbarButton
1787
- [class]="toolbarButtonClass"
1788
- [tabindex]="tabIndex"
1789
- type="button"
1790
- kendoButton
1791
- [ngStyle]="style"
1792
- [ngClass]="className"
1793
- [attr.title]="title"
1794
- [disabled]="disabled"
1795
- [toggleable]="toggleable"
1796
- [fillMode]="fillMode"
1797
- [themeColor]="fillMode ? themeColor : null"
1798
- [selected]="selected"
1799
- [icon]="toolbarOptions.icon"
1800
- [iconClass]="toolbarOptions.iconClass"
1801
- [svgIcon]="toolbarOptions.svgIcon"
1802
- [imageUrl]="toolbarOptions.imageUrl"
1803
- (click)="click.emit($event)"
1804
- (pointerdown)="pointerdown.emit($event)"
1805
- (selectedChange)="selectedChangeHandler($event)"
1806
- (blur)="onBlur()"
1807
- >
1808
- {{ toolbarOptions.text }}
1809
- </button>
1810
- </ng-template>
1811
- <ng-template #popupTemplate>
1812
- <div
1813
- #overflowButton
1814
- tabindex="-1"
1815
- role="menuitem"
1816
- class="k-item k-menu-item"
1817
- [class.k-disabled]="disabled"
1818
- [ngClass]="className"
1819
- [ngStyle]="style"
1820
- (click)="handleClick($event)">
1821
- <span
1822
- class="k-link k-menu-link"
1823
- [class.k-selected]="selected"
1824
- >
1825
- <kendo-icon-wrapper
1826
- *ngIf="overflowOptions.icon || overflowOptions.iconClass || overflowOptions.svgIcon"
1827
- [name]="overflowOptions.icon"
1828
- [customFontClass]="overflowOptions.iconClass"
1829
- [svgIcon]="overflowOptions.svgIcon"
1830
- ></kendo-icon-wrapper>
1831
- <span *ngIf="overflowOptions.text" class="k-menu-link-text">{{overflowOptions.text}}</span>
1832
- </span>
1833
- </div>
1834
- </ng-template>
1835
- `,
1836
- standalone: true,
1837
- imports: [ButtonComponent, NgStyle, NgClass, NgIf, IconWrapperComponent]
1838
- }]
1839
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { showText: [{
1840
- type: Input
1841
- }], showIcon: [{
1842
- type: Input
1843
- }], text: [{
1844
- type: Input
1845
- }], style: [{
1846
- type: Input
1847
- }], className: [{
1848
- type: Input
1849
- }], title: [{
1850
- type: Input
1851
- }], disabled: [{
1852
- type: Input
1853
- }], toggleable: [{
1854
- type: Input
1855
- }], look: [{
1856
- type: Input
1857
- }], togglable: [{
1858
- type: Input
1859
- }], selected: [{
1860
- type: Input
1861
- }], fillMode: [{
1862
- type: Input
1863
- }], themeColor: [{
1864
- type: Input
1865
- }], icon: [{
1866
- type: Input
1867
- }], iconClass: [{
1868
- type: Input
1869
- }], svgIcon: [{
1870
- type: Input
1871
- }], imageUrl: [{
1872
- type: Input
1873
- }], click: [{
1874
- type: Output
1875
- }], pointerdown: [{
1876
- type: Output
1877
- }], selectedChange: [{
1878
- type: Output
1879
- }], toolbarTemplate: [{
1880
- type: ViewChild,
1881
- args: ['toolbarTemplate', { static: true }]
1882
- }], popupTemplate: [{
1883
- type: ViewChild,
1884
- args: ['popupTemplate', { static: true }]
1885
- }], toolbarButtonElement: [{
1886
- type: ViewChild,
1887
- args: ['toolbarButton', { read: ElementRef }]
1888
- }], overflowButtonElement: [{
1889
- type: ViewChild,
1890
- args: ['overflowButton', { read: ElementRef }]
1891
- }] } });
1892
-
1893
- /**
1894
- * Represents the Kendo UI Toolbar ButtonGroup for Angular.
1895
- */
1896
- class ToolBarButtonGroupComponent extends ToolBarToolComponent {
1897
- constructor(localization) {
1898
- super();
1899
- this.localization = localization;
1900
- /**
1901
- * By default, the selection mode of the ButtonGroup is set to `multiple`.
1902
- */
1903
- this.selection = 'multiple';
1904
- this.focusedIndex = -1;
1905
- this.getNextKey = getNextKey(this.localization.rtl);
1906
- this.getPrevKey = getPrevKey(this.localization.rtl);
1907
- this.isBuiltInTool = true;
1908
- }
1909
- /**
1910
- * @hidden
1911
- */
1912
- set look(look) {
1913
- if (look) {
1914
- this.buttonComponents.forEach(b => b.fillMode = look === 'default' ? 'solid' : look);
1915
- }
1916
- }
1917
- get buttonElements() {
1918
- if (this.overflows) {
1919
- return [...this.overflowListItems.toArray().filter(el => !el.nativeElement.classList.contains('k-disabled'))].map(el => el.nativeElement);
1920
- }
1921
- else {
1922
- return this.toolbarButtonGroup
1923
- .buttons.filter(b => !b.isDisabled)
1924
- .map(b => b.element);
1925
- }
1926
- }
1927
- /**
1928
- * @hidden
1929
- */
1930
- onFocus() {
1931
- // triggered on tabin
1932
- this.focusedIndex = 0;
1933
- }
1934
- /**
1935
- * @hidden
1936
- */
1937
- onNavigate(ev) {
1938
- ev.preventDefault();
1939
- }
1940
- /**
1941
- * @hidden
1942
- */
1943
- selectedChangeHandler(state, button) {
1944
- button.selected = state;
1945
- button.selectedChange.emit(state);
1946
- }
1947
- /**
1948
- * @hidden
1949
- */
1950
- overflowSelectedChangeHandler(button) {
1951
- if (this.selection === 'multiple') {
1952
- button.selected = !button.selected;
1953
- }
1954
- else {
1955
- const filteredButtons = this.buttonComponents.filter(b => b !== button);
1956
- filteredButtons.forEach(b => b.selected = false);
1957
- button.selected = !button.selected;
1958
- }
1959
- button.selectedChange.emit(button.selected);
1960
- }
1961
- /**
1962
- * @hidden
1963
- */
1964
- onButtonClick(ev) {
1965
- this.focusedIndex = this.buttonElements.findIndex(be => be === ev.target || be.contains(ev.target));
1966
- this.focusButton(this.focusedIndex, ev);
1967
- }
1968
- /**
1969
- * @hidden
1970
- */
1971
- canFocus() {
1972
- return !(this.disabled || this.buttonElements.length === 0);
1973
- }
1974
- /**
1975
- * @hidden
1976
- */
1977
- focus(ev = {}) {
1978
- const nextKey = this.getNextKey(this.overflows);
1979
- const prevKey = this.getPrevKey(this.overflows);
1980
- this.focusedIndex = getIndexOfFocused(prevKey, nextKey, this.buttonElements)(ev);
1981
- this.focusButton(this.focusedIndex, ev);
1982
- }
1983
- /**
1984
- * @hidden
1985
- */
1986
- handleKey(ev) {
1987
- const nextKey = this.getNextKey(this.overflows);
1988
- const prevKey = this.getPrevKey(this.overflows);
1989
- const peekAtIndex = makePeeker(this.buttonElements);
1990
- const isUnmodified = areEqual(this.focusedIndex);
1991
- this.focusedIndex = seekFocusedIndex(prevKey, nextKey, peekAtIndex)(this.focusedIndex, ev);
1992
- this.focusButton(this.focusedIndex, ev);
1993
- return !isUnmodified(this.focusedIndex);
1994
- }
1995
- /**
1996
- * @hidden
1997
- */
1998
- handleClick(ev, button) {
1999
- button.click.emit(ev);
2000
- this.onButtonClick(ev);
2001
- this.overflowSelectedChangeHandler(button);
2002
- }
2003
- /**
2004
- * @hidden
2005
- */
2006
- getIconClasses(button) {
2007
- if (button.overflowOptions.icon) {
2008
- return `${button.overflowOptions.icon}`;
2009
- }
2010
- if (button.overflowOptions.iconClass) {
2011
- return button.overflowOptions.iconClass;
2012
- }
2013
- if (button.overflowOptions.svgIcon) {
2014
- return button.overflowOptions.svgIcon;
2015
- }
2016
- }
2017
- focusButton(index, ev) {
2018
- var _a;
2019
- // Guard against focusing twice on mousedown.
2020
- if (!ev.type || ev.type === 'focus' || ev.type === 'keydown') {
2021
- (_a = this.buttonElements[index]) === null || _a === void 0 ? void 0 : _a.focus();
2022
- }
2023
- }
2024
- }
2025
- ToolBarButtonGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarButtonGroupComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2026
- ToolBarButtonGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarButtonGroupComponent, isStandalone: true, selector: "kendo-toolbar-buttongroup", inputs: { disabled: "disabled", selection: "selection", width: "width", look: "look" }, providers: [LocalizationService, { provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarButtonGroupComponent) }], queries: [{ propertyName: "buttonComponents", predicate: i0.forwardRef(function () { return ToolBarButtonComponent; }) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "toolbarButtonGroup", first: true, predicate: ["toolbarButtonGroup"], descendants: true }, { propertyName: "overflowListItems", predicate: ["listItem"], descendants: true }], exportAs: ["kendoToolBarButtonGroup"], usesInheritance: true, ngImport: i0, template: `
2027
- <ng-template #toolbarTemplate>
2028
- <kendo-buttongroup
2029
- class="k-toolbar-button-group"
2030
- #toolbarButtonGroup
2031
- [tabIndex]="-1"
2032
- [selection]="selection"
2033
- [disabled]="disabled"
2034
- [width]="width"
2035
- (navigate)="onNavigate($event)"
2036
- (focus)="onFocus()"
2037
- >
2038
- <button
2039
- kendoButton
2040
- type="button"
2041
- *ngFor="let button of buttonComponents"
2042
- [ngStyle]="button.style"
2043
- [ngClass]="button.className"
2044
- [attr.title]="button.title"
2045
- [disabled]="button.disabled"
2046
- [togglable]="button.togglable"
2047
- [selected]="button.selected"
2048
- [attr.aria-pressed]="button.selected ? true : false"
2049
- [fillMode]="button.fillMode"
2050
- [themeColor]="button.fillMode ? button.themeColor : null"
2051
- [icon]="button.toolbarOptions.icon"
2052
- [iconClass]="button.toolbarOptions.iconClass"
2053
- [svgIcon]="button.toolbarOptions.svgIcon"
2054
- [imageUrl]="button.toolbarOptions.imageUrl"
2055
- (click)="button.click.emit($event); onButtonClick($event)"
2056
- (pointerdown)="button.pointerdown.emit($event)"
2057
- (selectedChange)="selectedChangeHandler($event, button)"
2058
- >
2059
- {{ button.toolbarOptions.text }}
2060
- </button>
2061
- </kendo-buttongroup>
2062
- </ng-template>
2063
- <ng-template #popupTemplate>
2064
- <div
2065
- *ngFor="let button of buttonComponents"
2066
- #listItem
2067
- tabindex="-1"
2068
- role="menuitem"
2069
- class="k-item k-menu-item"
2070
- [class.k-disabled]="disabled || button.disabled"
2071
- [ngStyle]="button.style"
2072
- [ngClass]="button.className"
2073
- (click)="handleClick($event, button)">
2074
- <span
2075
- class="k-link k-menu-link"
2076
- [class.k-selected]="button.selected"
2077
- >
2078
- <kendo-icon-wrapper
2079
- *ngIf="button.overflowOptions.icon || button.overflowOptions.iconClass || button.overflowOptions.svgIcon"
2080
- [name]="button.overflowOptions.icon"
2081
- [customFontClass]="button.overflowOptions.iconClass"
2082
- [svgIcon]="button.overflowOptions.svgIcon"
2083
- ></kendo-icon-wrapper>
2084
- <span *ngIf="button.overflowOptions.text" class="k-menu-link-text">{{button.overflowOptions.text}}</span>
2085
- </span>
2086
- </div>
2087
- </ng-template>
2088
- `, isInline: true, dependencies: [{ kind: "component", type: ButtonGroupComponent, selector: "kendo-buttongroup", inputs: ["disabled", "selection", "width", "tabIndex", "navigable"], outputs: ["navigate"], exportAs: ["kendoButtonGroup"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] });
2089
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarButtonGroupComponent, decorators: [{
2090
- type: Component,
2091
- args: [{
2092
- exportAs: 'kendoToolBarButtonGroup',
2093
- providers: [LocalizationService, { provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarButtonGroupComponent) }],
2094
- selector: 'kendo-toolbar-buttongroup',
2095
- template: `
2096
- <ng-template #toolbarTemplate>
2097
- <kendo-buttongroup
2098
- class="k-toolbar-button-group"
2099
- #toolbarButtonGroup
2100
- [tabIndex]="-1"
2101
- [selection]="selection"
2102
- [disabled]="disabled"
2103
- [width]="width"
2104
- (navigate)="onNavigate($event)"
2105
- (focus)="onFocus()"
2106
- >
2107
- <button
2108
- kendoButton
2109
- type="button"
2110
- *ngFor="let button of buttonComponents"
2111
- [ngStyle]="button.style"
2112
- [ngClass]="button.className"
2113
- [attr.title]="button.title"
2114
- [disabled]="button.disabled"
2115
- [togglable]="button.togglable"
2116
- [selected]="button.selected"
2117
- [attr.aria-pressed]="button.selected ? true : false"
2118
- [fillMode]="button.fillMode"
2119
- [themeColor]="button.fillMode ? button.themeColor : null"
2120
- [icon]="button.toolbarOptions.icon"
2121
- [iconClass]="button.toolbarOptions.iconClass"
2122
- [svgIcon]="button.toolbarOptions.svgIcon"
2123
- [imageUrl]="button.toolbarOptions.imageUrl"
2124
- (click)="button.click.emit($event); onButtonClick($event)"
2125
- (pointerdown)="button.pointerdown.emit($event)"
2126
- (selectedChange)="selectedChangeHandler($event, button)"
2127
- >
2128
- {{ button.toolbarOptions.text }}
2129
- </button>
2130
- </kendo-buttongroup>
2131
- </ng-template>
2132
- <ng-template #popupTemplate>
2133
- <div
2134
- *ngFor="let button of buttonComponents"
2135
- #listItem
2136
- tabindex="-1"
2137
- role="menuitem"
2138
- class="k-item k-menu-item"
2139
- [class.k-disabled]="disabled || button.disabled"
2140
- [ngStyle]="button.style"
2141
- [ngClass]="button.className"
2142
- (click)="handleClick($event, button)">
2143
- <span
2144
- class="k-link k-menu-link"
2145
- [class.k-selected]="button.selected"
2146
- >
2147
- <kendo-icon-wrapper
2148
- *ngIf="button.overflowOptions.icon || button.overflowOptions.iconClass || button.overflowOptions.svgIcon"
2149
- [name]="button.overflowOptions.icon"
2150
- [customFontClass]="button.overflowOptions.iconClass"
2151
- [svgIcon]="button.overflowOptions.svgIcon"
2152
- ></kendo-icon-wrapper>
2153
- <span *ngIf="button.overflowOptions.text" class="k-menu-link-text">{{button.overflowOptions.text}}</span>
2154
- </span>
2155
- </div>
2156
- </ng-template>
2157
- `,
2158
- standalone: true,
2159
- imports: [ButtonGroupComponent, NgFor, ButtonComponent, NgStyle, NgClass, NgIf, IconWrapperComponent]
2160
- }]
2161
- }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { disabled: [{
2162
- type: Input
2163
- }], selection: [{
2164
- type: Input
2165
- }], width: [{
2166
- type: Input
2167
- }], look: [{
2168
- type: Input
2169
- }], toolbarTemplate: [{
2170
- type: ViewChild,
2171
- args: ['toolbarTemplate', { static: true }]
2172
- }], popupTemplate: [{
2173
- type: ViewChild,
2174
- args: ['popupTemplate', { static: true }]
2175
- }], toolbarButtonGroup: [{
2176
- type: ViewChild,
2177
- args: ['toolbarButtonGroup', { static: false }]
2178
- }], overflowListItems: [{
2179
- type: ViewChildren,
2180
- args: ['listItem']
2181
- }], buttonComponents: [{
2182
- type: ContentChildren,
2183
- args: [forwardRef(() => ToolBarButtonComponent)]
2184
- }] } });
2185
-
2186
- /**
2187
- * Represents the [Kendo UI ToolBar DropDownButton for Angular]({% slug controltypes_toolbar %}#toc-dropdownbuttons).
2188
- */
2189
- class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
2190
- constructor() {
2191
- super();
2192
- /**
2193
- * Allows showing the default arrow icon or providing alternative one instead.
2194
- * @default false
2195
- */
2196
- this.arrowIcon = false;
2197
- /**
2198
- * Sets the `title` attribute of the underlying button element.
2199
- * @default ''
2200
- */
2201
- this.title = '';
2202
- /**
2203
- * Defines the location of the button icon that will be displayed.
2204
- */
2205
- this.showIcon = 'both';
2206
- /**
2207
- * The fillMode property specifies the background and border styles of the Button.
2208
- *
2209
- * The available values are:
2210
- * * `solid` (default)
2211
- * * `flat`
2212
- * * `outline`
2213
- * * `link`
2214
- * * `null`
2215
- */
2216
- this.fillMode = 'solid';
2217
- /**
2218
- * The Button allows you to specify predefined theme colors.
2219
- * The theme color will be applied as a background and border color while also amending the text color accordingly
2220
- * ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-themeColor)).
2221
- *
2222
- * The possible values are:
2223
- * * `base` &mdash;Applies coloring based on the `base` theme color. (default)
2224
- * * `primary` &mdash;Applies coloring based on the `primary` theme color.
2225
- * * `secondary`&mdash;Applies coloring based on the `secondary` theme color.
2226
- * * `tertiary`&mdash; Applies coloring based on the `tertiary` theme color.
2227
- * * `info`&mdash;Applies coloring based on the `info` theme color.
2228
- * * `success`&mdash; Applies coloring based on the `success` theme color.
2229
- * * `warning`&mdash; Applies coloring based on the `warning` theme color.
2230
- * * `error`&mdash; Applies coloring based on the `error` theme color.
2231
- * * `dark`&mdash; Applies coloring based on the `dark` theme color.
2232
- * * `light`&mdash; Applies coloring based on the `light` theme color.
2233
- * * `inverse`&mdash; Applies coloring based on the `inverse` theme color.
2234
- * * `null` &mdash;Removes the default CSS class (no class would be rendered).
2235
- */
2236
- this.themeColor = 'base';
2237
- /**
2238
- * Fires each time the user clicks a DropDownButton item.
2239
- * The event data contains the data item that is bound to the clicked list item.
2240
- */
2241
- this.itemClick = new EventEmitter();
2242
- /**
2243
- * Fires each time the popup is about to open.
2244
- * This event is preventable. If you cancel the event, the popup will remain closed.
2245
- */
2246
- this.open = new EventEmitter();
2247
- /**
2248
- * Fires each time the popup is about to close.
2249
- * This event is preventable. If you cancel the event, the popup will remain open.
2250
- */
2251
- this.close = new EventEmitter();
2252
- this.toolbarOptions = {
2253
- text: '',
2254
- icon: '',
2255
- iconClass: '',
2256
- svgIcon: null,
2257
- imageUrl: ''
2258
- };
2259
- this.overflowOptions = {
2260
- text: '',
2261
- icon: '',
2262
- iconClass: '',
2263
- svgIcon: null,
2264
- imageUrl: ''
2265
- };
2266
- this._popupSettings = { animate: true, popupClass: '' };
2267
- this.focusedIndex = -1;
2268
- this._showText = 'both';
2269
- this.getNextKey = getNextKey();
2270
- this.getPrevKey = getPrevKey();
2271
- this.isBuiltInTool = true;
2272
- }
2273
- // showText and showIcon showIcon should be declared first
2274
- /**
2275
- * Defines the location of the button text that will be displayed.
2276
- */
2277
- set showText(value) {
2278
- this._showText = value;
2279
- this.setTextDisplayMode();
2280
- }
2281
- get showText() {
2282
- return this._showText;
2283
- }
2284
- /**
2285
- * Sets the text of the DropDownButton
2286
- * ([see example](slug:controltypes_toolbar#toc-drop-down-buttons).
2287
- */
2288
- set text(text) {
2289
- this._text = text;
2290
- this.setTextDisplayMode();
2291
- }
2292
- get text() {
2293
- return this._text;
2294
- }
2295
- /**
2296
- * Defines an icon that will be rendered next to the button text.
2297
- */
2298
- set icon(icon) {
2299
- this.toolbarOptions.icon = getValueForLocation(icon, this.showIcon, false);
2300
- this.overflowOptions.icon = getValueForLocation(icon, this.showIcon, true);
2301
- }
2302
- /**
2303
- * Defines an SVGIcon to be rendered within the button.
2304
- * The input can take either an [existing Kendo SVG icon](slug:svgicon_list) or a custom one.
2305
- */
2306
- set svgIcon(icon) {
2307
- const isIconSet = this.toolbarOptions.icon || this.overflowOptions.icon;
2308
- const isIconClassSet = this.toolbarOptions.iconClass || this.overflowOptions.iconClass;
2309
- if (isDevMode() &&
2310
- icon &&
2311
- isIconSet &&
2312
- isIconClassSet) {
2313
- throw new Error('Setting both icon/svgIcon and iconClass options at the same time is not supported.');
2314
- }
2315
- this.toolbarOptions.svgIcon = getValueForLocation(icon, this.showIcon, false);
2316
- this.overflowOptions.svgIcon = getValueForLocation(icon, this.showIcon, true);
2317
- }
2318
- /**
2319
- * Defines an icon with a custom CSS class that will be rendered next to the button text.
2320
- */
2321
- set iconClass(iconClass) {
2322
- this.toolbarOptions.iconClass = getValueForLocation(iconClass, this.showIcon, false);
2323
- this.overflowOptions.iconClass = getValueForLocation(iconClass, this.showIcon, true);
2324
- }
2325
- /**
2326
- * Defines the location of an image that will be displayed next to the button text.
2327
- */
2328
- set imageUrl(imageUrl) {
2329
- this.toolbarOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, false);
2330
- this.overflowOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, true);
2331
- }
2332
- /**
2333
- * Configures the popup of the DropDownButton.
2334
- *
2335
- * The available options are:
2336
- * - `animate:Boolean`&mdash;Controls the popup animation. By default, the open and close animations are enabled.
2337
- * - `popupClass:String`&mdash;Specifies a list of CSS classes that are used to style the popup.
2338
- */
2339
- set popupSettings(settings) {
2340
- this._popupSettings = Object.assign({ animate: true, popupClass: '' }, settings);
2341
- }
2342
- get popupSettings() {
2343
- return this._popupSettings;
2344
- }
2345
- /**
2346
- * @hidden
2347
- */
2348
- set look(look) {
2349
- if (look) {
2350
- this.fillMode = look === 'default' ? 'solid' : look;
2351
- }
2352
- }
2353
- /**
2354
- * @hidden
2355
- */
2356
- set primary(primary) {
2357
- this.themeColor = primary ? 'primary' : 'base';
2358
- }
2359
- /**
2360
- * Sets the data of the DropDownButton
2361
- * ([see example]({% slug controltypes_toolbar %}#toc-dropdownbuttons)).
2362
- *
2363
- * > The data has to be provided in an array-like list.
2364
- */
2365
- set data(data) {
2366
- this._data = data || [];
2367
- }
2368
- get data() {
2369
- if (!this._data) {
2370
- this.data = [];
2371
- }
2372
- return this._data;
2373
- }
2374
- ngOnInit() {
2375
- this.setTextDisplayMode();
2376
- }
2377
- get overflowButtons() {
2378
- return [...this.overflowListItems.toArray().filter(el => !el.nativeElement.classList.contains('k-disabled'))];
2379
- }
2380
- /**
2381
- * @hidden
2382
- */
2383
- onButtonListClick(ev) {
2384
- this.focusedIndex = this.overflowListItems
2385
- .toArray()
2386
- .findIndex(b => b.nativeElement.contains(ev.target));
2387
- }
2388
- /**
2389
- * @hidden
2390
- */
2391
- canFocus() {
2392
- return !this.disabled;
2393
- }
2394
- /**
2395
- * @hidden
2396
- */
2397
- focus(ev = {}) {
2398
- if (!this.overflows) {
2399
- if (ev.type === 'focus' || ev.type === 'keydown') {
2400
- this.toolbarDropDownButton.focus();
2401
- }
2402
- }
2403
- else if (this.overflowButtons.length > 0) {
2404
- this.focusedIndex = getIndexOfFocused(this.getPrevKey(), this.getNextKey(), this.overflowButtons.map(ob => ob.nativeElement))(ev);
2405
- this.focusButton(this.focusedIndex, ev);
2406
- }
2407
- }
2408
- /**
2409
- * @hidden
2410
- */
2411
- handleKey(ev) {
2412
- if (!this.overflows && (ev.keyCode === this.getPrevKey(this.overflows) || ev.keyCode === this.getNextKey(this.overflows))) {
2413
- return false;
2414
- }
2415
- if (this.overflows) {
2416
- const peekAtIndex = makePeeker(this.overflowButtons);
2417
- const isUnmodified = areEqual(this.focusedIndex);
2418
- this.focusedIndex = seekFocusedIndex(this.getPrevKey(), this.getNextKey(), peekAtIndex)(this.focusedIndex, ev);
2419
- this.focusButton(this.focusedIndex, ev);
2420
- return !isUnmodified(this.focusedIndex);
2421
- }
2422
- }
2423
- /**
2424
- * @hidden
2425
- */
2426
- getText(dataItem) {
2427
- if (dataItem) {
2428
- return this.textField ? dataItem[this.textField] : dataItem.text || dataItem;
2429
- }
2430
- return undefined;
2431
- }
2432
- /**
2433
- * @hidden
2434
- */
2435
- handleClick(ev, item, index) {
2436
- this.onButtonListClick(ev);
2437
- const dataItem = this.data[index];
2438
- if (item.click) {
2439
- item.click(dataItem);
2440
- }
2441
- this.itemClick.emit(dataItem);
2442
- }
2443
- focusButton(index, ev) {
2444
- if (!ev.type || ev.type === 'focus' || ev.type === 'keydown') {
2445
- this.overflowButtons[index].nativeElement.focus();
2446
- }
2447
- }
2448
- setTextDisplayMode() {
2449
- this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
2450
- this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
2451
- }
2452
- }
2453
- ToolBarDropDownButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarDropDownButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2454
- ToolBarDropDownButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarDropDownButtonComponent, isStandalone: true, selector: "kendo-toolbar-dropdownbutton", inputs: { arrowIcon: "arrowIcon", title: "title", showText: "showText", showIcon: "showIcon", text: "text", icon: "icon", svgIcon: "svgIcon", iconClass: "iconClass", imageUrl: "imageUrl", popupSettings: "popupSettings", look: "look", primary: "primary", fillMode: "fillMode", themeColor: "themeColor", buttonClass: "buttonClass", textField: "textField", disabled: "disabled", data: "data" }, outputs: { itemClick: "itemClick", open: "open", close: "close" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarDropDownButtonComponent) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "dropdownButton", first: true, predicate: ["dropdownButton"], descendants: true, read: ElementRef, static: true }, { propertyName: "dropDownButtonComponent", first: true, predicate: DropDownButtonComponent, descendants: true }, { propertyName: "toolbarDropDownButton", first: true, predicate: ["toolbarDropDownButton"], descendants: true }, { propertyName: "overflowListItems", predicate: ["listItem"], descendants: true }], exportAs: ["kendoToolBarDropDownButton"], usesInheritance: true, ngImport: i0, template: `
2455
- <ng-template #toolbarTemplate>
2456
- <kendo-dropdownbutton
2457
- #toolbarDropDownButton
2458
- class="k-toolbar-menu-button"
2459
- [icon]="toolbarOptions.icon"
2460
- [iconClass]="toolbarOptions.iconClass"
2461
- [svgIcon]="toolbarOptions.svgIcon"
2462
- [imageUrl]="toolbarOptions.imageUrl"
2463
- [arrowIcon]="arrowIcon"
2464
- [buttonClass]="buttonClass"
2465
- [disabled]="disabled"
2466
- [tabIndex]="-1"
2467
- [data]="data"
2468
- [buttonAttributes]="{'title': title}"
2469
- [textField]="textField"
2470
- [popupSettings]="popupSettings"
2471
- [fillMode]="fillMode"
2472
- [themeColor]="fillMode ? themeColor : null"
2473
- (open)="open.emit($event)"
2474
- (close)="close.emit($event)"
2475
- (itemClick)="itemClick.emit($event)"
2476
- >
2477
- {{ toolbarOptions.text }}
2478
- </kendo-dropdownbutton>
2479
- </ng-template>
2480
- <ng-template #popupTemplate>
2481
- <div
2482
- tabindex="-1"
2483
- role="menuitem"
2484
- class="k-item k-menu-item k-disabled"
2485
- [ngClass]="buttonClass">
2486
- <span
2487
- [ngClass]="{'k-link': true, 'k-menu-link': true}"
2488
- >
2489
- <kendo-icon-wrapper
2490
- *ngIf="overflowOptions.icon || overflowOptions.iconClass || overflowOptions.svgIcon"
2491
- [name]="overflowOptions.icon"
2492
- [customFontClass]="overflowOptions.iconClass"
2493
- [svgIcon]="overflowOptions.svgIcon"
2494
- ></kendo-icon-wrapper>
2495
- <span *ngIf="overflowOptions.text" class="k-menu-link-text">{{overflowOptions.text}}</span>
2496
- </span>
2497
- </div>
2498
- <ng-container *ngFor="let item of data; let i = index">
2499
- <div #listItem
2500
- tabindex="-1"
2501
- role="menuitem"
2502
- class="k-item k-menu-item"
2503
- [class.k-disabled]="disabled || item.disabled"
2504
- (click)="handleClick($event, item, i)">
2505
- <span
2506
- class="k-link k-menu-link"
2507
- [ngClass]="item.cssClass"
2508
- >
2509
- <kendo-icon-wrapper
2510
- *ngIf="item.icon || item.iconClass || item.svgIcon"
2511
- [name]="item.icon"
2512
- [customFontClass]="item.iconClass"
2513
- [svgIcon]="item.svgIcon"
2514
- ></kendo-icon-wrapper>
2515
- <span *ngIf="getText(item)" class="k-menu-link-text">{{ getText(item) }}</span>
2516
- </span>
2517
- </div>
2518
- </ng-container>
2519
- </ng-template>
2520
- `, isInline: true, dependencies: [{ kind: "component", type: DropDownButtonComponent, selector: "kendo-dropdownbutton", inputs: ["arrowIcon", "icon", "svgIcon", "iconClass", "imageUrl", "textField", "data", "size", "rounded", "fillMode", "themeColor", "buttonAttributes"], outputs: ["itemClick", "focus", "blur"], exportAs: ["kendoDropDownButton"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
2521
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarDropDownButtonComponent, decorators: [{
2522
- type: Component,
2523
- args: [{
2524
- exportAs: 'kendoToolBarDropDownButton',
2525
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarDropDownButtonComponent) }],
2526
- selector: 'kendo-toolbar-dropdownbutton',
2527
- template: `
2528
- <ng-template #toolbarTemplate>
2529
- <kendo-dropdownbutton
2530
- #toolbarDropDownButton
2531
- class="k-toolbar-menu-button"
2532
- [icon]="toolbarOptions.icon"
2533
- [iconClass]="toolbarOptions.iconClass"
2534
- [svgIcon]="toolbarOptions.svgIcon"
2535
- [imageUrl]="toolbarOptions.imageUrl"
2536
- [arrowIcon]="arrowIcon"
2537
- [buttonClass]="buttonClass"
2538
- [disabled]="disabled"
2539
- [tabIndex]="-1"
2540
- [data]="data"
2541
- [buttonAttributes]="{'title': title}"
2542
- [textField]="textField"
2543
- [popupSettings]="popupSettings"
2544
- [fillMode]="fillMode"
2545
- [themeColor]="fillMode ? themeColor : null"
2546
- (open)="open.emit($event)"
2547
- (close)="close.emit($event)"
2548
- (itemClick)="itemClick.emit($event)"
2549
- >
2550
- {{ toolbarOptions.text }}
2551
- </kendo-dropdownbutton>
2552
- </ng-template>
2553
- <ng-template #popupTemplate>
2554
- <div
2555
- tabindex="-1"
2556
- role="menuitem"
2557
- class="k-item k-menu-item k-disabled"
2558
- [ngClass]="buttonClass">
2559
- <span
2560
- [ngClass]="{'k-link': true, 'k-menu-link': true}"
2561
- >
2562
- <kendo-icon-wrapper
2563
- *ngIf="overflowOptions.icon || overflowOptions.iconClass || overflowOptions.svgIcon"
2564
- [name]="overflowOptions.icon"
2565
- [customFontClass]="overflowOptions.iconClass"
2566
- [svgIcon]="overflowOptions.svgIcon"
2567
- ></kendo-icon-wrapper>
2568
- <span *ngIf="overflowOptions.text" class="k-menu-link-text">{{overflowOptions.text}}</span>
2569
- </span>
2570
- </div>
2571
- <ng-container *ngFor="let item of data; let i = index">
2572
- <div #listItem
2573
- tabindex="-1"
2574
- role="menuitem"
2575
- class="k-item k-menu-item"
2576
- [class.k-disabled]="disabled || item.disabled"
2577
- (click)="handleClick($event, item, i)">
2578
- <span
2579
- class="k-link k-menu-link"
2580
- [ngClass]="item.cssClass"
2581
- >
2582
- <kendo-icon-wrapper
2583
- *ngIf="item.icon || item.iconClass || item.svgIcon"
2584
- [name]="item.icon"
2585
- [customFontClass]="item.iconClass"
2586
- [svgIcon]="item.svgIcon"
2587
- ></kendo-icon-wrapper>
2588
- <span *ngIf="getText(item)" class="k-menu-link-text">{{ getText(item) }}</span>
2589
- </span>
2590
- </div>
2591
- </ng-container>
2592
- </ng-template>
2593
- `,
2594
- standalone: true,
2595
- imports: [DropDownButtonComponent, NgClass, NgIf, IconWrapperComponent, NgFor]
2596
- }]
2597
- }], ctorParameters: function () { return []; }, propDecorators: { arrowIcon: [{
2598
- type: Input
2599
- }], title: [{
2600
- type: Input
2601
- }], showText: [{
2602
- type: Input
2603
- }], showIcon: [{
2604
- type: Input
2605
- }], text: [{
2606
- type: Input
2607
- }], icon: [{
2608
- type: Input
2609
- }], svgIcon: [{
2610
- type: Input
2611
- }], iconClass: [{
2612
- type: Input
2613
- }], imageUrl: [{
2614
- type: Input
2615
- }], popupSettings: [{
2616
- type: Input
2617
- }], look: [{
2618
- type: Input
2619
- }], primary: [{
2620
- type: Input
2621
- }], fillMode: [{
2622
- type: Input
2623
- }], themeColor: [{
2624
- type: Input
2625
- }], buttonClass: [{
2626
- type: Input
2627
- }], textField: [{
2628
- type: Input
2629
- }], disabled: [{
2630
- type: Input
2631
- }], data: [{
2632
- type: Input
2633
- }], itemClick: [{
2634
- type: Output
2635
- }], open: [{
2636
- type: Output
2637
- }], close: [{
2638
- type: Output
2639
- }], toolbarTemplate: [{
2640
- type: ViewChild,
2641
- args: ['toolbarTemplate', { static: true }]
2642
- }], popupTemplate: [{
2643
- type: ViewChild,
2644
- args: ['popupTemplate', { static: true }]
2645
- }], dropdownButton: [{
2646
- type: ViewChild,
2647
- args: ['dropdownButton', { read: ElementRef, static: true }]
2648
- }], dropDownButtonComponent: [{
2649
- type: ViewChild,
2650
- args: [DropDownButtonComponent, { static: false }]
2651
- }], overflowListItems: [{
2652
- type: ViewChildren,
2653
- args: ['listItem']
2654
- }], toolbarDropDownButton: [{
2655
- type: ViewChild,
2656
- args: ['toolbarDropDownButton', { static: false }]
2657
- }] } });
2658
-
2659
- /**
2660
- * Represents the [Kendo UI ToolBar SplitButton for Angular]({% slug controltypes_toolbar %}#toc-splitbuttons).
2661
- */
2662
- class ToolBarSplitButtonComponent extends ToolBarToolComponent {
2663
- constructor() {
2664
- super();
2665
- /**
2666
- * Specifies where button icon should be displayed
2667
- */
2668
- this.showIcon = 'both';
2669
- /**
2670
- * The fillMode property specifies the background and border styles of the Button.
2671
- *
2672
- * The available values are:
2673
- * * `solid` (default)
2674
- * * `flat`
2675
- * * `outline`
2676
- * * `link`
2677
- * * `null`
2678
- */
2679
- this.fillMode = 'solid';
2680
- /**
2681
- * The Button allows you to specify predefined theme colors.
2682
- * The theme color will be applied as a background and border color while also amending the text color accordingly.
2683
- *
2684
- * The possible values are:
2685
- * * `base` &mdash;Applies coloring based on the `base` theme color. (default)
2686
- * * `primary` &mdash;Applies coloring based on the `primary` theme color.
2687
- * * `secondary`&mdash;Applies coloring based on the `secondary` theme color.
2688
- * * `tertiary`&mdash; Applies coloring based on the `tertiary` theme color.
2689
- * * `info`&mdash;Applies coloring based on the `info` theme color.
2690
- * * `success`&mdash; Applies coloring based on the `success` theme color.
2691
- * * `warning`&mdash; Applies coloring based on the `warning` theme color.
2692
- * * `error`&mdash; Applies coloring based on the `error` theme color.
2693
- * * `dark`&mdash; Applies coloring based on the `dark` theme color.
2694
- * * `light`&mdash; Applies coloring based on the `light` theme color.
2695
- * * `inverse`&mdash; Applies coloring based on the `inverse` theme color.
2696
- * * `null` &mdash;Removes the default CSS class (no class would be rendered).
2697
- */
2698
- this.themeColor = 'base';
2699
- /**
2700
- * Specifies the name of the [font icon]({% slug icons %}#toc-list-of-font-icons) that will
2701
- * be rendered for the button which opens the popup.
2702
- */
2703
- this.arrowButtonIcon = 'caret-alt-down';
2704
- /**
2705
- * Specifies the [`SVGIcon`](slug:api_icons_svgicon) that will
2706
- * be rendered for the button which opens the popup.
2707
- */
2708
- this.arrowButtonSvgIcon = caretAltDownIcon;
2709
- /**
2710
- * Configures the text field of the button-list popup.
2711
- */
2712
- this.textField = 'text';
2713
- /**
2714
- * Fires each time the user clicks the main button.
2715
- */
2716
- this.buttonClick = new EventEmitter();
2717
- /**
2718
- * Fires each time the user clicks the drop-down list.
2719
- * The event data contains the data item that is bound to the clicked list item.
2720
- */
2721
- this.itemClick = new EventEmitter();
2722
- /**
2723
- * Fires each time the popup is about to open.
2724
- * This event is preventable. If you cancel the event, the popup will remain closed.
2725
- */
2726
- this.open = new EventEmitter();
2727
- /**
2728
- * Fires each time the popup is about to close.
2729
- * This event is preventable. If you cancel the event, the popup will remain open.
2730
- */
2731
- this.close = new EventEmitter();
2732
- this.toolbarOptions = {
2733
- text: '',
2734
- icon: '',
2735
- iconClass: '',
2736
- svgIcon: null,
2737
- imageUrl: ''
2738
- };
2739
- this.overflowOptions = {
2740
- text: '',
2741
- icon: '',
2742
- iconClass: '',
2743
- svgIcon: null,
2744
- imageUrl: ''
2745
- };
2746
- this._popupSettings = { animate: true, popupClass: '' };
2747
- this.focusedIndex = -1;
2748
- this._showText = 'both';
2749
- this.getNextKey = getNextKey();
2750
- this.getPrevKey = getPrevKey();
2751
- this.isBuiltInTool = true;
2752
- }
2753
- // showText and showIcon showIcon should be declared first
2754
- /**
2755
- * Specifies where button text should be displayed
2756
- */
2757
- set showText(value) {
2758
- this._showText = value;
2759
- this.setTextDisplayMode();
2760
- }
2761
- get showText() {
2762
- return this._showText;
2763
- }
2764
- /**
2765
- * Sets the text of the SplitButton ([see example](slug:controltypes_toolbar#toc-split-buttons).
2766
- */
2767
- set text(text) {
2768
- this._text = text;
2769
- this.setTextDisplayMode();
2770
- }
2771
- get text() {
2772
- return this._text;
2773
- }
2774
- /**
2775
- * Defines the icon that will be rendered next to the button text
2776
- * ([see example](slug:controltypes_toolbar#toc-split-buttons)).
2777
- */
2778
- set icon(icon) {
2779
- this.toolbarOptions.icon = getValueForLocation(icon, this.showIcon, false);
2780
- this.overflowOptions.icon = getValueForLocation(icon, this.showIcon, true);
2781
- }
2782
- /**
2783
- * Defines an SVGIcon to be rendered within the main button.
2784
- * The input can take either an [existing Kendo SVG icon](slug:svgicon_list) or a custom one.
2785
- */
2786
- set svgIcon(icon) {
2787
- const isIconSet = this.toolbarOptions.icon || this.overflowOptions.icon;
2788
- const isIconClassSet = this.toolbarOptions.iconClass || this.overflowOptions.iconClass;
2789
- if (isDevMode() &&
2790
- icon &&
2791
- isIconSet &&
2792
- isIconClassSet) {
2793
- throw new Error('Setting both icon/svgIcon and iconClass options at the same time is not supported.');
2794
- }
2795
- this.toolbarOptions.svgIcon = getValueForLocation(icon, this.showIcon, false);
2796
- this.overflowOptions.svgIcon = getValueForLocation(icon, this.showIcon, true);
2797
- }
2798
- /**
2799
- * Defines an icon with a custom CSS class that will be rendered next to the button text.
2800
- */
2801
- set iconClass(iconClass) {
2802
- this.toolbarOptions.iconClass = getValueForLocation(iconClass, this.showIcon, false);
2803
- this.overflowOptions.iconClass = getValueForLocation(iconClass, this.showIcon, true);
2804
- }
2805
- /**
2806
- * Defines the location of an image that will be displayed next to the button text.
2807
- */
2808
- set imageUrl(imageUrl) {
2809
- this.toolbarOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, false);
2810
- this.overflowOptions.imageUrl = getValueForLocation(imageUrl, this.showIcon, true);
2811
- }
2812
- /**
2813
- * Configures the popup of the SplitButton.
2814
- *
2815
- * The available options are:
2816
- * - `animate:Boolean`&mdash;Controls the popup animation. By default, the open and close animations are enabled.
2817
- * - `popupClass:String`&mdash;Specifies a list of CSS classes that are used to style the popup.
2818
- */
2819
- set popupSettings(value) {
2820
- this._popupSettings = value;
2821
- }
2822
- get popupSettings() {
2823
- if (!this._popupSettings) {
2824
- this._popupSettings = { animate: true, popupClass: '' };
2825
- }
2826
- return this._popupSettings;
2827
- }
2828
- /**
2829
- * @hidden
2830
- */
2831
- set look(look) {
2832
- if (look) {
2833
- this.fillMode = look === 'default' ? 'solid' : look;
2834
- }
2835
- }
2836
- /**
2837
- * Sets the data of the SplitButton ([see example]({% slug controltypes_toolbar %}#toc-splitbuttons)).
2838
- *
2839
- * > The data has to be provided in an array-like list.
2840
- */
2841
- set data(data) {
2842
- this._data = data || [];
2843
- }
2844
- get data() {
2845
- if (!this._data) {
2846
- this.data = [];
2847
- }
2848
- return this._data;
2849
- }
2850
- ngOnInit() {
2851
- this.setTextDisplayMode();
2852
- }
2853
- get overflowButtons() {
2854
- return [this.overflowMainButton, ...this.overflowListItems.toArray().filter(el => !el.nativeElement.classList.contains('k-disabled'))];
2855
- }
2856
- /**
2857
- * @hidden
2858
- */
2859
- onButtonListClick(ev) {
2860
- this.focusedIndex = this.overflowButtons.findIndex(b => b.nativeElement.contains(ev.target));
2861
- }
2862
- /**
2863
- * @hidden
2864
- */
2865
- onMainButtonClick(ev) {
2866
- this.buttonClick.emit(ev);
2867
- this.focusedIndex = 0;
2868
- }
2869
- /**
2870
- * @hidden
2871
- */
2872
- canFocus() {
2873
- return !this.disabled;
2874
- }
2875
- /**
2876
- * @hidden
2877
- */
2878
- focus(ev = {}) {
2879
- if (!this.overflows) {
2880
- if (ev.type === 'focus' || ev.type === 'keydown') {
2881
- this.toolbarSplitButton.focus();
2882
- }
2883
- }
2884
- else if (this.overflowButtons.length > 0) {
2885
- this.focusedIndex = getIndexOfFocused(this.getPrevKey(), this.getNextKey(), this.overflowButtons.map(ob => ob.nativeElement))(ev);
2886
- this.focusButton(this.focusedIndex, ev);
2887
- }
2888
- }
2889
- /**
2890
- * @hidden
2891
- */
2892
- handleKey(ev) {
2893
- if (!this.overflows && (ev.keyCode === this.getPrevKey(this.overflows) || ev.keyCode === this.getNextKey(this.overflows))) {
2894
- return false;
2895
- }
2896
- if (this.overflows) {
2897
- const peekAtIndex = makePeeker(this.overflowButtons);
2898
- const isUnmodified = areEqual(this.focusedIndex);
2899
- this.focusedIndex = seekFocusedIndex(this.getPrevKey(), this.getNextKey(), peekAtIndex)(this.focusedIndex, ev);
2900
- this.focusButton(this.focusedIndex, ev);
2901
- return !isUnmodified(this.focusedIndex);
2902
- }
2903
- }
2904
- /**
2905
- * @hidden
2906
- */
2907
- getText(dataItem) {
2908
- if (dataItem) {
2909
- return this.textField ? dataItem[this.textField] : dataItem.text || dataItem;
2910
- }
2911
- return undefined;
2912
- }
2913
- /**
2914
- * @hidden
2915
- */
2916
- handleClick(ev, item, index) {
2917
- this.onButtonListClick(ev);
2918
- const dataItem = this.data[index];
2919
- if (item.click) {
2920
- item.click(dataItem);
2921
- }
2922
- this.itemClick.emit(dataItem);
2923
- }
2924
- focusButton(index, ev) {
2925
- if (!ev.type || ev.type === 'focus' || ev.type === 'keydown' || ev.type === 'click') {
2926
- this.overflowButtons[index].nativeElement.focus();
2927
- }
2928
- }
2929
- setTextDisplayMode() {
2930
- this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
2931
- this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
2932
- }
2933
- }
2934
- ToolBarSplitButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarSplitButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2935
- ToolBarSplitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarSplitButtonComponent, isStandalone: true, selector: "kendo-toolbar-splitbutton", inputs: { showText: "showText", showIcon: "showIcon", text: "text", icon: "icon", svgIcon: "svgIcon", iconClass: "iconClass", imageUrl: "imageUrl", disabled: "disabled", popupSettings: "popupSettings", fillMode: "fillMode", themeColor: "themeColor", look: "look", buttonClass: "buttonClass", arrowButtonClass: "arrowButtonClass", arrowButtonIcon: "arrowButtonIcon", arrowButtonSvgIcon: "arrowButtonSvgIcon", textField: "textField", data: "data" }, outputs: { buttonClick: "buttonClick", itemClick: "itemClick", open: "open", close: "close" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarSplitButtonComponent) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "toolbarSplitButton", first: true, predicate: ["toolbarSplitButton"], descendants: true }, { propertyName: "overflowMainButton", first: true, predicate: ["overflowMainButton"], descendants: true, read: ElementRef }, { propertyName: "overflowListItems", predicate: ["listItem"], descendants: true }], exportAs: ["kendoToolBarSplitButton"], usesInheritance: true, ngImport: i0, template: `
2936
- <ng-template #toolbarTemplate>
2937
- <kendo-splitbutton
2938
- #toolbarSplitButton
2939
- class="k-toolbar-split-button"
2940
- [data]="data"
2941
- [text]="toolbarOptions.text"
2942
- [icon]="toolbarOptions.icon"
2943
- [iconClass]="toolbarOptions.iconClass"
2944
- [svgIcon]="toolbarOptions.svgIcon"
2945
- [imageUrl]="toolbarOptions.imageUrl"
2946
- [buttonClass]="buttonClass"
2947
- [arrowButtonClass]="arrowButtonClass"
2948
- [arrowButtonIcon]="arrowButtonIcon"
2949
- [arrowButtonSvgIcon]="arrowButtonSvgIcon"
2950
- [disabled]="disabled"
2951
- [tabIndex]="-1"
2952
- [textField]="textField"
2953
- [popupSettings]="popupSettings"
2954
- [fillMode]="fillMode"
2955
- [themeColor]="fillMode ? themeColor : null"
2956
- (buttonClick)="buttonClick.emit($event)"
2957
- (open)="open.emit($event)"
2958
- (close)="close.emit($event)"
2959
- (itemClick)="itemClick.emit($event)"
2960
- ></kendo-splitbutton>
2961
- </ng-template>
2962
- <ng-template #popupTemplate>
2963
- <div #overflowMainButton
2964
- tabindex="-1"
2965
- role="menuitem"
2966
- class="k-item k-menu-item"
2967
- [class.k-disabled]="disabled"
2968
- [ngClass]="buttonClass"
2969
- (click)="onMainButtonClick($event)">
2970
- <span
2971
- [ngClass]="{'k-link': true, 'k-menu-link': true}"
2972
- >
2973
- <kendo-icon-wrapper
2974
- *ngIf="overflowOptions.icon || overflowOptions.iconClass || overflowOptions.svgIcon"
2975
- [name]="overflowOptions.icon"
2976
- [customFontClass]="overflowOptions.iconClass"
2977
- [svgIcon]="overflowOptions.svgIcon"
2978
- >
2979
- </kendo-icon-wrapper>
2980
- <span *ngIf="overflowOptions.text" class="k-menu-link-text">{{overflowOptions.text}}</span>
2981
- </span>
2982
- </div>
2983
- <ng-container *ngFor="let item of data; let i = index">
2984
- <div #listItem
2985
- tabindex="-1"
2986
- role="menuitem"
2987
- class="k-item k-menu-item"
2988
- [class.k-disabled]="disabled || item.disabled"
2989
- (click)="handleClick($event, item, i)">
2990
- <span
2991
- class="k-link k-menu-link"
2992
- >
2993
- <kendo-icon-wrapper
2994
- *ngIf="item.icon || item.iconClass || item.svgIcon"
2995
- [name]="item.icon"
2996
- [customFontClass]="item.iconClass"
2997
- [svgIcon]="item.svgIcon"
2998
- >
2999
- </kendo-icon-wrapper>
3000
- <span *ngIf="getText(item)" class="k-menu-link-text">{{ getText(item) }}</span>
3001
- </span>
3002
- </div>
3003
- </ng-container>
3004
- </ng-template>
3005
- `, isInline: true, dependencies: [{ kind: "component", type: SplitButtonComponent, selector: "kendo-splitbutton", inputs: ["text", "icon", "svgIcon", "iconClass", "type", "imageUrl", "size", "rounded", "fillMode", "themeColor", "disabled", "popupSettings", "tabIndex", "textField", "data", "buttonClass", "arrowButtonClass", "arrowButtonIcon", "arrowButtonSvgIcon", "buttonAttributes"], outputs: ["buttonClick", "itemClick", "focus", "blur", "open", "close"], exportAs: ["kendoSplitButton"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
3006
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarSplitButtonComponent, decorators: [{
3007
- type: Component,
3008
- args: [{
3009
- exportAs: 'kendoToolBarSplitButton',
3010
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarSplitButtonComponent) }],
3011
- selector: 'kendo-toolbar-splitbutton',
3012
- template: `
3013
- <ng-template #toolbarTemplate>
3014
- <kendo-splitbutton
3015
- #toolbarSplitButton
3016
- class="k-toolbar-split-button"
3017
- [data]="data"
3018
- [text]="toolbarOptions.text"
3019
- [icon]="toolbarOptions.icon"
3020
- [iconClass]="toolbarOptions.iconClass"
3021
- [svgIcon]="toolbarOptions.svgIcon"
3022
- [imageUrl]="toolbarOptions.imageUrl"
3023
- [buttonClass]="buttonClass"
3024
- [arrowButtonClass]="arrowButtonClass"
3025
- [arrowButtonIcon]="arrowButtonIcon"
3026
- [arrowButtonSvgIcon]="arrowButtonSvgIcon"
3027
- [disabled]="disabled"
3028
- [tabIndex]="-1"
3029
- [textField]="textField"
3030
- [popupSettings]="popupSettings"
3031
- [fillMode]="fillMode"
3032
- [themeColor]="fillMode ? themeColor : null"
3033
- (buttonClick)="buttonClick.emit($event)"
3034
- (open)="open.emit($event)"
3035
- (close)="close.emit($event)"
3036
- (itemClick)="itemClick.emit($event)"
3037
- ></kendo-splitbutton>
3038
- </ng-template>
3039
- <ng-template #popupTemplate>
3040
- <div #overflowMainButton
3041
- tabindex="-1"
3042
- role="menuitem"
3043
- class="k-item k-menu-item"
3044
- [class.k-disabled]="disabled"
3045
- [ngClass]="buttonClass"
3046
- (click)="onMainButtonClick($event)">
3047
- <span
3048
- [ngClass]="{'k-link': true, 'k-menu-link': true}"
3049
- >
3050
- <kendo-icon-wrapper
3051
- *ngIf="overflowOptions.icon || overflowOptions.iconClass || overflowOptions.svgIcon"
3052
- [name]="overflowOptions.icon"
3053
- [customFontClass]="overflowOptions.iconClass"
3054
- [svgIcon]="overflowOptions.svgIcon"
3055
- >
3056
- </kendo-icon-wrapper>
3057
- <span *ngIf="overflowOptions.text" class="k-menu-link-text">{{overflowOptions.text}}</span>
3058
- </span>
3059
- </div>
3060
- <ng-container *ngFor="let item of data; let i = index">
3061
- <div #listItem
3062
- tabindex="-1"
3063
- role="menuitem"
3064
- class="k-item k-menu-item"
3065
- [class.k-disabled]="disabled || item.disabled"
3066
- (click)="handleClick($event, item, i)">
3067
- <span
3068
- class="k-link k-menu-link"
3069
- >
3070
- <kendo-icon-wrapper
3071
- *ngIf="item.icon || item.iconClass || item.svgIcon"
3072
- [name]="item.icon"
3073
- [customFontClass]="item.iconClass"
3074
- [svgIcon]="item.svgIcon"
3075
- >
3076
- </kendo-icon-wrapper>
3077
- <span *ngIf="getText(item)" class="k-menu-link-text">{{ getText(item) }}</span>
3078
- </span>
3079
- </div>
3080
- </ng-container>
3081
- </ng-template>
3082
- `,
3083
- standalone: true,
3084
- imports: [SplitButtonComponent, NgClass, NgIf, IconWrapperComponent, NgFor]
3085
- }]
3086
- }], ctorParameters: function () { return []; }, propDecorators: { showText: [{
3087
- type: Input
3088
- }], showIcon: [{
3089
- type: Input
3090
- }], text: [{
3091
- type: Input
3092
- }], icon: [{
3093
- type: Input
3094
- }], svgIcon: [{
3095
- type: Input
3096
- }], iconClass: [{
3097
- type: Input
3098
- }], imageUrl: [{
3099
- type: Input
3100
- }], disabled: [{
3101
- type: Input
3102
- }], popupSettings: [{
3103
- type: Input
3104
- }], fillMode: [{
3105
- type: Input
3106
- }], themeColor: [{
3107
- type: Input
3108
- }], look: [{
3109
- type: Input
3110
- }], buttonClass: [{
3111
- type: Input
3112
- }], arrowButtonClass: [{
3113
- type: Input
3114
- }], arrowButtonIcon: [{
3115
- type: Input
3116
- }], arrowButtonSvgIcon: [{
3117
- type: Input
3118
- }], textField: [{
3119
- type: Input
3120
- }], data: [{
3121
- type: Input
3122
- }], buttonClick: [{
3123
- type: Output
3124
- }], itemClick: [{
3125
- type: Output
3126
- }], open: [{
3127
- type: Output
3128
- }], close: [{
3129
- type: Output
3130
- }], toolbarTemplate: [{
3131
- type: ViewChild,
3132
- args: ['toolbarTemplate', { static: true }]
3133
- }], popupTemplate: [{
3134
- type: ViewChild,
3135
- args: ['popupTemplate', { static: true }]
3136
- }], toolbarSplitButton: [{
3137
- type: ViewChild,
3138
- args: ['toolbarSplitButton', { static: false }]
3139
- }], overflowMainButton: [{
3140
- type: ViewChild,
3141
- args: ['overflowMainButton', { read: ElementRef }]
3142
- }], overflowListItems: [{
3143
- type: ViewChildren,
3144
- args: ['listItem']
3145
- }] } });
3146
-
3147
- /**
3148
- * Represents the [Kendo UI ToolBar Separator for Angular]({% slug controltypes_toolbar %}#toc-separators).
3149
- */
3150
- class ToolBarSeparatorComponent extends ToolBarToolComponent {
3151
- constructor() {
3152
- super();
3153
- this.isBuiltInTool = true;
3154
- }
3155
- /**
3156
- * @hidden
3157
- */
3158
- canFocus() {
3159
- return false;
3160
- }
3161
- // If this is not here, the docs display info from its parent(ToolBarToolComponent).
3162
- /**
3163
- * @hidden
3164
- */
3165
- focus() {
3166
- /* noop */
3167
- }
3168
- // If this is not here, the docs display info from its parent(ToolBarToolComponent).
3169
- /**
3170
- * @hidden
3171
- */
3172
- handleKey() {
3173
- return false;
3174
- }
3175
- ngAfterViewInit() {
3176
- if (!this.popupTemplate) {
3177
- this.popupTemplate = this.toolbarTemplate;
3178
- }
3179
- }
3180
- }
3181
- ToolBarSeparatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3182
- ToolBarSeparatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarSeparatorComponent, isStandalone: true, selector: "kendo-toolbar-separator", providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarSeparatorComponent) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "separator", first: true, predicate: ["separator"], descendants: true }], exportAs: ["kendoToolBarSeparator"], usesInheritance: true, ngImport: i0, template: `
3183
- <ng-template #toolbarTemplate>
3184
- <div class="k-separator"></div>
3185
- </ng-template>
3186
-
3187
- <ng-template #popupTemplate>
3188
- <div class="k-item k-menu-item">
3189
- <div class="k-separator k-separator-horizontal"></div>
3190
- </div>
3191
- </ng-template>
3192
- `, isInline: true });
3193
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarSeparatorComponent, decorators: [{
3194
- type: Component,
3195
- args: [{
3196
- exportAs: 'kendoToolBarSeparator',
3197
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarSeparatorComponent) }],
3198
- selector: 'kendo-toolbar-separator',
3199
- template: `
3200
- <ng-template #toolbarTemplate>
3201
- <div class="k-separator"></div>
3202
- </ng-template>
3203
-
3204
- <ng-template #popupTemplate>
3205
- <div class="k-item k-menu-item">
3206
- <div class="k-separator k-separator-horizontal"></div>
3207
- </div>
3208
- </ng-template>
3209
- `,
3210
- standalone: true
3211
- }]
3212
- }], ctorParameters: function () { return []; }, propDecorators: { toolbarTemplate: [{
3213
- type: ViewChild,
3214
- args: ['toolbarTemplate', { static: true }]
3215
- }], popupTemplate: [{
3216
- type: ViewChild,
3217
- args: ['popupTemplate', { static: true }]
3218
- }], separator: [{
3219
- type: ViewChild,
3220
- args: ['separator', { static: false }]
3221
- }] } });
3222
-
3223
- /**
3224
- * Represents the [Kendo UI ToolBar Spacer for Angular]({% slug controltypes_toolbar %}#toc-separators).
3225
- */
3226
- class ToolBarSpacerComponent extends ToolBarToolComponent {
3227
- constructor() {
3228
- super();
3229
- /**
3230
- * @hidden
3231
- */
3232
- this.__isSpacer = true;
3233
- this.isBuiltInTool = true;
3234
- }
3235
- /**
3236
- * @hidden
3237
- */
3238
- canFocus() {
3239
- return false;
3240
- }
3241
- // If this is not here, the docs display info from its parent(ToolBarToolComponent).
3242
- /**
3243
- * @hidden
3244
- */
3245
- focus() {
3246
- /* noop */
3247
- }
3248
- // If this is not here, the docs display info from its parent(ToolBarToolComponent).
3249
- /**
3250
- * @hidden
3251
- */
3252
- handleKey() {
3253
- return false;
3254
- }
3255
- ngAfterViewInit() {
3256
- if (!this.popupTemplate) {
3257
- this.popupTemplate = this.toolbarTemplate;
3258
- }
3259
- }
3260
- }
3261
- ToolBarSpacerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarSpacerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3262
- ToolBarSpacerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ToolBarSpacerComponent, isStandalone: true, selector: "kendo-toolbar-spacer", providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarSpacerComponent) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }], exportAs: ["kendoToolBarSpacer"], usesInheritance: true, ngImport: i0, template: `
3263
- <ng-template #toolbarTemplate>
3264
- <div class="k-spacer"></div>
3265
- </ng-template>
3266
- `, isInline: true });
3267
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarSpacerComponent, decorators: [{
3268
- type: Component,
3269
- args: [{
3270
- exportAs: 'kendoToolBarSpacer',
3271
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarSpacerComponent) }],
3272
- selector: 'kendo-toolbar-spacer',
3273
- template: `
3274
- <ng-template #toolbarTemplate>
3275
- <div class="k-spacer"></div>
3276
- </ng-template>
3277
- `,
3278
- standalone: true
3279
- }]
3280
- }], ctorParameters: function () { return []; }, propDecorators: { toolbarTemplate: [{
3281
- type: ViewChild,
3282
- args: ['toolbarTemplate', { static: true }]
3283
- }], popupTemplate: [{
3284
- type: ViewChild,
3285
- args: ['popupTemplate', { static: true }]
3286
- }] } });
3287
-
3288
- /**
3289
- * Custom component messages override default component messages.
3290
- */
3291
- class ToolbarCustomMessagesComponent extends ToolbarMessages {
3292
- constructor(service) {
3293
- super();
3294
- this.service = service;
3295
- }
3296
- get override() {
3297
- return true;
3298
- }
3299
- }
3300
- ToolbarCustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarCustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
3301
- ToolbarCustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ToolbarCustomMessagesComponent, isStandalone: true, selector: "kendo-toolbar-messages", providers: [
3302
- {
3303
- provide: ToolbarMessages,
3304
- useExisting: forwardRef(() => ToolbarCustomMessagesComponent)
3305
- }
3306
- ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
3307
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarCustomMessagesComponent, decorators: [{
3308
- type: Component,
3309
- args: [{
3310
- providers: [
3311
- {
3312
- provide: ToolbarMessages,
3313
- useExisting: forwardRef(() => ToolbarCustomMessagesComponent)
3314
- }
3315
- ],
3316
- selector: 'kendo-toolbar-messages',
3317
- template: ``,
3318
- standalone: true
3319
- }]
3320
- }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
3321
-
3322
- /**
3323
- * Utility array that contains all `@progress/kendo-angular-toolbar` related components and directives
3324
- */
3325
- const KENDO_TOOLBAR = [
3326
- ToolBarComponent,
3327
- ToolbarCustomMessagesComponent,
3328
- ToolBarButtonComponent,
3329
- ToolBarButtonGroupComponent,
3330
- ToolBarDropDownButtonComponent,
3331
- ToolBarSeparatorComponent,
3332
- ToolBarSpacerComponent,
3333
- ToolBarSplitButtonComponent,
3334
- ToolBarToolComponent
3335
- ];
3336
-
3337
- // IMPORTANT: NgModule export kept for backwards compatibility
3338
- /**
3339
- * Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi']) definition for the ToolBar component.
3340
- *
3341
- * The package exports:
3342
- * - `ToolBarComponent`&mdash;The ToolBarComponent class.
3343
- * - `ToolBarToolComponent`&mdash;The base Tool component class.
3344
- * - `ToolBarButtonComponent`&mdash;The Button Tool component class.
3345
- * - `ToolBarButtonGroupComponent`&mdash;The ButtonGroup Tool component class.
3346
- * - `ToolBarDropDownButtonComponent`&mdash;The DropDownButton Tool component class.
3347
- * - `ToolBarSplitButtonComponent`&mdash;The SplitButton Tool component class.
3348
- * - `ToolBarSeparatorComponent`&mdash;The Separator Tool component class.
3349
- */
3350
- class ToolBarModule {
3351
- }
3352
- ToolBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3353
- ToolBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: ToolBarModule, imports: [ToolBarComponent, ToolbarCustomMessagesComponent, ToolBarButtonComponent, ToolBarButtonGroupComponent, ToolBarDropDownButtonComponent, ToolBarSeparatorComponent, ToolBarSpacerComponent, ToolBarSplitButtonComponent, ToolBarToolComponent], exports: [ToolBarComponent, ToolbarCustomMessagesComponent, ToolBarButtonComponent, ToolBarButtonGroupComponent, ToolBarDropDownButtonComponent, ToolBarSeparatorComponent, ToolBarSpacerComponent, ToolBarSplitButtonComponent, ToolBarToolComponent] });
3354
- ToolBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarModule, providers: [IconsService, PopupService, ResizeBatchService], imports: [ToolBarComponent, ToolbarCustomMessagesComponent, ToolBarButtonComponent, ToolBarButtonGroupComponent, ToolBarDropDownButtonComponent, ToolBarSeparatorComponent, ToolBarSpacerComponent, ToolBarSplitButtonComponent] });
3355
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolBarModule, decorators: [{
3356
- type: NgModule,
3357
- args: [{
3358
- exports: [...KENDO_TOOLBAR],
3359
- imports: [...KENDO_TOOLBAR],
3360
- providers: [IconsService, PopupService, ResizeBatchService]
3361
- }]
3362
- }] });
3363
-
3364
- /**
3365
- * Generated bundle index. Do not edit.
3366
- */
3367
-
3368
- export { KENDO_TOOLBAR, LocalizedToolbarMessagesDirective, RefreshService, ToolBarButtonComponent, ToolBarButtonGroupComponent, ToolBarComponent, ToolBarDropDownButtonComponent, ToolBarModule, ToolBarSeparatorComponent, ToolBarSpacerComponent, ToolBarSplitButtonComponent, ToolBarToolComponent, ToolbarCustomMessagesComponent };
3369
-