@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.
Files changed (189) hide show
  1. package/colorpicker/localization/messages.d.ts +1 -1
  2. package/common/radio-checkbox.base.d.ts +1 -1
  3. package/fesm2022/progress-kendo-angular-inputs.mjs +321 -321
  4. package/numerictextbox/localization/messages.d.ts +1 -1
  5. package/otpinput/localization/messages.d.ts +1 -1
  6. package/package.json +17 -25
  7. package/rangeslider/localization/messages.d.ts +1 -1
  8. package/signature/localization/messages.d.ts +1 -1
  9. package/slider/localization/messages.d.ts +1 -1
  10. package/sliders-common/slider-base.d.ts +1 -1
  11. package/switch/localization/messages.d.ts +1 -1
  12. package/text-fields-common/text-fields-base.d.ts +1 -1
  13. package/textbox/localization/messages.d.ts +1 -1
  14. package/esm2022/checkbox/checkbox.component.mjs +0 -227
  15. package/esm2022/checkbox/checkbox.directive.mjs +0 -96
  16. package/esm2022/checkbox/checked-state.mjs +0 -5
  17. package/esm2022/checkbox.module.mjs +0 -42
  18. package/esm2022/colorpicker/adaptiveness/adaptive-close-button.component.mjs +0 -62
  19. package/esm2022/colorpicker/adaptiveness/adaptive-renderer.component.mjs +0 -219
  20. package/esm2022/colorpicker/color-contrast-svg.component.mjs +0 -108
  21. package/esm2022/colorpicker/color-gradient-numeric-label.directive.mjs +0 -37
  22. package/esm2022/colorpicker/color-gradient-text-label.directive.mjs +0 -34
  23. package/esm2022/colorpicker/color-gradient.component.mjs +0 -1110
  24. package/esm2022/colorpicker/color-input.component.mjs +0 -498
  25. package/esm2022/colorpicker/color-palette.component.mjs +0 -629
  26. package/esm2022/colorpicker/colorpicker.component.mjs +0 -1315
  27. package/esm2022/colorpicker/constants.mjs +0 -40
  28. package/esm2022/colorpicker/contrast-validation.component.mjs +0 -83
  29. package/esm2022/colorpicker/contrast.component.mjs +0 -114
  30. package/esm2022/colorpicker/events/active-color-click-event.mjs +0 -55
  31. package/esm2022/colorpicker/events/cancel-event.mjs +0 -18
  32. package/esm2022/colorpicker/events/close-event.mjs +0 -10
  33. package/esm2022/colorpicker/events/kendo-drag-event.mjs +0 -5
  34. package/esm2022/colorpicker/events/open-event.mjs +0 -10
  35. package/esm2022/colorpicker/events.mjs +0 -8
  36. package/esm2022/colorpicker/flatcolorpicker-actions.component.mjs +0 -112
  37. package/esm2022/colorpicker/flatcolorpicker-header.component.mjs +0 -244
  38. package/esm2022/colorpicker/flatcolorpicker.component.mjs +0 -942
  39. package/esm2022/colorpicker/localization/colorgradient-localization.service.mjs +0 -46
  40. package/esm2022/colorpicker/localization/colorpalette-localization.service.mjs +0 -46
  41. package/esm2022/colorpicker/localization/colorpicker-localization.service.mjs +0 -31
  42. package/esm2022/colorpicker/localization/custom-messages.component.mjs +0 -51
  43. package/esm2022/colorpicker/localization/flatcolorpicker-localization.service.mjs +0 -46
  44. package/esm2022/colorpicker/localization/localized-colorpicker-messages.directive.mjs +0 -39
  45. package/esm2022/colorpicker/localization/messages.mjs +0 -201
  46. package/esm2022/colorpicker/models/actions-layout.mjs +0 -5
  47. package/esm2022/colorpicker/models/adaptive-mode.mjs +0 -8
  48. package/esm2022/colorpicker/models/colorpicker-view.mjs +0 -5
  49. package/esm2022/colorpicker/models/gradient-settings.mjs +0 -5
  50. package/esm2022/colorpicker/models/hsva.mjs +0 -5
  51. package/esm2022/colorpicker/models/output-format.mjs +0 -5
  52. package/esm2022/colorpicker/models/palette-presets.mjs +0 -62
  53. package/esm2022/colorpicker/models/palette-settings.mjs +0 -5
  54. package/esm2022/colorpicker/models/popup-settings.mjs +0 -5
  55. package/esm2022/colorpicker/models/rgb.mjs +0 -5
  56. package/esm2022/colorpicker/models/rgba.mjs +0 -5
  57. package/esm2022/colorpicker/models/table-cell.mjs +0 -5
  58. package/esm2022/colorpicker/models/tile-size.mjs +0 -5
  59. package/esm2022/colorpicker/models.mjs +0 -16
  60. package/esm2022/colorpicker/services/color-palette.service.mjs +0 -65
  61. package/esm2022/colorpicker/services/flatcolorpicker.service.mjs +0 -39
  62. package/esm2022/colorpicker/utils/color-parser.mjs +0 -164
  63. package/esm2022/colorpicker/utils/contrast-curve.mjs +0 -85
  64. package/esm2022/colorpicker/utils.mjs +0 -6
  65. package/esm2022/colorpicker.module.mjs +0 -50
  66. package/esm2022/common/dom-utils.mjs +0 -36
  67. package/esm2022/common/formservice.service.mjs +0 -21
  68. package/esm2022/common/math.mjs +0 -65
  69. package/esm2022/common/models/fillmode.mjs +0 -5
  70. package/esm2022/common/models/gutters.mjs +0 -5
  71. package/esm2022/common/models/responsive-breakpoints.mjs +0 -5
  72. package/esm2022/common/models/rounded.mjs +0 -5
  73. package/esm2022/common/models/size.mjs +0 -5
  74. package/esm2022/common/models/styling-classes.mjs +0 -5
  75. package/esm2022/common/models/type.mjs +0 -5
  76. package/esm2022/common/models.mjs +0 -9
  77. package/esm2022/common/radio-checkbox.base.mjs +0 -295
  78. package/esm2022/common/utils.mjs +0 -88
  79. package/esm2022/directives.mjs +0 -430
  80. package/esm2022/form/form.component.mjs +0 -163
  81. package/esm2022/form/formseparator.component.mjs +0 -80
  82. package/esm2022/form/utils.mjs +0 -147
  83. package/esm2022/form.module.mjs +0 -46
  84. package/esm2022/formfield/error.component.mjs +0 -70
  85. package/esm2022/formfield/formfield.component.mjs +0 -353
  86. package/esm2022/formfield/hint.component.mjs +0 -65
  87. package/esm2022/formfield/models/message-align.mjs +0 -5
  88. package/esm2022/formfield/models/orientation.mjs +0 -5
  89. package/esm2022/formfield/models/show-options.mjs +0 -5
  90. package/esm2022/formfield.module.mjs +0 -43
  91. package/esm2022/formfieldset/formfieldset.component.mjs +0 -174
  92. package/esm2022/index.mjs +0 -91
  93. package/esm2022/inputs.module.mjs +0 -91
  94. package/esm2022/maskedtextbox/maskedtextbox.component.mjs +0 -876
  95. package/esm2022/maskedtextbox/masking.service.mjs +0 -189
  96. package/esm2022/maskedtextbox/parsing/combinators.mjs +0 -28
  97. package/esm2022/maskedtextbox/parsing/parsers.mjs +0 -148
  98. package/esm2022/maskedtextbox/parsing/result.mjs +0 -44
  99. package/esm2022/maskedtextbox/parsing/stream.mjs +0 -43
  100. package/esm2022/maskedtextbox.module.mjs +0 -43
  101. package/esm2022/numerictextbox/arrow-direction.mjs +0 -13
  102. package/esm2022/numerictextbox/constants.mjs +0 -28
  103. package/esm2022/numerictextbox/localization/custom-messages.component.mjs +0 -55
  104. package/esm2022/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +0 -39
  105. package/esm2022/numerictextbox/localization/messages.mjs +0 -33
  106. package/esm2022/numerictextbox/numerictextbox.component.mjs +0 -1314
  107. package/esm2022/numerictextbox/utils.mjs +0 -92
  108. package/esm2022/numerictextbox.module.mjs +0 -46
  109. package/esm2022/otp.module.mjs +0 -44
  110. package/esm2022/otpinput/localization/custom-messages.component.mjs +0 -45
  111. package/esm2022/otpinput/localization/localized-textbox-messages.directive.mjs +0 -39
  112. package/esm2022/otpinput/localization/messages.mjs +0 -34
  113. package/esm2022/otpinput/models/otpinput-type.mjs +0 -5
  114. package/esm2022/otpinput/models/separator-icon.mjs +0 -5
  115. package/esm2022/otpinput/otpinput-separator.component.mjs +0 -93
  116. package/esm2022/otpinput/otpinput.component.mjs +0 -936
  117. package/esm2022/package-metadata.mjs +0 -16
  118. package/esm2022/progress-kendo-angular-inputs.mjs +0 -8
  119. package/esm2022/radiobutton/radiobutton.component.mjs +0 -212
  120. package/esm2022/radiobutton/radiobutton.directive.mjs +0 -81
  121. package/esm2022/radiobutton.module.mjs +0 -43
  122. package/esm2022/rangeslider/localization/custom-messages.component.mjs +0 -53
  123. package/esm2022/rangeslider/localization/localized-rangeslider-messages.directive.mjs +0 -39
  124. package/esm2022/rangeslider/localization/messages.mjs +0 -33
  125. package/esm2022/rangeslider/rangeslider-model.mjs +0 -53
  126. package/esm2022/rangeslider/rangeslider-value.type.mjs +0 -5
  127. package/esm2022/rangeslider/rangeslider.component.mjs +0 -625
  128. package/esm2022/rangeslider.module.mjs +0 -46
  129. package/esm2022/rating/directives/rating-hovered-item.directive.mjs +0 -35
  130. package/esm2022/rating/directives/rating-item.directive.mjs +0 -34
  131. package/esm2022/rating/directives/rating-selected-item.directive.mjs +0 -36
  132. package/esm2022/rating/models/precision.mjs +0 -5
  133. package/esm2022/rating/models/rating-item.interface.mjs +0 -5
  134. package/esm2022/rating/models/selection.mjs +0 -5
  135. package/esm2022/rating/rating.component.mjs +0 -754
  136. package/esm2022/rating.module.mjs +0 -46
  137. package/esm2022/shared/input-separator.component.mjs +0 -55
  138. package/esm2022/shared/input-spacer.component.mjs +0 -56
  139. package/esm2022/shared/shared-events.directive.mjs +0 -102
  140. package/esm2022/shared/utils.mjs +0 -13
  141. package/esm2022/signature/events/close-event.mjs +0 -10
  142. package/esm2022/signature/events/index.mjs +0 -6
  143. package/esm2022/signature/events/open-event.mjs +0 -10
  144. package/esm2022/signature/localization/custom-messages.component.mjs +0 -43
  145. package/esm2022/signature/localization/index.mjs +0 -7
  146. package/esm2022/signature/localization/localized-signature-messages.directive.mjs +0 -39
  147. package/esm2022/signature/localization/messages.mjs +0 -45
  148. package/esm2022/signature/signature.component.mjs +0 -981
  149. package/esm2022/signature.module.mjs +0 -47
  150. package/esm2022/slider/localization/custom-messages.component.mjs +0 -43
  151. package/esm2022/slider/localization/localized-slider-messages.directive.mjs +0 -39
  152. package/esm2022/slider/localization/messages.mjs +0 -39
  153. package/esm2022/slider/slider-model.mjs +0 -32
  154. package/esm2022/slider/slider.component.mjs +0 -671
  155. package/esm2022/slider.module.mjs +0 -48
  156. package/esm2022/sliders-common/label-template.directive.mjs +0 -37
  157. package/esm2022/sliders-common/slider-base.mjs +0 -300
  158. package/esm2022/sliders-common/slider-model.base.mjs +0 -118
  159. package/esm2022/sliders-common/slider-ticks.component.mjs +0 -147
  160. package/esm2022/sliders-common/sliders-util.mjs +0 -206
  161. package/esm2022/sliders-common/title-callback.mjs +0 -5
  162. package/esm2022/switch/events/blur-event.mjs +0 -13
  163. package/esm2022/switch/events/focus-event.mjs +0 -13
  164. package/esm2022/switch/localization/custom-messages.component.mjs +0 -43
  165. package/esm2022/switch/localization/localized-switch-messages.directive.mjs +0 -39
  166. package/esm2022/switch/localization/messages.mjs +0 -33
  167. package/esm2022/switch/switch.component.mjs +0 -585
  168. package/esm2022/switch.module.mjs +0 -44
  169. package/esm2022/text-fields-common/text-fields-base.mjs +0 -150
  170. package/esm2022/textarea/models/adornments-orientation.mjs +0 -5
  171. package/esm2022/textarea/models/flow.mjs +0 -5
  172. package/esm2022/textarea/models/resize.mjs +0 -5
  173. package/esm2022/textarea/models/textarea-settings.mjs +0 -5
  174. package/esm2022/textarea/textarea-prefix.component.mjs +0 -67
  175. package/esm2022/textarea/textarea-suffix.component.mjs +0 -67
  176. package/esm2022/textarea/textarea.component.mjs +0 -740
  177. package/esm2022/textarea/textarea.directive.mjs +0 -288
  178. package/esm2022/textarea.module.mjs +0 -46
  179. package/esm2022/textbox/localization/custom-messages.component.mjs +0 -43
  180. package/esm2022/textbox/localization/localized-textbox-messages.directive.mjs +0 -39
  181. package/esm2022/textbox/localization/messages.mjs +0 -27
  182. package/esm2022/textbox/models/icon-show-options.mjs +0 -5
  183. package/esm2022/textbox/textbox-prefix.directive.mjs +0 -50
  184. package/esm2022/textbox/textbox-suffix.directive.mjs +0 -49
  185. package/esm2022/textbox/textbox.component.mjs +0 -933
  186. package/esm2022/textbox/textbox.directive.mjs +0 -125
  187. package/esm2022/textbox.module.mjs +0 -51
  188. package/esm2022/validators/max.validator.mjs +0 -21
  189. package/esm2022/validators/min.validator.mjs +0 -21
@@ -1,295 +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 { Input, Component, Renderer2, Output, EventEmitter, ViewChild, ElementRef, Injector, ChangeDetectorRef, NgZone, Inject } from '@angular/core';
6
- import { NgControl } from '@angular/forms';
7
- import { guid, hasObservers, isControlRequired, isObjectPresent, isPresent, parseAttributes, removeHTMLAttributes, setHTMLAttributes } from '@progress/kendo-angular-common';
8
- import { COMPONENT_TYPE, getStylingClasses, requiresZoneOnBlur } from './utils';
9
- import * as i0 from "@angular/core";
10
- const FOCUSED = 'k-focus';
11
- const DEFAULT_SIZE = 'medium';
12
- /**
13
- * @hidden
14
- */
15
- export class RadioCheckBoxBase {
16
- componentType;
17
- hostElement;
18
- renderer;
19
- cdr;
20
- ngZone;
21
- injector;
22
- /**
23
- * @hidden
24
- */
25
- focusableId = `k-${guid()}`;
26
- /**
27
- * Sets the `title` attribute of the `input` element of the component.
28
- */
29
- title;
30
- /**
31
- * Sets the `name` attribute for the component.
32
- */
33
- name;
34
- /**
35
- * Sets the disabled state of the component.
36
- *
37
- * @default false
38
- */
39
- disabled = false;
40
- /**
41
- * Specifies the `tabindex` of the component.
42
- *
43
- * @default 0
44
- */
45
- tabindex = 0;
46
- /**
47
- * @hidden
48
- */
49
- set tabIndex(tabIndex) {
50
- this.tabindex = tabIndex;
51
- }
52
- get tabIndex() {
53
- return this.tabindex;
54
- }
55
- /**
56
- * Provides a value for the component.
57
- */
58
- value;
59
- /**
60
- * The size property specifies the width and height of the component.
61
- *
62
- * @default 'medium'
63
- *
64
- */
65
- set size(size) {
66
- const newSize = size ? size : DEFAULT_SIZE;
67
- this.handleClasses(newSize, 'size');
68
- this._size = newSize;
69
- }
70
- get size() {
71
- return this._size;
72
- }
73
- /**
74
- * Sets the HTML attributes of the inner focusable input element. Attributes which are essential for certain component functionalities cannot be changed.
75
- */
76
- set inputAttributes(attributes) {
77
- if (isObjectPresent(this.parsedAttributes)) {
78
- removeHTMLAttributes(this.parsedAttributes, this.renderer, this.input.nativeElement);
79
- }
80
- this._inputAttributes = attributes;
81
- this.parsedAttributes = this.inputAttributes ?
82
- parseAttributes(this.inputAttributes, this.defaultAttributes) :
83
- this.inputAttributes;
84
- this.setInputAttributes();
85
- }
86
- get inputAttributes() {
87
- return this._inputAttributes;
88
- }
89
- ngOnInit() {
90
- this.control = this.injector.get(NgControl, null);
91
- }
92
- /**
93
- * Fires each time the user focuses the component.
94
- *
95
- */
96
- onFocus = new EventEmitter();
97
- /**
98
- * Fires each time the component gets blurred.
99
- *
100
- */
101
- onBlur = new EventEmitter();
102
- /**
103
- * Focuses the component.
104
- */
105
- focus() {
106
- if (!this.input) {
107
- return;
108
- }
109
- this.focusChangedProgrammatically = true;
110
- this.isFocused = true;
111
- this.input.nativeElement.focus();
112
- this.focusChangedProgrammatically = false;
113
- }
114
- /**
115
- * Blurs the component.
116
- */
117
- blur() {
118
- this.focusChangedProgrammatically = true;
119
- const isFocusedElement = this.hostElement.nativeElement.querySelector(':focus');
120
- if (isFocusedElement) {
121
- isFocusedElement.blur();
122
- }
123
- this.isFocused = false;
124
- this.focusChangedProgrammatically = false;
125
- }
126
- /**
127
- * @hidden
128
- */
129
- handleInputBlur = () => {
130
- this.cdr.markForCheck();
131
- if (requiresZoneOnBlur(this.control)) {
132
- this.ngZone.run(() => {
133
- this.ngTouched();
134
- });
135
- }
136
- };
137
- /**
138
- * @hidden
139
- */
140
- handleFocus() {
141
- this.ngZone.run(() => {
142
- if (!this.focusChangedProgrammatically && hasObservers(this.onFocus)) {
143
- this.onFocus.emit();
144
- }
145
- this.isFocused = true;
146
- });
147
- }
148
- /**
149
- * @hidden
150
- */
151
- handleBlur() {
152
- this.ngZone.run(() => {
153
- if (!this.focusChangedProgrammatically) {
154
- this.ngTouched();
155
- this.onBlur.emit();
156
- }
157
- this.isFocused = false;
158
- });
159
- }
160
- /**
161
- * @hidden
162
- */
163
- registerOnChange(fn) {
164
- this.ngChange = fn;
165
- }
166
- /**
167
- * @hidden
168
- */
169
- registerOnTouched(fn) {
170
- this.ngTouched = fn;
171
- }
172
- /**
173
- * @hidden
174
- */
175
- get isControlRequired() {
176
- return isControlRequired(this.control?.control);
177
- }
178
- /**
179
- * @hidden
180
- */
181
- get isControlInvalid() {
182
- return this.control?.touched && this.control?.invalid;
183
- }
184
- /**
185
- * Represents the visible `input` element.
186
- */
187
- input;
188
- /**
189
- * @hidden
190
- */
191
- get isFocused() {
192
- return this._isFocused;
193
- }
194
- /**
195
- * @hidden
196
- */
197
- set isFocused(value) {
198
- if (this._isFocused !== value && this.input) {
199
- const element = this.input.nativeElement;
200
- if (value && !this.disabled) {
201
- this.renderer.addClass(element, FOCUSED);
202
- }
203
- else {
204
- this.renderer.removeClass(element, FOCUSED);
205
- }
206
- this._isFocused = value;
207
- }
208
- }
209
- /**
210
- * @hidden
211
- * Called when the status of the component changes to or from `disabled`.
212
- * Depending on the value, it enables or disables the appropriate DOM element.
213
- *
214
- * @param isDisabled
215
- */
216
- setDisabledState(isDisabled) {
217
- this.cdr.markForCheck();
218
- this.disabled = isDisabled;
219
- }
220
- control;
221
- focusChangedProgrammatically = false;
222
- get defaultAttributes() { return null; }
223
- parsedAttributes = {};
224
- _inputAttributes;
225
- ngChange = (_) => { };
226
- ngTouched = () => { };
227
- _isFocused = false;
228
- _size = DEFAULT_SIZE;
229
- constructor(componentType, hostElement, renderer, cdr, ngZone, injector) {
230
- this.componentType = componentType;
231
- this.hostElement = hostElement;
232
- this.renderer = renderer;
233
- this.cdr = cdr;
234
- this.ngZone = ngZone;
235
- this.injector = injector;
236
- }
237
- /**
238
- * @hidden
239
- */
240
- writeValue(_value) { }
241
- handleClasses(value, input) {
242
- if (!isPresent(this.input)) {
243
- return;
244
- }
245
- const inputElem = this.input.nativeElement;
246
- const classes = getStylingClasses(this.componentType, input, this[input], value);
247
- if (classes.toRemove) {
248
- this.renderer.removeClass(inputElem, classes.toRemove);
249
- }
250
- if (classes.toAdd) {
251
- this.renderer.addClass(inputElem, classes.toAdd);
252
- }
253
- }
254
- setInputAttributes() {
255
- setHTMLAttributes(this.parsedAttributes, this.renderer, this.input.nativeElement, this.ngZone);
256
- }
257
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RadioCheckBoxBase, deps: [{ token: COMPONENT_TYPE }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
258
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: RadioCheckBoxBase, selector: "ng-component", inputs: { focusableId: "focusableId", title: "title", name: "name", disabled: "disabled", tabindex: "tabindex", tabIndex: "tabIndex", value: "value", size: "size", inputAttributes: "inputAttributes" }, outputs: { onFocus: "focus", onBlur: "blur" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
259
- }
260
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RadioCheckBoxBase, decorators: [{
261
- type: Component,
262
- args: [{
263
- template: ''
264
- }]
265
- }], ctorParameters: () => [{ type: undefined, decorators: [{
266
- type: Inject,
267
- args: [COMPONENT_TYPE]
268
- }] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Injector }], propDecorators: { focusableId: [{
269
- type: Input
270
- }], title: [{
271
- type: Input
272
- }], name: [{
273
- type: Input
274
- }], disabled: [{
275
- type: Input
276
- }], tabindex: [{
277
- type: Input
278
- }], tabIndex: [{
279
- type: Input
280
- }], value: [{
281
- type: Input
282
- }], size: [{
283
- type: Input
284
- }], inputAttributes: [{
285
- type: Input
286
- }], onFocus: [{
287
- type: Output,
288
- args: ['focus']
289
- }], onBlur: [{
290
- type: Output,
291
- args: ['blur']
292
- }], input: [{
293
- type: ViewChild,
294
- args: ['input', { static: true }]
295
- }] } });
@@ -1,88 +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 { InjectionToken } from "@angular/core";
6
- /**
7
- * @hidden
8
- *
9
- * Checks if the value is `null` or `undefined`. Falsy values like '', 0, false, NaN, etc. are regarded as present.
10
- */
11
- export const isPresent = (value) => value !== null && value !== undefined;
12
- /**
13
- * @hidden
14
- */
15
- export const areSame = (value1, value2) => value1 === value2 || (value1 === null && value2 === undefined) || (value1 === undefined && value2 === null);
16
- /**
17
- * @hidden
18
- */
19
- export const requiresZoneOnBlur = (ngControl) => ngControl &&
20
- (!ngControl.touched || (ngControl.control && ngControl.control.updateOn === 'blur'));
21
- /**
22
- * @hidden
23
- *
24
- * Fits the contender number into the specified bounds. If the number is NaN or null, the min is returned.
25
- *
26
- * @param contender Represents the number you want to fit into specified bounds.
27
- * @param min The inclusive lower bound number.
28
- * @param max The inclusive upper bound number.
29
- */
30
- export const fitIntoBounds = (contender, min, max) => {
31
- if (!isPresent(contender) || isNaN(contender)) {
32
- return min;
33
- }
34
- return contender <= min ? min : contender >= max ? max : contender;
35
- };
36
- /**
37
- * @hidden
38
- */
39
- export const SIZE_MAP = {
40
- small: 'sm',
41
- medium: 'md',
42
- large: 'lg'
43
- };
44
- /**
45
- * @hidden
46
- */
47
- export const ROUNDED_MAP = {
48
- small: 'sm',
49
- medium: 'md',
50
- large: 'lg',
51
- full: 'full'
52
- };
53
- /**
54
- * @hidden
55
- */
56
- export const isNone = (style) => style === 'none';
57
- /**
58
- * @hidden
59
- *
60
- * Returns the styling classes to be added and removed
61
- */
62
- export const getStylingClasses = (componentType, stylingOption, previousValue, newValue) => {
63
- switch (stylingOption) {
64
- case 'size':
65
- return {
66
- toRemove: `k-${componentType}-${SIZE_MAP[previousValue]}`,
67
- toAdd: newValue !== 'none' ? `k-${componentType}-${SIZE_MAP[newValue]}` : ''
68
- };
69
- case 'rounded':
70
- return {
71
- toRemove: `k-rounded-${ROUNDED_MAP[previousValue]}`,
72
- toAdd: newValue !== 'none' ? `k-rounded-${ROUNDED_MAP[newValue]}` : ''
73
- };
74
- case 'fillMode':
75
- return {
76
- toRemove: `k-${componentType}-${previousValue}`,
77
- toAdd: newValue !== 'none' ? `k-${componentType}-${newValue}` : ''
78
- };
79
- default:
80
- break;
81
- }
82
- };
83
- /**
84
- * @hidden
85
- *
86
- * Used to differentiate between the Radio and CheckBox components in their base class.
87
- */
88
- export const COMPONENT_TYPE = new InjectionToken('TYPE_TOKEN');