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