@progress/kendo-angular-label 3.1.2 → 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 -103
- 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
|
@@ -0,0 +1,5 @@
|
|
|
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
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@progress/kendo-angular-common"),require("@progress/kendo-angular-l10n"),require("@angular/common"),require("@angular/forms"),require("@progress/kendo-licensing"),require("rxjs")):"function"==typeof define&&define.amd?define("KendoAngularLabel",["exports","@angular/core","@progress/kendo-angular-common","@progress/kendo-angular-l10n","@angular/common","@angular/forms","@progress/kendo-licensing","rxjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoAngularLabel={},e.ng.core,e.KendoAngularCommon,e.KendoAngularL10N,e.ng.common,e.ng.forms,e.KendoLicensing,e.rxjs)}(this,function(e,r,i,t,n,o,a,s){"use strict";function l(n){if(n&&n.__esModule)return n;var o=Object.create(null);return n&&Object.keys(n).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(n,e),Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:function(){return n[e]}}))}),o.default=n,Object.freeze(o)}var c=l(r),p=l(t),u=l(n),d=(Object.defineProperty(g.prototype,"labelFor",{get:function(){if("string"==typeof this.for)return this.for;if(!i.isDocumentAvailable())return null;var e,t=this.getFocusableComponent()||{};return t instanceof HTMLElement&&(e="id",!t.hasAttribute(e))&&this.renderer.setAttribute(t,"id","k-"+i.guid()),t.focusableId||t.id||null},enumerable:!1,configurable:!0}),g.prototype.ngAfterViewInit=function(){var e=this;this.setAriaLabelledby(),this.zone.runOutsideAngular(function(){return e.clickListener=e.renderer.listen(e.label.nativeElement,"click",e.handleClick)})},g.prototype.ngOnDestroy=function(){this.clickListener&&this.clickListener()},g.prototype.setAriaLabelledby=function(){var e,t,n;!i.isDocumentAvailable()||(e=this.getFocusableComponent())&&e.focusableId&&((e=function(e){if(!e)return null;for(var t=e;t.parentElement;)t=t.parentElement;return t}(this.label.nativeElement).querySelector("#"+e.focusableId))&&(n=(t=this.label.nativeElement).id||"k-"+i.guid(),t.getAttribute("id")||this.renderer.setAttribute(t,"id",n),this.renderer.setAttribute(e,"aria-labelledby",n)))},g.prototype.getFocusableComponent=function(){var e=this.for;return e&&void 0!==e.focus?e:null},g);function g(e,t,n){var o=this;this.label=e,this.renderer=t,this.zone=n,this.labelClass=!0,this.handleClick=function(){var e,t=o.getFocusableComponent();t&&(!(e=t).wrapper||"KENDO-UPLOAD"!==e.wrapper.tagName&&"KENDO-FILESELECT"!==e.wrapper.tagName||t.fileSelect.nativeElement.click(),t.focus&&t.focus())}}d.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:d,deps:[{token:c.ElementRef},{token:c.Renderer2},{token:c.NgZone}],target:c.ɵɵFactoryTarget.Directive}),d.ɵdir=c.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:d,selector:"label[for]",inputs:{for:"for"},host:{properties:{"attr.for":"this.labelFor","class.k-label":"this.labelClass"}},ngImport:c}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:d,decorators:[{type:r.Directive,args:[{selector:"label[for]"}]}],ctorParameters:function(){return[{type:c.ElementRef},{type:c.Renderer2},{type:c.NgZone}]},propDecorators:{for:[{type:r.Input}],labelFor:[{type:r.HostBinding,args:["attr.for"]}],labelClass:[{type:r.HostBinding,args:["class.k-label"]}]}});var f=function(e,t){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function b(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function y(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||((o=o||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}Object.create;m(I,h=t.ComponentMessages);var h,v=I;function I(){return null!==h&&h.apply(this,arguments)||this}v.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:v,deps:null,target:c.ɵɵFactoryTarget.Directive}),v.ɵdir=c.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:v,selector:"kendo-label-messages-base",inputs:{optional:"optional"},usesInheritance:!0,ngImport:c}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:v,decorators:[{type:r.Directive,args:[{selector:"kendo-label-messages-base"}]}],propDecorators:{optional:[{type:r.Input}]}});m(L,k=v);var k,C=L;function L(e){var t=k.call(this)||this;return t.service=e,t}C.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:C,deps:[{token:p.LocalizationService}],target:c.ɵɵFactoryTarget.Directive}),C.ɵdir=c.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:C,selector:"\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n ",providers:[{provide:v,useExisting:r.forwardRef(function(){return C})}],usesInheritance:!0,ngImport:c}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:C,decorators:[{type:r.Directive,args:[{providers:[{provide:v,useExisting:r.forwardRef(function(){return C})}],selector:"\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n "}]}],ctorParameters:function(){return[{type:p.LocalizationService}]}});m(E,F=v),Object.defineProperty(E.prototype,"override",{get:function(){return!0},enumerable:!1,configurable:!0});var F,D=E;function E(e){var t=F.call(this)||this;return t.service=e,t}D.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:D,deps:[{token:p.LocalizationService}],target:c.ɵɵFactoryTarget.Component}),D.ɵcmp=c.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:D,selector:"kendo-label-messages, kendo-floatinglabel-messages",providers:[{provide:v,useExisting:r.forwardRef(function(){return D})}],usesInheritance:!0,ngImport:c,template:"",isInline:!0}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:D,decorators:[{type:r.Component,args:[{providers:[{provide:v,useExisting:r.forwardRef(function(){return D})}],selector:"kendo-label-messages, kendo-floatinglabel-messages",template:""}]}],ctorParameters:function(){return[{type:p.LocalizationService}]}});var v=[C,D],x=function(){},M=(x.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:x,deps:[],target:c.ɵɵFactoryTarget.NgModule}),x.ɵmod=c.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:x,declarations:[C,D],exports:[C,D]}),x.ɵinj=c.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:x}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:x,decorators:[{type:r.NgModule,args:[{declarations:[v],exports:[v]}]}]}),{name:"@progress/kendo-angular-label",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1649876656,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"}),S=(Object.defineProperty(A.prototype,"focusableId",{get:function(){var e=this.component;return"focusableId"in e?e.focusableId:"id"in e?e.id:""},set:function(e){var t=this.component;"focusableId"in t?t.focusableId=e:"id"in t&&(t.id=e)},enumerable:!1,configurable:!0}),A);function A(e,t){function n(e){return e instanceof s.Observable||e instanceof r.EventEmitter}n((this.component=e).onFocus)&&(this.onFocus=e.onFocus),n(e.autoFillStart)&&(this.autoFillStart=e.autoFillStart),n(e.autoFillEnd)&&(this.autoFillEnd=e.autoFillEnd),n(e.onBlur)&&(this.onBlur=e.onBlur),t?this.onValueChange=t.valueChanges:e.onValueChange&&(this.onValueChange=e.onValueChange)}function V(e){return"[object Function]"===Object.prototype.toString.call(e)}Object.defineProperty(O.prototype,"labelPosition",{get:function(){return!this.empty||this.focused?"Out":"In"},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"focusedClass",{get:function(){return this.focused},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"invalidClass",{get:function(){return this.invalid},enumerable:!1,configurable:!0}),O.prototype.ngAfterContentInit=function(){this.validateSetup();var e=new S(this.kendoInput||this.formControl.valueAccessor,this.formControl);this.addHandlers(e),this.setLabelFor(e)},O.prototype.ngAfterViewInit=function(){this.kendoInput&&this.setAriaLabelledby(this.kendoInput)},O.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},O.prototype.textFor=function(e){return this.localization.get(e)},O.prototype.subscribe=function(e,t,n){e[t]instanceof r.EventEmitter&&(e=e[t].subscribe(n),this.subscription?this.subscription.add(e):this.subscription=e)},O.prototype.updateState=function(){function e(e){return 0!==e&&!1!==e&&(!(!Array.isArray(e)||e.length)||!e)}var t,n=this.formControl;n?(t=n.valueAccessor,V(t.isEmpty)?this.empty=t.isEmpty():this.empty=e(n.value),this.invalid=n.invalid&&(n.touched||n.dirty)):this.empty=V(this.kendoInput.isEmpty)?this.kendoInput.isEmpty():e(this.kendoInput.value),this.empty?this.renderer.addClass(this.elementRef.nativeElement,"k-empty"):this.renderer.removeClass(this.elementRef.nativeElement,"k-empty"),this.changeDetectorRef.markForCheck()},O.prototype.setAriaLabelledby=function(e){var e=e.focusableId||e.id;e&&(e=this.elementRef.nativeElement.querySelector("#"+e),this.renderer.setAttribute(e,"aria-labelledby",this.labelId))},O.prototype.setLabelFor=function(e){var t=e.focusableId||e.id;this.id&&t?this.id=t:this.id?e.focusableId=this.id:t?this.id=t:(t="k-"+i.guid(),e.focusableId=t,this.id=t)},O.prototype.handleAutofill=function(e){var t=this;this.subscribe(e,"autoFillStart",function(){t.autoFillStarted=!0,t.renderer.removeClass(t.elementRef.nativeElement,"k-empty")}),this.subscribe(e,"autoFillEnd",function(){t.autoFillStarted&&(t.autoFillStarted=!1,t.empty&&t.renderer.addClass(t.elementRef.nativeElement,"k-empty"))})},O.prototype.addHandlers=function(e){function t(e){return function(){o.focused=e,o.updateState(),o.empty&&i.hasObservers(o.positionChange)&&o.positionChange.emit(e?"Out":"In")}}function n(){return o.updateState()}var o=this;this.subscribe(e,"onFocus",t(!0)),this.subscribe(e,"onBlur",t(!1)),this.handleAutofill(e);n(),this.subscribe(e,"onValueChange",n)},O.prototype.validateSetup=function(){if(!this.formControl&&!this.kendoInput&&r.isDevMode())throw new Error("The FloatingLabelComponent requires a Kendo Input component or a forms-bound component to function properly.")};v=O;function O(e,t,n,o){this.elementRef=e,this.renderer=t,this.changeDetectorRef=n,this.localization=o,this.hostClasses=!0,this.positionChange=new r.EventEmitter,this.focused=!1,this.empty=!0,this.invalid=!1,this.labelId="k-"+i.guid(),this.autoFillStarted=!1,a.validatePackage(M),this.direction=o.rtl?"rtl":"ltr",this.renderer.removeAttribute(this.elementRef.nativeElement,"id")}v.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:v,deps:[{token:c.ElementRef},{token:c.Renderer2},{token:c.ChangeDetectorRef},{token:p.LocalizationService}],target:c.ɵɵFactoryTarget.Component}),v.ɵcmp=c.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:v,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-state-invalid":"this.invalidClass","attr.dir":"this.direction"}},providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.floatinglabel"}],queries:[{propertyName:"kendoInput",first:!0,predicate:i.KendoInput,descendants:!0},{propertyName:"formControl",first:!0,predicate:o.NgControl,descendants:!0}],exportAs:["kendoFloatingLabel"],ngImport:c,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 ',isInline:!0,directives:[{type:C,selector:"\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n "},{type:u.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{type:u.NgClass,selector:"[ngClass]",inputs:["class","ngClass"]},{type:u.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]}]}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:v,decorators:[{type:r.Component,args:[{selector:"kendo-floatinglabel",exportAs:"kendoFloatingLabel",providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.floatinglabel"}],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 '}]}],ctorParameters:function(){return[{type:c.ElementRef},{type:c.Renderer2},{type:c.ChangeDetectorRef},{type:p.LocalizationService}]},propDecorators:{hostClasses:[{type:r.HostBinding,args:["class.k-floating-label-container"]}],focusedClass:[{type:r.HostBinding,args:["class.k-focus"]}],invalidClass:[{type:r.HostBinding,args:["class.k-state-invalid"]}],direction:[{type:r.HostBinding,args:["attr.dir"]}],labelCssStyle:[{type:r.Input}],labelCssClass:[{type:r.Input}],id:[{type:r.Input}],text:[{type:r.Input}],optional:[{type:r.Input}],positionChange:[{type:r.Output}],kendoInput:[{type:r.ContentChild,args:[i.KendoInput,{static:!1}]}],formControl:[{type:r.ContentChild,args:[o.NgControl,{static:!1}]}]}});var o=[v],R=function(){},o=(R.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:R,deps:[],target:c.ɵɵFactoryTarget.NgModule}),R.ɵmod=c.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:R,declarations:[v],imports:[n.CommonModule,x],exports:[v,x]}),R.ɵinj=c.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:R,imports:[[n.CommonModule,x],x]}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:R,decorators:[{type:r.NgModule,args:[{declarations:y([],b(o)),exports:y(y([],b(o)),[x]),imports:[n.CommonModule,x]}]}]}),N.prototype.ngAfterContentInit=function(){var e;{if(!this.for)return(e=this.elementRef.nativeElement.querySelector("kendo-label > input, kendo-label > textarea, kendo-label > select"))?(e.hasAttribute("id")||this.renderer.setAttribute(e,"id","k-"+i.guid()),void(this.control=e)):void(this.control=this.kendoInput);this.control=this.for}},N.prototype.ngOnInit=function(){var t=this;this.subscriptions.add(this.localization.changes.subscribe(function(e){e=e.rtl;t.direction=e?"rtl":"ltr"}))},N.prototype.ngAfterViewInit=function(){this.labelDirective.setAriaLabelledby()},N.prototype.ngOnDestroy=function(){this.subscriptions&&this.subscriptions.unsubscribe()},N.prototype.textFor=function(e){return this.localization.get(e)},N);function N(e,t,n){this.elementRef=e,this.renderer=t,this.localization=n,this.subscriptions=new s.Subscription,a.validatePackage(M),this.direction=n.rtl?"rtl":"ltr",this.renderer.removeAttribute(this.elementRef.nativeElement,"id")}o.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:o,deps:[{token:c.ElementRef},{token:c.Renderer2},{token:p.LocalizationService}],target:c.ɵɵFactoryTarget.Component}),o.ɵcmp=c.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:o,selector:"kendo-label",inputs:{text:"text",for:"for",optional:"optional"},host:{properties:{"attr.dir":"this.direction"}},providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.label"}],queries:[{propertyName:"kendoInput",first:!0,predicate:i.KendoInput,descendants:!0,static:!0}],viewQueries:[{propertyName:"labelDirective",first:!0,predicate:d,descendants:!0,static:!0}],exportAs:["kendoLabel"],ngImport:c,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 ',isInline:!0,directives:[{type:C,selector:"\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n "},{type:d,selector:"label[for]",inputs:["for"]},{type:u.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:o,decorators:[{type:r.Component,args:[{selector:"kendo-label",exportAs:"kendoLabel",providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.label"}],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 '}]}],ctorParameters:function(){return[{type:c.ElementRef},{type:c.Renderer2},{type:p.LocalizationService}]},propDecorators:{direction:[{type:r.HostBinding,args:["attr.dir"]}],text:[{type:r.Input}],for:[{type:r.Input}],optional:[{type:r.Input}],labelDirective:[{type:r.ViewChild,args:[d,{static:!0}]}],kendoInput:[{type:r.ContentChild,args:[i.KendoInput,{static:!0}]}]}});u=[d,o],t=function(){};t.ɵfac=c.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:t,deps:[],target:c.ɵɵFactoryTarget.NgModule}),t.ɵmod=c.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:t,declarations:[d,o],imports:[n.CommonModule,x],exports:[d,o,R,x]}),t.ɵinj=c.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:t,imports:[[n.CommonModule,x],R,x]}),c.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:c,type:t,decorators:[{type:r.NgModule,args:[{imports:[n.CommonModule,x],declarations:y([],b(u)),exports:y(y([],b(u)),[R,x])}]}]}),e.CustomMessagesComponent=D,e.FloatingLabelComponent=v,e.FloatingLabelModule=R,e.LabelComponent=o,e.LabelDirective=d,e.LabelModule=t,e.LocalizedMessagesDirective=C,e.SharedDirectivesModule=x,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
File without changes
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import
|
|
6
|
-
import { ContentChild, Component, ElementRef, EventEmitter, HostBinding, Input, Renderer2, isDevMode, ChangeDetectorRef, Output } from '@angular/core';
|
|
5
|
+
import { ContentChild, Component, EventEmitter, HostBinding, Input, isDevMode, Output } from '@angular/core';
|
|
7
6
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
8
7
|
import { NgControl } from '@angular/forms';
|
|
9
8
|
import { guid, KendoInput, hasObservers } from '@progress/kendo-angular-common';
|
|
10
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
10
|
import { packageMetadata } from '../package-metadata';
|
|
12
11
|
import { FloatingLabelInputAdapter } from './floating-label-input-adapter';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
14
|
+
import * as i2 from "../localization/localized-messages.directive";
|
|
15
|
+
import * as i3 from "@angular/common";
|
|
13
16
|
const isFunction = (x) => Object.prototype.toString.call(x) === '[object Function]';
|
|
14
|
-
const ɵ0 = isFunction;
|
|
15
17
|
/**
|
|
16
18
|
* Represents the [Kendo UI FloatingLabel component for Angular]({% slug overview_floatinglabel %}).
|
|
17
19
|
* Provides floating labels to `input` elements.
|
|
@@ -37,7 +39,7 @@ const ɵ0 = isFunction;
|
|
|
37
39
|
*
|
|
38
40
|
* ```
|
|
39
41
|
*/
|
|
40
|
-
|
|
42
|
+
export class FloatingLabelComponent {
|
|
41
43
|
constructor(elementRef, renderer, changeDetectorRef, localization) {
|
|
42
44
|
this.elementRef = elementRef;
|
|
43
45
|
this.renderer = renderer;
|
|
@@ -151,10 +153,10 @@ let FloatingLabelComponent = class FloatingLabelComponent {
|
|
|
151
153
|
this.kendoInput.isEmpty() : empty(this.kendoInput.value);
|
|
152
154
|
}
|
|
153
155
|
if (this.empty) {
|
|
154
|
-
this.renderer.addClass(this.elementRef.nativeElement, 'k-
|
|
156
|
+
this.renderer.addClass(this.elementRef.nativeElement, 'k-empty');
|
|
155
157
|
}
|
|
156
158
|
else {
|
|
157
|
-
this.renderer.removeClass(this.elementRef.nativeElement, 'k-
|
|
159
|
+
this.renderer.removeClass(this.elementRef.nativeElement, 'k-empty');
|
|
158
160
|
}
|
|
159
161
|
this.changeDetectorRef.markForCheck();
|
|
160
162
|
}
|
|
@@ -186,13 +188,13 @@ let FloatingLabelComponent = class FloatingLabelComponent {
|
|
|
186
188
|
handleAutofill(control) {
|
|
187
189
|
this.subscribe(control, 'autoFillStart', () => {
|
|
188
190
|
this.autoFillStarted = true;
|
|
189
|
-
this.renderer.removeClass(this.elementRef.nativeElement, 'k-
|
|
191
|
+
this.renderer.removeClass(this.elementRef.nativeElement, 'k-empty');
|
|
190
192
|
});
|
|
191
193
|
this.subscribe(control, 'autoFillEnd', () => {
|
|
192
194
|
if (this.autoFillStarted) {
|
|
193
195
|
this.autoFillStarted = false;
|
|
194
196
|
if (this.empty) {
|
|
195
|
-
this.renderer.addClass(this.elementRef.nativeElement, 'k-
|
|
197
|
+
this.renderer.addClass(this.elementRef.nativeElement, 'k-empty');
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
});
|
|
@@ -224,69 +226,38 @@ let FloatingLabelComponent = class FloatingLabelComponent {
|
|
|
224
226
|
return;
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
],
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
],
|
|
258
|
-
|
|
259
|
-
Input(),
|
|
260
|
-
tslib_1.__metadata("design:type", String)
|
|
261
|
-
], FloatingLabelComponent.prototype, "text", void 0);
|
|
262
|
-
tslib_1.__decorate([
|
|
263
|
-
Input(),
|
|
264
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
265
|
-
], FloatingLabelComponent.prototype, "optional", void 0);
|
|
266
|
-
tslib_1.__decorate([
|
|
267
|
-
Output(),
|
|
268
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
269
|
-
], FloatingLabelComponent.prototype, "positionChange", void 0);
|
|
270
|
-
tslib_1.__decorate([
|
|
271
|
-
ContentChild(KendoInput, { static: false }),
|
|
272
|
-
tslib_1.__metadata("design:type", Object)
|
|
273
|
-
], FloatingLabelComponent.prototype, "kendoInput", void 0);
|
|
274
|
-
tslib_1.__decorate([
|
|
275
|
-
ContentChild(NgControl, { static: false }),
|
|
276
|
-
tslib_1.__metadata("design:type", NgControl)
|
|
277
|
-
], FloatingLabelComponent.prototype, "formControl", void 0);
|
|
278
|
-
FloatingLabelComponent = tslib_1.__decorate([
|
|
279
|
-
Component({
|
|
280
|
-
selector: 'kendo-floatinglabel',
|
|
281
|
-
exportAs: 'kendoFloatingLabel',
|
|
282
|
-
providers: [
|
|
283
|
-
LocalizationService,
|
|
284
|
-
{
|
|
285
|
-
provide: L10N_PREFIX,
|
|
286
|
-
useValue: 'kendo.floatinglabel'
|
|
287
|
-
}
|
|
288
|
-
],
|
|
289
|
-
template: `
|
|
229
|
+
}
|
|
230
|
+
FloatingLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FloatingLabelComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
231
|
+
FloatingLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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-state-invalid": "this.invalidClass", "attr.dir": "this.direction" } }, providers: [
|
|
232
|
+
LocalizationService,
|
|
233
|
+
{
|
|
234
|
+
provide: L10N_PREFIX,
|
|
235
|
+
useValue: 'kendo.floatinglabel'
|
|
236
|
+
}
|
|
237
|
+
], queries: [{ propertyName: "kendoInput", first: true, predicate: KendoInput, descendants: true }, { propertyName: "formControl", first: true, predicate: NgControl, descendants: true }], exportAs: ["kendoFloatingLabel"], ngImport: i0, template: `
|
|
238
|
+
<ng-container kendoFloatingLabelLocalizedMessages
|
|
239
|
+
i18n-optional="kendo.floatinglabel.optional|The text for the optional segment of a FloatingLabel component"
|
|
240
|
+
optional="Optional"
|
|
241
|
+
>
|
|
242
|
+
</ng-container>
|
|
243
|
+
<ng-content></ng-content>
|
|
244
|
+
<label *ngIf="text" [ngClass]="labelCssClass" [ngStyle]="labelCssStyle" [for]="id" [attr.id]="labelId" class="k-label">
|
|
245
|
+
{{ text }}<span *ngIf="optional" class="k-label-optional">({{textFor('optional')}})</span>
|
|
246
|
+
</label>
|
|
247
|
+
`, isInline: true, directives: [{ type: i2.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"] }] });
|
|
248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FloatingLabelComponent, decorators: [{
|
|
249
|
+
type: Component,
|
|
250
|
+
args: [{
|
|
251
|
+
selector: 'kendo-floatinglabel',
|
|
252
|
+
exportAs: 'kendoFloatingLabel',
|
|
253
|
+
providers: [
|
|
254
|
+
LocalizationService,
|
|
255
|
+
{
|
|
256
|
+
provide: L10N_PREFIX,
|
|
257
|
+
useValue: 'kendo.floatinglabel'
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
template: `
|
|
290
261
|
<ng-container kendoFloatingLabelLocalizedMessages
|
|
291
262
|
i18n-optional="kendo.floatinglabel.optional|The text for the optional segment of a FloatingLabel component"
|
|
292
263
|
optional="Optional"
|
|
@@ -297,11 +268,35 @@ FloatingLabelComponent = tslib_1.__decorate([
|
|
|
297
268
|
{{ text }}<span *ngIf="optional" class="k-label-optional">({{textFor('optional')}})</span>
|
|
298
269
|
</label>
|
|
299
270
|
`
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
271
|
+
}]
|
|
272
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }]; }, propDecorators: { hostClasses: [{
|
|
273
|
+
type: HostBinding,
|
|
274
|
+
args: ['class.k-floating-label-container']
|
|
275
|
+
}], focusedClass: [{
|
|
276
|
+
type: HostBinding,
|
|
277
|
+
args: ['class.k-focus']
|
|
278
|
+
}], invalidClass: [{
|
|
279
|
+
type: HostBinding,
|
|
280
|
+
args: ['class.k-state-invalid']
|
|
281
|
+
}], direction: [{
|
|
282
|
+
type: HostBinding,
|
|
283
|
+
args: ['attr.dir']
|
|
284
|
+
}], labelCssStyle: [{
|
|
285
|
+
type: Input
|
|
286
|
+
}], labelCssClass: [{
|
|
287
|
+
type: Input
|
|
288
|
+
}], id: [{
|
|
289
|
+
type: Input
|
|
290
|
+
}], text: [{
|
|
291
|
+
type: Input
|
|
292
|
+
}], optional: [{
|
|
293
|
+
type: Input
|
|
294
|
+
}], positionChange: [{
|
|
295
|
+
type: Output
|
|
296
|
+
}], kendoInput: [{
|
|
297
|
+
type: ContentChild,
|
|
298
|
+
args: [KendoInput, { static: false }]
|
|
299
|
+
}], formControl: [{
|
|
300
|
+
type: ContentChild,
|
|
301
|
+
args: [NgControl, { static: false }]
|
|
302
|
+
}] } });
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import * as tslib_1 from "tslib";
|
|
6
5
|
import { NgModule } from '@angular/core';
|
|
7
6
|
import { CommonModule } from '@angular/common';
|
|
8
7
|
import { SharedDirectivesModule } from './../shared.module';
|
|
9
8
|
import { FloatingLabelComponent } from './floating-label.component';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
10
|
const COMPONENT_DIRECTIVES = [FloatingLabelComponent];
|
|
11
11
|
/**
|
|
12
12
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
@@ -37,13 +37,16 @@ const COMPONENT_DIRECTIVES = [FloatingLabelComponent];
|
|
|
37
37
|
*
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
FloatingLabelModule =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
],
|
|
49
|
-
|
|
40
|
+
export class FloatingLabelModule {
|
|
41
|
+
}
|
|
42
|
+
FloatingLabelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FloatingLabelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
43
|
+
FloatingLabelModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FloatingLabelModule, declarations: [FloatingLabelComponent], imports: [CommonModule, SharedDirectivesModule], exports: [FloatingLabelComponent, SharedDirectivesModule] });
|
|
44
|
+
FloatingLabelModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FloatingLabelModule, imports: [[CommonModule, SharedDirectivesModule], SharedDirectivesModule] });
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FloatingLabelModule, decorators: [{
|
|
46
|
+
type: NgModule,
|
|
47
|
+
args: [{
|
|
48
|
+
declarations: [...COMPONENT_DIRECTIVES],
|
|
49
|
+
exports: [...COMPONENT_DIRECTIVES, SharedDirectivesModule],
|
|
50
|
+
imports: [CommonModule, SharedDirectivesModule]
|
|
51
|
+
}]
|
|
52
|
+
}] });
|
|
@@ -2,3 +2,4 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export {};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Generated bundle index. Do not edit.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
}
|
|
8
|
+
export * from './main';
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ContentChild, Component, HostBinding, Input, 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 * as i0 from "@angular/core";
|
|
14
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
15
|
+
import * as i2 from "../localization/localized-messages.directive";
|
|
16
|
+
import * as i3 from "../label.directive";
|
|
17
|
+
import * as i4 from "@angular/common";
|
|
18
|
+
/**
|
|
19
|
+
* Represents the [Kendo UI Label component for Angular]({% slug label_basic %}).
|
|
20
|
+
*
|
|
21
|
+
* Associates a label with input elements or components.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
*
|
|
26
|
+
* _@Component({
|
|
27
|
+
* selector: 'my-app',
|
|
28
|
+
* template: `
|
|
29
|
+
* <kendo-label [for]="input" text="First name">
|
|
30
|
+
* <input [(ngModel)]="name" kendoTextBox #input />
|
|
31
|
+
* </kendo-label>
|
|
32
|
+
* `
|
|
33
|
+
* })
|
|
34
|
+
* class AppComponent {
|
|
35
|
+
* public name = 'John';
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export class LabelComponent {
|
|
41
|
+
constructor(elementRef, renderer, localization) {
|
|
42
|
+
this.elementRef = elementRef;
|
|
43
|
+
this.renderer = renderer;
|
|
44
|
+
this.localization = localization;
|
|
45
|
+
this.subscriptions = new Subscription();
|
|
46
|
+
validatePackage(packageMetadata);
|
|
47
|
+
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
48
|
+
this.renderer.removeAttribute(this.elementRef.nativeElement, 'id');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
|
+
ngAfterContentInit() {
|
|
54
|
+
if (this.for) {
|
|
55
|
+
this.control = this.for;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const wrappedNativeInput = getWrappedNativeInput(this.elementRef.nativeElement);
|
|
59
|
+
if (wrappedNativeInput) {
|
|
60
|
+
if (!wrappedNativeInput.hasAttribute('id')) {
|
|
61
|
+
this.renderer.setAttribute(wrappedNativeInput, 'id', `k-${guid()}`);
|
|
62
|
+
}
|
|
63
|
+
this.control = wrappedNativeInput;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.control = this.kendoInput;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
ngOnInit() {
|
|
72
|
+
this.subscriptions.add(this.localization.changes.subscribe(({ rtl }) => {
|
|
73
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @hidden
|
|
78
|
+
*/
|
|
79
|
+
ngAfterViewInit() {
|
|
80
|
+
this.labelDirective.setAriaLabelledby();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @hidden
|
|
84
|
+
*/
|
|
85
|
+
ngOnDestroy() {
|
|
86
|
+
if (this.subscriptions) {
|
|
87
|
+
this.subscriptions.unsubscribe();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @hidden
|
|
92
|
+
*/
|
|
93
|
+
textFor(key) {
|
|
94
|
+
return this.localization.get(key);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
LabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LabelComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
98
|
+
LabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LabelComponent, selector: "kendo-label", inputs: { text: "text", for: "for", optional: "optional" }, host: { properties: { "attr.dir": "this.direction" } }, providers: [
|
|
99
|
+
LocalizationService,
|
|
100
|
+
{
|
|
101
|
+
provide: L10N_PREFIX,
|
|
102
|
+
useValue: 'kendo.label'
|
|
103
|
+
}
|
|
104
|
+
], 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: `
|
|
105
|
+
<ng-container kendoLabelLocalizedMessages
|
|
106
|
+
i18n-optional="kendo.label.optional|The text for the optional segment of a Label component"
|
|
107
|
+
optional="Optional"
|
|
108
|
+
>
|
|
109
|
+
</ng-container>
|
|
110
|
+
<label
|
|
111
|
+
[for]="control"
|
|
112
|
+
[class.k-label-empty]="!text">
|
|
113
|
+
{{ text }}<span *ngIf="optional" class="k-label-optional">({{textFor('optional')}})</span>
|
|
114
|
+
</label>
|
|
115
|
+
<ng-content></ng-content>
|
|
116
|
+
`, isInline: true, directives: [{ type: i2.LocalizedMessagesDirective, selector: "\n [kendoLabelLocalizedMessages],\n [kendoFloatingLabelLocalizedMessages]\n " }, { type: i3.LabelDirective, selector: "label[for]", inputs: ["for"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LabelComponent, decorators: [{
|
|
118
|
+
type: Component,
|
|
119
|
+
args: [{
|
|
120
|
+
selector: 'kendo-label',
|
|
121
|
+
exportAs: 'kendoLabel',
|
|
122
|
+
providers: [
|
|
123
|
+
LocalizationService,
|
|
124
|
+
{
|
|
125
|
+
provide: L10N_PREFIX,
|
|
126
|
+
useValue: 'kendo.label'
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
template: `
|
|
130
|
+
<ng-container kendoLabelLocalizedMessages
|
|
131
|
+
i18n-optional="kendo.label.optional|The text for the optional segment of a Label component"
|
|
132
|
+
optional="Optional"
|
|
133
|
+
>
|
|
134
|
+
</ng-container>
|
|
135
|
+
<label
|
|
136
|
+
[for]="control"
|
|
137
|
+
[class.k-label-empty]="!text">
|
|
138
|
+
{{ text }}<span *ngIf="optional" class="k-label-optional">({{textFor('optional')}})</span>
|
|
139
|
+
</label>
|
|
140
|
+
<ng-content></ng-content>
|
|
141
|
+
`
|
|
142
|
+
}]
|
|
143
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }]; }, propDecorators: { direction: [{
|
|
144
|
+
type: HostBinding,
|
|
145
|
+
args: ['attr.dir']
|
|
146
|
+
}], text: [{
|
|
147
|
+
type: Input
|
|
148
|
+
}], for: [{
|
|
149
|
+
type: Input
|
|
150
|
+
}], optional: [{
|
|
151
|
+
type: Input
|
|
152
|
+
}], labelDirective: [{
|
|
153
|
+
type: ViewChild,
|
|
154
|
+
args: [LabelDirective, { static: true }]
|
|
155
|
+
}], kendoInput: [{
|
|
156
|
+
type: ContentChild,
|
|
157
|
+
args: [KendoInput, { static: true }]
|
|
158
|
+
}] } });
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import * as tslib_1 from "tslib";
|
|
6
5
|
import { isUploadComponent, getRootElement, inputElementHasAttr, isInputElement } from './util';
|
|
7
|
-
import { Directive, Input, HostBinding
|
|
6
|
+
import { Directive, Input, HostBinding } from '@angular/core';
|
|
8
7
|
import { isDocumentAvailable, guid } from '@progress/kendo-angular-common';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
9
|
/**
|
|
10
10
|
* Represents the [Kendo UI Label directive for Angular]({% slug overview_label %}).
|
|
11
11
|
* The Label associates a focusable Angular component or an HTML element
|
|
@@ -37,7 +37,7 @@ import { isDocumentAvailable, guid } from '@progress/kendo-angular-common';
|
|
|
37
37
|
* class AppComponent { }
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
export class LabelDirective {
|
|
41
41
|
constructor(label, renderer, zone) {
|
|
42
42
|
this.label = label;
|
|
43
43
|
this.renderer = renderer;
|
|
@@ -110,24 +110,21 @@ let LabelDirective = class LabelDirective {
|
|
|
110
110
|
const target = this.for;
|
|
111
111
|
return target && target.focus !== undefined ? target : null;
|
|
112
112
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
],
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
tslib_1.__metadata("design:paramtypes", [ElementRef, Renderer2, NgZone])
|
|
132
|
-
], LabelDirective);
|
|
133
|
-
export { LabelDirective };
|
|
113
|
+
}
|
|
114
|
+
LabelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LabelDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
115
|
+
LabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: LabelDirective, selector: "label[for]", inputs: { for: "for" }, host: { properties: { "attr.for": "this.labelFor", "class.k-label": "this.labelClass" } }, ngImport: i0 });
|
|
116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LabelDirective, decorators: [{
|
|
117
|
+
type: Directive,
|
|
118
|
+
args: [{
|
|
119
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
120
|
+
selector: 'label[for]'
|
|
121
|
+
}]
|
|
122
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { for: [{
|
|
123
|
+
type: Input
|
|
124
|
+
}], labelFor: [{
|
|
125
|
+
type: HostBinding,
|
|
126
|
+
args: ['attr.for']
|
|
127
|
+
}], labelClass: [{
|
|
128
|
+
type: HostBinding,
|
|
129
|
+
args: ['class.k-label']
|
|
130
|
+
}] } });
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import * as tslib_1 from "tslib";
|
|
6
5
|
import { SharedDirectivesModule } from './shared.module';
|
|
7
6
|
import { CommonModule } from '@angular/common';
|
|
8
7
|
import { NgModule } from '@angular/core';
|
|
9
8
|
import { FloatingLabelModule } from './floating-label/floating-label.module';
|
|
10
9
|
import { LabelDirective } from './label.directive';
|
|
11
10
|
import { LabelComponent } from './label/label.component';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
12
|
const COMPONENT_DIRECTIVES = [
|
|
13
13
|
LabelDirective,
|
|
14
14
|
LabelComponent
|
|
@@ -48,13 +48,18 @@ const COMPONENT_DIRECTIVES = [
|
|
|
48
48
|
*
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
LabelModule =
|
|
54
|
-
|
|
55
|
-
imports: [CommonModule, SharedDirectivesModule],
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
export class LabelModule {
|
|
52
|
+
}
|
|
53
|
+
LabelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LabelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
54
|
+
LabelModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LabelModule, declarations: [LabelDirective,
|
|
55
|
+
LabelComponent], imports: [CommonModule, SharedDirectivesModule], exports: [LabelDirective,
|
|
56
|
+
LabelComponent, FloatingLabelModule, SharedDirectivesModule] });
|
|
57
|
+
LabelModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LabelModule, imports: [[CommonModule, SharedDirectivesModule], FloatingLabelModule, SharedDirectivesModule] });
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LabelModule, decorators: [{
|
|
59
|
+
type: NgModule,
|
|
60
|
+
args: [{
|
|
61
|
+
imports: [CommonModule, SharedDirectivesModule],
|
|
62
|
+
declarations: [...COMPONENT_DIRECTIVES],
|
|
63
|
+
exports: [...COMPONENT_DIRECTIVES, FloatingLabelModule, SharedDirectivesModule]
|
|
64
|
+
}]
|
|
65
|
+
}] });
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Component, forwardRef } from '@angular/core';
|
|
6
|
+
import { Messages } from './messages';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
9
|
+
/**
|
|
10
|
+
* Custom component messages override default component messages
|
|
11
|
+
* ([see example]({% slug label_globalization %}#toc-localization)).
|
|
12
|
+
*/
|
|
13
|
+
export class CustomMessagesComponent extends Messages {
|
|
14
|
+
constructor(service) {
|
|
15
|
+
super();
|
|
16
|
+
this.service = service;
|
|
17
|
+
}
|
|
18
|
+
get override() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
23
|
+
CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CustomMessagesComponent, selector: "kendo-label-messages, kendo-floatinglabel-messages", providers: [
|
|
24
|
+
{
|
|
25
|
+
provide: Messages,
|
|
26
|
+
useExisting: forwardRef(() => CustomMessagesComponent)
|
|
27
|
+
}
|
|
28
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, decorators: [{
|
|
30
|
+
type: Component,
|
|
31
|
+
args: [{
|
|
32
|
+
providers: [
|
|
33
|
+
{
|
|
34
|
+
provide: Messages,
|
|
35
|
+
useExisting: forwardRef(() => CustomMessagesComponent)
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
selector: 'kendo-label-messages, kendo-floatinglabel-messages',
|
|
39
|
+
template: ``
|
|
40
|
+
}]
|
|
41
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|