@progress/kendo-angular-inputs 7.5.2-dev.202111191702 → 8.0.0-dev.202112251033
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-inputs.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/checkbox/checkbox.directive.js +79 -3
- package/dist/es/colorpicker/color-contrast-svg.component.js +95 -0
- package/dist/es/colorpicker/color-gradient.component.js +109 -81
- package/dist/es/colorpicker/color-input.component.js +39 -18
- package/dist/es/colorpicker/color-palette.component.js +28 -18
- package/dist/es/colorpicker/colorpicker.component.js +297 -80
- package/dist/es/colorpicker/constants.js +12 -0
- package/dist/es/colorpicker/contrast-validation.component.js +8 -6
- package/dist/es/colorpicker/contrast.component.js +6 -8
- package/dist/es/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/es/colorpicker/events/cancel-event.js +19 -0
- package/dist/es/colorpicker/events/close-event.js +17 -0
- package/dist/es/colorpicker/{models → events}/kendo-drag-event.js +0 -0
- package/dist/es/colorpicker/events/open-event.js +17 -0
- package/dist/es/colorpicker/events.js +8 -0
- package/dist/es/colorpicker/flatcolorpicker-actions.component.js +50 -0
- package/dist/es/colorpicker/flatcolorpicker-header.component.js +94 -0
- package/dist/es/colorpicker/flatcolorpicker.component.js +553 -0
- package/dist/es/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/es/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/es/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/es/colorpicker/localization/flatcolorpicker-localization.service.js +34 -0
- package/dist/es/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/es/colorpicker/localization/messages.js +36 -0
- package/dist/es/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
- package/dist/{es2015/colorpicker/models/color-picker-view.js → es/colorpicker/models/colorpicker-view.js} +0 -0
- package/dist/es/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/es/colorpicker/models.js +1 -2
- package/dist/es/colorpicker/services/flatcolorpicker.service.js +41 -0
- package/dist/es/colorpicker/utils/color-parser.js +18 -5
- package/dist/es/colorpicker/utils/contrast-curve.js +91 -0
- package/dist/es/colorpicker/utils.js +1 -1
- package/dist/es/colorpicker.module.js +9 -1
- package/dist/es/common/models/fillmode.js +4 -0
- package/dist/es/common/models/rounded.js +4 -0
- package/dist/es/common/models/size.js +4 -0
- package/dist/es/common/models/styling-classes.js +4 -0
- package/dist/{es2015/colorpicker/models/kendo-drag-event.js → es/common/models.js} +0 -0
- package/dist/es/common/utils.js +37 -0
- package/dist/es/index.js +5 -0
- package/dist/es/main.js +4 -2
- package/dist/es/maskedtextbox/maskedtextbox.component.js +101 -6
- package/dist/es/numerictextbox/numerictextbox.component.js +116 -20
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/radiobutton.directive.js +52 -3
- package/dist/es/shared/textarea.directive.js +3 -2
- package/dist/es/switch/switch.component.js +167 -21
- package/dist/es/text-fields-common/text-fields-base.js +1 -1
- package/dist/es/textarea/textarea.component.js +101 -5
- package/dist/es/textbox/textbox.component.js +108 -11
- package/dist/es/textbox/textbox.directive.js +3 -2
- package/dist/es/textbox.module.js +0 -3
- package/dist/es2015/checkbox/checkbox.directive.d.ts +31 -0
- package/dist/es2015/checkbox/checkbox.directive.js +68 -10
- package/dist/es2015/colorpicker/color-contrast-svg.component.d.ts +26 -0
- package/dist/es2015/colorpicker/color-contrast-svg.component.js +97 -0
- package/dist/es2015/colorpicker/color-gradient.component.d.ts +32 -43
- package/dist/es2015/colorpicker/color-gradient.component.js +126 -93
- package/dist/es2015/colorpicker/color-input.component.d.ts +11 -4
- package/dist/es2015/colorpicker/color-input.component.js +52 -32
- package/dist/es2015/colorpicker/color-palette.component.d.ts +8 -3
- package/dist/es2015/colorpicker/color-palette.component.js +28 -18
- package/dist/es2015/colorpicker/colorpicker.component.d.ts +129 -23
- package/dist/es2015/colorpicker/colorpicker.component.js +319 -125
- package/dist/es2015/colorpicker/constants.d.ts +12 -0
- package/dist/es2015/colorpicker/constants.js +12 -0
- package/dist/es2015/colorpicker/contrast-validation.component.d.ts +1 -1
- package/dist/es2015/colorpicker/contrast-validation.component.js +16 -12
- package/dist/es2015/colorpicker/contrast.component.d.ts +1 -3
- package/dist/es2015/colorpicker/contrast.component.js +17 -17
- package/dist/es2015/colorpicker/{models → events}/active-color-click-event.d.ts +0 -0
- package/dist/es2015/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/es2015/colorpicker/events/cancel-event.d.ts +15 -0
- package/dist/es2015/colorpicker/events/cancel-event.js +14 -0
- package/dist/es2015/colorpicker/events/close-event.d.ts +10 -0
- package/dist/es2015/colorpicker/events/close-event.js +10 -0
- package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.d.ts +0 -0
- package/dist/es2015/colorpicker/events/kendo-drag-event.js +4 -0
- package/dist/es2015/colorpicker/events/open-event.d.ts +10 -0
- package/dist/es2015/colorpicker/events/open-event.js +10 -0
- package/dist/es2015/colorpicker/events.d.ts +8 -0
- package/dist/es2015/colorpicker/events.js +8 -0
- package/dist/es2015/colorpicker/flatcolorpicker-actions.component.d.ts +18 -0
- package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +60 -0
- package/dist/es2015/colorpicker/flatcolorpicker-header.component.d.ts +30 -0
- package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +131 -0
- package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +214 -0
- package/dist/es2015/colorpicker/flatcolorpicker.component.js +593 -0
- package/dist/es2015/colorpicker/localization/colorgradient-localization.service.d.ts +3 -3
- package/dist/es2015/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/es2015/colorpicker/localization/colorpalette-localization.service.d.ts +3 -3
- package/dist/es2015/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/es2015/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.d.ts +14 -0
- package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.js +31 -0
- package/dist/es2015/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/es2015/colorpicker/localization/messages.d.ts +36 -0
- package/dist/es2015/colorpicker/localization/messages.js +36 -0
- package/dist/es2015/colorpicker/models/actions-layout.d.ts +8 -0
- package/dist/es2015/colorpicker/models/actions-layout.js +4 -0
- package/dist/es2015/colorpicker/models/colorpicker-view.d.ts +8 -0
- package/dist/es2015/colorpicker/models/colorpicker-view.js +4 -0
- package/dist/es2015/colorpicker/models/gradient-settings.d.ts +4 -3
- package/dist/es2015/colorpicker/models/output-format.d.ts +0 -5
- package/dist/es2015/colorpicker/{utils → models}/palette-presets.d.ts +0 -0
- package/dist/es2015/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/es2015/colorpicker/models/palette-settings.d.ts +2 -3
- package/dist/es2015/colorpicker/models/tile-size.d.ts +1 -5
- package/dist/es2015/colorpicker/models.d.ts +10 -10
- package/dist/es2015/colorpicker/models.js +1 -2
- package/dist/es2015/colorpicker/services/flatcolorpicker.service.d.ts +12 -0
- package/dist/es2015/colorpicker/services/flatcolorpicker.service.js +38 -0
- package/dist/es2015/colorpicker/utils/color-parser.d.ts +8 -2
- package/dist/es2015/colorpicker/utils/color-parser.js +15 -5
- package/dist/es2015/colorpicker/utils/contrast-curve.d.ts +37 -0
- package/dist/es2015/colorpicker/utils/contrast-curve.js +85 -0
- package/dist/es2015/colorpicker/utils.d.ts +1 -1
- package/dist/es2015/colorpicker/utils.js +1 -1
- package/dist/es2015/colorpicker.module.js +9 -1
- package/dist/es2015/{colorpicker/models/color-picker-view.d.ts → common/models/fillmode.d.ts} +5 -5
- package/dist/es2015/common/models/fillmode.js +4 -0
- package/dist/es2015/common/models/rounded.d.ts +23 -0
- package/dist/es2015/common/models/rounded.js +4 -0
- package/dist/es2015/common/models/size.d.ts +14 -0
- package/dist/es2015/common/models/size.js +4 -0
- 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.d.ts +8 -0
- package/dist/es2015/common/models.js +4 -0
- package/dist/es2015/common/utils.d.ts +7 -0
- package/dist/es2015/common/utils.js +37 -0
- package/dist/es2015/index.d.ts +5 -0
- package/dist/es2015/index.js +5 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +5 -2
- package/dist/es2015/main.js +4 -2
- package/dist/es2015/maskedtextbox/maskedtextbox.component.d.ts +39 -1
- package/dist/es2015/maskedtextbox/maskedtextbox.component.js +88 -6
- package/dist/es2015/numerictextbox/numerictextbox.component.d.ts +39 -2
- package/dist/es2015/numerictextbox/numerictextbox.component.js +124 -40
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/radiobutton/radiobutton.directive.d.ts +18 -0
- package/dist/es2015/radiobutton/radiobutton.directive.js +46 -11
- package/dist/es2015/shared/textarea.directive.d.ts +1 -1
- package/dist/es2015/shared/textarea.directive.js +3 -2
- package/dist/es2015/switch/switch.component.d.ts +48 -5
- package/dist/es2015/switch/switch.component.js +166 -24
- package/dist/es2015/text-fields-common/text-fields-base.js +1 -1
- package/dist/es2015/textarea/textarea.component.d.ts +39 -1
- package/dist/es2015/textarea/textarea.component.js +89 -5
- package/dist/es2015/textbox/textbox.component.d.ts +40 -1
- package/dist/es2015/textbox/textbox.component.js +96 -11
- package/dist/es2015/textbox/textbox.directive.d.ts +1 -1
- package/dist/es2015/textbox/textbox.directive.js +3 -2
- package/dist/es2015/textbox.module.js +0 -3
- package/dist/fesm2015/index.js +3114 -1478
- package/dist/fesm5/index.js +3114 -1462
- package/dist/npm/checkbox/checkbox.directive.js +78 -2
- package/dist/npm/colorpicker/color-contrast-svg.component.js +97 -0
- package/dist/npm/colorpicker/color-gradient.component.js +109 -81
- package/dist/npm/colorpicker/color-input.component.js +38 -17
- package/dist/npm/colorpicker/color-palette.component.js +29 -19
- package/dist/npm/colorpicker/colorpicker.component.js +303 -86
- package/dist/npm/colorpicker/constants.js +12 -0
- package/dist/npm/colorpicker/contrast-validation.component.js +8 -6
- package/dist/npm/colorpicker/contrast.component.js +6 -8
- package/dist/npm/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/npm/colorpicker/events/cancel-event.js +21 -0
- package/dist/npm/colorpicker/events/close-event.js +19 -0
- package/dist/npm/colorpicker/{models → events}/kendo-drag-event.js +0 -0
- package/dist/npm/colorpicker/events/open-event.js +19 -0
- package/dist/npm/colorpicker/events.js +11 -0
- package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +52 -0
- package/dist/npm/colorpicker/flatcolorpicker-header.component.js +96 -0
- package/dist/npm/colorpicker/flatcolorpicker.component.js +555 -0
- package/dist/npm/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/npm/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/npm/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/npm/colorpicker/localization/flatcolorpicker-localization.service.js +36 -0
- package/dist/npm/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/npm/colorpicker/localization/messages.js +36 -0
- package/dist/npm/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
- package/dist/npm/colorpicker/models/colorpicker-view.js +6 -0
- package/dist/npm/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/npm/colorpicker/models.js +1 -2
- package/dist/npm/colorpicker/services/flatcolorpicker.service.js +43 -0
- package/dist/npm/colorpicker/utils/color-parser.js +18 -5
- package/dist/npm/colorpicker/utils/contrast-curve.js +93 -0
- package/dist/npm/colorpicker/utils.js +1 -1
- package/dist/npm/colorpicker.module.js +9 -1
- package/dist/npm/common/models/fillmode.js +6 -0
- package/dist/npm/common/models/rounded.js +6 -0
- package/dist/npm/common/models/size.js +6 -0
- package/dist/npm/common/models/styling-classes.js +6 -0
- package/dist/npm/common/models.js +6 -0
- package/dist/npm/common/utils.js +37 -0
- package/dist/npm/index.js +10 -0
- package/dist/npm/main.js +7 -4
- package/dist/npm/maskedtextbox/maskedtextbox.component.js +100 -5
- package/dist/npm/numerictextbox/numerictextbox.component.js +115 -19
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/radiobutton.directive.js +51 -2
- package/dist/npm/shared/textarea.directive.js +3 -2
- package/dist/npm/switch/switch.component.js +166 -20
- package/dist/npm/text-fields-common/text-fields-base.js +1 -1
- package/dist/npm/textarea/textarea.component.js +100 -4
- package/dist/npm/textbox/textbox.component.js +107 -10
- package/dist/npm/textbox/textbox.directive.js +3 -2
- package/dist/npm/textbox.module.js +0 -3
- package/dist/systemjs/kendo-angular-inputs.js +1 -1
- package/package.json +11 -10
- package/dist/es/colorpicker/models/preventable-event.js +0 -29
- package/dist/es/textbox/floating-label-input-adapter.js +0 -58
- package/dist/es/textbox/textbox-container.component.js +0 -224
- package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
- package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
- package/dist/es2015/textbox/floating-label-input-adapter.d.ts +0 -20
- package/dist/es2015/textbox/floating-label-input-adapter.js +0 -52
- package/dist/es2015/textbox/textbox-container.component.d.ts +0 -59
- package/dist/es2015/textbox/textbox-container.component.js +0 -209
- package/dist/npm/colorpicker/models/preventable-event.js +0 -31
- package/dist/npm/textbox/floating-label-input-adapter.js +0 -60
- package/dist/npm/textbox/textbox-container.component.js +0 -226
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Component, ElementRef, EventEmitter, HostBinding, Input, Output, Renderer2, ViewChild, forwardRef, isDevMode, NgZone, ChangeDetectorRef, Injector } from '@angular/core';
|
|
7
7
|
import { anyChanged, hasObservers, Keys, guid, KendoInput } from '@progress/kendo-angular-common';
|
|
8
|
-
import { areSame, requiresZoneOnBlur } from '../common/utils';
|
|
8
|
+
import { areSame, getStylingClasses, requiresZoneOnBlur } from '../common/utils';
|
|
9
9
|
import { invokeElementMethod } from '../common/dom-utils';
|
|
10
10
|
import { add, toFixedPrecision, limitPrecision } from '../common/math';
|
|
11
11
|
import { createMaxValidator } from '../validators/max.validator';
|
|
@@ -26,8 +26,7 @@ var PARSABLE_DEFAULTS = {
|
|
|
26
26
|
min: null,
|
|
27
27
|
step: 1
|
|
28
28
|
};
|
|
29
|
-
var FOCUSED = 'k-
|
|
30
|
-
var FORMATTED_VALUE = 'k-formatted-value';
|
|
29
|
+
var FOCUSED = 'k-focus';
|
|
31
30
|
/**
|
|
32
31
|
* Represents the [Kendo UI NumericTextBox component for Angular]({% slug overview_numerictextbox %}).
|
|
33
32
|
*/
|
|
@@ -123,15 +122,20 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
123
122
|
* @hidden
|
|
124
123
|
*/
|
|
125
124
|
this.arrowDirection = ArrowDirection.None;
|
|
125
|
+
this.hostClasses = true;
|
|
126
126
|
this.inputValue = '';
|
|
127
127
|
this.minValidateFn = noop;
|
|
128
128
|
this.maxValidateFn = noop;
|
|
129
129
|
this._format = "n2";
|
|
130
130
|
this.isPasted = false;
|
|
131
131
|
this.mouseDown = false;
|
|
132
|
+
this._size = 'medium';
|
|
133
|
+
this._rounded = 'medium';
|
|
134
|
+
this._fillMode = 'solid';
|
|
132
135
|
this.ngChange = noop;
|
|
133
136
|
this.ngTouched = noop;
|
|
134
137
|
this.ngValidatorChange = noop;
|
|
138
|
+
this.domEvents = [];
|
|
135
139
|
/**
|
|
136
140
|
* @hidden
|
|
137
141
|
*/
|
|
@@ -326,9 +330,69 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
326
330
|
enumerable: true,
|
|
327
331
|
configurable: true
|
|
328
332
|
});
|
|
329
|
-
Object.defineProperty(NumericTextBoxComponent.prototype, "
|
|
333
|
+
Object.defineProperty(NumericTextBoxComponent.prototype, "size", {
|
|
330
334
|
get: function () {
|
|
331
|
-
return
|
|
335
|
+
return this._size;
|
|
336
|
+
},
|
|
337
|
+
/**
|
|
338
|
+
* The size property specifies the font size and line height of the NumericTextBox
|
|
339
|
+
* ([see example]({% slug appearance_numerictextbox %}#toc-size)).
|
|
340
|
+
* The possible values are:
|
|
341
|
+
* * `'small'`
|
|
342
|
+
* * `'medium'` (default)
|
|
343
|
+
* * `'large'`
|
|
344
|
+
* * `null`
|
|
345
|
+
*/
|
|
346
|
+
set: function (size) {
|
|
347
|
+
this.handleClasses(size, 'size');
|
|
348
|
+
this._size = size;
|
|
349
|
+
},
|
|
350
|
+
enumerable: true,
|
|
351
|
+
configurable: true
|
|
352
|
+
});
|
|
353
|
+
Object.defineProperty(NumericTextBoxComponent.prototype, "rounded", {
|
|
354
|
+
get: function () {
|
|
355
|
+
return this._rounded;
|
|
356
|
+
},
|
|
357
|
+
/**
|
|
358
|
+
* The rounded property specifies the border radius of the NumericTextBox
|
|
359
|
+
* ([see example]({% slug appearance_numerictextbox %}#toc-rounded)).
|
|
360
|
+
* The possible values are:
|
|
361
|
+
* * `'small'`
|
|
362
|
+
* * `'medium'` (default)
|
|
363
|
+
* * `'large'`
|
|
364
|
+
* * `null`
|
|
365
|
+
*/
|
|
366
|
+
set: function (rounded) {
|
|
367
|
+
this.handleClasses(rounded, 'rounded');
|
|
368
|
+
this._rounded = rounded;
|
|
369
|
+
},
|
|
370
|
+
enumerable: true,
|
|
371
|
+
configurable: true
|
|
372
|
+
});
|
|
373
|
+
Object.defineProperty(NumericTextBoxComponent.prototype, "fillMode", {
|
|
374
|
+
get: function () {
|
|
375
|
+
return this._fillMode;
|
|
376
|
+
},
|
|
377
|
+
/**
|
|
378
|
+
* The fillMode property specifies the background and border styles of the NumericTextBox
|
|
379
|
+
* ([see example]({% slug appearance_numerictextbox %}#toc-fillMode)).
|
|
380
|
+
* The possible values are:
|
|
381
|
+
* * `'flat'`
|
|
382
|
+
* * `'solid'` (default)
|
|
383
|
+
* * `'outline'`
|
|
384
|
+
* * `null`
|
|
385
|
+
*/
|
|
386
|
+
set: function (fillMode) {
|
|
387
|
+
this.handleClasses(fillMode, 'fillMode');
|
|
388
|
+
this._fillMode = fillMode;
|
|
389
|
+
},
|
|
390
|
+
enumerable: true,
|
|
391
|
+
configurable: true
|
|
392
|
+
});
|
|
393
|
+
Object.defineProperty(NumericTextBoxComponent.prototype, "disableClass", {
|
|
394
|
+
get: function () {
|
|
395
|
+
return this.disabled;
|
|
332
396
|
},
|
|
333
397
|
enumerable: true,
|
|
334
398
|
configurable: true
|
|
@@ -346,6 +410,17 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
346
410
|
this.renderer.removeAttribute(this.hostElement.nativeElement, "tabindex");
|
|
347
411
|
}
|
|
348
412
|
this.control = this.injector.get(NgControl, null);
|
|
413
|
+
this.ngZone.runOutsideAngular(function () {
|
|
414
|
+
_this.domEvents.push(_this.renderer.listen(_this.hostElement.nativeElement, 'mousewheel', _this.handleWheel.bind(_this)));
|
|
415
|
+
_this.domEvents.push(_this.renderer.listen(_this.hostElement.nativeElement, 'DOMMouseScroll', _this.handleWheel.bind(_this)));
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
NumericTextBoxComponent.prototype.ngAfterViewInit = function () {
|
|
419
|
+
var _this = this;
|
|
420
|
+
var stylingInputs = ['size', 'rounded', 'fillMode'];
|
|
421
|
+
stylingInputs.forEach(function (input) {
|
|
422
|
+
_this.handleClasses(_this[input], input);
|
|
423
|
+
});
|
|
349
424
|
};
|
|
350
425
|
/**
|
|
351
426
|
* @hidden
|
|
@@ -379,6 +454,7 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
379
454
|
this.subscriptions.unsubscribe();
|
|
380
455
|
}
|
|
381
456
|
clearTimeout(this.spinTimeout);
|
|
457
|
+
this.domEvents.forEach(function (unbindHandler) { return unbindHandler(); });
|
|
382
458
|
};
|
|
383
459
|
/**
|
|
384
460
|
* @hidden
|
|
@@ -498,18 +574,13 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
498
574
|
return this.isFocused;
|
|
499
575
|
},
|
|
500
576
|
set: function (value) {
|
|
501
|
-
if (this.isFocused !== value && this.
|
|
502
|
-
var wrap = this.
|
|
503
|
-
var input = this.numericInput.nativeElement;
|
|
577
|
+
if (this.isFocused !== value && this.hostElement) {
|
|
578
|
+
var wrap = this.hostElement.nativeElement;
|
|
504
579
|
if (value) {
|
|
505
580
|
this.renderer.addClass(wrap, FOCUSED);
|
|
506
|
-
if (!this.isDisabled) {
|
|
507
|
-
this.renderer.removeClass(input, FORMATTED_VALUE);
|
|
508
|
-
}
|
|
509
581
|
}
|
|
510
582
|
else {
|
|
511
583
|
this.renderer.removeClass(wrap, FOCUSED);
|
|
512
|
-
this.renderer.addClass(input, FORMATTED_VALUE);
|
|
513
584
|
}
|
|
514
585
|
this.isFocused = value;
|
|
515
586
|
}
|
|
@@ -818,6 +889,16 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
818
889
|
}
|
|
819
890
|
return significantChars;
|
|
820
891
|
};
|
|
892
|
+
NumericTextBoxComponent.prototype.handleClasses = function (value, input) {
|
|
893
|
+
var elem = this.hostElement.nativeElement;
|
|
894
|
+
var classes = getStylingClasses('input', input, this[input], value);
|
|
895
|
+
if (classes.toRemove) {
|
|
896
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
897
|
+
}
|
|
898
|
+
if (classes.toAdd) {
|
|
899
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
900
|
+
}
|
|
901
|
+
};
|
|
821
902
|
var NumericTextBoxComponent_1;
|
|
822
903
|
tslib_1.__decorate([
|
|
823
904
|
Input(),
|
|
@@ -897,6 +978,21 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
897
978
|
Input(),
|
|
898
979
|
tslib_1.__metadata("design:type", Number)
|
|
899
980
|
], NumericTextBoxComponent.prototype, "maxlength", void 0);
|
|
981
|
+
tslib_1.__decorate([
|
|
982
|
+
Input(),
|
|
983
|
+
tslib_1.__metadata("design:type", String),
|
|
984
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
985
|
+
], NumericTextBoxComponent.prototype, "size", null);
|
|
986
|
+
tslib_1.__decorate([
|
|
987
|
+
Input(),
|
|
988
|
+
tslib_1.__metadata("design:type", String),
|
|
989
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
990
|
+
], NumericTextBoxComponent.prototype, "rounded", null);
|
|
991
|
+
tslib_1.__decorate([
|
|
992
|
+
Input(),
|
|
993
|
+
tslib_1.__metadata("design:type", String),
|
|
994
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
995
|
+
], NumericTextBoxComponent.prototype, "fillMode", null);
|
|
900
996
|
tslib_1.__decorate([
|
|
901
997
|
Output(),
|
|
902
998
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
@@ -913,20 +1009,20 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
913
1009
|
ViewChild('numericInput', { static: true }),
|
|
914
1010
|
tslib_1.__metadata("design:type", ElementRef)
|
|
915
1011
|
], NumericTextBoxComponent.prototype, "numericInput", void 0);
|
|
916
|
-
tslib_1.__decorate([
|
|
917
|
-
ViewChild('numericWrap', { static: true }),
|
|
918
|
-
tslib_1.__metadata("design:type", ElementRef)
|
|
919
|
-
], NumericTextBoxComponent.prototype, "numericWrap", void 0);
|
|
920
1012
|
tslib_1.__decorate([
|
|
921
1013
|
HostBinding('attr.dir'),
|
|
922
1014
|
tslib_1.__metadata("design:type", String)
|
|
923
1015
|
], NumericTextBoxComponent.prototype, "direction", void 0);
|
|
924
1016
|
tslib_1.__decorate([
|
|
925
|
-
HostBinding('class.k-
|
|
926
|
-
HostBinding('class.k-numerictextbox'),
|
|
1017
|
+
HostBinding('class.k-disabled'),
|
|
927
1018
|
tslib_1.__metadata("design:type", Boolean),
|
|
928
1019
|
tslib_1.__metadata("design:paramtypes", [])
|
|
929
|
-
], NumericTextBoxComponent.prototype, "
|
|
1020
|
+
], NumericTextBoxComponent.prototype, "disableClass", null);
|
|
1021
|
+
tslib_1.__decorate([
|
|
1022
|
+
HostBinding('class.k-input'),
|
|
1023
|
+
HostBinding('class.k-numerictextbox'),
|
|
1024
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
1025
|
+
], NumericTextBoxComponent.prototype, "hostClasses", void 0);
|
|
930
1026
|
NumericTextBoxComponent = NumericTextBoxComponent_1 = tslib_1.__decorate([
|
|
931
1027
|
Component({
|
|
932
1028
|
exportAs: 'kendoNumericTextBox',
|
|
@@ -938,7 +1034,7 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
938
1034
|
{ provide: KendoInput, useExisting: forwardRef(function () { return NumericTextBoxComponent_1; }) }
|
|
939
1035
|
],
|
|
940
1036
|
selector: 'kendo-numerictextbox',
|
|
941
|
-
template: "\n <ng-container kendoNumericTextBoxLocalizedMessages\n i18n-increment=\"kendo.numerictextbox.increment|The title for the **Increment** button in the NumericTextBox\"\n increment=\"Increase value\"\n i18n-decrement=\"kendo.numerictextbox.decrement|The title for the **Decrement** button in the NumericTextBox\"\n decrement=\"Decrease value\"\n >\n </ng-container>\n
|
|
1037
|
+
template: "\n <ng-container kendoNumericTextBoxLocalizedMessages\n i18n-increment=\"kendo.numerictextbox.increment|The title for the **Increment** button in the NumericTextBox\"\n increment=\"Increase value\"\n i18n-decrement=\"kendo.numerictextbox.decrement|The title for the **Decrement** button in the NumericTextBox\"\n decrement=\"Decrease value\"\n >\n </ng-container>\n <input\n role=\"spinbutton\"\n class=\"k-input-inner\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n [id]=\"focusableId\"\n [attr.aria-valuemin]=\"min\"\n [attr.aria-valuemax]=\"max\"\n [attr.aria-valuenow]=\"value\"\n [attr.title]=\"title\"\n [attr.placeholder]=\"placeholder\"\n [attr.maxLength]=\"maxlength\"\n [tabindex]=\"tabIndex\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [kendoEventsOutsideAngular]=\"{\n mousedown: handleMouseDown,\n dragenter: handleDragEnter,\n keydown: handleKeyDown,\n input: handleInput,\n focus: handleFocus,\n blur: handleBlur,\n paste: handlePaste\n }\"\n #numericInput />\n <span\n class=\"k-input-spinner k-spin-button\" *ngIf=\"spinners\"\n [kendoEventsOutsideAngular]=\"{ mouseup: releaseArrow, mouseleave: releaseArrow }\"\n >\n <button\n type=\"button\"\n [kendoEventsOutsideAngular]=\"{ mousedown: increasePress }\"\n [attr.aria-hidden]=\"true\"\n [attr.aria-label]=\"incrementTitle\"\n [title]=\"incrementTitle\"\n [class.k-active]=\"arrowDirection === ArrowDirection.Up\"\n class=\"k-spinner-increase k-button k-icon-button k-button-solid k-button-solid-base\"\n tabindex=\"-1\"\n >\n <span class=\"k-button-icon k-icon k-i-arrow-n\"></span>\n </button>\n <button\n type=\"button\"\n [kendoEventsOutsideAngular]=\"{ mousedown: decreasePress }\"\n [attr.aria-hidden]=\"true\"\n [attr.aria-label]=\"decrementTitle\"\n [title]=\"decrementTitle\"\n [class.k-active]=\"arrowDirection === ArrowDirection.Down\"\n class=\"k-spinner-decrease k-button k-icon-button k-button-solid k-button-solid-base\"\n tabindex=\"-1\"\n >\n <span class=\"k-button-icon k-icon k-i-arrow-s\"></span>\n </button>\n </span>\n "
|
|
942
1038
|
}),
|
|
943
1039
|
tslib_1.__metadata("design:paramtypes", [IntlService,
|
|
944
1040
|
Renderer2,
|
|
@@ -9,7 +9,7 @@ export var packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-inputs',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1640428155,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
|
-
import { Directive, HostBinding } from '@angular/core';
|
|
6
|
+
import { Directive, ElementRef, HostBinding, Input, Renderer2 } from '@angular/core';
|
|
7
|
+
import { getStylingClasses } from '../common/utils';
|
|
7
8
|
/**
|
|
8
9
|
* Represents the directive that renders the [Kendo UI RadioButton]({% slug overview_checkbox %}) input component.
|
|
9
10
|
* The directive is placed on input type="radio" elements.
|
|
@@ -14,17 +15,65 @@ import { Directive, HostBinding } from '@angular/core';
|
|
|
14
15
|
* ```
|
|
15
16
|
*/
|
|
16
17
|
var RadioButtonDirective = /** @class */ (function () {
|
|
17
|
-
function RadioButtonDirective() {
|
|
18
|
+
function RadioButtonDirective(renderer, hostElement) {
|
|
19
|
+
this.renderer = renderer;
|
|
20
|
+
this.hostElement = hostElement;
|
|
18
21
|
this.kendoClass = true;
|
|
22
|
+
this._size = 'medium';
|
|
19
23
|
}
|
|
24
|
+
Object.defineProperty(RadioButtonDirective.prototype, "size", {
|
|
25
|
+
get: function () {
|
|
26
|
+
return this._size;
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* The size property specifies the width and height of the RadioButton
|
|
30
|
+
* ([see example]({% slug appearance_radiobuttondirective %}#toc-size)).
|
|
31
|
+
* The possible values are:
|
|
32
|
+
* * `'small'`
|
|
33
|
+
* * `'medium'` (default)
|
|
34
|
+
* * `'large'`
|
|
35
|
+
* * `null`
|
|
36
|
+
*/
|
|
37
|
+
set: function (size) {
|
|
38
|
+
this.handleClasses(size, 'size');
|
|
39
|
+
this._size = size;
|
|
40
|
+
},
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true
|
|
43
|
+
});
|
|
44
|
+
RadioButtonDirective.prototype.ngAfterViewInit = function () {
|
|
45
|
+
var _this = this;
|
|
46
|
+
// kept in sync with other inputs for easier refactoring
|
|
47
|
+
// to a common base class
|
|
48
|
+
var stylingInputs = ['size'];
|
|
49
|
+
stylingInputs.forEach(function (input) {
|
|
50
|
+
_this.handleClasses(_this[input], input);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
RadioButtonDirective.prototype.handleClasses = function (value, input) {
|
|
54
|
+
var elem = this.hostElement.nativeElement;
|
|
55
|
+
var classes = getStylingClasses('radio', input, this[input], value);
|
|
56
|
+
if (classes.toRemove) {
|
|
57
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
58
|
+
}
|
|
59
|
+
if (classes.toAdd) {
|
|
60
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
20
63
|
tslib_1.__decorate([
|
|
21
64
|
HostBinding('class.k-radio'),
|
|
22
65
|
tslib_1.__metadata("design:type", Boolean)
|
|
23
66
|
], RadioButtonDirective.prototype, "kendoClass", void 0);
|
|
67
|
+
tslib_1.__decorate([
|
|
68
|
+
Input(),
|
|
69
|
+
tslib_1.__metadata("design:type", String),
|
|
70
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
71
|
+
], RadioButtonDirective.prototype, "size", null);
|
|
24
72
|
RadioButtonDirective = tslib_1.__decorate([
|
|
25
73
|
Directive({
|
|
26
74
|
selector: 'input[kendoRadioButton]'
|
|
27
|
-
})
|
|
75
|
+
}),
|
|
76
|
+
tslib_1.__metadata("design:paramtypes", [Renderer2, ElementRef])
|
|
28
77
|
], RadioButtonDirective);
|
|
29
78
|
return RadioButtonDirective;
|
|
30
79
|
}());
|
|
@@ -26,7 +26,7 @@ var TextAreaDirective = /** @class */ (function () {
|
|
|
26
26
|
this.zone = zone;
|
|
27
27
|
this.changeDetector = changeDetector;
|
|
28
28
|
this.injector = injector;
|
|
29
|
-
this.
|
|
29
|
+
this.elementClasses = true;
|
|
30
30
|
this.autofillClass = true;
|
|
31
31
|
/**
|
|
32
32
|
* Fires each time the textarea value is changed.
|
|
@@ -218,8 +218,9 @@ var TextAreaDirective = /** @class */ (function () {
|
|
|
218
218
|
var TextAreaDirective_1;
|
|
219
219
|
tslib_1.__decorate([
|
|
220
220
|
HostBinding('class.k-textarea'),
|
|
221
|
+
HostBinding('class.k-input'),
|
|
221
222
|
tslib_1.__metadata("design:type", Boolean)
|
|
222
|
-
], TextAreaDirective.prototype, "
|
|
223
|
+
], TextAreaDirective.prototype, "elementClasses", void 0);
|
|
223
224
|
tslib_1.__decorate([
|
|
224
225
|
HostBinding('class.k-autofill'),
|
|
225
226
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -9,10 +9,11 @@ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
|
9
9
|
import { hasObservers, guid, Keys, KendoInput } from '@progress/kendo-angular-common';
|
|
10
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
11
|
import { packageMetadata } from '../package-metadata';
|
|
12
|
-
import { requiresZoneOnBlur } from '../common/utils';
|
|
12
|
+
import { requiresZoneOnBlur, getStylingClasses } from '../common/utils';
|
|
13
|
+
import { Subscription } from "rxjs";
|
|
13
14
|
import { skip, take } from "rxjs/operators";
|
|
14
15
|
import { browser } from '@progress/kendo-common';
|
|
15
|
-
var FOCUSED = 'k-
|
|
16
|
+
var FOCUSED = 'k-focus';
|
|
16
17
|
/**
|
|
17
18
|
* Represents the [Kendo UI Switch component for Angular]({% slug overview_switch %}).
|
|
18
19
|
*/
|
|
@@ -58,13 +59,20 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
58
59
|
* @hidden
|
|
59
60
|
*/
|
|
60
61
|
this.initialized = false;
|
|
62
|
+
this.hostClickSubscription = new Subscription;
|
|
61
63
|
this._checked = false;
|
|
64
|
+
this._size = 'medium';
|
|
65
|
+
this._trackRounded = 'full';
|
|
66
|
+
this._thumbRounded = 'full';
|
|
62
67
|
this.ngChange = function (_) { };
|
|
63
68
|
this.ngTouched = function () { };
|
|
64
69
|
/**
|
|
65
70
|
* @hidden
|
|
66
71
|
*/
|
|
67
72
|
this.handleFocus = function () {
|
|
73
|
+
if (_this.isFocused) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
68
76
|
_this.focused = true;
|
|
69
77
|
if (hasObservers(_this.onFocus)) {
|
|
70
78
|
_this.ngZone.run(function () {
|
|
@@ -75,7 +83,11 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
75
83
|
/**
|
|
76
84
|
* @hidden
|
|
77
85
|
*/
|
|
78
|
-
this.handleBlur = function () {
|
|
86
|
+
this.handleBlur = function (event) {
|
|
87
|
+
var relatedTarget = event && event.relatedTarget;
|
|
88
|
+
if (_this.hostElement.nativeElement.contains(relatedTarget)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
79
91
|
_this.changeDetector.markForCheck();
|
|
80
92
|
_this.focused = false;
|
|
81
93
|
if (hasObservers(_this.onBlur) || requiresZoneOnBlur(_this.control)) {
|
|
@@ -105,6 +117,68 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
105
117
|
enumerable: true,
|
|
106
118
|
configurable: true
|
|
107
119
|
});
|
|
120
|
+
Object.defineProperty(SwitchComponent.prototype, "size", {
|
|
121
|
+
get: function () {
|
|
122
|
+
return this._size;
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Specifies the size of the Switch.
|
|
126
|
+
*
|
|
127
|
+
* The possible values are:
|
|
128
|
+
* * `'small'`
|
|
129
|
+
* * `'medium'` (default)
|
|
130
|
+
* * `'large'`
|
|
131
|
+
* * `null`
|
|
132
|
+
*/
|
|
133
|
+
set: function (size) {
|
|
134
|
+
this.handleClasses(size, 'size');
|
|
135
|
+
this._size = size;
|
|
136
|
+
},
|
|
137
|
+
enumerable: true,
|
|
138
|
+
configurable: true
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(SwitchComponent.prototype, "thumbRounded", {
|
|
141
|
+
get: function () {
|
|
142
|
+
return this._thumbRounded;
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Specifies the border radius of the Switch thumb.
|
|
146
|
+
*
|
|
147
|
+
* The possible values are:
|
|
148
|
+
* * `'full'` (default)
|
|
149
|
+
* * `'small'`
|
|
150
|
+
* * `'medium'`
|
|
151
|
+
* * `'large'`
|
|
152
|
+
* * `null`
|
|
153
|
+
*/
|
|
154
|
+
set: function (thumbRounded) {
|
|
155
|
+
this.handleThumbClasses(thumbRounded);
|
|
156
|
+
this._thumbRounded = thumbRounded;
|
|
157
|
+
},
|
|
158
|
+
enumerable: true,
|
|
159
|
+
configurable: true
|
|
160
|
+
});
|
|
161
|
+
Object.defineProperty(SwitchComponent.prototype, "trackRounded", {
|
|
162
|
+
get: function () {
|
|
163
|
+
return this._trackRounded;
|
|
164
|
+
},
|
|
165
|
+
/**
|
|
166
|
+
* Specifies the border radius of the Switch track.
|
|
167
|
+
*
|
|
168
|
+
* The possible values are:
|
|
169
|
+
* * `'full'` (default)
|
|
170
|
+
* * `'small'`
|
|
171
|
+
* * `'medium'`
|
|
172
|
+
* * `'large'`
|
|
173
|
+
* * `null`
|
|
174
|
+
*/
|
|
175
|
+
set: function (trackRounded) {
|
|
176
|
+
this.handleTrackClasses(trackRounded);
|
|
177
|
+
this._trackRounded = trackRounded;
|
|
178
|
+
},
|
|
179
|
+
enumerable: true,
|
|
180
|
+
configurable: true
|
|
181
|
+
});
|
|
108
182
|
Object.defineProperty(SwitchComponent.prototype, "tabIndex", {
|
|
109
183
|
get: function () {
|
|
110
184
|
return this.tabindex;
|
|
@@ -189,10 +263,23 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
189
263
|
this.control = this.injector.get(NgControl, null);
|
|
190
264
|
this.ngZone.onStable.pipe(take(1)).subscribe(function () { return _this.initialized = true; });
|
|
191
265
|
};
|
|
266
|
+
SwitchComponent.prototype.ngAfterViewInit = function () {
|
|
267
|
+
var wrapper = this.hostElement.nativeElement;
|
|
268
|
+
this.attachHostClickHandler();
|
|
269
|
+
if (!this.checked && !wrapper.classList.contains('k-switch-off')) {
|
|
270
|
+
this.renderer.addClass(wrapper, 'k-switch-off');
|
|
271
|
+
}
|
|
272
|
+
this.handleClasses(this.size, 'size');
|
|
273
|
+
this.handleTrackClasses(this.trackRounded);
|
|
274
|
+
this.handleThumbClasses(this.thumbRounded);
|
|
275
|
+
};
|
|
192
276
|
SwitchComponent.prototype.ngOnDestroy = function () {
|
|
193
277
|
if (this.localizationChangeSubscription) {
|
|
194
278
|
this.localizationChangeSubscription.unsubscribe();
|
|
195
279
|
}
|
|
280
|
+
if (this.hostClickSubscription) {
|
|
281
|
+
this.hostClickSubscription.unsubscribe();
|
|
282
|
+
}
|
|
196
283
|
};
|
|
197
284
|
/**
|
|
198
285
|
* Focuses the Switch.
|
|
@@ -210,19 +297,19 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
210
297
|
* ```
|
|
211
298
|
*/
|
|
212
299
|
SwitchComponent.prototype.focus = function () {
|
|
213
|
-
if (!this.
|
|
300
|
+
if (!this.track) {
|
|
214
301
|
return;
|
|
215
302
|
}
|
|
216
|
-
this.
|
|
303
|
+
this.track.nativeElement.focus();
|
|
217
304
|
};
|
|
218
305
|
/**
|
|
219
306
|
* Blurs the Switch.
|
|
220
307
|
*/
|
|
221
308
|
SwitchComponent.prototype.blur = function () {
|
|
222
|
-
if (!this.
|
|
309
|
+
if (!this.track) {
|
|
223
310
|
return;
|
|
224
311
|
}
|
|
225
|
-
this.
|
|
312
|
+
this.track.nativeElement.blur();
|
|
226
313
|
};
|
|
227
314
|
/**
|
|
228
315
|
* @hidden
|
|
@@ -272,7 +359,7 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
272
359
|
};
|
|
273
360
|
/**
|
|
274
361
|
* @hidden
|
|
275
|
-
* Used by the
|
|
362
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
276
363
|
*/
|
|
277
364
|
SwitchComponent.prototype.isEmpty = function () {
|
|
278
365
|
return false;
|
|
@@ -291,12 +378,12 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
291
378
|
Object.defineProperty(SwitchComponent.prototype, "focused", {
|
|
292
379
|
set: function (value) {
|
|
293
380
|
if (this.isFocused !== value && this.hostElement) {
|
|
294
|
-
var
|
|
381
|
+
var wrapper = this.hostElement.nativeElement;
|
|
295
382
|
if (value) {
|
|
296
|
-
this.renderer.addClass(
|
|
383
|
+
this.renderer.addClass(wrapper, FOCUSED);
|
|
297
384
|
}
|
|
298
385
|
else {
|
|
299
|
-
this.renderer.removeClass(
|
|
386
|
+
this.renderer.removeClass(wrapper, FOCUSED);
|
|
300
387
|
}
|
|
301
388
|
this.isFocused = value;
|
|
302
389
|
}
|
|
@@ -304,14 +391,54 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
304
391
|
enumerable: true,
|
|
305
392
|
configurable: true
|
|
306
393
|
});
|
|
394
|
+
SwitchComponent.prototype.attachHostClickHandler = function () {
|
|
395
|
+
var _this = this;
|
|
396
|
+
this.ngZone.runOutsideAngular(function () {
|
|
397
|
+
_this.hostClickSubscription.add(_this.renderer.listen(_this.hostElement.nativeElement, 'click', _this.clickHandler));
|
|
398
|
+
});
|
|
399
|
+
};
|
|
307
400
|
SwitchComponent.prototype.setHostClasses = function (value) {
|
|
401
|
+
var wrapper = this.hostElement.nativeElement;
|
|
308
402
|
if (value) {
|
|
309
|
-
this.renderer.removeClass(
|
|
310
|
-
this.renderer.addClass(
|
|
403
|
+
this.renderer.removeClass(wrapper, 'k-switch-off');
|
|
404
|
+
this.renderer.addClass(wrapper, 'k-switch-on');
|
|
311
405
|
}
|
|
312
406
|
else {
|
|
313
|
-
this.renderer.removeClass(
|
|
314
|
-
this.renderer.addClass(
|
|
407
|
+
this.renderer.removeClass(wrapper, 'k-switch-on');
|
|
408
|
+
this.renderer.addClass(wrapper, 'k-switch-off');
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
SwitchComponent.prototype.handleClasses = function (value, input) {
|
|
412
|
+
var elem = this.hostElement.nativeElement;
|
|
413
|
+
var classes = getStylingClasses('switch', input, this[input], value);
|
|
414
|
+
if (classes.toRemove) {
|
|
415
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
416
|
+
}
|
|
417
|
+
if (classes.toAdd) {
|
|
418
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
SwitchComponent.prototype.handleTrackClasses = function (value) {
|
|
422
|
+
var elem = this.hostElement.nativeElement;
|
|
423
|
+
var track = this.track.nativeElement;
|
|
424
|
+
var classes = getStylingClasses('switch', 'rounded', this.trackRounded, value);
|
|
425
|
+
if (classes.toRemove) {
|
|
426
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
427
|
+
this.renderer.removeClass(track, classes.toRemove);
|
|
428
|
+
}
|
|
429
|
+
if (classes.toAdd) {
|
|
430
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
431
|
+
this.renderer.addClass(track, classes.toAdd);
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
SwitchComponent.prototype.handleThumbClasses = function (value) {
|
|
435
|
+
var thumb = this.thumb.nativeElement;
|
|
436
|
+
var classes = getStylingClasses('switch', 'rounded', this.thumbRounded, value);
|
|
437
|
+
if (classes.toRemove) {
|
|
438
|
+
this.renderer.removeClass(thumb, classes.toRemove);
|
|
439
|
+
}
|
|
440
|
+
if (classes.toAdd) {
|
|
441
|
+
this.renderer.addClass(thumb, classes.toAdd);
|
|
315
442
|
}
|
|
316
443
|
};
|
|
317
444
|
var SwitchComponent_1;
|
|
@@ -344,6 +471,21 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
344
471
|
Input(),
|
|
345
472
|
tslib_1.__metadata("design:type", Number)
|
|
346
473
|
], SwitchComponent.prototype, "tabindex", void 0);
|
|
474
|
+
tslib_1.__decorate([
|
|
475
|
+
Input(),
|
|
476
|
+
tslib_1.__metadata("design:type", String),
|
|
477
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
478
|
+
], SwitchComponent.prototype, "size", null);
|
|
479
|
+
tslib_1.__decorate([
|
|
480
|
+
Input(),
|
|
481
|
+
tslib_1.__metadata("design:type", String),
|
|
482
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
483
|
+
], SwitchComponent.prototype, "thumbRounded", null);
|
|
484
|
+
tslib_1.__decorate([
|
|
485
|
+
Input(),
|
|
486
|
+
tslib_1.__metadata("design:type", String),
|
|
487
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
488
|
+
], SwitchComponent.prototype, "trackRounded", null);
|
|
347
489
|
tslib_1.__decorate([
|
|
348
490
|
Input(),
|
|
349
491
|
tslib_1.__metadata("design:type", Number),
|
|
@@ -361,10 +503,6 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
361
503
|
Output(),
|
|
362
504
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
363
505
|
], SwitchComponent.prototype, "valueChange", void 0);
|
|
364
|
-
tslib_1.__decorate([
|
|
365
|
-
ViewChild('wrapper', { static: true }),
|
|
366
|
-
tslib_1.__metadata("design:type", Object)
|
|
367
|
-
], SwitchComponent.prototype, "wrapper", void 0);
|
|
368
506
|
tslib_1.__decorate([
|
|
369
507
|
HostBinding('attr.dir'),
|
|
370
508
|
tslib_1.__metadata("design:type", String)
|
|
@@ -389,10 +527,18 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
389
527
|
tslib_1.__metadata("design:type", Boolean)
|
|
390
528
|
], SwitchComponent.prototype, "hostClasses", void 0);
|
|
391
529
|
tslib_1.__decorate([
|
|
392
|
-
HostBinding('class.k-
|
|
530
|
+
HostBinding('class.k-disabled'),
|
|
393
531
|
tslib_1.__metadata("design:type", Boolean),
|
|
394
532
|
tslib_1.__metadata("design:paramtypes", [])
|
|
395
533
|
], SwitchComponent.prototype, "disabledClass", null);
|
|
534
|
+
tslib_1.__decorate([
|
|
535
|
+
ViewChild('track', { static: true }),
|
|
536
|
+
tslib_1.__metadata("design:type", Object)
|
|
537
|
+
], SwitchComponent.prototype, "track", void 0);
|
|
538
|
+
tslib_1.__decorate([
|
|
539
|
+
ViewChild('thumb', { static: true }),
|
|
540
|
+
tslib_1.__metadata("design:type", Object)
|
|
541
|
+
], SwitchComponent.prototype, "thumb", void 0);
|
|
396
542
|
SwitchComponent = SwitchComponent_1 = tslib_1.__decorate([
|
|
397
543
|
Component({
|
|
398
544
|
exportAs: 'kendoSwitch',
|
|
@@ -410,7 +556,7 @@ var SwitchComponent = /** @class */ (function () {
|
|
|
410
556
|
}
|
|
411
557
|
],
|
|
412
558
|
selector: 'kendo-switch',
|
|
413
|
-
template: "\n <ng-container kendoSwitchLocalizedMessages\n i18n-on=\"kendo.switch.on|The **On** label of the Switch.\"\n on=\"ON\"\n i18n-off=\"kendo.switch.off|The **Off** label of the Switch.\"\n off=\"OFF\"\n >\n\n <span\n #
|
|
559
|
+
template: "\n <ng-container kendoSwitchLocalizedMessages\n i18n-on=\"kendo.switch.on|The **On** label of the Switch.\"\n on=\"ON\"\n i18n-off=\"kendo.switch.off|The **Off** label of the Switch.\"\n off=\"OFF\"\n >\n\n <span\n #track\n class=\"k-switch-track\"\n [id]=\"focusableId\"\n role=\"switch\"\n [style.transitionDuration]=\"initialized ? '200ms' : '0ms'\"\n [attr.aria-checked]=\"checked\"\n [attr.tabindex]=\"(disabled ? undefined : tabIndex)\"\n [kendoEventsOutsideAngular]=\"{ keydown: keyDownHandler, focus: handleFocus, blur: handleBlur }\"\n >\n <span class=\"k-switch-label-on\" [attr.aria-hidden]=\"true\" >{{onLabelMessage}}</span>\n <span class=\"k-switch-label-off\" [attr.aria-hidden]=\"true\">{{offLabelMessage}}</span>\n </span>\n <span\n class=\"k-switch-thumb-wrap\"\n tabindex=\"-1\"\n [style.transitionDuration]=\"initialized ? '200ms' : '0ms'\" [kendoEventsOutsideAngular]=\"{\n keydown: keyDownHandler,\n focus: handleFocus,\n blur: handleBlur\n }\">\n <span #thumb class=\"k-switch-thumb\"></span>\n </span>\n "
|
|
414
560
|
}),
|
|
415
561
|
tslib_1.__metadata("design:paramtypes", [Renderer2,
|
|
416
562
|
ElementRef,
|
|
@@ -131,7 +131,7 @@ var TextFieldsBase = /** @class */ (function () {
|
|
|
131
131
|
tslib_1.__metadata("design:type", ElementRef)
|
|
132
132
|
], TextFieldsBase.prototype, "input", void 0);
|
|
133
133
|
tslib_1.__decorate([
|
|
134
|
-
HostBinding('class.k-
|
|
134
|
+
HostBinding('class.k-disabled'),
|
|
135
135
|
tslib_1.__metadata("design:type", Boolean),
|
|
136
136
|
tslib_1.__metadata("design:paramtypes", [])
|
|
137
137
|
], TextFieldsBase.prototype, "disabledClass", null);
|