@progress/kendo-angular-buttons 6.4.0 → 7.0.0-dev.202201101733
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/dist/cdn/js/kendo-angular-buttons.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/button/button.directive.js +239 -89
- package/dist/es/button/button.service.js +1 -5
- package/dist/es/buttongroup/buttongroup.component.js +1 -53
- package/dist/es/chip/chip-list.component.js +54 -7
- package/dist/es/chip/chip.component.js +175 -86
- package/dist/es/{chip/models/chip-look.js → common/models/fillmode.js} +0 -0
- package/dist/es/{chip/models/type.js → common/models/rounded.js} +0 -0
- package/dist/{es2015/button-look.js → es/common/models/styling-classes.js} +0 -0
- package/dist/es/{button-look.js → common/models.js} +0 -0
- package/dist/es/dropdownbutton/dropdownbutton.component.js +74 -33
- package/dist/es/floatingactionbutton/dial-item.component.js +1 -1
- package/dist/es/floatingactionbutton/floatingactionbutton.component.js +66 -41
- package/dist/es/focusable/focusable.directive.js +4 -4
- package/dist/es/listbutton/list-button.js +1 -1
- package/dist/es/listbutton/list.component.js +20 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/splitbutton/splitbutton.component.js +91 -33
- package/dist/es/util.js +52 -0
- package/dist/es2015/button/button.directive.d.ts +85 -22
- package/dist/es2015/button/button.directive.js +222 -85
- package/dist/es2015/button/button.service.d.ts +1 -4
- package/dist/es2015/button/button.service.js +1 -5
- package/dist/es2015/buttongroup/buttongroup.component.d.ts +0 -15
- package/dist/es2015/buttongroup/buttongroup.component.js +1 -41
- package/dist/es2015/chip/chip-list.component.d.ts +19 -3
- package/dist/es2015/chip/chip-list.component.js +49 -7
- package/dist/es2015/chip/chip.component.d.ts +67 -32
- package/dist/es2015/chip/chip.component.js +186 -97
- package/dist/es2015/common/models/fillmode.d.ts +12 -0
- package/dist/es2015/{chip/models/type.js → common/models/fillmode.js} +0 -0
- package/dist/es2015/common/models/rounded.d.ts +12 -0
- package/dist/es2015/common/models/rounded.js +4 -0
- package/dist/es2015/common/models/shape.d.ts +2 -9
- package/dist/es2015/common/models/size.d.ts +9 -6
- package/dist/es2015/common/models/styling-classes.d.ts +11 -0
- package/dist/es2015/common/models/styling-classes.js +4 -0
- package/dist/es2015/common/models/theme-color.d.ts +15 -4
- package/dist/es2015/common/models.d.ts +10 -0
- package/dist/es2015/{chip/models/chip-look.js → common/models.js} +0 -0
- package/dist/es2015/dropdownbutton/dropdownbutton.component.d.ts +58 -7
- package/dist/es2015/dropdownbutton/dropdownbutton.component.js +81 -28
- package/dist/es2015/floatingactionbutton/dial-item.component.js +1 -1
- package/dist/es2015/floatingactionbutton/floatingactionbutton.component.d.ts +28 -21
- package/dist/es2015/floatingactionbutton/floatingactionbutton.component.js +62 -42
- package/dist/es2015/focusable/focusable.directive.js +4 -4
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/listbutton/list-button.js +1 -1
- package/dist/es2015/listbutton/list.component.d.ts +3 -0
- package/dist/es2015/listbutton/list.component.js +37 -20
- package/dist/es2015/main.d.ts +4 -4
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/splitbutton/splitbutton.component.d.ts +53 -7
- package/dist/es2015/splitbutton/splitbutton.component.js +101 -29
- package/dist/es2015/util.d.ts +21 -0
- package/dist/es2015/util.js +52 -0
- package/dist/fesm2015/index.js +832 -395
- package/dist/fesm5/index.js +817 -393
- package/dist/npm/button/button.directive.js +239 -89
- package/dist/npm/button/button.service.js +0 -4
- package/dist/npm/buttongroup/buttongroup.component.js +1 -53
- package/dist/npm/chip/chip-list.component.js +52 -5
- package/dist/npm/chip/chip.component.js +173 -84
- package/dist/npm/{chip/models/chip-look.js → common/models/fillmode.js} +0 -0
- package/dist/npm/{chip/models/type.js → common/models/rounded.js} +0 -0
- package/dist/npm/common/models/styling-classes.js +6 -0
- package/dist/npm/{button-look.js → common/models.js} +0 -0
- package/dist/npm/dropdownbutton/dropdownbutton.component.js +74 -33
- package/dist/npm/floatingactionbutton/dial-item.component.js +1 -1
- package/dist/npm/floatingactionbutton/floatingactionbutton.component.js +66 -41
- package/dist/npm/focusable/focusable.directive.js +4 -4
- package/dist/npm/listbutton/list-button.js +1 -1
- package/dist/npm/listbutton/list.component.js +20 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/splitbutton/splitbutton.component.js +89 -31
- package/dist/npm/util.js +52 -0
- package/dist/systemjs/kendo-angular-buttons.js +1 -1
- package/package.json +18 -15
- package/dist/es2015/button-look.d.ts +0 -21
- package/dist/es2015/chip/models/chip-look.d.ts +0 -20
- package/dist/es2015/chip/models/type.d.ts +0 -21
package/dist/fesm2015/index.js
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { __decorate, __metadata, __param } from 'tslib';
|
|
6
6
|
import { Injectable, EventEmitter, Input, Output, HostBinding, HostListener, Directive, Optional, ElementRef, Renderer2, NgZone, isDevMode, ContentChildren, QueryList, Component, NgModule, TemplateRef, ViewContainerRef, InjectionToken, Inject, ContentChild, ViewChild, ChangeDetectorRef, forwardRef } from '@angular/core';
|
|
7
|
-
import {
|
|
7
|
+
import { Subject, fromEvent, merge, Subscription } from 'rxjs';
|
|
8
8
|
import { Keys, isChanged, isDocumentAvailable, hasObservers, guid, EventsModule } from '@progress/kendo-angular-common';
|
|
9
9
|
import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
|
|
10
|
-
import { filter, take } from 'rxjs/operators';
|
|
11
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
12
11
|
import { CommonModule } from '@angular/common';
|
|
13
12
|
import { PopupService, PopupModule } from '@progress/kendo-angular-popup';
|
|
13
|
+
import { filter, take } from 'rxjs/operators';
|
|
14
14
|
import { sequence, query, style, stagger, animate, AnimationBuilder } from '@angular/animations';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -21,16 +21,12 @@ let KendoButtonService = class KendoButtonService {
|
|
|
21
21
|
* @hidden
|
|
22
22
|
*/
|
|
23
23
|
constructor() {
|
|
24
|
-
this.buttonLookChange = new BehaviorSubject('default');
|
|
25
24
|
this.buttonClicked = new Subject();
|
|
26
25
|
this.buttonClicked$ = this.buttonClicked.asObservable();
|
|
27
26
|
}
|
|
28
27
|
click(button) {
|
|
29
28
|
this.buttonClicked.next(button);
|
|
30
29
|
}
|
|
31
|
-
setButtonLook(look) {
|
|
32
|
-
this.buttonLookChange.next(look);
|
|
33
|
-
}
|
|
34
30
|
};
|
|
35
31
|
KendoButtonService = __decorate([
|
|
36
32
|
Injectable()
|
|
@@ -43,11 +39,103 @@ const packageMetadata = {
|
|
|
43
39
|
name: '@progress/kendo-angular-buttons',
|
|
44
40
|
productName: 'Kendo UI for Angular',
|
|
45
41
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
46
|
-
publishDate:
|
|
42
|
+
publishDate: 1641835943,
|
|
47
43
|
version: '',
|
|
48
44
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
49
45
|
};
|
|
50
46
|
|
|
47
|
+
/* tslint:disable:no-null-keyword */
|
|
48
|
+
/* tslint:disable:no-bitwise */
|
|
49
|
+
const resolvedPromise = Promise.resolve(null);
|
|
50
|
+
/**
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
|
+
const isPresent = (value) => value !== null && value !== undefined;
|
|
54
|
+
/**
|
|
55
|
+
* @hidden
|
|
56
|
+
*/
|
|
57
|
+
const tick = (f) => (resolvedPromise.then(f));
|
|
58
|
+
/**
|
|
59
|
+
* @hidden
|
|
60
|
+
*/
|
|
61
|
+
function isDocumentNode(container) {
|
|
62
|
+
return container.nodeType === 9;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @hidden
|
|
66
|
+
*/
|
|
67
|
+
function closest(element, selector) {
|
|
68
|
+
if (element.closest) {
|
|
69
|
+
return element.closest(selector);
|
|
70
|
+
}
|
|
71
|
+
const matches = Element.prototype.matches ?
|
|
72
|
+
(el, sel) => el.matches(sel)
|
|
73
|
+
: (el, sel) => el.msMatchesSelector(sel);
|
|
74
|
+
let node = element;
|
|
75
|
+
while (node && !isDocumentNode(node)) {
|
|
76
|
+
if (matches(node, selector)) {
|
|
77
|
+
return node;
|
|
78
|
+
}
|
|
79
|
+
node = node.parentNode;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @hidden
|
|
84
|
+
*/
|
|
85
|
+
const replaceMessagePlaceholder = (message, name, value) => message.replace(new RegExp(`\{\\s*${name}\\s*\}`, 'g'), value);
|
|
86
|
+
/**
|
|
87
|
+
* @hidden
|
|
88
|
+
*/
|
|
89
|
+
const SIZES = {
|
|
90
|
+
small: 'sm',
|
|
91
|
+
medium: 'md',
|
|
92
|
+
large: 'lg'
|
|
93
|
+
};
|
|
94
|
+
const ROUNDNESS = {
|
|
95
|
+
small: 'sm',
|
|
96
|
+
medium: 'md',
|
|
97
|
+
large: 'lg',
|
|
98
|
+
full: 'full'
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* @hidden
|
|
102
|
+
*
|
|
103
|
+
* Returns the styling classes to be added and removed
|
|
104
|
+
*/
|
|
105
|
+
const getStylingClasses = (componentType, stylingOption, previousValue, newValue) => {
|
|
106
|
+
switch (stylingOption) {
|
|
107
|
+
case 'size':
|
|
108
|
+
return {
|
|
109
|
+
toRemove: `k-${componentType}-${SIZES[previousValue]}`,
|
|
110
|
+
toAdd: newValue ? `k-${componentType}-${SIZES[newValue]}` : null
|
|
111
|
+
};
|
|
112
|
+
case 'rounded':
|
|
113
|
+
return {
|
|
114
|
+
toRemove: `k-rounded-${ROUNDNESS[previousValue]}`,
|
|
115
|
+
toAdd: newValue ? `k-rounded-${ROUNDNESS[newValue]}` : null
|
|
116
|
+
};
|
|
117
|
+
case 'fillMode':
|
|
118
|
+
case 'shape':
|
|
119
|
+
return {
|
|
120
|
+
toRemove: `k-${componentType}-${previousValue}`,
|
|
121
|
+
toAdd: newValue ? `k-${componentType}-${newValue}` : null
|
|
122
|
+
};
|
|
123
|
+
default:
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* @hidden
|
|
129
|
+
*
|
|
130
|
+
* Returns the themeColor classes to be added and removed
|
|
131
|
+
*/
|
|
132
|
+
const getThemeColorClasses = (componentType, prevFillMode, fillMode, previousValue, newValue) => {
|
|
133
|
+
return {
|
|
134
|
+
toRemove: `k-${componentType}-${prevFillMode}-${previousValue}`,
|
|
135
|
+
toAdd: newValue ? `k-${componentType}-${fillMode}-${newValue}` : null
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
51
139
|
const SPAN_TAG_NAME = 'SPAN';
|
|
52
140
|
/**
|
|
53
141
|
* Represents the Kendo UI Button component for Angular.
|
|
@@ -61,19 +149,6 @@ let ButtonDirective = class ButtonDirective {
|
|
|
61
149
|
* By default, `toggleable` is set to `false`.
|
|
62
150
|
*/
|
|
63
151
|
this.toggleable = false;
|
|
64
|
-
/**
|
|
65
|
-
* Adds visual weight to the Button and makes it primary.
|
|
66
|
-
*/
|
|
67
|
-
this.primary = false;
|
|
68
|
-
/**
|
|
69
|
-
* Changes the visual appearance by using alternative styling options
|
|
70
|
-
* ([more information and examples]({% slug appearance_button %})).
|
|
71
|
-
*
|
|
72
|
-
* The available values are:
|
|
73
|
-
* * [`ButtonLook`]({% slug api_buttons_buttonlook %}) = `flat` | `outline`
|
|
74
|
-
* * `clear`
|
|
75
|
-
*/
|
|
76
|
-
this.look = 'default';
|
|
77
152
|
/**
|
|
78
153
|
* @hidden
|
|
79
154
|
*/
|
|
@@ -91,12 +166,16 @@ let ButtonDirective = class ButtonDirective {
|
|
|
91
166
|
this.isDisabled = false;
|
|
92
167
|
this.isIcon = false;
|
|
93
168
|
this.isIconClass = false;
|
|
169
|
+
this._size = 'medium';
|
|
170
|
+
this._rounded = 'medium';
|
|
171
|
+
this._shape = 'rectangle';
|
|
172
|
+
this._fillMode = 'solid';
|
|
173
|
+
this._themeColor = 'base';
|
|
94
174
|
this._focused = false;
|
|
95
175
|
this.domEvents = [];
|
|
96
176
|
validatePackage(packageMetadata);
|
|
97
177
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
98
|
-
this.localizationChangeSubscription = localization.changes
|
|
99
|
-
.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr');
|
|
178
|
+
this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr'));
|
|
100
179
|
this.element = element.nativeElement;
|
|
101
180
|
this.renderer = renderer;
|
|
102
181
|
}
|
|
@@ -140,7 +219,7 @@ let ButtonDirective = class ButtonDirective {
|
|
|
140
219
|
if (icon) {
|
|
141
220
|
this.iconSetter(icon, () => {
|
|
142
221
|
this.isIcon = true;
|
|
143
|
-
const classes = 'k-icon k-i-' + icon;
|
|
222
|
+
const classes = 'k-button-icon k-icon k-i-' + icon;
|
|
144
223
|
this.addIcon(classes);
|
|
145
224
|
});
|
|
146
225
|
}
|
|
@@ -157,7 +236,8 @@ let ButtonDirective = class ButtonDirective {
|
|
|
157
236
|
if (iconClassName) {
|
|
158
237
|
this.iconSetter(iconClassName, () => {
|
|
159
238
|
this.isIconClass = true;
|
|
160
|
-
|
|
239
|
+
const classes = 'k-button-icon k-icon ' + iconClassName;
|
|
240
|
+
this.addIcon(classes);
|
|
161
241
|
});
|
|
162
242
|
}
|
|
163
243
|
else {
|
|
@@ -187,8 +267,101 @@ let ButtonDirective = class ButtonDirective {
|
|
|
187
267
|
get disabled() {
|
|
188
268
|
return this.isDisabled;
|
|
189
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* The size property specifies the width and height of the Button
|
|
272
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-size)).
|
|
273
|
+
*
|
|
274
|
+
* The possible values are:
|
|
275
|
+
* * `'small'`
|
|
276
|
+
* * `'medium'` (default)
|
|
277
|
+
* * `'large'`
|
|
278
|
+
* * `null`
|
|
279
|
+
*/
|
|
280
|
+
set size(size) {
|
|
281
|
+
this.handleClasses(size, 'size');
|
|
282
|
+
this._size = size;
|
|
283
|
+
}
|
|
284
|
+
get size() {
|
|
285
|
+
return this._size;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The rounded property specifies the border radius of the Button
|
|
289
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-rounded)).
|
|
290
|
+
*
|
|
291
|
+
* The possible values are:
|
|
292
|
+
* * `'small'`
|
|
293
|
+
* * `'medium'` (default)
|
|
294
|
+
* * `'large'`
|
|
295
|
+
* * `'full'`
|
|
296
|
+
* * `null`
|
|
297
|
+
*/
|
|
298
|
+
set rounded(rounded) {
|
|
299
|
+
this.handleClasses(rounded, 'rounded');
|
|
300
|
+
this._rounded = rounded;
|
|
301
|
+
}
|
|
302
|
+
get rounded() {
|
|
303
|
+
return this._rounded;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* The fillMode property specifies the background and border styles of the Button
|
|
307
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-fillMode)).
|
|
308
|
+
*
|
|
309
|
+
* The possible values are:
|
|
310
|
+
* * `'flat'`
|
|
311
|
+
* * `'solid'` (default)
|
|
312
|
+
* * `'outline'`
|
|
313
|
+
* * `'link'`
|
|
314
|
+
* * `null`
|
|
315
|
+
*/
|
|
316
|
+
set fillMode(fillMode) {
|
|
317
|
+
this.handleClasses(fillMode, 'fillMode');
|
|
318
|
+
this._fillMode = fillMode;
|
|
319
|
+
}
|
|
320
|
+
get fillMode() {
|
|
321
|
+
return this._fillMode;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* The Button allows you to specify predefined theme colors.
|
|
325
|
+
* The theme color will be applied as a background and border color while also amending the text color accordingly
|
|
326
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-themeColor)).
|
|
327
|
+
*
|
|
328
|
+
* The possible values are:
|
|
329
|
+
* * `'base'` (default)
|
|
330
|
+
* * `'primary'`
|
|
331
|
+
* * `'secondary'`
|
|
332
|
+
* * `'tertiary'`
|
|
333
|
+
* * `'info'`
|
|
334
|
+
* * `'success'`
|
|
335
|
+
* * `'warning'`
|
|
336
|
+
* * `'error'`
|
|
337
|
+
* * `'dark'`
|
|
338
|
+
* * `'light`'
|
|
339
|
+
* * `'inverse'`
|
|
340
|
+
*/
|
|
341
|
+
set themeColor(themeColor) {
|
|
342
|
+
this.handleThemeColor(themeColor);
|
|
343
|
+
this._themeColor = themeColor;
|
|
344
|
+
}
|
|
345
|
+
get themeColor() {
|
|
346
|
+
return this._themeColor;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* The shape property specifies if the Button will form a rectangle or square.
|
|
350
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-shape)).
|
|
351
|
+
*
|
|
352
|
+
* The possible values are:
|
|
353
|
+
* * `'square'`
|
|
354
|
+
* * `'rectangle'` (default)
|
|
355
|
+
*/
|
|
356
|
+
set shape(shape) {
|
|
357
|
+
this.handleClasses(shape, 'shape');
|
|
358
|
+
this._shape = shape;
|
|
359
|
+
}
|
|
360
|
+
get shape() {
|
|
361
|
+
return this._shape;
|
|
362
|
+
}
|
|
190
363
|
set isFocused(isFocused) {
|
|
191
|
-
this.toggleClass('k-
|
|
364
|
+
this.toggleClass('k-focus', isFocused);
|
|
192
365
|
this._focused = isFocused;
|
|
193
366
|
}
|
|
194
367
|
get isFocused() {
|
|
@@ -197,24 +370,9 @@ let ButtonDirective = class ButtonDirective {
|
|
|
197
370
|
get classButton() {
|
|
198
371
|
return true;
|
|
199
372
|
}
|
|
200
|
-
get classPrimary() {
|
|
201
|
-
return this.primary;
|
|
202
|
-
}
|
|
203
373
|
get isToggleable() {
|
|
204
374
|
return this.toggleable;
|
|
205
375
|
}
|
|
206
|
-
get isFlat() {
|
|
207
|
-
return this.look === 'flat';
|
|
208
|
-
}
|
|
209
|
-
get isBare() {
|
|
210
|
-
return this.look === 'bare';
|
|
211
|
-
}
|
|
212
|
-
get isOutline() {
|
|
213
|
-
return this.look === 'outline';
|
|
214
|
-
}
|
|
215
|
-
get isClear() {
|
|
216
|
-
return this.look === 'clear';
|
|
217
|
-
}
|
|
218
376
|
get roleSetter() {
|
|
219
377
|
return this.role;
|
|
220
378
|
}
|
|
@@ -239,13 +397,31 @@ let ButtonDirective = class ButtonDirective {
|
|
|
239
397
|
onBlur() {
|
|
240
398
|
this.isFocused = false;
|
|
241
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* @hidden
|
|
402
|
+
*/
|
|
403
|
+
set primary(value) {
|
|
404
|
+
this.themeColor = value ? 'primary' : 'base';
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* @hidden
|
|
408
|
+
*/
|
|
409
|
+
set look(value) {
|
|
410
|
+
switch (value) {
|
|
411
|
+
case 'default':
|
|
412
|
+
this.fillMode = 'solid';
|
|
413
|
+
break;
|
|
414
|
+
case 'clear':
|
|
415
|
+
this.fillMode = 'flat';
|
|
416
|
+
break;
|
|
417
|
+
default:
|
|
418
|
+
this.fillMode = value;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
242
422
|
ngOnInit() {
|
|
243
423
|
const isSpan = this.element.tagName === SPAN_TAG_NAME;
|
|
244
|
-
|
|
245
|
-
this.buttonLookChangeSubscription = this.service.buttonLookChange
|
|
246
|
-
.pipe(filter((look) => look !== 'default'))
|
|
247
|
-
.subscribe((look) => this.look = look);
|
|
248
|
-
}
|
|
424
|
+
this.addTextSpan();
|
|
249
425
|
if (!this.element.hasAttribute('role') && this.togglable) {
|
|
250
426
|
this.toggleAriaPressed(this.toggleable);
|
|
251
427
|
}
|
|
@@ -255,7 +431,8 @@ let ButtonDirective = class ButtonDirective {
|
|
|
255
431
|
this.ngZone.runOutsideAngular(() => {
|
|
256
432
|
this.domEvents.push(this.renderer.listen(this.element, 'click', this._onButtonClick.bind(this)));
|
|
257
433
|
this.domEvents.push(this.renderer.listen(this.element, 'keydown', (event) => {
|
|
258
|
-
|
|
434
|
+
const isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
|
|
435
|
+
if (isSpan && isSpaceOrEnter) {
|
|
259
436
|
this.click.emit(event);
|
|
260
437
|
this._onButtonClick();
|
|
261
438
|
}
|
|
@@ -267,17 +444,21 @@ let ButtonDirective = class ButtonDirective {
|
|
|
267
444
|
this.toggleAriaPressed(this.toggleable);
|
|
268
445
|
}
|
|
269
446
|
}
|
|
447
|
+
ngAfterViewInit() {
|
|
448
|
+
const stylingOptions = ['size', 'rounded', 'shape', 'fillMode'];
|
|
449
|
+
stylingOptions.forEach(input => {
|
|
450
|
+
this.handleClasses(this[input], input);
|
|
451
|
+
});
|
|
452
|
+
}
|
|
270
453
|
ngAfterViewChecked() {
|
|
271
454
|
this.setIconTextClasses();
|
|
272
455
|
}
|
|
273
456
|
ngOnDestroy() {
|
|
274
457
|
this.imageNode = null;
|
|
275
458
|
this.iconNode = null;
|
|
459
|
+
this.iconSpanNode = null;
|
|
276
460
|
this.renderer = null;
|
|
277
461
|
this.localizationChangeSubscription.unsubscribe();
|
|
278
|
-
if (this.service && this.buttonLookChangeSubscription) {
|
|
279
|
-
this.buttonLookChangeSubscription.unsubscribe();
|
|
280
|
-
}
|
|
281
462
|
clearTimeout(this.deferTimeout);
|
|
282
463
|
this.domEvents.forEach(unbindHandler => unbindHandler());
|
|
283
464
|
}
|
|
@@ -320,7 +501,7 @@ let ButtonDirective = class ButtonDirective {
|
|
|
320
501
|
const changed = this.selected !== value;
|
|
321
502
|
this.selected = value;
|
|
322
503
|
this.setAttribute('aria-pressed', this.selected.toString());
|
|
323
|
-
this.toggleClass('k-
|
|
504
|
+
this.toggleClass('k-selected', this.selected);
|
|
324
505
|
if (changed && hasObservers(this.selectedChange)) {
|
|
325
506
|
this.ngZone.run(() => {
|
|
326
507
|
this.selectedChange.emit(value);
|
|
@@ -340,14 +521,21 @@ let ButtonDirective = class ButtonDirective {
|
|
|
340
521
|
}
|
|
341
522
|
hasText() {
|
|
342
523
|
if (isDocumentAvailable()) {
|
|
343
|
-
return
|
|
524
|
+
return this.element.textContent.trim().length > 0;
|
|
344
525
|
}
|
|
345
526
|
else {
|
|
346
527
|
return false;
|
|
347
528
|
}
|
|
348
529
|
}
|
|
530
|
+
get text() {
|
|
531
|
+
if (isDocumentAvailable()) {
|
|
532
|
+
return this.element.innerHTML.trim();
|
|
533
|
+
}
|
|
534
|
+
}
|
|
349
535
|
addImgIcon(imageUrl) {
|
|
350
536
|
let renderer = this.renderer;
|
|
537
|
+
this.iconSpanNode = renderer.createElement('span');
|
|
538
|
+
renderer.setProperty(this.iconSpanNode, 'className', 'k-button-icon k-icon');
|
|
351
539
|
if (this.imageNode) {
|
|
352
540
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
353
541
|
}
|
|
@@ -356,8 +544,9 @@ let ButtonDirective = class ButtonDirective {
|
|
|
356
544
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
357
545
|
renderer.setProperty(this.imageNode, 'className', 'k-image');
|
|
358
546
|
renderer.setAttribute(this.imageNode, 'role', 'presentation');
|
|
359
|
-
this.prependChild(this.imageNode);
|
|
360
547
|
}
|
|
548
|
+
this.iconSpanNode.appendChild(this.imageNode);
|
|
549
|
+
this.prependChild(this.iconSpanNode);
|
|
361
550
|
}
|
|
362
551
|
addIcon(classNames) {
|
|
363
552
|
let renderer = this.renderer;
|
|
@@ -371,6 +560,11 @@ let ButtonDirective = class ButtonDirective {
|
|
|
371
560
|
this.prependChild(this.iconNode);
|
|
372
561
|
}
|
|
373
562
|
}
|
|
563
|
+
addTextSpan() {
|
|
564
|
+
if (isDocumentAvailable() && this.hasText()) {
|
|
565
|
+
this.element.innerHTML = `<span class='k-button-text'>${this.text}</span>`;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
374
568
|
prependChild(node) {
|
|
375
569
|
this.defer(() => {
|
|
376
570
|
if (this.renderer && node !== this.element.firstChild) {
|
|
@@ -392,7 +586,9 @@ let ButtonDirective = class ButtonDirective {
|
|
|
392
586
|
removeImageNode() {
|
|
393
587
|
if (this.imageNode && this.renderer.parentNode(this.imageNode)) {
|
|
394
588
|
this.renderer.removeChild(this.element, this.imageNode);
|
|
589
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
395
590
|
this.imageNode = null;
|
|
591
|
+
this.iconSpanNode = null;
|
|
396
592
|
}
|
|
397
593
|
}
|
|
398
594
|
removeIconNode() {
|
|
@@ -400,6 +596,10 @@ let ButtonDirective = class ButtonDirective {
|
|
|
400
596
|
this.renderer.removeChild(this.element, this.iconNode);
|
|
401
597
|
this.iconNode = null;
|
|
402
598
|
}
|
|
599
|
+
if (this.iconSpanNode) {
|
|
600
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
601
|
+
this.iconSpanNode = null;
|
|
602
|
+
}
|
|
403
603
|
}
|
|
404
604
|
updateIconNode() {
|
|
405
605
|
if (!this.isIcon && !this.isIconClass) {
|
|
@@ -408,9 +608,7 @@ let ButtonDirective = class ButtonDirective {
|
|
|
408
608
|
}
|
|
409
609
|
setIconTextClasses() {
|
|
410
610
|
const hasIcon = this.isIcon || this.isIconClass || this.imageNode;
|
|
411
|
-
|
|
412
|
-
this.toggleClass('k-button-icon', hasIcon && !hasText);
|
|
413
|
-
this.toggleClass('k-button-icontext', hasIcon && hasText);
|
|
611
|
+
this.toggleClass('k-icon-button', hasIcon && !this.hasText());
|
|
414
612
|
}
|
|
415
613
|
toggleClass(className, add) {
|
|
416
614
|
if (add) {
|
|
@@ -430,6 +628,31 @@ let ButtonDirective = class ButtonDirective {
|
|
|
430
628
|
this.setSelected(!this.selected);
|
|
431
629
|
}
|
|
432
630
|
}
|
|
631
|
+
handleClasses(value, input) {
|
|
632
|
+
const elem = this.element;
|
|
633
|
+
const classes = getStylingClasses('button', input, this[input], value);
|
|
634
|
+
if (input === 'fillMode') {
|
|
635
|
+
this.handleThemeColor(this.themeColor, this[input], value);
|
|
636
|
+
}
|
|
637
|
+
if (classes.toRemove) {
|
|
638
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
639
|
+
}
|
|
640
|
+
if (classes.toAdd) {
|
|
641
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
handleThemeColor(value, prevFillMode, fillMode) {
|
|
645
|
+
const elem = this.element;
|
|
646
|
+
const removeFillMode = prevFillMode ? prevFillMode : this.fillMode;
|
|
647
|
+
const addFillMode = fillMode ? fillMode : this.fillMode;
|
|
648
|
+
const themeColorClass = getThemeColorClasses('button', removeFillMode, addFillMode, this.themeColor, value);
|
|
649
|
+
this.renderer.removeClass(elem, themeColorClass.toRemove);
|
|
650
|
+
if (addFillMode !== null && fillMode !== null) {
|
|
651
|
+
if (themeColorClass.toAdd) {
|
|
652
|
+
this.renderer.addClass(elem, themeColorClass.toAdd);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
433
656
|
};
|
|
434
657
|
__decorate([
|
|
435
658
|
Input(),
|
|
@@ -440,14 +663,6 @@ __decorate([
|
|
|
440
663
|
__metadata("design:type", Boolean),
|
|
441
664
|
__metadata("design:paramtypes", [Boolean])
|
|
442
665
|
], ButtonDirective.prototype, "togglable", null);
|
|
443
|
-
__decorate([
|
|
444
|
-
Input(),
|
|
445
|
-
__metadata("design:type", Boolean)
|
|
446
|
-
], ButtonDirective.prototype, "primary", void 0);
|
|
447
|
-
__decorate([
|
|
448
|
-
Input(),
|
|
449
|
-
__metadata("design:type", String)
|
|
450
|
-
], ButtonDirective.prototype, "look", void 0);
|
|
451
666
|
__decorate([
|
|
452
667
|
Input(),
|
|
453
668
|
__metadata("design:type", Boolean),
|
|
@@ -478,6 +693,31 @@ __decorate([
|
|
|
478
693
|
__metadata("design:type", Boolean),
|
|
479
694
|
__metadata("design:paramtypes", [Boolean])
|
|
480
695
|
], ButtonDirective.prototype, "disabled", null);
|
|
696
|
+
__decorate([
|
|
697
|
+
Input(),
|
|
698
|
+
__metadata("design:type", String),
|
|
699
|
+
__metadata("design:paramtypes", [String])
|
|
700
|
+
], ButtonDirective.prototype, "size", null);
|
|
701
|
+
__decorate([
|
|
702
|
+
Input(),
|
|
703
|
+
__metadata("design:type", String),
|
|
704
|
+
__metadata("design:paramtypes", [String])
|
|
705
|
+
], ButtonDirective.prototype, "rounded", null);
|
|
706
|
+
__decorate([
|
|
707
|
+
Input(),
|
|
708
|
+
__metadata("design:type", String),
|
|
709
|
+
__metadata("design:paramtypes", [String])
|
|
710
|
+
], ButtonDirective.prototype, "fillMode", null);
|
|
711
|
+
__decorate([
|
|
712
|
+
Input(),
|
|
713
|
+
__metadata("design:type", String),
|
|
714
|
+
__metadata("design:paramtypes", [String])
|
|
715
|
+
], ButtonDirective.prototype, "themeColor", null);
|
|
716
|
+
__decorate([
|
|
717
|
+
Input(),
|
|
718
|
+
__metadata("design:type", String),
|
|
719
|
+
__metadata("design:paramtypes", [String])
|
|
720
|
+
], ButtonDirective.prototype, "shape", null);
|
|
481
721
|
__decorate([
|
|
482
722
|
Input(),
|
|
483
723
|
__metadata("design:type", String)
|
|
@@ -495,36 +735,11 @@ __decorate([
|
|
|
495
735
|
__metadata("design:type", Boolean),
|
|
496
736
|
__metadata("design:paramtypes", [])
|
|
497
737
|
], ButtonDirective.prototype, "classButton", null);
|
|
498
|
-
__decorate([
|
|
499
|
-
HostBinding('class.k-primary'),
|
|
500
|
-
__metadata("design:type", Boolean),
|
|
501
|
-
__metadata("design:paramtypes", [])
|
|
502
|
-
], ButtonDirective.prototype, "classPrimary", null);
|
|
503
738
|
__decorate([
|
|
504
739
|
HostBinding('class.k-toggle-button'),
|
|
505
740
|
__metadata("design:type", Boolean),
|
|
506
741
|
__metadata("design:paramtypes", [])
|
|
507
742
|
], ButtonDirective.prototype, "isToggleable", null);
|
|
508
|
-
__decorate([
|
|
509
|
-
HostBinding('class.k-flat'),
|
|
510
|
-
__metadata("design:type", Boolean),
|
|
511
|
-
__metadata("design:paramtypes", [])
|
|
512
|
-
], ButtonDirective.prototype, "isFlat", null);
|
|
513
|
-
__decorate([
|
|
514
|
-
HostBinding('class.k-bare'),
|
|
515
|
-
__metadata("design:type", Boolean),
|
|
516
|
-
__metadata("design:paramtypes", [])
|
|
517
|
-
], ButtonDirective.prototype, "isBare", null);
|
|
518
|
-
__decorate([
|
|
519
|
-
HostBinding('class.k-outline'),
|
|
520
|
-
__metadata("design:type", Boolean),
|
|
521
|
-
__metadata("design:paramtypes", [])
|
|
522
|
-
], ButtonDirective.prototype, "isOutline", null);
|
|
523
|
-
__decorate([
|
|
524
|
-
HostBinding('class.k-button-clear'),
|
|
525
|
-
__metadata("design:type", Boolean),
|
|
526
|
-
__metadata("design:paramtypes", [])
|
|
527
|
-
], ButtonDirective.prototype, "isClear", null);
|
|
528
743
|
__decorate([
|
|
529
744
|
HostBinding('attr.role'),
|
|
530
745
|
__metadata("design:type", String),
|
|
@@ -532,12 +747,12 @@ __decorate([
|
|
|
532
747
|
], ButtonDirective.prototype, "roleSetter", null);
|
|
533
748
|
__decorate([
|
|
534
749
|
HostBinding('attr.aria-disabled'),
|
|
535
|
-
HostBinding('class.k-
|
|
750
|
+
HostBinding('class.k-disabled'),
|
|
536
751
|
__metadata("design:type", Boolean),
|
|
537
752
|
__metadata("design:paramtypes", [])
|
|
538
753
|
], ButtonDirective.prototype, "classDisabled", null);
|
|
539
754
|
__decorate([
|
|
540
|
-
HostBinding('class.k-
|
|
755
|
+
HostBinding('class.k-selected'),
|
|
541
756
|
__metadata("design:type", Boolean),
|
|
542
757
|
__metadata("design:paramtypes", [])
|
|
543
758
|
], ButtonDirective.prototype, "classActive", null);
|
|
@@ -558,6 +773,16 @@ __decorate([
|
|
|
558
773
|
__metadata("design:paramtypes", []),
|
|
559
774
|
__metadata("design:returntype", void 0)
|
|
560
775
|
], ButtonDirective.prototype, "onBlur", null);
|
|
776
|
+
__decorate([
|
|
777
|
+
Input(),
|
|
778
|
+
__metadata("design:type", Boolean),
|
|
779
|
+
__metadata("design:paramtypes", [Boolean])
|
|
780
|
+
], ButtonDirective.prototype, "primary", null);
|
|
781
|
+
__decorate([
|
|
782
|
+
Input(),
|
|
783
|
+
__metadata("design:type", String),
|
|
784
|
+
__metadata("design:paramtypes", [String])
|
|
785
|
+
], ButtonDirective.prototype, "look", null);
|
|
561
786
|
ButtonDirective = __decorate([
|
|
562
787
|
Directive({
|
|
563
788
|
exportAs: 'kendoButton',
|
|
@@ -568,7 +793,7 @@ ButtonDirective = __decorate([
|
|
|
568
793
|
useValue: 'kendo.button'
|
|
569
794
|
}
|
|
570
795
|
],
|
|
571
|
-
selector: 'button[kendoButton], span[kendoButton]'
|
|
796
|
+
selector: 'button[kendoButton], span[kendoButton]',
|
|
572
797
|
}),
|
|
573
798
|
__param(2, Optional()),
|
|
574
799
|
__metadata("design:paramtypes", [ElementRef,
|
|
@@ -578,46 +803,6 @@ ButtonDirective = __decorate([
|
|
|
578
803
|
NgZone])
|
|
579
804
|
], ButtonDirective);
|
|
580
805
|
|
|
581
|
-
/* tslint:disable:no-null-keyword */
|
|
582
|
-
/* tslint:disable:no-bitwise */
|
|
583
|
-
const resolvedPromise = Promise.resolve(null);
|
|
584
|
-
/**
|
|
585
|
-
* @hidden
|
|
586
|
-
*/
|
|
587
|
-
const isPresent = (value) => value !== null && value !== undefined;
|
|
588
|
-
/**
|
|
589
|
-
* @hidden
|
|
590
|
-
*/
|
|
591
|
-
const tick = (f) => (resolvedPromise.then(f));
|
|
592
|
-
/**
|
|
593
|
-
* @hidden
|
|
594
|
-
*/
|
|
595
|
-
function isDocumentNode(container) {
|
|
596
|
-
return container.nodeType === 9;
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* @hidden
|
|
600
|
-
*/
|
|
601
|
-
function closest(element, selector) {
|
|
602
|
-
if (element.closest) {
|
|
603
|
-
return element.closest(selector);
|
|
604
|
-
}
|
|
605
|
-
const matches = Element.prototype.matches ?
|
|
606
|
-
(el, sel) => el.matches(sel)
|
|
607
|
-
: (el, sel) => el.msMatchesSelector(sel);
|
|
608
|
-
let node = element;
|
|
609
|
-
while (node && !isDocumentNode(node)) {
|
|
610
|
-
if (matches(node, selector)) {
|
|
611
|
-
return node;
|
|
612
|
-
}
|
|
613
|
-
node = node.parentNode;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* @hidden
|
|
618
|
-
*/
|
|
619
|
-
const replaceMessagePlaceholder = (message, name, value) => message.replace(new RegExp(`\{\\s*${name}\\s*\}`, 'g'), value);
|
|
620
|
-
|
|
621
806
|
/**
|
|
622
807
|
* @hidden
|
|
623
808
|
*/
|
|
@@ -657,17 +842,6 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
657
842
|
* By default, the selection mode of the ButtonGroup is set to `multiple`.
|
|
658
843
|
*/
|
|
659
844
|
this.selection = 'multiple';
|
|
660
|
-
/**
|
|
661
|
-
* Changes the visual appearance by using alternative styling options
|
|
662
|
-
* ([more information and examples]({% slug styling_buttongroup %})).
|
|
663
|
-
* The `look` property of the ButtonGroup takes precedence over the `look` property
|
|
664
|
-
* of the individual buttons that are part of the group.
|
|
665
|
-
*
|
|
666
|
-
* The available values are:
|
|
667
|
-
* * `flat`
|
|
668
|
-
* * `outline`
|
|
669
|
-
*/
|
|
670
|
-
this.look = 'default';
|
|
671
845
|
/**
|
|
672
846
|
* Fires every time keyboard navigation occurs.
|
|
673
847
|
*/
|
|
@@ -695,15 +869,6 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
695
869
|
get stretchedClass() {
|
|
696
870
|
return !!this.width;
|
|
697
871
|
}
|
|
698
|
-
get isFlat() {
|
|
699
|
-
return this.look === 'flat';
|
|
700
|
-
}
|
|
701
|
-
get isBare() {
|
|
702
|
-
return this.look === 'bare';
|
|
703
|
-
}
|
|
704
|
-
get isOutline() {
|
|
705
|
-
return this.look === 'outline';
|
|
706
|
-
}
|
|
707
872
|
get getRole() {
|
|
708
873
|
return this.isSelectionSingle() ? 'radiogroup' : 'group';
|
|
709
874
|
}
|
|
@@ -748,7 +913,6 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
748
913
|
}
|
|
749
914
|
}
|
|
750
915
|
ngOnInit() {
|
|
751
|
-
this.service.setButtonLook(this.look);
|
|
752
916
|
this.subscription = this.service.buttonClicked$.subscribe((button) => {
|
|
753
917
|
let newSelectionValue;
|
|
754
918
|
if (this.isSelectionSingle()) {
|
|
@@ -868,10 +1032,6 @@ __decorate([
|
|
|
868
1032
|
Input('width'),
|
|
869
1033
|
__metadata("design:type", String)
|
|
870
1034
|
], ButtonGroupComponent.prototype, "width", void 0);
|
|
871
|
-
__decorate([
|
|
872
|
-
Input(),
|
|
873
|
-
__metadata("design:type", String)
|
|
874
|
-
], ButtonGroupComponent.prototype, "look", void 0);
|
|
875
1035
|
__decorate([
|
|
876
1036
|
Input(),
|
|
877
1037
|
__metadata("design:type", Number),
|
|
@@ -891,7 +1051,7 @@ __decorate([
|
|
|
891
1051
|
__metadata("design:paramtypes", [])
|
|
892
1052
|
], ButtonGroupComponent.prototype, "wrapperClass", null);
|
|
893
1053
|
__decorate([
|
|
894
|
-
HostBinding('class.k-
|
|
1054
|
+
HostBinding('class.k-disabled'),
|
|
895
1055
|
__metadata("design:type", Boolean),
|
|
896
1056
|
__metadata("design:paramtypes", [])
|
|
897
1057
|
], ButtonGroupComponent.prototype, "disabledClass", null);
|
|
@@ -900,21 +1060,6 @@ __decorate([
|
|
|
900
1060
|
__metadata("design:type", Boolean),
|
|
901
1061
|
__metadata("design:paramtypes", [])
|
|
902
1062
|
], ButtonGroupComponent.prototype, "stretchedClass", null);
|
|
903
|
-
__decorate([
|
|
904
|
-
HostBinding('class.k-button-group-flat'),
|
|
905
|
-
__metadata("design:type", Boolean),
|
|
906
|
-
__metadata("design:paramtypes", [])
|
|
907
|
-
], ButtonGroupComponent.prototype, "isFlat", null);
|
|
908
|
-
__decorate([
|
|
909
|
-
HostBinding('class.k-button-group-bare'),
|
|
910
|
-
__metadata("design:type", Boolean),
|
|
911
|
-
__metadata("design:paramtypes", [])
|
|
912
|
-
], ButtonGroupComponent.prototype, "isBare", null);
|
|
913
|
-
__decorate([
|
|
914
|
-
HostBinding('class.k-button-group-outline'),
|
|
915
|
-
__metadata("design:type", Boolean),
|
|
916
|
-
__metadata("design:paramtypes", [])
|
|
917
|
-
], ButtonGroupComponent.prototype, "isOutline", null);
|
|
918
1063
|
__decorate([
|
|
919
1064
|
HostBinding('attr.role'),
|
|
920
1065
|
__metadata("design:type", String),
|
|
@@ -1104,8 +1249,17 @@ let ListComponent = class ListComponent {
|
|
|
1104
1249
|
constructor() {
|
|
1105
1250
|
this.onItemClick = new EventEmitter();
|
|
1106
1251
|
this.onItemBlur = new EventEmitter();
|
|
1252
|
+
this.sizeClass = '';
|
|
1107
1253
|
validatePackage(packageMetadata);
|
|
1108
1254
|
}
|
|
1255
|
+
set size(size) {
|
|
1256
|
+
if (size) {
|
|
1257
|
+
this.sizeClass = `k-menu-group-${SIZES[size]}`;
|
|
1258
|
+
}
|
|
1259
|
+
else {
|
|
1260
|
+
this.sizeClass = '';
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1109
1263
|
getText(dataItem) {
|
|
1110
1264
|
if (dataItem) {
|
|
1111
1265
|
return this.textField ? dataItem[this.textField] : dataItem.text || dataItem;
|
|
@@ -1145,37 +1299,44 @@ __decorate([
|
|
|
1145
1299
|
Output(),
|
|
1146
1300
|
__metadata("design:type", EventEmitter)
|
|
1147
1301
|
], ListComponent.prototype, "onItemBlur", void 0);
|
|
1302
|
+
__decorate([
|
|
1303
|
+
Input(),
|
|
1304
|
+
__metadata("design:type", String),
|
|
1305
|
+
__metadata("design:paramtypes", [String])
|
|
1306
|
+
], ListComponent.prototype, "size", null);
|
|
1148
1307
|
ListComponent = __decorate([
|
|
1149
1308
|
Component({
|
|
1150
1309
|
selector: 'kendo-button-list',
|
|
1151
1310
|
template: `
|
|
1152
|
-
<ul class="k-
|
|
1153
|
-
<li role="menuitem" unselectable="on"
|
|
1311
|
+
<ul class="k-group k-menu-group k-reset" [ngClass]="sizeClass" unselectable="on" role="menu">
|
|
1312
|
+
<li role="menuitem" unselectable="on"
|
|
1154
1313
|
kendoButtonFocusable
|
|
1155
1314
|
*ngFor="let dataItem of data; let index = index;"
|
|
1156
|
-
|
|
1157
|
-
[ngClass]="{'k-item': true, 'k-state-disabled': dataItem.disabled}"
|
|
1315
|
+
class="k-item k-menu-item"
|
|
1158
1316
|
(click)="onClick(index)"
|
|
1159
1317
|
(blur)="onBlur()"
|
|
1160
1318
|
[attr.aria-disabled]="dataItem.disabled ? true : false">
|
|
1161
|
-
<ng-template
|
|
1162
|
-
[
|
|
1163
|
-
templateRef: itemTemplate?.templateRef,
|
|
1164
|
-
|
|
1165
|
-
}">
|
|
1319
|
+
<ng-template [ngIf]="itemTemplate?.templateRef">
|
|
1320
|
+
<span kendoButtonFocusable [index]="index" class="k-link k-menu-link" [class.k-disabled]="dataItem.disabled" tabindex="-1">
|
|
1321
|
+
<ng-template [templateContext]="{templateRef: itemTemplate?.templateRef, $implicit: dataItem}"></ng-template>
|
|
1322
|
+
</span>
|
|
1166
1323
|
</ng-template>
|
|
1167
1324
|
<ng-template [ngIf]="!itemTemplate?.templateRef">
|
|
1168
|
-
<span
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1325
|
+
<span kendoButtonFocusable [index]="index" class="k-link k-menu-link" [class.k-disabled]="dataItem.disabled" tabindex="-1">
|
|
1326
|
+
<span
|
|
1327
|
+
*ngIf="dataItem.icon || dataItem.iconClass"
|
|
1328
|
+
[ngClass]="getIconClasses(dataItem)"
|
|
1329
|
+
></span>
|
|
1330
|
+
<img
|
|
1331
|
+
*ngIf="dataItem.imageUrl"
|
|
1332
|
+
class="k-image"
|
|
1333
|
+
[src]="dataItem.imageUrl"
|
|
1334
|
+
alt=""
|
|
1335
|
+
>
|
|
1336
|
+
<span *ngIf="getText(dataItem)" class="k-menu-link-text">
|
|
1337
|
+
{{ getText(dataItem) }}
|
|
1338
|
+
</span>
|
|
1339
|
+
</span>
|
|
1179
1340
|
</ng-template>
|
|
1180
1341
|
</li>
|
|
1181
1342
|
</ul>
|
|
@@ -1231,10 +1392,10 @@ let FocusableDirective = class FocusableDirective {
|
|
|
1231
1392
|
}
|
|
1232
1393
|
ngOnInit() {
|
|
1233
1394
|
if (this.index === this.focusService.focused) {
|
|
1234
|
-
this.renderer.addClass(this.element, 'k-
|
|
1395
|
+
this.renderer.addClass(this.element, 'k-focus');
|
|
1235
1396
|
}
|
|
1236
1397
|
else {
|
|
1237
|
-
this.renderer.removeClass(this.element, 'k-
|
|
1398
|
+
this.renderer.removeClass(this.element, 'k-focus');
|
|
1238
1399
|
}
|
|
1239
1400
|
}
|
|
1240
1401
|
/**
|
|
@@ -1249,11 +1410,11 @@ let FocusableDirective = class FocusableDirective {
|
|
|
1249
1410
|
}
|
|
1250
1411
|
this.focusSubscription = this.focusService.onFocus.subscribe((index) => {
|
|
1251
1412
|
if (this.index === index) {
|
|
1252
|
-
this.renderer.addClass(this.element, 'k-
|
|
1413
|
+
this.renderer.addClass(this.element, 'k-focus');
|
|
1253
1414
|
this.element.focus();
|
|
1254
1415
|
}
|
|
1255
1416
|
else {
|
|
1256
|
-
this.renderer.removeClass(this.element, 'k-
|
|
1417
|
+
this.renderer.removeClass(this.element, 'k-focus');
|
|
1257
1418
|
}
|
|
1258
1419
|
});
|
|
1259
1420
|
}
|
|
@@ -1375,7 +1536,7 @@ class ListButton {
|
|
|
1375
1536
|
this.subscribeEvents();
|
|
1376
1537
|
}
|
|
1377
1538
|
get popupClasses() {
|
|
1378
|
-
const popupClasses = ['k-
|
|
1539
|
+
const popupClasses = ['k-menu-popup'];
|
|
1379
1540
|
if (this._popupSettings.popupClass) {
|
|
1380
1541
|
popupClasses.push(this._popupSettings.popupClass);
|
|
1381
1542
|
}
|
|
@@ -1719,11 +1880,12 @@ const NAVIGATION_SETTINGS_PROVIDER = {
|
|
|
1719
1880
|
* ```
|
|
1720
1881
|
*/
|
|
1721
1882
|
let SplitButtonComponent = class SplitButtonComponent extends ListButton {
|
|
1722
|
-
constructor(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr) {
|
|
1883
|
+
constructor(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr, renderer) {
|
|
1723
1884
|
super(focusService, navigationService, wrapperRef, zone, localization, cdr);
|
|
1724
1885
|
this.popupService = popupService;
|
|
1725
1886
|
this.elRef = elRef;
|
|
1726
1887
|
this.localization = localization;
|
|
1888
|
+
this.renderer = renderer;
|
|
1727
1889
|
/**
|
|
1728
1890
|
* Sets the text of the SplitButton.
|
|
1729
1891
|
*/
|
|
@@ -1748,13 +1910,46 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
|
|
|
1748
1910
|
*/
|
|
1749
1911
|
this.imageUrl = '';
|
|
1750
1912
|
/**
|
|
1751
|
-
*
|
|
1913
|
+
* The size property specifies the width and height of the SplitButton
|
|
1914
|
+
* ([see example]({% slug api_buttons_splitbuttoncomponent %}#toc-size)).
|
|
1915
|
+
*
|
|
1916
|
+
* The possible values are:
|
|
1917
|
+
* * `'small'`
|
|
1918
|
+
* * `'medium'` (default)
|
|
1919
|
+
* * `'large'`
|
|
1920
|
+
* * `null`
|
|
1921
|
+
*/
|
|
1922
|
+
this.size = 'medium';
|
|
1923
|
+
/**
|
|
1924
|
+
* The fillMode property specifies the background and border styles of the SplitButton
|
|
1925
|
+
* ([see example]({% slug api_buttons_splitbuttoncomponent %}#toc-fillMode)).
|
|
1752
1926
|
*
|
|
1753
1927
|
* The available values are:
|
|
1928
|
+
* * `solid` (default)
|
|
1754
1929
|
* * `flat`
|
|
1755
1930
|
* * `outline`
|
|
1931
|
+
* * `link`
|
|
1932
|
+
*/
|
|
1933
|
+
this.fillMode = 'solid';
|
|
1934
|
+
/**
|
|
1935
|
+
* The SplitButton allows you to specify predefined theme colors.
|
|
1936
|
+
* The theme color will be applied as a background and border color while also amending the text color accordingly
|
|
1937
|
+
* ([see example]({% slug api_buttons_splitbuttoncomponent %}#toc-themeColor)).
|
|
1938
|
+
*
|
|
1939
|
+
* The possible values are:
|
|
1940
|
+
* * `base` —Applies coloring based on the `base` theme color. (default)
|
|
1941
|
+
* * `primary` —Applies coloring based on the `primary` theme color.
|
|
1942
|
+
* * `secondary`—Applies coloring based on the `secondary` theme color.
|
|
1943
|
+
* * `tertiary`— Applies coloring based on the `tertiary` theme color.
|
|
1944
|
+
* * `info`—Applies coloring based on the `info` theme color.
|
|
1945
|
+
* * `success`— Applies coloring based on the `success` theme color.
|
|
1946
|
+
* * `warning`— Applies coloring based on the `warning` theme color.
|
|
1947
|
+
* * `error`— Applies coloring based on the `error` theme color.
|
|
1948
|
+
* * `dark`— Applies coloring based on the `dark` theme color.
|
|
1949
|
+
* * `light`— Applies coloring based on the `light` theme color.
|
|
1950
|
+
* * `inverse`— Applies coloring based on the `inverse` theme color.
|
|
1756
1951
|
*/
|
|
1757
|
-
this.
|
|
1952
|
+
this.themeColor = 'base';
|
|
1758
1953
|
/**
|
|
1759
1954
|
* Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
1760
1955
|
*/
|
|
@@ -1839,9 +2034,28 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
|
|
|
1839
2034
|
this.activeArrow = false;
|
|
1840
2035
|
this.buttonText = '';
|
|
1841
2036
|
this.lockFocus = false;
|
|
2037
|
+
this._rounded = 'medium';
|
|
1842
2038
|
this._itemClick = this.itemClick;
|
|
1843
2039
|
this._blur = this.onBlur;
|
|
1844
2040
|
}
|
|
2041
|
+
/**
|
|
2042
|
+
* The rounded property specifies the border radius of the SplitButton
|
|
2043
|
+
* ([see example]({% slug api_buttons_splitbuttoncomponent %}#toc-rounded)).
|
|
2044
|
+
*
|
|
2045
|
+
* The possible values are:
|
|
2046
|
+
* * `'small'`
|
|
2047
|
+
* * `'medium'` (default)
|
|
2048
|
+
* * `'large'`
|
|
2049
|
+
* * `'full'`
|
|
2050
|
+
* * `null`
|
|
2051
|
+
*/
|
|
2052
|
+
set rounded(rounded) {
|
|
2053
|
+
this.handleClasses(rounded, 'rounded');
|
|
2054
|
+
this._rounded = rounded;
|
|
2055
|
+
}
|
|
2056
|
+
get rounded() {
|
|
2057
|
+
return this._rounded;
|
|
2058
|
+
}
|
|
1845
2059
|
/**
|
|
1846
2060
|
* When set to `true`, disables a SplitButton item
|
|
1847
2061
|
* ([see example]({% slug databinding_splitbutton %}#toc-arrays-of-complex-data)).
|
|
@@ -1927,12 +2141,6 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
|
|
|
1927
2141
|
get isFocused() {
|
|
1928
2142
|
return this._isFocused && !this._disabled;
|
|
1929
2143
|
}
|
|
1930
|
-
get isFlat() {
|
|
1931
|
-
return this.look === 'flat';
|
|
1932
|
-
}
|
|
1933
|
-
get isOutline() {
|
|
1934
|
-
return this.look === 'outline';
|
|
1935
|
-
}
|
|
1936
2144
|
get widgetClasses() {
|
|
1937
2145
|
return true;
|
|
1938
2146
|
}
|
|
@@ -2019,6 +2227,7 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
|
|
|
2019
2227
|
*/
|
|
2020
2228
|
ngAfterViewInit() {
|
|
2021
2229
|
this.updateButtonText();
|
|
2230
|
+
this.handleClasses(this.rounded, 'rounded');
|
|
2022
2231
|
}
|
|
2023
2232
|
/**
|
|
2024
2233
|
* @hidden
|
|
@@ -2166,6 +2375,16 @@ let SplitButtonComponent = class SplitButtonComponent extends ListButton {
|
|
|
2166
2375
|
this.popupRef = null;
|
|
2167
2376
|
}
|
|
2168
2377
|
}
|
|
2378
|
+
handleClasses(value, input) {
|
|
2379
|
+
const elem = this.wrapperRef.nativeElement;
|
|
2380
|
+
const classes = getStylingClasses('button', input, this[input], value);
|
|
2381
|
+
if (classes.toRemove) {
|
|
2382
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
2383
|
+
}
|
|
2384
|
+
if (classes.toAdd) {
|
|
2385
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2169
2388
|
};
|
|
2170
2389
|
__decorate([
|
|
2171
2390
|
Input(),
|
|
@@ -2190,7 +2409,20 @@ __decorate([
|
|
|
2190
2409
|
__decorate([
|
|
2191
2410
|
Input(),
|
|
2192
2411
|
__metadata("design:type", String)
|
|
2193
|
-
], SplitButtonComponent.prototype, "
|
|
2412
|
+
], SplitButtonComponent.prototype, "size", void 0);
|
|
2413
|
+
__decorate([
|
|
2414
|
+
Input(),
|
|
2415
|
+
__metadata("design:type", String),
|
|
2416
|
+
__metadata("design:paramtypes", [String])
|
|
2417
|
+
], SplitButtonComponent.prototype, "rounded", null);
|
|
2418
|
+
__decorate([
|
|
2419
|
+
Input(),
|
|
2420
|
+
__metadata("design:type", String)
|
|
2421
|
+
], SplitButtonComponent.prototype, "fillMode", void 0);
|
|
2422
|
+
__decorate([
|
|
2423
|
+
Input(),
|
|
2424
|
+
__metadata("design:type", String)
|
|
2425
|
+
], SplitButtonComponent.prototype, "themeColor", void 0);
|
|
2194
2426
|
__decorate([
|
|
2195
2427
|
Input(),
|
|
2196
2428
|
__metadata("design:type", Boolean),
|
|
@@ -2271,20 +2503,10 @@ __decorate([
|
|
|
2271
2503
|
__metadata("design:type", ViewContainerRef)
|
|
2272
2504
|
], SplitButtonComponent.prototype, "containerRef", void 0);
|
|
2273
2505
|
__decorate([
|
|
2274
|
-
HostBinding('class.k-
|
|
2506
|
+
HostBinding('class.k-focus'),
|
|
2275
2507
|
__metadata("design:type", Boolean),
|
|
2276
2508
|
__metadata("design:paramtypes", [Boolean])
|
|
2277
2509
|
], SplitButtonComponent.prototype, "isFocused", null);
|
|
2278
|
-
__decorate([
|
|
2279
|
-
HostBinding('class.k-flat'),
|
|
2280
|
-
__metadata("design:type", Boolean),
|
|
2281
|
-
__metadata("design:paramtypes", [])
|
|
2282
|
-
], SplitButtonComponent.prototype, "isFlat", null);
|
|
2283
|
-
__decorate([
|
|
2284
|
-
HostBinding('class.k-outline'),
|
|
2285
|
-
__metadata("design:type", Boolean),
|
|
2286
|
-
__metadata("design:paramtypes", [])
|
|
2287
|
-
], SplitButtonComponent.prototype, "isOutline", null);
|
|
2288
2510
|
__decorate([
|
|
2289
2511
|
HostBinding('class.k-split-button'),
|
|
2290
2512
|
HostBinding('class.k-button-group'),
|
|
@@ -2337,11 +2559,15 @@ SplitButtonComponent = __decorate([
|
|
|
2337
2559
|
kendoButton
|
|
2338
2560
|
#button
|
|
2339
2561
|
[type]="type"
|
|
2340
|
-
[look]="look"
|
|
2341
2562
|
[tabindex]="componentTabIndex"
|
|
2342
2563
|
[disabled]="disabled"
|
|
2564
|
+
[size]="size"
|
|
2565
|
+
[rounded]="rounded"
|
|
2566
|
+
[fillMode]="fillMode"
|
|
2567
|
+
[themeColor]="themeColor"
|
|
2343
2568
|
[icon]="icon"
|
|
2344
|
-
[class.k-
|
|
2569
|
+
[class.k-active]="active"
|
|
2570
|
+
[class.k-icon-button]="!text && icon"
|
|
2345
2571
|
[iconClass]="iconClass"
|
|
2346
2572
|
[imageUrl]="imageUrl"
|
|
2347
2573
|
[ngClass]="buttonClass"
|
|
@@ -2356,16 +2582,21 @@ SplitButtonComponent = __decorate([
|
|
|
2356
2582
|
[attr.aria-owns]="listId"
|
|
2357
2583
|
[attr.aria-label]="ariaLabel"
|
|
2358
2584
|
>
|
|
2359
|
-
|
|
2585
|
+
<span *ngIf="text" class="k-button-text">
|
|
2586
|
+
{{ text }}
|
|
2587
|
+
</span><ng-content></ng-content>
|
|
2360
2588
|
</button>
|
|
2361
2589
|
<button
|
|
2362
2590
|
kendoButton
|
|
2363
2591
|
#arrowButton
|
|
2364
2592
|
type="button"
|
|
2365
|
-
[class.k-
|
|
2593
|
+
[class.k-active]="activeArrow"
|
|
2366
2594
|
[disabled]="disabled"
|
|
2367
2595
|
[icon]="arrowButtonIcon"
|
|
2368
|
-
[
|
|
2596
|
+
[size]="size"
|
|
2597
|
+
[rounded]="rounded"
|
|
2598
|
+
[fillMode]="fillMode"
|
|
2599
|
+
[themeColor]="fillMode ? themeColor : null"
|
|
2369
2600
|
[tabindex]="-1"
|
|
2370
2601
|
[ngClass]="arrowButtonClass"
|
|
2371
2602
|
(click)="onArrowButtonClick()"
|
|
@@ -2383,6 +2614,7 @@ SplitButtonComponent = __decorate([
|
|
|
2383
2614
|
(keypress)="keyPressHandler($event)"
|
|
2384
2615
|
(keyup)="keyUpHandler($event)"
|
|
2385
2616
|
[attr.dir]="dir"
|
|
2617
|
+
[size]="size"
|
|
2386
2618
|
>
|
|
2387
2619
|
</kendo-button-list>
|
|
2388
2620
|
</ng-template>
|
|
@@ -2396,7 +2628,8 @@ SplitButtonComponent = __decorate([
|
|
|
2396
2628
|
PopupService,
|
|
2397
2629
|
ElementRef,
|
|
2398
2630
|
LocalizationService,
|
|
2399
|
-
ChangeDetectorRef
|
|
2631
|
+
ChangeDetectorRef,
|
|
2632
|
+
Renderer2])
|
|
2400
2633
|
], SplitButtonComponent);
|
|
2401
2634
|
|
|
2402
2635
|
/**
|
|
@@ -2532,17 +2765,70 @@ let DropDownButtonComponent = class DropDownButtonComponent extends ListButton {
|
|
|
2532
2765
|
*/
|
|
2533
2766
|
this.imageUrl = '';
|
|
2534
2767
|
/**
|
|
2535
|
-
*
|
|
2768
|
+
* The size property specifies the width and height of the DropDownButton
|
|
2769
|
+
* ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-size)).
|
|
2770
|
+
*
|
|
2771
|
+
* The possible values are:
|
|
2772
|
+
* * `'small'`
|
|
2773
|
+
* * `'medium'` (default)
|
|
2774
|
+
* * `'large'`
|
|
2775
|
+
* * `null`
|
|
2776
|
+
*/
|
|
2777
|
+
this.size = 'medium';
|
|
2778
|
+
/**
|
|
2779
|
+
* The shape property specifies if the DropDownButton will be a square or rectangle.
|
|
2780
|
+
* ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-shape)).
|
|
2781
|
+
*
|
|
2782
|
+
* The possible values are:
|
|
2783
|
+
* * `'rectangle'` (default)
|
|
2784
|
+
* * `'square'`
|
|
2785
|
+
* * `null`
|
|
2536
2786
|
*/
|
|
2537
|
-
this.
|
|
2787
|
+
this.shape = 'rectangle';
|
|
2538
2788
|
/**
|
|
2539
|
-
*
|
|
2789
|
+
* The rounded property specifies the border radius of the DropDownButton
|
|
2790
|
+
* ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-rounded)).
|
|
2791
|
+
*
|
|
2792
|
+
* The possible values are:
|
|
2793
|
+
* * `'small'`
|
|
2794
|
+
* * `'medium'` (default)
|
|
2795
|
+
* * `'large'`
|
|
2796
|
+
* * `'full'`
|
|
2797
|
+
* * `null`
|
|
2798
|
+
*/
|
|
2799
|
+
this.rounded = 'medium';
|
|
2800
|
+
/**
|
|
2801
|
+
* The fillMode property specifies the background and border styles of the DropDownButton
|
|
2802
|
+
* ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-fillMode)).
|
|
2540
2803
|
*
|
|
2541
2804
|
* The available values are:
|
|
2805
|
+
* * `solid` (default)
|
|
2542
2806
|
* * `flat`
|
|
2543
2807
|
* * `outline`
|
|
2808
|
+
* * `link`
|
|
2809
|
+
* * `null`
|
|
2810
|
+
*/
|
|
2811
|
+
this.fillMode = 'solid';
|
|
2812
|
+
/**
|
|
2813
|
+
* The DropDownButton allows you to specify predefined theme colors.
|
|
2814
|
+
* The theme color will be applied as a background and border color while also amending the text color accordingly
|
|
2815
|
+
* ([see example]({% slug api_buttons_dropdownbuttoncomponent %}#toc-themeColor)).
|
|
2816
|
+
*
|
|
2817
|
+
* The possible values are:
|
|
2818
|
+
* * `base` —Applies coloring based on the `base` theme color. (default)
|
|
2819
|
+
* * `primary` —Applies coloring based on the `primary` theme color.
|
|
2820
|
+
* * `secondary`—Applies coloring based on the `secondary` theme color.
|
|
2821
|
+
* * `tertiary`— Applies coloring based on the `tertiary` theme color.
|
|
2822
|
+
* * `info`—Applies coloring based on the `info` theme color.
|
|
2823
|
+
* * `success`— Applies coloring based on the `success` theme color.
|
|
2824
|
+
* * `warning`— Applies coloring based on the `warning` theme color.
|
|
2825
|
+
* * `error`— Applies coloring based on the `error` theme color.
|
|
2826
|
+
* * `dark`— Applies coloring based on the `dark` theme color.
|
|
2827
|
+
* * `light`— Applies coloring based on the `light` theme color.
|
|
2828
|
+
* * `inverse`— Applies coloring based on the `inverse` theme color.
|
|
2829
|
+
* * `null` —Removes the default CSS class (no class would be rendered).
|
|
2544
2830
|
*/
|
|
2545
|
-
this.
|
|
2831
|
+
this.themeColor = 'base';
|
|
2546
2832
|
/**
|
|
2547
2833
|
* Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
2548
2834
|
*/
|
|
@@ -2652,12 +2938,6 @@ let DropDownButtonComponent = class DropDownButtonComponent extends ListButton {
|
|
|
2652
2938
|
get focused() {
|
|
2653
2939
|
return this._isFocused && !this._disabled;
|
|
2654
2940
|
}
|
|
2655
|
-
get isFlat() {
|
|
2656
|
-
return this.look === 'flat';
|
|
2657
|
-
}
|
|
2658
|
-
get isOutline() {
|
|
2659
|
-
return this.look === 'outline';
|
|
2660
|
-
}
|
|
2661
2941
|
get widgetClasses() {
|
|
2662
2942
|
return true;
|
|
2663
2943
|
}
|
|
@@ -2910,12 +3190,24 @@ __decorate([
|
|
|
2910
3190
|
], DropDownButtonComponent.prototype, "data", null);
|
|
2911
3191
|
__decorate([
|
|
2912
3192
|
Input(),
|
|
2913
|
-
__metadata("design:type",
|
|
2914
|
-
], DropDownButtonComponent.prototype, "
|
|
3193
|
+
__metadata("design:type", String)
|
|
3194
|
+
], DropDownButtonComponent.prototype, "size", void 0);
|
|
3195
|
+
__decorate([
|
|
3196
|
+
Input(),
|
|
3197
|
+
__metadata("design:type", String)
|
|
3198
|
+
], DropDownButtonComponent.prototype, "shape", void 0);
|
|
3199
|
+
__decorate([
|
|
3200
|
+
Input(),
|
|
3201
|
+
__metadata("design:type", String)
|
|
3202
|
+
], DropDownButtonComponent.prototype, "rounded", void 0);
|
|
2915
3203
|
__decorate([
|
|
2916
3204
|
Input(),
|
|
2917
3205
|
__metadata("design:type", String)
|
|
2918
|
-
], DropDownButtonComponent.prototype, "
|
|
3206
|
+
], DropDownButtonComponent.prototype, "fillMode", void 0);
|
|
3207
|
+
__decorate([
|
|
3208
|
+
Input(),
|
|
3209
|
+
__metadata("design:type", String)
|
|
3210
|
+
], DropDownButtonComponent.prototype, "themeColor", void 0);
|
|
2919
3211
|
__decorate([
|
|
2920
3212
|
Input(),
|
|
2921
3213
|
__metadata("design:type", Object)
|
|
@@ -2945,20 +3237,10 @@ __decorate([
|
|
|
2945
3237
|
__metadata("design:type", EventEmitter)
|
|
2946
3238
|
], DropDownButtonComponent.prototype, "onBlur", void 0);
|
|
2947
3239
|
__decorate([
|
|
2948
|
-
HostBinding('class.k-
|
|
3240
|
+
HostBinding('class.k-focus'),
|
|
2949
3241
|
__metadata("design:type", Boolean),
|
|
2950
3242
|
__metadata("design:paramtypes", [])
|
|
2951
3243
|
], DropDownButtonComponent.prototype, "focused", null);
|
|
2952
|
-
__decorate([
|
|
2953
|
-
HostBinding('class.k-flat'),
|
|
2954
|
-
__metadata("design:type", Boolean),
|
|
2955
|
-
__metadata("design:paramtypes", [])
|
|
2956
|
-
], DropDownButtonComponent.prototype, "isFlat", null);
|
|
2957
|
-
__decorate([
|
|
2958
|
-
HostBinding('class.k-outline'),
|
|
2959
|
-
__metadata("design:type", Boolean),
|
|
2960
|
-
__metadata("design:paramtypes", [])
|
|
2961
|
-
], DropDownButtonComponent.prototype, "isOutline", null);
|
|
2962
3244
|
__decorate([
|
|
2963
3245
|
HostBinding('class.k-dropdown-button'),
|
|
2964
3246
|
__metadata("design:type", Boolean),
|
|
@@ -3038,12 +3320,17 @@ DropDownButtonComponent = __decorate([
|
|
|
3038
3320
|
role="menu"
|
|
3039
3321
|
type="button"
|
|
3040
3322
|
[tabindex]="componentTabIndex"
|
|
3041
|
-
[class.k-
|
|
3323
|
+
[class.k-active]="active"
|
|
3042
3324
|
[disabled]="disabled"
|
|
3043
3325
|
[icon]="icon"
|
|
3044
3326
|
[iconClass]="iconClass"
|
|
3045
3327
|
[imageUrl]="imageUrl"
|
|
3046
3328
|
[ngClass]="buttonClass"
|
|
3329
|
+
[size]="size"
|
|
3330
|
+
[shape]="shape"
|
|
3331
|
+
[rounded]="rounded"
|
|
3332
|
+
[fillMode]="fillMode"
|
|
3333
|
+
[themeColor]="fillMode ? themeColor : null"
|
|
3047
3334
|
(click)="openPopup()"
|
|
3048
3335
|
(focus)="handleFocus()"
|
|
3049
3336
|
(blur)="onButtonBlur()"
|
|
@@ -3051,9 +3338,7 @@ DropDownButtonComponent = __decorate([
|
|
|
3051
3338
|
[attr.aria-expanded]="openState"
|
|
3052
3339
|
[attr.aria-haspopup]="true"
|
|
3053
3340
|
[attr.aria-owns]="listId"
|
|
3054
|
-
|
|
3055
|
-
[primary]="primary"
|
|
3056
|
-
>
|
|
3341
|
+
>
|
|
3057
3342
|
<ng-content></ng-content>
|
|
3058
3343
|
</button>
|
|
3059
3344
|
<ng-template #popupTemplate>
|
|
@@ -3068,6 +3353,7 @@ DropDownButtonComponent = __decorate([
|
|
|
3068
3353
|
(keypress)="keyPressHandler($event)"
|
|
3069
3354
|
(keyup)="keyUpHandler($event)"
|
|
3070
3355
|
[attr.dir]="dir"
|
|
3356
|
+
[size]="size"
|
|
3071
3357
|
>
|
|
3072
3358
|
</kendo-button-list>
|
|
3073
3359
|
</ng-template>
|
|
@@ -3111,38 +3397,20 @@ let ChipComponent = class ChipComponent {
|
|
|
3111
3397
|
this.renderer = renderer;
|
|
3112
3398
|
this.ngZone = ngZone;
|
|
3113
3399
|
this.localizationService = localizationService;
|
|
3114
|
-
/**
|
|
3115
|
-
* Changes the visual appearance by using alternative styling options.
|
|
3116
|
-
*
|
|
3117
|
-
* The available values are:
|
|
3118
|
-
* * `solid`
|
|
3119
|
-
* * `outline`
|
|
3120
|
-
* * `filled` (The `filled` option will be deprecated. To apply identical styling, use `solid` instead).
|
|
3121
|
-
* * `outlined` (The `outlined` option will be deprecated. To apply identical styling, use `outline` instead).
|
|
3122
|
-
*/
|
|
3123
|
-
this.look = 'solid';
|
|
3124
3400
|
/**
|
|
3125
3401
|
* Specifies the selected state of the Chip.
|
|
3402
|
+
* @default false
|
|
3126
3403
|
*/
|
|
3127
3404
|
this.selected = false;
|
|
3128
3405
|
/**
|
|
3129
3406
|
* Specifies if the Chip will be removable or not.
|
|
3130
3407
|
* If the property is set to `true`, the Chip renders a remove icon.
|
|
3408
|
+
* @default false
|
|
3131
3409
|
*/
|
|
3132
3410
|
this.removable = false;
|
|
3133
|
-
/**
|
|
3134
|
-
* Specifies the Chip type.
|
|
3135
|
-
*
|
|
3136
|
-
* The possible values are:
|
|
3137
|
-
* - `none` (default)
|
|
3138
|
-
* - `success`
|
|
3139
|
-
* - `error`
|
|
3140
|
-
* - `warning`
|
|
3141
|
-
* - `info`
|
|
3142
|
-
*/
|
|
3143
|
-
this.type = 'none';
|
|
3144
3411
|
/**
|
|
3145
3412
|
* If set to `true`, the Chip will be disabled.
|
|
3413
|
+
* @default false
|
|
3146
3414
|
*/
|
|
3147
3415
|
this.disabled = false;
|
|
3148
3416
|
/**
|
|
@@ -3155,21 +3423,90 @@ let ChipComponent = class ChipComponent {
|
|
|
3155
3423
|
this.contentClick = new EventEmitter();
|
|
3156
3424
|
this.tabIndex = 0;
|
|
3157
3425
|
this.hostClass = true;
|
|
3426
|
+
this._size = 'medium';
|
|
3427
|
+
this._rounded = 'medium';
|
|
3428
|
+
this._fillMode = 'solid';
|
|
3429
|
+
this._themeColor = 'base';
|
|
3158
3430
|
this.focused = false;
|
|
3159
3431
|
validatePackage(packageMetadata);
|
|
3160
3432
|
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
|
3161
3433
|
}
|
|
3162
|
-
|
|
3163
|
-
|
|
3434
|
+
/**
|
|
3435
|
+
* The size property specifies the height, padding and line height of the Chip
|
|
3436
|
+
* ([see example]({% slug appearance_chip %}#toc-size)).
|
|
3437
|
+
*
|
|
3438
|
+
* The possible values are:
|
|
3439
|
+
* * `'small'`
|
|
3440
|
+
* * `'medium'` (default)
|
|
3441
|
+
* * `'large'`
|
|
3442
|
+
* * `null`
|
|
3443
|
+
*/
|
|
3444
|
+
set size(size) {
|
|
3445
|
+
this.handleClasses(size, 'size');
|
|
3446
|
+
this._size = size;
|
|
3164
3447
|
}
|
|
3165
|
-
get
|
|
3166
|
-
return this.
|
|
3448
|
+
get size() {
|
|
3449
|
+
return this._size;
|
|
3450
|
+
}
|
|
3451
|
+
/**
|
|
3452
|
+
* The rounded property specifies the border radius of the Chip
|
|
3453
|
+
* ([see example]({% slug appearance_chip %}#toc-rounded)).
|
|
3454
|
+
*
|
|
3455
|
+
* The possible values are:
|
|
3456
|
+
* * `'small'`
|
|
3457
|
+
* * `'medium'` (default)
|
|
3458
|
+
* * `'large'`
|
|
3459
|
+
* * `'full'`
|
|
3460
|
+
* * `null`
|
|
3461
|
+
*/
|
|
3462
|
+
set rounded(rounded) {
|
|
3463
|
+
this.handleClasses(rounded, 'rounded');
|
|
3464
|
+
this._rounded = rounded;
|
|
3167
3465
|
}
|
|
3168
|
-
get
|
|
3169
|
-
return this.
|
|
3466
|
+
get rounded() {
|
|
3467
|
+
return this._rounded;
|
|
3468
|
+
}
|
|
3469
|
+
/**
|
|
3470
|
+
* The fillMode property specifies the background and border styles of the Chip
|
|
3471
|
+
* ([see example]({% slug appearance_chip %}#toc-fillMode)).
|
|
3472
|
+
*
|
|
3473
|
+
* The possible values are:
|
|
3474
|
+
* * `'solid'` (default)
|
|
3475
|
+
* * `'outline'`
|
|
3476
|
+
* * `null`
|
|
3477
|
+
*/
|
|
3478
|
+
set fillMode(fillMode) {
|
|
3479
|
+
this.handleClasses(fillMode, 'fillMode');
|
|
3480
|
+
this._fillMode = fillMode;
|
|
3481
|
+
}
|
|
3482
|
+
get fillMode() {
|
|
3483
|
+
return this._fillMode;
|
|
3484
|
+
}
|
|
3485
|
+
/**
|
|
3486
|
+
* The Chip allows you to specify predefined theme colors.
|
|
3487
|
+
* The theme color will be applied as a background and border color while also amending the text color accordingly
|
|
3488
|
+
* ([see example]({% slug appearance_chip %}#toc-themeColor)).
|
|
3489
|
+
*
|
|
3490
|
+
* The possible values are:
|
|
3491
|
+
* * `'base'` (default)
|
|
3492
|
+
* * `'info'`
|
|
3493
|
+
* * `'success'`
|
|
3494
|
+
* * `'warning'`
|
|
3495
|
+
* * `'error'`
|
|
3496
|
+
* * `null`
|
|
3497
|
+
*/
|
|
3498
|
+
set themeColor(themeColor) {
|
|
3499
|
+
this.handleThemeColor(themeColor);
|
|
3500
|
+
this._themeColor = themeColor;
|
|
3501
|
+
}
|
|
3502
|
+
get themeColor() {
|
|
3503
|
+
return this._themeColor;
|
|
3504
|
+
}
|
|
3505
|
+
get ariaChecked() {
|
|
3506
|
+
return this.selected;
|
|
3170
3507
|
}
|
|
3171
3508
|
get hasIconClass() {
|
|
3172
|
-
return this.icon || this.iconClass ? true : false;
|
|
3509
|
+
return this.icon || this.iconClass || this.avatarClass ? true : false;
|
|
3173
3510
|
}
|
|
3174
3511
|
get disabledClass() {
|
|
3175
3512
|
return this.disabled;
|
|
@@ -3194,54 +3531,41 @@ let ChipComponent = class ChipComponent {
|
|
|
3194
3531
|
}
|
|
3195
3532
|
ngAfterViewInit() {
|
|
3196
3533
|
const chip = this.element.nativeElement;
|
|
3197
|
-
const
|
|
3198
|
-
|
|
3199
|
-
this.
|
|
3200
|
-
}
|
|
3534
|
+
const stylingOptions = ['size', 'rounded', 'fillMode'];
|
|
3535
|
+
stylingOptions.forEach(input => {
|
|
3536
|
+
this.handleClasses(this[input], input);
|
|
3537
|
+
});
|
|
3201
3538
|
this.attachElementEventHandlers(chip);
|
|
3202
3539
|
}
|
|
3203
3540
|
/**
|
|
3204
3541
|
* @hidden
|
|
3205
3542
|
*/
|
|
3206
|
-
get
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
classes.push(`${this.iconClass}`);
|
|
3210
|
-
}
|
|
3211
|
-
if (this.icon) {
|
|
3212
|
-
classes.push(`k-icon k-i-${this.icon}`);
|
|
3213
|
-
}
|
|
3214
|
-
return classes;
|
|
3543
|
+
get kendoIconClass() {
|
|
3544
|
+
this.verifyIconSettings([this.iconClass, this.avatarClass]);
|
|
3545
|
+
return `k-i-${this.icon}`;
|
|
3215
3546
|
}
|
|
3216
3547
|
/**
|
|
3217
3548
|
* @hidden
|
|
3218
3549
|
*/
|
|
3219
|
-
get
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
}
|
|
3223
|
-
return `k-icon k-i-check`;
|
|
3550
|
+
get customIconClass() {
|
|
3551
|
+
this.verifyIconSettings([this.icon, this.avatarClass]);
|
|
3552
|
+
return `${this.iconClass}`;
|
|
3224
3553
|
}
|
|
3225
3554
|
/**
|
|
3226
3555
|
* @hidden
|
|
3227
3556
|
*/
|
|
3228
|
-
get
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
}
|
|
3232
|
-
return `k-icon k-i-close-circle`;
|
|
3557
|
+
get chipAvatarClass() {
|
|
3558
|
+
this.verifyIconSettings([this.icon, this.iconClass]);
|
|
3559
|
+
return `${this.avatarClass}`;
|
|
3233
3560
|
}
|
|
3234
3561
|
/**
|
|
3235
3562
|
* @hidden
|
|
3236
3563
|
*/
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
'error': 'k-chip-error',
|
|
3243
|
-
'info': 'k-chip-info'
|
|
3244
|
-
}[this.type];
|
|
3564
|
+
get removeIconClass() {
|
|
3565
|
+
if (this.removeIcon) {
|
|
3566
|
+
return `${this.removeIcon}`;
|
|
3567
|
+
}
|
|
3568
|
+
return `k-i-close-circle`;
|
|
3245
3569
|
}
|
|
3246
3570
|
/**
|
|
3247
3571
|
* Focuses the Chip component.
|
|
@@ -3276,7 +3600,7 @@ let ChipComponent = class ChipComponent {
|
|
|
3276
3600
|
this.renderer.removeClass(chip, 'k-focus');
|
|
3277
3601
|
});
|
|
3278
3602
|
const contentClickListener = this.renderer.listen(chip, 'click', (e) => {
|
|
3279
|
-
const isRemoveClicked = closest(e.target, '.k-remove-
|
|
3603
|
+
const isRemoveClicked = closest(e.target, '.k-chip-remove-action');
|
|
3280
3604
|
if (!isRemoveClicked) {
|
|
3281
3605
|
this.ngZone.run(() => {
|
|
3282
3606
|
this.contentClick.emit({ sender: this, originalEvent: e });
|
|
@@ -3290,11 +3614,43 @@ let ChipComponent = class ChipComponent {
|
|
|
3290
3614
|
};
|
|
3291
3615
|
});
|
|
3292
3616
|
}
|
|
3617
|
+
/**
|
|
3618
|
+
* @hidden
|
|
3619
|
+
*/
|
|
3620
|
+
verifyIconSettings(iconsToCheck) {
|
|
3621
|
+
if (isDevMode()) {
|
|
3622
|
+
if (iconsToCheck.filter(icon => icon !== null && icon !== undefined).length > 0) {
|
|
3623
|
+
this.renderer.removeClass(this.element.nativeElement, 'k-chip-has-icon');
|
|
3624
|
+
throw new Error('Invalid configuration: Having multiple icons is not supported. Only a single icon on a chip can be displayed.');
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
handleClasses(value, input) {
|
|
3629
|
+
const elem = this.element.nativeElement;
|
|
3630
|
+
const classes = getStylingClasses('chip', input, this[input], value);
|
|
3631
|
+
if (input === 'fillMode') {
|
|
3632
|
+
this.handleThemeColor(this.themeColor, this[input], value);
|
|
3633
|
+
}
|
|
3634
|
+
if (classes.toRemove) {
|
|
3635
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
3636
|
+
}
|
|
3637
|
+
if (classes.toAdd) {
|
|
3638
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
handleThemeColor(value, prevFillMode, fillMode) {
|
|
3642
|
+
const elem = this.element.nativeElement;
|
|
3643
|
+
const removeFillMode = prevFillMode ? prevFillMode : this.fillMode;
|
|
3644
|
+
const addFillMode = fillMode ? fillMode : this.fillMode;
|
|
3645
|
+
const themeColorClass = getThemeColorClasses('chip', removeFillMode, addFillMode, this.themeColor, value);
|
|
3646
|
+
this.renderer.removeClass(elem, themeColorClass.toRemove);
|
|
3647
|
+
if (addFillMode !== null && fillMode !== null) {
|
|
3648
|
+
if (themeColorClass.toAdd) {
|
|
3649
|
+
this.renderer.addClass(elem, themeColorClass.toAdd);
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3293
3653
|
};
|
|
3294
|
-
__decorate([
|
|
3295
|
-
Input(),
|
|
3296
|
-
__metadata("design:type", String)
|
|
3297
|
-
], ChipComponent.prototype, "look", void 0);
|
|
3298
3654
|
__decorate([
|
|
3299
3655
|
Input(),
|
|
3300
3656
|
__metadata("design:type", String)
|
|
@@ -3309,12 +3665,12 @@ __decorate([
|
|
|
3309
3665
|
], ChipComponent.prototype, "iconClass", void 0);
|
|
3310
3666
|
__decorate([
|
|
3311
3667
|
Input(),
|
|
3312
|
-
__metadata("design:type",
|
|
3313
|
-
], ChipComponent.prototype, "
|
|
3668
|
+
__metadata("design:type", String)
|
|
3669
|
+
], ChipComponent.prototype, "avatarClass", void 0);
|
|
3314
3670
|
__decorate([
|
|
3315
3671
|
Input(),
|
|
3316
|
-
__metadata("design:type",
|
|
3317
|
-
], ChipComponent.prototype, "
|
|
3672
|
+
__metadata("design:type", Boolean)
|
|
3673
|
+
], ChipComponent.prototype, "selected", void 0);
|
|
3318
3674
|
__decorate([
|
|
3319
3675
|
Input(),
|
|
3320
3676
|
__metadata("design:type", Boolean)
|
|
@@ -3323,14 +3679,30 @@ __decorate([
|
|
|
3323
3679
|
Input(),
|
|
3324
3680
|
__metadata("design:type", String)
|
|
3325
3681
|
], ChipComponent.prototype, "removeIcon", void 0);
|
|
3326
|
-
__decorate([
|
|
3327
|
-
Input(),
|
|
3328
|
-
__metadata("design:type", String)
|
|
3329
|
-
], ChipComponent.prototype, "type", void 0);
|
|
3330
3682
|
__decorate([
|
|
3331
3683
|
Input(),
|
|
3332
3684
|
__metadata("design:type", Boolean)
|
|
3333
3685
|
], ChipComponent.prototype, "disabled", void 0);
|
|
3686
|
+
__decorate([
|
|
3687
|
+
Input(),
|
|
3688
|
+
__metadata("design:type", String),
|
|
3689
|
+
__metadata("design:paramtypes", [String])
|
|
3690
|
+
], ChipComponent.prototype, "size", null);
|
|
3691
|
+
__decorate([
|
|
3692
|
+
Input(),
|
|
3693
|
+
__metadata("design:type", String),
|
|
3694
|
+
__metadata("design:paramtypes", [String])
|
|
3695
|
+
], ChipComponent.prototype, "rounded", null);
|
|
3696
|
+
__decorate([
|
|
3697
|
+
Input(),
|
|
3698
|
+
__metadata("design:type", String),
|
|
3699
|
+
__metadata("design:paramtypes", [String])
|
|
3700
|
+
], ChipComponent.prototype, "fillMode", null);
|
|
3701
|
+
__decorate([
|
|
3702
|
+
Input(),
|
|
3703
|
+
__metadata("design:type", String),
|
|
3704
|
+
__metadata("design:paramtypes", [String])
|
|
3705
|
+
], ChipComponent.prototype, "themeColor", null);
|
|
3334
3706
|
__decorate([
|
|
3335
3707
|
Output(),
|
|
3336
3708
|
__metadata("design:type", EventEmitter)
|
|
@@ -3352,16 +3724,6 @@ __decorate([
|
|
|
3352
3724
|
HostBinding('class.k-chip'),
|
|
3353
3725
|
__metadata("design:type", Boolean)
|
|
3354
3726
|
], ChipComponent.prototype, "hostClass", void 0);
|
|
3355
|
-
__decorate([
|
|
3356
|
-
HostBinding('class.k-chip-outline'),
|
|
3357
|
-
__metadata("design:type", Boolean),
|
|
3358
|
-
__metadata("design:paramtypes", [])
|
|
3359
|
-
], ChipComponent.prototype, "outlineClass", null);
|
|
3360
|
-
__decorate([
|
|
3361
|
-
HostBinding('class.k-chip-solid'),
|
|
3362
|
-
__metadata("design:type", Boolean),
|
|
3363
|
-
__metadata("design:paramtypes", [])
|
|
3364
|
-
], ChipComponent.prototype, "solidClass", null);
|
|
3365
3727
|
__decorate([
|
|
3366
3728
|
HostBinding('class.k-chip-has-icon'),
|
|
3367
3729
|
__metadata("design:type", Boolean),
|
|
@@ -3391,20 +3753,27 @@ ChipComponent = __decorate([
|
|
|
3391
3753
|
Component({
|
|
3392
3754
|
selector: 'kendo-chip',
|
|
3393
3755
|
template: `
|
|
3394
|
-
<span
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
</span>
|
|
3756
|
+
<span
|
|
3757
|
+
*ngIf="icon"
|
|
3758
|
+
class="k-chip-icon k-icon"
|
|
3759
|
+
[ngClass]="kendoIconClass"
|
|
3760
|
+
>
|
|
3400
3761
|
</span>
|
|
3401
3762
|
|
|
3402
|
-
<span
|
|
3763
|
+
<span
|
|
3764
|
+
*ngIf="iconClass"
|
|
3403
3765
|
class="k-chip-icon"
|
|
3404
|
-
[ngClass]="
|
|
3766
|
+
[ngClass]="customIconClass"
|
|
3405
3767
|
>
|
|
3406
3768
|
</span>
|
|
3407
3769
|
|
|
3770
|
+
<span
|
|
3771
|
+
*ngIf="avatarClass"
|
|
3772
|
+
class="k-chip-avatar k-avatar k-rounded-full"
|
|
3773
|
+
>
|
|
3774
|
+
<span class="k-avatar-image" [ngClass]="chipAvatarClass"></span>
|
|
3775
|
+
</span>
|
|
3776
|
+
|
|
3408
3777
|
<span class="k-chip-content">
|
|
3409
3778
|
<span class="k-chip-label" *ngIf="label">
|
|
3410
3779
|
{{ label }}
|
|
@@ -3412,11 +3781,17 @@ ChipComponent = __decorate([
|
|
|
3412
3781
|
<ng-content *ngIf="!label"></ng-content>
|
|
3413
3782
|
</span>
|
|
3414
3783
|
|
|
3415
|
-
<span
|
|
3416
|
-
class="k-remove-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3784
|
+
<span class="k-chip-actions">
|
|
3785
|
+
<span class="k-chip-action k-chip-remove-action"
|
|
3786
|
+
*ngIf="removable"
|
|
3787
|
+
(click)="onRemoveClick($event)"
|
|
3788
|
+
>
|
|
3789
|
+
<span
|
|
3790
|
+
class="k-icon"
|
|
3791
|
+
[ngClass]="removeIconClass"
|
|
3792
|
+
>
|
|
3793
|
+
</span>
|
|
3794
|
+
</span>
|
|
3420
3795
|
</span>
|
|
3421
3796
|
`,
|
|
3422
3797
|
providers: [
|
|
@@ -3434,9 +3809,10 @@ ChipComponent = __decorate([
|
|
|
3434
3809
|
], ChipComponent);
|
|
3435
3810
|
|
|
3436
3811
|
let ChipListComponent = class ChipListComponent {
|
|
3437
|
-
constructor(localizationService, renderer) {
|
|
3812
|
+
constructor(localizationService, renderer, element) {
|
|
3438
3813
|
this.localizationService = localizationService;
|
|
3439
3814
|
this.renderer = renderer;
|
|
3815
|
+
this.element = element;
|
|
3440
3816
|
this.hostClass = true;
|
|
3441
3817
|
/**
|
|
3442
3818
|
* Sets the selection mode of the ChipList.
|
|
@@ -3456,8 +3832,26 @@ let ChipListComponent = class ChipListComponent {
|
|
|
3456
3832
|
*/
|
|
3457
3833
|
this.remove = new EventEmitter();
|
|
3458
3834
|
this.role = 'listbox';
|
|
3835
|
+
this._size = 'medium';
|
|
3459
3836
|
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
|
3460
3837
|
}
|
|
3838
|
+
/**
|
|
3839
|
+
* The size property specifies the gap between the Chips in the ChipList
|
|
3840
|
+
* ([see example]({% slug appearance_chiplist %}#toc-size)).
|
|
3841
|
+
*
|
|
3842
|
+
* The possible values are:
|
|
3843
|
+
* * `'small'`
|
|
3844
|
+
* * `'medium'` (default)
|
|
3845
|
+
* * `'large'`
|
|
3846
|
+
* * `null`
|
|
3847
|
+
*/
|
|
3848
|
+
set size(size) {
|
|
3849
|
+
this.handleClasses(size, 'size');
|
|
3850
|
+
this._size = size;
|
|
3851
|
+
}
|
|
3852
|
+
get size() {
|
|
3853
|
+
return this._size;
|
|
3854
|
+
}
|
|
3461
3855
|
get single() {
|
|
3462
3856
|
return this.selection === 'single';
|
|
3463
3857
|
}
|
|
@@ -3469,7 +3863,7 @@ let ChipListComponent = class ChipListComponent {
|
|
|
3469
3863
|
*/
|
|
3470
3864
|
onClick($event) {
|
|
3471
3865
|
const target = $event.target;
|
|
3472
|
-
const isRemoveClicked = closest(target, '.k-remove-
|
|
3866
|
+
const isRemoveClicked = closest(target, '.k-chip-remove-action');
|
|
3473
3867
|
const clickedChip = closest(target, '.k-chip');
|
|
3474
3868
|
const chip = this.chips.find((chip) => clickedChip === chip.element.nativeElement);
|
|
3475
3869
|
if (isRemoveClicked && clickedChip) {
|
|
@@ -3484,6 +3878,12 @@ let ChipListComponent = class ChipListComponent {
|
|
|
3484
3878
|
this.dynamicRTLSubscription = this.localizationService.changes
|
|
3485
3879
|
.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr');
|
|
3486
3880
|
}
|
|
3881
|
+
ngAfterViewInit() {
|
|
3882
|
+
const stylingInputs = ['size'];
|
|
3883
|
+
stylingInputs.forEach(input => {
|
|
3884
|
+
this.handleClasses(this[input], input);
|
|
3885
|
+
});
|
|
3886
|
+
}
|
|
3487
3887
|
ngAfterContentInit() {
|
|
3488
3888
|
this.chips.forEach((chip) => {
|
|
3489
3889
|
this.renderer.setAttribute(chip.element.nativeElement, 'role', 'option');
|
|
@@ -3514,6 +3914,16 @@ let ChipListComponent = class ChipListComponent {
|
|
|
3514
3914
|
}
|
|
3515
3915
|
});
|
|
3516
3916
|
}
|
|
3917
|
+
handleClasses(value, input) {
|
|
3918
|
+
const elem = this.element.nativeElement;
|
|
3919
|
+
const classes = getStylingClasses('chip-list', input, this[input], value);
|
|
3920
|
+
if (classes.toRemove) {
|
|
3921
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
3922
|
+
}
|
|
3923
|
+
if (classes.toAdd) {
|
|
3924
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3517
3927
|
};
|
|
3518
3928
|
__decorate([
|
|
3519
3929
|
HostBinding('class.k-chip-list'),
|
|
@@ -3527,6 +3937,11 @@ __decorate([
|
|
|
3527
3937
|
Input(),
|
|
3528
3938
|
__metadata("design:type", String)
|
|
3529
3939
|
], ChipListComponent.prototype, "selection", void 0);
|
|
3940
|
+
__decorate([
|
|
3941
|
+
Input(),
|
|
3942
|
+
__metadata("design:type", String),
|
|
3943
|
+
__metadata("design:paramtypes", [String])
|
|
3944
|
+
], ChipListComponent.prototype, "size", null);
|
|
3530
3945
|
__decorate([
|
|
3531
3946
|
Output(),
|
|
3532
3947
|
__metadata("design:type", EventEmitter)
|
|
@@ -3561,7 +3976,7 @@ __decorate([
|
|
|
3561
3976
|
], ChipListComponent.prototype, "onClick", null);
|
|
3562
3977
|
ChipListComponent = __decorate([
|
|
3563
3978
|
Component({
|
|
3564
|
-
selector: 'kendo-
|
|
3979
|
+
selector: 'kendo-chiplist, kendo-chip-list',
|
|
3565
3980
|
template: `
|
|
3566
3981
|
<ng-content></ng-content>
|
|
3567
3982
|
`,
|
|
@@ -3569,11 +3984,13 @@ ChipListComponent = __decorate([
|
|
|
3569
3984
|
LocalizationService,
|
|
3570
3985
|
{
|
|
3571
3986
|
provide: L10N_PREFIX,
|
|
3572
|
-
useValue: 'kendo.
|
|
3987
|
+
useValue: 'kendo.chiplist'
|
|
3573
3988
|
}
|
|
3574
3989
|
]
|
|
3575
3990
|
}),
|
|
3576
|
-
__metadata("design:paramtypes", [LocalizationService,
|
|
3991
|
+
__metadata("design:paramtypes", [LocalizationService,
|
|
3992
|
+
Renderer2,
|
|
3993
|
+
ElementRef])
|
|
3577
3994
|
], ChipListComponent);
|
|
3578
3995
|
|
|
3579
3996
|
const exportedModules = [
|
|
@@ -3737,12 +4154,16 @@ const SIZE_CLASSES = {
|
|
|
3737
4154
|
large: 'k-fab-lg'
|
|
3738
4155
|
};
|
|
3739
4156
|
const SHAPE_CLASSES = {
|
|
3740
|
-
pill: 'k-fab-pill',
|
|
3741
|
-
circle: 'k-fab-circle',
|
|
3742
4157
|
rectangle: 'k-fab-rectangle',
|
|
3743
|
-
square: 'k-fab-square'
|
|
3744
|
-
rounded: 'k-fab-rounded'
|
|
4158
|
+
square: 'k-fab-square'
|
|
3745
4159
|
};
|
|
4160
|
+
const ROUNDED_CLASSES = {
|
|
4161
|
+
small: 'k-rounded-sm',
|
|
4162
|
+
medium: 'k-rounded-md',
|
|
4163
|
+
large: 'k-rounded-lg',
|
|
4164
|
+
full: 'k-rounded-full'
|
|
4165
|
+
};
|
|
4166
|
+
const FILLMODE_CLASS = 'k-fab-solid';
|
|
3746
4167
|
const DEFAULT_DURATION = 180;
|
|
3747
4168
|
const DEFAULT_ITEM_GAP = 90;
|
|
3748
4169
|
const DEFAULT_OFFSET = '16px';
|
|
@@ -3822,13 +4243,15 @@ let FloatingActionButtonComponent = class FloatingActionButtonComponent {
|
|
|
3822
4243
|
this.id = `k-${guid()}`;
|
|
3823
4244
|
this._themeColor = 'primary';
|
|
3824
4245
|
this._size = 'medium';
|
|
3825
|
-
this._shape = '
|
|
4246
|
+
this._shape = 'rectangle';
|
|
3826
4247
|
this._disabled = false;
|
|
3827
4248
|
this._align = { horizontal: 'end', vertical: 'bottom' };
|
|
3828
4249
|
this._offset = { x: DEFAULT_OFFSET, y: DEFAULT_OFFSET };
|
|
4250
|
+
this._rounded = 'full';
|
|
3829
4251
|
this.subscriptions = new Subscription();
|
|
3830
4252
|
this.rtl = false;
|
|
3831
4253
|
this.animationEnd = new EventEmitter();
|
|
4254
|
+
this.initialSetup = true;
|
|
3832
4255
|
validatePackage(packageMetadata);
|
|
3833
4256
|
this.subscribeNavigationEvents();
|
|
3834
4257
|
this.subscriptions.add(this.localizationService.changes.subscribe(({ rtl }) => {
|
|
@@ -3848,18 +4271,16 @@ let FloatingActionButtonComponent = class FloatingActionButtonComponent {
|
|
|
3848
4271
|
* The theme color will be applied as background color of the component.
|
|
3849
4272
|
*
|
|
3850
4273
|
* The possible values are:
|
|
3851
|
-
* * `primary` (Default)—Applies coloring based on the `primary` theme color.
|
|
3852
|
-
* * `secondary`—Applies coloring based on the `secondary` theme color.
|
|
3853
|
-
* * `tertiary`— Applies coloring based on the `tertiary` theme color.
|
|
3854
|
-
* * `
|
|
3855
|
-
* * `
|
|
3856
|
-
* * `
|
|
3857
|
-
* * `
|
|
3858
|
-
* * `
|
|
3859
|
-
* * `
|
|
3860
|
-
* * `
|
|
3861
|
-
* * `inverse`— Applies coloring based on the `inverse` theme color.
|
|
3862
|
-
*
|
|
4274
|
+
* * `'primary'` (Default)—Applies coloring based on the `primary` theme color.
|
|
4275
|
+
* * `'secondary'`—Applies coloring based on the `secondary` theme color.
|
|
4276
|
+
* * `'tertiary'`— Applies coloring based on the `tertiary` theme color.
|
|
4277
|
+
* * `'info'`—Applies coloring based on the `info` theme color.
|
|
4278
|
+
* * `'success'`— Applies coloring based on the `success` theme color.
|
|
4279
|
+
* * `'warning'`— Applies coloring based on the `warning` theme color.
|
|
4280
|
+
* * `'error'`— Applies coloring based on the `error` theme color.
|
|
4281
|
+
* * `'dark'`— Applies coloring based on the `dark` theme color.
|
|
4282
|
+
* * `'light'`— Applies coloring based on the `light` theme color.
|
|
4283
|
+
* * `'inverse'`— Applies coloring based on the `inverse` theme color.
|
|
3863
4284
|
*/
|
|
3864
4285
|
set themeColor(themeColor) {
|
|
3865
4286
|
this.handleClasses(themeColor, 'themeColor');
|
|
@@ -3873,10 +4294,9 @@ let FloatingActionButtonComponent = class FloatingActionButtonComponent {
|
|
|
3873
4294
|
* ([see example]({% slug appearance_floatingactionbutton %}#toc-size)).
|
|
3874
4295
|
*
|
|
3875
4296
|
* The possible values are:
|
|
3876
|
-
* * `small`
|
|
3877
|
-
* * `medium` (Default)
|
|
3878
|
-
* * `large`
|
|
3879
|
-
*
|
|
4297
|
+
* * `'small'`
|
|
4298
|
+
* * `'medium'` (Default)
|
|
4299
|
+
* * `'large'`
|
|
3880
4300
|
*/
|
|
3881
4301
|
set size(size) {
|
|
3882
4302
|
this.handleClasses(size, 'size');
|
|
@@ -3885,15 +4305,29 @@ let FloatingActionButtonComponent = class FloatingActionButtonComponent {
|
|
|
3885
4305
|
get size() {
|
|
3886
4306
|
return this._size;
|
|
3887
4307
|
}
|
|
4308
|
+
/**
|
|
4309
|
+
* The rounded property specifies the border radius of the FloatingActionButton.
|
|
4310
|
+
*
|
|
4311
|
+
* The possible values are:
|
|
4312
|
+
* * `'small'`
|
|
4313
|
+
* * `'medium'`
|
|
4314
|
+
* * `'large'`
|
|
4315
|
+
* * `'full'` (default)
|
|
4316
|
+
* * `null`
|
|
4317
|
+
*/
|
|
4318
|
+
set rounded(rounded) {
|
|
4319
|
+
this.handleClasses(rounded, 'rounded');
|
|
4320
|
+
this._rounded = rounded;
|
|
4321
|
+
}
|
|
4322
|
+
get rounded() {
|
|
4323
|
+
return this._rounded;
|
|
4324
|
+
}
|
|
3888
4325
|
/**
|
|
3889
4326
|
* Specifies the shape of the FloatingActionButton
|
|
3890
4327
|
* ([see example]({% slug appearance_floatingactionbutton %}#toc-shape)).
|
|
3891
4328
|
*
|
|
3892
4329
|
* The possible values are:
|
|
3893
|
-
* * `
|
|
3894
|
-
* * `circle`—Applies circle shape on the FloatingActionButton.
|
|
3895
|
-
* * `rectangle`—Applies rectangular shape on the FloatingActionButton.
|
|
3896
|
-
* * `rounded`—Applies rounded shape on the FloatingActionButton.
|
|
4330
|
+
* * `rectangle` (Default)—Applies rectangular shape on the FloatingActionButton.
|
|
3897
4331
|
* * `square`—Applies square shape on the FloatingActionButton.
|
|
3898
4332
|
*
|
|
3899
4333
|
*/
|
|
@@ -3951,8 +4385,10 @@ let FloatingActionButtonComponent = class FloatingActionButtonComponent {
|
|
|
3951
4385
|
return this.disabled ? (-1) : this.tabIndex;
|
|
3952
4386
|
}
|
|
3953
4387
|
ngAfterViewInit() {
|
|
3954
|
-
this.
|
|
4388
|
+
['shape', 'size', 'rounded', 'themeColor'].forEach(option => this.handleClasses(this[option], option));
|
|
4389
|
+
this.renderer.addClass(this.element.nativeElement, this.alignClass());
|
|
3955
4390
|
this.offsetStyles();
|
|
4391
|
+
this.initialSetup = false;
|
|
3956
4392
|
}
|
|
3957
4393
|
ngOnDestroy() {
|
|
3958
4394
|
this.subscriptions.unsubscribe();
|
|
@@ -4094,20 +4530,24 @@ let FloatingActionButtonComponent = class FloatingActionButtonComponent {
|
|
|
4094
4530
|
this.toggleDialWithEvents(false);
|
|
4095
4531
|
}
|
|
4096
4532
|
handleClasses(inputValue, input) {
|
|
4097
|
-
if (isPresent(this.button) && (this[input] !== inputValue)) {
|
|
4533
|
+
if (isPresent(this.button) && (this[input] !== inputValue || this.initialSetup)) {
|
|
4098
4534
|
const button = this.button.nativeElement;
|
|
4099
4535
|
const classesToRemove = {
|
|
4100
|
-
themeColor:
|
|
4536
|
+
themeColor: `${FILLMODE_CLASS}-${this.themeColor}`,
|
|
4101
4537
|
size: SIZE_CLASSES[this.size],
|
|
4102
|
-
shape: SHAPE_CLASSES[this.shape]
|
|
4538
|
+
shape: SHAPE_CLASSES[this.shape],
|
|
4539
|
+
rounded: ROUNDED_CLASSES[this.rounded]
|
|
4103
4540
|
};
|
|
4104
4541
|
const classesToAdd = {
|
|
4105
|
-
themeColor:
|
|
4542
|
+
themeColor: inputValue ? `${FILLMODE_CLASS}-${inputValue}` : null,
|
|
4106
4543
|
size: SIZE_CLASSES[inputValue],
|
|
4107
|
-
shape: SHAPE_CLASSES[inputValue]
|
|
4544
|
+
shape: SHAPE_CLASSES[inputValue],
|
|
4545
|
+
rounded: ROUNDED_CLASSES[inputValue]
|
|
4108
4546
|
};
|
|
4109
4547
|
this.renderer.removeClass(button, classesToRemove[input]);
|
|
4110
|
-
|
|
4548
|
+
if (classesToAdd[input]) {
|
|
4549
|
+
this.renderer.addClass(button, classesToAdd[input]);
|
|
4550
|
+
}
|
|
4111
4551
|
}
|
|
4112
4552
|
}
|
|
4113
4553
|
onEnterPressed() {
|
|
@@ -4162,14 +4602,6 @@ let FloatingActionButtonComponent = class FloatingActionButtonComponent {
|
|
|
4162
4602
|
alignClass() {
|
|
4163
4603
|
return `k-pos-${this.align.vertical}-${this.align.horizontal}`;
|
|
4164
4604
|
}
|
|
4165
|
-
applyClasses() {
|
|
4166
|
-
const hostElement = this.element.nativeElement;
|
|
4167
|
-
const button = this.button.nativeElement;
|
|
4168
|
-
this.renderer.addClass(button, SHAPE_CLASSES[this.shape]);
|
|
4169
|
-
this.renderer.addClass(button, `k-fab-${this.themeColor}`);
|
|
4170
|
-
this.renderer.addClass(button, SIZE_CLASSES[this.size]);
|
|
4171
|
-
this.renderer.addClass(hostElement, this.alignClass());
|
|
4172
|
-
}
|
|
4173
4605
|
toggleDialWithEvents(open) {
|
|
4174
4606
|
if (open === this.isOpen) {
|
|
4175
4607
|
return;
|
|
@@ -4389,6 +4821,11 @@ __decorate([
|
|
|
4389
4821
|
__metadata("design:type", String),
|
|
4390
4822
|
__metadata("design:paramtypes", [String])
|
|
4391
4823
|
], FloatingActionButtonComponent.prototype, "size", null);
|
|
4824
|
+
__decorate([
|
|
4825
|
+
Input(),
|
|
4826
|
+
__metadata("design:type", String),
|
|
4827
|
+
__metadata("design:paramtypes", [String])
|
|
4828
|
+
], FloatingActionButtonComponent.prototype, "rounded", null);
|
|
4392
4829
|
__decorate([
|
|
4393
4830
|
Input(),
|
|
4394
4831
|
__metadata("design:type", String),
|
|
@@ -4485,8 +4922,8 @@ FloatingActionButtonComponent = __decorate([
|
|
|
4485
4922
|
[attr.role]="role"
|
|
4486
4923
|
[tabIndex]="componentTabIndex"
|
|
4487
4924
|
type="button"
|
|
4488
|
-
|
|
4489
|
-
[class.k-
|
|
4925
|
+
class="k-fab k-fab-solid"
|
|
4926
|
+
[class.k-disabled]="disabled"
|
|
4490
4927
|
[ngClass]="buttonClass"
|
|
4491
4928
|
[disabled]="disabled"
|
|
4492
4929
|
[attr.aria-disabled]="disabled"
|
|
@@ -4670,7 +5107,7 @@ __decorate([
|
|
|
4670
5107
|
], DialItemComponent.prototype, "role", void 0);
|
|
4671
5108
|
__decorate([
|
|
4672
5109
|
HostBinding('attr.aria-disabled'),
|
|
4673
|
-
HostBinding('class.k-
|
|
5110
|
+
HostBinding('class.k-disabled'),
|
|
4674
5111
|
__metadata("design:type", Boolean),
|
|
4675
5112
|
__metadata("design:paramtypes", [])
|
|
4676
5113
|
], DialItemComponent.prototype, "disabledClass", null);
|