UNPKG

otus-localization

Version:

A translation tool for Angular i18n(angular-t9n)

1 lines 14.9 kB
"use strict";(self.webpackChunkotus_translation=self.webpackChunkotus_translation||[]).push([[269],{6529:(E,x,n)=>{n.d(x,{t:()=>M});var u=n(1476),t=n(3566),b=n(8645),m=n(3019),P=n(6232),f=n(9773),p=n(5879),c=n(1896),O=n(6223);let M=(()=>{class _{constructor(s,r,g){this._route=s,this._router=r,this.filter=g,this._destroy=new b.x;const l=this._route.snapshot.queryParamMap;this.queryParams=this._route.queryParams,this.pageSize=this._toInteger(l.get("entriesPerPage")),this.pageIndex=this._toInteger(l.get("page"))}ngOnInit(){this._applyCurrentSort(),this._applyCurrentFilter(),(0,m.T)(this.paginator.page,this.sort.sortChange,this.filter?this.filter.valueChanges:P.E).pipe((0,f.R)(this._destroy)).subscribe(()=>this._applyToQueryParams())}ngOnDestroy(){this._destroy.next(),this._destroy.complete()}_toInteger(s){return s&&Number.isInteger(+s)?+s:0}_applyCurrentSort(){const s=this._route.snapshot.queryParamMap.get("sort");if(!s)return;const r=s.startsWith("!")?"desc":"asc",g="desc"===r?s.substring(1):s;this.sort.sort({id:g,start:r,disableClear:!1})}_applyCurrentFilter(){if(!this.filter)return;const s=this._route.snapshot.queryParamMap,r=Object.keys(this.filter.controls).filter(g=>s.get(g)).reduce((g,l)=>Object.assign(g,{[l]:s.get(l)}),{});this.filter.patchValue(r)}_applyToQueryParams(){const{paginator:s,sort:r,filter:g}=this,l=Object.assign({},s.pageSize!==s.pageSizeOptions[0]?{entriesPerPage:s.pageSize}:void 0,s.pageIndex?{page:s.pageIndex}:void 0,r.active&&r.direction?{sort:`${"desc"===r.direction?"!":""}${r.active}`}:void 0,g?Object.keys(g.controls).filter(I=>g.get(I).value).reduce((I,T)=>Object.assign(I,{[T]:g.get(T).value}),{}):void 0);this._router.navigate([],{relativeTo:this._route,queryParams:l})}static{this.\u0275fac=function(r){return new(r||_)(p.Y36(c.gz),p.Y36(c.F0),p.Y36(O.nJ))}}static{this.\u0275dir=p.lG2({type:_,viewQuery:function(r,g){if(1&r&&(p.Gf(u.NW,7),p.Gf(t.YE,7)),2&r){let l;p.iGM(l=p.CRH())&&(g.paginator=l.first),p.iGM(l=p.CRH())&&(g.sort=l.first)}}})}}return _})()},2887:(E,x,n)=>{n.d(x,{k:()=>O});var u=n(8337),t=n(8645),b=n(3019),m=n(6232),P=n(3620),f=n(4664),p=n(9397),c=n(7398);class O extends u.o2{constructor(_,d,s){super(),this._paginator=_,this._sort=d,this._filter=s,this._internalPageChanges=new t.x}connect(){return(0,b.T)(this._paginator.page,this._internalPageChanges,this._paginator.initialized,this._sort.sortChange,this._filter?this._filter.valueChanges:m.E).pipe((0,P.b)(100),(0,f.w)(()=>this._fetchData(this._paginator,this._sort,this._filter)),(0,p.b)(_=>this._updatePaginator(_.totalEntries)),(0,c.U)(_=>this._mapPaginationResponse(_)))}disconnect(){}_mapPaginationResponse(_){return _._embedded.entries}_updatePaginator(_){Promise.resolve().then(()=>{const d=this._paginator;if(d&&(d.length=_,d.pageIndex>0)){const s=Math.ceil(d.length/d.pageSize)-1||0,r=Math.min(d.pageIndex,s);r!==d.pageIndex&&(d.pageIndex=r,this._internalPageChanges.next())}})}}},1476:(E,x,n)=>{n.d(x,{NW:()=>R,TU:()=>U});var u=n(6814),t=n(5879),b=n(8645),m=n(2296),P=n(8525),f=n(2596),p=n(3680),c=n(2495),O=n(5683);function M(a,v){if(1&a&&(t.TgZ(0,"mat-option",19),t._uU(1),t.qZA()),2&a){const e=v.$implicit;t.Q6J("value",e),t.xp6(1),t.hij(" ",e," ")}}function _(a,v){if(1&a){const e=t.EpF();t.TgZ(0,"mat-form-field",16)(1,"mat-select",17),t.NdJ("selectionChange",function(i){t.CHM(e);const h=t.oxw(2);return t.KtG(h._changePageSize(i.value))}),t.YNc(2,M,2,2,"mat-option",18),t.qZA()()}if(2&a){const e=t.oxw(2);t.Q6J("appearance",e._formFieldAppearance)("color",e.color),t.xp6(1),t.Q6J("value",e.pageSize)("disabled",e.disabled)("aria-labelledby",e._pageSizeLabelId)("panelClass",e.selectConfig.panelClass||"")("disableOptionCentering",e.selectConfig.disableOptionCentering),t.xp6(1),t.Q6J("ngForOf",e._displayedPageSizeOptions)}}function d(a,v){if(1&a&&(t.TgZ(0,"div",20),t._uU(1),t.qZA()),2&a){const e=t.oxw(2);t.xp6(1),t.Oqu(e.pageSize)}}function s(a,v){if(1&a&&(t.TgZ(0,"div",12)(1,"div",13),t._uU(2),t.qZA(),t.YNc(3,_,3,8,"mat-form-field",14),t.YNc(4,d,2,1,"div",15),t.qZA()),2&a){const e=t.oxw();t.xp6(1),t.s9C("id",e._pageSizeLabelId),t.xp6(1),t.hij(" ",e._intl.itemsPerPageLabel," "),t.xp6(1),t.Q6J("ngIf",e._displayedPageSizeOptions.length>1),t.xp6(1),t.Q6J("ngIf",e._displayedPageSizeOptions.length<=1)}}function r(a,v){if(1&a){const e=t.EpF();t.TgZ(0,"button",21),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.firstPage())}),t.O4$(),t.TgZ(1,"svg",7),t._UZ(2,"path",22),t.qZA()()}if(2&a){const e=t.oxw();t.Q6J("matTooltip",e._intl.firstPageLabel)("matTooltipDisabled",e._previousButtonsDisabled())("matTooltipPosition","above")("disabled",e._previousButtonsDisabled()),t.uIk("aria-label",e._intl.firstPageLabel)}}function g(a,v){if(1&a){const e=t.EpF();t.O4$(),t.kcU(),t.TgZ(0,"button",23),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return t.KtG(i.lastPage())}),t.O4$(),t.TgZ(1,"svg",7),t._UZ(2,"path",24),t.qZA()()}if(2&a){const e=t.oxw();t.Q6J("matTooltip",e._intl.lastPageLabel)("matTooltipDisabled",e._nextButtonsDisabled())("matTooltipPosition","above")("disabled",e._nextButtonsDisabled()),t.uIk("aria-label",e._intl.lastPageLabel)}}let l=(()=>{class a{constructor(){this.changes=new b.x,this.itemsPerPageLabel="Items per page:",this.nextPageLabel="Next page",this.previousPageLabel="Previous page",this.firstPageLabel="First page",this.lastPageLabel="Last page",this.getRangeLabel=(e,o,i)=>{if(0==i||0==o)return`0 of ${i}`;const h=e*o;return`${h+1} \u2013 ${h<(i=Math.max(i,0))?Math.min(h+o,i):h+o} of ${i}`}}static{this.\u0275fac=function(o){return new(o||a)}}static{this.\u0275prov=t.Yz7({token:a,factory:a.\u0275fac,providedIn:"root"})}}return a})();const T={provide:l,deps:[[new t.FiY,new t.tp0,l]],useFactory:function I(a){return a||new l}},L=new t.OlP("MAT_PAGINATOR_DEFAULT_OPTIONS"),C=(0,p.Id)((0,p.dB)(class{}));let A=(()=>{class a extends C{get pageIndex(){return this._pageIndex}set pageIndex(e){this._pageIndex=Math.max((0,c.su)(e),0),this._changeDetectorRef.markForCheck()}get length(){return this._length}set length(e){this._length=(0,c.su)(e),this._changeDetectorRef.markForCheck()}get pageSize(){return this._pageSize}set pageSize(e){this._pageSize=Math.max((0,c.su)(e),0),this._updateDisplayedPageSizeOptions()}get pageSizeOptions(){return this._pageSizeOptions}set pageSizeOptions(e){this._pageSizeOptions=(e||[]).map(o=>(0,c.su)(o)),this._updateDisplayedPageSizeOptions()}get hidePageSize(){return this._hidePageSize}set hidePageSize(e){this._hidePageSize=(0,c.Ig)(e)}get showFirstLastButtons(){return this._showFirstLastButtons}set showFirstLastButtons(e){this._showFirstLastButtons=(0,c.Ig)(e)}constructor(e,o,i){if(super(),this._intl=e,this._changeDetectorRef=o,this._pageIndex=0,this._length=0,this._pageSizeOptions=[],this._hidePageSize=!1,this._showFirstLastButtons=!1,this.selectConfig={},this.page=new t.vpe,this._intlChanges=e.changes.subscribe(()=>this._changeDetectorRef.markForCheck()),i){const{pageSize:h,pageSizeOptions:D,hidePageSize:z,showFirstLastButtons:y}=i;null!=h&&(this._pageSize=h),null!=D&&(this._pageSizeOptions=D),null!=z&&(this._hidePageSize=z),null!=y&&(this._showFirstLastButtons=y)}}ngOnInit(){this._initialized=!0,this._updateDisplayedPageSizeOptions(),this._markInitialized()}ngOnDestroy(){this._intlChanges.unsubscribe()}nextPage(){if(!this.hasNextPage())return;const e=this.pageIndex;this.pageIndex=this.pageIndex+1,this._emitPageEvent(e)}previousPage(){if(!this.hasPreviousPage())return;const e=this.pageIndex;this.pageIndex=this.pageIndex-1,this._emitPageEvent(e)}firstPage(){if(!this.hasPreviousPage())return;const e=this.pageIndex;this.pageIndex=0,this._emitPageEvent(e)}lastPage(){if(!this.hasNextPage())return;const e=this.pageIndex;this.pageIndex=this.getNumberOfPages()-1,this._emitPageEvent(e)}hasPreviousPage(){return this.pageIndex>=1&&0!=this.pageSize}hasNextPage(){const e=this.getNumberOfPages()-1;return this.pageIndex<e&&0!=this.pageSize}getNumberOfPages(){return this.pageSize?Math.ceil(this.length/this.pageSize):0}_changePageSize(e){const i=this.pageIndex;this.pageIndex=Math.floor(this.pageIndex*this.pageSize/e)||0,this.pageSize=e,this._emitPageEvent(i)}_nextButtonsDisabled(){return this.disabled||!this.hasNextPage()}_previousButtonsDisabled(){return this.disabled||!this.hasPreviousPage()}_updateDisplayedPageSizeOptions(){this._initialized&&(this.pageSize||(this._pageSize=0!=this.pageSizeOptions.length?this.pageSizeOptions[0]:50),this._displayedPageSizeOptions=this.pageSizeOptions.slice(),-1===this._displayedPageSizeOptions.indexOf(this.pageSize)&&this._displayedPageSizeOptions.push(this.pageSize),this._displayedPageSizeOptions.sort((e,o)=>e-o),this._changeDetectorRef.markForCheck())}_emitPageEvent(e){this.page.emit({previousPageIndex:e,pageIndex:this.pageIndex,pageSize:this.pageSize,length:this.length})}static{this.\u0275fac=function(o){t.$Z()}}static{this.\u0275dir=t.lG2({type:a,inputs:{color:"color",pageIndex:"pageIndex",length:"length",pageSize:"pageSize",pageSizeOptions:"pageSizeOptions",hidePageSize:"hidePageSize",showFirstLastButtons:"showFirstLastButtons",selectConfig:"selectConfig"},outputs:{page:"page"},features:[t.qOj]})}}return a})(),B=0,R=(()=>{class a extends A{constructor(e,o,i){super(e,o,i),this._pageSizeLabelId="mat-paginator-page-size-label-"+B++,this._formFieldAppearance=i?.formFieldAppearance||"outline"}static{this.\u0275fac=function(o){return new(o||a)(t.Y36(l),t.Y36(t.sBO),t.Y36(L,8))}}static{this.\u0275cmp=t.Xpm({type:a,selectors:[["mat-paginator"]],hostAttrs:["role","group",1,"mat-mdc-paginator"],inputs:{disabled:"disabled"},exportAs:["matPaginator"],features:[t.qOj],decls:14,vars:14,consts:[[1,"mat-mdc-paginator-outer-container"],[1,"mat-mdc-paginator-container"],["class","mat-mdc-paginator-page-size",4,"ngIf"],[1,"mat-mdc-paginator-range-actions"],["aria-live","polite",1,"mat-mdc-paginator-range-label"],["mat-icon-button","","type","button","class","mat-mdc-paginator-navigation-first",3,"matTooltip","matTooltipDisabled","matTooltipPosition","disabled","click",4,"ngIf"],["mat-icon-button","","type","button",1,"mat-mdc-paginator-navigation-previous",3,"matTooltip","matTooltipDisabled","matTooltipPosition","disabled","click"],["viewBox","0 0 24 24","focusable","false","aria-hidden","true",1,"mat-mdc-paginator-icon"],["d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"],["mat-icon-button","","type","button",1,"mat-mdc-paginator-navigation-next",3,"matTooltip","matTooltipDisabled","matTooltipPosition","disabled","click"],["d","M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"],["mat-icon-button","","type","button","class","mat-mdc-paginator-navigation-last",3,"matTooltip","matTooltipDisabled","matTooltipPosition","disabled","click",4,"ngIf"],[1,"mat-mdc-paginator-page-size"],[1,"mat-mdc-paginator-page-size-label",3,"id"],["class","mat-mdc-paginator-page-size-select",3,"appearance","color",4,"ngIf"],["class","mat-mdc-paginator-page-size-value",4,"ngIf"],[1,"mat-mdc-paginator-page-size-select",3,"appearance","color"],["hideSingleSelectionIndicator","",3,"value","disabled","aria-labelledby","panelClass","disableOptionCentering","selectionChange"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"mat-mdc-paginator-page-size-value"],["mat-icon-button","","type","button",1,"mat-mdc-paginator-navigation-first",3,"matTooltip","matTooltipDisabled","matTooltipPosition","disabled","click"],["d","M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"],["mat-icon-button","","type","button",1,"mat-mdc-paginator-navigation-last",3,"matTooltip","matTooltipDisabled","matTooltipPosition","disabled","click"],["d","M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"]],template:function(o,i){1&o&&(t.TgZ(0,"div",0)(1,"div",1),t.YNc(2,s,5,4,"div",2),t.TgZ(3,"div",3)(4,"div",4),t._uU(5),t.qZA(),t.YNc(6,r,3,5,"button",5),t.TgZ(7,"button",6),t.NdJ("click",function(){return i.previousPage()}),t.O4$(),t.TgZ(8,"svg",7),t._UZ(9,"path",8),t.qZA()(),t.kcU(),t.TgZ(10,"button",9),t.NdJ("click",function(){return i.nextPage()}),t.O4$(),t.TgZ(11,"svg",7),t._UZ(12,"path",10),t.qZA()(),t.YNc(13,g,3,5,"button",11),t.qZA()()()),2&o&&(t.xp6(2),t.Q6J("ngIf",!i.hidePageSize),t.xp6(3),t.hij(" ",i._intl.getRangeLabel(i.pageIndex,i.pageSize,i.length)," "),t.xp6(1),t.Q6J("ngIf",i.showFirstLastButtons),t.xp6(1),t.Q6J("matTooltip",i._intl.previousPageLabel)("matTooltipDisabled",i._previousButtonsDisabled())("matTooltipPosition","above")("disabled",i._previousButtonsDisabled()),t.uIk("aria-label",i._intl.previousPageLabel),t.xp6(3),t.Q6J("matTooltip",i._intl.nextPageLabel)("matTooltipDisabled",i._nextButtonsDisabled())("matTooltipPosition","above")("disabled",i._nextButtonsDisabled()),t.uIk("aria-label",i._intl.nextPageLabel),t.xp6(3),t.Q6J("ngIf",i.showFirstLastButtons))},dependencies:[u.sg,u.O5,m.RK,O.KE,P.gD,p.ey,f.gM],styles:[".mat-mdc-paginator{display:block;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:var(--mat-paginator-container-text-color);background-color:var(--mat-paginator-container-background-color);font-family:var(--mat-paginator-container-text-font);line-height:var(--mat-paginator-container-text-line-height);font-size:var(--mat-paginator-container-text-size);font-weight:var(--mat-paginator-container-text-weight);letter-spacing:var(--mat-paginator-container-text-tracking)}.mat-mdc-paginator .mat-mdc-select-value{font-size:var(--mat-paginator-select-trigger-text-size)}.mat-mdc-paginator .mat-mdc-form-field-subscript-wrapper{display:none}.mat-mdc-paginator .mat-mdc-select{line-height:1.5}.mat-mdc-paginator-outer-container{display:flex}.mat-mdc-paginator-container{display:flex;align-items:center;justify-content:flex-end;padding:0 8px;flex-wrap:wrap-reverse;width:100%;min-height:var(--mat-paginator-container-size)}.mat-mdc-paginator-page-size{display:flex;align-items:baseline;margin-right:8px}[dir=rtl] .mat-mdc-paginator-page-size{margin-right:0;margin-left:8px}.mat-mdc-paginator-page-size-label{margin:0 4px}.mat-mdc-paginator-page-size-select{margin:0 4px;width:84px}.mat-mdc-paginator-range-label{margin:0 32px 0 24px}.mat-mdc-paginator-range-actions{display:flex;align-items:center}.mat-mdc-paginator-icon{display:inline-block;width:28px;fill:var(--mat-paginator-enabled-icon-color)}.mat-mdc-icon-button[disabled] .mat-mdc-paginator-icon{fill:var(--mat-paginator-disabled-icon-color)}[dir=rtl] .mat-mdc-paginator-icon{transform:rotate(180deg)}.cdk-high-contrast-active .mat-mdc-icon-button[disabled] .mat-mdc-paginator-icon,.cdk-high-contrast-active .mat-mdc-paginator-icon{fill:currentColor;fill:CanvasText}.cdk-high-contrast-active .mat-mdc-paginator-range-actions .mat-mdc-icon-button{outline:solid 1px}"],encapsulation:2,changeDetection:0})}}return a})(),U=(()=>{class a{static{this.\u0275fac=function(o){return new(o||a)}}static{this.\u0275mod=t.oAB({type:a})}static{this.\u0275inj=t.cJS({providers:[T],imports:[u.ez,m.ot,P.LD,f.AV]})}}return a})()}}]);