@progress/kendo-angular-label 3.1.3 → 4.0.0-dev.202204131904
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/bundles/kendo-angular-label.umd.js +5 -0
- package/{dist/es2015 → esm2015}/floating-label/floating-label-input-adapter.js +0 -0
- package/{dist/es2015 → esm2015}/floating-label/floating-label.component.js +74 -79
- package/{dist/es2015 → esm2015}/floating-label/floating-label.module.js +14 -11
- package/{dist/es → esm2015}/floating-label/models/label-position.js +1 -0
- package/{dist/es2015/shared.module.d.ts → esm2015/kendo-angular-label.js} +2 -3
- package/esm2015/label/label.component.js +158 -0
- package/{dist/es2015 → esm2015}/label.directive.js +21 -24
- package/{dist/es2015 → esm2015}/label.module.js +16 -11
- package/esm2015/localization/custom-messages.component.js +41 -0
- package/esm2015/localization/localized-messages.directive.js +39 -0
- package/esm2015/localization/messages.js +23 -0
- package/{dist/es → esm2015}/main.js +2 -0
- package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
- package/esm2015/shared.module.js +29 -0
- package/{dist/es2015 → esm2015}/util.js +0 -0
- package/{dist/fesm2015/index.js → fesm2015/kendo-angular-label.js} +245 -205
- package/{dist/es2015/floating-label → floating-label}/floating-label-input-adapter.d.ts +2 -1
- package/{dist/es2015/floating-label → floating-label}/floating-label.component.d.ts +6 -3
- package/{dist/es2015/floating-label → floating-label}/floating-label.module.d.ts +7 -0
- package/{dist/es2015/floating-label → floating-label}/models/label-position.d.ts +0 -0
- package/{dist/es2015/floating-label/models/label-position.js → kendo-angular-label.d.ts} +5 -0
- package/{dist/es2015/label → label}/label.component.d.ts +3 -0
- package/{dist/es2015/label.directive.d.ts → label.directive.d.ts} +4 -1
- package/{dist/es2015/label.module.d.ts → label.module.d.ts} +9 -0
- package/{dist/es2015/localization → localization}/custom-messages.component.d.ts +4 -1
- package/{dist/es2015/localization → localization}/localized-messages.directive.d.ts +3 -0
- package/{dist/es2015/localization → localization}/messages.d.ts +3 -0
- package/{dist/es2015/main.d.ts → main.d.ts} +2 -0
- package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
- package/package.json +34 -107
- package/schematics/ngAdd/index.js +5 -2
- package/schematics/ngAdd/index.js.map +1 -1
- package/shared.module.d.ts +15 -0
- package/{dist/es2015/util.d.ts → util.d.ts} +0 -0
- package/dist/cdn/js/kendo-angular-label.js +0 -20
- package/dist/cdn/main.js +0 -5
- package/dist/es/floating-label/floating-label-input-adapter.js +0 -58
- package/dist/es/floating-label/floating-label.component.js +0 -312
- package/dist/es/floating-label/floating-label.module.js +0 -52
- package/dist/es/index.js +0 -11
- package/dist/es/label/label.component.js +0 -137
- package/dist/es/label.directive.js +0 -140
- package/dist/es/label.module.js +0 -63
- package/dist/es/localization/custom-messages.component.js +0 -44
- package/dist/es/localization/localized-messages.directive.js +0 -35
- package/dist/es/localization/messages.js +0 -22
- package/dist/es/package-metadata.js +0 -15
- package/dist/es/shared.module.js +0 -27
- package/dist/es/util.js +0 -33
- package/dist/es2015/index.d.ts +0 -11
- package/dist/es2015/index.js +0 -11
- package/dist/es2015/index.metadata.json +0 -1
- package/dist/es2015/label/label.component.js +0 -146
- package/dist/es2015/localization/custom-messages.component.js +0 -36
- package/dist/es2015/localization/localized-messages.directive.js +0 -34
- package/dist/es2015/localization/messages.js +0 -16
- package/dist/es2015/main.js +0 -10
- package/dist/es2015/shared.module.js +0 -24
- package/dist/fesm5/index.js +0 -858
- package/dist/npm/floating-label/floating-label-input-adapter.js +0 -60
- package/dist/npm/floating-label/floating-label.component.js +0 -314
- package/dist/npm/floating-label/floating-label.module.js +0 -54
- package/dist/npm/floating-label/models/label-position.js +0 -6
- package/dist/npm/index.js +0 -17
- package/dist/npm/label/label.component.js +0 -139
- package/dist/npm/label.directive.js +0 -142
- package/dist/npm/label.module.js +0 -65
- package/dist/npm/localization/custom-messages.component.js +0 -46
- package/dist/npm/localization/localized-messages.directive.js +0 -37
- package/dist/npm/localization/messages.js +0 -24
- package/dist/npm/main.js +0 -18
- package/dist/npm/package-metadata.js +0 -17
- package/dist/npm/shared.module.js +0 -29
- package/dist/npm/util.js +0 -35
- package/dist/systemjs/kendo-angular-label.js +0 -5
|
@@ -1,60 +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
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
var rxjs_1 = require("rxjs");
|
|
8
|
-
var core_1 = require("@angular/core");
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
var FloatingLabelInputAdapter = /** @class */ (function () {
|
|
13
|
-
function FloatingLabelInputAdapter(component, formControl) {
|
|
14
|
-
this.component = component;
|
|
15
|
-
var isObservableOrEventEmitter = function (event) { return event instanceof rxjs_1.Observable || event instanceof core_1.EventEmitter; };
|
|
16
|
-
if (isObservableOrEventEmitter(component.onFocus)) {
|
|
17
|
-
this.onFocus = component.onFocus;
|
|
18
|
-
}
|
|
19
|
-
if (isObservableOrEventEmitter(component.autoFillStart)) {
|
|
20
|
-
this.autoFillStart = component.autoFillStart;
|
|
21
|
-
}
|
|
22
|
-
if (isObservableOrEventEmitter(component.autoFillEnd)) {
|
|
23
|
-
this.autoFillEnd = component.autoFillEnd;
|
|
24
|
-
}
|
|
25
|
-
if (isObservableOrEventEmitter(component.onBlur)) {
|
|
26
|
-
this.onBlur = component.onBlur;
|
|
27
|
-
}
|
|
28
|
-
if (formControl) {
|
|
29
|
-
this.onValueChange = formControl.valueChanges;
|
|
30
|
-
}
|
|
31
|
-
else if (component.onValueChange) {
|
|
32
|
-
this.onValueChange = component.onValueChange;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
Object.defineProperty(FloatingLabelInputAdapter.prototype, "focusableId", {
|
|
36
|
-
get: function () {
|
|
37
|
-
var component = this.component;
|
|
38
|
-
if ('focusableId' in component) {
|
|
39
|
-
return component.focusableId;
|
|
40
|
-
}
|
|
41
|
-
else if ('id' in component) {
|
|
42
|
-
return component.id;
|
|
43
|
-
}
|
|
44
|
-
return "";
|
|
45
|
-
},
|
|
46
|
-
set: function (value) {
|
|
47
|
-
var component = this.component;
|
|
48
|
-
if ('focusableId' in component) {
|
|
49
|
-
component.focusableId = value;
|
|
50
|
-
}
|
|
51
|
-
else if ('id' in component) {
|
|
52
|
-
component.id = value;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
enumerable: true,
|
|
56
|
-
configurable: true
|
|
57
|
-
});
|
|
58
|
-
return FloatingLabelInputAdapter;
|
|
59
|
-
}());
|
|
60
|
-
exports.FloatingLabelInputAdapter = FloatingLabelInputAdapter;
|
|
@@ -1,314 +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
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
var tslib_1 = require("tslib");
|
|
8
|
-
var core_1 = require("@angular/core");
|
|
9
|
-
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
|
-
var forms_1 = require("@angular/forms");
|
|
11
|
-
var kendo_angular_common_1 = require("@progress/kendo-angular-common");
|
|
12
|
-
var kendo_licensing_1 = require("@progress/kendo-licensing");
|
|
13
|
-
var package_metadata_1 = require("../package-metadata");
|
|
14
|
-
var floating_label_input_adapter_1 = require("./floating-label-input-adapter");
|
|
15
|
-
var isFunction = function (x) { return Object.prototype.toString.call(x) === '[object Function]'; };
|
|
16
|
-
var ɵ0 = isFunction;
|
|
17
|
-
exports.ɵ0 = ɵ0;
|
|
18
|
-
/**
|
|
19
|
-
* Represents the [Kendo UI FloatingLabel component for Angular]({% slug overview_floatinglabel %}).
|
|
20
|
-
* Provides floating labels to `input` elements.
|
|
21
|
-
*
|
|
22
|
-
* The FloatingLabel supports both Template and Reactive Forms and
|
|
23
|
-
* [can contain Kendo UI for Angular Input components such as `kendo-combobox` and `kendo-numerictextbox`,
|
|
24
|
-
* or HTML Input elements with the `kendoTextBox` directive applied]({% slug overview_floatinglabel %}#toc-implementing-floating-labels).
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
*
|
|
29
|
-
* _@Component({
|
|
30
|
-
* selector: 'my-app',
|
|
31
|
-
* template: `
|
|
32
|
-
* <kendo-floatinglabel text="First name">
|
|
33
|
-
* <input [(ngModel)]="name" kendoTextBox />
|
|
34
|
-
* </kendo-floatinglabel>
|
|
35
|
-
* `
|
|
36
|
-
* })
|
|
37
|
-
* class AppComponent {
|
|
38
|
-
* public name = 'John';
|
|
39
|
-
* }
|
|
40
|
-
*
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
var FloatingLabelComponent = /** @class */ (function () {
|
|
44
|
-
function FloatingLabelComponent(elementRef, renderer, changeDetectorRef, localization) {
|
|
45
|
-
this.elementRef = elementRef;
|
|
46
|
-
this.renderer = renderer;
|
|
47
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
48
|
-
this.localization = localization;
|
|
49
|
-
this.hostClasses = true;
|
|
50
|
-
/**
|
|
51
|
-
* Fires after the floating label position is changed.
|
|
52
|
-
*/
|
|
53
|
-
this.positionChange = new core_1.EventEmitter();
|
|
54
|
-
/**
|
|
55
|
-
* @hidden
|
|
56
|
-
*/
|
|
57
|
-
this.focused = false;
|
|
58
|
-
/**
|
|
59
|
-
* @hidden
|
|
60
|
-
*/
|
|
61
|
-
this.empty = true;
|
|
62
|
-
/**
|
|
63
|
-
* @hidden
|
|
64
|
-
*/
|
|
65
|
-
this.invalid = false;
|
|
66
|
-
/**
|
|
67
|
-
* @hidden
|
|
68
|
-
*/
|
|
69
|
-
this.labelId = "k-" + kendo_angular_common_1.guid();
|
|
70
|
-
this.autoFillStarted = false;
|
|
71
|
-
kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
|
|
72
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
73
|
-
this.renderer.removeAttribute(this.elementRef.nativeElement, "id");
|
|
74
|
-
}
|
|
75
|
-
Object.defineProperty(FloatingLabelComponent.prototype, "labelPosition", {
|
|
76
|
-
/**
|
|
77
|
-
* Represents the current floating label position.
|
|
78
|
-
*/
|
|
79
|
-
get: function () {
|
|
80
|
-
if (!this.empty) {
|
|
81
|
-
return 'Out';
|
|
82
|
-
}
|
|
83
|
-
return this.focused ? 'Out' : 'In';
|
|
84
|
-
},
|
|
85
|
-
enumerable: true,
|
|
86
|
-
configurable: true
|
|
87
|
-
});
|
|
88
|
-
Object.defineProperty(FloatingLabelComponent.prototype, "focusedClass", {
|
|
89
|
-
get: function () {
|
|
90
|
-
return this.focused;
|
|
91
|
-
},
|
|
92
|
-
enumerable: true,
|
|
93
|
-
configurable: true
|
|
94
|
-
});
|
|
95
|
-
Object.defineProperty(FloatingLabelComponent.prototype, "invalidClass", {
|
|
96
|
-
get: function () {
|
|
97
|
-
return this.invalid;
|
|
98
|
-
},
|
|
99
|
-
enumerable: true,
|
|
100
|
-
configurable: true
|
|
101
|
-
});
|
|
102
|
-
/**
|
|
103
|
-
* @hidden
|
|
104
|
-
*/
|
|
105
|
-
FloatingLabelComponent.prototype.ngAfterContentInit = function () {
|
|
106
|
-
this.validateSetup();
|
|
107
|
-
var control = new floating_label_input_adapter_1.FloatingLabelInputAdapter(this.kendoInput || this.formControl.valueAccessor, this.formControl);
|
|
108
|
-
this.addHandlers(control);
|
|
109
|
-
this.setLabelFor(control);
|
|
110
|
-
};
|
|
111
|
-
FloatingLabelComponent.prototype.ngAfterViewInit = function () {
|
|
112
|
-
if (this.kendoInput) {
|
|
113
|
-
this.setAriaLabelledby(this.kendoInput);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* @hidden
|
|
118
|
-
*/
|
|
119
|
-
FloatingLabelComponent.prototype.ngOnDestroy = function () {
|
|
120
|
-
if (this.subscription) {
|
|
121
|
-
this.subscription.unsubscribe();
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* @hidden
|
|
126
|
-
*/
|
|
127
|
-
FloatingLabelComponent.prototype.textFor = function (key) {
|
|
128
|
-
return this.localization.get(key);
|
|
129
|
-
};
|
|
130
|
-
FloatingLabelComponent.prototype.subscribe = function (control, eventName, handler) {
|
|
131
|
-
if (control[eventName] instanceof core_1.EventEmitter) {
|
|
132
|
-
var subscription = control[eventName].subscribe(handler);
|
|
133
|
-
if (!this.subscription) {
|
|
134
|
-
this.subscription = subscription;
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.subscription.add(subscription);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
FloatingLabelComponent.prototype.updateState = function () {
|
|
142
|
-
var empty = function (value) {
|
|
143
|
-
// zero is not an empty value (e.g., NumericTextBox)
|
|
144
|
-
if (value === 0 || value === false) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
// empty arrays are an empty value (e.g., MultiSelect)
|
|
148
|
-
if (Array.isArray(value) && !value.length) {
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
return !value;
|
|
152
|
-
};
|
|
153
|
-
var formControl = this.formControl;
|
|
154
|
-
if (formControl) {
|
|
155
|
-
var valueAccessor = formControl.valueAccessor;
|
|
156
|
-
if (isFunction(valueAccessor.isEmpty)) {
|
|
157
|
-
this.empty = valueAccessor.isEmpty();
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
this.empty = empty(formControl.value);
|
|
161
|
-
}
|
|
162
|
-
this.invalid = formControl.invalid && (formControl.touched || formControl.dirty);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
this.empty = isFunction(this.kendoInput.isEmpty) ?
|
|
166
|
-
this.kendoInput.isEmpty() : empty(this.kendoInput.value);
|
|
167
|
-
}
|
|
168
|
-
if (this.empty) {
|
|
169
|
-
this.renderer.addClass(this.elementRef.nativeElement, 'k-state-empty');
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
this.renderer.removeClass(this.elementRef.nativeElement, 'k-state-empty');
|
|
173
|
-
}
|
|
174
|
-
this.changeDetectorRef.markForCheck();
|
|
175
|
-
};
|
|
176
|
-
FloatingLabelComponent.prototype.setAriaLabelledby = function (component) {
|
|
177
|
-
var componentId = component.focusableId || component.id;
|
|
178
|
-
if (componentId) {
|
|
179
|
-
var focusableElement = this.elementRef.nativeElement.querySelector("#" + componentId);
|
|
180
|
-
this.renderer.setAttribute(focusableElement, 'aria-labelledby', this.labelId);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
FloatingLabelComponent.prototype.setLabelFor = function (control) {
|
|
184
|
-
var controlId = control.focusableId || control.id;
|
|
185
|
-
if (this.id && controlId) {
|
|
186
|
-
// input wins
|
|
187
|
-
this.id = controlId;
|
|
188
|
-
}
|
|
189
|
-
else if (this.id) {
|
|
190
|
-
control.focusableId = this.id;
|
|
191
|
-
}
|
|
192
|
-
else if (controlId) {
|
|
193
|
-
this.id = controlId;
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
var id = "k-" + kendo_angular_common_1.guid();
|
|
197
|
-
control.focusableId = id;
|
|
198
|
-
this.id = id;
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
FloatingLabelComponent.prototype.handleAutofill = function (control) {
|
|
202
|
-
var _this = this;
|
|
203
|
-
this.subscribe(control, 'autoFillStart', function () {
|
|
204
|
-
_this.autoFillStarted = true;
|
|
205
|
-
_this.renderer.removeClass(_this.elementRef.nativeElement, 'k-state-empty');
|
|
206
|
-
});
|
|
207
|
-
this.subscribe(control, 'autoFillEnd', function () {
|
|
208
|
-
if (_this.autoFillStarted) {
|
|
209
|
-
_this.autoFillStarted = false;
|
|
210
|
-
if (_this.empty) {
|
|
211
|
-
_this.renderer.addClass(_this.elementRef.nativeElement, 'k-state-empty');
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
FloatingLabelComponent.prototype.addHandlers = function (control) {
|
|
217
|
-
var _this = this;
|
|
218
|
-
var setFocus = function (isFocused) { return function () {
|
|
219
|
-
_this.focused = isFocused;
|
|
220
|
-
_this.updateState();
|
|
221
|
-
if (!_this.empty) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
if (kendo_angular_common_1.hasObservers(_this.positionChange)) {
|
|
225
|
-
_this.positionChange.emit(isFocused ? 'Out' : 'In');
|
|
226
|
-
}
|
|
227
|
-
}; };
|
|
228
|
-
this.subscribe(control, 'onFocus', setFocus(true));
|
|
229
|
-
this.subscribe(control, 'onBlur', setFocus(false));
|
|
230
|
-
this.handleAutofill(control);
|
|
231
|
-
var updateState = function () { return _this.updateState(); };
|
|
232
|
-
updateState();
|
|
233
|
-
this.subscribe(control, 'onValueChange', updateState);
|
|
234
|
-
};
|
|
235
|
-
FloatingLabelComponent.prototype.validateSetup = function () {
|
|
236
|
-
if (!this.formControl && !this.kendoInput) {
|
|
237
|
-
if (core_1.isDevMode()) {
|
|
238
|
-
throw new Error("The FloatingLabelComponent requires a Kendo Input component" +
|
|
239
|
-
" or a forms-bound component to function properly.");
|
|
240
|
-
}
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
tslib_1.__decorate([
|
|
245
|
-
core_1.HostBinding('class.k-floating-label-container'),
|
|
246
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
247
|
-
], FloatingLabelComponent.prototype, "hostClasses", void 0);
|
|
248
|
-
tslib_1.__decorate([
|
|
249
|
-
core_1.HostBinding('class.k-state-focused'),
|
|
250
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
251
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
252
|
-
], FloatingLabelComponent.prototype, "focusedClass", null);
|
|
253
|
-
tslib_1.__decorate([
|
|
254
|
-
core_1.HostBinding('class.k-state-invalid'),
|
|
255
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
256
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
257
|
-
], FloatingLabelComponent.prototype, "invalidClass", null);
|
|
258
|
-
tslib_1.__decorate([
|
|
259
|
-
core_1.HostBinding('attr.dir'),
|
|
260
|
-
tslib_1.__metadata("design:type", String)
|
|
261
|
-
], FloatingLabelComponent.prototype, "direction", void 0);
|
|
262
|
-
tslib_1.__decorate([
|
|
263
|
-
core_1.Input(),
|
|
264
|
-
tslib_1.__metadata("design:type", Object)
|
|
265
|
-
], FloatingLabelComponent.prototype, "labelCssStyle", void 0);
|
|
266
|
-
tslib_1.__decorate([
|
|
267
|
-
core_1.Input(),
|
|
268
|
-
tslib_1.__metadata("design:type", Object)
|
|
269
|
-
], FloatingLabelComponent.prototype, "labelCssClass", void 0);
|
|
270
|
-
tslib_1.__decorate([
|
|
271
|
-
core_1.Input(),
|
|
272
|
-
tslib_1.__metadata("design:type", String)
|
|
273
|
-
], FloatingLabelComponent.prototype, "id", void 0);
|
|
274
|
-
tslib_1.__decorate([
|
|
275
|
-
core_1.Input(),
|
|
276
|
-
tslib_1.__metadata("design:type", String)
|
|
277
|
-
], FloatingLabelComponent.prototype, "text", void 0);
|
|
278
|
-
tslib_1.__decorate([
|
|
279
|
-
core_1.Input(),
|
|
280
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
281
|
-
], FloatingLabelComponent.prototype, "optional", void 0);
|
|
282
|
-
tslib_1.__decorate([
|
|
283
|
-
core_1.Output(),
|
|
284
|
-
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
285
|
-
], FloatingLabelComponent.prototype, "positionChange", void 0);
|
|
286
|
-
tslib_1.__decorate([
|
|
287
|
-
core_1.ContentChild(kendo_angular_common_1.KendoInput, { static: false }),
|
|
288
|
-
tslib_1.__metadata("design:type", Object)
|
|
289
|
-
], FloatingLabelComponent.prototype, "kendoInput", void 0);
|
|
290
|
-
tslib_1.__decorate([
|
|
291
|
-
core_1.ContentChild(forms_1.NgControl, { static: false }),
|
|
292
|
-
tslib_1.__metadata("design:type", forms_1.NgControl)
|
|
293
|
-
], FloatingLabelComponent.prototype, "formControl", void 0);
|
|
294
|
-
FloatingLabelComponent = tslib_1.__decorate([
|
|
295
|
-
core_1.Component({
|
|
296
|
-
selector: 'kendo-floatinglabel',
|
|
297
|
-
exportAs: 'kendoFloatingLabel',
|
|
298
|
-
providers: [
|
|
299
|
-
kendo_angular_l10n_1.LocalizationService,
|
|
300
|
-
{
|
|
301
|
-
provide: kendo_angular_l10n_1.L10N_PREFIX,
|
|
302
|
-
useValue: 'kendo.floatinglabel'
|
|
303
|
-
}
|
|
304
|
-
],
|
|
305
|
-
template: "\n <ng-container kendoFloatingLabelLocalizedMessages\n i18n-optional=\"kendo.floatinglabel.optional|The text for the optional segment of a FloatingLabel component\"\n optional=\"Optional\"\n >\n </ng-container>\n <ng-content></ng-content>\n <label *ngIf=\"text\" [ngClass]=\"labelCssClass\" [ngStyle]=\"labelCssStyle\" [for]=\"id\" [attr.id]=\"labelId\" class=\"k-label\">\n {{ text }}<span *ngIf=\"optional\" class=\"k-label-optional\">({{textFor('optional')}})</span>\n </label>\n "
|
|
306
|
-
}),
|
|
307
|
-
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
|
|
308
|
-
core_1.Renderer2,
|
|
309
|
-
core_1.ChangeDetectorRef,
|
|
310
|
-
kendo_angular_l10n_1.LocalizationService])
|
|
311
|
-
], FloatingLabelComponent);
|
|
312
|
-
return FloatingLabelComponent;
|
|
313
|
-
}());
|
|
314
|
-
exports.FloatingLabelComponent = FloatingLabelComponent;
|
|
@@ -1,54 +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
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
var tslib_1 = require("tslib");
|
|
8
|
-
var core_1 = require("@angular/core");
|
|
9
|
-
var common_1 = require("@angular/common");
|
|
10
|
-
var shared_module_1 = require("./../shared.module");
|
|
11
|
-
var floating_label_component_1 = require("./floating-label.component");
|
|
12
|
-
var COMPONENT_DIRECTIVES = [floating_label_component_1.FloatingLabelComponent];
|
|
13
|
-
/**
|
|
14
|
-
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
15
|
-
* definition for the TextBox directive.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* ```ts-no-run
|
|
20
|
-
*
|
|
21
|
-
* // The browser platform with a compiler
|
|
22
|
-
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
23
|
-
*
|
|
24
|
-
* import { NgModule } from '@angular/core';
|
|
25
|
-
*
|
|
26
|
-
* // Import the app component
|
|
27
|
-
* import { AppComponent } from './app.component';
|
|
28
|
-
*
|
|
29
|
-
* // Define the app module
|
|
30
|
-
* _@NgModule({
|
|
31
|
-
* declarations: [AppComponent], // declare app component
|
|
32
|
-
* imports: [BrowserModule, FloatingLabelModule], // import FloatingLabel module
|
|
33
|
-
* bootstrap: [AppComponent]
|
|
34
|
-
* })
|
|
35
|
-
* export class AppModule {}
|
|
36
|
-
*
|
|
37
|
-
* // Compile and launch the module
|
|
38
|
-
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
39
|
-
*
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
var FloatingLabelModule = /** @class */ (function () {
|
|
43
|
-
function FloatingLabelModule() {
|
|
44
|
-
}
|
|
45
|
-
FloatingLabelModule = tslib_1.__decorate([
|
|
46
|
-
core_1.NgModule({
|
|
47
|
-
declarations: COMPONENT_DIRECTIVES.slice(),
|
|
48
|
-
exports: COMPONENT_DIRECTIVES.concat([shared_module_1.SharedDirectivesModule]),
|
|
49
|
-
imports: [common_1.CommonModule, shared_module_1.SharedDirectivesModule]
|
|
50
|
-
})
|
|
51
|
-
], FloatingLabelModule);
|
|
52
|
-
return FloatingLabelModule;
|
|
53
|
-
}());
|
|
54
|
-
exports.FloatingLabelModule = FloatingLabelModule;
|
|
@@ -1,6 +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
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/npm/index.js
DELETED
|
@@ -1,17 +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
|
-
"use strict";
|
|
6
|
-
/**
|
|
7
|
-
* Generated bundle index. Do not edit.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
var tslib_1 = require("tslib");
|
|
11
|
-
tslib_1.__exportStar(require("./main"), exports);
|
|
12
|
-
var localized_messages_directive_1 = require("./localization/localized-messages.directive");
|
|
13
|
-
exports.LocalizedMessagesDirective = localized_messages_directive_1.LocalizedMessagesDirective
|
|
14
|
-
var messages_1 = require("./localization/messages");
|
|
15
|
-
exports.Messages = messages_1.Messages
|
|
16
|
-
var shared_module_1 = require("./shared.module");
|
|
17
|
-
exports.SharedDirectivesModule = shared_module_1.SharedDirectivesModule
|
|
@@ -1,139 +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
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
var tslib_1 = require("tslib");
|
|
8
|
-
var core_1 = require("@angular/core");
|
|
9
|
-
var rxjs_1 = require("rxjs");
|
|
10
|
-
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
11
|
-
var kendo_angular_common_1 = require("@progress/kendo-angular-common");
|
|
12
|
-
var kendo_licensing_1 = require("@progress/kendo-licensing");
|
|
13
|
-
var package_metadata_1 = require("../package-metadata");
|
|
14
|
-
var label_directive_1 = require("./../label.directive");
|
|
15
|
-
var util_1 = require("./../util");
|
|
16
|
-
/**
|
|
17
|
-
* Represents the [Kendo UI Label component for Angular]({% slug label_basic %}).
|
|
18
|
-
*
|
|
19
|
-
* Associates a label with input elements or components.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
*
|
|
24
|
-
* _@Component({
|
|
25
|
-
* selector: 'my-app',
|
|
26
|
-
* template: `
|
|
27
|
-
* <kendo-label [for]="input" text="First name">
|
|
28
|
-
* <input [(ngModel)]="name" kendoTextBox #input />
|
|
29
|
-
* </kendo-label>
|
|
30
|
-
* `
|
|
31
|
-
* })
|
|
32
|
-
* class AppComponent {
|
|
33
|
-
* public name = 'John';
|
|
34
|
-
* }
|
|
35
|
-
*
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
var LabelComponent = /** @class */ (function () {
|
|
39
|
-
function LabelComponent(elementRef, renderer, localization) {
|
|
40
|
-
this.elementRef = elementRef;
|
|
41
|
-
this.renderer = renderer;
|
|
42
|
-
this.localization = localization;
|
|
43
|
-
this.subscriptions = new rxjs_1.Subscription();
|
|
44
|
-
kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
|
|
45
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
46
|
-
this.renderer.removeAttribute(this.elementRef.nativeElement, 'id');
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @hidden
|
|
50
|
-
*/
|
|
51
|
-
LabelComponent.prototype.ngAfterContentInit = function () {
|
|
52
|
-
if (this.for) {
|
|
53
|
-
this.control = this.for;
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
var wrappedNativeInput = util_1.getWrappedNativeInput(this.elementRef.nativeElement);
|
|
57
|
-
if (wrappedNativeInput) {
|
|
58
|
-
if (!wrappedNativeInput.hasAttribute('id')) {
|
|
59
|
-
this.renderer.setAttribute(wrappedNativeInput, 'id', "k-" + kendo_angular_common_1.guid());
|
|
60
|
-
}
|
|
61
|
-
this.control = wrappedNativeInput;
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
this.control = this.kendoInput;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* @hidden
|
|
68
|
-
*/
|
|
69
|
-
LabelComponent.prototype.ngOnInit = function () {
|
|
70
|
-
var _this = this;
|
|
71
|
-
this.subscriptions.add(this.localization.changes.subscribe(function (_a) {
|
|
72
|
-
var rtl = _a.rtl;
|
|
73
|
-
_this.direction = rtl ? 'rtl' : 'ltr';
|
|
74
|
-
}));
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* @hidden
|
|
78
|
-
*/
|
|
79
|
-
LabelComponent.prototype.ngAfterViewInit = function () {
|
|
80
|
-
this.labelDirective.setAriaLabelledby();
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* @hidden
|
|
84
|
-
*/
|
|
85
|
-
LabelComponent.prototype.ngOnDestroy = function () {
|
|
86
|
-
if (this.subscriptions) {
|
|
87
|
-
this.subscriptions.unsubscribe();
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* @hidden
|
|
92
|
-
*/
|
|
93
|
-
LabelComponent.prototype.textFor = function (key) {
|
|
94
|
-
return this.localization.get(key);
|
|
95
|
-
};
|
|
96
|
-
tslib_1.__decorate([
|
|
97
|
-
core_1.HostBinding('attr.dir'),
|
|
98
|
-
tslib_1.__metadata("design:type", String)
|
|
99
|
-
], LabelComponent.prototype, "direction", void 0);
|
|
100
|
-
tslib_1.__decorate([
|
|
101
|
-
core_1.Input(),
|
|
102
|
-
tslib_1.__metadata("design:type", String)
|
|
103
|
-
], LabelComponent.prototype, "text", void 0);
|
|
104
|
-
tslib_1.__decorate([
|
|
105
|
-
core_1.Input(),
|
|
106
|
-
tslib_1.__metadata("design:type", Object)
|
|
107
|
-
], LabelComponent.prototype, "for", void 0);
|
|
108
|
-
tslib_1.__decorate([
|
|
109
|
-
core_1.Input(),
|
|
110
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
111
|
-
], LabelComponent.prototype, "optional", void 0);
|
|
112
|
-
tslib_1.__decorate([
|
|
113
|
-
core_1.ViewChild(label_directive_1.LabelDirective, { static: true }),
|
|
114
|
-
tslib_1.__metadata("design:type", label_directive_1.LabelDirective)
|
|
115
|
-
], LabelComponent.prototype, "labelDirective", void 0);
|
|
116
|
-
tslib_1.__decorate([
|
|
117
|
-
core_1.ContentChild(kendo_angular_common_1.KendoInput, { static: true }),
|
|
118
|
-
tslib_1.__metadata("design:type", Object)
|
|
119
|
-
], LabelComponent.prototype, "kendoInput", void 0);
|
|
120
|
-
LabelComponent = tslib_1.__decorate([
|
|
121
|
-
core_1.Component({
|
|
122
|
-
selector: 'kendo-label',
|
|
123
|
-
exportAs: 'kendoLabel',
|
|
124
|
-
providers: [
|
|
125
|
-
kendo_angular_l10n_1.LocalizationService,
|
|
126
|
-
{
|
|
127
|
-
provide: kendo_angular_l10n_1.L10N_PREFIX,
|
|
128
|
-
useValue: 'kendo.label'
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
template: "\n <ng-container kendoLabelLocalizedMessages\n i18n-optional=\"kendo.label.optional|The text for the optional segment of a Label component\"\n optional=\"Optional\"\n >\n </ng-container>\n <label\n [for]=\"control\"\n [class.k-label-empty]=\"!text\">\n {{ text }}<span *ngIf=\"optional\" class=\"k-label-optional\">({{textFor('optional')}})</span>\n </label>\n <ng-content></ng-content>\n "
|
|
132
|
-
}),
|
|
133
|
-
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
|
|
134
|
-
core_1.Renderer2,
|
|
135
|
-
kendo_angular_l10n_1.LocalizationService])
|
|
136
|
-
], LabelComponent);
|
|
137
|
-
return LabelComponent;
|
|
138
|
-
}());
|
|
139
|
-
exports.LabelComponent = LabelComponent;
|