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