@progress/kendo-angular-buttons 6.4.1-dev.202111011439 → 7.0.0-dev.202201121347
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 +236 -89
- package/dist/es/button/button.service.js +1 -5
- package/dist/es/buttongroup/buttongroup.component.js +11 -60
- package/dist/es/chip/chip-list.component.js +57 -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 +89 -36
- 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 +4 -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 +107 -37
- package/dist/es/util.js +52 -0
- package/dist/es2015/button/button.directive.d.ts +85 -22
- package/dist/es2015/button/button.directive.js +219 -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 +11 -48
- package/dist/es2015/chip/chip-list.component.d.ts +19 -3
- package/dist/es2015/chip/chip-list.component.js +52 -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 +59 -7
- package/dist/es2015/dropdownbutton/dropdownbutton.component.js +92 -31
- 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 +4 -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 +59 -12
- package/dist/es2015/splitbutton/splitbutton.component.js +113 -33
- package/dist/es2015/util.d.ts +21 -0
- package/dist/es2015/util.js +52 -0
- package/dist/fesm2015/index.js +862 -409
- package/dist/fesm5/index.js +853 -405
- package/dist/npm/button/button.directive.js +236 -89
- package/dist/npm/button/button.service.js +0 -4
- package/dist/npm/buttongroup/buttongroup.component.js +11 -60
- package/dist/npm/chip/chip-list.component.js +55 -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 +89 -36
- 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 +4 -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 +105 -35
- package/dist/npm/util.js +52 -0
- package/dist/systemjs/kendo-angular-buttons.js +1 -1
- package/package.json +13 -10
- 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,37 @@ 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
|
+
default:
|
|
378
|
+
this.fillMode = value;
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
enumerable: true,
|
|
383
|
+
configurable: true
|
|
384
|
+
});
|
|
288
385
|
ButtonDirective.prototype.ngOnInit = function () {
|
|
289
386
|
var _this = this;
|
|
290
387
|
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
|
-
}
|
|
388
|
+
this.addTextSpan();
|
|
296
389
|
if (!this.element.hasAttribute('role') && this.togglable) {
|
|
297
390
|
this.toggleAriaPressed(this.toggleable);
|
|
298
391
|
}
|
|
@@ -302,7 +395,8 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
302
395
|
this.ngZone.runOutsideAngular(function () {
|
|
303
396
|
_this.domEvents.push(_this.renderer.listen(_this.element, 'click', _this._onButtonClick.bind(_this)));
|
|
304
397
|
_this.domEvents.push(_this.renderer.listen(_this.element, 'keydown', function (event) {
|
|
305
|
-
|
|
398
|
+
var isSpaceOrEnter = event.keyCode === kendo_angular_common_1.Keys.Space || event.keyCode === kendo_angular_common_1.Keys.Enter;
|
|
399
|
+
if (isSpan && isSpaceOrEnter) {
|
|
306
400
|
_this.click.emit(event);
|
|
307
401
|
_this._onButtonClick();
|
|
308
402
|
}
|
|
@@ -314,17 +408,22 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
314
408
|
this.toggleAriaPressed(this.toggleable);
|
|
315
409
|
}
|
|
316
410
|
};
|
|
411
|
+
ButtonDirective.prototype.ngAfterViewInit = function () {
|
|
412
|
+
var _this = this;
|
|
413
|
+
var stylingOptions = ['size', 'rounded', 'shape', 'fillMode'];
|
|
414
|
+
stylingOptions.forEach(function (input) {
|
|
415
|
+
_this.handleClasses(_this[input], input);
|
|
416
|
+
});
|
|
417
|
+
};
|
|
317
418
|
ButtonDirective.prototype.ngAfterViewChecked = function () {
|
|
318
419
|
this.setIconTextClasses();
|
|
319
420
|
};
|
|
320
421
|
ButtonDirective.prototype.ngOnDestroy = function () {
|
|
321
422
|
this.imageNode = null;
|
|
322
423
|
this.iconNode = null;
|
|
424
|
+
this.iconSpanNode = null;
|
|
323
425
|
this.renderer = null;
|
|
324
426
|
this.localizationChangeSubscription.unsubscribe();
|
|
325
|
-
if (this.service && this.buttonLookChangeSubscription) {
|
|
326
|
-
this.buttonLookChangeSubscription.unsubscribe();
|
|
327
|
-
}
|
|
328
427
|
clearTimeout(this.deferTimeout);
|
|
329
428
|
this.domEvents.forEach(function (unbindHandler) { return unbindHandler(); });
|
|
330
429
|
};
|
|
@@ -368,7 +467,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
368
467
|
var changed = this.selected !== value;
|
|
369
468
|
this.selected = value;
|
|
370
469
|
this.setAttribute('aria-pressed', this.selected.toString());
|
|
371
|
-
this.toggleClass('k-
|
|
470
|
+
this.toggleClass('k-selected', this.selected);
|
|
372
471
|
if (changed && kendo_angular_common_1.hasObservers(this.selectedChange)) {
|
|
373
472
|
this.ngZone.run(function () {
|
|
374
473
|
_this.selectedChange.emit(value);
|
|
@@ -388,14 +487,25 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
388
487
|
};
|
|
389
488
|
ButtonDirective.prototype.hasText = function () {
|
|
390
489
|
if (kendo_angular_common_1.isDocumentAvailable()) {
|
|
391
|
-
return
|
|
490
|
+
return this.element.textContent.trim().length > 0;
|
|
392
491
|
}
|
|
393
492
|
else {
|
|
394
493
|
return false;
|
|
395
494
|
}
|
|
396
495
|
};
|
|
496
|
+
Object.defineProperty(ButtonDirective.prototype, "text", {
|
|
497
|
+
get: function () {
|
|
498
|
+
if (kendo_angular_common_1.isDocumentAvailable()) {
|
|
499
|
+
return this.element.innerHTML.trim();
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
enumerable: true,
|
|
503
|
+
configurable: true
|
|
504
|
+
});
|
|
397
505
|
ButtonDirective.prototype.addImgIcon = function (imageUrl) {
|
|
398
506
|
var renderer = this.renderer;
|
|
507
|
+
this.iconSpanNode = renderer.createElement('span');
|
|
508
|
+
renderer.setProperty(this.iconSpanNode, 'className', 'k-button-icon k-icon');
|
|
399
509
|
if (this.imageNode) {
|
|
400
510
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
401
511
|
}
|
|
@@ -404,8 +514,9 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
404
514
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
405
515
|
renderer.setProperty(this.imageNode, 'className', 'k-image');
|
|
406
516
|
renderer.setAttribute(this.imageNode, 'role', 'presentation');
|
|
407
|
-
this.prependChild(this.imageNode);
|
|
408
517
|
}
|
|
518
|
+
this.iconSpanNode.appendChild(this.imageNode);
|
|
519
|
+
this.prependChild(this.iconSpanNode);
|
|
409
520
|
};
|
|
410
521
|
ButtonDirective.prototype.addIcon = function (classNames) {
|
|
411
522
|
var renderer = this.renderer;
|
|
@@ -419,6 +530,11 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
419
530
|
this.prependChild(this.iconNode);
|
|
420
531
|
}
|
|
421
532
|
};
|
|
533
|
+
ButtonDirective.prototype.addTextSpan = function () {
|
|
534
|
+
if (kendo_angular_common_1.isDocumentAvailable() && this.hasText()) {
|
|
535
|
+
this.element.innerHTML = "<span class='k-button-text'>" + this.text + "</span>";
|
|
536
|
+
}
|
|
537
|
+
};
|
|
422
538
|
ButtonDirective.prototype.prependChild = function (node) {
|
|
423
539
|
var _this = this;
|
|
424
540
|
this.defer(function () {
|
|
@@ -442,7 +558,9 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
442
558
|
ButtonDirective.prototype.removeImageNode = function () {
|
|
443
559
|
if (this.imageNode && this.renderer.parentNode(this.imageNode)) {
|
|
444
560
|
this.renderer.removeChild(this.element, this.imageNode);
|
|
561
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
445
562
|
this.imageNode = null;
|
|
563
|
+
this.iconSpanNode = null;
|
|
446
564
|
}
|
|
447
565
|
};
|
|
448
566
|
ButtonDirective.prototype.removeIconNode = function () {
|
|
@@ -450,6 +568,10 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
450
568
|
this.renderer.removeChild(this.element, this.iconNode);
|
|
451
569
|
this.iconNode = null;
|
|
452
570
|
}
|
|
571
|
+
if (this.iconSpanNode) {
|
|
572
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
573
|
+
this.iconSpanNode = null;
|
|
574
|
+
}
|
|
453
575
|
};
|
|
454
576
|
ButtonDirective.prototype.updateIconNode = function () {
|
|
455
577
|
if (!this.isIcon && !this.isIconClass) {
|
|
@@ -458,9 +580,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
458
580
|
};
|
|
459
581
|
ButtonDirective.prototype.setIconTextClasses = function () {
|
|
460
582
|
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);
|
|
583
|
+
this.toggleClass('k-icon-button', hasIcon && !this.hasText());
|
|
464
584
|
};
|
|
465
585
|
ButtonDirective.prototype.toggleClass = function (className, add) {
|
|
466
586
|
if (add) {
|
|
@@ -481,6 +601,31 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
481
601
|
this.setSelected(!this.selected);
|
|
482
602
|
}
|
|
483
603
|
};
|
|
604
|
+
ButtonDirective.prototype.handleClasses = function (value, input) {
|
|
605
|
+
var elem = this.element;
|
|
606
|
+
var classes = util_1.getStylingClasses('button', input, this[input], value);
|
|
607
|
+
if (input === 'fillMode') {
|
|
608
|
+
this.handleThemeColor(this.themeColor, this[input], value);
|
|
609
|
+
}
|
|
610
|
+
if (classes.toRemove) {
|
|
611
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
612
|
+
}
|
|
613
|
+
if (classes.toAdd) {
|
|
614
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
ButtonDirective.prototype.handleThemeColor = function (value, prevFillMode, fillMode) {
|
|
618
|
+
var elem = this.element;
|
|
619
|
+
var removeFillMode = prevFillMode ? prevFillMode : this.fillMode;
|
|
620
|
+
var addFillMode = fillMode ? fillMode : this.fillMode;
|
|
621
|
+
var themeColorClass = util_1.getThemeColorClasses('button', removeFillMode, addFillMode, this.themeColor, value);
|
|
622
|
+
this.renderer.removeClass(elem, themeColorClass.toRemove);
|
|
623
|
+
if (addFillMode !== null && fillMode !== null) {
|
|
624
|
+
if (themeColorClass.toAdd) {
|
|
625
|
+
this.renderer.addClass(elem, themeColorClass.toAdd);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
};
|
|
484
629
|
tslib_1.__decorate([
|
|
485
630
|
core_1.Input(),
|
|
486
631
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -490,14 +635,6 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
490
635
|
tslib_1.__metadata("design:type", Boolean),
|
|
491
636
|
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
492
637
|
], 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
638
|
tslib_1.__decorate([
|
|
502
639
|
core_1.Input(),
|
|
503
640
|
tslib_1.__metadata("design:type", Boolean),
|
|
@@ -528,6 +665,31 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
528
665
|
tslib_1.__metadata("design:type", Boolean),
|
|
529
666
|
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
530
667
|
], ButtonDirective.prototype, "disabled", null);
|
|
668
|
+
tslib_1.__decorate([
|
|
669
|
+
core_1.Input(),
|
|
670
|
+
tslib_1.__metadata("design:type", String),
|
|
671
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
672
|
+
], ButtonDirective.prototype, "size", null);
|
|
673
|
+
tslib_1.__decorate([
|
|
674
|
+
core_1.Input(),
|
|
675
|
+
tslib_1.__metadata("design:type", String),
|
|
676
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
677
|
+
], ButtonDirective.prototype, "rounded", null);
|
|
678
|
+
tslib_1.__decorate([
|
|
679
|
+
core_1.Input(),
|
|
680
|
+
tslib_1.__metadata("design:type", String),
|
|
681
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
682
|
+
], ButtonDirective.prototype, "fillMode", null);
|
|
683
|
+
tslib_1.__decorate([
|
|
684
|
+
core_1.Input(),
|
|
685
|
+
tslib_1.__metadata("design:type", String),
|
|
686
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
687
|
+
], ButtonDirective.prototype, "themeColor", null);
|
|
688
|
+
tslib_1.__decorate([
|
|
689
|
+
core_1.Input(),
|
|
690
|
+
tslib_1.__metadata("design:type", String),
|
|
691
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
692
|
+
], ButtonDirective.prototype, "shape", null);
|
|
531
693
|
tslib_1.__decorate([
|
|
532
694
|
core_1.Input(),
|
|
533
695
|
tslib_1.__metadata("design:type", String)
|
|
@@ -545,36 +707,11 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
545
707
|
tslib_1.__metadata("design:type", Boolean),
|
|
546
708
|
tslib_1.__metadata("design:paramtypes", [])
|
|
547
709
|
], 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
710
|
tslib_1.__decorate([
|
|
554
711
|
core_1.HostBinding('class.k-toggle-button'),
|
|
555
712
|
tslib_1.__metadata("design:type", Boolean),
|
|
556
713
|
tslib_1.__metadata("design:paramtypes", [])
|
|
557
714
|
], 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
715
|
tslib_1.__decorate([
|
|
579
716
|
core_1.HostBinding('attr.role'),
|
|
580
717
|
tslib_1.__metadata("design:type", String),
|
|
@@ -582,12 +719,12 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
582
719
|
], ButtonDirective.prototype, "roleSetter", null);
|
|
583
720
|
tslib_1.__decorate([
|
|
584
721
|
core_1.HostBinding('attr.aria-disabled'),
|
|
585
|
-
core_1.HostBinding('class.k-
|
|
722
|
+
core_1.HostBinding('class.k-disabled'),
|
|
586
723
|
tslib_1.__metadata("design:type", Boolean),
|
|
587
724
|
tslib_1.__metadata("design:paramtypes", [])
|
|
588
725
|
], ButtonDirective.prototype, "classDisabled", null);
|
|
589
726
|
tslib_1.__decorate([
|
|
590
|
-
core_1.HostBinding('class.k-
|
|
727
|
+
core_1.HostBinding('class.k-selected'),
|
|
591
728
|
tslib_1.__metadata("design:type", Boolean),
|
|
592
729
|
tslib_1.__metadata("design:paramtypes", [])
|
|
593
730
|
], ButtonDirective.prototype, "classActive", null);
|
|
@@ -608,6 +745,16 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
608
745
|
tslib_1.__metadata("design:paramtypes", []),
|
|
609
746
|
tslib_1.__metadata("design:returntype", void 0)
|
|
610
747
|
], ButtonDirective.prototype, "onBlur", null);
|
|
748
|
+
tslib_1.__decorate([
|
|
749
|
+
core_1.Input(),
|
|
750
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
751
|
+
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
752
|
+
], ButtonDirective.prototype, "primary", null);
|
|
753
|
+
tslib_1.__decorate([
|
|
754
|
+
core_1.Input(),
|
|
755
|
+
tslib_1.__metadata("design:type", String),
|
|
756
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
757
|
+
], ButtonDirective.prototype, "look", null);
|
|
611
758
|
ButtonDirective = tslib_1.__decorate([
|
|
612
759
|
core_1.Directive({
|
|
613
760
|
exportAs: 'kendoButton',
|
|
@@ -618,7 +765,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
618
765
|
useValue: 'kendo.button'
|
|
619
766
|
}
|
|
620
767
|
],
|
|
621
|
-
selector: 'button[kendoButton], span[kendoButton]'
|
|
768
|
+
selector: 'button[kendoButton], span[kendoButton]',
|
|
622
769
|
}),
|
|
623
770
|
tslib_1.__param(2, core_1.Optional()),
|
|
624
771
|
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);
|