@progress/kendo-angular-inputs 8.0.0-dev.202112161434 → 8.0.0-dev.202201121416
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-gradient.component.js +4 -1
- package/dist/es/colorpicker/color-input.component.js +1 -1
- package/dist/es/colorpicker/color-palette.component.js +6 -3
- package/dist/es/colorpicker/colorpicker.component.js +316 -53
- package/dist/es/colorpicker/flatcolorpicker-actions.component.js +1 -1
- package/dist/es/colorpicker/flatcolorpicker-header.component.js +1 -1
- package/dist/es/colorpicker/flatcolorpicker.component.js +7 -4
- 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/es/common/models.js +4 -0
- package/dist/es/common/utils.js +37 -0
- package/dist/es/main.js +0 -1
- 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 +55 -3
- package/dist/es/shared/textarea.directive.js +3 -2
- package/dist/es/slider/slider.component.js +1 -1
- 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-gradient.component.js +4 -1
- package/dist/es2015/colorpicker/color-input.component.js +2 -2
- package/dist/es2015/colorpicker/color-palette.component.d.ts +1 -1
- package/dist/es2015/colorpicker/color-palette.component.js +6 -3
- package/dist/es2015/colorpicker/colorpicker.component.d.ts +67 -9
- package/dist/es2015/colorpicker/colorpicker.component.js +285 -76
- package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +2 -2
- package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +2 -2
- package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +2 -2
- package/dist/es2015/colorpicker/flatcolorpicker.component.js +7 -4
- package/dist/es2015/common/models/fillmode.d.ts +13 -0
- 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.metadata.json +1 -1
- package/dist/es2015/main.d.ts +1 -1
- package/dist/es2015/main.js +0 -1
- 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 +49 -11
- package/dist/es2015/shared/textarea.directive.d.ts +1 -1
- package/dist/es2015/shared/textarea.directive.js +3 -2
- package/dist/es2015/slider/slider.component.js +18 -23
- 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 +114 -30
- 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 +1220 -654
- package/dist/fesm5/index.js +1276 -585
- package/dist/npm/checkbox/checkbox.directive.js +78 -2
- package/dist/npm/colorpicker/color-gradient.component.js +4 -1
- package/dist/npm/colorpicker/color-input.component.js +1 -1
- package/dist/npm/colorpicker/color-palette.component.js +6 -3
- package/dist/npm/colorpicker/colorpicker.component.js +313 -50
- package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +1 -1
- package/dist/npm/colorpicker/flatcolorpicker-header.component.js +1 -1
- package/dist/npm/colorpicker/flatcolorpicker.component.js +7 -4
- 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/main.js +0 -2
- 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 +54 -2
- package/dist/npm/shared/textarea.directive.js +3 -2
- package/dist/npm/slider/slider.component.js +1 -1
- 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 +12 -12
- package/dist/es/textbox/floating-label-input-adapter.js +0 -58
- package/dist/es/textbox/textbox-container.component.js +0 -224
- 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/textbox/floating-label-input-adapter.js +0 -60
- package/dist/npm/textbox/textbox-container.component.js +0 -226
|
@@ -3,7 +3,10 @@
|
|
|
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 { validatePackage } from '@progress/kendo-licensing';
|
|
8
|
+
import { getStylingClasses } from '../common/utils';
|
|
9
|
+
import { packageMetadata } from '../package-metadata';
|
|
7
10
|
/**
|
|
8
11
|
* Represents the directive that renders the [Kendo UI RadioButton]({% slug overview_checkbox %}) input component.
|
|
9
12
|
* The directive is placed on input type="radio" elements.
|
|
@@ -14,26 +17,61 @@ import { Directive, HostBinding } from '@angular/core';
|
|
|
14
17
|
* ```
|
|
15
18
|
*/
|
|
16
19
|
let RadioButtonDirective = class RadioButtonDirective {
|
|
20
|
+
constructor(renderer, hostElement) {
|
|
21
|
+
this.renderer = renderer;
|
|
22
|
+
this.hostElement = hostElement;
|
|
23
|
+
this.kendoClass = true;
|
|
24
|
+
this._size = 'medium';
|
|
25
|
+
validatePackage(packageMetadata);
|
|
26
|
+
}
|
|
17
27
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
28
|
+
* The size property specifies the width and height of the RadioButton
|
|
29
|
+
* ([see example]({% slug appearance_radiobuttondirective %}#toc-size)).
|
|
30
|
+
* The possible values are:
|
|
31
|
+
* * `'small'`
|
|
32
|
+
* * `'medium'` (default)
|
|
33
|
+
* * `'large'`
|
|
34
|
+
* * `null`
|
|
25
35
|
*/
|
|
26
|
-
|
|
27
|
-
this.
|
|
36
|
+
set size(size) {
|
|
37
|
+
this.handleClasses(size, 'size');
|
|
38
|
+
this._size = size;
|
|
39
|
+
}
|
|
40
|
+
get size() {
|
|
41
|
+
return this._size;
|
|
42
|
+
}
|
|
43
|
+
ngAfterViewInit() {
|
|
44
|
+
// kept in sync with other inputs for easier refactoring
|
|
45
|
+
// to a common base class
|
|
46
|
+
const stylingInputs = ['size'];
|
|
47
|
+
stylingInputs.forEach(input => {
|
|
48
|
+
this.handleClasses(this[input], input);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
handleClasses(value, input) {
|
|
52
|
+
const elem = this.hostElement.nativeElement;
|
|
53
|
+
const classes = getStylingClasses('radio', input, this[input], value);
|
|
54
|
+
if (classes.toRemove) {
|
|
55
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
56
|
+
}
|
|
57
|
+
if (classes.toAdd) {
|
|
58
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
59
|
+
}
|
|
28
60
|
}
|
|
29
61
|
};
|
|
30
62
|
tslib_1.__decorate([
|
|
31
63
|
HostBinding('class.k-radio'),
|
|
32
64
|
tslib_1.__metadata("design:type", Boolean)
|
|
33
65
|
], RadioButtonDirective.prototype, "kendoClass", void 0);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
Input(),
|
|
68
|
+
tslib_1.__metadata("design:type", String),
|
|
69
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
70
|
+
], RadioButtonDirective.prototype, "size", null);
|
|
34
71
|
RadioButtonDirective = tslib_1.__decorate([
|
|
35
72
|
Directive({
|
|
36
73
|
selector: 'input[kendoRadioButton]'
|
|
37
|
-
})
|
|
74
|
+
}),
|
|
75
|
+
tslib_1.__metadata("design:paramtypes", [Renderer2, ElementRef])
|
|
38
76
|
], RadioButtonDirective);
|
|
39
77
|
export { RadioButtonDirective };
|
|
@@ -27,7 +27,7 @@ let TextAreaDirective = TextAreaDirective_1 = class TextAreaDirective {
|
|
|
27
27
|
this.zone = zone;
|
|
28
28
|
this.changeDetector = changeDetector;
|
|
29
29
|
this.injector = injector;
|
|
30
|
-
this.
|
|
30
|
+
this.elementClasses = true;
|
|
31
31
|
this.autofillClass = true;
|
|
32
32
|
/**
|
|
33
33
|
* Fires each time the textarea value is changed.
|
|
@@ -206,8 +206,9 @@ let TextAreaDirective = TextAreaDirective_1 = class TextAreaDirective {
|
|
|
206
206
|
};
|
|
207
207
|
tslib_1.__decorate([
|
|
208
208
|
HostBinding('class.k-textarea'),
|
|
209
|
+
HostBinding('class.k-input'),
|
|
209
210
|
tslib_1.__metadata("design:type", Boolean)
|
|
210
|
-
], TextAreaDirective.prototype, "
|
|
211
|
+
], TextAreaDirective.prototype, "elementClasses", void 0);
|
|
211
212
|
tslib_1.__decorate([
|
|
212
213
|
HostBinding('class.k-autofill'),
|
|
213
214
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -446,33 +446,28 @@ SliderComponent = SliderComponent_1 = tslib_1.__decorate([
|
|
|
446
446
|
[class.k-slider-bottomright]="tickPlacement === 'after'"
|
|
447
447
|
[kendoEventsOutsideAngular]="{ click: onWrapClick, keydown: onKeyDown }"
|
|
448
448
|
>
|
|
449
|
-
<
|
|
450
|
-
|
|
451
|
-
*ngIf="showButtons"
|
|
452
|
-
class="k-button k-button-decrease"
|
|
449
|
+
<button *ngIf="showButtons" type="button" #decreaseButton
|
|
450
|
+
class="k-button-decrease k-button k-button-md k-rounded-full k-button-rectangle k-button-solid k-button-solid-base k-icon-button"
|
|
453
451
|
[title]="decrementMessage"
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
*ngIf="showButtons"
|
|
464
|
-
#increaseButton
|
|
465
|
-
class="k-button k-button-increase"
|
|
452
|
+
[attr.tabindex]="-1"
|
|
453
|
+
role="presentation">
|
|
454
|
+
<span class="k-button-icon k-icon"
|
|
455
|
+
[class.k-i-arrow-w]="!vertical"
|
|
456
|
+
[class.k-i-arrow-s]="vertical">
|
|
457
|
+
</span>
|
|
458
|
+
</button>
|
|
459
|
+
<button *ngIf="showButtons" type="button" #increaseButton
|
|
460
|
+
class="k-button-increase k-button k-button-md k-rounded-full k-button-rectangle k-button-solid k-button-solid-base k-icon-button"
|
|
466
461
|
[title]="incrementMessage"
|
|
467
462
|
(click)="$event.preventDefault()"
|
|
463
|
+
[attr.tabindex]="-1"
|
|
468
464
|
[attr.aria-label]="currentValue"
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
</span>
|
|
465
|
+
role="presentation">
|
|
466
|
+
<span class="k-button-icon k-icon"
|
|
467
|
+
[class.k-i-arrow-e]="!vertical"
|
|
468
|
+
[class.k-i-arrow-n]="vertical">
|
|
469
|
+
</span>
|
|
470
|
+
</button>
|
|
476
471
|
<ul kendoSliderTicks
|
|
477
472
|
#ticks
|
|
478
473
|
*ngIf="tickPlacement !== 'none'"
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { ElementRef, Renderer2, EventEmitter, OnInit, OnDestroy, ChangeDetectorRef, NgZone, Injector } from '@angular/core';
|
|
5
|
+
import { ElementRef, Renderer2, EventEmitter, OnInit, OnDestroy, ChangeDetectorRef, NgZone, Injector, AfterViewInit } from '@angular/core';
|
|
6
6
|
import { ControlValueAccessor, NgControl } from '@angular/forms';
|
|
7
7
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
8
|
import { Subscription } from "rxjs";
|
|
9
|
+
import { InputRounded, InputSize } from '../common/models';
|
|
9
10
|
/**
|
|
10
11
|
* Represents the [Kendo UI Switch component for Angular]({% slug overview_switch %}).
|
|
11
12
|
*/
|
|
12
|
-
export declare class SwitchComponent implements ControlValueAccessor, OnInit, OnDestroy {
|
|
13
|
+
export declare class SwitchComponent implements ControlValueAccessor, OnInit, OnDestroy, AfterViewInit {
|
|
13
14
|
private renderer;
|
|
14
15
|
private hostElement;
|
|
15
16
|
private localizationService;
|
|
@@ -44,6 +45,38 @@ export declare class SwitchComponent implements ControlValueAccessor, OnInit, On
|
|
|
44
45
|
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the Switch.
|
|
45
46
|
*/
|
|
46
47
|
tabindex: number;
|
|
48
|
+
/**
|
|
49
|
+
* Specifies the size of the Switch.
|
|
50
|
+
*
|
|
51
|
+
* The possible values are:
|
|
52
|
+
* * `'small'`
|
|
53
|
+
* * `'medium'` (default)
|
|
54
|
+
* * `'large'`
|
|
55
|
+
* * `null`
|
|
56
|
+
*/
|
|
57
|
+
size: InputSize;
|
|
58
|
+
/**
|
|
59
|
+
* Specifies the border radius of the Switch thumb.
|
|
60
|
+
*
|
|
61
|
+
* The possible values are:
|
|
62
|
+
* * `'full'` (default)
|
|
63
|
+
* * `'small'`
|
|
64
|
+
* * `'medium'`
|
|
65
|
+
* * `'large'`
|
|
66
|
+
* * `null`
|
|
67
|
+
*/
|
|
68
|
+
thumbRounded: InputRounded;
|
|
69
|
+
/**
|
|
70
|
+
* Specifies the border radius of the Switch track.
|
|
71
|
+
*
|
|
72
|
+
* The possible values are:
|
|
73
|
+
* * `'full'` (default)
|
|
74
|
+
* * `'small'`
|
|
75
|
+
* * `'medium'`
|
|
76
|
+
* * `'large'`
|
|
77
|
+
* * `null`
|
|
78
|
+
*/
|
|
79
|
+
trackRounded: InputRounded;
|
|
47
80
|
/**
|
|
48
81
|
* @hidden
|
|
49
82
|
*/
|
|
@@ -60,13 +93,14 @@ export declare class SwitchComponent implements ControlValueAccessor, OnInit, On
|
|
|
60
93
|
* Fires each time the user selects a new value.
|
|
61
94
|
*/
|
|
62
95
|
valueChange: EventEmitter<any>;
|
|
63
|
-
wrapper: any;
|
|
64
96
|
direction: string;
|
|
65
97
|
readonly ieClass: boolean;
|
|
66
98
|
readonly ariaDisabled: boolean;
|
|
67
99
|
readonly ariaReadonly: boolean;
|
|
68
100
|
hostClasses: boolean;
|
|
69
101
|
readonly disabledClass: boolean;
|
|
102
|
+
track: any;
|
|
103
|
+
thumb: any;
|
|
70
104
|
/**
|
|
71
105
|
* @hidden
|
|
72
106
|
*/
|
|
@@ -74,7 +108,11 @@ export declare class SwitchComponent implements ControlValueAccessor, OnInit, On
|
|
|
74
108
|
protected localizationChangeSubscription: Subscription;
|
|
75
109
|
protected isFocused: boolean;
|
|
76
110
|
protected control: NgControl;
|
|
111
|
+
private hostClickSubscription;
|
|
77
112
|
private _checked;
|
|
113
|
+
private _size;
|
|
114
|
+
private _trackRounded;
|
|
115
|
+
private _thumbRounded;
|
|
78
116
|
constructor(renderer: Renderer2, hostElement: ElementRef, localizationService: LocalizationService, injector: Injector, changeDetector: ChangeDetectorRef, ngZone: NgZone);
|
|
79
117
|
/**
|
|
80
118
|
* @hidden
|
|
@@ -88,6 +126,7 @@ export declare class SwitchComponent implements ControlValueAccessor, OnInit, On
|
|
|
88
126
|
protected ngTouched: Function;
|
|
89
127
|
protected readonly isEnabled: boolean;
|
|
90
128
|
ngOnInit(): void;
|
|
129
|
+
ngAfterViewInit(): void;
|
|
91
130
|
ngOnDestroy(): void;
|
|
92
131
|
/**
|
|
93
132
|
* Focuses the Switch.
|
|
@@ -122,7 +161,7 @@ export declare class SwitchComponent implements ControlValueAccessor, OnInit, On
|
|
|
122
161
|
/**
|
|
123
162
|
* @hidden
|
|
124
163
|
*/
|
|
125
|
-
handleBlur: () => void;
|
|
164
|
+
handleBlur: (event: any) => void;
|
|
126
165
|
/**
|
|
127
166
|
* @hidden
|
|
128
167
|
*/
|
|
@@ -145,10 +184,14 @@ export declare class SwitchComponent implements ControlValueAccessor, OnInit, On
|
|
|
145
184
|
clickHandler(): void;
|
|
146
185
|
/**
|
|
147
186
|
* @hidden
|
|
148
|
-
* Used by the
|
|
187
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
149
188
|
*/
|
|
150
189
|
isEmpty(): boolean;
|
|
151
190
|
private changeValue;
|
|
152
191
|
private focused;
|
|
192
|
+
private attachHostClickHandler;
|
|
153
193
|
private setHostClasses;
|
|
194
|
+
private handleClasses;
|
|
195
|
+
private handleTrackClasses;
|
|
196
|
+
private handleThumbClasses;
|
|
154
197
|
}
|
|
@@ -10,10 +10,11 @@ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
|
10
10
|
import { hasObservers, guid, Keys, KendoInput } from '@progress/kendo-angular-common';
|
|
11
11
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
12
12
|
import { packageMetadata } from '../package-metadata';
|
|
13
|
-
import { requiresZoneOnBlur } from '../common/utils';
|
|
13
|
+
import { requiresZoneOnBlur, getStylingClasses } from '../common/utils';
|
|
14
|
+
import { Subscription } from "rxjs";
|
|
14
15
|
import { skip, take } from "rxjs/operators";
|
|
15
16
|
import { browser } from '@progress/kendo-common';
|
|
16
|
-
const FOCUSED = 'k-
|
|
17
|
+
const FOCUSED = 'k-focus';
|
|
17
18
|
/**
|
|
18
19
|
* Represents the [Kendo UI Switch component for Angular]({% slug overview_switch %}).
|
|
19
20
|
*/
|
|
@@ -58,13 +59,20 @@ let SwitchComponent = SwitchComponent_1 = class SwitchComponent {
|
|
|
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 = (_) => { };
|
|
63
68
|
this.ngTouched = () => { };
|
|
64
69
|
/**
|
|
65
70
|
* @hidden
|
|
66
71
|
*/
|
|
67
72
|
this.handleFocus = () => {
|
|
73
|
+
if (this.isFocused) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
68
76
|
this.focused = true;
|
|
69
77
|
if (hasObservers(this.onFocus)) {
|
|
70
78
|
this.ngZone.run(() => {
|
|
@@ -75,7 +83,11 @@ let SwitchComponent = SwitchComponent_1 = class SwitchComponent {
|
|
|
75
83
|
/**
|
|
76
84
|
* @hidden
|
|
77
85
|
*/
|
|
78
|
-
this.handleBlur = () => {
|
|
86
|
+
this.handleBlur = (event) => {
|
|
87
|
+
const 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)) {
|
|
@@ -100,6 +112,56 @@ let SwitchComponent = SwitchComponent_1 = class SwitchComponent {
|
|
|
100
112
|
get checked() {
|
|
101
113
|
return this._checked;
|
|
102
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Specifies the size of the Switch.
|
|
117
|
+
*
|
|
118
|
+
* The possible values are:
|
|
119
|
+
* * `'small'`
|
|
120
|
+
* * `'medium'` (default)
|
|
121
|
+
* * `'large'`
|
|
122
|
+
* * `null`
|
|
123
|
+
*/
|
|
124
|
+
set size(size) {
|
|
125
|
+
this.handleClasses(size, 'size');
|
|
126
|
+
this._size = size;
|
|
127
|
+
}
|
|
128
|
+
get size() {
|
|
129
|
+
return this._size;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Specifies the border radius of the Switch thumb.
|
|
133
|
+
*
|
|
134
|
+
* The possible values are:
|
|
135
|
+
* * `'full'` (default)
|
|
136
|
+
* * `'small'`
|
|
137
|
+
* * `'medium'`
|
|
138
|
+
* * `'large'`
|
|
139
|
+
* * `null`
|
|
140
|
+
*/
|
|
141
|
+
set thumbRounded(thumbRounded) {
|
|
142
|
+
this.handleThumbClasses(thumbRounded);
|
|
143
|
+
this._thumbRounded = thumbRounded;
|
|
144
|
+
}
|
|
145
|
+
get thumbRounded() {
|
|
146
|
+
return this._thumbRounded;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Specifies the border radius of the Switch track.
|
|
150
|
+
*
|
|
151
|
+
* The possible values are:
|
|
152
|
+
* * `'full'` (default)
|
|
153
|
+
* * `'small'`
|
|
154
|
+
* * `'medium'`
|
|
155
|
+
* * `'large'`
|
|
156
|
+
* * `null`
|
|
157
|
+
*/
|
|
158
|
+
set trackRounded(trackRounded) {
|
|
159
|
+
this.handleTrackClasses(trackRounded);
|
|
160
|
+
this._trackRounded = trackRounded;
|
|
161
|
+
}
|
|
162
|
+
get trackRounded() {
|
|
163
|
+
return this._trackRounded;
|
|
164
|
+
}
|
|
103
165
|
/**
|
|
104
166
|
* @hidden
|
|
105
167
|
*/
|
|
@@ -150,10 +212,23 @@ let SwitchComponent = SwitchComponent_1 = class SwitchComponent {
|
|
|
150
212
|
this.control = this.injector.get(NgControl, null);
|
|
151
213
|
this.ngZone.onStable.pipe(take(1)).subscribe(() => this.initialized = true);
|
|
152
214
|
}
|
|
215
|
+
ngAfterViewInit() {
|
|
216
|
+
const wrapper = this.hostElement.nativeElement;
|
|
217
|
+
this.attachHostClickHandler();
|
|
218
|
+
if (!this.checked && !wrapper.classList.contains('k-switch-off')) {
|
|
219
|
+
this.renderer.addClass(wrapper, 'k-switch-off');
|
|
220
|
+
}
|
|
221
|
+
this.handleClasses(this.size, 'size');
|
|
222
|
+
this.handleTrackClasses(this.trackRounded);
|
|
223
|
+
this.handleThumbClasses(this.thumbRounded);
|
|
224
|
+
}
|
|
153
225
|
ngOnDestroy() {
|
|
154
226
|
if (this.localizationChangeSubscription) {
|
|
155
227
|
this.localizationChangeSubscription.unsubscribe();
|
|
156
228
|
}
|
|
229
|
+
if (this.hostClickSubscription) {
|
|
230
|
+
this.hostClickSubscription.unsubscribe();
|
|
231
|
+
}
|
|
157
232
|
}
|
|
158
233
|
/**
|
|
159
234
|
* Focuses the Switch.
|
|
@@ -171,19 +246,19 @@ let SwitchComponent = SwitchComponent_1 = class SwitchComponent {
|
|
|
171
246
|
* ```
|
|
172
247
|
*/
|
|
173
248
|
focus() {
|
|
174
|
-
if (!this.
|
|
249
|
+
if (!this.track) {
|
|
175
250
|
return;
|
|
176
251
|
}
|
|
177
|
-
this.
|
|
252
|
+
this.track.nativeElement.focus();
|
|
178
253
|
}
|
|
179
254
|
/**
|
|
180
255
|
* Blurs the Switch.
|
|
181
256
|
*/
|
|
182
257
|
blur() {
|
|
183
|
-
if (!this.
|
|
258
|
+
if (!this.track) {
|
|
184
259
|
return;
|
|
185
260
|
}
|
|
186
|
-
this.
|
|
261
|
+
this.track.nativeElement.blur();
|
|
187
262
|
}
|
|
188
263
|
/**
|
|
189
264
|
* @hidden
|
|
@@ -233,7 +308,7 @@ let SwitchComponent = SwitchComponent_1 = class SwitchComponent {
|
|
|
233
308
|
}
|
|
234
309
|
/**
|
|
235
310
|
* @hidden
|
|
236
|
-
* Used by the
|
|
311
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
237
312
|
*/
|
|
238
313
|
isEmpty() {
|
|
239
314
|
return false;
|
|
@@ -250,24 +325,63 @@ let SwitchComponent = SwitchComponent_1 = class SwitchComponent {
|
|
|
250
325
|
}
|
|
251
326
|
set focused(value) {
|
|
252
327
|
if (this.isFocused !== value && this.hostElement) {
|
|
253
|
-
const
|
|
328
|
+
const wrapper = this.hostElement.nativeElement;
|
|
254
329
|
if (value) {
|
|
255
|
-
this.renderer.addClass(
|
|
330
|
+
this.renderer.addClass(wrapper, FOCUSED);
|
|
256
331
|
}
|
|
257
332
|
else {
|
|
258
|
-
this.renderer.removeClass(
|
|
333
|
+
this.renderer.removeClass(wrapper, FOCUSED);
|
|
259
334
|
}
|
|
260
335
|
this.isFocused = value;
|
|
261
336
|
}
|
|
262
337
|
}
|
|
338
|
+
attachHostClickHandler() {
|
|
339
|
+
this.ngZone.runOutsideAngular(() => {
|
|
340
|
+
this.hostClickSubscription.add(this.renderer.listen(this.hostElement.nativeElement, 'click', this.clickHandler));
|
|
341
|
+
});
|
|
342
|
+
}
|
|
263
343
|
setHostClasses(value) {
|
|
344
|
+
const wrapper = this.hostElement.nativeElement;
|
|
264
345
|
if (value) {
|
|
265
|
-
this.renderer.removeClass(
|
|
266
|
-
this.renderer.addClass(
|
|
346
|
+
this.renderer.removeClass(wrapper, 'k-switch-off');
|
|
347
|
+
this.renderer.addClass(wrapper, 'k-switch-on');
|
|
267
348
|
}
|
|
268
349
|
else {
|
|
269
|
-
this.renderer.removeClass(
|
|
270
|
-
this.renderer.addClass(
|
|
350
|
+
this.renderer.removeClass(wrapper, 'k-switch-on');
|
|
351
|
+
this.renderer.addClass(wrapper, 'k-switch-off');
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
handleClasses(value, input) {
|
|
355
|
+
const elem = this.hostElement.nativeElement;
|
|
356
|
+
const classes = getStylingClasses('switch', input, this[input], value);
|
|
357
|
+
if (classes.toRemove) {
|
|
358
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
359
|
+
}
|
|
360
|
+
if (classes.toAdd) {
|
|
361
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
handleTrackClasses(value) {
|
|
365
|
+
const elem = this.hostElement.nativeElement;
|
|
366
|
+
const track = this.track.nativeElement;
|
|
367
|
+
const classes = getStylingClasses('switch', 'rounded', this.trackRounded, value);
|
|
368
|
+
if (classes.toRemove) {
|
|
369
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
370
|
+
this.renderer.removeClass(track, classes.toRemove);
|
|
371
|
+
}
|
|
372
|
+
if (classes.toAdd) {
|
|
373
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
374
|
+
this.renderer.addClass(track, classes.toAdd);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
handleThumbClasses(value) {
|
|
378
|
+
const thumb = this.thumb.nativeElement;
|
|
379
|
+
const classes = getStylingClasses('switch', 'rounded', this.thumbRounded, value);
|
|
380
|
+
if (classes.toRemove) {
|
|
381
|
+
this.renderer.removeClass(thumb, classes.toRemove);
|
|
382
|
+
}
|
|
383
|
+
if (classes.toAdd) {
|
|
384
|
+
this.renderer.addClass(thumb, classes.toAdd);
|
|
271
385
|
}
|
|
272
386
|
}
|
|
273
387
|
};
|
|
@@ -300,6 +414,21 @@ tslib_1.__decorate([
|
|
|
300
414
|
Input(),
|
|
301
415
|
tslib_1.__metadata("design:type", Number)
|
|
302
416
|
], SwitchComponent.prototype, "tabindex", void 0);
|
|
417
|
+
tslib_1.__decorate([
|
|
418
|
+
Input(),
|
|
419
|
+
tslib_1.__metadata("design:type", String),
|
|
420
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
421
|
+
], SwitchComponent.prototype, "size", null);
|
|
422
|
+
tslib_1.__decorate([
|
|
423
|
+
Input(),
|
|
424
|
+
tslib_1.__metadata("design:type", String),
|
|
425
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
426
|
+
], SwitchComponent.prototype, "thumbRounded", null);
|
|
427
|
+
tslib_1.__decorate([
|
|
428
|
+
Input(),
|
|
429
|
+
tslib_1.__metadata("design:type", String),
|
|
430
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
431
|
+
], SwitchComponent.prototype, "trackRounded", null);
|
|
303
432
|
tslib_1.__decorate([
|
|
304
433
|
Input(),
|
|
305
434
|
tslib_1.__metadata("design:type", Number),
|
|
@@ -317,10 +446,6 @@ tslib_1.__decorate([
|
|
|
317
446
|
Output(),
|
|
318
447
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
319
448
|
], SwitchComponent.prototype, "valueChange", void 0);
|
|
320
|
-
tslib_1.__decorate([
|
|
321
|
-
ViewChild('wrapper', { static: true }),
|
|
322
|
-
tslib_1.__metadata("design:type", Object)
|
|
323
|
-
], SwitchComponent.prototype, "wrapper", void 0);
|
|
324
449
|
tslib_1.__decorate([
|
|
325
450
|
HostBinding('attr.dir'),
|
|
326
451
|
tslib_1.__metadata("design:type", String)
|
|
@@ -345,10 +470,18 @@ tslib_1.__decorate([
|
|
|
345
470
|
tslib_1.__metadata("design:type", Boolean)
|
|
346
471
|
], SwitchComponent.prototype, "hostClasses", void 0);
|
|
347
472
|
tslib_1.__decorate([
|
|
348
|
-
HostBinding('class.k-
|
|
473
|
+
HostBinding('class.k-disabled'),
|
|
349
474
|
tslib_1.__metadata("design:type", Boolean),
|
|
350
475
|
tslib_1.__metadata("design:paramtypes", [])
|
|
351
476
|
], SwitchComponent.prototype, "disabledClass", null);
|
|
477
|
+
tslib_1.__decorate([
|
|
478
|
+
ViewChild('track', { static: true }),
|
|
479
|
+
tslib_1.__metadata("design:type", Object)
|
|
480
|
+
], SwitchComponent.prototype, "track", void 0);
|
|
481
|
+
tslib_1.__decorate([
|
|
482
|
+
ViewChild('thumb', { static: true }),
|
|
483
|
+
tslib_1.__metadata("design:type", Object)
|
|
484
|
+
], SwitchComponent.prototype, "thumb", void 0);
|
|
352
485
|
SwitchComponent = SwitchComponent_1 = tslib_1.__decorate([
|
|
353
486
|
Component({
|
|
354
487
|
exportAs: 'kendoSwitch',
|
|
@@ -375,18 +508,27 @@ SwitchComponent = SwitchComponent_1 = tslib_1.__decorate([
|
|
|
375
508
|
>
|
|
376
509
|
|
|
377
510
|
<span
|
|
378
|
-
#
|
|
379
|
-
class="k-switch-
|
|
511
|
+
#track
|
|
512
|
+
class="k-switch-track"
|
|
380
513
|
[id]="focusableId"
|
|
381
514
|
role="switch"
|
|
382
515
|
[style.transitionDuration]="initialized ? '200ms' : '0ms'"
|
|
383
516
|
[attr.aria-checked]="checked"
|
|
384
517
|
[attr.tabindex]="(disabled ? undefined : tabIndex)"
|
|
385
|
-
[kendoEventsOutsideAngular]="{
|
|
518
|
+
[kendoEventsOutsideAngular]="{ keydown: keyDownHandler, focus: handleFocus, blur: handleBlur }"
|
|
386
519
|
>
|
|
387
520
|
<span class="k-switch-label-on" [attr.aria-hidden]="true" >{{onLabelMessage}}</span>
|
|
388
521
|
<span class="k-switch-label-off" [attr.aria-hidden]="true">{{offLabelMessage}}</span>
|
|
389
|
-
|
|
522
|
+
</span>
|
|
523
|
+
<span
|
|
524
|
+
class="k-switch-thumb-wrap"
|
|
525
|
+
tabindex="-1"
|
|
526
|
+
[style.transitionDuration]="initialized ? '200ms' : '0ms'" [kendoEventsOutsideAngular]="{
|
|
527
|
+
keydown: keyDownHandler,
|
|
528
|
+
focus: handleFocus,
|
|
529
|
+
blur: handleBlur
|
|
530
|
+
}">
|
|
531
|
+
<span #thumb class="k-switch-thumb"></span>
|
|
390
532
|
</span>
|
|
391
533
|
`
|
|
392
534
|
}),
|
|
@@ -127,7 +127,7 @@ tslib_1.__decorate([
|
|
|
127
127
|
tslib_1.__metadata("design:type", ElementRef)
|
|
128
128
|
], TextFieldsBase.prototype, "input", void 0);
|
|
129
129
|
tslib_1.__decorate([
|
|
130
|
-
HostBinding('class.k-
|
|
130
|
+
HostBinding('class.k-disabled'),
|
|
131
131
|
tslib_1.__metadata("design:type", Boolean),
|
|
132
132
|
tslib_1.__metadata("design:paramtypes", [])
|
|
133
133
|
], TextFieldsBase.prototype, "disabledClass", null);
|
|
@@ -8,6 +8,7 @@ import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
|
8
8
|
import { TextFieldsBase } from '../text-fields-common/text-fields-base';
|
|
9
9
|
import { TextAreaFlow } from './models/flow';
|
|
10
10
|
import { TextAreaResize } from './models/resize';
|
|
11
|
+
import { InputRounded, InputFillMode, InputSize } from '../common/models';
|
|
11
12
|
/**
|
|
12
13
|
* Represents the [Kendo UI TextArea component for Angular]({% slug overview_textarea %}).
|
|
13
14
|
*/
|
|
@@ -22,7 +23,7 @@ export declare class TextAreaComponent extends TextFieldsBase implements Control
|
|
|
22
23
|
* @hidden
|
|
23
24
|
*/
|
|
24
25
|
focusableId: string;
|
|
25
|
-
|
|
26
|
+
hostClasses: boolean;
|
|
26
27
|
readonly flowCol: boolean;
|
|
27
28
|
readonly flowRow: boolean;
|
|
28
29
|
/**
|
|
@@ -66,6 +67,39 @@ export declare class TextAreaComponent extends TextFieldsBase implements Control
|
|
|
66
67
|
*
|
|
67
68
|
*/
|
|
68
69
|
resizable: TextAreaResize;
|
|
70
|
+
/**
|
|
71
|
+
* The size property specifies the font size and line height of the TextArea
|
|
72
|
+
* ([see example]({% slug appearance_textarea %}#toc-size)).
|
|
73
|
+
*
|
|
74
|
+
* The possible values are:
|
|
75
|
+
* * `'small'`
|
|
76
|
+
* * `'medium'` (default)
|
|
77
|
+
* * `'large'`
|
|
78
|
+
* * `null`
|
|
79
|
+
*/
|
|
80
|
+
size: InputSize;
|
|
81
|
+
/**
|
|
82
|
+
* The rounded property specifies the border radius of the TextArea
|
|
83
|
+
* ([see example]({% slug appearance_textarea %}#toc-rounded)).
|
|
84
|
+
*
|
|
85
|
+
* The possible values are:
|
|
86
|
+
* * `'small'`
|
|
87
|
+
* * `'medium'` (default)
|
|
88
|
+
* * `'large'`
|
|
89
|
+
* * `null`
|
|
90
|
+
*/
|
|
91
|
+
rounded: InputRounded;
|
|
92
|
+
/**
|
|
93
|
+
* The fillMode property specifies the background and border styles of the TextArea
|
|
94
|
+
* ([see example]({% slug appearance_textarea %}#toc-fillMode)).
|
|
95
|
+
*
|
|
96
|
+
* The possible values are:
|
|
97
|
+
* * `'flat'`
|
|
98
|
+
* * `'solid'` (default)
|
|
99
|
+
* * `'outline'`
|
|
100
|
+
* * `null`
|
|
101
|
+
*/
|
|
102
|
+
fillMode: InputFillMode;
|
|
69
103
|
/**
|
|
70
104
|
* Fires each time the user focuses the TextArea component.
|
|
71
105
|
*
|
|
@@ -116,6 +150,9 @@ export declare class TextAreaComponent extends TextFieldsBase implements Control
|
|
|
116
150
|
valueChange: EventEmitter<any>;
|
|
117
151
|
private initialHeight;
|
|
118
152
|
private resizeSubscription;
|
|
153
|
+
private _size;
|
|
154
|
+
private _rounded;
|
|
155
|
+
private _fillMode;
|
|
119
156
|
constructor(localizationService: LocalizationService, ngZone: NgZone, changeDetector: ChangeDetectorRef, renderer: Renderer2, injector: Injector, hostElement: ElementRef);
|
|
120
157
|
ngAfterViewInit(): void;
|
|
121
158
|
ngOnInit(): void;
|
|
@@ -172,4 +209,5 @@ export declare class TextAreaComponent extends TextFieldsBase implements Control
|
|
|
172
209
|
private handleBlur;
|
|
173
210
|
private setSelection;
|
|
174
211
|
private selectAll;
|
|
212
|
+
private handleClasses;
|
|
175
213
|
}
|