@progress/kendo-angular-inputs 8.0.0-dev.202112161434 → 8.0.0-dev.202112211528

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 (104) hide show
  1. package/dist/cdn/js/kendo-angular-inputs.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/checkbox/checkbox.directive.js +79 -3
  4. package/dist/es/colorpicker/color-gradient.component.js +1 -1
  5. package/dist/es/colorpicker/color-input.component.js +1 -1
  6. package/dist/es/colorpicker/colorpicker.component.js +111 -6
  7. package/dist/es/colorpicker/flatcolorpicker-actions.component.js +1 -1
  8. package/dist/es/colorpicker/flatcolorpicker-header.component.js +1 -1
  9. package/dist/es/common/models/fillmode.js +4 -0
  10. package/dist/es/common/models/rounded.js +4 -0
  11. package/dist/es/common/models/size.js +4 -0
  12. package/dist/es/common/models/styling-classes.js +4 -0
  13. package/dist/es/common/models.js +4 -0
  14. package/dist/es/common/utils.js +37 -0
  15. package/dist/es/main.js +0 -1
  16. package/dist/es/maskedtextbox/maskedtextbox.component.js +101 -6
  17. package/dist/es/numerictextbox/numerictextbox.component.js +116 -20
  18. package/dist/es/package-metadata.js +1 -1
  19. package/dist/es/radiobutton/radiobutton.directive.js +52 -3
  20. package/dist/es/shared/textarea.directive.js +3 -2
  21. package/dist/es/switch/switch.component.js +167 -21
  22. package/dist/es/text-fields-common/text-fields-base.js +1 -1
  23. package/dist/es/textarea/textarea.component.js +101 -5
  24. package/dist/es/textbox/textbox.component.js +108 -11
  25. package/dist/es/textbox/textbox.directive.js +3 -2
  26. package/dist/es/textbox.module.js +0 -3
  27. package/dist/es2015/checkbox/checkbox.directive.d.ts +31 -0
  28. package/dist/es2015/checkbox/checkbox.directive.js +68 -10
  29. package/dist/es2015/colorpicker/color-gradient.component.js +1 -1
  30. package/dist/es2015/colorpicker/color-input.component.js +1 -1
  31. package/dist/es2015/colorpicker/colorpicker.component.d.ts +45 -3
  32. package/dist/es2015/colorpicker/colorpicker.component.js +113 -16
  33. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +2 -2
  34. package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +2 -2
  35. package/dist/es2015/common/models/fillmode.d.ts +13 -0
  36. package/dist/es2015/common/models/fillmode.js +4 -0
  37. package/dist/es2015/common/models/rounded.d.ts +23 -0
  38. package/dist/es2015/common/models/rounded.js +4 -0
  39. package/dist/es2015/common/models/size.d.ts +14 -0
  40. package/dist/es2015/common/models/size.js +4 -0
  41. package/dist/es2015/common/models/styling-classes.d.ts +11 -0
  42. package/dist/es2015/common/models/styling-classes.js +4 -0
  43. package/dist/es2015/common/models.d.ts +8 -0
  44. package/dist/es2015/common/models.js +4 -0
  45. package/dist/es2015/common/utils.d.ts +7 -0
  46. package/dist/es2015/common/utils.js +37 -0
  47. package/dist/es2015/index.metadata.json +1 -1
  48. package/dist/es2015/main.d.ts +1 -1
  49. package/dist/es2015/main.js +0 -1
  50. package/dist/es2015/maskedtextbox/maskedtextbox.component.d.ts +39 -1
  51. package/dist/es2015/maskedtextbox/maskedtextbox.component.js +88 -6
  52. package/dist/es2015/numerictextbox/numerictextbox.component.d.ts +39 -2
  53. package/dist/es2015/numerictextbox/numerictextbox.component.js +124 -40
  54. package/dist/es2015/package-metadata.js +1 -1
  55. package/dist/es2015/radiobutton/radiobutton.directive.d.ts +18 -0
  56. package/dist/es2015/radiobutton/radiobutton.directive.js +46 -11
  57. package/dist/es2015/shared/textarea.directive.d.ts +1 -1
  58. package/dist/es2015/shared/textarea.directive.js +3 -2
  59. package/dist/es2015/switch/switch.component.d.ts +48 -5
  60. package/dist/es2015/switch/switch.component.js +166 -24
  61. package/dist/es2015/text-fields-common/text-fields-base.js +1 -1
  62. package/dist/es2015/textarea/textarea.component.d.ts +39 -1
  63. package/dist/es2015/textarea/textarea.component.js +89 -5
  64. package/dist/es2015/textbox/textbox.component.d.ts +40 -1
  65. package/dist/es2015/textbox/textbox.component.js +96 -11
  66. package/dist/es2015/textbox/textbox.directive.d.ts +1 -1
  67. package/dist/es2015/textbox/textbox.directive.js +3 -2
  68. package/dist/es2015/textbox.module.js +0 -3
  69. package/dist/fesm2015/index.js +936 -478
  70. package/dist/fesm5/index.js +1015 -484
  71. package/dist/npm/checkbox/checkbox.directive.js +78 -2
  72. package/dist/npm/colorpicker/color-gradient.component.js +1 -1
  73. package/dist/npm/colorpicker/color-input.component.js +1 -1
  74. package/dist/npm/colorpicker/colorpicker.component.js +109 -4
  75. package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +1 -1
  76. package/dist/npm/colorpicker/flatcolorpicker-header.component.js +1 -1
  77. package/dist/npm/common/models/fillmode.js +6 -0
  78. package/dist/npm/common/models/rounded.js +6 -0
  79. package/dist/npm/common/models/size.js +6 -0
  80. package/dist/npm/common/models/styling-classes.js +6 -0
  81. package/dist/npm/common/models.js +6 -0
  82. package/dist/npm/common/utils.js +37 -0
  83. package/dist/npm/main.js +0 -2
  84. package/dist/npm/maskedtextbox/maskedtextbox.component.js +100 -5
  85. package/dist/npm/numerictextbox/numerictextbox.component.js +115 -19
  86. package/dist/npm/package-metadata.js +1 -1
  87. package/dist/npm/radiobutton/radiobutton.directive.js +51 -2
  88. package/dist/npm/shared/textarea.directive.js +3 -2
  89. package/dist/npm/switch/switch.component.js +166 -20
  90. package/dist/npm/text-fields-common/text-fields-base.js +1 -1
  91. package/dist/npm/textarea/textarea.component.js +100 -4
  92. package/dist/npm/textbox/textbox.component.js +107 -10
  93. package/dist/npm/textbox/textbox.directive.js +3 -2
  94. package/dist/npm/textbox.module.js +0 -3
  95. package/dist/systemjs/kendo-angular-inputs.js +1 -1
  96. package/package.json +11 -11
  97. package/dist/es/textbox/floating-label-input-adapter.js +0 -58
  98. package/dist/es/textbox/textbox-container.component.js +0 -224
  99. package/dist/es2015/textbox/floating-label-input-adapter.d.ts +0 -20
  100. package/dist/es2015/textbox/floating-label-input-adapter.js +0 -52
  101. package/dist/es2015/textbox/textbox-container.component.d.ts +0 -59
  102. package/dist/es2015/textbox/textbox-container.component.js +0 -209
  103. package/dist/npm/textbox/floating-label-input-adapter.js +0 -60
  104. package/dist/npm/textbox/textbox-container.component.js +0 -226
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Inputs Package for Angular",
4
4
  "author": "Progress",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
- "version": "8.0.0-dev.202112161434",
6
+ "version": "8.0.0-dev.202112211528",
7
7
  "main": "dist/npm/index.js",
8
8
  "module": "dist/fesm5/index.js",
9
9
  "es2015": "dist/fesm2015/index.js",
@@ -15,8 +15,8 @@
15
15
  "unpkg": "dist/cdn/main.js",
16
16
  "sideEffects": false,
17
17
  "scripts": {
18
- "test": "jest",
19
- "test:watch": "jest --watch",
18
+ "test": "jest --env=jsdom",
19
+ "test:watch": "jest --watch --env=jsdom",
20
20
  "test:ci": "ci-angular-test",
21
21
  "start": "gulp start",
22
22
  "e2e:ci": "ci-angular-e2e",
@@ -80,17 +80,17 @@
80
80
  "@progress/kendo-angular-layout": "^6.0.0",
81
81
  "@progress/kendo-angular-popup": "^4.0.0",
82
82
  "@progress/kendo-angular-progressbar": "^2.0.0",
83
- "@progress/kendo-angular-tasks": "19.0.2",
83
+ "@progress/kendo-angular-tasks": "^19.1.0",
84
84
  "@progress/kendo-angular-treeview": "^5.0.0",
85
85
  "@progress/kendo-drawing": "^1.5.12",
86
86
  "@progress/kendo-licensing": "^1.0.2",
87
87
  "@progress/kendo-e2e": "^0.7.0",
88
88
  "@progress/kendo-svg-icons": "^0.1.2",
89
- "@progress/kendo-theme-bootstrap": "^4.42.0",
90
- "@progress/kendo-theme-default": "^4.42.0",
91
- "@progress/kendo-theme-material": "^4.42.0",
89
+ "@progress/kendo-theme-bootstrap": "next",
90
+ "@progress/kendo-theme-default": "next",
91
+ "@progress/kendo-theme-material": "next",
92
92
  "@telerik/semantic-prerelease": "^1.1.5",
93
- "@types/jest": "^21.0.0",
93
+ "@types/jest": "^24.9.0",
94
94
  "@types/node": "ts3.4",
95
95
  "@types/zone.js": "0.0.27",
96
96
  "cldr-data": "^32.0.0",
@@ -99,10 +99,10 @@
99
99
  "cz-conventional-changelog": "^1.1.5",
100
100
  "ghooks": "^1.0.3",
101
101
  "gulp": "^4.0.0",
102
- "jest": "^21.0.0",
103
- "jest-cli": "^21.0.0",
102
+ "jest": "^24.9.0",
103
+ "jest-cli": "^24.9.0",
104
104
  "jest-junit": "^12.2.0",
105
- "jest-environment-jsdom": "^21.0.0",
105
+ "jest-environment-jsdom": "^24.9.0",
106
106
  "rxjs": "~6.4.0",
107
107
  "rxjs-tslint-rules": "^4.23.1",
108
108
  "semantic-release": "^6.3.6",
@@ -1,58 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Observable } from 'rxjs';
6
- import { EventEmitter } from '@angular/core';
7
- /**
8
- * @hidden
9
- */
10
- var FloatingLabelInputAdapter = /** @class */ (function () {
11
- function FloatingLabelInputAdapter(component, formControl) {
12
- this.component = component;
13
- var isObservableOrEventEmitter = function (event) { return event instanceof Observable || event instanceof EventEmitter; };
14
- if (isObservableOrEventEmitter(component.onFocus)) {
15
- this.onFocus = component.onFocus;
16
- }
17
- if (isObservableOrEventEmitter(component.autoFillStart)) {
18
- this.autoFillStart = component.autoFillStart;
19
- }
20
- if (isObservableOrEventEmitter(component.autoFillEnd)) {
21
- this.autoFillEnd = component.autoFillEnd;
22
- }
23
- if (isObservableOrEventEmitter(component.onBlur)) {
24
- this.onBlur = component.onBlur;
25
- }
26
- if (formControl) {
27
- this.onValueChange = formControl.valueChanges;
28
- }
29
- else if (component.onValueChange) {
30
- this.onValueChange = component.onValueChange;
31
- }
32
- }
33
- Object.defineProperty(FloatingLabelInputAdapter.prototype, "focusableId", {
34
- get: function () {
35
- var component = this.component;
36
- if ('focusableId' in component) {
37
- return component.focusableId;
38
- }
39
- else if ('id' in component) {
40
- return component.id;
41
- }
42
- return "";
43
- },
44
- set: function (value) {
45
- var component = this.component;
46
- if ('focusableId' in component) {
47
- component.focusableId = value;
48
- }
49
- else if ('id' in component) {
50
- component.id = value;
51
- }
52
- },
53
- enumerable: true,
54
- configurable: true
55
- });
56
- return FloatingLabelInputAdapter;
57
- }());
58
- export { FloatingLabelInputAdapter };
@@ -1,224 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { ContentChild, Component, ElementRef, EventEmitter, HostBinding, Input, Inject, Optional, Renderer2, isDevMode, ChangeDetectorRef } from '@angular/core';
7
- import { RTL } from '@progress/kendo-angular-l10n';
8
- import { TextAreaDirective } from '../shared/textarea.directive';
9
- import { NgControl } from '@angular/forms';
10
- import { guid, KendoInput } from '@progress/kendo-angular-common';
11
- import { FloatingLabelInputAdapter } from './floating-label-input-adapter';
12
- var isFunction = function (x) { return Object.prototype.toString.call(x) === '[object Function]'; };
13
- var ɵ0 = isFunction;
14
- /**
15
- * @hidden
16
- */
17
- var TextBoxContainerComponent = /** @class */ (function () {
18
- function TextBoxContainerComponent(elementRef, renderer, changeDetectorRef, rtl) {
19
- this.elementRef = elementRef;
20
- this.renderer = renderer;
21
- this.changeDetectorRef = changeDetectorRef;
22
- /**
23
- * @hidden
24
- */
25
- this.focused = false;
26
- /**
27
- * @hidden
28
- */
29
- this.empty = true;
30
- /**
31
- * @hidden
32
- */
33
- this.invalid = false;
34
- this._subscriptions = [];
35
- this.autoFillStarted = false;
36
- this.direction = rtl ? 'rtl' : 'ltr';
37
- this.renderer.removeAttribute(this.elementRef.nativeElement, "id");
38
- }
39
- Object.defineProperty(TextBoxContainerComponent.prototype, "hostClasses", {
40
- get: function () {
41
- return true;
42
- },
43
- enumerable: true,
44
- configurable: true
45
- });
46
- Object.defineProperty(TextBoxContainerComponent.prototype, "textareaElementClass", {
47
- get: function () {
48
- return !!this.textarea;
49
- },
50
- enumerable: true,
51
- configurable: true
52
- });
53
- Object.defineProperty(TextBoxContainerComponent.prototype, "focusedClass", {
54
- get: function () {
55
- return this.focused;
56
- },
57
- enumerable: true,
58
- configurable: true
59
- });
60
- Object.defineProperty(TextBoxContainerComponent.prototype, "invalidClass", {
61
- get: function () {
62
- return this.invalid;
63
- },
64
- enumerable: true,
65
- configurable: true
66
- });
67
- /**
68
- * @hidden
69
- */
70
- TextBoxContainerComponent.prototype.ngAfterContentInit = function () {
71
- var _this = this;
72
- if (!this.formControl && !this.kendoInput) {
73
- if (isDevMode()) {
74
- throw new Error("The TextBoxContainer requires a Kendo Input component" +
75
- " or a forms-bound component to function properly.");
76
- }
77
- return;
78
- }
79
- // add focus/blur/valueChange handlers
80
- var control = new FloatingLabelInputAdapter(this.kendoInput || this.formControl.valueAccessor, this.formControl);
81
- var setFocus = function (isFocused) { return function () {
82
- _this.focused = isFocused;
83
- _this.updateState();
84
- }; };
85
- this.subscribe(control, 'onFocus', setFocus(true));
86
- this.subscribe(control, 'onBlur', setFocus(false));
87
- this.subscribe(control, 'autoFillStart', function () {
88
- _this.autoFillStarted = true;
89
- _this.renderer.removeClass(_this.elementRef.nativeElement, 'k-state-empty');
90
- });
91
- this.subscribe(control, 'autoFillEnd', function () {
92
- if (_this.autoFillStarted) {
93
- _this.autoFillStarted = false;
94
- if (_this.empty) {
95
- _this.renderer.addClass(_this.elementRef.nativeElement, 'k-state-empty');
96
- }
97
- }
98
- });
99
- var updateState = function () { return _this.updateState(); };
100
- updateState();
101
- this.subscribe(control, 'onValueChange', updateState);
102
- // set label id for floating label
103
- if (this.id && control.focusableId) {
104
- // input wins
105
- this.id = control.focusableId;
106
- }
107
- else if (this.id) {
108
- control.focusableId = this.id;
109
- }
110
- else if (control.focusableId) {
111
- this.id = control.focusableId;
112
- }
113
- else {
114
- var id = "_" + guid();
115
- control.focusableId = id;
116
- this.id = id;
117
- }
118
- };
119
- /**
120
- * @hidden
121
- */
122
- TextBoxContainerComponent.prototype.ngOnDestroy = function () {
123
- this._subscriptions.forEach(function (s) { return s.unsubscribe(); });
124
- this._subscriptions = [];
125
- };
126
- TextBoxContainerComponent.prototype.subscribe = function (control, eventName, handler) {
127
- if (control[eventName] instanceof EventEmitter) {
128
- var subscription = control[eventName].subscribe(handler);
129
- this._subscriptions.push(subscription);
130
- }
131
- };
132
- TextBoxContainerComponent.prototype.updateState = function () {
133
- var empty = function (value) {
134
- // zero is not an empty value (e.g., NumericTextBox)
135
- if (value === 0 || value === false) {
136
- return false;
137
- }
138
- // empty arrays are an empty value (e.g., MultiSelect)
139
- if (Array.isArray(value) && !value.length) {
140
- return true;
141
- }
142
- return !value;
143
- };
144
- var formControl = this.formControl;
145
- if (formControl) {
146
- var valueAccessor = formControl.valueAccessor;
147
- if (isFunction(valueAccessor.isEmpty)) {
148
- this.empty = valueAccessor.isEmpty();
149
- }
150
- else {
151
- this.empty = empty(formControl.value);
152
- }
153
- this.invalid = formControl.invalid && (formControl.touched || formControl.dirty);
154
- }
155
- else {
156
- this.empty = isFunction(this.kendoInput.isEmpty) ?
157
- this.kendoInput.isEmpty() : empty(this.kendoInput.value);
158
- }
159
- if (this.empty) {
160
- this.renderer.addClass(this.elementRef.nativeElement, 'k-state-empty');
161
- }
162
- else {
163
- this.renderer.removeClass(this.elementRef.nativeElement, 'k-state-empty');
164
- }
165
- this.changeDetectorRef.markForCheck();
166
- };
167
- tslib_1.__decorate([
168
- HostBinding('class.k-textbox-container'),
169
- tslib_1.__metadata("design:type", Boolean),
170
- tslib_1.__metadata("design:paramtypes", [])
171
- ], TextBoxContainerComponent.prototype, "hostClasses", null);
172
- tslib_1.__decorate([
173
- HostBinding('class.k-textarea-wrapper'),
174
- tslib_1.__metadata("design:type", Boolean),
175
- tslib_1.__metadata("design:paramtypes", [])
176
- ], TextBoxContainerComponent.prototype, "textareaElementClass", null);
177
- tslib_1.__decorate([
178
- HostBinding('class.k-state-focused'),
179
- tslib_1.__metadata("design:type", Boolean),
180
- tslib_1.__metadata("design:paramtypes", [])
181
- ], TextBoxContainerComponent.prototype, "focusedClass", null);
182
- tslib_1.__decorate([
183
- HostBinding('class.k-state-invalid'),
184
- tslib_1.__metadata("design:type", Boolean),
185
- tslib_1.__metadata("design:paramtypes", [])
186
- ], TextBoxContainerComponent.prototype, "invalidClass", null);
187
- tslib_1.__decorate([
188
- HostBinding('attr.dir'),
189
- tslib_1.__metadata("design:type", String)
190
- ], TextBoxContainerComponent.prototype, "direction", void 0);
191
- tslib_1.__decorate([
192
- Input(),
193
- tslib_1.__metadata("design:type", String)
194
- ], TextBoxContainerComponent.prototype, "id", void 0);
195
- tslib_1.__decorate([
196
- Input(),
197
- tslib_1.__metadata("design:type", String)
198
- ], TextBoxContainerComponent.prototype, "floatingLabel", void 0);
199
- tslib_1.__decorate([
200
- ContentChild(KendoInput, { static: false }),
201
- tslib_1.__metadata("design:type", Object)
202
- ], TextBoxContainerComponent.prototype, "kendoInput", void 0);
203
- tslib_1.__decorate([
204
- ContentChild(TextAreaDirective, { static: false }),
205
- tslib_1.__metadata("design:type", TextAreaDirective)
206
- ], TextBoxContainerComponent.prototype, "textarea", void 0);
207
- tslib_1.__decorate([
208
- ContentChild(NgControl, { static: false }),
209
- tslib_1.__metadata("design:type", NgControl)
210
- ], TextBoxContainerComponent.prototype, "formControl", void 0);
211
- TextBoxContainerComponent = tslib_1.__decorate([
212
- Component({
213
- selector: 'kendo-textbox-container',
214
- template: "\n <ng-content></ng-content>\n <label *ngIf=\"floatingLabel\" [for]=\"id\" class=\"k-label\">{{ floatingLabel }}</label>\n "
215
- }),
216
- tslib_1.__param(3, Optional()), tslib_1.__param(3, Inject(RTL)),
217
- tslib_1.__metadata("design:paramtypes", [ElementRef,
218
- Renderer2,
219
- ChangeDetectorRef, Boolean])
220
- ], TextBoxContainerComponent);
221
- return TextBoxContainerComponent;
222
- }());
223
- export { TextBoxContainerComponent };
224
- export { ɵ0 };
@@ -1,20 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Observable } from 'rxjs';
6
- import { NgControl } from '@angular/forms';
7
- import { EventEmitter } from '@angular/core';
8
- /**
9
- * @hidden
10
- */
11
- export declare class FloatingLabelInputAdapter {
12
- private component;
13
- onFocus: Observable<any> | EventEmitter<any>;
14
- onBlur: Observable<any> | EventEmitter<any>;
15
- autoFillStart: Observable<any> | EventEmitter<any>;
16
- autoFillEnd: Observable<any> | EventEmitter<any>;
17
- onValueChange: Observable<any> | EventEmitter<any>;
18
- focusableId: string;
19
- constructor(component: any, formControl?: NgControl);
20
- }
@@ -1,52 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Observable } from 'rxjs';
6
- import { EventEmitter } from '@angular/core';
7
- /**
8
- * @hidden
9
- */
10
- export class FloatingLabelInputAdapter {
11
- constructor(component, formControl) {
12
- this.component = component;
13
- const isObservableOrEventEmitter = (event) => event instanceof Observable || event instanceof EventEmitter;
14
- if (isObservableOrEventEmitter(component.onFocus)) {
15
- this.onFocus = component.onFocus;
16
- }
17
- if (isObservableOrEventEmitter(component.autoFillStart)) {
18
- this.autoFillStart = component.autoFillStart;
19
- }
20
- if (isObservableOrEventEmitter(component.autoFillEnd)) {
21
- this.autoFillEnd = component.autoFillEnd;
22
- }
23
- if (isObservableOrEventEmitter(component.onBlur)) {
24
- this.onBlur = component.onBlur;
25
- }
26
- if (formControl) {
27
- this.onValueChange = formControl.valueChanges;
28
- }
29
- else if (component.onValueChange) {
30
- this.onValueChange = component.onValueChange;
31
- }
32
- }
33
- get focusableId() {
34
- const component = this.component;
35
- if ('focusableId' in component) {
36
- return component.focusableId;
37
- }
38
- else if ('id' in component) {
39
- return component.id;
40
- }
41
- return "";
42
- }
43
- set focusableId(value) {
44
- const component = this.component;
45
- if ('focusableId' in component) {
46
- component.focusableId = value;
47
- }
48
- else if ('id' in component) {
49
- component.id = value;
50
- }
51
- }
52
- }
@@ -1,59 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { AfterContentInit, ElementRef, OnDestroy, Renderer2, ChangeDetectorRef } from '@angular/core';
6
- import { TextAreaDirective } from '../shared/textarea.directive';
7
- import { NgControl } from '@angular/forms';
8
- /**
9
- * @hidden
10
- */
11
- export declare class TextBoxContainerComponent implements AfterContentInit, OnDestroy {
12
- private elementRef;
13
- private renderer;
14
- private changeDetectorRef;
15
- readonly hostClasses: boolean;
16
- readonly textareaElementClass: boolean;
17
- readonly focusedClass: boolean;
18
- readonly invalidClass: boolean;
19
- /**
20
- * @hidden
21
- */
22
- direction: string;
23
- /**
24
- * Sets the `id` attribute of the input inside the container.
25
- */
26
- id: string;
27
- /**
28
- * Adds a floating label which describes the input.
29
- */
30
- floatingLabel: string;
31
- kendoInput: any;
32
- textarea: TextAreaDirective;
33
- formControl: NgControl;
34
- /**
35
- * @hidden
36
- */
37
- focused: boolean;
38
- /**
39
- * @hidden
40
- */
41
- empty: boolean;
42
- /**
43
- * @hidden
44
- */
45
- invalid: boolean;
46
- private _subscriptions;
47
- private autoFillStarted;
48
- constructor(elementRef: ElementRef, renderer: Renderer2, changeDetectorRef: ChangeDetectorRef, rtl: boolean);
49
- /**
50
- * @hidden
51
- */
52
- ngAfterContentInit(): void;
53
- /**
54
- * @hidden
55
- */
56
- ngOnDestroy(): void;
57
- private subscribe;
58
- private updateState;
59
- }
@@ -1,209 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { ContentChild, Component, ElementRef, EventEmitter, HostBinding, Input, Inject, Optional, Renderer2, isDevMode, ChangeDetectorRef } from '@angular/core';
7
- import { RTL } from '@progress/kendo-angular-l10n';
8
- import { TextAreaDirective } from '../shared/textarea.directive';
9
- import { NgControl } from '@angular/forms';
10
- import { guid, KendoInput } from '@progress/kendo-angular-common';
11
- import { FloatingLabelInputAdapter } from './floating-label-input-adapter';
12
- const isFunction = (x) => Object.prototype.toString.call(x) === '[object Function]';
13
- const ɵ0 = isFunction;
14
- /**
15
- * @hidden
16
- */
17
- let TextBoxContainerComponent = class TextBoxContainerComponent {
18
- constructor(elementRef, renderer, changeDetectorRef, rtl) {
19
- this.elementRef = elementRef;
20
- this.renderer = renderer;
21
- this.changeDetectorRef = changeDetectorRef;
22
- /**
23
- * @hidden
24
- */
25
- this.focused = false;
26
- /**
27
- * @hidden
28
- */
29
- this.empty = true;
30
- /**
31
- * @hidden
32
- */
33
- this.invalid = false;
34
- this._subscriptions = [];
35
- this.autoFillStarted = false;
36
- this.direction = rtl ? 'rtl' : 'ltr';
37
- this.renderer.removeAttribute(this.elementRef.nativeElement, "id");
38
- }
39
- get hostClasses() {
40
- return true;
41
- }
42
- get textareaElementClass() {
43
- return !!this.textarea;
44
- }
45
- get focusedClass() {
46
- return this.focused;
47
- }
48
- get invalidClass() {
49
- return this.invalid;
50
- }
51
- /**
52
- * @hidden
53
- */
54
- ngAfterContentInit() {
55
- if (!this.formControl && !this.kendoInput) {
56
- if (isDevMode()) {
57
- throw new Error("The TextBoxContainer requires a Kendo Input component" +
58
- " or a forms-bound component to function properly.");
59
- }
60
- return;
61
- }
62
- // add focus/blur/valueChange handlers
63
- const control = new FloatingLabelInputAdapter(this.kendoInput || this.formControl.valueAccessor, this.formControl);
64
- const setFocus = (isFocused) => () => {
65
- this.focused = isFocused;
66
- this.updateState();
67
- };
68
- this.subscribe(control, 'onFocus', setFocus(true));
69
- this.subscribe(control, 'onBlur', setFocus(false));
70
- this.subscribe(control, 'autoFillStart', () => {
71
- this.autoFillStarted = true;
72
- this.renderer.removeClass(this.elementRef.nativeElement, 'k-state-empty');
73
- });
74
- this.subscribe(control, 'autoFillEnd', () => {
75
- if (this.autoFillStarted) {
76
- this.autoFillStarted = false;
77
- if (this.empty) {
78
- this.renderer.addClass(this.elementRef.nativeElement, 'k-state-empty');
79
- }
80
- }
81
- });
82
- const updateState = () => this.updateState();
83
- updateState();
84
- this.subscribe(control, 'onValueChange', updateState);
85
- // set label id for floating label
86
- if (this.id && control.focusableId) {
87
- // input wins
88
- this.id = control.focusableId;
89
- }
90
- else if (this.id) {
91
- control.focusableId = this.id;
92
- }
93
- else if (control.focusableId) {
94
- this.id = control.focusableId;
95
- }
96
- else {
97
- const id = "_" + guid();
98
- control.focusableId = id;
99
- this.id = id;
100
- }
101
- }
102
- /**
103
- * @hidden
104
- */
105
- ngOnDestroy() {
106
- this._subscriptions.forEach(s => s.unsubscribe());
107
- this._subscriptions = [];
108
- }
109
- subscribe(control, eventName, handler) {
110
- if (control[eventName] instanceof EventEmitter) {
111
- const subscription = control[eventName].subscribe(handler);
112
- this._subscriptions.push(subscription);
113
- }
114
- }
115
- updateState() {
116
- const empty = value => {
117
- // zero is not an empty value (e.g., NumericTextBox)
118
- if (value === 0 || value === false) {
119
- return false;
120
- }
121
- // empty arrays are an empty value (e.g., MultiSelect)
122
- if (Array.isArray(value) && !value.length) {
123
- return true;
124
- }
125
- return !value;
126
- };
127
- const formControl = this.formControl;
128
- if (formControl) {
129
- const valueAccessor = formControl.valueAccessor;
130
- if (isFunction(valueAccessor.isEmpty)) {
131
- this.empty = valueAccessor.isEmpty();
132
- }
133
- else {
134
- this.empty = empty(formControl.value);
135
- }
136
- this.invalid = formControl.invalid && (formControl.touched || formControl.dirty);
137
- }
138
- else {
139
- this.empty = isFunction(this.kendoInput.isEmpty) ?
140
- this.kendoInput.isEmpty() : empty(this.kendoInput.value);
141
- }
142
- if (this.empty) {
143
- this.renderer.addClass(this.elementRef.nativeElement, 'k-state-empty');
144
- }
145
- else {
146
- this.renderer.removeClass(this.elementRef.nativeElement, 'k-state-empty');
147
- }
148
- this.changeDetectorRef.markForCheck();
149
- }
150
- };
151
- tslib_1.__decorate([
152
- HostBinding('class.k-textbox-container'),
153
- tslib_1.__metadata("design:type", Boolean),
154
- tslib_1.__metadata("design:paramtypes", [])
155
- ], TextBoxContainerComponent.prototype, "hostClasses", null);
156
- tslib_1.__decorate([
157
- HostBinding('class.k-textarea-wrapper'),
158
- tslib_1.__metadata("design:type", Boolean),
159
- tslib_1.__metadata("design:paramtypes", [])
160
- ], TextBoxContainerComponent.prototype, "textareaElementClass", null);
161
- tslib_1.__decorate([
162
- HostBinding('class.k-state-focused'),
163
- tslib_1.__metadata("design:type", Boolean),
164
- tslib_1.__metadata("design:paramtypes", [])
165
- ], TextBoxContainerComponent.prototype, "focusedClass", null);
166
- tslib_1.__decorate([
167
- HostBinding('class.k-state-invalid'),
168
- tslib_1.__metadata("design:type", Boolean),
169
- tslib_1.__metadata("design:paramtypes", [])
170
- ], TextBoxContainerComponent.prototype, "invalidClass", null);
171
- tslib_1.__decorate([
172
- HostBinding('attr.dir'),
173
- tslib_1.__metadata("design:type", String)
174
- ], TextBoxContainerComponent.prototype, "direction", void 0);
175
- tslib_1.__decorate([
176
- Input(),
177
- tslib_1.__metadata("design:type", String)
178
- ], TextBoxContainerComponent.prototype, "id", void 0);
179
- tslib_1.__decorate([
180
- Input(),
181
- tslib_1.__metadata("design:type", String)
182
- ], TextBoxContainerComponent.prototype, "floatingLabel", void 0);
183
- tslib_1.__decorate([
184
- ContentChild(KendoInput, { static: false }),
185
- tslib_1.__metadata("design:type", Object)
186
- ], TextBoxContainerComponent.prototype, "kendoInput", void 0);
187
- tslib_1.__decorate([
188
- ContentChild(TextAreaDirective, { static: false }),
189
- tslib_1.__metadata("design:type", TextAreaDirective)
190
- ], TextBoxContainerComponent.prototype, "textarea", void 0);
191
- tslib_1.__decorate([
192
- ContentChild(NgControl, { static: false }),
193
- tslib_1.__metadata("design:type", NgControl)
194
- ], TextBoxContainerComponent.prototype, "formControl", void 0);
195
- TextBoxContainerComponent = tslib_1.__decorate([
196
- Component({
197
- selector: 'kendo-textbox-container',
198
- template: `
199
- <ng-content></ng-content>
200
- <label *ngIf="floatingLabel" [for]="id" class="k-label">{{ floatingLabel }}</label>
201
- `
202
- }),
203
- tslib_1.__param(3, Optional()), tslib_1.__param(3, Inject(RTL)),
204
- tslib_1.__metadata("design:paramtypes", [ElementRef,
205
- Renderer2,
206
- ChangeDetectorRef, Boolean])
207
- ], TextBoxContainerComponent);
208
- export { TextBoxContainerComponent };
209
- export { ɵ0 };