@progress/kendo-angular-label 4.0.2-dev.202211170802 → 11.0.0-develop.79
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/NOTICE.txt +3 -3
- package/{esm2015/floating-label/floating-label-input-adapter.js → esm2020/floating-label/floating-label-input-adapter.mjs} +1 -1
- package/{esm2015/floating-label/floating-label.component.js → esm2020/floating-label/floating-label.component.mjs} +9 -6
- package/{esm2015/floating-label/floating-label.module.js → esm2020/floating-label/floating-label.module.mjs} +5 -5
- package/{esm2015/floating-label/models/label-position.js → esm2020/floating-label/models/label-position.mjs} +1 -1
- package/{esm2015/main.js → esm2020/index.mjs} +1 -1
- package/{esm2015/label/label.component.js → esm2020/label/label.component.mjs} +5 -5
- package/{esm2015/label.directive.js → esm2020/label.directive.mjs} +5 -5
- package/{esm2015/label.module.js → esm2020/label.module.mjs} +5 -5
- package/{esm2015/localization/custom-messages.component.js → esm2020/localization/custom-messages.component.mjs} +5 -4
- package/{esm2015/localization/localized-messages.directive.js → esm2020/localization/localized-messages.directive.mjs} +5 -4
- package/{esm2015/localization/messages.js → esm2020/localization/messages.mjs} +4 -4
- package/{esm2015/package-metadata.js → esm2020/package-metadata.mjs} +3 -3
- package/{esm2015/kendo-angular-label.js → esm2020/progress-kendo-angular-label.mjs} +2 -2
- package/{esm2015/shared.module.js → esm2020/shared.module.mjs} +5 -5
- package/{esm2015/util.js → esm2020/util.mjs} +1 -1
- package/fesm2015/{kendo-angular-label.js → progress-kendo-angular-label.mjs} +36 -33
- package/fesm2020/progress-kendo-angular-label.mjs +870 -0
- package/floating-label/floating-label-input-adapter.d.ts +1 -1
- package/floating-label/floating-label.component.d.ts +1 -1
- package/floating-label/floating-label.module.d.ts +1 -1
- package/floating-label/models/label-position.d.ts +1 -1
- package/{main.d.ts → index.d.ts} +1 -1
- package/label/label.component.d.ts +1 -1
- package/label.directive.d.ts +1 -1
- package/label.module.d.ts +1 -1
- package/localization/custom-messages.component.d.ts +1 -1
- package/localization/localized-messages.directive.d.ts +1 -1
- package/localization/messages.d.ts +1 -1
- package/package-metadata.d.ts +1 -1
- package/package.json +29 -55
- package/{kendo-angular-label.d.ts → progress-kendo-angular-label.d.ts} +2 -2
- package/schematics/ngAdd/index.js +1 -5
- package/shared.module.d.ts +1 -1
- package/util.d.ts +1 -1
- package/bundles/kendo-angular-label.umd.js +0 -5
- package/schematics/ngAdd/index.js.map +0 -1
|
@@ -0,0 +1,870 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2022 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 i0 from '@angular/core';
|
|
6
|
+
import { Directive, Input, HostBinding, forwardRef, Component, NgModule, EventEmitter, isDevMode, Output, ContentChild, ViewChild } from '@angular/core';
|
|
7
|
+
import { isDocumentAvailable, guid, hasObservers, KendoInput } from '@progress/kendo-angular-common';
|
|
8
|
+
import * as i1 from '@progress/kendo-angular-l10n';
|
|
9
|
+
import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
10
|
+
import * as i3 from '@angular/common';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import { NgControl } from '@angular/forms';
|
|
13
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
14
|
+
import { Observable, Subscription } from 'rxjs';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
const isUploadComponent = (component) => component.wrapper && (component.wrapper.tagName === 'KENDO-UPLOAD' || component.wrapper.tagName === 'KENDO-FILESELECT');
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
const isInputElement = (component) => component instanceof HTMLElement;
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
const inputElementHasAttr = (element, attribute) => element.hasAttribute(attribute);
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
const getWrappedNativeInput = (element) => element.querySelector('kendo-label > input, kendo-label > textarea, kendo-label > select');
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
const getRootElement = (element) => {
|
|
36
|
+
if (!element) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
let rootElement = element;
|
|
40
|
+
while (rootElement.parentElement) {
|
|
41
|
+
rootElement = rootElement.parentElement;
|
|
42
|
+
}
|
|
43
|
+
return rootElement;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Represents the [Kendo UI Label directive for Angular]({% slug overview_label %}).
|
|
48
|
+
* The Label associates a focusable Angular component or an HTML element
|
|
49
|
+
* with a `label` tag by using the `[for]` property binding.
|
|
50
|
+
*
|
|
51
|
+
* To associate a component by using the `label` element, either:
|
|
52
|
+
* * Set the `[for]` property binding to a
|
|
53
|
+
* [template reference variable](link:site.data.urls.angular['templatesyntax']#template-reference-variables--var-), or
|
|
54
|
+
* * Set the `[for]` property binding to an `id` HTML string value.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* _@Component({
|
|
59
|
+
* selector: 'my-app',
|
|
60
|
+
* template: `
|
|
61
|
+
* <div class="row example-wrapper" style="min-height: 450px;">
|
|
62
|
+
* <div class="col-xs-12 col-md-6 example-col">
|
|
63
|
+
* <label [for]="datepicker">DatePicker: </label>
|
|
64
|
+
* <kendo-datepicker #datepicker></kendo-datepicker>
|
|
65
|
+
* </div>
|
|
66
|
+
*
|
|
67
|
+
* <div class="col-xs-12 col-md-6 example-col">
|
|
68
|
+
* <label for="input">Input: </label>
|
|
69
|
+
* <input id="input" />
|
|
70
|
+
* </div>
|
|
71
|
+
* </div>
|
|
72
|
+
* `
|
|
73
|
+
* })
|
|
74
|
+
* class AppComponent { }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
class LabelDirective {
|
|
78
|
+
constructor(label, renderer, zone) {
|
|
79
|
+
this.label = label;
|
|
80
|
+
this.renderer = renderer;
|
|
81
|
+
this.zone = zone;
|
|
82
|
+
this.labelClass = true;
|
|
83
|
+
this.handleClick = () => {
|
|
84
|
+
const component = this.getFocusableComponent();
|
|
85
|
+
if (!component) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (isUploadComponent(component)) {
|
|
89
|
+
component.fileSelect.nativeElement.click();
|
|
90
|
+
}
|
|
91
|
+
if (component.focus) {
|
|
92
|
+
component.focus();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
get labelFor() {
|
|
97
|
+
if (typeof this.for === 'string') {
|
|
98
|
+
return this.for;
|
|
99
|
+
}
|
|
100
|
+
if (!isDocumentAvailable()) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const component = this.getFocusableComponent() || {};
|
|
104
|
+
if (isInputElement(component) && !inputElementHasAttr(component, 'id')) {
|
|
105
|
+
this.renderer.setAttribute(component, 'id', `k-${guid()}`);
|
|
106
|
+
}
|
|
107
|
+
return component.focusableId || component.id || null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @hidden
|
|
111
|
+
*/
|
|
112
|
+
ngAfterViewInit() {
|
|
113
|
+
this.setAriaLabelledby();
|
|
114
|
+
this.zone.runOutsideAngular(() => this.clickListener = this.renderer.listen(this.label.nativeElement, 'click', this.handleClick));
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @hidden
|
|
118
|
+
*/
|
|
119
|
+
ngOnDestroy() {
|
|
120
|
+
if (this.clickListener) {
|
|
121
|
+
this.clickListener();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @hidden
|
|
126
|
+
*/
|
|
127
|
+
setAriaLabelledby() {
|
|
128
|
+
if (!isDocumentAvailable()) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const component = this.getFocusableComponent();
|
|
132
|
+
if (component && component.focusableId) {
|
|
133
|
+
const rootElement = getRootElement(this.label.nativeElement);
|
|
134
|
+
const labelTarget = rootElement.querySelector(`#${component.focusableId}`);
|
|
135
|
+
if (!labelTarget) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const labelElement = this.label.nativeElement;
|
|
139
|
+
const id = labelElement.id || `k-${guid()}`;
|
|
140
|
+
if (!labelElement.getAttribute('id')) {
|
|
141
|
+
this.renderer.setAttribute(labelElement, 'id', id);
|
|
142
|
+
}
|
|
143
|
+
this.renderer.setAttribute(labelTarget, 'aria-labelledby', id);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
getFocusableComponent() {
|
|
147
|
+
const target = this.for;
|
|
148
|
+
return target && target.focus !== undefined ? target : null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
LabelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LabelDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
152
|
+
LabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: LabelDirective, selector: "label[for]", inputs: { for: "for" }, host: { properties: { "attr.for": "this.labelFor", "class.k-label": "this.labelClass" } }, ngImport: i0 });
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LabelDirective, decorators: [{
|
|
154
|
+
type: Directive,
|
|
155
|
+
args: [{
|
|
156
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
157
|
+
selector: 'label[for]'
|
|
158
|
+
}]
|
|
159
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { for: [{
|
|
160
|
+
type: Input
|
|
161
|
+
}], labelFor: [{
|
|
162
|
+
type: HostBinding,
|
|
163
|
+
args: ['attr.for']
|
|
164
|
+
}], labelClass: [{
|
|
165
|
+
type: HostBinding,
|
|
166
|
+
args: ['class.k-label']
|
|
167
|
+
}] } });
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @hidden
|
|
171
|
+
*/
|
|
172
|
+
class Messages extends ComponentMessages {
|
|
173
|
+
}
|
|
174
|
+
Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
175
|
+
Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: Messages, selector: "kendo-label-messages-base", inputs: { optional: "optional" }, usesInheritance: true, ngImport: i0 });
|
|
176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: Messages, decorators: [{
|
|
177
|
+
type: Directive,
|
|
178
|
+
args: [{
|
|
179
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
180
|
+
selector: 'kendo-label-messages-base'
|
|
181
|
+
}]
|
|
182
|
+
}], propDecorators: { optional: [{
|
|
183
|
+
type: Input
|
|
184
|
+
}] } });
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @hidden
|
|
188
|
+
*/
|
|
189
|
+
class LocalizedMessagesDirective extends Messages {
|
|
190
|
+
constructor(service) {
|
|
191
|
+
super();
|
|
192
|
+
this.service = service;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
196
|
+
LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: LocalizedMessagesDirective, selector: "\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n ", providers: [
|
|
197
|
+
{
|
|
198
|
+
provide: Messages,
|
|
199
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
|
200
|
+
}
|
|
201
|
+
], usesInheritance: true, ngImport: i0 });
|
|
202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
|
203
|
+
type: Directive,
|
|
204
|
+
args: [{
|
|
205
|
+
providers: [
|
|
206
|
+
{
|
|
207
|
+
provide: Messages,
|
|
208
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
selector: `
|
|
212
|
+
[kendoLabelLocalizedMessages],
|
|
213
|
+
[kendoFloatingLabelLocalizedMessages]
|
|
214
|
+
`
|
|
215
|
+
}]
|
|
216
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Custom component messages override default component messages
|
|
220
|
+
* ([see example]({% slug label_globalization %}#toc-localization)).
|
|
221
|
+
*/
|
|
222
|
+
class CustomMessagesComponent extends Messages {
|
|
223
|
+
constructor(service) {
|
|
224
|
+
super();
|
|
225
|
+
this.service = service;
|
|
226
|
+
}
|
|
227
|
+
get override() {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
232
|
+
CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: CustomMessagesComponent, selector: "kendo-label-messages, kendo-floatinglabel-messages", providers: [
|
|
233
|
+
{
|
|
234
|
+
provide: Messages,
|
|
235
|
+
useExisting: forwardRef(() => CustomMessagesComponent)
|
|
236
|
+
}
|
|
237
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CustomMessagesComponent, decorators: [{
|
|
239
|
+
type: Component,
|
|
240
|
+
args: [{
|
|
241
|
+
providers: [
|
|
242
|
+
{
|
|
243
|
+
provide: Messages,
|
|
244
|
+
useExisting: forwardRef(() => CustomMessagesComponent)
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
selector: 'kendo-label-messages, kendo-floatinglabel-messages',
|
|
248
|
+
template: ``
|
|
249
|
+
}]
|
|
250
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|
|
251
|
+
|
|
252
|
+
const SHARED_DIRECTIVES = [
|
|
253
|
+
LocalizedMessagesDirective,
|
|
254
|
+
CustomMessagesComponent
|
|
255
|
+
];
|
|
256
|
+
/**
|
|
257
|
+
* @hidden
|
|
258
|
+
*/
|
|
259
|
+
class SharedDirectivesModule {
|
|
260
|
+
}
|
|
261
|
+
SharedDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SharedDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
262
|
+
SharedDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SharedDirectivesModule, declarations: [LocalizedMessagesDirective,
|
|
263
|
+
CustomMessagesComponent], exports: [LocalizedMessagesDirective,
|
|
264
|
+
CustomMessagesComponent] });
|
|
265
|
+
SharedDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SharedDirectivesModule });
|
|
266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SharedDirectivesModule, decorators: [{
|
|
267
|
+
type: NgModule,
|
|
268
|
+
args: [{
|
|
269
|
+
declarations: [SHARED_DIRECTIVES],
|
|
270
|
+
exports: [SHARED_DIRECTIVES]
|
|
271
|
+
}]
|
|
272
|
+
}] });
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @hidden
|
|
276
|
+
*/
|
|
277
|
+
const packageMetadata = {
|
|
278
|
+
name: '@progress/kendo-angular-label',
|
|
279
|
+
productName: 'Kendo UI for Angular',
|
|
280
|
+
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
281
|
+
publishDate: 1672320818,
|
|
282
|
+
version: '',
|
|
283
|
+
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @hidden
|
|
288
|
+
*/
|
|
289
|
+
class FloatingLabelInputAdapter {
|
|
290
|
+
constructor(component, formControl) {
|
|
291
|
+
this.component = component;
|
|
292
|
+
const isObservableOrEventEmitter = (event) => event instanceof Observable || event instanceof EventEmitter;
|
|
293
|
+
if (isObservableOrEventEmitter(component.onFocus)) {
|
|
294
|
+
this.onFocus = component.onFocus;
|
|
295
|
+
}
|
|
296
|
+
if (isObservableOrEventEmitter(component.autoFillStart)) {
|
|
297
|
+
this.autoFillStart = component.autoFillStart;
|
|
298
|
+
}
|
|
299
|
+
if (isObservableOrEventEmitter(component.autoFillEnd)) {
|
|
300
|
+
this.autoFillEnd = component.autoFillEnd;
|
|
301
|
+
}
|
|
302
|
+
if (isObservableOrEventEmitter(component.onBlur)) {
|
|
303
|
+
this.onBlur = component.onBlur;
|
|
304
|
+
}
|
|
305
|
+
if (formControl) {
|
|
306
|
+
this.onValueChange = formControl.valueChanges;
|
|
307
|
+
}
|
|
308
|
+
else if (component.onValueChange) {
|
|
309
|
+
this.onValueChange = component.onValueChange;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
get focusableId() {
|
|
313
|
+
const component = this.component;
|
|
314
|
+
if ('focusableId' in component) {
|
|
315
|
+
return component.focusableId;
|
|
316
|
+
}
|
|
317
|
+
else if ('id' in component) {
|
|
318
|
+
return component.id;
|
|
319
|
+
}
|
|
320
|
+
return "";
|
|
321
|
+
}
|
|
322
|
+
set focusableId(value) {
|
|
323
|
+
const component = this.component;
|
|
324
|
+
if ('focusableId' in component) {
|
|
325
|
+
component.focusableId = value;
|
|
326
|
+
}
|
|
327
|
+
else if ('id' in component) {
|
|
328
|
+
component.id = value;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const isFunction = (x) => Object.prototype.toString.call(x) === '[object Function]';
|
|
334
|
+
/**
|
|
335
|
+
* Represents the [Kendo UI FloatingLabel component for Angular]({% slug overview_floatinglabel %}).
|
|
336
|
+
* Provides floating labels to `input` elements.
|
|
337
|
+
*
|
|
338
|
+
* The FloatingLabel supports both Template and Reactive Forms and
|
|
339
|
+
* [can contain Kendo UI for Angular Input components such as `kendo-combobox` and `kendo-numerictextbox`,
|
|
340
|
+
* or HTML Input elements with the `kendoTextBox` directive applied](slug:overview_floatinglabel#toc-implementing-floating-labels).
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```ts
|
|
344
|
+
*
|
|
345
|
+
* _@Component({
|
|
346
|
+
* selector: 'my-app',
|
|
347
|
+
* template: `
|
|
348
|
+
* <kendo-floatinglabel text="First name">
|
|
349
|
+
* <input [(ngModel)]="name" kendoTextBox />
|
|
350
|
+
* </kendo-floatinglabel>
|
|
351
|
+
* `
|
|
352
|
+
* })
|
|
353
|
+
* class AppComponent {
|
|
354
|
+
* public name = 'John';
|
|
355
|
+
* }
|
|
356
|
+
*
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
class FloatingLabelComponent {
|
|
360
|
+
constructor(elementRef, renderer, changeDetectorRef, localization) {
|
|
361
|
+
this.elementRef = elementRef;
|
|
362
|
+
this.renderer = renderer;
|
|
363
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
364
|
+
this.localization = localization;
|
|
365
|
+
this.hostClasses = true;
|
|
366
|
+
/**
|
|
367
|
+
* Fires after the floating label position is changed.
|
|
368
|
+
*/
|
|
369
|
+
this.positionChange = new EventEmitter();
|
|
370
|
+
/**
|
|
371
|
+
* @hidden
|
|
372
|
+
*/
|
|
373
|
+
this.focused = false;
|
|
374
|
+
/**
|
|
375
|
+
* @hidden
|
|
376
|
+
*/
|
|
377
|
+
this.empty = true;
|
|
378
|
+
/**
|
|
379
|
+
* @hidden
|
|
380
|
+
*/
|
|
381
|
+
this.invalid = false;
|
|
382
|
+
/**
|
|
383
|
+
* @hidden
|
|
384
|
+
*/
|
|
385
|
+
this.labelId = `k-${guid()}`;
|
|
386
|
+
this.autoFillStarted = false;
|
|
387
|
+
validatePackage(packageMetadata);
|
|
388
|
+
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
389
|
+
this.renderer.removeAttribute(this.elementRef.nativeElement, "id");
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Represents the current floating label position.
|
|
393
|
+
*/
|
|
394
|
+
get labelPosition() {
|
|
395
|
+
if (!this.empty) {
|
|
396
|
+
return 'Out';
|
|
397
|
+
}
|
|
398
|
+
return this.focused ? 'Out' : 'In';
|
|
399
|
+
}
|
|
400
|
+
get focusedClass() {
|
|
401
|
+
return this.focused;
|
|
402
|
+
}
|
|
403
|
+
get invalidClass() {
|
|
404
|
+
return this.invalid;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* @hidden
|
|
408
|
+
*/
|
|
409
|
+
ngAfterContentInit() {
|
|
410
|
+
if (!isDocumentAvailable()) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
this.validateSetup();
|
|
414
|
+
const control = new FloatingLabelInputAdapter(this.kendoInput || this.formControl.valueAccessor, this.formControl);
|
|
415
|
+
this.addHandlers(control);
|
|
416
|
+
this.setLabelFor(control);
|
|
417
|
+
}
|
|
418
|
+
ngAfterViewInit() {
|
|
419
|
+
if (this.kendoInput) {
|
|
420
|
+
this.setAriaLabelledby(this.kendoInput);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* @hidden
|
|
425
|
+
*/
|
|
426
|
+
ngOnDestroy() {
|
|
427
|
+
if (this.subscription) {
|
|
428
|
+
this.subscription.unsubscribe();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* @hidden
|
|
433
|
+
*/
|
|
434
|
+
textFor(key) {
|
|
435
|
+
return this.localization.get(key);
|
|
436
|
+
}
|
|
437
|
+
subscribe(control, eventName, handler) {
|
|
438
|
+
if (control[eventName] instanceof EventEmitter) {
|
|
439
|
+
const subscription = control[eventName].subscribe(handler);
|
|
440
|
+
if (!this.subscription) {
|
|
441
|
+
this.subscription = subscription;
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.subscription.add(subscription);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
updateState() {
|
|
449
|
+
const empty = value => {
|
|
450
|
+
// zero is not an empty value (e.g., NumericTextBox)
|
|
451
|
+
if (value === 0 || value === false) {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
// empty arrays are an empty value (e.g., MultiSelect)
|
|
455
|
+
if (Array.isArray(value) && !value.length) {
|
|
456
|
+
return true;
|
|
457
|
+
}
|
|
458
|
+
return !value;
|
|
459
|
+
};
|
|
460
|
+
const formControl = this.formControl;
|
|
461
|
+
if (formControl) {
|
|
462
|
+
const valueAccessor = formControl.valueAccessor;
|
|
463
|
+
if (isFunction(valueAccessor.isEmpty)) {
|
|
464
|
+
this.empty = valueAccessor.isEmpty();
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
this.empty = empty(formControl.value);
|
|
468
|
+
}
|
|
469
|
+
this.invalid = formControl.invalid && (formControl.touched || formControl.dirty);
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
this.empty = isFunction(this.kendoInput.isEmpty) ?
|
|
473
|
+
this.kendoInput.isEmpty() : empty(this.kendoInput.value);
|
|
474
|
+
}
|
|
475
|
+
if (this.empty) {
|
|
476
|
+
this.renderer.addClass(this.elementRef.nativeElement, 'k-empty');
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
this.renderer.removeClass(this.elementRef.nativeElement, 'k-empty');
|
|
480
|
+
}
|
|
481
|
+
this.changeDetectorRef.markForCheck();
|
|
482
|
+
}
|
|
483
|
+
setAriaLabelledby(component) {
|
|
484
|
+
const componentId = component.focusableId || component.id;
|
|
485
|
+
if (componentId) {
|
|
486
|
+
const focusableElement = this.elementRef.nativeElement.querySelector(`#${componentId}`);
|
|
487
|
+
this.renderer.setAttribute(focusableElement, 'aria-labelledby', this.labelId);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
setLabelFor(control) {
|
|
491
|
+
const controlId = control.focusableId || control.id;
|
|
492
|
+
if (this.id && controlId) {
|
|
493
|
+
// input wins
|
|
494
|
+
this.id = controlId;
|
|
495
|
+
}
|
|
496
|
+
else if (this.id) {
|
|
497
|
+
control.focusableId = this.id;
|
|
498
|
+
}
|
|
499
|
+
else if (controlId) {
|
|
500
|
+
this.id = controlId;
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
const id = `k-${guid()}`;
|
|
504
|
+
control.focusableId = id;
|
|
505
|
+
this.id = id;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
handleAutofill(control) {
|
|
509
|
+
this.subscribe(control, 'autoFillStart', () => {
|
|
510
|
+
this.autoFillStarted = true;
|
|
511
|
+
this.renderer.removeClass(this.elementRef.nativeElement, 'k-empty');
|
|
512
|
+
});
|
|
513
|
+
this.subscribe(control, 'autoFillEnd', () => {
|
|
514
|
+
if (this.autoFillStarted) {
|
|
515
|
+
this.autoFillStarted = false;
|
|
516
|
+
if (this.empty) {
|
|
517
|
+
this.renderer.addClass(this.elementRef.nativeElement, 'k-empty');
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
addHandlers(control) {
|
|
523
|
+
const setFocus = (isFocused) => () => {
|
|
524
|
+
this.focused = isFocused;
|
|
525
|
+
this.updateState();
|
|
526
|
+
if (!this.empty) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (hasObservers(this.positionChange)) {
|
|
530
|
+
this.positionChange.emit(isFocused ? 'Out' : 'In');
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
this.subscribe(control, 'onFocus', setFocus(true));
|
|
534
|
+
this.subscribe(control, 'onBlur', setFocus(false));
|
|
535
|
+
this.handleAutofill(control);
|
|
536
|
+
const updateState = () => this.updateState();
|
|
537
|
+
updateState();
|
|
538
|
+
this.subscribe(control, 'onValueChange', updateState);
|
|
539
|
+
}
|
|
540
|
+
validateSetup() {
|
|
541
|
+
if (!this.formControl && !this.kendoInput) {
|
|
542
|
+
if (isDevMode()) {
|
|
543
|
+
throw new Error("The FloatingLabelComponent requires a Kendo Input component" +
|
|
544
|
+
" or a forms-bound component to function properly.");
|
|
545
|
+
}
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
FloatingLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FloatingLabelComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
551
|
+
FloatingLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: FloatingLabelComponent, selector: "kendo-floatinglabel", inputs: { labelCssStyle: "labelCssStyle", labelCssClass: "labelCssClass", id: "id", text: "text", optional: "optional" }, outputs: { positionChange: "positionChange" }, host: { properties: { "class.k-floating-label-container": "this.hostClasses", "class.k-focus": "this.focusedClass", "class.k-invalid": "this.invalidClass", "attr.dir": "this.direction" } }, providers: [
|
|
552
|
+
LocalizationService,
|
|
553
|
+
{
|
|
554
|
+
provide: L10N_PREFIX,
|
|
555
|
+
useValue: 'kendo.floatinglabel'
|
|
556
|
+
}
|
|
557
|
+
], queries: [{ propertyName: "kendoInput", first: true, predicate: KendoInput, descendants: true }, { propertyName: "formControl", first: true, predicate: NgControl, descendants: true }], exportAs: ["kendoFloatingLabel"], ngImport: i0, template: `
|
|
558
|
+
<ng-container kendoFloatingLabelLocalizedMessages
|
|
559
|
+
i18n-optional="kendo.floatinglabel.optional|The text for the optional segment of a FloatingLabel component"
|
|
560
|
+
optional="Optional"
|
|
561
|
+
>
|
|
562
|
+
</ng-container>
|
|
563
|
+
<ng-content></ng-content>
|
|
564
|
+
<label *ngIf="text" [ngClass]="labelCssClass" [ngStyle]="labelCssStyle" [for]="id" [attr.id]="labelId" class="k-label">
|
|
565
|
+
{{ text }}<span *ngIf="optional" class="k-label-optional">({{textFor('optional')}})</span>
|
|
566
|
+
</label>
|
|
567
|
+
`, isInline: true, directives: [{ type: LocalizedMessagesDirective, selector: "\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n " }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FloatingLabelComponent, decorators: [{
|
|
569
|
+
type: Component,
|
|
570
|
+
args: [{
|
|
571
|
+
selector: 'kendo-floatinglabel',
|
|
572
|
+
exportAs: 'kendoFloatingLabel',
|
|
573
|
+
providers: [
|
|
574
|
+
LocalizationService,
|
|
575
|
+
{
|
|
576
|
+
provide: L10N_PREFIX,
|
|
577
|
+
useValue: 'kendo.floatinglabel'
|
|
578
|
+
}
|
|
579
|
+
],
|
|
580
|
+
template: `
|
|
581
|
+
<ng-container kendoFloatingLabelLocalizedMessages
|
|
582
|
+
i18n-optional="kendo.floatinglabel.optional|The text for the optional segment of a FloatingLabel component"
|
|
583
|
+
optional="Optional"
|
|
584
|
+
>
|
|
585
|
+
</ng-container>
|
|
586
|
+
<ng-content></ng-content>
|
|
587
|
+
<label *ngIf="text" [ngClass]="labelCssClass" [ngStyle]="labelCssStyle" [for]="id" [attr.id]="labelId" class="k-label">
|
|
588
|
+
{{ text }}<span *ngIf="optional" class="k-label-optional">({{textFor('optional')}})</span>
|
|
589
|
+
</label>
|
|
590
|
+
`
|
|
591
|
+
}]
|
|
592
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }]; }, propDecorators: { hostClasses: [{
|
|
593
|
+
type: HostBinding,
|
|
594
|
+
args: ['class.k-floating-label-container']
|
|
595
|
+
}], focusedClass: [{
|
|
596
|
+
type: HostBinding,
|
|
597
|
+
args: ['class.k-focus']
|
|
598
|
+
}], invalidClass: [{
|
|
599
|
+
type: HostBinding,
|
|
600
|
+
args: ['class.k-invalid']
|
|
601
|
+
}], direction: [{
|
|
602
|
+
type: HostBinding,
|
|
603
|
+
args: ['attr.dir']
|
|
604
|
+
}], labelCssStyle: [{
|
|
605
|
+
type: Input
|
|
606
|
+
}], labelCssClass: [{
|
|
607
|
+
type: Input
|
|
608
|
+
}], id: [{
|
|
609
|
+
type: Input
|
|
610
|
+
}], text: [{
|
|
611
|
+
type: Input
|
|
612
|
+
}], optional: [{
|
|
613
|
+
type: Input
|
|
614
|
+
}], positionChange: [{
|
|
615
|
+
type: Output
|
|
616
|
+
}], kendoInput: [{
|
|
617
|
+
type: ContentChild,
|
|
618
|
+
args: [KendoInput, { static: false }]
|
|
619
|
+
}], formControl: [{
|
|
620
|
+
type: ContentChild,
|
|
621
|
+
args: [NgControl, { static: false }]
|
|
622
|
+
}] } });
|
|
623
|
+
|
|
624
|
+
const COMPONENT_DIRECTIVES$1 = [FloatingLabelComponent];
|
|
625
|
+
/**
|
|
626
|
+
* Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
|
|
627
|
+
* definition for the TextBox directive.
|
|
628
|
+
*
|
|
629
|
+
* @example
|
|
630
|
+
*
|
|
631
|
+
* ```ts-no-run
|
|
632
|
+
*
|
|
633
|
+
* // The browser platform with a compiler
|
|
634
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
635
|
+
*
|
|
636
|
+
* import { NgModule } from '@angular/core';
|
|
637
|
+
*
|
|
638
|
+
* // Import the app component
|
|
639
|
+
* import { AppComponent } from './app.component';
|
|
640
|
+
*
|
|
641
|
+
* // Define the app module
|
|
642
|
+
* _@NgModule({
|
|
643
|
+
* declarations: [AppComponent], // declare app component
|
|
644
|
+
* imports: [BrowserModule, FloatingLabelModule], // import FloatingLabel module
|
|
645
|
+
* bootstrap: [AppComponent]
|
|
646
|
+
* })
|
|
647
|
+
* export class AppModule {}
|
|
648
|
+
*
|
|
649
|
+
* // Compile and launch the module
|
|
650
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
651
|
+
*
|
|
652
|
+
* ```
|
|
653
|
+
*/
|
|
654
|
+
class FloatingLabelModule {
|
|
655
|
+
}
|
|
656
|
+
FloatingLabelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FloatingLabelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
657
|
+
FloatingLabelModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FloatingLabelModule, declarations: [FloatingLabelComponent], imports: [CommonModule, SharedDirectivesModule], exports: [FloatingLabelComponent, SharedDirectivesModule] });
|
|
658
|
+
FloatingLabelModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FloatingLabelModule, imports: [[CommonModule, SharedDirectivesModule], SharedDirectivesModule] });
|
|
659
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FloatingLabelModule, decorators: [{
|
|
660
|
+
type: NgModule,
|
|
661
|
+
args: [{
|
|
662
|
+
declarations: [...COMPONENT_DIRECTIVES$1],
|
|
663
|
+
exports: [...COMPONENT_DIRECTIVES$1, SharedDirectivesModule],
|
|
664
|
+
imports: [CommonModule, SharedDirectivesModule]
|
|
665
|
+
}]
|
|
666
|
+
}] });
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Represents the [Kendo UI Label component for Angular]({% slug overview_label %}).
|
|
670
|
+
*
|
|
671
|
+
* Associates a label with input elements or components.
|
|
672
|
+
*
|
|
673
|
+
* @example
|
|
674
|
+
* ```ts
|
|
675
|
+
*
|
|
676
|
+
* _@Component({
|
|
677
|
+
* selector: 'my-app',
|
|
678
|
+
* template: `
|
|
679
|
+
* <kendo-label [for]="input" text="First name">
|
|
680
|
+
* <input [(ngModel)]="name" kendoTextBox #input />
|
|
681
|
+
* </kendo-label>
|
|
682
|
+
* `
|
|
683
|
+
* })
|
|
684
|
+
* class AppComponent {
|
|
685
|
+
* public name = 'John';
|
|
686
|
+
* }
|
|
687
|
+
*
|
|
688
|
+
* ```
|
|
689
|
+
*/
|
|
690
|
+
class LabelComponent {
|
|
691
|
+
constructor(elementRef, renderer, localization) {
|
|
692
|
+
this.elementRef = elementRef;
|
|
693
|
+
this.renderer = renderer;
|
|
694
|
+
this.localization = localization;
|
|
695
|
+
this.subscriptions = new Subscription();
|
|
696
|
+
validatePackage(packageMetadata);
|
|
697
|
+
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
698
|
+
this.renderer.removeAttribute(this.elementRef.nativeElement, 'id');
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* @hidden
|
|
702
|
+
*/
|
|
703
|
+
ngAfterContentInit() {
|
|
704
|
+
if (this.for) {
|
|
705
|
+
this.control = this.for;
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
const wrappedNativeInput = getWrappedNativeInput(this.elementRef.nativeElement);
|
|
709
|
+
if (wrappedNativeInput) {
|
|
710
|
+
if (!wrappedNativeInput.hasAttribute('id')) {
|
|
711
|
+
this.renderer.setAttribute(wrappedNativeInput, 'id', `k-${guid()}`);
|
|
712
|
+
}
|
|
713
|
+
this.control = wrappedNativeInput;
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
this.control = this.kendoInput;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* @hidden
|
|
720
|
+
*/
|
|
721
|
+
ngOnInit() {
|
|
722
|
+
this.subscriptions.add(this.localization.changes.subscribe(({ rtl }) => {
|
|
723
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
|
724
|
+
}));
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* @hidden
|
|
728
|
+
*/
|
|
729
|
+
ngAfterViewInit() {
|
|
730
|
+
this.labelDirective.setAriaLabelledby();
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* @hidden
|
|
734
|
+
*/
|
|
735
|
+
ngOnDestroy() {
|
|
736
|
+
if (this.subscriptions) {
|
|
737
|
+
this.subscriptions.unsubscribe();
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* @hidden
|
|
742
|
+
*/
|
|
743
|
+
textFor(key) {
|
|
744
|
+
return this.localization.get(key);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
LabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LabelComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
748
|
+
LabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: LabelComponent, selector: "kendo-label", inputs: { text: "text", for: "for", optional: "optional" }, host: { properties: { "attr.dir": "this.direction" } }, providers: [
|
|
749
|
+
LocalizationService,
|
|
750
|
+
{
|
|
751
|
+
provide: L10N_PREFIX,
|
|
752
|
+
useValue: 'kendo.label'
|
|
753
|
+
}
|
|
754
|
+
], queries: [{ propertyName: "kendoInput", first: true, predicate: KendoInput, descendants: true, static: true }], viewQueries: [{ propertyName: "labelDirective", first: true, predicate: LabelDirective, descendants: true, static: true }], exportAs: ["kendoLabel"], ngImport: i0, template: `
|
|
755
|
+
<ng-container kendoLabelLocalizedMessages
|
|
756
|
+
i18n-optional="kendo.label.optional|The text for the optional segment of a Label component"
|
|
757
|
+
optional="Optional"
|
|
758
|
+
>
|
|
759
|
+
</ng-container>
|
|
760
|
+
<label
|
|
761
|
+
[for]="control"
|
|
762
|
+
[class.k-label-empty]="!text">
|
|
763
|
+
{{ text }}<span *ngIf="optional" class="k-label-optional">({{textFor('optional')}})</span>
|
|
764
|
+
</label>
|
|
765
|
+
<ng-content></ng-content>
|
|
766
|
+
`, isInline: true, directives: [{ type: LocalizedMessagesDirective, selector: "\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n " }, { type: LabelDirective, selector: "label[for]", inputs: ["for"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
767
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LabelComponent, decorators: [{
|
|
768
|
+
type: Component,
|
|
769
|
+
args: [{
|
|
770
|
+
selector: 'kendo-label',
|
|
771
|
+
exportAs: 'kendoLabel',
|
|
772
|
+
providers: [
|
|
773
|
+
LocalizationService,
|
|
774
|
+
{
|
|
775
|
+
provide: L10N_PREFIX,
|
|
776
|
+
useValue: 'kendo.label'
|
|
777
|
+
}
|
|
778
|
+
],
|
|
779
|
+
template: `
|
|
780
|
+
<ng-container kendoLabelLocalizedMessages
|
|
781
|
+
i18n-optional="kendo.label.optional|The text for the optional segment of a Label component"
|
|
782
|
+
optional="Optional"
|
|
783
|
+
>
|
|
784
|
+
</ng-container>
|
|
785
|
+
<label
|
|
786
|
+
[for]="control"
|
|
787
|
+
[class.k-label-empty]="!text">
|
|
788
|
+
{{ text }}<span *ngIf="optional" class="k-label-optional">({{textFor('optional')}})</span>
|
|
789
|
+
</label>
|
|
790
|
+
<ng-content></ng-content>
|
|
791
|
+
`
|
|
792
|
+
}]
|
|
793
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }]; }, propDecorators: { direction: [{
|
|
794
|
+
type: HostBinding,
|
|
795
|
+
args: ['attr.dir']
|
|
796
|
+
}], text: [{
|
|
797
|
+
type: Input
|
|
798
|
+
}], for: [{
|
|
799
|
+
type: Input
|
|
800
|
+
}], optional: [{
|
|
801
|
+
type: Input
|
|
802
|
+
}], labelDirective: [{
|
|
803
|
+
type: ViewChild,
|
|
804
|
+
args: [LabelDirective, { static: true }]
|
|
805
|
+
}], kendoInput: [{
|
|
806
|
+
type: ContentChild,
|
|
807
|
+
args: [KendoInput, { static: true }]
|
|
808
|
+
}] } });
|
|
809
|
+
|
|
810
|
+
const COMPONENT_DIRECTIVES = [
|
|
811
|
+
LabelDirective,
|
|
812
|
+
LabelComponent
|
|
813
|
+
];
|
|
814
|
+
/**
|
|
815
|
+
* The exported package module.
|
|
816
|
+
*
|
|
817
|
+
* The package exports:
|
|
818
|
+
* - `LabelDirective`—The Label directive class.
|
|
819
|
+
* - `LabelComponent`—The Label component class
|
|
820
|
+
* - `FLoatingLabel`—The FloatingLabel component class.
|
|
821
|
+
*
|
|
822
|
+
* @example
|
|
823
|
+
*
|
|
824
|
+
* ```ts-no-run
|
|
825
|
+
* // Import the Label module
|
|
826
|
+
* import { LabelModule } from '@progress/kendo-angular-label';
|
|
827
|
+
*
|
|
828
|
+
* // The browser platform with a compiler
|
|
829
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
830
|
+
*
|
|
831
|
+
* import { NgModule } from '@angular/core';
|
|
832
|
+
*
|
|
833
|
+
* // Import the app component
|
|
834
|
+
* import { AppComponent } from './app.component';
|
|
835
|
+
*
|
|
836
|
+
* // Define the app module
|
|
837
|
+
* _@NgModule({
|
|
838
|
+
* declarations: [AppComponent], // declare app component
|
|
839
|
+
* imports: [BrowserModule, LabelModule], // import Label module
|
|
840
|
+
* bootstrap: [AppComponent]
|
|
841
|
+
* })
|
|
842
|
+
* export class AppModule {}
|
|
843
|
+
*
|
|
844
|
+
* // Compile and launch the module
|
|
845
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
846
|
+
*
|
|
847
|
+
* ```
|
|
848
|
+
*/
|
|
849
|
+
class LabelModule {
|
|
850
|
+
}
|
|
851
|
+
LabelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LabelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
852
|
+
LabelModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LabelModule, declarations: [LabelDirective,
|
|
853
|
+
LabelComponent], imports: [CommonModule, SharedDirectivesModule], exports: [LabelDirective,
|
|
854
|
+
LabelComponent, FloatingLabelModule, SharedDirectivesModule] });
|
|
855
|
+
LabelModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LabelModule, imports: [[CommonModule, SharedDirectivesModule], FloatingLabelModule, SharedDirectivesModule] });
|
|
856
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LabelModule, decorators: [{
|
|
857
|
+
type: NgModule,
|
|
858
|
+
args: [{
|
|
859
|
+
imports: [CommonModule, SharedDirectivesModule],
|
|
860
|
+
declarations: [...COMPONENT_DIRECTIVES],
|
|
861
|
+
exports: [...COMPONENT_DIRECTIVES, FloatingLabelModule, SharedDirectivesModule]
|
|
862
|
+
}]
|
|
863
|
+
}] });
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* Generated bundle index. Do not edit.
|
|
867
|
+
*/
|
|
868
|
+
|
|
869
|
+
export { CustomMessagesComponent, FloatingLabelComponent, FloatingLabelModule, LabelComponent, LabelDirective, LabelModule, LocalizedMessagesDirective, SharedDirectivesModule };
|
|
870
|
+
|