@progress/kendo-angular-toolbar 17.0.0-develop.9 → 17.0.1-develop.1

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