@progress/kendo-angular-label 21.4.1 → 22.0.0-develop.1
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/fesm2022/progress-kendo-angular-label.mjs +29 -29
- package/localization/messages.d.ts +1 -1
- package/package.json +10 -18
- package/esm2022/directives.mjs +0 -45
- package/esm2022/floating-label/floating-label-input-adapter.mjs +0 -58
- package/esm2022/floating-label/floating-label.component.mjs +0 -354
- package/esm2022/floating-label/floating-label.module.mjs +0 -37
- package/esm2022/floating-label/models/label-position.mjs +0 -5
- package/esm2022/index.mjs +0 -12
- package/esm2022/label/label.component.mjs +0 -237
- package/esm2022/label.directive.mjs +0 -157
- package/esm2022/label.module.mjs +0 -45
- package/esm2022/localization/custom-messages.component.mjs +0 -44
- package/esm2022/localization/localized-messages.directive.mjs +0 -42
- package/esm2022/localization/messages.mjs +0 -27
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-label.mjs +0 -8
- package/esm2022/util.mjs +0 -33
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { ContentChild, Component, ElementRef, EventEmitter, HostBinding, Input, Renderer2, isDevMode, ChangeDetectorRef, Output } from '@angular/core';
|
|
6
|
-
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
7
|
-
import { NgControl } from '@angular/forms';
|
|
8
|
-
import { guid, KendoInput, hasObservers, isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
9
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
|
-
import { packageMetadata } from '../package-metadata';
|
|
11
|
-
import { FloatingLabelInputAdapter } from './floating-label-input-adapter';
|
|
12
|
-
import { nativeLabelForTargets } from '../util';
|
|
13
|
-
import { NgClass, NgStyle } from '@angular/common';
|
|
14
|
-
import { LocalizedMessagesDirective } from '../localization/localized-messages.directive';
|
|
15
|
-
import * as i0 from "@angular/core";
|
|
16
|
-
import * as i1 from "@progress/kendo-angular-l10n";
|
|
17
|
-
const isFunction = (x) => Object.prototype.toString.call(x) === '[object Function]';
|
|
18
|
-
/**
|
|
19
|
-
* Represents the [Kendo UI FloatingLabel component for Angular]({% slug overview_floatinglabel %}).
|
|
20
|
-
* Use this component to provide floating labels to `input` elements.
|
|
21
|
-
*
|
|
22
|
-
* The FloatingLabel supports Template and Reactive Forms.
|
|
23
|
-
* You can use it with Kendo UI for Angular Inputs components such as `kendo-combobox`, `kendo-numerictextbox`, or `kendo-textbox`.
|
|
24
|
-
* [See example.](slug:associate_floatinglabel)
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```html
|
|
28
|
-
* <kendo-floatinglabel text="First name">
|
|
29
|
-
* <kendo-textbox></kendo-textbox>
|
|
30
|
-
* </kendo-floatinglabel>
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* Supported children components are: {@link CustomMessagesComponent}.
|
|
35
|
-
*/
|
|
36
|
-
export class FloatingLabelComponent {
|
|
37
|
-
elementRef;
|
|
38
|
-
renderer;
|
|
39
|
-
changeDetectorRef;
|
|
40
|
-
localization;
|
|
41
|
-
/**
|
|
42
|
-
* Gets the current floating label position.
|
|
43
|
-
*/
|
|
44
|
-
get labelPosition() {
|
|
45
|
-
if (!this.empty) {
|
|
46
|
-
return 'Out';
|
|
47
|
-
}
|
|
48
|
-
return this.focused ? 'Out' : 'In';
|
|
49
|
-
}
|
|
50
|
-
hostClasses = true;
|
|
51
|
-
get focusedClass() {
|
|
52
|
-
return this.focused;
|
|
53
|
-
}
|
|
54
|
-
get invalidClass() {
|
|
55
|
-
return this.invalid;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* @hidden
|
|
59
|
-
*/
|
|
60
|
-
direction;
|
|
61
|
-
/**
|
|
62
|
-
* Sets the CSS styles for the internal label element.
|
|
63
|
-
* Accepts values supported by the [`ngStyle`](link:site.data.urls.angular['ngstyleapi']) directive.
|
|
64
|
-
*/
|
|
65
|
-
labelCssStyle;
|
|
66
|
-
/**
|
|
67
|
-
* Sets the CSS classes for the label element.
|
|
68
|
-
* Accepts values supported by the [`ngClass`](link:site.data.urls.angular['ngclassapi']) directive.
|
|
69
|
-
*/
|
|
70
|
-
labelCssClass;
|
|
71
|
-
/**
|
|
72
|
-
* Sets the `id` attribute of the input inside the floating label.
|
|
73
|
-
*/
|
|
74
|
-
id;
|
|
75
|
-
/**
|
|
76
|
-
* Sets the text content of the floating label that describes the input.
|
|
77
|
-
*/
|
|
78
|
-
text;
|
|
79
|
-
/**
|
|
80
|
-
* Marks a form field as optional. When enabled, renders the `Optional` text by default.
|
|
81
|
-
* You can customize the text by providing a custom message ([see example]({% slug label_globalization %}#toc-custom-messages)).
|
|
82
|
-
*
|
|
83
|
-
* @default false
|
|
84
|
-
*/
|
|
85
|
-
optional;
|
|
86
|
-
/**
|
|
87
|
-
* Fires after the FloatingLabel position changes.
|
|
88
|
-
*/
|
|
89
|
-
positionChange = new EventEmitter();
|
|
90
|
-
kendoInput;
|
|
91
|
-
formControl;
|
|
92
|
-
/**
|
|
93
|
-
* @hidden
|
|
94
|
-
*/
|
|
95
|
-
focused = false;
|
|
96
|
-
/**
|
|
97
|
-
* @hidden
|
|
98
|
-
*/
|
|
99
|
-
empty = true;
|
|
100
|
-
/**
|
|
101
|
-
* @hidden
|
|
102
|
-
*/
|
|
103
|
-
invalid = false;
|
|
104
|
-
/**
|
|
105
|
-
* @hidden
|
|
106
|
-
*/
|
|
107
|
-
labelId = `k-${guid()}`;
|
|
108
|
-
subscription;
|
|
109
|
-
autoFillStarted = false;
|
|
110
|
-
constructor(elementRef, renderer, changeDetectorRef, localization) {
|
|
111
|
-
this.elementRef = elementRef;
|
|
112
|
-
this.renderer = renderer;
|
|
113
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
114
|
-
this.localization = localization;
|
|
115
|
-
validatePackage(packageMetadata);
|
|
116
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
117
|
-
this.renderer.removeAttribute(this.elementRef.nativeElement, "id");
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* @hidden
|
|
121
|
-
*/
|
|
122
|
-
ngAfterContentInit() {
|
|
123
|
-
if (!isDocumentAvailable()) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
this.validateSetup();
|
|
127
|
-
const control = new FloatingLabelInputAdapter(this.kendoInput || this.formControl.valueAccessor, this.formControl);
|
|
128
|
-
this.addHandlers(control);
|
|
129
|
-
this.setLabelFor(control);
|
|
130
|
-
}
|
|
131
|
-
ngAfterViewInit() {
|
|
132
|
-
if (this.kendoInput) {
|
|
133
|
-
this.setAriaLabelledby(this.kendoInput);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* @hidden
|
|
138
|
-
*/
|
|
139
|
-
ngOnDestroy() {
|
|
140
|
-
if (this.subscription) {
|
|
141
|
-
this.subscription.unsubscribe();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* @hidden
|
|
146
|
-
*/
|
|
147
|
-
textFor(key) {
|
|
148
|
-
return this.localization.get(key);
|
|
149
|
-
}
|
|
150
|
-
subscribe(control, eventName, handler) {
|
|
151
|
-
if (control[eventName] instanceof EventEmitter) {
|
|
152
|
-
const subscription = control[eventName].subscribe(handler);
|
|
153
|
-
if (!this.subscription) {
|
|
154
|
-
this.subscription = subscription;
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
this.subscription.add(subscription);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
updateState() {
|
|
162
|
-
const empty = value => {
|
|
163
|
-
// zero is not an empty value (e.g., NumericTextBox)
|
|
164
|
-
if (value === 0 || value === false) {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
// empty arrays are an empty value (e.g., MultiSelect)
|
|
168
|
-
if (Array.isArray(value) && !value.length) {
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
return !value;
|
|
172
|
-
};
|
|
173
|
-
const formControl = this.formControl;
|
|
174
|
-
if (formControl) {
|
|
175
|
-
const valueAccessor = formControl.valueAccessor;
|
|
176
|
-
if (isFunction(valueAccessor.isEmpty)) {
|
|
177
|
-
this.empty = valueAccessor.isEmpty();
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
this.empty = empty(formControl.value);
|
|
181
|
-
}
|
|
182
|
-
this.invalid = formControl.invalid && (formControl.touched || formControl.dirty);
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
this.empty = isFunction(this.kendoInput.isEmpty) ?
|
|
186
|
-
this.kendoInput.isEmpty() : empty(this.kendoInput.value);
|
|
187
|
-
}
|
|
188
|
-
if (this.empty) {
|
|
189
|
-
this.renderer.addClass(this.elementRef.nativeElement, 'k-empty');
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
this.renderer.removeClass(this.elementRef.nativeElement, 'k-empty');
|
|
193
|
-
}
|
|
194
|
-
this.changeDetectorRef.markForCheck();
|
|
195
|
-
}
|
|
196
|
-
setAriaLabelledby(component) {
|
|
197
|
-
const componentId = component.focusableId || component.id;
|
|
198
|
-
if (componentId) {
|
|
199
|
-
const focusableElement = this.elementRef.nativeElement.querySelector(`#${componentId}`);
|
|
200
|
-
if (!focusableElement) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
const existingAriaLabelledBy = focusableElement.hasAttribute('aria-labelledby') && focusableElement.getAttribute('aria-labelledby');
|
|
204
|
-
// DropDowns with focusable input elements rely on the aria-labelledby attribute to set the same attribute on their popup listbox element.
|
|
205
|
-
// On the other hand, the aria-labelledby attribute is redundant on the Input element when there is label[for] association -
|
|
206
|
-
// https://feedback.telerik.com/kendo-angular-ui/1648203-remove-aria-labelledby-when-native-html-elements-are-associated.
|
|
207
|
-
// This addresses both cases, setting a special data-kendo-label-id attribute to be used internally by other components when the aria-describedby one is not applicable.
|
|
208
|
-
this.renderer.setAttribute(focusableElement, nativeLabelForTargets.includes(focusableElement.tagName) ?
|
|
209
|
-
'data-kendo-label-id' : 'aria-labelledby', existingAriaLabelledBy && existingAriaLabelledBy !== this.labelId ? `${existingAriaLabelledBy} ${this.labelId}` : this.labelId);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
setLabelFor(control) {
|
|
213
|
-
const controlId = control.focusableId || control.id;
|
|
214
|
-
if (this.id && controlId) {
|
|
215
|
-
// input wins
|
|
216
|
-
this.id = controlId;
|
|
217
|
-
}
|
|
218
|
-
else if (this.id) {
|
|
219
|
-
control.focusableId = this.id;
|
|
220
|
-
}
|
|
221
|
-
else if (controlId) {
|
|
222
|
-
this.id = controlId;
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
const id = `k-${guid()}`;
|
|
226
|
-
control.focusableId = id;
|
|
227
|
-
this.id = id;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
handleAutofill(control) {
|
|
231
|
-
this.subscribe(control, 'autoFillStart', () => {
|
|
232
|
-
this.autoFillStarted = true;
|
|
233
|
-
this.renderer.removeClass(this.elementRef.nativeElement, 'k-empty');
|
|
234
|
-
});
|
|
235
|
-
this.subscribe(control, 'autoFillEnd', () => {
|
|
236
|
-
if (this.autoFillStarted) {
|
|
237
|
-
this.autoFillStarted = false;
|
|
238
|
-
if (this.empty) {
|
|
239
|
-
this.renderer.addClass(this.elementRef.nativeElement, 'k-empty');
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
addHandlers(control) {
|
|
245
|
-
const setFocus = (isFocused) => () => {
|
|
246
|
-
this.focused = isFocused;
|
|
247
|
-
this.updateState();
|
|
248
|
-
if (!this.empty) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (hasObservers(this.positionChange)) {
|
|
252
|
-
this.positionChange.emit(isFocused ? 'Out' : 'In');
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
this.subscribe(control, 'onFocus', setFocus(true));
|
|
256
|
-
this.subscribe(control, 'onBlur', setFocus(false));
|
|
257
|
-
this.handleAutofill(control);
|
|
258
|
-
const updateState = () => this.updateState();
|
|
259
|
-
updateState();
|
|
260
|
-
this.subscribe(control, 'onValueChange', updateState);
|
|
261
|
-
}
|
|
262
|
-
validateSetup() {
|
|
263
|
-
if (!this.formControl && !this.kendoInput) {
|
|
264
|
-
if (isDevMode()) {
|
|
265
|
-
throw new Error("The FloatingLabelComponent requires a Kendo Input component" +
|
|
266
|
-
" or a forms-bound component to function properly.");
|
|
267
|
-
}
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FloatingLabelComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
272
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: FloatingLabelComponent, isStandalone: true, 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: [
|
|
273
|
-
LocalizationService,
|
|
274
|
-
{
|
|
275
|
-
provide: L10N_PREFIX,
|
|
276
|
-
useValue: 'kendo.floatinglabel'
|
|
277
|
-
}
|
|
278
|
-
], queries: [{ propertyName: "kendoInput", first: true, predicate: KendoInput, descendants: true }, { propertyName: "formControl", first: true, predicate: NgControl, descendants: true }], exportAs: ["kendoFloatingLabel"], ngImport: i0, template: `
|
|
279
|
-
<ng-container kendoFloatingLabelLocalizedMessages
|
|
280
|
-
i18n-optional="kendo.floatinglabel.optional|The text for the optional segment of a FloatingLabel component"
|
|
281
|
-
optional="Optional"
|
|
282
|
-
>
|
|
283
|
-
</ng-container>
|
|
284
|
-
<ng-content></ng-content>
|
|
285
|
-
@if (text) {
|
|
286
|
-
<label [ngClass]="labelCssClass" [ngStyle]="labelCssStyle" [for]="id" [attr.id]="labelId" class="k-floating-label">
|
|
287
|
-
{{ text }}@if (optional) {
|
|
288
|
-
<span class="k-label-optional">({{textFor('optional')}})</span>
|
|
289
|
-
}
|
|
290
|
-
</label>
|
|
291
|
-
}
|
|
292
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n " }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
293
|
-
}
|
|
294
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FloatingLabelComponent, decorators: [{
|
|
295
|
-
type: Component,
|
|
296
|
-
args: [{
|
|
297
|
-
selector: 'kendo-floatinglabel',
|
|
298
|
-
exportAs: 'kendoFloatingLabel',
|
|
299
|
-
providers: [
|
|
300
|
-
LocalizationService,
|
|
301
|
-
{
|
|
302
|
-
provide: L10N_PREFIX,
|
|
303
|
-
useValue: 'kendo.floatinglabel'
|
|
304
|
-
}
|
|
305
|
-
],
|
|
306
|
-
template: `
|
|
307
|
-
<ng-container kendoFloatingLabelLocalizedMessages
|
|
308
|
-
i18n-optional="kendo.floatinglabel.optional|The text for the optional segment of a FloatingLabel component"
|
|
309
|
-
optional="Optional"
|
|
310
|
-
>
|
|
311
|
-
</ng-container>
|
|
312
|
-
<ng-content></ng-content>
|
|
313
|
-
@if (text) {
|
|
314
|
-
<label [ngClass]="labelCssClass" [ngStyle]="labelCssStyle" [for]="id" [attr.id]="labelId" class="k-floating-label">
|
|
315
|
-
{{ text }}@if (optional) {
|
|
316
|
-
<span class="k-label-optional">({{textFor('optional')}})</span>
|
|
317
|
-
}
|
|
318
|
-
</label>
|
|
319
|
-
}
|
|
320
|
-
`,
|
|
321
|
-
standalone: true,
|
|
322
|
-
imports: [LocalizedMessagesDirective, NgClass, NgStyle]
|
|
323
|
-
}]
|
|
324
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }], propDecorators: { hostClasses: [{
|
|
325
|
-
type: HostBinding,
|
|
326
|
-
args: ['class.k-floating-label-container']
|
|
327
|
-
}], focusedClass: [{
|
|
328
|
-
type: HostBinding,
|
|
329
|
-
args: ['class.k-focus']
|
|
330
|
-
}], invalidClass: [{
|
|
331
|
-
type: HostBinding,
|
|
332
|
-
args: ['class.k-invalid']
|
|
333
|
-
}], direction: [{
|
|
334
|
-
type: HostBinding,
|
|
335
|
-
args: ['attr.dir']
|
|
336
|
-
}], labelCssStyle: [{
|
|
337
|
-
type: Input
|
|
338
|
-
}], labelCssClass: [{
|
|
339
|
-
type: Input
|
|
340
|
-
}], id: [{
|
|
341
|
-
type: Input
|
|
342
|
-
}], text: [{
|
|
343
|
-
type: Input
|
|
344
|
-
}], optional: [{
|
|
345
|
-
type: Input
|
|
346
|
-
}], positionChange: [{
|
|
347
|
-
type: Output
|
|
348
|
-
}], kendoInput: [{
|
|
349
|
-
type: ContentChild,
|
|
350
|
-
args: [KendoInput, { static: false }]
|
|
351
|
-
}], formControl: [{
|
|
352
|
-
type: ContentChild,
|
|
353
|
-
args: [NgControl, { static: false }]
|
|
354
|
-
}] } });
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { NgModule } from '@angular/core';
|
|
6
|
-
import { KENDO_FLOATINGLABEL } from '../directives';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "./floating-label.component";
|
|
9
|
-
import * as i2 from "../localization/custom-messages.component";
|
|
10
|
-
//IMPORTANT: NgModule export kept for backwards compatibility
|
|
11
|
-
/**
|
|
12
|
-
* Represents the [`NgModule`](link:site.data.urls.angular['ngmoduleapi']) definition for the FloatingLabel component.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import { FloatingLabelModule } from '@progress/kendo-angular-label';
|
|
17
|
-
*
|
|
18
|
-
* @NgModule({
|
|
19
|
-
* imports: [BrowserModule, FloatingLabelModule],
|
|
20
|
-
* declarations: [AppComponent],
|
|
21
|
-
* bootstrap: [AppComponent]
|
|
22
|
-
* })
|
|
23
|
-
* export class AppModule { }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export class FloatingLabelModule {
|
|
27
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FloatingLabelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
28
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: FloatingLabelModule, imports: [i1.FloatingLabelComponent, i2.CustomMessagesComponent], exports: [i1.FloatingLabelComponent, i2.CustomMessagesComponent] });
|
|
29
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FloatingLabelModule });
|
|
30
|
-
}
|
|
31
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FloatingLabelModule, decorators: [{
|
|
32
|
-
type: NgModule,
|
|
33
|
-
args: [{
|
|
34
|
-
exports: [...KENDO_FLOATINGLABEL],
|
|
35
|
-
imports: [...KENDO_FLOATINGLABEL]
|
|
36
|
-
}]
|
|
37
|
-
}] });
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
export {};
|
package/esm2022/index.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
export { LabelDirective } from './label.directive';
|
|
6
|
-
export { LabelModule } from './label.module';
|
|
7
|
-
export { FloatingLabelModule } from './floating-label/floating-label.module';
|
|
8
|
-
export { FloatingLabelComponent } from './floating-label/floating-label.component';
|
|
9
|
-
export { LabelComponent } from './label/label.component';
|
|
10
|
-
export { CustomMessagesComponent } from './localization/custom-messages.component';
|
|
11
|
-
export { LocalizedMessagesDirective } from './localization/localized-messages.directive';
|
|
12
|
-
export * from './directives';
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { ContentChild, Component, ElementRef, HostBinding, Input, Renderer2, ViewChild } from '@angular/core';
|
|
6
|
-
import { Subscription } from 'rxjs';
|
|
7
|
-
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
8
|
-
import { KendoInput, guid } from '@progress/kendo-angular-common';
|
|
9
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
|
-
import { packageMetadata } from '../package-metadata';
|
|
11
|
-
import { LabelDirective } from './../label.directive';
|
|
12
|
-
import { getWrappedNativeInput } from './../util';
|
|
13
|
-
import { NgClass, NgStyle } from '@angular/common';
|
|
14
|
-
import { LocalizedMessagesDirective } from '../localization/localized-messages.directive';
|
|
15
|
-
import * as i0 from "@angular/core";
|
|
16
|
-
import * as i1 from "@progress/kendo-angular-l10n";
|
|
17
|
-
/**
|
|
18
|
-
* Represents the [Kendo UI Label component for Angular]({% slug overview_label %}).
|
|
19
|
-
*
|
|
20
|
-
* Use the `LabelComponent` to associate a label with input elements or components.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```html
|
|
24
|
-
* <kendo-label [for]="input" text="First name">
|
|
25
|
-
* <kendo-textbox #input></kendo-textbox>
|
|
26
|
-
* </kendo-label>
|
|
27
|
-
* ```
|
|
28
|
-
* @remarks
|
|
29
|
-
* Supported children components are: {@link CustomMessagesComponent}.
|
|
30
|
-
*/
|
|
31
|
-
export class LabelComponent {
|
|
32
|
-
elementRef;
|
|
33
|
-
renderer;
|
|
34
|
-
localization;
|
|
35
|
-
/**
|
|
36
|
-
* Specifies the `dir` attribute value for the component.
|
|
37
|
-
* @hidden
|
|
38
|
-
*/
|
|
39
|
-
direction;
|
|
40
|
-
/**
|
|
41
|
-
* Sets the text content of the Label. Use this property to describe the input.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```html
|
|
45
|
-
* <kendo-label text="Email"></kendo-label>
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
text;
|
|
49
|
-
/**
|
|
50
|
-
* Associates the label with a component by a template reference or with an HTML element by `id`.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```html
|
|
54
|
-
* <input #myInput />
|
|
55
|
-
* <kendo-label [for]="myInput" text="Username"></kendo-label>
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
set for(forValue) {
|
|
59
|
-
if (forValue !== this._for) {
|
|
60
|
-
this._for = forValue;
|
|
61
|
-
this.control = forValue;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
get for() {
|
|
65
|
-
return this._for;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Marks a form field as optional. When enabled, the label displays the `Optional` text by default.
|
|
69
|
-
* You can customize the text by providing a custom message. ([See example]({% slug label_globalization %}#toc-custom-messages)).
|
|
70
|
-
*
|
|
71
|
-
* @default false
|
|
72
|
-
* @example
|
|
73
|
-
* ```html
|
|
74
|
-
* <kendo-label text="Phone" [optional]="true"></kendo-label>
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
optional;
|
|
78
|
-
/**
|
|
79
|
-
* Sets the CSS styles for the label element.
|
|
80
|
-
* Accepts values supported by the [`ngStyle`](link:site.data.urls.angular['ngstyleapi']) directive.
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```html
|
|
84
|
-
* <kendo-label text="Name" [labelCssStyle]="{ color: 'red' }"></kendo-label>
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
labelCssStyle;
|
|
88
|
-
/**
|
|
89
|
-
* Sets the CSS classes for the label element.
|
|
90
|
-
* Accepts values supported by the [`ngClass`](link:site.data.urls.angular['ngclassapi']) directive.
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```html
|
|
94
|
-
* <kendo-label text="Address" [labelCssClass]="'custom-label'"></kendo-label>
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
labelCssClass;
|
|
98
|
-
labelDirective;
|
|
99
|
-
kendoInput;
|
|
100
|
-
/**
|
|
101
|
-
* @hidden
|
|
102
|
-
*/
|
|
103
|
-
control;
|
|
104
|
-
subscriptions = new Subscription();
|
|
105
|
-
_for;
|
|
106
|
-
constructor(elementRef, renderer, localization) {
|
|
107
|
-
this.elementRef = elementRef;
|
|
108
|
-
this.renderer = renderer;
|
|
109
|
-
this.localization = localization;
|
|
110
|
-
validatePackage(packageMetadata);
|
|
111
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
112
|
-
this.renderer.removeAttribute(this.elementRef.nativeElement, 'id');
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* @hidden
|
|
116
|
-
*/
|
|
117
|
-
ngAfterContentInit() {
|
|
118
|
-
if (this.for) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const wrappedNativeInput = getWrappedNativeInput(this.elementRef.nativeElement);
|
|
122
|
-
if (wrappedNativeInput) {
|
|
123
|
-
if (!wrappedNativeInput.hasAttribute('id')) {
|
|
124
|
-
this.renderer.setAttribute(wrappedNativeInput, 'id', `k-${guid()}`);
|
|
125
|
-
}
|
|
126
|
-
this.control = wrappedNativeInput;
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
this.control = this.kendoInput;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* @hidden
|
|
133
|
-
*/
|
|
134
|
-
ngOnInit() {
|
|
135
|
-
this.subscriptions.add(this.localization.changes.subscribe(({ rtl }) => {
|
|
136
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* @hidden
|
|
141
|
-
*/
|
|
142
|
-
ngAfterViewInit() {
|
|
143
|
-
this.labelDirective.setAriaLabelledby();
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* @hidden
|
|
147
|
-
*/
|
|
148
|
-
ngOnDestroy() {
|
|
149
|
-
if (this.subscriptions) {
|
|
150
|
-
this.subscriptions.unsubscribe();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* @hidden
|
|
155
|
-
*/
|
|
156
|
-
textFor(key) {
|
|
157
|
-
return this.localization.get(key);
|
|
158
|
-
}
|
|
159
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
160
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LabelComponent, isStandalone: true, selector: "kendo-label", inputs: { text: "text", for: "for", optional: "optional", labelCssStyle: "labelCssStyle", labelCssClass: "labelCssClass" }, host: { properties: { "attr.dir": "this.direction" } }, providers: [
|
|
161
|
-
LocalizationService,
|
|
162
|
-
{
|
|
163
|
-
provide: L10N_PREFIX,
|
|
164
|
-
useValue: 'kendo.label'
|
|
165
|
-
}
|
|
166
|
-
], 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: `
|
|
167
|
-
<ng-container kendoLabelLocalizedMessages
|
|
168
|
-
i18n-optional="kendo.label.optional|The text for the optional segment of a Label component"
|
|
169
|
-
optional="Optional"
|
|
170
|
-
>
|
|
171
|
-
</ng-container>
|
|
172
|
-
<label
|
|
173
|
-
[for]="control"
|
|
174
|
-
[class.k-label-empty]="!text"
|
|
175
|
-
[ngClass]="labelCssClass"
|
|
176
|
-
[ngStyle]="labelCssStyle"
|
|
177
|
-
>
|
|
178
|
-
{{ text }}@if (optional) {
|
|
179
|
-
<span class="k-label-optional">({{textFor('optional')}})</span>
|
|
180
|
-
}
|
|
181
|
-
</label>
|
|
182
|
-
<ng-content></ng-content>
|
|
183
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n " }, { kind: "directive", type: LabelDirective, selector: "label[for]", inputs: ["for", "labelClass"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
184
|
-
}
|
|
185
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LabelComponent, decorators: [{
|
|
186
|
-
type: Component,
|
|
187
|
-
args: [{
|
|
188
|
-
selector: 'kendo-label',
|
|
189
|
-
exportAs: 'kendoLabel',
|
|
190
|
-
providers: [
|
|
191
|
-
LocalizationService,
|
|
192
|
-
{
|
|
193
|
-
provide: L10N_PREFIX,
|
|
194
|
-
useValue: 'kendo.label'
|
|
195
|
-
}
|
|
196
|
-
],
|
|
197
|
-
template: `
|
|
198
|
-
<ng-container kendoLabelLocalizedMessages
|
|
199
|
-
i18n-optional="kendo.label.optional|The text for the optional segment of a Label component"
|
|
200
|
-
optional="Optional"
|
|
201
|
-
>
|
|
202
|
-
</ng-container>
|
|
203
|
-
<label
|
|
204
|
-
[for]="control"
|
|
205
|
-
[class.k-label-empty]="!text"
|
|
206
|
-
[ngClass]="labelCssClass"
|
|
207
|
-
[ngStyle]="labelCssStyle"
|
|
208
|
-
>
|
|
209
|
-
{{ text }}@if (optional) {
|
|
210
|
-
<span class="k-label-optional">({{textFor('optional')}})</span>
|
|
211
|
-
}
|
|
212
|
-
</label>
|
|
213
|
-
<ng-content></ng-content>
|
|
214
|
-
`,
|
|
215
|
-
standalone: true,
|
|
216
|
-
imports: [LocalizedMessagesDirective, LabelDirective, NgClass, NgStyle]
|
|
217
|
-
}]
|
|
218
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }], propDecorators: { direction: [{
|
|
219
|
-
type: HostBinding,
|
|
220
|
-
args: ['attr.dir']
|
|
221
|
-
}], text: [{
|
|
222
|
-
type: Input
|
|
223
|
-
}], for: [{
|
|
224
|
-
type: Input
|
|
225
|
-
}], optional: [{
|
|
226
|
-
type: Input
|
|
227
|
-
}], labelCssStyle: [{
|
|
228
|
-
type: Input
|
|
229
|
-
}], labelCssClass: [{
|
|
230
|
-
type: Input
|
|
231
|
-
}], labelDirective: [{
|
|
232
|
-
type: ViewChild,
|
|
233
|
-
args: [LabelDirective, { static: true }]
|
|
234
|
-
}], kendoInput: [{
|
|
235
|
-
type: ContentChild,
|
|
236
|
-
args: [KendoInput, { static: true }]
|
|
237
|
-
}] } });
|