@progress/kendo-angular-toolbar 17.0.0-develop.21 → 17.0.0-develop.22

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