@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
|
@@ -7,9 +7,9 @@ import { Directive, ElementRef, EventEmitter, HostBinding, HostListener, Input,
|
|
|
7
7
|
import { KendoButtonService } from './button.service';
|
|
8
8
|
import { isDocumentAvailable, isChanged, hasObservers, Keys } from '@progress/kendo-angular-common';
|
|
9
9
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
10
|
-
import { filter } from 'rxjs/operators';
|
|
11
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
12
11
|
import { packageMetadata } from '../package-metadata';
|
|
12
|
+
import { getStylingClasses, getThemeColorClasses } from '../util';
|
|
13
13
|
const SPAN_TAG_NAME = 'SPAN';
|
|
14
14
|
/**
|
|
15
15
|
* Represents the Kendo UI Button component for Angular.
|
|
@@ -23,19 +23,6 @@ let ButtonDirective = class ButtonDirective {
|
|
|
23
23
|
* By default, `toggleable` is set to `false`.
|
|
24
24
|
*/
|
|
25
25
|
this.toggleable = false;
|
|
26
|
-
/**
|
|
27
|
-
* Adds visual weight to the Button and makes it primary.
|
|
28
|
-
*/
|
|
29
|
-
this.primary = false;
|
|
30
|
-
/**
|
|
31
|
-
* Changes the visual appearance by using alternative styling options
|
|
32
|
-
* ([more information and examples]({% slug appearance_button %})).
|
|
33
|
-
*
|
|
34
|
-
* The available values are:
|
|
35
|
-
* * [`ButtonLook`]({% slug api_buttons_buttonlook %}) = `flat` | `outline`
|
|
36
|
-
* * `clear`
|
|
37
|
-
*/
|
|
38
|
-
this.look = 'default';
|
|
39
26
|
/**
|
|
40
27
|
* @hidden
|
|
41
28
|
*/
|
|
@@ -53,12 +40,16 @@ let ButtonDirective = class ButtonDirective {
|
|
|
53
40
|
this.isDisabled = false;
|
|
54
41
|
this.isIcon = false;
|
|
55
42
|
this.isIconClass = false;
|
|
43
|
+
this._size = 'medium';
|
|
44
|
+
this._rounded = 'medium';
|
|
45
|
+
this._shape = 'rectangle';
|
|
46
|
+
this._fillMode = 'solid';
|
|
47
|
+
this._themeColor = 'base';
|
|
56
48
|
this._focused = false;
|
|
57
49
|
this.domEvents = [];
|
|
58
50
|
validatePackage(packageMetadata);
|
|
59
51
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
60
|
-
this.localizationChangeSubscription = localization.changes
|
|
61
|
-
.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr');
|
|
52
|
+
this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr'));
|
|
62
53
|
this.element = element.nativeElement;
|
|
63
54
|
this.renderer = renderer;
|
|
64
55
|
}
|
|
@@ -102,7 +93,7 @@ let ButtonDirective = class ButtonDirective {
|
|
|
102
93
|
if (icon) {
|
|
103
94
|
this.iconSetter(icon, () => {
|
|
104
95
|
this.isIcon = true;
|
|
105
|
-
const classes = 'k-icon k-i-' + icon;
|
|
96
|
+
const classes = 'k-button-icon k-icon k-i-' + icon;
|
|
106
97
|
this.addIcon(classes);
|
|
107
98
|
});
|
|
108
99
|
}
|
|
@@ -119,7 +110,8 @@ let ButtonDirective = class ButtonDirective {
|
|
|
119
110
|
if (iconClassName) {
|
|
120
111
|
this.iconSetter(iconClassName, () => {
|
|
121
112
|
this.isIconClass = true;
|
|
122
|
-
|
|
113
|
+
const classes = 'k-button-icon k-icon ' + iconClassName;
|
|
114
|
+
this.addIcon(classes);
|
|
123
115
|
});
|
|
124
116
|
}
|
|
125
117
|
else {
|
|
@@ -149,8 +141,101 @@ let ButtonDirective = class ButtonDirective {
|
|
|
149
141
|
get disabled() {
|
|
150
142
|
return this.isDisabled;
|
|
151
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* The size property specifies the width and height of the Button
|
|
146
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-size)).
|
|
147
|
+
*
|
|
148
|
+
* The possible values are:
|
|
149
|
+
* * `'small'`
|
|
150
|
+
* * `'medium'` (default)
|
|
151
|
+
* * `'large'`
|
|
152
|
+
* * `null`
|
|
153
|
+
*/
|
|
154
|
+
set size(size) {
|
|
155
|
+
this.handleClasses(size, 'size');
|
|
156
|
+
this._size = size;
|
|
157
|
+
}
|
|
158
|
+
get size() {
|
|
159
|
+
return this._size;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The rounded property specifies the border radius of the Button
|
|
163
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-rounded)).
|
|
164
|
+
*
|
|
165
|
+
* The possible values are:
|
|
166
|
+
* * `'small'`
|
|
167
|
+
* * `'medium'` (default)
|
|
168
|
+
* * `'large'`
|
|
169
|
+
* * `'full'`
|
|
170
|
+
* * `null`
|
|
171
|
+
*/
|
|
172
|
+
set rounded(rounded) {
|
|
173
|
+
this.handleClasses(rounded, 'rounded');
|
|
174
|
+
this._rounded = rounded;
|
|
175
|
+
}
|
|
176
|
+
get rounded() {
|
|
177
|
+
return this._rounded;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The fillMode property specifies the background and border styles of the Button
|
|
181
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-fillMode)).
|
|
182
|
+
*
|
|
183
|
+
* The possible values are:
|
|
184
|
+
* * `'flat'`
|
|
185
|
+
* * `'solid'` (default)
|
|
186
|
+
* * `'outline'`
|
|
187
|
+
* * `'link'`
|
|
188
|
+
* * `null`
|
|
189
|
+
*/
|
|
190
|
+
set fillMode(fillMode) {
|
|
191
|
+
this.handleClasses(fillMode, 'fillMode');
|
|
192
|
+
this._fillMode = fillMode;
|
|
193
|
+
}
|
|
194
|
+
get fillMode() {
|
|
195
|
+
return this._fillMode;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The Button allows you to specify predefined theme colors.
|
|
199
|
+
* The theme color will be applied as a background and border color while also amending the text color accordingly
|
|
200
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-themeColor)).
|
|
201
|
+
*
|
|
202
|
+
* The possible values are:
|
|
203
|
+
* * `'base'` (default)
|
|
204
|
+
* * `'primary'`
|
|
205
|
+
* * `'secondary'`
|
|
206
|
+
* * `'tertiary'`
|
|
207
|
+
* * `'info'`
|
|
208
|
+
* * `'success'`
|
|
209
|
+
* * `'warning'`
|
|
210
|
+
* * `'error'`
|
|
211
|
+
* * `'dark'`
|
|
212
|
+
* * `'light`'
|
|
213
|
+
* * `'inverse'`
|
|
214
|
+
*/
|
|
215
|
+
set themeColor(themeColor) {
|
|
216
|
+
this.handleThemeColor(themeColor);
|
|
217
|
+
this._themeColor = themeColor;
|
|
218
|
+
}
|
|
219
|
+
get themeColor() {
|
|
220
|
+
return this._themeColor;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The shape property specifies if the Button will form a rectangle or square.
|
|
224
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-shape)).
|
|
225
|
+
*
|
|
226
|
+
* The possible values are:
|
|
227
|
+
* * `'square'`
|
|
228
|
+
* * `'rectangle'` (default)
|
|
229
|
+
*/
|
|
230
|
+
set shape(shape) {
|
|
231
|
+
this.handleClasses(shape, 'shape');
|
|
232
|
+
this._shape = shape;
|
|
233
|
+
}
|
|
234
|
+
get shape() {
|
|
235
|
+
return this._shape;
|
|
236
|
+
}
|
|
152
237
|
set isFocused(isFocused) {
|
|
153
|
-
this.toggleClass('k-
|
|
238
|
+
this.toggleClass('k-focus', isFocused);
|
|
154
239
|
this._focused = isFocused;
|
|
155
240
|
}
|
|
156
241
|
get isFocused() {
|
|
@@ -159,24 +244,9 @@ let ButtonDirective = class ButtonDirective {
|
|
|
159
244
|
get classButton() {
|
|
160
245
|
return true;
|
|
161
246
|
}
|
|
162
|
-
get classPrimary() {
|
|
163
|
-
return this.primary;
|
|
164
|
-
}
|
|
165
247
|
get isToggleable() {
|
|
166
248
|
return this.toggleable;
|
|
167
249
|
}
|
|
168
|
-
get isFlat() {
|
|
169
|
-
return this.look === 'flat';
|
|
170
|
-
}
|
|
171
|
-
get isBare() {
|
|
172
|
-
return this.look === 'bare';
|
|
173
|
-
}
|
|
174
|
-
get isOutline() {
|
|
175
|
-
return this.look === 'outline';
|
|
176
|
-
}
|
|
177
|
-
get isClear() {
|
|
178
|
-
return this.look === 'clear';
|
|
179
|
-
}
|
|
180
250
|
get roleSetter() {
|
|
181
251
|
return this.role;
|
|
182
252
|
}
|
|
@@ -201,13 +271,31 @@ let ButtonDirective = class ButtonDirective {
|
|
|
201
271
|
onBlur() {
|
|
202
272
|
this.isFocused = false;
|
|
203
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* @hidden
|
|
276
|
+
*/
|
|
277
|
+
set primary(value) {
|
|
278
|
+
this.themeColor = value ? 'primary' : 'base';
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* @hidden
|
|
282
|
+
*/
|
|
283
|
+
set look(value) {
|
|
284
|
+
switch (value) {
|
|
285
|
+
case 'default':
|
|
286
|
+
this.fillMode = 'solid';
|
|
287
|
+
break;
|
|
288
|
+
case 'clear':
|
|
289
|
+
this.fillMode = 'flat';
|
|
290
|
+
break;
|
|
291
|
+
default:
|
|
292
|
+
this.fillMode = value;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
204
296
|
ngOnInit() {
|
|
205
297
|
const isSpan = this.element.tagName === SPAN_TAG_NAME;
|
|
206
|
-
|
|
207
|
-
this.buttonLookChangeSubscription = this.service.buttonLookChange
|
|
208
|
-
.pipe(filter((look) => look !== 'default'))
|
|
209
|
-
.subscribe((look) => this.look = look);
|
|
210
|
-
}
|
|
298
|
+
this.addTextSpan();
|
|
211
299
|
if (!this.element.hasAttribute('role') && this.togglable) {
|
|
212
300
|
this.toggleAriaPressed(this.toggleable);
|
|
213
301
|
}
|
|
@@ -217,7 +305,8 @@ let ButtonDirective = class ButtonDirective {
|
|
|
217
305
|
this.ngZone.runOutsideAngular(() => {
|
|
218
306
|
this.domEvents.push(this.renderer.listen(this.element, 'click', this._onButtonClick.bind(this)));
|
|
219
307
|
this.domEvents.push(this.renderer.listen(this.element, 'keydown', (event) => {
|
|
220
|
-
|
|
308
|
+
const isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
|
|
309
|
+
if (isSpan && isSpaceOrEnter) {
|
|
221
310
|
this.click.emit(event);
|
|
222
311
|
this._onButtonClick();
|
|
223
312
|
}
|
|
@@ -229,17 +318,21 @@ let ButtonDirective = class ButtonDirective {
|
|
|
229
318
|
this.toggleAriaPressed(this.toggleable);
|
|
230
319
|
}
|
|
231
320
|
}
|
|
321
|
+
ngAfterViewInit() {
|
|
322
|
+
const stylingOptions = ['size', 'rounded', 'shape', 'fillMode'];
|
|
323
|
+
stylingOptions.forEach(input => {
|
|
324
|
+
this.handleClasses(this[input], input);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
232
327
|
ngAfterViewChecked() {
|
|
233
328
|
this.setIconTextClasses();
|
|
234
329
|
}
|
|
235
330
|
ngOnDestroy() {
|
|
236
331
|
this.imageNode = null;
|
|
237
332
|
this.iconNode = null;
|
|
333
|
+
this.iconSpanNode = null;
|
|
238
334
|
this.renderer = null;
|
|
239
335
|
this.localizationChangeSubscription.unsubscribe();
|
|
240
|
-
if (this.service && this.buttonLookChangeSubscription) {
|
|
241
|
-
this.buttonLookChangeSubscription.unsubscribe();
|
|
242
|
-
}
|
|
243
336
|
clearTimeout(this.deferTimeout);
|
|
244
337
|
this.domEvents.forEach(unbindHandler => unbindHandler());
|
|
245
338
|
}
|
|
@@ -282,7 +375,7 @@ let ButtonDirective = class ButtonDirective {
|
|
|
282
375
|
const changed = this.selected !== value;
|
|
283
376
|
this.selected = value;
|
|
284
377
|
this.setAttribute('aria-pressed', this.selected.toString());
|
|
285
|
-
this.toggleClass('k-
|
|
378
|
+
this.toggleClass('k-selected', this.selected);
|
|
286
379
|
if (changed && hasObservers(this.selectedChange)) {
|
|
287
380
|
this.ngZone.run(() => {
|
|
288
381
|
this.selectedChange.emit(value);
|
|
@@ -302,14 +395,21 @@ let ButtonDirective = class ButtonDirective {
|
|
|
302
395
|
}
|
|
303
396
|
hasText() {
|
|
304
397
|
if (isDocumentAvailable()) {
|
|
305
|
-
return
|
|
398
|
+
return this.element.textContent.trim().length > 0;
|
|
306
399
|
}
|
|
307
400
|
else {
|
|
308
401
|
return false;
|
|
309
402
|
}
|
|
310
403
|
}
|
|
404
|
+
get text() {
|
|
405
|
+
if (isDocumentAvailable()) {
|
|
406
|
+
return this.element.innerHTML.trim();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
311
409
|
addImgIcon(imageUrl) {
|
|
312
410
|
let renderer = this.renderer;
|
|
411
|
+
this.iconSpanNode = renderer.createElement('span');
|
|
412
|
+
renderer.setProperty(this.iconSpanNode, 'className', 'k-button-icon k-icon');
|
|
313
413
|
if (this.imageNode) {
|
|
314
414
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
315
415
|
}
|
|
@@ -318,8 +418,9 @@ let ButtonDirective = class ButtonDirective {
|
|
|
318
418
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
319
419
|
renderer.setProperty(this.imageNode, 'className', 'k-image');
|
|
320
420
|
renderer.setAttribute(this.imageNode, 'role', 'presentation');
|
|
321
|
-
this.prependChild(this.imageNode);
|
|
322
421
|
}
|
|
422
|
+
this.iconSpanNode.appendChild(this.imageNode);
|
|
423
|
+
this.prependChild(this.iconSpanNode);
|
|
323
424
|
}
|
|
324
425
|
addIcon(classNames) {
|
|
325
426
|
let renderer = this.renderer;
|
|
@@ -333,6 +434,11 @@ let ButtonDirective = class ButtonDirective {
|
|
|
333
434
|
this.prependChild(this.iconNode);
|
|
334
435
|
}
|
|
335
436
|
}
|
|
437
|
+
addTextSpan() {
|
|
438
|
+
if (isDocumentAvailable() && this.hasText()) {
|
|
439
|
+
this.element.innerHTML = `<span class='k-button-text'>${this.text}</span>`;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
336
442
|
prependChild(node) {
|
|
337
443
|
this.defer(() => {
|
|
338
444
|
if (this.renderer && node !== this.element.firstChild) {
|
|
@@ -354,7 +460,9 @@ let ButtonDirective = class ButtonDirective {
|
|
|
354
460
|
removeImageNode() {
|
|
355
461
|
if (this.imageNode && this.renderer.parentNode(this.imageNode)) {
|
|
356
462
|
this.renderer.removeChild(this.element, this.imageNode);
|
|
463
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
357
464
|
this.imageNode = null;
|
|
465
|
+
this.iconSpanNode = null;
|
|
358
466
|
}
|
|
359
467
|
}
|
|
360
468
|
removeIconNode() {
|
|
@@ -362,6 +470,10 @@ let ButtonDirective = class ButtonDirective {
|
|
|
362
470
|
this.renderer.removeChild(this.element, this.iconNode);
|
|
363
471
|
this.iconNode = null;
|
|
364
472
|
}
|
|
473
|
+
if (this.iconSpanNode) {
|
|
474
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
475
|
+
this.iconSpanNode = null;
|
|
476
|
+
}
|
|
365
477
|
}
|
|
366
478
|
updateIconNode() {
|
|
367
479
|
if (!this.isIcon && !this.isIconClass) {
|
|
@@ -370,9 +482,7 @@ let ButtonDirective = class ButtonDirective {
|
|
|
370
482
|
}
|
|
371
483
|
setIconTextClasses() {
|
|
372
484
|
const hasIcon = this.isIcon || this.isIconClass || this.imageNode;
|
|
373
|
-
|
|
374
|
-
this.toggleClass('k-button-icon', hasIcon && !hasText);
|
|
375
|
-
this.toggleClass('k-button-icontext', hasIcon && hasText);
|
|
485
|
+
this.toggleClass('k-icon-button', hasIcon && !this.hasText());
|
|
376
486
|
}
|
|
377
487
|
toggleClass(className, add) {
|
|
378
488
|
if (add) {
|
|
@@ -392,6 +502,31 @@ let ButtonDirective = class ButtonDirective {
|
|
|
392
502
|
this.setSelected(!this.selected);
|
|
393
503
|
}
|
|
394
504
|
}
|
|
505
|
+
handleClasses(value, input) {
|
|
506
|
+
const elem = this.element;
|
|
507
|
+
const classes = getStylingClasses('button', input, this[input], value);
|
|
508
|
+
if (input === 'fillMode') {
|
|
509
|
+
this.handleThemeColor(this.themeColor, this[input], value);
|
|
510
|
+
}
|
|
511
|
+
if (classes.toRemove) {
|
|
512
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
513
|
+
}
|
|
514
|
+
if (classes.toAdd) {
|
|
515
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
handleThemeColor(value, prevFillMode, fillMode) {
|
|
519
|
+
const elem = this.element;
|
|
520
|
+
const removeFillMode = prevFillMode ? prevFillMode : this.fillMode;
|
|
521
|
+
const addFillMode = fillMode ? fillMode : this.fillMode;
|
|
522
|
+
const themeColorClass = getThemeColorClasses('button', removeFillMode, addFillMode, this.themeColor, value);
|
|
523
|
+
this.renderer.removeClass(elem, themeColorClass.toRemove);
|
|
524
|
+
if (addFillMode !== null && fillMode !== null) {
|
|
525
|
+
if (themeColorClass.toAdd) {
|
|
526
|
+
this.renderer.addClass(elem, themeColorClass.toAdd);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
395
530
|
};
|
|
396
531
|
tslib_1.__decorate([
|
|
397
532
|
Input(),
|
|
@@ -402,14 +537,6 @@ tslib_1.__decorate([
|
|
|
402
537
|
tslib_1.__metadata("design:type", Boolean),
|
|
403
538
|
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
404
539
|
], ButtonDirective.prototype, "togglable", null);
|
|
405
|
-
tslib_1.__decorate([
|
|
406
|
-
Input(),
|
|
407
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
408
|
-
], ButtonDirective.prototype, "primary", void 0);
|
|
409
|
-
tslib_1.__decorate([
|
|
410
|
-
Input(),
|
|
411
|
-
tslib_1.__metadata("design:type", String)
|
|
412
|
-
], ButtonDirective.prototype, "look", void 0);
|
|
413
540
|
tslib_1.__decorate([
|
|
414
541
|
Input(),
|
|
415
542
|
tslib_1.__metadata("design:type", Boolean),
|
|
@@ -440,6 +567,31 @@ tslib_1.__decorate([
|
|
|
440
567
|
tslib_1.__metadata("design:type", Boolean),
|
|
441
568
|
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
442
569
|
], ButtonDirective.prototype, "disabled", null);
|
|
570
|
+
tslib_1.__decorate([
|
|
571
|
+
Input(),
|
|
572
|
+
tslib_1.__metadata("design:type", String),
|
|
573
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
574
|
+
], ButtonDirective.prototype, "size", null);
|
|
575
|
+
tslib_1.__decorate([
|
|
576
|
+
Input(),
|
|
577
|
+
tslib_1.__metadata("design:type", String),
|
|
578
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
579
|
+
], ButtonDirective.prototype, "rounded", null);
|
|
580
|
+
tslib_1.__decorate([
|
|
581
|
+
Input(),
|
|
582
|
+
tslib_1.__metadata("design:type", String),
|
|
583
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
584
|
+
], ButtonDirective.prototype, "fillMode", null);
|
|
585
|
+
tslib_1.__decorate([
|
|
586
|
+
Input(),
|
|
587
|
+
tslib_1.__metadata("design:type", String),
|
|
588
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
589
|
+
], ButtonDirective.prototype, "themeColor", null);
|
|
590
|
+
tslib_1.__decorate([
|
|
591
|
+
Input(),
|
|
592
|
+
tslib_1.__metadata("design:type", String),
|
|
593
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
594
|
+
], ButtonDirective.prototype, "shape", null);
|
|
443
595
|
tslib_1.__decorate([
|
|
444
596
|
Input(),
|
|
445
597
|
tslib_1.__metadata("design:type", String)
|
|
@@ -457,36 +609,11 @@ tslib_1.__decorate([
|
|
|
457
609
|
tslib_1.__metadata("design:type", Boolean),
|
|
458
610
|
tslib_1.__metadata("design:paramtypes", [])
|
|
459
611
|
], ButtonDirective.prototype, "classButton", null);
|
|
460
|
-
tslib_1.__decorate([
|
|
461
|
-
HostBinding('class.k-primary'),
|
|
462
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
463
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
464
|
-
], ButtonDirective.prototype, "classPrimary", null);
|
|
465
612
|
tslib_1.__decorate([
|
|
466
613
|
HostBinding('class.k-toggle-button'),
|
|
467
614
|
tslib_1.__metadata("design:type", Boolean),
|
|
468
615
|
tslib_1.__metadata("design:paramtypes", [])
|
|
469
616
|
], ButtonDirective.prototype, "isToggleable", null);
|
|
470
|
-
tslib_1.__decorate([
|
|
471
|
-
HostBinding('class.k-flat'),
|
|
472
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
473
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
474
|
-
], ButtonDirective.prototype, "isFlat", null);
|
|
475
|
-
tslib_1.__decorate([
|
|
476
|
-
HostBinding('class.k-bare'),
|
|
477
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
478
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
479
|
-
], ButtonDirective.prototype, "isBare", null);
|
|
480
|
-
tslib_1.__decorate([
|
|
481
|
-
HostBinding('class.k-outline'),
|
|
482
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
483
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
484
|
-
], ButtonDirective.prototype, "isOutline", null);
|
|
485
|
-
tslib_1.__decorate([
|
|
486
|
-
HostBinding('class.k-button-clear'),
|
|
487
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
488
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
489
|
-
], ButtonDirective.prototype, "isClear", null);
|
|
490
617
|
tslib_1.__decorate([
|
|
491
618
|
HostBinding('attr.role'),
|
|
492
619
|
tslib_1.__metadata("design:type", String),
|
|
@@ -494,12 +621,12 @@ tslib_1.__decorate([
|
|
|
494
621
|
], ButtonDirective.prototype, "roleSetter", null);
|
|
495
622
|
tslib_1.__decorate([
|
|
496
623
|
HostBinding('attr.aria-disabled'),
|
|
497
|
-
HostBinding('class.k-
|
|
624
|
+
HostBinding('class.k-disabled'),
|
|
498
625
|
tslib_1.__metadata("design:type", Boolean),
|
|
499
626
|
tslib_1.__metadata("design:paramtypes", [])
|
|
500
627
|
], ButtonDirective.prototype, "classDisabled", null);
|
|
501
628
|
tslib_1.__decorate([
|
|
502
|
-
HostBinding('class.k-
|
|
629
|
+
HostBinding('class.k-selected'),
|
|
503
630
|
tslib_1.__metadata("design:type", Boolean),
|
|
504
631
|
tslib_1.__metadata("design:paramtypes", [])
|
|
505
632
|
], ButtonDirective.prototype, "classActive", null);
|
|
@@ -520,6 +647,16 @@ tslib_1.__decorate([
|
|
|
520
647
|
tslib_1.__metadata("design:paramtypes", []),
|
|
521
648
|
tslib_1.__metadata("design:returntype", void 0)
|
|
522
649
|
], ButtonDirective.prototype, "onBlur", null);
|
|
650
|
+
tslib_1.__decorate([
|
|
651
|
+
Input(),
|
|
652
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
653
|
+
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
654
|
+
], ButtonDirective.prototype, "primary", null);
|
|
655
|
+
tslib_1.__decorate([
|
|
656
|
+
Input(),
|
|
657
|
+
tslib_1.__metadata("design:type", String),
|
|
658
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
659
|
+
], ButtonDirective.prototype, "look", null);
|
|
523
660
|
ButtonDirective = tslib_1.__decorate([
|
|
524
661
|
Directive({
|
|
525
662
|
exportAs: 'kendoButton',
|
|
@@ -530,7 +667,7 @@ ButtonDirective = tslib_1.__decorate([
|
|
|
530
667
|
useValue: 'kendo.button'
|
|
531
668
|
}
|
|
532
669
|
],
|
|
533
|
-
selector: 'button[kendoButton], span[kendoButton]'
|
|
670
|
+
selector: 'button[kendoButton], span[kendoButton]',
|
|
534
671
|
}),
|
|
535
672
|
tslib_1.__param(2, Optional()),
|
|
536
673
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Observable,
|
|
5
|
+
import { Observable, Subject } from 'rxjs';
|
|
6
6
|
import { ButtonDirective } from "./button.directive";
|
|
7
|
-
import { ButtonLook } from '../button-look';
|
|
8
7
|
/**
|
|
9
8
|
* @hidden
|
|
10
9
|
*/
|
|
11
10
|
export declare class KendoButtonService {
|
|
12
|
-
buttonLookChange: BehaviorSubject<ButtonLook>;
|
|
13
11
|
buttonClicked: Subject<ButtonDirective>;
|
|
14
12
|
buttonClicked$: Observable<ButtonDirective>;
|
|
15
13
|
click(button: ButtonDirective): void;
|
|
16
|
-
setButtonLook(look: ButtonLook): void;
|
|
17
14
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Injectable } from '@angular/core';
|
|
7
|
-
import {
|
|
7
|
+
import { Subject } from 'rxjs';
|
|
8
8
|
/**
|
|
9
9
|
* @hidden
|
|
10
10
|
*/
|
|
@@ -13,16 +13,12 @@ let KendoButtonService = class KendoButtonService {
|
|
|
13
13
|
* @hidden
|
|
14
14
|
*/
|
|
15
15
|
constructor() {
|
|
16
|
-
this.buttonLookChange = new BehaviorSubject('default');
|
|
17
16
|
this.buttonClicked = new Subject();
|
|
18
17
|
this.buttonClicked$ = this.buttonClicked.asObservable();
|
|
19
18
|
}
|
|
20
19
|
click(button) {
|
|
21
20
|
this.buttonClicked.next(button);
|
|
22
21
|
}
|
|
23
|
-
setButtonLook(look) {
|
|
24
|
-
this.buttonLookChange.next(look);
|
|
25
|
-
}
|
|
26
22
|
};
|
|
27
23
|
KendoButtonService = tslib_1.__decorate([
|
|
28
24
|
Injectable()
|
|
@@ -7,7 +7,6 @@ import { EventEmitter, QueryList, OnInit, OnDestroy, AfterContentChecked, AfterV
|
|
|
7
7
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
8
|
import { ButtonGroupSelection } from '../button/selection-settings';
|
|
9
9
|
import { KendoButtonService } from '../button/button.service';
|
|
10
|
-
import { ButtonLook } from '../button-look';
|
|
11
10
|
import { PreventableEvent } from '../preventable-event';
|
|
12
11
|
/**
|
|
13
12
|
* Represents the Kendo UI ButtonGroup component for Angular.
|
|
@@ -39,17 +38,6 @@ export declare class ButtonGroupComponent implements OnInit, OnDestroy, AfterCon
|
|
|
39
38
|
* - The buttons acquire the same width.
|
|
40
39
|
*/
|
|
41
40
|
width: string;
|
|
42
|
-
/**
|
|
43
|
-
* Changes the visual appearance by using alternative styling options
|
|
44
|
-
* ([more information and examples]({% slug styling_buttongroup %})).
|
|
45
|
-
* The `look` property of the ButtonGroup takes precedence over the `look` property
|
|
46
|
-
* of the individual buttons that are part of the group.
|
|
47
|
-
*
|
|
48
|
-
* The available values are:
|
|
49
|
-
* * `flat`
|
|
50
|
-
* * `outline`
|
|
51
|
-
*/
|
|
52
|
-
look: ButtonLook;
|
|
53
41
|
/**
|
|
54
42
|
* Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
55
43
|
*/
|
|
@@ -67,9 +55,6 @@ export declare class ButtonGroupComponent implements OnInit, OnDestroy, AfterCon
|
|
|
67
55
|
readonly wrapperClass: boolean;
|
|
68
56
|
readonly disabledClass: boolean;
|
|
69
57
|
readonly stretchedClass: boolean;
|
|
70
|
-
readonly isFlat: boolean;
|
|
71
|
-
readonly isBare: boolean;
|
|
72
|
-
readonly isOutline: boolean;
|
|
73
58
|
readonly getRole: string;
|
|
74
59
|
readonly dir: string;
|
|
75
60
|
readonly ariaDisabled: boolean;
|
|
@@ -25,17 +25,6 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
25
25
|
* By default, the selection mode of the ButtonGroup is set to `multiple`.
|
|
26
26
|
*/
|
|
27
27
|
this.selection = 'multiple';
|
|
28
|
-
/**
|
|
29
|
-
* Changes the visual appearance by using alternative styling options
|
|
30
|
-
* ([more information and examples]({% slug styling_buttongroup %})).
|
|
31
|
-
* The `look` property of the ButtonGroup takes precedence over the `look` property
|
|
32
|
-
* of the individual buttons that are part of the group.
|
|
33
|
-
*
|
|
34
|
-
* The available values are:
|
|
35
|
-
* * `flat`
|
|
36
|
-
* * `outline`
|
|
37
|
-
*/
|
|
38
|
-
this.look = 'default';
|
|
39
28
|
/**
|
|
40
29
|
* Fires every time keyboard navigation occurs.
|
|
41
30
|
*/
|
|
@@ -63,15 +52,6 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
63
52
|
get stretchedClass() {
|
|
64
53
|
return !!this.width;
|
|
65
54
|
}
|
|
66
|
-
get isFlat() {
|
|
67
|
-
return this.look === 'flat';
|
|
68
|
-
}
|
|
69
|
-
get isBare() {
|
|
70
|
-
return this.look === 'bare';
|
|
71
|
-
}
|
|
72
|
-
get isOutline() {
|
|
73
|
-
return this.look === 'outline';
|
|
74
|
-
}
|
|
75
55
|
get getRole() {
|
|
76
56
|
return this.isSelectionSingle() ? 'radiogroup' : 'group';
|
|
77
57
|
}
|
|
@@ -116,7 +96,6 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
116
96
|
}
|
|
117
97
|
}
|
|
118
98
|
ngOnInit() {
|
|
119
|
-
this.service.setButtonLook(this.look);
|
|
120
99
|
this.subscription = this.service.buttonClicked$.subscribe((button) => {
|
|
121
100
|
let newSelectionValue;
|
|
122
101
|
if (this.isSelectionSingle()) {
|
|
@@ -236,10 +215,6 @@ tslib_1.__decorate([
|
|
|
236
215
|
Input('width'),
|
|
237
216
|
tslib_1.__metadata("design:type", String)
|
|
238
217
|
], ButtonGroupComponent.prototype, "width", void 0);
|
|
239
|
-
tslib_1.__decorate([
|
|
240
|
-
Input(),
|
|
241
|
-
tslib_1.__metadata("design:type", String)
|
|
242
|
-
], ButtonGroupComponent.prototype, "look", void 0);
|
|
243
218
|
tslib_1.__decorate([
|
|
244
219
|
Input(),
|
|
245
220
|
tslib_1.__metadata("design:type", Number),
|
|
@@ -259,7 +234,7 @@ tslib_1.__decorate([
|
|
|
259
234
|
tslib_1.__metadata("design:paramtypes", [])
|
|
260
235
|
], ButtonGroupComponent.prototype, "wrapperClass", null);
|
|
261
236
|
tslib_1.__decorate([
|
|
262
|
-
HostBinding('class.k-
|
|
237
|
+
HostBinding('class.k-disabled'),
|
|
263
238
|
tslib_1.__metadata("design:type", Boolean),
|
|
264
239
|
tslib_1.__metadata("design:paramtypes", [])
|
|
265
240
|
], ButtonGroupComponent.prototype, "disabledClass", null);
|
|
@@ -268,21 +243,6 @@ tslib_1.__decorate([
|
|
|
268
243
|
tslib_1.__metadata("design:type", Boolean),
|
|
269
244
|
tslib_1.__metadata("design:paramtypes", [])
|
|
270
245
|
], ButtonGroupComponent.prototype, "stretchedClass", null);
|
|
271
|
-
tslib_1.__decorate([
|
|
272
|
-
HostBinding('class.k-button-group-flat'),
|
|
273
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
274
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
275
|
-
], ButtonGroupComponent.prototype, "isFlat", null);
|
|
276
|
-
tslib_1.__decorate([
|
|
277
|
-
HostBinding('class.k-button-group-bare'),
|
|
278
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
279
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
280
|
-
], ButtonGroupComponent.prototype, "isBare", null);
|
|
281
|
-
tslib_1.__decorate([
|
|
282
|
-
HostBinding('class.k-button-group-outline'),
|
|
283
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
284
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
285
|
-
], ButtonGroupComponent.prototype, "isOutline", null);
|
|
286
246
|
tslib_1.__decorate([
|
|
287
247
|
HostBinding('attr.role'),
|
|
288
248
|
tslib_1.__metadata("design:type", String),
|