@progress/kendo-angular-buttons 6.4.1 → 7.0.0-dev.202201180832
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/LICENSE.md +1 -1
- package/NOTICE.txt +119 -79
- package/README.md +1 -1
- 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 +14 -11
- 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,37 @@ 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
|
+
default:
|
|
376
|
+
this.fillMode = value;
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
enumerable: true,
|
|
381
|
+
configurable: true
|
|
382
|
+
});
|
|
286
383
|
ButtonDirective.prototype.ngOnInit = function () {
|
|
287
384
|
var _this = this;
|
|
288
385
|
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
|
-
}
|
|
386
|
+
this.addTextSpan();
|
|
294
387
|
if (!this.element.hasAttribute('role') && this.togglable) {
|
|
295
388
|
this.toggleAriaPressed(this.toggleable);
|
|
296
389
|
}
|
|
@@ -300,7 +393,8 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
300
393
|
this.ngZone.runOutsideAngular(function () {
|
|
301
394
|
_this.domEvents.push(_this.renderer.listen(_this.element, 'click', _this._onButtonClick.bind(_this)));
|
|
302
395
|
_this.domEvents.push(_this.renderer.listen(_this.element, 'keydown', function (event) {
|
|
303
|
-
|
|
396
|
+
var isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
|
|
397
|
+
if (isSpan && isSpaceOrEnter) {
|
|
304
398
|
_this.click.emit(event);
|
|
305
399
|
_this._onButtonClick();
|
|
306
400
|
}
|
|
@@ -312,17 +406,22 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
312
406
|
this.toggleAriaPressed(this.toggleable);
|
|
313
407
|
}
|
|
314
408
|
};
|
|
409
|
+
ButtonDirective.prototype.ngAfterViewInit = function () {
|
|
410
|
+
var _this = this;
|
|
411
|
+
var stylingOptions = ['size', 'rounded', 'shape', 'fillMode'];
|
|
412
|
+
stylingOptions.forEach(function (input) {
|
|
413
|
+
_this.handleClasses(_this[input], input);
|
|
414
|
+
});
|
|
415
|
+
};
|
|
315
416
|
ButtonDirective.prototype.ngAfterViewChecked = function () {
|
|
316
417
|
this.setIconTextClasses();
|
|
317
418
|
};
|
|
318
419
|
ButtonDirective.prototype.ngOnDestroy = function () {
|
|
319
420
|
this.imageNode = null;
|
|
320
421
|
this.iconNode = null;
|
|
422
|
+
this.iconSpanNode = null;
|
|
321
423
|
this.renderer = null;
|
|
322
424
|
this.localizationChangeSubscription.unsubscribe();
|
|
323
|
-
if (this.service && this.buttonLookChangeSubscription) {
|
|
324
|
-
this.buttonLookChangeSubscription.unsubscribe();
|
|
325
|
-
}
|
|
326
425
|
clearTimeout(this.deferTimeout);
|
|
327
426
|
this.domEvents.forEach(function (unbindHandler) { return unbindHandler(); });
|
|
328
427
|
};
|
|
@@ -366,7 +465,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
366
465
|
var changed = this.selected !== value;
|
|
367
466
|
this.selected = value;
|
|
368
467
|
this.setAttribute('aria-pressed', this.selected.toString());
|
|
369
|
-
this.toggleClass('k-
|
|
468
|
+
this.toggleClass('k-selected', this.selected);
|
|
370
469
|
if (changed && hasObservers(this.selectedChange)) {
|
|
371
470
|
this.ngZone.run(function () {
|
|
372
471
|
_this.selectedChange.emit(value);
|
|
@@ -386,14 +485,25 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
386
485
|
};
|
|
387
486
|
ButtonDirective.prototype.hasText = function () {
|
|
388
487
|
if (isDocumentAvailable()) {
|
|
389
|
-
return
|
|
488
|
+
return this.element.textContent.trim().length > 0;
|
|
390
489
|
}
|
|
391
490
|
else {
|
|
392
491
|
return false;
|
|
393
492
|
}
|
|
394
493
|
};
|
|
494
|
+
Object.defineProperty(ButtonDirective.prototype, "text", {
|
|
495
|
+
get: function () {
|
|
496
|
+
if (isDocumentAvailable()) {
|
|
497
|
+
return this.element.innerHTML.trim();
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
enumerable: true,
|
|
501
|
+
configurable: true
|
|
502
|
+
});
|
|
395
503
|
ButtonDirective.prototype.addImgIcon = function (imageUrl) {
|
|
396
504
|
var renderer = this.renderer;
|
|
505
|
+
this.iconSpanNode = renderer.createElement('span');
|
|
506
|
+
renderer.setProperty(this.iconSpanNode, 'className', 'k-button-icon k-icon');
|
|
397
507
|
if (this.imageNode) {
|
|
398
508
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
399
509
|
}
|
|
@@ -402,8 +512,9 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
402
512
|
renderer.setProperty(this.imageNode, 'src', imageUrl);
|
|
403
513
|
renderer.setProperty(this.imageNode, 'className', 'k-image');
|
|
404
514
|
renderer.setAttribute(this.imageNode, 'role', 'presentation');
|
|
405
|
-
this.prependChild(this.imageNode);
|
|
406
515
|
}
|
|
516
|
+
this.iconSpanNode.appendChild(this.imageNode);
|
|
517
|
+
this.prependChild(this.iconSpanNode);
|
|
407
518
|
};
|
|
408
519
|
ButtonDirective.prototype.addIcon = function (classNames) {
|
|
409
520
|
var renderer = this.renderer;
|
|
@@ -417,6 +528,11 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
417
528
|
this.prependChild(this.iconNode);
|
|
418
529
|
}
|
|
419
530
|
};
|
|
531
|
+
ButtonDirective.prototype.addTextSpan = function () {
|
|
532
|
+
if (isDocumentAvailable() && this.hasText()) {
|
|
533
|
+
this.element.innerHTML = "<span class='k-button-text'>" + this.text + "</span>";
|
|
534
|
+
}
|
|
535
|
+
};
|
|
420
536
|
ButtonDirective.prototype.prependChild = function (node) {
|
|
421
537
|
var _this = this;
|
|
422
538
|
this.defer(function () {
|
|
@@ -440,7 +556,9 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
440
556
|
ButtonDirective.prototype.removeImageNode = function () {
|
|
441
557
|
if (this.imageNode && this.renderer.parentNode(this.imageNode)) {
|
|
442
558
|
this.renderer.removeChild(this.element, this.imageNode);
|
|
559
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
443
560
|
this.imageNode = null;
|
|
561
|
+
this.iconSpanNode = null;
|
|
444
562
|
}
|
|
445
563
|
};
|
|
446
564
|
ButtonDirective.prototype.removeIconNode = function () {
|
|
@@ -448,6 +566,10 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
448
566
|
this.renderer.removeChild(this.element, this.iconNode);
|
|
449
567
|
this.iconNode = null;
|
|
450
568
|
}
|
|
569
|
+
if (this.iconSpanNode) {
|
|
570
|
+
this.renderer.removeChild(this.element, this.iconSpanNode);
|
|
571
|
+
this.iconSpanNode = null;
|
|
572
|
+
}
|
|
451
573
|
};
|
|
452
574
|
ButtonDirective.prototype.updateIconNode = function () {
|
|
453
575
|
if (!this.isIcon && !this.isIconClass) {
|
|
@@ -456,9 +578,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
456
578
|
};
|
|
457
579
|
ButtonDirective.prototype.setIconTextClasses = function () {
|
|
458
580
|
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);
|
|
581
|
+
this.toggleClass('k-icon-button', hasIcon && !this.hasText());
|
|
462
582
|
};
|
|
463
583
|
ButtonDirective.prototype.toggleClass = function (className, add) {
|
|
464
584
|
if (add) {
|
|
@@ -479,6 +599,31 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
479
599
|
this.setSelected(!this.selected);
|
|
480
600
|
}
|
|
481
601
|
};
|
|
602
|
+
ButtonDirective.prototype.handleClasses = function (value, input) {
|
|
603
|
+
var elem = this.element;
|
|
604
|
+
var classes = getStylingClasses('button', input, this[input], value);
|
|
605
|
+
if (input === 'fillMode') {
|
|
606
|
+
this.handleThemeColor(this.themeColor, this[input], value);
|
|
607
|
+
}
|
|
608
|
+
if (classes.toRemove) {
|
|
609
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
610
|
+
}
|
|
611
|
+
if (classes.toAdd) {
|
|
612
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
ButtonDirective.prototype.handleThemeColor = function (value, prevFillMode, fillMode) {
|
|
616
|
+
var elem = this.element;
|
|
617
|
+
var removeFillMode = prevFillMode ? prevFillMode : this.fillMode;
|
|
618
|
+
var addFillMode = fillMode ? fillMode : this.fillMode;
|
|
619
|
+
var themeColorClass = getThemeColorClasses('button', removeFillMode, addFillMode, this.themeColor, value);
|
|
620
|
+
this.renderer.removeClass(elem, themeColorClass.toRemove);
|
|
621
|
+
if (addFillMode !== null && fillMode !== null) {
|
|
622
|
+
if (themeColorClass.toAdd) {
|
|
623
|
+
this.renderer.addClass(elem, themeColorClass.toAdd);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
};
|
|
482
627
|
tslib_1.__decorate([
|
|
483
628
|
Input(),
|
|
484
629
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -488,14 +633,6 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
488
633
|
tslib_1.__metadata("design:type", Boolean),
|
|
489
634
|
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
490
635
|
], 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
636
|
tslib_1.__decorate([
|
|
500
637
|
Input(),
|
|
501
638
|
tslib_1.__metadata("design:type", Boolean),
|
|
@@ -526,6 +663,31 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
526
663
|
tslib_1.__metadata("design:type", Boolean),
|
|
527
664
|
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
528
665
|
], ButtonDirective.prototype, "disabled", null);
|
|
666
|
+
tslib_1.__decorate([
|
|
667
|
+
Input(),
|
|
668
|
+
tslib_1.__metadata("design:type", String),
|
|
669
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
670
|
+
], ButtonDirective.prototype, "size", null);
|
|
671
|
+
tslib_1.__decorate([
|
|
672
|
+
Input(),
|
|
673
|
+
tslib_1.__metadata("design:type", String),
|
|
674
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
675
|
+
], ButtonDirective.prototype, "rounded", null);
|
|
676
|
+
tslib_1.__decorate([
|
|
677
|
+
Input(),
|
|
678
|
+
tslib_1.__metadata("design:type", String),
|
|
679
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
680
|
+
], ButtonDirective.prototype, "fillMode", null);
|
|
681
|
+
tslib_1.__decorate([
|
|
682
|
+
Input(),
|
|
683
|
+
tslib_1.__metadata("design:type", String),
|
|
684
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
685
|
+
], ButtonDirective.prototype, "themeColor", null);
|
|
686
|
+
tslib_1.__decorate([
|
|
687
|
+
Input(),
|
|
688
|
+
tslib_1.__metadata("design:type", String),
|
|
689
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
690
|
+
], ButtonDirective.prototype, "shape", null);
|
|
529
691
|
tslib_1.__decorate([
|
|
530
692
|
Input(),
|
|
531
693
|
tslib_1.__metadata("design:type", String)
|
|
@@ -543,36 +705,11 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
543
705
|
tslib_1.__metadata("design:type", Boolean),
|
|
544
706
|
tslib_1.__metadata("design:paramtypes", [])
|
|
545
707
|
], 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
708
|
tslib_1.__decorate([
|
|
552
709
|
HostBinding('class.k-toggle-button'),
|
|
553
710
|
tslib_1.__metadata("design:type", Boolean),
|
|
554
711
|
tslib_1.__metadata("design:paramtypes", [])
|
|
555
712
|
], 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
713
|
tslib_1.__decorate([
|
|
577
714
|
HostBinding('attr.role'),
|
|
578
715
|
tslib_1.__metadata("design:type", String),
|
|
@@ -580,12 +717,12 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
580
717
|
], ButtonDirective.prototype, "roleSetter", null);
|
|
581
718
|
tslib_1.__decorate([
|
|
582
719
|
HostBinding('attr.aria-disabled'),
|
|
583
|
-
HostBinding('class.k-
|
|
720
|
+
HostBinding('class.k-disabled'),
|
|
584
721
|
tslib_1.__metadata("design:type", Boolean),
|
|
585
722
|
tslib_1.__metadata("design:paramtypes", [])
|
|
586
723
|
], ButtonDirective.prototype, "classDisabled", null);
|
|
587
724
|
tslib_1.__decorate([
|
|
588
|
-
HostBinding('class.k-
|
|
725
|
+
HostBinding('class.k-selected'),
|
|
589
726
|
tslib_1.__metadata("design:type", Boolean),
|
|
590
727
|
tslib_1.__metadata("design:paramtypes", [])
|
|
591
728
|
], ButtonDirective.prototype, "classActive", null);
|
|
@@ -606,6 +743,16 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
606
743
|
tslib_1.__metadata("design:paramtypes", []),
|
|
607
744
|
tslib_1.__metadata("design:returntype", void 0)
|
|
608
745
|
], ButtonDirective.prototype, "onBlur", null);
|
|
746
|
+
tslib_1.__decorate([
|
|
747
|
+
Input(),
|
|
748
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
749
|
+
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
750
|
+
], ButtonDirective.prototype, "primary", null);
|
|
751
|
+
tslib_1.__decorate([
|
|
752
|
+
Input(),
|
|
753
|
+
tslib_1.__metadata("design:type", String),
|
|
754
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
755
|
+
], ButtonDirective.prototype, "look", null);
|
|
609
756
|
ButtonDirective = tslib_1.__decorate([
|
|
610
757
|
Directive({
|
|
611
758
|
exportAs: 'kendoButton',
|
|
@@ -616,7 +763,7 @@ var ButtonDirective = /** @class */ (function () {
|
|
|
616
763
|
useValue: 'kendo.button'
|
|
617
764
|
}
|
|
618
765
|
],
|
|
619
|
-
selector: 'button[kendoButton], span[kendoButton]'
|
|
766
|
+
selector: 'button[kendoButton], span[kendoButton]',
|
|
620
767
|
}),
|
|
621
768
|
tslib_1.__param(2, Optional()),
|
|
622
769
|
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);
|