p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
2 lines • 5.07 kB
JavaScript
import {Y}from'./chunk-BAYRo-WK.js';import {X as Xe,cV as z,d1 as Ue,f as fQ,G as It,F as x,_ as _e,m as mb,aJ as jn,c$ as Pn,cj as He,co as rn,bd as On,d0 as xn,de as Tt,be as tn,bE as Jt,cW as zt,cX as jt,cY as Vt,cZ as Nt,bc as Ut,ba as qe,cp as q,ck as Ve,cl as Be,e as aY,aK as iY,g as _A,y as yt,w as wt,d as ae,s as se,B as Ba,k as bv,I as IS,v as vf,cr as Lv,bj as Mx,c as In,t as If,R as Rv,cs as Fv,p as pv,bk as Nx,cu as AS}from'./chunk-BwlFOdbx.js';import {E,F,K,I}from'./main-HNF44SV3.js';import {Q}from'./chunk-BnyV8OX_.js';var lt=I((yt,rt)=>{rt.exports=ut;var gt={hoursPerDay:24,daysPerWeek:7,weeksPerMonth:4,monthsPerYear:12,daysPerYear:365.25},nt={ms:["ms","milli","millisecond","milliseconds"],s:["s","sec","secs","second","seconds"],m:["m","min","mins","minute","minutes"],h:["h","hr","hrs","hour","hours"],d:["d","day","days"],w:["w","week","weeks"],mth:["mon","mth","mths","month","months"],y:["y","yr","yrs","year","years"]};function ut(t,i,n){n=Object.assign({},gt,n||{}),(typeof t=="number"||t.match(/^[-+]?[0-9.]+$/g))&&(t=parseInt(t)+"ms");let a=0,e=ht(n),m=t.toLowerCase().replace(/[^.\w+-]+/g,"").match(/[-+]?[0-9.]+[a-z]+/g);if(m===null)throw new Error(`The value [${t}] could not be parsed by timestring`);return m.forEach(o=>{let st=o.match(/[0-9.]+/g)[0],ct=o.match(/[a-z]+/g)[0];a+=ft(st,ct,e);}),i?Tt(a,i,e):a}function ht(t){let i={ms:.001,s:1,m:60,h:3600};return i.d=t.hoursPerDay*i.h,i.w=t.daysPerWeek*i.d,i.mth=t.daysPerYear/t.monthsPerYear*i.d,i.y=t.daysPerYear*i.d,i}function ot(t){for(let i of Object.keys(nt))if(nt[i].indexOf(t)>-1)return i;throw new Error(`The unit [${t}] is not supported by timestring`)}function ft(t,i,n){return t*n[ot(i)]}function Tt(t,i,n){return t/n[ot(i)]}});var at=K(lt()),mt=K(Y());var Bt=(()=>{class t{dialogRef;data;i18n;common;settingsService;model={ttl:-1};convertTextToTime="";strings;constructor(n,a,e,m,o){this.dialogRef=n,this.data=a,this.i18n=e,this.common=m,this.settingsService=o,this.strings=this.i18n.strings;}ngOnInit(){if(this.model=E({},this.data.model),typeof this.model.ttl=="number"&&this.model.ttl>0)try{let n=this.settingsService.getHumanizeDurationOptions();this.convertTextToTime=(0,mt.default)(this.model.ttl*1e3,F(E({},n),{delimiter:" "}));}catch(n){this.convertTextToTime="";}}onTextTimeChange(n){try{this.model.ttl=(0,at.default)(String(n),"s");}catch(a){console.warn("timestring parse error",a);}}openTimestringNpm(){window.open("https://www.npmjs.com/package/timestring#keywords","_blank");}submit(){isNaN(this.model.ttl)&&(this.model.ttl=Math.round(this.model.ttl)),this.dialogRef.close({model:this.model});}cancel(){this.dialogRef.close(void 0);}static \u0275fac=function(a){return new(a||t)(Xe(z),Xe(Ue),Xe(fQ),Xe(It),Xe(x))};static \u0275cmp=_e({type:t,selectors:[["p3xr-ttl-dialog"]],decls:26,vars:9,consts:[["novalidate","",3,"ngSubmit"],[1,"p3xr-dialog-toolbar","p3xr-mat-layout-strong"],["mat-dialog-title","",1,"p3xr-dialog-title"],["mat-icon-button","","type","button",3,"click"],[1,"p3xr-dialog-content"],[1,"full-width"],["matInput","","type","number","name","ttl","min","-1",3,"ngModelChange","ngModel","placeholder"],["matInput","","name","convertTextToTime",3,"ngModelChange","ngModel","placeholder"],["mat-button","","type","button",1,"btn-accent","p3xr-timestring-link",3,"click"],[1,"p3xr-dialog-actions"],[3,"cancel"],["mat-raised-button","","type","submit",1,"btn-primary"]],template:function(a,e){a&1&&(Ba(0,"form",0),bv("ngSubmit",function(){return e.submit()}),Ba(1,"mat-toolbar",1)(2,"span",2),IS(3),vf(),Ba(4,"button",3),bv("click",function(){return e.cancel()}),Ba(5,"mat-icon"),IS(6,"close"),vf()()(),Ba(7,"mat-dialog-content",4)(8,"div"),IS(9),vf(),Ba(10,"mat-form-field",5)(11,"mat-label"),IS(12),vf(),Ba(13,"input",6),Lv("ngModelChange",function(o){return AS(e.model.ttl,o)||(e.model.ttl=o),o}),vf(),Mx(),vf(),Ba(14,"mat-form-field",5)(15,"mat-label"),IS(16),vf(),Ba(17,"input",7),Lv("ngModelChange",function(o){return AS(e.convertTextToTime,o)||(e.convertTextToTime=o),o}),bv("ngModelChange",function(o){return e.onTextTimeChange(o)}),vf(),Mx(),vf(),Ba(18,"button",8),bv("click",function(){return e.openTimestringNpm()}),IS(19," https://www.npmjs.com/package/timestring "),vf()(),Ba(20,"mat-dialog-actions",9)(21,"p3xr-dialog-cancel",10),bv("cancel",function(){return e.cancel()}),vf(),Ba(22,"button",11)(23,"mat-icon"),IS(24,"timer"),vf(),IS(25),vf()()()),a&2&&(In(3),If(" ",e.strings().confirm?.ttl?.title," "),In(6),Rv(e.strings().confirm?.ttl?.textContent),In(3),Rv(e.strings().confirm?.ttl?.placeholder),In(),Fv("ngModel",e.model.ttl),pv("placeholder",e.strings().confirm?.ttl?.placeholderPlaceholder),Nx(),In(3),Rv(e.strings().confirm?.ttl?.convertTextToTime),In(),Fv("ngModel",e.convertTextToTime),pv("placeholder",e.strings().confirm?.ttl?.convertTextToTimePlaceholder),Nx(),In(8),If(" ",e.strings().intention?.ttl," "));},dependencies:[mb,jn,Pn,He,rn,On,xn,Tt,tn,Jt,zt,jt,Vt,Nt,Ut,qe,q,Ve,Be,aY,iY,_A,yt,wt,ae,se,Q],styles:[".full-width[_ngcontent-%COMP%]{width:100%}"],changeDetection:1})}return t})();
export{Bt as TtlDialogComponent};