@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
|
var SPAN_TAG_NAME = 'SPAN';
|
|
14
14
|
/**
|
|
15
15
|
* Represents the Kendo UI Button component for Angular.
|
|
@@ -24,19 +24,6 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
24
24
|
* By default, `toggleable` is set to `false`.
|
|
25
25
|
*/
|
|
26
26
|
this.toggleable = false;
|
|
27
|
-
/**
|
|
28
|
-
* Adds visual weight to the Button and makes it primary.
|
|
29
|
-
*/
|
|
30
|
-
this.primary = false;
|
|
31
|
-
/**
|
|
32
|
-
* Changes the visual appearance by using alternative styling options
|
|
33
|
-
* ([more information and examples]({% slug appearance_button %})).
|
|
34
|
-
*
|
|
35
|
-
* The available values are:
|
|
36
|
-
* * [`ButtonLook`]({% slug api_buttons_buttonlook %}) = `flat` | `outline`
|
|
37
|
-
* * `clear`
|
|
38
|
-
*/
|
|
39
|
-
this.look = 'default';
|
|
40
27
|
/**
|
|
41
28
|
* @hidden
|
|
42
29
|
*/
|
|
@@ -54,14 +41,18 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
54
41
|
this.isDisabled = false;
|
|
55
42
|
this.isIcon = false;
|
|
56
43
|
this.isIconClass = false;
|
|
44
|
+
this._size = 'medium';
|
|
45
|
+
this._rounded = 'medium';
|
|
46
|
+
this._shape = 'rectangle';
|
|
47
|
+
this._fillMode = 'solid';
|
|
48
|
+
this._themeColor = 'base';
|
|
57
49
|
this._focused = false;
|
|
58
50
|
this.domEvents = [];
|
|
59
51
|
validatePackage(packageMetadata);
|
|
60
52
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
61
|
-
this.localizationChangeSubscription = localization.changes
|
|
62
|
-
.subscribe(function (_a) {
|
|
53
|
+
this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
|
|
63
54
|
var rtl = _a.rtl;
|
|
64
|
-
return _this.direction = rtl ? 'rtl' : 'ltr';
|
|
55
|
+
return (_this.direction = rtl ? 'rtl' : 'ltr');
|
|
65
56
|
});
|
|
66
57
|
this.element = element.nativeElement;
|
|
67
58
|
this.renderer = renderer;
|
|
@@ -120,7 +111,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
120
111
|
if (icon) {
|
|
121
112
|
this.iconSetter(icon, function () {
|
|
122
113
|
_this.isIcon = true;
|
|
123
|
-
var classes = 'k-icon k-i-' + icon;
|
|
114
|
+
var classes = 'k-button-icon k-icon k-i-' + icon;
|
|
124
115
|
_this.addIcon(classes);
|
|
125
116
|
});
|
|
126
117
|
}
|
|
@@ -142,7 +133,8 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
142
133
|
if (iconClassName) {
|
|
143
134
|
this.iconSetter(iconClassName, function () {
|
|
144
135
|
_this.isIconClass = true;
|
|
145
|
-
|
|
136
|
+
var classes = 'k-button-icon k-icon ' + iconClassName;
|
|
137
|
+
_this.addIcon(classes);
|
|
146
138
|
});
|
|
147
139
|
}
|
|
148
140
|
else {
|
|
@@ -183,62 +175,140 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
183
175
|
enumerable: true,
|
|
184
176
|
configurable: true
|
|
185
177
|
});
|
|
186
|
-
Object.defineProperty(ButtonDirective.prototype, "
|
|
178
|
+
Object.defineProperty(ButtonDirective.prototype, "size", {
|
|
187
179
|
get: function () {
|
|
188
|
-
return this.
|
|
180
|
+
return this._size;
|
|
189
181
|
},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
/**
|
|
183
|
+
* The size property specifies the width and height of the Button
|
|
184
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-size)).
|
|
185
|
+
*
|
|
186
|
+
* The possible values are:
|
|
187
|
+
* * `'small'`
|
|
188
|
+
* * `'medium'` (default)
|
|
189
|
+
* * `'large'`
|
|
190
|
+
* * `null`
|
|
191
|
+
*/
|
|
192
|
+
set: function (size) {
|
|
193
|
+
this.handleClasses(size, 'size');
|
|
194
|
+
this._size = size;
|
|
193
195
|
},
|
|
194
196
|
enumerable: true,
|
|
195
197
|
configurable: true
|
|
196
198
|
});
|
|
197
|
-
Object.defineProperty(ButtonDirective.prototype, "
|
|
199
|
+
Object.defineProperty(ButtonDirective.prototype, "rounded", {
|
|
198
200
|
get: function () {
|
|
199
|
-
return
|
|
201
|
+
return this._rounded;
|
|
202
|
+
},
|
|
203
|
+
/**
|
|
204
|
+
* The rounded property specifies the border radius of the Button
|
|
205
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-rounded)).
|
|
206
|
+
*
|
|
207
|
+
* The possible values are:
|
|
208
|
+
* * `'small'`
|
|
209
|
+
* * `'medium'` (default)
|
|
210
|
+
* * `'large'`
|
|
211
|
+
* * `'full'`
|
|
212
|
+
* * `null`
|
|
213
|
+
*/
|
|
214
|
+
set: function (rounded) {
|
|
215
|
+
this.handleClasses(rounded, 'rounded');
|
|
216
|
+
this._rounded = rounded;
|
|
200
217
|
},
|
|
201
218
|
enumerable: true,
|
|
202
219
|
configurable: true
|
|
203
220
|
});
|
|
204
|
-
Object.defineProperty(ButtonDirective.prototype, "
|
|
221
|
+
Object.defineProperty(ButtonDirective.prototype, "fillMode", {
|
|
205
222
|
get: function () {
|
|
206
|
-
return this.
|
|
223
|
+
return this._fillMode;
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* The fillMode property specifies the background and border styles of the Button
|
|
227
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-fillMode)).
|
|
228
|
+
*
|
|
229
|
+
* The possible values are:
|
|
230
|
+
* * `'flat'`
|
|
231
|
+
* * `'solid'` (default)
|
|
232
|
+
* * `'outline'`
|
|
233
|
+
* * `'link'`
|
|
234
|
+
* * `null`
|
|
235
|
+
*/
|
|
236
|
+
set: function (fillMode) {
|
|
237
|
+
this.handleClasses(fillMode, 'fillMode');
|
|
238
|
+
this._fillMode = fillMode;
|
|
207
239
|
},
|
|
208
240
|
enumerable: true,
|
|
209
241
|
configurable: true
|
|
210
242
|
});
|
|
211
|
-
Object.defineProperty(ButtonDirective.prototype, "
|
|
243
|
+
Object.defineProperty(ButtonDirective.prototype, "themeColor", {
|
|
212
244
|
get: function () {
|
|
213
|
-
return this.
|
|
245
|
+
return this._themeColor;
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
* The Button allows you to specify predefined theme colors.
|
|
249
|
+
* The theme color will be applied as a background and border color while also amending the text color accordingly
|
|
250
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-themeColor)).
|
|
251
|
+
*
|
|
252
|
+
* The possible values are:
|
|
253
|
+
* * `'base'` (default)
|
|
254
|
+
* * `'primary'`
|
|
255
|
+
* * `'secondary'`
|
|
256
|
+
* * `'tertiary'`
|
|
257
|
+
* * `'info'`
|
|
258
|
+
* * `'success'`
|
|
259
|
+
* * `'warning'`
|
|
260
|
+
* * `'error'`
|
|
261
|
+
* * `'dark'`
|
|
262
|
+
* * `'light`'
|
|
263
|
+
* * `'inverse'`
|
|
264
|
+
*/
|
|
265
|
+
set: function (themeColor) {
|
|
266
|
+
this.handleThemeColor(themeColor);
|
|
267
|
+
this._themeColor = themeColor;
|
|
214
268
|
},
|
|
215
269
|
enumerable: true,
|
|
216
270
|
configurable: true
|
|
217
271
|
});
|
|
218
|
-
Object.defineProperty(ButtonDirective.prototype, "
|
|
272
|
+
Object.defineProperty(ButtonDirective.prototype, "shape", {
|
|
219
273
|
get: function () {
|
|
220
|
-
return this.
|
|
274
|
+
return this._shape;
|
|
275
|
+
},
|
|
276
|
+
/**
|
|
277
|
+
* The shape property specifies if the Button will form a rectangle or square.
|
|
278
|
+
* ([see example]({% slug appearance_buttondirective %}#toc-shape)).
|
|
279
|
+
*
|
|
280
|
+
* The possible values are:
|
|
281
|
+
* * `'square'`
|
|
282
|
+
* * `'rectangle'` (default)
|
|
283
|
+
*/
|
|
284
|
+
set: function (shape) {
|
|
285
|
+
this.handleClasses(shape, 'shape');
|
|
286
|
+
this._shape = shape;
|
|
221
287
|
},
|
|
222
288
|
enumerable: true,
|
|
223
289
|
configurable: true
|
|
224
290
|
});
|
|
225
|
-
Object.defineProperty(ButtonDirective.prototype, "
|
|
291
|
+
Object.defineProperty(ButtonDirective.prototype, "isFocused", {
|
|
226
292
|
get: function () {
|
|
227
|
-
return this.
|
|
293
|
+
return this._focused;
|
|
294
|
+
},
|
|
295
|
+
set: function (isFocused) {
|
|
296
|
+
this.toggleClass('k-focus', isFocused);
|
|
297
|
+
this._focused = isFocused;
|
|
228
298
|
},
|
|
229
299
|
enumerable: true,
|
|
230
300
|
configurable: true
|
|
231
301
|
});
|
|
232
|
-
Object.defineProperty(ButtonDirective.prototype, "
|
|
302
|
+
Object.defineProperty(ButtonDirective.prototype, "classButton", {
|
|
233
303
|
get: function () {
|
|
234
|
-
return
|
|
304
|
+
return true;
|
|
235
305
|
},
|
|
236
306
|
enumerable: true,
|
|
237
307
|
configurable: true
|
|
238
308
|
});
|
|
239
|
-
Object.defineProperty(ButtonDirective.prototype, "
|
|
309
|
+
Object.defineProperty(ButtonDirective.prototype, "isToggleable", {
|
|
240
310
|
get: function () {
|
|
241
|
-
return this.
|
|
311
|
+
return this.toggleable;
|
|
242
312
|
},
|
|
243
313
|
enumerable: true,
|
|
244
314
|
configurable: true
|
|
@@ -283,14 +353,40 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
283
353
|
ButtonDirective.prototype.onBlur = function () {
|
|
284
354
|
this.isFocused = false;
|
|
285
355
|
};
|
|
356
|
+
Object.defineProperty(ButtonDirective.prototype, "primary", {
|
|
357
|
+
/**
|
|
358
|
+
* @hidden
|
|
359
|
+
*/
|
|
360
|
+
set: function (value) {
|
|
361
|
+
this.themeColor = value ? 'primary' : 'base';
|
|
362
|
+
},
|
|
363
|
+
enumerable: true,
|
|
364
|
+
configurable: true
|
|
365
|
+
});
|
|
366
|
+
Object.defineProperty(ButtonDirective.prototype, "look", {
|
|
367
|
+
/**
|
|
368
|
+
* @hidden
|
|
369
|
+
*/
|
|
370
|
+
set: function (value) {
|
|
371
|
+
switch (value) {
|
|
372
|
+
case 'default':
|
|
373
|
+
this.fillMode = 'solid';
|
|
374
|
+
break;
|
|
375
|
+
case 'clear':
|
|
376
|
+
this.fillMode = 'flat';
|
|
377
|
+
break;
|
|
378
|
+
default:
|
|
379
|
+
this.fillMode = value;
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
enumerable: true,
|
|
384
|
+
configurable: true
|
|
385
|
+
});
|
|
286
386
|
ButtonDirective.prototype.ngOnInit = function () {
|
|
287
387
|
var _this = this;
|
|
288
388
|
var isSpan = this.element.tagName === SPAN_TAG_NAME;
|
|
289
|
-
|
|
290
|
-
this.buttonLookChangeSubscription = this.service.buttonLookChange
|
|
291
|
-
.pipe(filter(function (look) { return look !== 'default'; }))
|
|
292
|
-
.subscribe(function (look) { return _this.look = look; });
|
|
293
|
-
}
|
|
389
|
+
this.addTextSpan();
|
|
294
390
|
if (!this.element.hasAttribute('role') && this.togglable) {
|
|
295
391
|
this.toggleAriaPressed(this.toggleable);
|
|
296
392
|
}
|
|
@@ -300,7 +396,8 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
300
396
|
this.ngZone.runOutsideAngular(function () {
|
|
301
397
|
_this.domEvents.push(_this.renderer.listen(_this.element, 'click', _this._onButtonClick.bind(_this)));
|
|
302
398
|
_this.domEvents.push(_this.renderer.listen(_this.element, 'keydown', function (event) {
|
|
303
|
-
|
|
399
|
+
var isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
|
|
400
|
+
if (isSpan && isSpaceOrEnter) {
|
|
304
401
|
_this.click.emit(event);
|
|
305
402
|
_this._onButtonClick();
|
|
306
403
|
}
|
|
@@ -312,17 +409,22 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
312
409
|
this.toggleAriaPressed(this.toggleable);
|
|
313
410
|
}
|
|
314
411
|
};
|
|
412
|
+
ButtonDirective.prototype.ngAfterViewInit = function () {
|
|
413
|
+
var _this = this;
|
|
414
|
+
var stylingOptions = ['size', 'rounded', 'shape', 'fillMode'];
|
|
415
|
+
stylingOptions.forEach(function (input) {
|
|
416
|
+
_this.handleClasses(_this[input], input);
|
|
417
|
+
});
|
|
418
|
+
};
|
|
315
419
|
ButtonDirective.prototype.ngAfterViewChecked = function () {
|
|
316
420
|
this.setIconTextClasses();
|
|
317
421
|
};
|
|
318
422
|
ButtonDirective.prototype.ngOnDestroy = function () {
|
|
319
423
|
this.imageNode = null;
|
|
320
424
|
this.iconNode = null;
|
|
425
|
+
this.iconSpanNode = null;
|
|
321
426
|
this.renderer = null;
|
|
322
427
|
this.localizationChangeSubscription.unsubscribe();
|
|
323
|
-
if (this.service && this.buttonLookChangeSubscription) {
|
|
324
|
-
this.buttonLookChangeSubscription.unsubscribe();
|
|
325
|
-
}
|
|
326
428
|
clearTimeout(this.deferTimeout);
|
|
327
429
|
this.domEvents.forEach(function (unbindHandler) { return unbindHandler(); });
|
|
328
430
|
};
|
|
@@ -366,7 +468,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
366
468
|
var changed = this.selected !== value;
|
|
367
469
|
this.selected = value;
|
|
368
470
|
this.setAttribute('aria-pressed', this.selected.toString());
|
|
369
|
-
this.toggleClass('k-
|
|
471
|
+
this.toggleClass('k-selected', this.selected);
|
|
370
472
|
if (changed && hasObservers(this.selectedChange)) {
|
|
371
473
|
this.ngZone.run(function () {
|
|
372
474
|
_this.selectedChange.emit(value);
|
|
@@ -386,14 +488,25 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
386
488
|
};
|
|
387
489
|
ButtonDirective.prototype.hasText = function () {
|
|
388
490
|
if (isDocumentAvailable()) {
|
|
389
|
-
return
|
|
491
|
+
return this.element.textContent.trim().length > 0;
|
|
390
492
|
}
|
|
391
493
|
else {
|
|
392
494
|
return false;
|
|
393
495
|
}
|
|
394
496
|
};
|
|
497
|
+
Object.defineProperty(ButtonDirective.prototype, "text", {
|
|
498
|
+
get: function () {
|
|
499
|
+
if (isDocumentAvailable()) {
|
|
500
|
+
return this.element.innerHTML.trim();
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
enumerable: true,
|
|
504
|
+
configurable: true
|
|
505
|
+
});
|
|
395
506
|
ButtonDirective.prototype.addImgIcon = function (imageUrl) {
|
|
396
507
|
var renderer = this.renderer;
|
|
508
|
+
this.iconSpanNode = renderer.createElement('span');
|
|
509
|
+
renderer.setProperty(this.iconSpanNode, 'className', 'k-button-icon k-icon');
|
|
397
510
|
if (this.imageNode) {
|
|
398
511
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
399
512
|
}
|
|
@@ -402,8 +515,9 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
402
515
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
403
516
|
renderer.setProperty(this.imageNode, 'className', 'k-image');
|
|
404
517
|
renderer.setAttribute(this.imageNode, 'role', 'presentation');
|
|
405
|
-
this.prependChild(this.imageNode);
|
|
406
518
|
}
|
|
519
|
+
this.iconSpanNode.appendChild(this.imageNode);
|
|
520
|
+
this.prependChild(this.iconSpanNode);
|
|
407
521
|
};
|
|
408
522
|
ButtonDirective.prototype.addIcon = function (classNames) {
|
|
409
523
|
var renderer = this.renderer;
|
|
@@ -417,6 +531,11 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
417
531
|
this.prependChild(this.iconNode);
|
|
418
532
|
}
|
|
419
533
|
};
|
|
534
|
+
ButtonDirective.prototype.addTextSpan = function () {
|
|
535
|
+
if (isDocumentAvailable() && this.hasText()) {
|
|
536
|
+
this.element.innerHTML = "<span class='k-button-text'>" + this.text + "</span>";
|
|
537
|
+
}
|
|
538
|
+
};
|
|
420
539
|
ButtonDirective.prototype.prependChild = function (node) {
|
|
421
540
|
var _this = this;
|
|
422
541
|
this.defer(function () {
|
|
@@ -440,7 +559,9 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
440
559
|
ButtonDirective.prototype.removeImageNode = function () {
|
|
441
560
|
if (this.imageNode && this.renderer.parentNode(this.imageNode)) {
|
|
442
561
|
this.renderer.removeChild(this.element, this.imageNode);
|
|
562
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
443
563
|
this.imageNode = null;
|
|
564
|
+
this.iconSpanNode = null;
|
|
444
565
|
}
|
|
445
566
|
};
|
|
446
567
|
ButtonDirective.prototype.removeIconNode = function () {
|
|
@@ -448,6 +569,10 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
448
569
|
this.renderer.removeChild(this.element, this.iconNode);
|
|
449
570
|
this.iconNode = null;
|
|
450
571
|
}
|
|
572
|
+
if (this.iconSpanNode) {
|
|
573
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
574
|
+
this.iconSpanNode = null;
|
|
575
|
+
}
|
|
451
576
|
};
|
|
452
577
|
ButtonDirective.prototype.updateIconNode = function () {
|
|
453
578
|
if (!this.isIcon && !this.isIconClass) {
|
|
@@ -456,9 +581,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
456
581
|
};
|
|
457
582
|
ButtonDirective.prototype.setIconTextClasses = function () {
|
|
458
583
|
var hasIcon = this.isIcon || this.isIconClass || this.imageNode;
|
|
459
|
-
|
|
460
|
-
this.toggleClass('k-button-icon', hasIcon && !hasText);
|
|
461
|
-
this.toggleClass('k-button-icontext', hasIcon && hasText);
|
|
584
|
+
this.toggleClass('k-icon-button', hasIcon && !this.hasText());
|
|
462
585
|
};
|
|
463
586
|
ButtonDirective.prototype.toggleClass = function (className, add) {
|
|
464
587
|
if (add) {
|
|
@@ -479,6 +602,31 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
479
602
|
this.setSelected(!this.selected);
|
|
480
603
|
}
|
|
481
604
|
};
|
|
605
|
+
ButtonDirective.prototype.handleClasses = function (value, input) {
|
|
606
|
+
var elem = this.element;
|
|
607
|
+
var classes = getStylingClasses('button', input, this[input], value);
|
|
608
|
+
if (input === 'fillMode') {
|
|
609
|
+
this.handleThemeColor(this.themeColor, this[input], value);
|
|
610
|
+
}
|
|
611
|
+
if (classes.toRemove) {
|
|
612
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
613
|
+
}
|
|
614
|
+
if (classes.toAdd) {
|
|
615
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
ButtonDirective.prototype.handleThemeColor = function (value, prevFillMode, fillMode) {
|
|
619
|
+
var elem = this.element;
|
|
620
|
+
var removeFillMode = prevFillMode ? prevFillMode : this.fillMode;
|
|
621
|
+
var addFillMode = fillMode ? fillMode : this.fillMode;
|
|
622
|
+
var themeColorClass = getThemeColorClasses('button', removeFillMode, addFillMode, this.themeColor, value);
|
|
623
|
+
this.renderer.removeClass(elem, themeColorClass.toRemove);
|
|
624
|
+
if (addFillMode !== null && fillMode !== null) {
|
|
625
|
+
if (themeColorClass.toAdd) {
|
|
626
|
+
this.renderer.addClass(elem, themeColorClass.toAdd);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
};
|
|
482
630
|
tslib_1.__decorate([
|
|
483
631
|
Input(),
|
|
484
632
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -488,14 +636,6 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
488
636
|
tslib_1.__metadata("design:type", Boolean),
|
|
489
637
|
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
490
638
|
], ButtonDirective.prototype, "togglable", null);
|
|
491
|
-
tslib_1.__decorate([
|
|
492
|
-
Input(),
|
|
493
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
494
|
-
], ButtonDirective.prototype, "primary", void 0);
|
|
495
|
-
tslib_1.__decorate([
|
|
496
|
-
Input(),
|
|
497
|
-
tslib_1.__metadata("design:type", String)
|
|
498
|
-
], ButtonDirective.prototype, "look", void 0);
|
|
499
639
|
tslib_1.__decorate([
|
|
500
640
|
Input(),
|
|
501
641
|
tslib_1.__metadata("design:type", Boolean),
|
|
@@ -526,6 +666,31 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
526
666
|
tslib_1.__metadata("design:type", Boolean),
|
|
527
667
|
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
528
668
|
], ButtonDirective.prototype, "disabled", null);
|
|
669
|
+
tslib_1.__decorate([
|
|
670
|
+
Input(),
|
|
671
|
+
tslib_1.__metadata("design:type", String),
|
|
672
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
673
|
+
], ButtonDirective.prototype, "size", null);
|
|
674
|
+
tslib_1.__decorate([
|
|
675
|
+
Input(),
|
|
676
|
+
tslib_1.__metadata("design:type", String),
|
|
677
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
678
|
+
], ButtonDirective.prototype, "rounded", null);
|
|
679
|
+
tslib_1.__decorate([
|
|
680
|
+
Input(),
|
|
681
|
+
tslib_1.__metadata("design:type", String),
|
|
682
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
683
|
+
], ButtonDirective.prototype, "fillMode", null);
|
|
684
|
+
tslib_1.__decorate([
|
|
685
|
+
Input(),
|
|
686
|
+
tslib_1.__metadata("design:type", String),
|
|
687
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
688
|
+
], ButtonDirective.prototype, "themeColor", null);
|
|
689
|
+
tslib_1.__decorate([
|
|
690
|
+
Input(),
|
|
691
|
+
tslib_1.__metadata("design:type", String),
|
|
692
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
693
|
+
], ButtonDirective.prototype, "shape", null);
|
|
529
694
|
tslib_1.__decorate([
|
|
530
695
|
Input(),
|
|
531
696
|
tslib_1.__metadata("design:type", String)
|
|
@@ -543,36 +708,11 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
543
708
|
tslib_1.__metadata("design:type", Boolean),
|
|
544
709
|
tslib_1.__metadata("design:paramtypes", [])
|
|
545
710
|
], ButtonDirective.prototype, "classButton", null);
|
|
546
|
-
tslib_1.__decorate([
|
|
547
|
-
HostBinding('class.k-primary'),
|
|
548
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
549
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
550
|
-
], ButtonDirective.prototype, "classPrimary", null);
|
|
551
711
|
tslib_1.__decorate([
|
|
552
712
|
HostBinding('class.k-toggle-button'),
|
|
553
713
|
tslib_1.__metadata("design:type", Boolean),
|
|
554
714
|
tslib_1.__metadata("design:paramtypes", [])
|
|
555
715
|
], ButtonDirective.prototype, "isToggleable", null);
|
|
556
|
-
tslib_1.__decorate([
|
|
557
|
-
HostBinding('class.k-flat'),
|
|
558
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
559
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
560
|
-
], ButtonDirective.prototype, "isFlat", null);
|
|
561
|
-
tslib_1.__decorate([
|
|
562
|
-
HostBinding('class.k-bare'),
|
|
563
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
564
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
565
|
-
], ButtonDirective.prototype, "isBare", null);
|
|
566
|
-
tslib_1.__decorate([
|
|
567
|
-
HostBinding('class.k-outline'),
|
|
568
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
569
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
570
|
-
], ButtonDirective.prototype, "isOutline", null);
|
|
571
|
-
tslib_1.__decorate([
|
|
572
|
-
HostBinding('class.k-button-clear'),
|
|
573
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
574
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
575
|
-
], ButtonDirective.prototype, "isClear", null);
|
|
576
716
|
tslib_1.__decorate([
|
|
577
717
|
HostBinding('attr.role'),
|
|
578
718
|
tslib_1.__metadata("design:type", String),
|
|
@@ -580,12 +720,12 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
580
720
|
], ButtonDirective.prototype, "roleSetter", null);
|
|
581
721
|
tslib_1.__decorate([
|
|
582
722
|
HostBinding('attr.aria-disabled'),
|
|
583
|
-
HostBinding('class.k-
|
|
723
|
+
HostBinding('class.k-disabled'),
|
|
584
724
|
tslib_1.__metadata("design:type", Boolean),
|
|
585
725
|
tslib_1.__metadata("design:paramtypes", [])
|
|
586
726
|
], ButtonDirective.prototype, "classDisabled", null);
|
|
587
727
|
tslib_1.__decorate([
|
|
588
|
-
HostBinding('class.k-
|
|
728
|
+
HostBinding('class.k-selected'),
|
|
589
729
|
tslib_1.__metadata("design:type", Boolean),
|
|
590
730
|
tslib_1.__metadata("design:paramtypes", [])
|
|
591
731
|
], ButtonDirective.prototype, "classActive", null);
|
|
@@ -606,6 +746,16 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
606
746
|
tslib_1.__metadata("design:paramtypes", []),
|
|
607
747
|
tslib_1.__metadata("design:returntype", void 0)
|
|
608
748
|
], ButtonDirective.prototype, "onBlur", null);
|
|
749
|
+
tslib_1.__decorate([
|
|
750
|
+
Input(),
|
|
751
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
752
|
+
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
753
|
+
], ButtonDirective.prototype, "primary", null);
|
|
754
|
+
tslib_1.__decorate([
|
|
755
|
+
Input(),
|
|
756
|
+
tslib_1.__metadata("design:type", String),
|
|
757
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
758
|
+
], ButtonDirective.prototype, "look", null);
|
|
609
759
|
ButtonDirective = tslib_1.__decorate([
|
|
610
760
|
Directive({
|
|
611
761
|
exportAs: 'kendoButton',
|
|
@@ -616,7 +766,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
616
766
|
useValue: 'kendo.button'
|
|
617
767
|
}
|
|
618
768
|
],
|
|
619
|
-
selector: 'button[kendoButton], span[kendoButton]'
|
|
769
|
+
selector: 'button[kendoButton], span[kendoButton]',
|
|
620
770
|
}),
|
|
621
771
|
tslib_1.__param(2, Optional()),
|
|
622
772
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
@@ -4,22 +4,18 @@
|
|
|
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
|
*/
|
|
11
11
|
var KendoButtonService = /** @class */ (function () {
|
|
12
12
|
function KendoButtonService() {
|
|
13
|
-
this.buttonLookChange = new BehaviorSubject('default');
|
|
14
13
|
this.buttonClicked = new Subject();
|
|
15
14
|
this.buttonClicked$ = this.buttonClicked.asObservable();
|
|
16
15
|
}
|
|
17
16
|
KendoButtonService.prototype.click = function (button) {
|
|
18
17
|
this.buttonClicked.next(button);
|
|
19
18
|
};
|
|
20
|
-
KendoButtonService.prototype.setButtonLook = function (look) {
|
|
21
|
-
this.buttonLookChange.next(look);
|
|
22
|
-
};
|
|
23
19
|
KendoButtonService = tslib_1.__decorate([
|
|
24
20
|
Injectable()
|
|
25
21
|
], KendoButtonService);
|
|
@@ -26,17 +26,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
26
26
|
* By default, the selection mode of the ButtonGroup is set to `multiple`.
|
|
27
27
|
*/
|
|
28
28
|
this.selection = 'multiple';
|
|
29
|
-
/**
|
|
30
|
-
* Changes the visual appearance by using alternative styling options
|
|
31
|
-
* ([more information and examples]({% slug styling_buttongroup %})).
|
|
32
|
-
* The `look` property of the ButtonGroup takes precedence over the `look` property
|
|
33
|
-
* of the individual buttons that are part of the group.
|
|
34
|
-
*
|
|
35
|
-
* The available values are:
|
|
36
|
-
* * `flat`
|
|
37
|
-
* * `outline`
|
|
38
|
-
*/
|
|
39
|
-
this.look = 'default';
|
|
40
29
|
/**
|
|
41
30
|
* Fires every time keyboard navigation occurs.
|
|
42
31
|
*/
|
|
@@ -83,27 +72,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
83
72
|
enumerable: true,
|
|
84
73
|
configurable: true
|
|
85
74
|
});
|
|
86
|
-
Object.defineProperty(ButtonGroupComponent.prototype, "isFlat", {
|
|
87
|
-
get: function () {
|
|
88
|
-
return this.look === 'flat';
|
|
89
|
-
},
|
|
90
|
-
enumerable: true,
|
|
91
|
-
configurable: true
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(ButtonGroupComponent.prototype, "isBare", {
|
|
94
|
-
get: function () {
|
|
95
|
-
return this.look === 'bare';
|
|
96
|
-
},
|
|
97
|
-
enumerable: true,
|
|
98
|
-
configurable: true
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(ButtonGroupComponent.prototype, "isOutline", {
|
|
101
|
-
get: function () {
|
|
102
|
-
return this.look === 'outline';
|
|
103
|
-
},
|
|
104
|
-
enumerable: true,
|
|
105
|
-
configurable: true
|
|
106
|
-
});
|
|
107
75
|
Object.defineProperty(ButtonGroupComponent.prototype, "getRole", {
|
|
108
76
|
get: function () {
|
|
109
77
|
return this.isSelectionSingle() ? 'radiogroup' : 'group';
|
|
@@ -169,7 +137,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
169
137
|
};
|
|
170
138
|
ButtonGroupComponent.prototype.ngOnInit = function () {
|
|
171
139
|
var _this = this;
|
|
172
|
-
this.service.setButtonLook(this.look);
|
|
173
140
|
this.subscription = this.service.buttonClicked$.subscribe(function (button) {
|
|
174
141
|
var newSelectionValue;
|
|
175
142
|
if (_this.isSelectionSingle()) {
|
|
@@ -289,10 +256,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
289
256
|
Input('width'),
|
|
290
257
|
tslib_1.__metadata("design:type", String)
|
|
291
258
|
], ButtonGroupComponent.prototype, "width", void 0);
|
|
292
|
-
tslib_1.__decorate([
|
|
293
|
-
Input(),
|
|
294
|
-
tslib_1.__metadata("design:type", String)
|
|
295
|
-
], ButtonGroupComponent.prototype, "look", void 0);
|
|
296
259
|
tslib_1.__decorate([
|
|
297
260
|
Input(),
|
|
298
261
|
tslib_1.__metadata("design:type", Number),
|
|
@@ -312,7 +275,7 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
312
275
|
tslib_1.__metadata("design:paramtypes", [])
|
|
313
276
|
], ButtonGroupComponent.prototype, "wrapperClass", null);
|
|
314
277
|
tslib_1.__decorate([
|
|
315
|
-
HostBinding('class.k-
|
|
278
|
+
HostBinding('class.k-disabled'),
|
|
316
279
|
tslib_1.__metadata("design:type", Boolean),
|
|
317
280
|
tslib_1.__metadata("design:paramtypes", [])
|
|
318
281
|
], ButtonGroupComponent.prototype, "disabledClass", null);
|
|
@@ -321,21 +284,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
321
284
|
tslib_1.__metadata("design:type", Boolean),
|
|
322
285
|
tslib_1.__metadata("design:paramtypes", [])
|
|
323
286
|
], ButtonGroupComponent.prototype, "stretchedClass", null);
|
|
324
|
-
tslib_1.__decorate([
|
|
325
|
-
HostBinding('class.k-button-group-flat'),
|
|
326
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
327
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
328
|
-
], ButtonGroupComponent.prototype, "isFlat", null);
|
|
329
|
-
tslib_1.__decorate([
|
|
330
|
-
HostBinding('class.k-button-group-bare'),
|
|
331
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
332
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
333
|
-
], ButtonGroupComponent.prototype, "isBare", null);
|
|
334
|
-
tslib_1.__decorate([
|
|
335
|
-
HostBinding('class.k-button-group-outline'),
|
|
336
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
337
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
338
|
-
], ButtonGroupComponent.prototype, "isOutline", null);
|
|
339
287
|
tslib_1.__decorate([
|
|
340
288
|
HostBinding('attr.role'),
|
|
341
289
|
tslib_1.__metadata("design:type", String),
|