@progress/kendo-angular-inputs 21.4.1 → 22.0.0
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/colorpicker/localization/messages.d.ts +1 -1
- package/common/radio-checkbox.base.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-inputs.mjs +321 -321
- package/numerictextbox/localization/messages.d.ts +1 -1
- package/otpinput/localization/messages.d.ts +1 -1
- package/package.json +17 -25
- package/rangeslider/localization/messages.d.ts +1 -1
- package/signature/localization/messages.d.ts +1 -1
- package/slider/localization/messages.d.ts +1 -1
- package/sliders-common/slider-base.d.ts +1 -1
- package/switch/localization/messages.d.ts +1 -1
- package/text-fields-common/text-fields-base.d.ts +1 -1
- package/textbox/localization/messages.d.ts +1 -1
- package/esm2022/checkbox/checkbox.component.mjs +0 -227
- package/esm2022/checkbox/checkbox.directive.mjs +0 -96
- package/esm2022/checkbox/checked-state.mjs +0 -5
- package/esm2022/checkbox.module.mjs +0 -42
- package/esm2022/colorpicker/adaptiveness/adaptive-close-button.component.mjs +0 -62
- package/esm2022/colorpicker/adaptiveness/adaptive-renderer.component.mjs +0 -219
- package/esm2022/colorpicker/color-contrast-svg.component.mjs +0 -108
- package/esm2022/colorpicker/color-gradient-numeric-label.directive.mjs +0 -37
- package/esm2022/colorpicker/color-gradient-text-label.directive.mjs +0 -34
- package/esm2022/colorpicker/color-gradient.component.mjs +0 -1110
- package/esm2022/colorpicker/color-input.component.mjs +0 -498
- package/esm2022/colorpicker/color-palette.component.mjs +0 -629
- package/esm2022/colorpicker/colorpicker.component.mjs +0 -1315
- package/esm2022/colorpicker/constants.mjs +0 -40
- package/esm2022/colorpicker/contrast-validation.component.mjs +0 -83
- package/esm2022/colorpicker/contrast.component.mjs +0 -114
- package/esm2022/colorpicker/events/active-color-click-event.mjs +0 -55
- package/esm2022/colorpicker/events/cancel-event.mjs +0 -18
- package/esm2022/colorpicker/events/close-event.mjs +0 -10
- package/esm2022/colorpicker/events/kendo-drag-event.mjs +0 -5
- package/esm2022/colorpicker/events/open-event.mjs +0 -10
- package/esm2022/colorpicker/events.mjs +0 -8
- package/esm2022/colorpicker/flatcolorpicker-actions.component.mjs +0 -112
- package/esm2022/colorpicker/flatcolorpicker-header.component.mjs +0 -244
- package/esm2022/colorpicker/flatcolorpicker.component.mjs +0 -942
- package/esm2022/colorpicker/localization/colorgradient-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/colorpalette-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/colorpicker-localization.service.mjs +0 -31
- package/esm2022/colorpicker/localization/custom-messages.component.mjs +0 -51
- package/esm2022/colorpicker/localization/flatcolorpicker-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/localized-colorpicker-messages.directive.mjs +0 -39
- package/esm2022/colorpicker/localization/messages.mjs +0 -201
- package/esm2022/colorpicker/models/actions-layout.mjs +0 -5
- package/esm2022/colorpicker/models/adaptive-mode.mjs +0 -8
- package/esm2022/colorpicker/models/colorpicker-view.mjs +0 -5
- package/esm2022/colorpicker/models/gradient-settings.mjs +0 -5
- package/esm2022/colorpicker/models/hsva.mjs +0 -5
- package/esm2022/colorpicker/models/output-format.mjs +0 -5
- package/esm2022/colorpicker/models/palette-presets.mjs +0 -62
- package/esm2022/colorpicker/models/palette-settings.mjs +0 -5
- package/esm2022/colorpicker/models/popup-settings.mjs +0 -5
- package/esm2022/colorpicker/models/rgb.mjs +0 -5
- package/esm2022/colorpicker/models/rgba.mjs +0 -5
- package/esm2022/colorpicker/models/table-cell.mjs +0 -5
- package/esm2022/colorpicker/models/tile-size.mjs +0 -5
- package/esm2022/colorpicker/models.mjs +0 -16
- package/esm2022/colorpicker/services/color-palette.service.mjs +0 -65
- package/esm2022/colorpicker/services/flatcolorpicker.service.mjs +0 -39
- package/esm2022/colorpicker/utils/color-parser.mjs +0 -164
- package/esm2022/colorpicker/utils/contrast-curve.mjs +0 -85
- package/esm2022/colorpicker/utils.mjs +0 -6
- package/esm2022/colorpicker.module.mjs +0 -50
- package/esm2022/common/dom-utils.mjs +0 -36
- package/esm2022/common/formservice.service.mjs +0 -21
- package/esm2022/common/math.mjs +0 -65
- package/esm2022/common/models/fillmode.mjs +0 -5
- package/esm2022/common/models/gutters.mjs +0 -5
- package/esm2022/common/models/responsive-breakpoints.mjs +0 -5
- package/esm2022/common/models/rounded.mjs +0 -5
- package/esm2022/common/models/size.mjs +0 -5
- package/esm2022/common/models/styling-classes.mjs +0 -5
- package/esm2022/common/models/type.mjs +0 -5
- package/esm2022/common/models.mjs +0 -9
- package/esm2022/common/radio-checkbox.base.mjs +0 -295
- package/esm2022/common/utils.mjs +0 -88
- package/esm2022/directives.mjs +0 -430
- package/esm2022/form/form.component.mjs +0 -163
- package/esm2022/form/formseparator.component.mjs +0 -80
- package/esm2022/form/utils.mjs +0 -147
- package/esm2022/form.module.mjs +0 -46
- package/esm2022/formfield/error.component.mjs +0 -70
- package/esm2022/formfield/formfield.component.mjs +0 -353
- package/esm2022/formfield/hint.component.mjs +0 -65
- package/esm2022/formfield/models/message-align.mjs +0 -5
- package/esm2022/formfield/models/orientation.mjs +0 -5
- package/esm2022/formfield/models/show-options.mjs +0 -5
- package/esm2022/formfield.module.mjs +0 -43
- package/esm2022/formfieldset/formfieldset.component.mjs +0 -174
- package/esm2022/index.mjs +0 -91
- package/esm2022/inputs.module.mjs +0 -91
- package/esm2022/maskedtextbox/maskedtextbox.component.mjs +0 -876
- package/esm2022/maskedtextbox/masking.service.mjs +0 -189
- package/esm2022/maskedtextbox/parsing/combinators.mjs +0 -28
- package/esm2022/maskedtextbox/parsing/parsers.mjs +0 -148
- package/esm2022/maskedtextbox/parsing/result.mjs +0 -44
- package/esm2022/maskedtextbox/parsing/stream.mjs +0 -43
- package/esm2022/maskedtextbox.module.mjs +0 -43
- package/esm2022/numerictextbox/arrow-direction.mjs +0 -13
- package/esm2022/numerictextbox/constants.mjs +0 -28
- package/esm2022/numerictextbox/localization/custom-messages.component.mjs +0 -55
- package/esm2022/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +0 -39
- package/esm2022/numerictextbox/localization/messages.mjs +0 -33
- package/esm2022/numerictextbox/numerictextbox.component.mjs +0 -1314
- package/esm2022/numerictextbox/utils.mjs +0 -92
- package/esm2022/numerictextbox.module.mjs +0 -46
- package/esm2022/otp.module.mjs +0 -44
- package/esm2022/otpinput/localization/custom-messages.component.mjs +0 -45
- package/esm2022/otpinput/localization/localized-textbox-messages.directive.mjs +0 -39
- package/esm2022/otpinput/localization/messages.mjs +0 -34
- package/esm2022/otpinput/models/otpinput-type.mjs +0 -5
- package/esm2022/otpinput/models/separator-icon.mjs +0 -5
- package/esm2022/otpinput/otpinput-separator.component.mjs +0 -93
- package/esm2022/otpinput/otpinput.component.mjs +0 -936
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-inputs.mjs +0 -8
- package/esm2022/radiobutton/radiobutton.component.mjs +0 -212
- package/esm2022/radiobutton/radiobutton.directive.mjs +0 -81
- package/esm2022/radiobutton.module.mjs +0 -43
- package/esm2022/rangeslider/localization/custom-messages.component.mjs +0 -53
- package/esm2022/rangeslider/localization/localized-rangeslider-messages.directive.mjs +0 -39
- package/esm2022/rangeslider/localization/messages.mjs +0 -33
- package/esm2022/rangeslider/rangeslider-model.mjs +0 -53
- package/esm2022/rangeslider/rangeslider-value.type.mjs +0 -5
- package/esm2022/rangeslider/rangeslider.component.mjs +0 -625
- package/esm2022/rangeslider.module.mjs +0 -46
- package/esm2022/rating/directives/rating-hovered-item.directive.mjs +0 -35
- package/esm2022/rating/directives/rating-item.directive.mjs +0 -34
- package/esm2022/rating/directives/rating-selected-item.directive.mjs +0 -36
- package/esm2022/rating/models/precision.mjs +0 -5
- package/esm2022/rating/models/rating-item.interface.mjs +0 -5
- package/esm2022/rating/models/selection.mjs +0 -5
- package/esm2022/rating/rating.component.mjs +0 -754
- package/esm2022/rating.module.mjs +0 -46
- package/esm2022/shared/input-separator.component.mjs +0 -55
- package/esm2022/shared/input-spacer.component.mjs +0 -56
- package/esm2022/shared/shared-events.directive.mjs +0 -102
- package/esm2022/shared/utils.mjs +0 -13
- package/esm2022/signature/events/close-event.mjs +0 -10
- package/esm2022/signature/events/index.mjs +0 -6
- package/esm2022/signature/events/open-event.mjs +0 -10
- package/esm2022/signature/localization/custom-messages.component.mjs +0 -43
- package/esm2022/signature/localization/index.mjs +0 -7
- package/esm2022/signature/localization/localized-signature-messages.directive.mjs +0 -39
- package/esm2022/signature/localization/messages.mjs +0 -45
- package/esm2022/signature/signature.component.mjs +0 -981
- package/esm2022/signature.module.mjs +0 -47
- package/esm2022/slider/localization/custom-messages.component.mjs +0 -43
- package/esm2022/slider/localization/localized-slider-messages.directive.mjs +0 -39
- package/esm2022/slider/localization/messages.mjs +0 -39
- package/esm2022/slider/slider-model.mjs +0 -32
- package/esm2022/slider/slider.component.mjs +0 -671
- package/esm2022/slider.module.mjs +0 -48
- package/esm2022/sliders-common/label-template.directive.mjs +0 -37
- package/esm2022/sliders-common/slider-base.mjs +0 -300
- package/esm2022/sliders-common/slider-model.base.mjs +0 -118
- package/esm2022/sliders-common/slider-ticks.component.mjs +0 -147
- package/esm2022/sliders-common/sliders-util.mjs +0 -206
- package/esm2022/sliders-common/title-callback.mjs +0 -5
- package/esm2022/switch/events/blur-event.mjs +0 -13
- package/esm2022/switch/events/focus-event.mjs +0 -13
- package/esm2022/switch/localization/custom-messages.component.mjs +0 -43
- package/esm2022/switch/localization/localized-switch-messages.directive.mjs +0 -39
- package/esm2022/switch/localization/messages.mjs +0 -33
- package/esm2022/switch/switch.component.mjs +0 -585
- package/esm2022/switch.module.mjs +0 -44
- package/esm2022/text-fields-common/text-fields-base.mjs +0 -150
- package/esm2022/textarea/models/adornments-orientation.mjs +0 -5
- package/esm2022/textarea/models/flow.mjs +0 -5
- package/esm2022/textarea/models/resize.mjs +0 -5
- package/esm2022/textarea/models/textarea-settings.mjs +0 -5
- package/esm2022/textarea/textarea-prefix.component.mjs +0 -67
- package/esm2022/textarea/textarea-suffix.component.mjs +0 -67
- package/esm2022/textarea/textarea.component.mjs +0 -740
- package/esm2022/textarea/textarea.directive.mjs +0 -288
- package/esm2022/textarea.module.mjs +0 -46
- package/esm2022/textbox/localization/custom-messages.component.mjs +0 -43
- package/esm2022/textbox/localization/localized-textbox-messages.directive.mjs +0 -39
- package/esm2022/textbox/localization/messages.mjs +0 -27
- package/esm2022/textbox/models/icon-show-options.mjs +0 -5
- package/esm2022/textbox/textbox-prefix.directive.mjs +0 -50
- package/esm2022/textbox/textbox-suffix.directive.mjs +0 -49
- package/esm2022/textbox/textbox.component.mjs +0 -933
- package/esm2022/textbox/textbox.directive.mjs +0 -125
- package/esm2022/textbox.module.mjs +0 -51
- package/esm2022/validators/max.validator.mjs +0 -21
- package/esm2022/validators/min.validator.mjs +0 -21
|
@@ -1,585 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { ElementRef, Renderer2, Component, EventEmitter, HostBinding, Input, Output, ViewChild, forwardRef, ChangeDetectorRef, NgZone, Injector } from '@angular/core';
|
|
6
|
-
import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
|
7
|
-
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
|
-
import { hasObservers, guid, Keys, KendoInput } from '@progress/kendo-angular-common';
|
|
9
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
|
-
import { packageMetadata } from '../package-metadata';
|
|
11
|
-
import { requiresZoneOnBlur, getStylingClasses } from '../common/utils';
|
|
12
|
-
import { skip, take } from "rxjs/operators";
|
|
13
|
-
import { LocalizedSwitchMessagesDirective } from './localization/localized-switch-messages.directive';
|
|
14
|
-
import * as i0 from "@angular/core";
|
|
15
|
-
import * as i1 from "@progress/kendo-angular-l10n";
|
|
16
|
-
const FOCUSED = 'k-focus';
|
|
17
|
-
const DEFAULT_SIZE = 'medium';
|
|
18
|
-
const DEFAULT_THUMB_ROUNDED = 'full';
|
|
19
|
-
const DEFAULT_TRACK_ROUNDED = 'full';
|
|
20
|
-
/**
|
|
21
|
-
* Represents the [Kendo UI Switch component for Angular]({% slug overview_switch %}).
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```html
|
|
25
|
-
* <kendo-switch [(ngModel)]="checked"></kendo-switch>`
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @remarks
|
|
29
|
-
* Supported children components are: {@link SwitchCustomMessagesComponent}.
|
|
30
|
-
*/
|
|
31
|
-
export class SwitchComponent {
|
|
32
|
-
renderer;
|
|
33
|
-
hostElement;
|
|
34
|
-
localizationService;
|
|
35
|
-
injector;
|
|
36
|
-
changeDetector;
|
|
37
|
-
ngZone;
|
|
38
|
-
/**
|
|
39
|
-
* @hidden
|
|
40
|
-
*/
|
|
41
|
-
get focusableId() {
|
|
42
|
-
if (this.hostElement.nativeElement.hasAttribute('id')) {
|
|
43
|
-
return this.hostElement.nativeElement.getAttribute('id');
|
|
44
|
-
}
|
|
45
|
-
return `k-${guid()}`;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Set the **On** label.
|
|
49
|
-
* This label takes precedence over the [custom messages component]({% slug api_inputs_switchcustommessagescomponent %}).
|
|
50
|
-
* [See example]({% slug labels_switch %}).
|
|
51
|
-
*/
|
|
52
|
-
onLabel;
|
|
53
|
-
/**
|
|
54
|
-
* Set the **Off** label.
|
|
55
|
-
* This label takes precedence over the [custom messages component]({% slug api_inputs_switchcustommessagescomponent %}).
|
|
56
|
-
* [See example]({% slug labels_switch %}).
|
|
57
|
-
*/
|
|
58
|
-
offLabel;
|
|
59
|
-
/**
|
|
60
|
-
* Sets the value of the Switch when it first appears.
|
|
61
|
-
*/
|
|
62
|
-
set checked(value) {
|
|
63
|
-
this.setHostClasses(value);
|
|
64
|
-
this._checked = value;
|
|
65
|
-
}
|
|
66
|
-
get checked() {
|
|
67
|
-
return this._checked;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* When `true`, disables the Switch.
|
|
71
|
-
* [See example]({% slug disabled_switch %}).
|
|
72
|
-
* To disable the component in reactive forms, see [Forms Support](slug:formssupport_switch#toc-managing-the-switch-disabled-state-in-reactive-forms).
|
|
73
|
-
* @default false
|
|
74
|
-
*/
|
|
75
|
-
disabled = false;
|
|
76
|
-
/**
|
|
77
|
-
* When `true`, sets the Switch to read-only.
|
|
78
|
-
* [See example]({% slug readonly_switch %}).
|
|
79
|
-
* @default false
|
|
80
|
-
*/
|
|
81
|
-
readonly = false;
|
|
82
|
-
/**
|
|
83
|
-
* Set the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the Switch.
|
|
84
|
-
* @default 0
|
|
85
|
-
*/
|
|
86
|
-
tabindex = 0;
|
|
87
|
-
/**
|
|
88
|
-
* Sets the size of the Switch.
|
|
89
|
-
*
|
|
90
|
-
* @default "medium"
|
|
91
|
-
*/
|
|
92
|
-
set size(size) {
|
|
93
|
-
const newSize = size || DEFAULT_SIZE;
|
|
94
|
-
this.handleClasses(newSize, 'size');
|
|
95
|
-
this._size = newSize;
|
|
96
|
-
}
|
|
97
|
-
get size() {
|
|
98
|
-
return this._size;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Sets the border radius of the Switch.
|
|
102
|
-
*
|
|
103
|
-
* @default "full"
|
|
104
|
-
*/
|
|
105
|
-
set thumbRounded(thumbRounded) {
|
|
106
|
-
const newThumbRounded = thumbRounded || DEFAULT_THUMB_ROUNDED;
|
|
107
|
-
this.handleThumbClasses(newThumbRounded);
|
|
108
|
-
this._thumbRounded = newThumbRounded;
|
|
109
|
-
}
|
|
110
|
-
get thumbRounded() {
|
|
111
|
-
return this._thumbRounded;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Sets the border radius of the Switch track.
|
|
115
|
-
*
|
|
116
|
-
* @default "full"
|
|
117
|
-
*/
|
|
118
|
-
set trackRounded(trackRounded) {
|
|
119
|
-
const newTrackRounded = trackRounded || DEFAULT_TRACK_ROUNDED;
|
|
120
|
-
this.handleTrackClasses(newTrackRounded);
|
|
121
|
-
this._trackRounded = newTrackRounded;
|
|
122
|
-
}
|
|
123
|
-
get trackRounded() {
|
|
124
|
-
return this._trackRounded;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @hidden
|
|
128
|
-
*/
|
|
129
|
-
set tabIndex(tabIndex) {
|
|
130
|
-
this.tabindex = tabIndex;
|
|
131
|
-
}
|
|
132
|
-
get tabIndex() {
|
|
133
|
-
return this.tabindex;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Fires when the user focuses the Switch.
|
|
137
|
-
*/
|
|
138
|
-
onFocus = new EventEmitter();
|
|
139
|
-
/**
|
|
140
|
-
* Fires when the user blurs the Switch.
|
|
141
|
-
*/
|
|
142
|
-
onBlur = new EventEmitter();
|
|
143
|
-
/**
|
|
144
|
-
* Fires when the value of the Switch changes.
|
|
145
|
-
*/
|
|
146
|
-
valueChange = new EventEmitter();
|
|
147
|
-
direction;
|
|
148
|
-
hostRole = 'switch';
|
|
149
|
-
get hostId() {
|
|
150
|
-
return this.focusableId;
|
|
151
|
-
}
|
|
152
|
-
get ariaChecked() {
|
|
153
|
-
return this.checked;
|
|
154
|
-
}
|
|
155
|
-
get ariaInvalid() {
|
|
156
|
-
return this.isControlInvalid ? true : undefined;
|
|
157
|
-
}
|
|
158
|
-
get hostTabIndex() {
|
|
159
|
-
return this.disabled ? undefined : this.tabIndex;
|
|
160
|
-
}
|
|
161
|
-
get ariaDisabled() {
|
|
162
|
-
return this.disabled ? true : undefined;
|
|
163
|
-
}
|
|
164
|
-
get ariaReadonly() {
|
|
165
|
-
return this.readonly;
|
|
166
|
-
}
|
|
167
|
-
hostClasses = true;
|
|
168
|
-
get disabledClass() {
|
|
169
|
-
return this.disabled;
|
|
170
|
-
}
|
|
171
|
-
track;
|
|
172
|
-
thumb;
|
|
173
|
-
/**
|
|
174
|
-
* @hidden
|
|
175
|
-
*/
|
|
176
|
-
initialized = false;
|
|
177
|
-
localizationChangeSubscription;
|
|
178
|
-
isFocused;
|
|
179
|
-
control;
|
|
180
|
-
domSubscriptions = [];
|
|
181
|
-
_checked = false;
|
|
182
|
-
_size = 'medium';
|
|
183
|
-
_trackRounded = 'full';
|
|
184
|
-
_thumbRounded = 'full';
|
|
185
|
-
constructor(renderer, hostElement, localizationService, injector, changeDetector, ngZone) {
|
|
186
|
-
this.renderer = renderer;
|
|
187
|
-
this.hostElement = hostElement;
|
|
188
|
-
this.localizationService = localizationService;
|
|
189
|
-
this.injector = injector;
|
|
190
|
-
this.changeDetector = changeDetector;
|
|
191
|
-
this.ngZone = ngZone;
|
|
192
|
-
validatePackage(packageMetadata);
|
|
193
|
-
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
|
194
|
-
this.keyDownHandler = this.keyDownHandler.bind(this);
|
|
195
|
-
this.clickHandler = this.clickHandler.bind(this);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* @hidden
|
|
199
|
-
*/
|
|
200
|
-
get onLabelMessage() {
|
|
201
|
-
return this.onLabel !== undefined ? this.onLabel : this.localizationService.get('on');
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* @hidden
|
|
205
|
-
*/
|
|
206
|
-
get offLabelMessage() {
|
|
207
|
-
return this.offLabel !== undefined ? this.offLabel : this.localizationService.get('off');
|
|
208
|
-
}
|
|
209
|
-
ngChange = (_) => { };
|
|
210
|
-
ngTouched = () => { };
|
|
211
|
-
get isEnabled() {
|
|
212
|
-
return !this.disabled && !this.readonly;
|
|
213
|
-
}
|
|
214
|
-
ngOnInit() {
|
|
215
|
-
if (this.hostElement) {
|
|
216
|
-
const wrapper = this.hostElement.nativeElement;
|
|
217
|
-
this.renderer.removeAttribute(wrapper, "tabindex");
|
|
218
|
-
}
|
|
219
|
-
this.localizationChangeSubscription = this.localizationService
|
|
220
|
-
.changes
|
|
221
|
-
.pipe(skip(1))
|
|
222
|
-
.subscribe(({ rtl }) => {
|
|
223
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
224
|
-
});
|
|
225
|
-
this.control = this.injector.get(NgControl, null);
|
|
226
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => this.initialized = true);
|
|
227
|
-
}
|
|
228
|
-
ngAfterViewInit() {
|
|
229
|
-
const wrapper = this.hostElement.nativeElement;
|
|
230
|
-
if (!this.checked && !wrapper.classList.contains('k-switch-off')) {
|
|
231
|
-
this.renderer.addClass(wrapper, 'k-switch-off');
|
|
232
|
-
}
|
|
233
|
-
this.handleClasses(this.size, 'size');
|
|
234
|
-
this.handleTrackClasses(this.trackRounded);
|
|
235
|
-
this.handleThumbClasses(this.thumbRounded);
|
|
236
|
-
this.attachHostHandlers();
|
|
237
|
-
}
|
|
238
|
-
ngOnDestroy() {
|
|
239
|
-
if (this.localizationChangeSubscription) {
|
|
240
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
241
|
-
}
|
|
242
|
-
this.domSubscriptions.forEach(subscription => subscription());
|
|
243
|
-
const wrapper = this.hostElement.nativeElement;
|
|
244
|
-
wrapper.removeEventListener('focus', this.handleFocus, true);
|
|
245
|
-
wrapper.removeEventListener('blur', this.handleBlur, true);
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Focuses the Switch.
|
|
249
|
-
*
|
|
250
|
-
*/
|
|
251
|
-
focus() {
|
|
252
|
-
if (!this.hostElement) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
this.hostElement.nativeElement.focus();
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Blurs the Switch.
|
|
259
|
-
*/
|
|
260
|
-
blur() {
|
|
261
|
-
if (!this.hostElement) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
this.hostElement.nativeElement.blur();
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* @hidden
|
|
268
|
-
* Called when the status of the component changes to or from `disabled`.
|
|
269
|
-
* Depending on the value, it enables or disables the appropriate DOM element.
|
|
270
|
-
*/
|
|
271
|
-
setDisabledState(isDisabled) {
|
|
272
|
-
this.disabled = isDisabled;
|
|
273
|
-
this.changeDetector.markForCheck();
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* @hidden
|
|
277
|
-
*/
|
|
278
|
-
handleFocus = (event) => {
|
|
279
|
-
if (this.isFocused) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
event.stopImmediatePropagation();
|
|
283
|
-
this.focused = true;
|
|
284
|
-
if (hasObservers(this.onFocus)) {
|
|
285
|
-
this.ngZone.run(() => {
|
|
286
|
-
const eventArgs = { originalEvent: event };
|
|
287
|
-
this.onFocus.emit(eventArgs);
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
/**
|
|
292
|
-
* @hidden
|
|
293
|
-
*/
|
|
294
|
-
handleBlur = (event) => {
|
|
295
|
-
const relatedTarget = event && event.relatedTarget;
|
|
296
|
-
if (this.hostElement.nativeElement.contains(relatedTarget)) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
event.stopImmediatePropagation();
|
|
300
|
-
this.changeDetector.markForCheck();
|
|
301
|
-
this.focused = false;
|
|
302
|
-
if (hasObservers(this.onBlur) || requiresZoneOnBlur(this.control)) {
|
|
303
|
-
this.ngZone.run(() => {
|
|
304
|
-
this.ngTouched();
|
|
305
|
-
const eventArgs = { originalEvent: event };
|
|
306
|
-
this.onBlur.emit(eventArgs);
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
/**
|
|
311
|
-
* @hidden
|
|
312
|
-
*/
|
|
313
|
-
get isControlInvalid() {
|
|
314
|
-
return this.control && this.control.touched && !this.control.valid;
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* @hidden
|
|
318
|
-
*/
|
|
319
|
-
writeValue(value) {
|
|
320
|
-
this.checked = value === null ? false : value;
|
|
321
|
-
this.changeDetector.markForCheck();
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* @hidden
|
|
325
|
-
*/
|
|
326
|
-
registerOnChange(fn) {
|
|
327
|
-
this.ngChange = fn;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* @hidden
|
|
331
|
-
*/
|
|
332
|
-
registerOnTouched(fn) {
|
|
333
|
-
this.ngTouched = fn;
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* @hidden
|
|
337
|
-
*/
|
|
338
|
-
keyDownHandler(e) {
|
|
339
|
-
const keyCode = e.code;
|
|
340
|
-
if (this.isEnabled && (keyCode === Keys.Space || keyCode === Keys.Enter || keyCode === Keys.NumpadEnter)) {
|
|
341
|
-
this.changeValue(!this.checked);
|
|
342
|
-
e.preventDefault();
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* @hidden
|
|
347
|
-
*/
|
|
348
|
-
clickHandler() {
|
|
349
|
-
if (this.isEnabled) {
|
|
350
|
-
this.changeValue(!this.checked);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* @hidden
|
|
355
|
-
* Used by the FloatingLabel to determine if the component is empty.
|
|
356
|
-
*/
|
|
357
|
-
isEmpty() {
|
|
358
|
-
return false;
|
|
359
|
-
}
|
|
360
|
-
changeValue(value) {
|
|
361
|
-
if (this.checked !== value) {
|
|
362
|
-
this.ngZone.run(() => {
|
|
363
|
-
this.checked = value;
|
|
364
|
-
this.ngChange(value);
|
|
365
|
-
this.valueChange.emit(value);
|
|
366
|
-
this.changeDetector.markForCheck();
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
set focused(value) {
|
|
371
|
-
if (this.isFocused !== value && this.hostElement) {
|
|
372
|
-
const wrapper = this.hostElement.nativeElement;
|
|
373
|
-
if (value) {
|
|
374
|
-
this.renderer.addClass(wrapper, FOCUSED);
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
this.renderer.removeClass(wrapper, FOCUSED);
|
|
378
|
-
}
|
|
379
|
-
this.isFocused = value;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
attachHostHandlers() {
|
|
383
|
-
this.ngZone.runOutsideAngular(() => {
|
|
384
|
-
const wrapper = this.hostElement.nativeElement;
|
|
385
|
-
this.domSubscriptions.push(this.renderer.listen(wrapper, 'click', this.clickHandler), this.renderer.listen(wrapper, 'keydown', this.keyDownHandler));
|
|
386
|
-
wrapper.addEventListener('focus', this.handleFocus, true);
|
|
387
|
-
wrapper.addEventListener('blur', this.handleBlur, true);
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
setHostClasses(value) {
|
|
391
|
-
const wrapper = this.hostElement.nativeElement;
|
|
392
|
-
if (value) {
|
|
393
|
-
this.renderer.removeClass(wrapper, 'k-switch-off');
|
|
394
|
-
this.renderer.addClass(wrapper, 'k-switch-on');
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
this.renderer.removeClass(wrapper, 'k-switch-on');
|
|
398
|
-
this.renderer.addClass(wrapper, 'k-switch-off');
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
handleClasses(value, input) {
|
|
402
|
-
const elem = this.hostElement.nativeElement;
|
|
403
|
-
const classes = getStylingClasses('switch', input, this[input], value);
|
|
404
|
-
if (classes.toRemove) {
|
|
405
|
-
this.renderer.removeClass(elem, classes.toRemove);
|
|
406
|
-
}
|
|
407
|
-
if (classes.toAdd) {
|
|
408
|
-
this.renderer.addClass(elem, classes.toAdd);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
handleTrackClasses(value) {
|
|
412
|
-
const track = this.track?.nativeElement;
|
|
413
|
-
if (!track) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const classes = getStylingClasses('switch', 'rounded', this.trackRounded, value);
|
|
417
|
-
if (classes.toRemove) {
|
|
418
|
-
this.renderer.removeClass(track, classes.toRemove);
|
|
419
|
-
}
|
|
420
|
-
if (classes.toAdd) {
|
|
421
|
-
this.renderer.addClass(track, classes.toAdd);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
handleThumbClasses(value) {
|
|
425
|
-
const thumb = this.thumb?.nativeElement;
|
|
426
|
-
if (!thumb) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
const classes = getStylingClasses('switch', 'rounded', this.thumbRounded, value);
|
|
430
|
-
if (classes.toRemove) {
|
|
431
|
-
this.renderer.removeClass(thumb, classes.toRemove);
|
|
432
|
-
}
|
|
433
|
-
if (classes.toAdd) {
|
|
434
|
-
this.renderer.addClass(thumb, classes.toAdd);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1.LocalizationService }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
438
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: SwitchComponent, isStandalone: true, selector: "kendo-switch", inputs: { focusableId: "focusableId", onLabel: "onLabel", offLabel: "offLabel", checked: "checked", disabled: "disabled", readonly: "readonly", tabindex: "tabindex", size: "size", thumbRounded: "thumbRounded", trackRounded: "trackRounded", tabIndex: "tabIndex" }, outputs: { onFocus: "focus", onBlur: "blur", valueChange: "valueChange" }, host: { properties: { "class.k-readonly": "this.readonly", "attr.dir": "this.direction", "attr.role": "this.hostRole", "attr.id": "this.hostId", "attr.aria-checked": "this.ariaChecked", "attr.aria-invalid": "this.ariaInvalid", "attr.tabindex": "this.hostTabIndex", "attr.aria-disabled": "this.ariaDisabled", "attr.aria-readonly": "this.ariaReadonly", "class.k-switch": "this.hostClasses", "class.k-disabled": "this.disabledClass" } }, providers: [
|
|
439
|
-
LocalizationService,
|
|
440
|
-
{ provide: L10N_PREFIX, useValue: 'kendo.switch' },
|
|
441
|
-
{
|
|
442
|
-
multi: true,
|
|
443
|
-
provide: NG_VALUE_ACCESSOR,
|
|
444
|
-
useExisting: forwardRef(() => SwitchComponent) /* eslint-disable-line*/
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
provide: KendoInput,
|
|
448
|
-
useExisting: forwardRef(() => SwitchComponent)
|
|
449
|
-
}
|
|
450
|
-
], viewQueries: [{ propertyName: "track", first: true, predicate: ["track"], descendants: true, static: true }, { propertyName: "thumb", first: true, predicate: ["thumb"], descendants: true, static: true }], exportAs: ["kendoSwitch"], ngImport: i0, template: `
|
|
451
|
-
<ng-container kendoSwitchLocalizedMessages
|
|
452
|
-
i18n-on="kendo.switch.on|The **On** label of the Switch."
|
|
453
|
-
on="ON"
|
|
454
|
-
i18n-off="kendo.switch.off|The **Off** label of the Switch."
|
|
455
|
-
off="OFF"
|
|
456
|
-
>
|
|
457
|
-
|
|
458
|
-
<span
|
|
459
|
-
#track
|
|
460
|
-
class="k-switch-track"
|
|
461
|
-
[style.transitionDuration]="initialized ? '200ms' : '0ms'"
|
|
462
|
-
>
|
|
463
|
-
<span class="k-switch-label-on" [attr.aria-hidden]="true" >{{onLabelMessage}}</span>
|
|
464
|
-
<span class="k-switch-label-off" [attr.aria-hidden]="true">{{offLabelMessage}}</span>
|
|
465
|
-
</span>
|
|
466
|
-
<span
|
|
467
|
-
class="k-switch-thumb-wrap"
|
|
468
|
-
[style.transitionDuration]="initialized ? '200ms' : '0ms'">
|
|
469
|
-
<span #thumb class="k-switch-thumb"></span>
|
|
470
|
-
</span>
|
|
471
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedSwitchMessagesDirective, selector: "[kendoSwitchLocalizedMessages]" }] });
|
|
472
|
-
}
|
|
473
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchComponent, decorators: [{
|
|
474
|
-
type: Component,
|
|
475
|
-
args: [{
|
|
476
|
-
exportAs: 'kendoSwitch',
|
|
477
|
-
providers: [
|
|
478
|
-
LocalizationService,
|
|
479
|
-
{ provide: L10N_PREFIX, useValue: 'kendo.switch' },
|
|
480
|
-
{
|
|
481
|
-
multi: true,
|
|
482
|
-
provide: NG_VALUE_ACCESSOR,
|
|
483
|
-
useExisting: forwardRef(() => SwitchComponent) /* eslint-disable-line*/
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
provide: KendoInput,
|
|
487
|
-
useExisting: forwardRef(() => SwitchComponent)
|
|
488
|
-
}
|
|
489
|
-
],
|
|
490
|
-
selector: 'kendo-switch',
|
|
491
|
-
template: `
|
|
492
|
-
<ng-container kendoSwitchLocalizedMessages
|
|
493
|
-
i18n-on="kendo.switch.on|The **On** label of the Switch."
|
|
494
|
-
on="ON"
|
|
495
|
-
i18n-off="kendo.switch.off|The **Off** label of the Switch."
|
|
496
|
-
off="OFF"
|
|
497
|
-
>
|
|
498
|
-
|
|
499
|
-
<span
|
|
500
|
-
#track
|
|
501
|
-
class="k-switch-track"
|
|
502
|
-
[style.transitionDuration]="initialized ? '200ms' : '0ms'"
|
|
503
|
-
>
|
|
504
|
-
<span class="k-switch-label-on" [attr.aria-hidden]="true" >{{onLabelMessage}}</span>
|
|
505
|
-
<span class="k-switch-label-off" [attr.aria-hidden]="true">{{offLabelMessage}}</span>
|
|
506
|
-
</span>
|
|
507
|
-
<span
|
|
508
|
-
class="k-switch-thumb-wrap"
|
|
509
|
-
[style.transitionDuration]="initialized ? '200ms' : '0ms'">
|
|
510
|
-
<span #thumb class="k-switch-thumb"></span>
|
|
511
|
-
</span>
|
|
512
|
-
`,
|
|
513
|
-
standalone: true,
|
|
514
|
-
imports: [LocalizedSwitchMessagesDirective]
|
|
515
|
-
}]
|
|
516
|
-
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1.LocalizationService }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }], propDecorators: { focusableId: [{
|
|
517
|
-
type: Input
|
|
518
|
-
}], onLabel: [{
|
|
519
|
-
type: Input
|
|
520
|
-
}], offLabel: [{
|
|
521
|
-
type: Input
|
|
522
|
-
}], checked: [{
|
|
523
|
-
type: Input
|
|
524
|
-
}], disabled: [{
|
|
525
|
-
type: Input
|
|
526
|
-
}], readonly: [{
|
|
527
|
-
type: Input
|
|
528
|
-
}, {
|
|
529
|
-
type: HostBinding,
|
|
530
|
-
args: ['class.k-readonly']
|
|
531
|
-
}], tabindex: [{
|
|
532
|
-
type: Input
|
|
533
|
-
}], size: [{
|
|
534
|
-
type: Input
|
|
535
|
-
}], thumbRounded: [{
|
|
536
|
-
type: Input
|
|
537
|
-
}], trackRounded: [{
|
|
538
|
-
type: Input
|
|
539
|
-
}], tabIndex: [{
|
|
540
|
-
type: Input
|
|
541
|
-
}], onFocus: [{
|
|
542
|
-
type: Output,
|
|
543
|
-
args: ['focus']
|
|
544
|
-
}], onBlur: [{
|
|
545
|
-
type: Output,
|
|
546
|
-
args: ['blur']
|
|
547
|
-
}], valueChange: [{
|
|
548
|
-
type: Output
|
|
549
|
-
}], direction: [{
|
|
550
|
-
type: HostBinding,
|
|
551
|
-
args: ['attr.dir']
|
|
552
|
-
}], hostRole: [{
|
|
553
|
-
type: HostBinding,
|
|
554
|
-
args: ['attr.role']
|
|
555
|
-
}], hostId: [{
|
|
556
|
-
type: HostBinding,
|
|
557
|
-
args: ['attr.id']
|
|
558
|
-
}], ariaChecked: [{
|
|
559
|
-
type: HostBinding,
|
|
560
|
-
args: ['attr.aria-checked']
|
|
561
|
-
}], ariaInvalid: [{
|
|
562
|
-
type: HostBinding,
|
|
563
|
-
args: ['attr.aria-invalid']
|
|
564
|
-
}], hostTabIndex: [{
|
|
565
|
-
type: HostBinding,
|
|
566
|
-
args: ['attr.tabindex']
|
|
567
|
-
}], ariaDisabled: [{
|
|
568
|
-
type: HostBinding,
|
|
569
|
-
args: ['attr.aria-disabled']
|
|
570
|
-
}], ariaReadonly: [{
|
|
571
|
-
type: HostBinding,
|
|
572
|
-
args: ['attr.aria-readonly']
|
|
573
|
-
}], hostClasses: [{
|
|
574
|
-
type: HostBinding,
|
|
575
|
-
args: ['class.k-switch']
|
|
576
|
-
}], disabledClass: [{
|
|
577
|
-
type: HostBinding,
|
|
578
|
-
args: ['class.k-disabled']
|
|
579
|
-
}], track: [{
|
|
580
|
-
type: ViewChild,
|
|
581
|
-
args: ['track', { static: true }]
|
|
582
|
-
}], thumb: [{
|
|
583
|
-
type: ViewChild,
|
|
584
|
-
args: ['thumb', { static: true }]
|
|
585
|
-
}] } });
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { NgModule } from '@angular/core';
|
|
6
|
-
import { KENDO_SWITCH } from './directives';
|
|
7
|
-
import { ResizeBatchService } from '@progress/kendo-angular-common';
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
import * as i1 from "./switch/switch.component";
|
|
10
|
-
import * as i2 from "./switch/localization/custom-messages.component";
|
|
11
|
-
//IMPORTANT: NgModule export kept for backwards compatibility
|
|
12
|
-
/**
|
|
13
|
-
* Defines the [`NgModule`](link:site.data.urls.angular['ngmoduleapi']) for the Switch component.
|
|
14
|
-
*
|
|
15
|
-
* Use this module to add the Switch component to your NgModule-based Angular application.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { SwitchModule } from '@progress/kendo-angular-inputs';
|
|
21
|
-
* import { NgModule } from '@angular/core';
|
|
22
|
-
* import { AppComponent } from './app.component';
|
|
23
|
-
*
|
|
24
|
-
* @NgModule({
|
|
25
|
-
* declarations: [AppComponent],
|
|
26
|
-
* imports: [BrowserModule, SwitchModule],
|
|
27
|
-
* bootstrap: [AppComponent]
|
|
28
|
-
* })
|
|
29
|
-
* export class AppModule {}
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export class SwitchModule {
|
|
33
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
34
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule, imports: [i1.SwitchComponent, i2.SwitchCustomMessagesComponent], exports: [i1.SwitchComponent, i2.SwitchCustomMessagesComponent] });
|
|
35
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule, providers: [ResizeBatchService] });
|
|
36
|
-
}
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule, decorators: [{
|
|
38
|
-
type: NgModule,
|
|
39
|
-
args: [{
|
|
40
|
-
imports: [...KENDO_SWITCH],
|
|
41
|
-
exports: [...KENDO_SWITCH],
|
|
42
|
-
providers: [ResizeBatchService]
|
|
43
|
-
}]
|
|
44
|
-
}] });
|