amotify 0.2.273 → 0.2.274
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/demo/next/package.json +1 -1
- package/dist/@utils/GenerateClassName.js +1 -1
- package/dist/@utils/config.js +1 -1
- package/dist/@utils/getElement.js +1 -1
- package/dist/atoms/Logo.js +1 -1
- package/dist/atoms/index.js +1 -1
- package/dist/fn/Button.d.ts +4 -4
- package/dist/fn/Button.js +1 -1
- package/dist/fn/Cropper.js +1 -1
- package/dist/fn/Input/Autocomplete.d.ts +3 -3
- package/dist/fn/Input/Autocomplete.js +1 -1
- package/dist/fn/Input/CollectForm.d.ts +2 -2
- package/dist/fn/Input/CollectForm.js +1 -1
- package/dist/fn/Input/DigitCharacters.js +1 -1
- package/dist/fn/Input/Drum.d.ts +2 -2
- package/dist/fn/Input/Drum.js +1 -1
- package/dist/fn/Input/Filer.js +1 -1
- package/dist/fn/Input/Hidden.d.ts +2 -2
- package/dist/fn/Input/Hidden.js +1 -1
- package/dist/fn/Input/List.d.ts +2 -2
- package/dist/fn/Input/List.js +1 -1
- package/dist/fn/Input/Segmented.d.ts +2 -2
- package/dist/fn/Input/Segmented.js +1 -1
- package/dist/fn/Input/Select.d.ts +2 -2
- package/dist/fn/Input/Select.js +1 -1
- package/dist/fn/Input/Slider.js +1 -1
- package/dist/fn/Input/TextField.js +2 -2
- package/dist/fn/Input/Time/Selector.js +1 -1
- package/dist/fn/Input/Time/index.js +1 -1
- package/dist/fn/Input/core.d.ts +4 -4
- package/dist/fn/Input/core.js +1 -1
- package/dist/fn/RootViewController.js +1 -1
- package/dist/fn/Sheet.js +1 -1
- package/dist/fn/Snackbar.js +1 -1
- package/dist/fn/SwipeView.js +1 -1
- package/dist/fn/Table/Data.js +1 -1
- package/dist/fn/Table/cellStyling.js +1 -1
- package/dist/mols/Accordion.js +1 -1
- package/package.json +2 -2
package/demo/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as ze,d as Ne}from"../chunk-C5N2D3ZX.js";import d from"jmini";import{Config as Fe}from".";const e={toConcreteBorderRadius:n=>{let A=Fe.get().roundness|0;return n=="1.tone.primary"?n=[0,2,3,4,5,5][A]:n=="2.tone.secondary"?n=[0,1,2,3,4,5][A]:n=="3.tone.tertiary"&&(n=[0,"1/3","2/3",1,2,3][A]),n},ev:n=>d.is.exist(n),ClassNames:(n,A)=>{var O,Re,Ce,N,Be,Te,_e,Le,we,We;let i=[],{gap:l,display:R,position:C,overflow:P,fontColor:E,fontSize:G,fontWeight:j,fontHeight:g,backgroundColor:q,textAlign:H,textDecoration:M,boxShadow:D,margin:p,marginTop:S,marginRight:o,marginBottom:r,marginLeft:y,padding:f,paddingTop:s,paddingRight:x,paddingBottom:B,paddingLeft:T,top:X,right:J,bottom:Q,left:Y,border:z,borderTop:u,borderRight:v,borderBottom:m,borderLeft:b,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:k,borderTopLeftRadius:_,borderTopRightRadius:L,borderBottomLeftRadius:w,borderBottomRightRadius:W,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce}=A;{if(e.ev(R)&&i.push("dsp"+R),P){let c=d.Arrayify(P);i.push("ovfl-x-"+c[0]),i.push("ovfl-y-"+(c[1]||c[0]))}e.ev(C)&&i.push("ps"+C),e.ev(H)&&i.push("txtalg"+H),e.ev(H)&&i.push("txtdeco"+M),e.ev(E)&&i.push("ftcl"+((O=String(E))==null?void 0:O.replace(/\./g,"_"))),e.ev(G)&&i.push("ftsz"+((Re=String(G))==null?void 0:Re.replace(/\..*/,""))),e.ev(j)&&i.push("ftwgt"+((Ce=String(j))==null?void 0:Ce.replace(/\..*/,""))),e.ev(g)&&i.push("fthgt"+((N=String(g))==null?void 0:N.replace(/\./g,"_"))),e.ev(q)&&i.push("bgc"+((Be=String(q))==null?void 0:Be.replace(/\./g,"_"))),e.ev(D)&&i.push("bs"+D);let U,$,V,I;d.is.exist(p)&&(d.is.array(p)?p.length==2?[U,$,V,I]=[...p,...p]:p.length==4&&([U,$,V,I]=p):U=$=V=I=p,S=S!=null?S:U,o=o!=null?o:$,r=r!=null?r:V,y=y!=null?y:I),e.ev(S)&&i.push("mrgt"+S),e.ev(o)&&i.push("mrgr"+o),e.ev(r)&&i.push("mrgb"+r),e.ev(y)&&i.push("mrgl"+y);let K,t,Ae,ye;d.is.exist(f)&&(d.is.array(f)?f.length==2?[K,t,Ae,ye]=[...f,...f]:f.length==4&&([K,t,Ae,ye]=f):K=t=Ae=ye=f,s=s!=null?s:K,x=x!=null?x:t,B=B!=null?B:Ae,T=T!=null?T:ye),e.ev(s)&&i.push("pdt"+s),e.ev(x)&&i.push("pdr"+x),e.ev(B)&&i.push("pdb"+B),e.ev(T)&&i.push("pdl"+T),e.ev(X)&&i.push("pstt"+X),e.ev(J)&&i.push("pstr"+J),e.ev(Q)&&i.push("pstb"+Q),e.ev(Y)&&i.push("pstl"+Y);{d.is.exist(z)&&(u=u!=null?u:z,v=v!=null?v:z,m=m!=null?m:z,b=b!=null?b:z),d.is.boolean(u)&&(u=["unset","2.normal"][Number(u)]),d.is.boolean(v)&&(v=["unset","2.normal"][Number(v)]),d.is.boolean(m)&&(m=["unset","2.normal"][Number(m)]),d.is.boolean(b)&&(b=["unset","2.normal"][Number(b)]),e.ev(u)&&i.push("b_t_ss"+((Te=String(u))==null?void 0:Te.replace(/\./g,"_"))),e.ev(v)&&i.push("b_r_ss"+((_e=String(v))==null?void 0:_e.replace(/\./g,"_"))),e.ev(m)&&i.push("b_b_ss"+((Le=String(m))==null?void 0:Le.replace(/\./g,"_"))),e.ev(b)&&i.push("b_l_ss"+((we=String(b))==null?void 0:we.replace(/\./g,"_"))),d.is.exist(Z)&&i.push("b_wth"+String(Z)),d.is.exist(ee)&&i.push("b_cl"+((We=String(ee))==null?void 0:We.replace(/\./g,"_"))),d.is.exist(te)&&i.push("b_st"+String(te));{let c,h,F,He;d.is.exist(k)&&(d.is.array(k)?k.length==4&&([c,h,He,F]=k):c=h=F=He=k,_=_!=null?_:c,L=L!=null?L:h,w=w!=null?w:F,W=W!=null?W:He)}e.ev(_)&&i.push("br_tl"+e.toConcreteBorderRadius(_)),e.ev(L)&&i.push("br_tr"+e.toConcreteBorderRadius(L)),e.ev(w)&&i.push("br_bl"+e.toConcreteBorderRadius(w)),e.ev(W)&&i.push("br_br"+e.toConcreteBorderRadius(W))}if(e.ev(ce)&&i.push("op"+ce),d.is.exist(l)){let c,h;d.is.array(l)?(c=l[0],h=l[1]):c=h=l,i.push("gapRow"+c,"gapCol"+h)}e.ev(ie)&&i.push("flsz"+ie),e.ev(re)&&i.push("flwrp"+re),e.ev(oe)&&i.push("fltyp"+oe),e.ev(se)&&i.push("flchld"+se),e.ev(ae)&&i.push("flgrid"+ae),e.ev(ne)&&i.push("flvrt"+ne),e.ev(de)&&i.push("flhrz"+de),e.ev(ge)&&i.push("grcnt"+ge),e.ev(pe)&&i.push("grcol"+pe),e.ev(be)&&i.push("hgt"+be),e.ev(me)&&i.push("wdt"+me),e.ev(Se)&&i.push("unthgt"+Se),e.ev(xe)&&i.push("untwdt"+xe),e.ev(le)&&i.push("trnst"+le),e.ev(he)&&i.push("maxh"+he),e.ev(fe)&&i.push("minh"+fe),e.ev(ue)&&i.push("maxw"+ue),e.ev(ve)&&i.push("minw"+ve)}return i.length?n+i.join(" "+n):""}},Ge=n=>{let y=a({},n),{gradients:i,ssCardBox:l,ssSphere:R,ssSquare:C,ssPushable:P,ssAbsoluteCovered:E,ssHiddenOnBreak:G,ssTextEllipsis:j,flexCenter:g,flexNewLine:q,isLightFont:H,isBoldFont:M,isSemiBoldFont:D,isRounded:p,isSquare:S,freeCSS:f={}}=y,o=Ne(f,[]),r=Ne(y,["gradients","ssCardBox","ssSphere","ssSquare","ssPushable","ssAbsoluteCovered","ssHiddenOnBreak","ssTextEllipsis","flexCenter","flexNewLine","isLightFont","isBoldFont","isSemiBoldFont","isRounded","isSquare","freeCSS"]);if(o=o||{},r=r||{},i){let{deg:s,colors:x}=i;o=ze(a({},o),{background:`linear-gradient(${s}deg,${x.join(",")})`})}if(l){l===!0&&(l="border");let s={backgroundColor:"layer.1",borderRadius:"1.tone.primary",boxShadow:"0.min"};l=="border"?s.border=!0:l=="plain"?(s.backgroundColor="layer.1",s.boxShadow="none"):l=="cloud"?s.backgroundColor="cloud":l=="shadow"&&(s.boxShadow="0.normal"),Fe.get().darkMode=="dim"&&(s.boxShadow="1.normal"),Fe.get().darkMode=="dark"&&(s.boxShadow="1.remark"),o=a(a({},s.freeCSS),o),r=a(a({},s),r)}return R&&(g=g!=null?g:!0,r=a({padding:0,unitWidth:R,unitHeight:R,borderRadius:"sphere",flexSizing:"none"},r)),C&&(g=g!=null?g:!0,r=a({padding:0,unitWidth:C,unitHeight:C,flexSizing:"none"},r)),G&&(r=ze(a({},r),{UnderBreakPointStyles:a({display:"none"},r.UnderBreakPointStyles)})),P&&(r=a({transition:"middle"},r),r=ze(a({},r),{className:[r.className,"ssPushable"].join(" ")})),E&&(r=a({position:"absolute",top:0,left:0,right:0,bottom:0},r)),j&&(r=a({overflow:"hidden"},r),o=a({whiteSpace:"nowrap",textOverflow:"ellipsis"},o)),q&&(r=a({width:1,flexSizing:"none"},r)),g&&(r=a({display:"flex",horizontalAlign:"center",verticalAlign:"center"},r)),H&&(r.fontWeight="1.light"),D&&(r.fontWeight="3.semiBold"),M&&(r.fontWeight="4.bold"),p&&(r.borderRadius="sphere",d.is.number(p)&&(o.borderRadius=p*12)),S&&(o.aspectRatio="1"),ze(a({},r),{freeCSS:o})},Ue=n=>{let He=Ge(n),{componentId:i,gap:l,display:R,position:C,overflow:P,fontColor:E,fontSize:G,fontWeight:j,fontHeight:g,backgroundColor:q,textAlign:H,textDecoration:M,boxShadow:D,margin:p,marginTop:S,marginRight:o,marginBottom:r,marginLeft:y,padding:f,paddingTop:s,paddingRight:x,paddingBottom:B,paddingLeft:T,top:X,right:J,bottom:Q,left:Y,border:z,borderTop:u,borderRight:v,borderBottom:m,borderLeft:b,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:k,borderTopLeftRadius:_,borderTopRightRadius:L,borderBottomLeftRadius:w,borderBottomRightRadius:W,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce,ssLastChildLossBorder:O,ssAbsoluteCovered:Re,ssCardBox:Ce,ssEffectsOnActive:N,ssPushable:Be,ssSphere:Te,ssSquare:_e,ssTextEllipsis:Le,isBoldFont:we,isLightFont:We,isSemiBoldFont:U,isRounded:$,flexCenter:V,flexNewLine:I,gradients:K,UnderBreakPointStyles:t={},className:Ae="",freeCSS:ye={}}=He,c=Ne(He,["componentId","gap","display","position","overflow","fontColor","fontSize","fontWeight","fontHeight","backgroundColor","textAlign","textDecoration","boxShadow","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","top","right","bottom","left","border","borderTop","borderRight","borderBottom","borderLeft","borderWidth","borderColor","borderStyle","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","flexSizing","flexWrap","flexType","flexChilds","flexGrid","horizontalAlign","verticalAlign","transition","gridCenter","gridCols","maxHeight","minHeight","maxWidth","minWidth","width","height","unitHeight","unitWidth","opacity","ssLastChildLossBorder","ssAbsoluteCovered","ssCardBox","ssEffectsOnActive","ssPushable","ssSphere","ssSquare","ssTextEllipsis","isBoldFont","isLightFont","isSemiBoldFont","isRounded","flexCenter","flexNewLine","gradients","UnderBreakPointStyles","className","freeCSS"]),h=a({},c),F=[Ae];if(O&&F.push("ssLastChildLossBorder_"+O),N){N=d.Arrayify(N);for(let ke of N){let[Ee,Pe]=ke.split(".");h["data-effect-"+Ee]="1",Pe&&(h["data-effect-tone"]=Pe)}}{let ke=e.ClassNames("amotf_",{gap:l,display:R,position:C,overflow:P,fontColor:E,fontSize:G,fontWeight:j,fontHeight:g,backgroundColor:q,textAlign:H,textDecoration:M,boxShadow:D,margin:p,marginTop:S,marginRight:o,marginBottom:r,marginLeft:y,padding:f,paddingTop:s,paddingRight:x,paddingBottom:B,paddingLeft:T,top:X,right:J,bottom:Q,left:Y,border:z,borderTop:u,borderRight:v,borderBottom:m,borderLeft:b,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:k,borderTopLeftRadius:_,borderTopRightRadius:L,borderBottomLeftRadius:w,borderBottomRightRadius:W,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce});F.push(ke)}return t&&F.push(e.ClassNames("amotf_bp",t)),ye&&(h.style=a(a({},ye),h.style)),(i||h["data-component-id"])&&(h["data-component-id"]=h["data-component-id"]||i),F.length&&F.join("")&&(h.className=F.join(" ").trim().replace(/%/ig,"P").replace(/\d+px/ig,"PIX").replace(/\s+/ig," ").replace(/\//ig,"_").replace(/\./ig,"-")),h},$e=n=>{let{gap:A,display:i,position:l,overflow:R,fontColor:C,fontSize:P,fontWeight:E,fontHeight:G,backgroundColor:j,textAlign:g,textDecoration:q,boxShadow:H,margin:M,marginTop:D,marginRight:p,marginBottom:S,marginLeft:o,padding:r,paddingTop:y,paddingRight:f,paddingBottom:s,paddingLeft:x,top:B,right:T,bottom:X,left:J,border:Q,borderTop:Y,borderRight:z,borderBottom:u,borderLeft:v,borderWidth:m,borderColor:b,borderStyle:Z,borderRadius:ee,borderTopLeftRadius:te,borderTopRightRadius:k,borderBottomLeftRadius:_,borderBottomRightRadius:L,flexSizing:w,flexWrap:W,flexType:ie,flexChilds:re,flexGrid:oe,horizontalAlign:se,verticalAlign:ae,transition:de,gridCenter:ne,gridCols:le,maxHeight:ge,minHeight:pe,maxWidth:he,minWidth:fe,width:ue,height:ve,unitHeight:me,unitWidth:be,opacity:Se,ssLastChildLossBorder:xe,ssAbsoluteCovered:ce,ssCardBox:O,ssEffectsOnActive:Re,ssPushable:Ce,ssSphere:N,ssSquare:Be,ssTextEllipsis:Te,isBoldFont:_e,isLightFont:Le,isSemiBoldFont:we,isRounded:We,flexCenter:U,flexNewLine:$,gradients:V,UnderBreakPointStyles:I={},freeCSS:K={}}=n,t={};return e.ev(A)&&(t.gap=A),e.ev(i)&&(t.display=i),e.ev(l)&&(t.position=l),e.ev(R)&&(t.overflow=R),e.ev(C)&&(t.fontColor=C),e.ev(P)&&(t.fontSize=P),e.ev(E)&&(t.fontWeight=E),e.ev(G)&&(t.fontHeight=G),e.ev(j)&&(t.backgroundColor=j),e.ev(g)&&(t.textAlign=g),e.ev(q)&&(t.textDecoration=q),e.ev(H)&&(t.boxShadow=H),e.ev(M)&&(t.margin=M),e.ev(D)&&(t.marginTop=D),e.ev(p)&&(t.marginRight=p),e.ev(S)&&(t.marginBottom=S),e.ev(o)&&(t.marginLeft=o),e.ev(r)&&(t.padding=r),e.ev(y)&&(t.paddingTop=y),e.ev(f)&&(t.paddingRight=f),e.ev(s)&&(t.paddingBottom=s),e.ev(x)&&(t.paddingLeft=x),e.ev(B)&&(t.top=B),e.ev(T)&&(t.right=T),e.ev(X)&&(t.bottom=X),e.ev(J)&&(t.left=J),e.ev(Q)&&(t.border=Q),e.ev(Y)&&(t.borderTop=Y),e.ev(z)&&(t.borderRight=z),e.ev(u)&&(t.borderBottom=u),e.ev(v)&&(t.borderLeft=v),e.ev(m)&&(t.borderWidth=m),e.ev(b)&&(t.borderColor=b),e.ev(Z)&&(t.borderStyle=Z),e.ev(ee)&&(t.borderRadius=ee),e.ev(te)&&(t.borderTopLeftRadius=te),e.ev(k)&&(t.borderTopRightRadius=k),e.ev(_)&&(t.borderBottomLeftRadius=_),e.ev(L)&&(t.borderBottomRightRadius=L),e.ev(w)&&(t.flexSizing=w),e.ev(W)&&(t.flexWrap=W),e.ev(ie)&&(t.flexType=ie),e.ev(re)&&(t.flexChilds=re),e.ev(oe)&&(t.flexGrid=oe),e.ev(se)&&(t.horizontalAlign=se),e.ev(ae)&&(t.verticalAlign=ae),e.ev(de)&&(t.transition=de),e.ev(ne)&&(t.gridCenter=ne),e.ev(le)&&(t.gridCols=le),e.ev(ge)&&(t.maxHeight=ge),e.ev(pe)&&(t.minHeight=pe),e.ev(he)&&(t.maxWidth=he),e.ev(fe)&&(t.minWidth=fe),e.ev(ue)&&(t.width=ue),e.ev(ve)&&(t.height=ve),e.ev(me)&&(t.unitHeight=me),e.ev(be)&&(t.unitWidth=be),e.ev(Se)&&(t.opacity=Se),e.ev(xe)&&(t.ssLastChildLossBorder=xe),e.ev(ce)&&(t.ssAbsoluteCovered=ce),e.ev(O)&&(t.ssCardBox=O),e.ev(Re)&&(t.ssEffectsOnActive=Re),e.ev(Ce)&&(t.ssPushable=Ce),e.ev(N)&&(t.ssSphere=N),e.ev(Be)&&(t.ssSquare=Be),e.ev(Te)&&(t.ssTextEllipsis=Te),e.ev(_e)&&(t.isBoldFont=_e),e.ev(Le)&&(t.isLightFont=Le),e.ev(we)&&(t.isSemiBoldFont=we),e.ev(We)&&(t.isRounded=We),e.ev(U)&&(t.flexCenter=U),e.ev($)&&(t.flexNewLine=$),e.ev(V)&&(t.gradients=V),e.ev(K)&&(t.freeCSS=K),e.ev(I)&&(t.UnderBreakPointStyles=I),t};export{$e as ExtractStyles,Ue as GenerateHTMLProps,Ge as ReadStyleSet};
|
|
1
|
+
import{b as a,c as He,d as Ne}from"../chunk-C5N2D3ZX.js";import d from"jmini";import{Config as ke}from".";const e={toConcreteBorderRadius:n=>{let A=ke.get().roundness|0;return n=="1.tone.primary"?n=[0,2,3,4,5,5][A]:n=="2.tone.secondary"?n=[0,1,2,3,4,5][A]:n=="3.tone.tertiary"&&(n=[0,"1/3","2/3",1,2,3][A]),n},ev:n=>d.isExist(n),ClassNames:(n,A)=>{var U,Be,Re,N,Ce,Te,_e,Le,we,We;let i=[],{gap:l,display:B,position:R,overflow:F,fontColor:P,fontSize:G,fontWeight:j,fontHeight:g,backgroundColor:q,textAlign:E,textDecoration:O,boxShadow:M,margin:p,marginTop:S,marginRight:o,marginBottom:r,marginLeft:y,padding:f,paddingTop:s,paddingRight:x,paddingBottom:C,paddingLeft:T,top:J,right:K,bottom:Q,left:Y,border:H,borderTop:u,borderRight:v,borderBottom:m,borderLeft:b,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:z,borderTopLeftRadius:_,borderTopRightRadius:L,borderBottomLeftRadius:w,borderBottomRightRadius:W,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce}=A;{if(e.ev(B)&&i.push("dsp"+B),F){let c=d.Arrayify(F);i.push("ovfl-x-"+c[0]),i.push("ovfl-y-"+(c[1]||c[0]))}e.ev(R)&&i.push("ps"+R),e.ev(E)&&i.push("txtalg"+E),e.ev(E)&&i.push("txtdeco"+O),e.ev(P)&&i.push("ftcl"+((U=String(P))==null?void 0:U.replace(/\./g,"_"))),e.ev(G)&&i.push("ftsz"+((Be=String(G))==null?void 0:Be.replace(/\..*/,""))),e.ev(j)&&i.push("ftwgt"+((Re=String(j))==null?void 0:Re.replace(/\..*/,""))),e.ev(g)&&i.push("fthgt"+((N=String(g))==null?void 0:N.replace(/\./g,"_"))),e.ev(q)&&i.push("bgc"+((Ce=String(q))==null?void 0:Ce.replace(/\./g,"_"))),e.ev(M)&&i.push("bs"+M);let D,$,I,V;d.isExist(p)&&(d.isArray(p)?p.length==2?[D,$,I,V]=[...p,...p]:p.length==4&&([D,$,I,V]=p):D=$=I=V=p,S=S!=null?S:D,o=o!=null?o:$,r=r!=null?r:I,y=y!=null?y:V),e.ev(S)&&i.push("mrgt"+S),e.ev(o)&&i.push("mrgr"+o),e.ev(r)&&i.push("mrgb"+r),e.ev(y)&&i.push("mrgl"+y);let X,t,Ae,ye;d.isExist(f)&&(d.isArray(f)?f.length==2?[X,t,Ae,ye]=[...f,...f]:f.length==4&&([X,t,Ae,ye]=f):X=t=Ae=ye=f,s=s!=null?s:X,x=x!=null?x:t,C=C!=null?C:Ae,T=T!=null?T:ye),e.ev(s)&&i.push("pdt"+s),e.ev(x)&&i.push("pdr"+x),e.ev(C)&&i.push("pdb"+C),e.ev(T)&&i.push("pdl"+T),e.ev(J)&&i.push("pstt"+J),e.ev(K)&&i.push("pstr"+K),e.ev(Q)&&i.push("pstb"+Q),e.ev(Y)&&i.push("pstl"+Y);{d.isExist(H)&&(u=u!=null?u:H,v=v!=null?v:H,m=m!=null?m:H,b=b!=null?b:H),d.isBoolean(u)&&(u=["unset","2.normal"][Number(u)]),d.isBoolean(v)&&(v=["unset","2.normal"][Number(v)]),d.isBoolean(m)&&(m=["unset","2.normal"][Number(m)]),d.isBoolean(b)&&(b=["unset","2.normal"][Number(b)]),e.ev(u)&&i.push("b_t_ss"+((Te=String(u))==null?void 0:Te.replace(/\./g,"_"))),e.ev(v)&&i.push("b_r_ss"+((_e=String(v))==null?void 0:_e.replace(/\./g,"_"))),e.ev(m)&&i.push("b_b_ss"+((Le=String(m))==null?void 0:Le.replace(/\./g,"_"))),e.ev(b)&&i.push("b_l_ss"+((we=String(b))==null?void 0:we.replace(/\./g,"_"))),d.isExist(Z)&&i.push("b_wth"+String(Z)),d.isExist(ee)&&i.push("b_cl"+((We=String(ee))==null?void 0:We.replace(/\./g,"_"))),d.isExist(te)&&i.push("b_st"+String(te));{let c,h,k,Ee;d.isExist(z)&&(d.isArray(z)?z.length==4&&([c,h,Ee,k]=z):c=h=k=Ee=z,_=_!=null?_:c,L=L!=null?L:h,w=w!=null?w:k,W=W!=null?W:Ee)}e.ev(_)&&i.push("br_tl"+e.toConcreteBorderRadius(_)),e.ev(L)&&i.push("br_tr"+e.toConcreteBorderRadius(L)),e.ev(w)&&i.push("br_bl"+e.toConcreteBorderRadius(w)),e.ev(W)&&i.push("br_br"+e.toConcreteBorderRadius(W))}if(e.ev(ce)&&i.push("op"+ce),d.isExist(l)){let c,h;d.isArray(l)?(c=l[0],h=l[1]):c=h=l,i.push("gapRow"+c,"gapCol"+h)}e.ev(ie)&&i.push("flsz"+ie),e.ev(re)&&i.push("flwrp"+re),e.ev(oe)&&i.push("fltyp"+oe),e.ev(se)&&i.push("flchld"+se),e.ev(ae)&&i.push("flgrid"+ae),e.ev(ne)&&i.push("flvrt"+ne),e.ev(de)&&i.push("flhrz"+de),e.ev(ge)&&i.push("grcnt"+ge),e.ev(pe)&&i.push("grcol"+pe),e.ev(be)&&i.push("hgt"+be),e.ev(me)&&i.push("wdt"+me),e.ev(Se)&&i.push("unthgt"+Se),e.ev(xe)&&i.push("untwdt"+xe),e.ev(le)&&i.push("trnst"+le),e.ev(he)&&i.push("maxh"+he),e.ev(fe)&&i.push("minh"+fe),e.ev(ue)&&i.push("maxw"+ue),e.ev(ve)&&i.push("minw"+ve)}return i.length?n+i.join(" "+n):""}},Ge=n=>{let y=a({},n),{gradients:i,ssCardBox:l,ssSphere:B,ssSquare:R,ssPushable:F,ssAbsoluteCovered:P,ssHiddenOnBreak:G,ssTextEllipsis:j,flexCenter:g,flexNewLine:q,isLightFont:E,isBoldFont:O,isSemiBoldFont:M,isRounded:p,isSquare:S,freeCSS:f={}}=y,o=Ne(f,[]),r=Ne(y,["gradients","ssCardBox","ssSphere","ssSquare","ssPushable","ssAbsoluteCovered","ssHiddenOnBreak","ssTextEllipsis","flexCenter","flexNewLine","isLightFont","isBoldFont","isSemiBoldFont","isRounded","isSquare","freeCSS"]);if(o=o||{},r=r||{},i){let{deg:s,colors:x}=i;o=He(a({},o),{background:`linear-gradient(${s}deg,${x.join(",")})`})}if(l){l===!0&&(l="border");let s={backgroundColor:"layer.1",borderRadius:"1.tone.primary",boxShadow:"0.min"};l=="border"?s.border=!0:l=="plain"?(s.backgroundColor="layer.1",s.boxShadow="none"):l=="cloud"?s.backgroundColor="cloud":l=="shadow"&&(s.boxShadow="0.normal"),ke.get().darkMode=="dim"&&(s.boxShadow="1.normal"),ke.get().darkMode=="dark"&&(s.boxShadow="1.remark"),o=a(a({},s.freeCSS),o),r=a(a({},s),r)}return B&&(g=g!=null?g:!0,r=a({padding:0,unitWidth:B,unitHeight:B,borderRadius:"sphere",flexSizing:"none"},r)),R&&(g=g!=null?g:!0,r=a({padding:0,unitWidth:R,unitHeight:R,flexSizing:"none"},r)),G&&(r=He(a({},r),{UnderBreakPointStyles:a({display:"none"},r.UnderBreakPointStyles)})),F&&(r=a({transition:"middle"},r),r=He(a({},r),{className:[r.className,"ssPushable"].join(" ")})),P&&(r=a({position:"absolute",top:0,left:0,right:0,bottom:0},r)),j&&(r=a({overflow:"hidden"},r),o=a({whiteSpace:"nowrap",textOverflow:"ellipsis"},o)),q&&(r=a({width:1,flexSizing:"none"},r)),g&&(r=a({display:"flex",horizontalAlign:"center",verticalAlign:"center"},r)),E&&(r.fontWeight="1.light"),M&&(r.fontWeight="3.semiBold"),O&&(r.fontWeight="4.bold"),p&&(r.borderRadius="sphere",d.isNumber(p)&&(o.borderRadius=p*12)),S&&(o.aspectRatio="1"),He(a({},r),{freeCSS:o})},Ue=n=>{let Ee=Ge(n),{componentId:i,gap:l,display:B,position:R,overflow:F,fontColor:P,fontSize:G,fontWeight:j,fontHeight:g,backgroundColor:q,textAlign:E,textDecoration:O,boxShadow:M,margin:p,marginTop:S,marginRight:o,marginBottom:r,marginLeft:y,padding:f,paddingTop:s,paddingRight:x,paddingBottom:C,paddingLeft:T,top:J,right:K,bottom:Q,left:Y,border:H,borderTop:u,borderRight:v,borderBottom:m,borderLeft:b,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:z,borderTopLeftRadius:_,borderTopRightRadius:L,borderBottomLeftRadius:w,borderBottomRightRadius:W,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce,ssLastChildLossBorder:U,ssAbsoluteCovered:Be,ssCardBox:Re,ssEffectsOnActive:N,ssPushable:Ce,ssSphere:Te,ssSquare:_e,ssTextEllipsis:Le,isBoldFont:we,isLightFont:We,isSemiBoldFont:D,isRounded:$,flexCenter:I,flexNewLine:V,gradients:X,UnderBreakPointStyles:t={},className:Ae="",freeCSS:ye={}}=Ee,c=Ne(Ee,["componentId","gap","display","position","overflow","fontColor","fontSize","fontWeight","fontHeight","backgroundColor","textAlign","textDecoration","boxShadow","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","top","right","bottom","left","border","borderTop","borderRight","borderBottom","borderLeft","borderWidth","borderColor","borderStyle","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","flexSizing","flexWrap","flexType","flexChilds","flexGrid","horizontalAlign","verticalAlign","transition","gridCenter","gridCols","maxHeight","minHeight","maxWidth","minWidth","width","height","unitHeight","unitWidth","opacity","ssLastChildLossBorder","ssAbsoluteCovered","ssCardBox","ssEffectsOnActive","ssPushable","ssSphere","ssSquare","ssTextEllipsis","isBoldFont","isLightFont","isSemiBoldFont","isRounded","flexCenter","flexNewLine","gradients","UnderBreakPointStyles","className","freeCSS"]),h=a({},c),k=[Ae];if(U&&k.push("ssLastChildLossBorder_"+U),N){N=d.Arrayify(N);for(let ze of N){let[Pe,Fe]=ze.split(".");h["data-effect-"+Pe]="1",Fe&&(h["data-effect-tone"]=Fe)}}{let ze=e.ClassNames("amotf_",{gap:l,display:B,position:R,overflow:F,fontColor:P,fontSize:G,fontWeight:j,fontHeight:g,backgroundColor:q,textAlign:E,textDecoration:O,boxShadow:M,margin:p,marginTop:S,marginRight:o,marginBottom:r,marginLeft:y,padding:f,paddingTop:s,paddingRight:x,paddingBottom:C,paddingLeft:T,top:J,right:K,bottom:Q,left:Y,border:H,borderTop:u,borderRight:v,borderBottom:m,borderLeft:b,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:z,borderTopLeftRadius:_,borderTopRightRadius:L,borderBottomLeftRadius:w,borderBottomRightRadius:W,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce});k.push(ze)}return t&&k.push(e.ClassNames("amotf_bp",t)),ye&&(h.style=a(a({},ye),h.style)),(i||h["data-component-id"])&&(h["data-component-id"]=h["data-component-id"]||i),k.length&&k.join("")&&(h.className=k.join(" ").trim().replace(/%/ig,"P").replace(/\d+px/ig,"PIX").replace(/\s+/ig," ").replace(/\//ig,"_").replace(/\./ig,"-")),h},De=n=>{let{gap:A,display:i,position:l,overflow:B,fontColor:R,fontSize:F,fontWeight:P,fontHeight:G,backgroundColor:j,textAlign:g,textDecoration:q,boxShadow:E,margin:O,marginTop:M,marginRight:p,marginBottom:S,marginLeft:o,padding:r,paddingTop:y,paddingRight:f,paddingBottom:s,paddingLeft:x,top:C,right:T,bottom:J,left:K,border:Q,borderTop:Y,borderRight:H,borderBottom:u,borderLeft:v,borderWidth:m,borderColor:b,borderStyle:Z,borderRadius:ee,borderTopLeftRadius:te,borderTopRightRadius:z,borderBottomLeftRadius:_,borderBottomRightRadius:L,flexSizing:w,flexWrap:W,flexType:ie,flexChilds:re,flexGrid:oe,horizontalAlign:se,verticalAlign:ae,transition:de,gridCenter:ne,gridCols:le,maxHeight:ge,minHeight:pe,maxWidth:he,minWidth:fe,width:ue,height:ve,unitHeight:me,unitWidth:be,opacity:Se,ssLastChildLossBorder:xe,ssAbsoluteCovered:ce,ssCardBox:U,ssEffectsOnActive:Be,ssPushable:Re,ssSphere:N,ssSquare:Ce,ssTextEllipsis:Te,isBoldFont:_e,isLightFont:Le,isSemiBoldFont:we,isRounded:We,flexCenter:D,flexNewLine:$,gradients:I,UnderBreakPointStyles:V={},freeCSS:X={}}=n,t={};return e.ev(A)&&(t.gap=A),e.ev(i)&&(t.display=i),e.ev(l)&&(t.position=l),e.ev(B)&&(t.overflow=B),e.ev(R)&&(t.fontColor=R),e.ev(F)&&(t.fontSize=F),e.ev(P)&&(t.fontWeight=P),e.ev(G)&&(t.fontHeight=G),e.ev(j)&&(t.backgroundColor=j),e.ev(g)&&(t.textAlign=g),e.ev(q)&&(t.textDecoration=q),e.ev(E)&&(t.boxShadow=E),e.ev(O)&&(t.margin=O),e.ev(M)&&(t.marginTop=M),e.ev(p)&&(t.marginRight=p),e.ev(S)&&(t.marginBottom=S),e.ev(o)&&(t.marginLeft=o),e.ev(r)&&(t.padding=r),e.ev(y)&&(t.paddingTop=y),e.ev(f)&&(t.paddingRight=f),e.ev(s)&&(t.paddingBottom=s),e.ev(x)&&(t.paddingLeft=x),e.ev(C)&&(t.top=C),e.ev(T)&&(t.right=T),e.ev(J)&&(t.bottom=J),e.ev(K)&&(t.left=K),e.ev(Q)&&(t.border=Q),e.ev(Y)&&(t.borderTop=Y),e.ev(H)&&(t.borderRight=H),e.ev(u)&&(t.borderBottom=u),e.ev(v)&&(t.borderLeft=v),e.ev(m)&&(t.borderWidth=m),e.ev(b)&&(t.borderColor=b),e.ev(Z)&&(t.borderStyle=Z),e.ev(ee)&&(t.borderRadius=ee),e.ev(te)&&(t.borderTopLeftRadius=te),e.ev(z)&&(t.borderTopRightRadius=z),e.ev(_)&&(t.borderBottomLeftRadius=_),e.ev(L)&&(t.borderBottomRightRadius=L),e.ev(w)&&(t.flexSizing=w),e.ev(W)&&(t.flexWrap=W),e.ev(ie)&&(t.flexType=ie),e.ev(re)&&(t.flexChilds=re),e.ev(oe)&&(t.flexGrid=oe),e.ev(se)&&(t.horizontalAlign=se),e.ev(ae)&&(t.verticalAlign=ae),e.ev(de)&&(t.transition=de),e.ev(ne)&&(t.gridCenter=ne),e.ev(le)&&(t.gridCols=le),e.ev(ge)&&(t.maxHeight=ge),e.ev(pe)&&(t.minHeight=pe),e.ev(he)&&(t.maxWidth=he),e.ev(fe)&&(t.minWidth=fe),e.ev(ue)&&(t.width=ue),e.ev(ve)&&(t.height=ve),e.ev(me)&&(t.unitHeight=me),e.ev(be)&&(t.unitWidth=be),e.ev(Se)&&(t.opacity=Se),e.ev(xe)&&(t.ssLastChildLossBorder=xe),e.ev(ce)&&(t.ssAbsoluteCovered=ce),e.ev(U)&&(t.ssCardBox=U),e.ev(Be)&&(t.ssEffectsOnActive=Be),e.ev(Re)&&(t.ssPushable=Re),e.ev(N)&&(t.ssSphere=N),e.ev(Ce)&&(t.ssSquare=Ce),e.ev(Te)&&(t.ssTextEllipsis=Te),e.ev(_e)&&(t.isBoldFont=_e),e.ev(Le)&&(t.isLightFont=Le),e.ev(we)&&(t.isSemiBoldFont=we),e.ev(We)&&(t.isRounded=We),e.ev(D)&&(t.flexCenter=D),e.ev($)&&(t.flexNewLine=$),e.ev(I)&&(t.gradients=I),e.ev(X)&&(t.freeCSS=X),e.ev(V)&&(t.UnderBreakPointStyles=V),t};export{De as ExtractStyles,Ue as GenerateHTMLProps,Ge as ReadStyleSet};
|
package/dist/@utils/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as s,c as h}from"../chunk-C5N2D3ZX.js";import i,{UUID as l}from"jmini";import{useRefresh as f,ColorObjects as b,SetThemeColorTag as g}from".";let n={sessionUID:l(),appRoot:null,darkMode:"light",themeColor:"comun",roundness:2,isSystemDarkmode:()=>window.matchMedia("(prefers-color-scheme: dark)").matches==!0,deviceIs:"",browserIs:"",isPhone:!1,isTouchDevice:!1,isIOS:!1,screen:{breakpoint:834,phonepoint:690,viewHeight:0,viewWidth:0,isBreakpoint:(e=834)=>window.innerWidth<=e,isPhonepoint:(e=690)=>window.innerWidth<=e}};const o={get:()=>n,set:e=>{n=s(s({},n),e)},update:{themeColor:e=>{if(b.find(d=>d.key==e)||(e="comun"),e==o.get().themeColor)return;o.set(h(s({},o.get()),{themeColor:e}));let t=i(document.body);t.removeClass(t.findClass(/^bdsTC/)).addClass("bdsTC_"+e).callback(()=>{g()}),o.restart()},darkMode:e=>{if(i.
|
|
1
|
+
import{b as s,c as h}from"../chunk-C5N2D3ZX.js";import i,{UUID as l}from"jmini";import{useRefresh as f,ColorObjects as b,SetThemeColorTag as g}from".";let n={sessionUID:l(),appRoot:null,darkMode:"light",themeColor:"comun",roundness:2,isSystemDarkmode:()=>window.matchMedia("(prefers-color-scheme: dark)").matches==!0,deviceIs:"",browserIs:"",isPhone:!1,isTouchDevice:!1,isIOS:!1,screen:{breakpoint:834,phonepoint:690,viewHeight:0,viewWidth:0,isBreakpoint:(e=834)=>window.innerWidth<=e,isPhonepoint:(e=690)=>window.innerWidth<=e}};const o={get:()=>n,set:e=>{n=s(s({},n),e)},update:{themeColor:e=>{if(b.find(d=>d.key==e)||(e="comun"),e==o.get().themeColor)return;o.set(h(s({},o.get()),{themeColor:e}));let t=i(document.body);t.removeClass(t.findClass(/^bdsTC/)).addClass("bdsTC_"+e).callback(()=>{g()}),o.restart()},darkMode:e=>{if(i.isOneOf(e,"light","dark","dim","auto")||(e="light"),e==o.get().darkMode)return;let t=e=="auto"?o.get().isSystemDarkmode()?"dark":"light":e;o.set(h(s({},o.get()),{darkMode:t}));let d=i(document.body);d.removeClass(d.findClass(/^bdsDM/)).addClass("bdsDM_"+t),o.restart()},roundness:e=>{e>=0&&e<=5||(e=2),e!=o.get().roundness&&(o.set(h(s({},o.get()),{roundness:e})),o.restart(l()))},screen:e=>{o.get().screen=s(s({},o.get().screen),e)}},launch:e=>{const t=window.navigator.userAgent.toLowerCase(),d=t.indexOf("windows nt")!==-1?"windows":t.indexOf("android")!==-1?"android":t.indexOf("iphone")!==-1?"iPhone":t.indexOf("ipad")>-1?"iPad":t.indexOf("mac os x")!==-1?"macOSX":"undefined",u=t.indexOf("msie")!==-1||t.indexOf("trident")!==-1?"ie":t.indexOf("edge")!==-1?"edge":t.indexOf("chrome")!==-1?"chrome":t.indexOf("safari")!==-1?"safari":t.indexOf("firefox")!==-1?"firefox":t.indexOf("opera")!==-1||t.indexOf("opr")!==-1?"opera":"undefined";n.appRoot=e.appRoot||document.body,n.appRoot instanceof HTMLElement&&(n.appRoot.tabIndex=0),i.isExist(e.roundness)&&o.update.roundness(e.roundness),i.isExist(e.themeColor)&&o.update.themeColor(e.themeColor),i.isExist(e.darkMode)&&o.update.darkMode(e.darkMode),n.deviceIs=d,n.browserIs=u,n.isPhone=i.isOneOf(d,"android","iPhone"),n.isTouchDevice=window.ontouchstart!==void 0&&0<navigator.maxTouchPoints,n.isIOS=i.isOneOf(d,"iPhone","iPad"),n.isTouchDevice=window.ontouchstart!==void 0&&0<navigator.maxTouchPoints,n.isIOS=i.isOneOf(d,"iPhone","iPad"),n.screen={breakpoint:834,phonepoint:690,viewHeight:window.innerHeight,viewWidth:window.innerWidth,isBreakpoint:(r=834)=>window.innerWidth<=r,isPhonepoint:(r=690)=>window.innerWidth<=r},i(document.body).addClass(["AMOTIFY_be_body","usrDevice_"+o.get().deviceIs,"bdsDM_"+o.get().darkMode,"bdsTC_"+o.get().themeColor]),i(window).addEvent({eventType:"load",eventID:"windowLoad",callback:()=>{let r=document.body.style,a=i(document.body),m=Number(a.getStyleProperty("--topNavHeight").removeLetters()||0),p=Number(a.getStyleProperty("--footerNavHeight").removeLetters()||0),w=window.innerHeight-m-p;r.setProperty("--viewHeight",window.innerHeight+"px"),r.setProperty("--contentHeight",w+"px")}}).addEvent({eventType:"resize",eventID:"getDeviceInfo",callback:()=>{o.update.screen({viewHeight:window.innerHeight,viewWidth:window.innerWidth});let r=i(document.body),a=window.innerHeight,m=Number(r.getStyleProperty("--topNavHeight").removeLetters()),p=Number(r.getStyleProperty("--footerNavHeight").removeLetters()),c=a-m-p;r.setStyleProperty("--viewHeight",a+"px").setStyleProperty("--sideNavHeight",c+"px").setStyleProperty("--contentHeight",c+"px")}}),g()},restart:e=>{f.release("LaunchReactApp_"+o.get().sessionUID,e)}};export{o as Config,o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-C5N2D3ZX.js";import e from"./config";import o from"jmini";const p=t=>{let r=e.get().appRoot;return o.
|
|
1
|
+
import"../chunk-C5N2D3ZX.js";import e from"./config";import o from"jmini";const p=t=>{let r=e.get().appRoot;return o.isShadowRoot(r)?o(r).find(t):o(t)};export{p as $$fromRoot,p as default};
|
package/dist/atoms/Logo.js
CHANGED
|
@@ -48,4 +48,4 @@ import{b as l,c,d as p}from"../chunk-C5N2D3ZX.js";import{Fragment as A,jsx as e,
|
|
|
48
48
|
L600,600
|
|
49
49
|
L600,300
|
|
50
50
|
Z
|
|
51
|
-
`,className:[a("P"),a("P_"+t)].join(" "),style:{fill:"#ea6093"}})]});return I("svg",{viewBox:"0,0,1200,1200",className:a("MingooIcon"),children:[o(0),o(1),o(2),o(3),o(4),o(5),o(6),o(7),o(8)]})}},u={Icon:o=>e(r.Icon,c(l({},o),{children:e(h.MingooIcon,{})})),Title:o=>e(r.Title,c(l({className:a("ComunTitle"),height:"auto"},o),{freeCSS:l({letterSpacing:"3px"},o.freeCSS),children:"mingoo"})),LogoH:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({gap:"1/2",flexCenter:!0},i),{children:[e(u.Icon,{size:t,color:g}),e(u.Title,{size:t,color:g})]}))},LogoV:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({flexType:"col",gap:"1/2"},i),{children:[e(u.Icon,{margin:"auto",size:t,color:g}),e(u.Title,{size:t,color:g})]}))}},m={Icon:o=>e(r.Icon,c(l({},o),{children:e(h.ComunIcon,{})})),Title:o=>e(r.Title,c(l({className:a("ComunTitle"),height:"auto"},o),{freeCSS:l({letterSpacing:"3px"},o.freeCSS),children:"comun"})),LogoH:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({gap:"1/2",flexCenter:!0},i),{children:[e(m.Icon,{size:t,color:g}),e(m.Title,{size:t,color:g})]}))},LogoV:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({flexType:"col",gap:"1/2"},i),{children:[e(m.Icon,{margin:"auto",size:t,color:g}),e(m.Title,{size:t,color:g})]}))}};let s="https://cdn.amotify.com/";const r={Icon:o=>{let f=o,{size:t="R",color:g="normal",className:i="",children:n}=f,S=p(f,["size","color","className","children"]);return e(L,c(l({className:[i,a("Icon"),a("Size_"+t)].join(" "),verticalAlign:"center"},S),{children:T.
|
|
51
|
+
`,className:[a("P"),a("P_"+t)].join(" "),style:{fill:"#ea6093"}})]});return I("svg",{viewBox:"0,0,1200,1200",className:a("MingooIcon"),children:[o(0),o(1),o(2),o(3),o(4),o(5),o(6),o(7),o(8)]})}},u={Icon:o=>e(r.Icon,c(l({},o),{children:e(h.MingooIcon,{})})),Title:o=>e(r.Title,c(l({className:a("ComunTitle"),height:"auto"},o),{freeCSS:l({letterSpacing:"3px"},o.freeCSS),children:"mingoo"})),LogoH:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({gap:"1/2",flexCenter:!0},i),{children:[e(u.Icon,{size:t,color:g}),e(u.Title,{size:t,color:g})]}))},LogoV:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({flexType:"col",gap:"1/2"},i),{children:[e(u.Icon,{margin:"auto",size:t,color:g}),e(u.Title,{size:t,color:g})]}))}},m={Icon:o=>e(r.Icon,c(l({},o),{children:e(h.ComunIcon,{})})),Title:o=>e(r.Title,c(l({className:a("ComunTitle"),height:"auto"},o),{freeCSS:l({letterSpacing:"3px"},o.freeCSS),children:"comun"})),LogoH:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({gap:"1/2",flexCenter:!0},i),{children:[e(m.Icon,{size:t,color:g}),e(m.Title,{size:t,color:g})]}))},LogoV:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({flexType:"col",gap:"1/2"},i),{children:[e(m.Icon,{margin:"auto",size:t,color:g}),e(m.Title,{size:t,color:g})]}))}};let s="https://cdn.amotify.com/";const r={Icon:o=>{let f=o,{size:t="R",color:g="normal",className:i="",children:n}=f,S=p(f,["size","color","className","children"]);return e(L,c(l({className:[i,a("Icon"),a("Size_"+t)].join(" "),verticalAlign:"center"},S),{children:T.isFunction(n)?e(n,{}):n}))},Title:o=>{let f=o,{size:t="R",color:g="normal",className:i="",children:n}=f,S=p(f,["size","color","className","children"]);return e(L,c(l({className:[i,a("Title"),a("Size_"+t)].join(" "),verticalAlign:"center",fontColor:g=="white"?"white":"logo"},S),{children:T.isFunction(n)?e(n,{}):n}))},Brands:{MingooIcon:u.Icon,MingooTitle:u.Title,MingooLogoH:u.LogoH,MingooLogoV:u.LogoV,ComunIcon:m.Icon,ComunTitle:m.Title,ComunLogoH:m.LogoH,ComunLogoV:m.LogoV,Google:o=>e(r.Icon,c(l({},o),{children:e(C,{src:s+"@env/@logos/brands/Google_Icon.svg",alt:""})})),Facebook:o=>e(r.Icon,c(l({},o),{children:e(C,{src:s+"@env/@logos/brands/FaceBook_Icon.svg",alt:""})})),Twitter:o=>e(r.Icon,c(l({},o),{children:e(C,{src:s+"@env/@logos/brands/Twitter_Icon.svg",alt:""})})),LINE:o=>e(r.Icon,c(l({},o),{children:e(C,{src:s+"@env/@logos/brands/Line_Icon.svg",alt:""})}))},Images:{mingooIcon:s+"@env/@logos/mingoo/icon.png",mingooIconClear:s+"@env/@logos/mingoo/iconClear.png",comunIcon:s+"@env/@logos/comun/icon.png",comunIconClear:s+"@env/@logos/comun/iconClear.png",defaultIcon:o=>s+"@env/@icon/"+(o||"image")+".png"}};export{r as Logo,r as default};
|
package/dist/atoms/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,c as
|
|
1
|
+
import{b as t,c as r}from"../chunk-C5N2D3ZX.js";import{jsx as o}from"react/jsx-runtime";export*from"./Box";import l from"react";import n from"./Box";const x=e=>o(n,r(t({},e),{htmlTag:"span"})),m=e=>o(n,r(t({},e),{htmlTag:"p"})),p=e=>o(n,r(t({flexType:"row",flexWrap:!0,display:"flex"},e),{freeCSS:t({wordBreak:"break-word"},e.freeCSS)})),c=e=>o(n,t({width:1,flexSizing:"none"},e)),f=e=>o(n,t({flexSizing:0},e)),u=e=>o(p,t({flexType:"col",gap:1},e)),s=l.memo(e=>e.children,(e,a)=>e.forceRender?!e.forceRender(e.params,a.params):!1);export*from"./FAI";export*from"./Img";export*from"./Logo";export*from"./Placeholder";export*from"./Card";export*from"./Grid";export{s as CacheRender,u as Column,p as Flex,c as FlexBr,f as FlexMargin,m as P,x as Span};
|
package/dist/fn/Button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { StyleTags, ReactElement } from '../@declares';
|
|
3
|
-
import {
|
|
3
|
+
import { Records } from 'jmini';
|
|
4
4
|
declare namespace ButtonTypes {
|
|
5
5
|
type Seeds = 'button' | 'label' | 'anchor';
|
|
6
6
|
type Tones = 'plain' | 'link' | 'normal' | 'border' | 'prime' | 'sub' | 'clear' | 'fillToBorder' | 'borderToFill';
|
|
@@ -43,10 +43,10 @@ declare namespace Button {
|
|
|
43
43
|
Callback<any>,
|
|
44
44
|
Options
|
|
45
45
|
];
|
|
46
|
-
type Callback<T =
|
|
46
|
+
type Callback<T = Records> = {
|
|
47
47
|
(args: CallbackParams<T>): void;
|
|
48
48
|
};
|
|
49
|
-
type CallbackParams<T =
|
|
49
|
+
type CallbackParams<T = Records> = {
|
|
50
50
|
body: T;
|
|
51
51
|
isValid: boolean;
|
|
52
52
|
/**
|
|
@@ -73,7 +73,7 @@ declare namespace Button {
|
|
|
73
73
|
formName: string;
|
|
74
74
|
acceptInvalidForm?: boolean;
|
|
75
75
|
submitDelegationKey?: ButtonTypes.delegateClickEventProps | ButtonTypes.delegateClickEventProps[];
|
|
76
|
-
callback(form:
|
|
76
|
+
callback(form: Records, ok: boolean): void;
|
|
77
77
|
};
|
|
78
78
|
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
79
79
|
namespace Methods {
|
package/dist/fn/Button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as s,c as i,d as I,e as F}from"../chunk-C5N2D3ZX.js";import{jsx as u}from"react/jsx-runtime";import M,{useStore as A,UUID as
|
|
1
|
+
import{b as s,c as i,d as I,e as F}from"../chunk-C5N2D3ZX.js";import{jsx as u}from"react/jsx-runtime";import M,{useStore as A,UUID as H}from"jmini";import{pageRouter as E,ReadStyleSet as V}from"../@utils";import{Input as O}from".";import{Box as N}from"../atoms";import{ButtonClasses as C}from"../@styles/componentClasses";const w={Size:(a,t,o,n)=>{let e={fontSize:"inherit"};return o=o||"R",t=="plain"?{}:(t=="link"?o=="xsmall"?e.fontSize="0.xs":o=="small"?e.fontSize="1.mini":o=="regular"||o=="large"&&(e.fontSize="3.paragraph"):e=s({borderRadius:"2.tone.secondary",transition:"middle",position:"relative",textAlign:"center"},e),o=="xsmall"?e=i(s({},e),{padding:["1/3","2/3"],fontSize:"0.xs",borderRadius:"3.tone.tertiary"}):o=="small"?e=i(s({},e),{padding:["1/2","3/4"],fontSize:"1.mini",borderRadius:"2.tone.secondary"}):o=="regular"?e.padding=["3/4",1]:o=="large"&&(e.padding=[1,2],e.fontSize="3.paragraph",e.isSemiBoldFont=!0),e)},Tone:(a,t,o,n)=>{let e={display:"inlineBlock",fontWeight:"inherit",fontColor:"inherit",border:"unset"};return t=="plain"||(t=="link"?(e.fontColor="theme",e.textAlign="left",e.backgroundColor="trans"):t=="normal"?e=i(s({},e),{backgroundColor:"trans"}):t=="border"?e=i(s({},e),{backgroundColor:"layer.1",border:"2.normal",borderStyle:"solid",boxShadow:"0.min"}):t=="prime"?(e=i(s({},e),{isSemiBoldFont:!0,fontColor:"white",backgroundColor:n,boxShadow:"0.normal",ssEffectsOnActive:["shrink","push","ripple.white"]}),n=="white"&&(e=i(s({},e),{fontColor:"theme",ssEffectsOnActive:["shrink","push","ripple.cloud"]}))):t=="sub"?e=i(s({},e),{fontColor:n,ssEffectsOnActive:["shrink","ripple.cloud"]}):t=="clear"?e=i(s({},e),{fontColor:n,backgroundColor:"trans",ssEffectsOnActive:["shrink","ripple.cloud"]}):t=="fillToBorder"?e=i(s({},e),{boxShadow:"0.normal",border:"2.normal",borderWidth:2,borderColor:n,fontColor:n,backgroundColor:n}):t=="borderToFill"&&(e=i(s({},e),{fontColor:n,boxShadow:"0.normal",border:"2.normal",borderWidth:2,borderColor:n,backgroundColor:n})),n=="cloud"&&(e.fontColor="2.normal"),t!="link"&&(e=s({position:"relative",ssEffectsOnActive:["shrink","push"]},e))),e}},K=a=>{var e;let t=V(s({isLocked:!1,isActive:!1,isActiveStyles:{},isActiveClassName:"",tabIndex:0,className:"",color:"theme",tone:"border","aria-label":H()},a)),o=t.seed;{let{isLocked:m=!1,isActive:h=!1,isActiveStyles:B={},isActiveClassName:g="",tone:r="border",size:l="regular",color:p="theme",className:d=""}=t;t=s(s(s({},w.Size(a.seed,r,l,p)),w.Tone(a.seed,r,l,p)),t),t.className=[d,C("Wrap"),C("isNeutral_"+!h),C("isLocked_"+m),C("Tone_"+r),C("Color_"+p),C("Tone_"+r+"_Color_"+p)].join(" "),h&&(t=s(s({className:[t.className,g].join(" ")},t),B))}if(o=="button"){let n=t,{isLocked:m,isActive:h,isActiveClassName:B,isActiveStyles:g,submitOption:r,onFormSubmit:l,onClick:p}=n,d=I(n,["isLocked","isActive","isActiveClassName","isActiveStyles","submitOption","onFormSubmit","onClick"]);return l!=null&&l[1]&&(d=i(s({},d),{"data-form-submit-button":l[0],"data-sdfike":M.Arrayify(((e=l[2])==null?void 0:e.submitableKey)||"auxEnter").join(",")})),r&&(r=s({acceptInvalidForm:!1,submitDelegationKey:"auxEnter"},r),d=i(s({},d),{"data-form-submit-button":r.formName,"data-sdfike":M.Arrayify(r.submitDelegationKey).join(",")})),u(N,i(s({htmlTag:"button",fontHeight:"inherit"},d),{onClick:k=>{m||(p&&p(k),M.scope(()=>F(void 0,null,function*(){if(!(l!=null&&l[1]))return;l[2]=s({validOnly:!0,submitableKey:"auxEnter",releaseOnFinish:!0},l==null?void 0:l[2]);let[c,T,f]=l,S="prevent-form-submit-"+c,b=A.get(S),x=()=>A.delete(S);const z=()=>(A.set({[S]:!0}),{release:x});if(b)return f.validOnly?void 0:T({body:{},isValid:!1,serialLock:z});z();let v=yield O.CollectForm(c);if(!v.isValid&&f.validOnly){x();return}yield T({body:v.data,isValid:v.isValid,serialLock:z}),f.releaseOnFinish&&x()})),M.scope(()=>F(void 0,null,function*(){if(!r)return;let c=yield O.CollectForm(r.formName);!c.isValid&&!r.acceptInvalidForm||r.callback(c.data,c.isValid)})))}}))}else if(o=="label"){let P=t,{isLocked:m,isActive:h,isActiveClassName:B,isActiveStyles:g,onClick:r}=P,l=I(P,["isLocked","isActive","isActiveClassName","isActiveStyles","onClick"]);return u(N,i(s({htmlTag:"label"},l),{onClick:p=>{m||r&&r(p)}}))}else if(o=="anchor"){let R=t,{isLocked:m,isActive:h,isActiveClassName:B,isActiveStyles:g,onClick:r,href:l="",newTab:p,sync:d,shiftQueryParams:k}=R,c=I(R,["isLocked","isActive","isActiveClassName","isActiveStyles","onClick","href","newTab","sync","shiftQueryParams"]);return u(N,i(s({htmlTag:"button"},c),{onClick:T=>{if(m)return;if(r)return r(T);let f=T.ctrlKey||T.metaKey,S=p||!!f,b=l;if(k&&(b+=location.search),d){E.pushSync(b);return}E.push(b,!!S)}}))}return null},y=function(a,t){const o=e=>u(K,s({seed:a,tone:t,size:"regular"},e)),n=o;return n.Plain=e=>u(o,s({size:"plain",tone:t},e)),n.XS=e=>u(o,s({size:"xsmall",tone:t},e)),n.S=e=>u(o,s({size:"small",tone:t},e)),n.R=e=>u(o,s({size:"regular",tone:t},e)),n.L=e=>u(o,s({size:"large",tone:t},e)),n},L=function(a){const o=n=>u(K,s({seed:a,tone:"prime",size:"regular"},n));return o.Plain=y(a,"plain"),o.Link=y(a,"link"),o.Normal=y(a,"normal"),o.Border=y(a,"border"),o.Prime=y(a,"prime"),o.Sub=y(a,"sub"),o.Clear=y(a,"clear"),o.FillToBorder=y(a,"fillToBorder"),o.BorderToFill=y(a,"borderToFill"),o},W=L("button"),_=L("label"),X=L("anchor");export{X as Anchor,W as Button,_ as Label};
|
package/dist/fn/Cropper.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Z,c as ne,e as V}from"../chunk-C5N2D3ZX.js";import{Fragment as Ce,jsx as o,jsxs as m}from"react/jsx-runtime";import v,{Filer as he,UUID as pe,useStore as q}from"jmini";import{$$fromRoot as le}from"../@utils";import{useState as z,useEffect as ee}from"react";import{Box as X,FAI as H,Column as J,FlexMargin as me}from"../atoms";import{Row as B,Literal as w}from"../mols";import{Button as k}from"./Button";import N from"./Sheet";import te from"./Loader";import ae from"./Input";import{faPalette as ue}from"@fortawesome/free-solid-svg-icons/faPalette";import{faBarsStaggered as fe}from"@fortawesome/free-solid-svg-icons/faBarsStaggered";import{faRotateLeft as ge}from"@fortawesome/free-solid-svg-icons/faRotateLeft";import{faRotateRight as de}from"@fortawesome/free-solid-svg-icons/faRotateRight";import{CropperClasses as O}from"../@styles/componentClasses";import j from"./Tooltips";class ve{constructor(e){this.set_scale=e.set_scale,this.val_file=e.val_file,this.develops=e.develops;{let[h,l]=v.is.array(e.use)&&e.use||e.use.split(":").map(r=>Number(r)),p=h/l;this.usage={w:h,h:l,aspect:p}}this.componentId=e.componentId;let c=e.canvas,t=e.picture.image;this.Canvas={elm:c,ctx:c.getContext("2d")};let{width:a,height:i}=t,n=a/i;this.Picture={elm:t,originDataUrl:t.src,aspect:n,revisedAspect:1,rotate:e.picture.rotate,grayScale:e.picture.grayScale,tone:e.picture.tone},this.scale={current:e.scale.default,default:e.scale.default,min:e.scale.min,max:e.scale.max},this.usage.aspect<this.Picture.aspect?this.scale.min=100/n*this.usage.aspect:this.scale.min=100*n/this.usage.aspect,this.pst={frame:{x:0,y:0,w:0,h:0,aspect:1},outImage:{x:0,y:0,w:0,h:0},imageX:a/2,imageY:i/2,centerX:0,centerY:0},this.dragEffectInfo={origin:{x:0,y:0},frameExpandRate:{x:0,y:0}},this.pinchEffectInfo={origin:{x:0,y:0,scale:this.scale.current}},this.frameSizing(),this.modifyImage()}frameSizing(){let e=this.Canvas.elm,c=this.Picture.elm,t=0,a=0;{if(this.usage.aspect==1){let s=e.width*.6666666666666666,C=e.height*(2/3);a=t=Math.min(s,C)}else this.usage.aspect>1?(t=e.width*.9,a=t/this.usage.aspect):(a=e.height*.9,t=a*this.usage.aspect);let r=.85;a>e.height*r&&(a=e.height*r,t=a*this.usage.aspect),t>e.width*r&&(t=e.width*r,a=t/this.usage.aspect)}let{width:i,height:n}=c,h=(e.width-t)/2,l=(e.height-a)/2,p=t/a;this.pst={frame:{x:h,y:l,w:t,h:a,aspect:p},outImage:{x:0,y:0,w:0,h:0},imageX:i/2,imageY:n/2,centerX:e.width/2,centerY:e.height/2}}dragEffect(e){let{eventType:c,x:t,y:a}=e;if(c=="start"){let i=this.Canvas.elm.position();this.dragEffectInfo={origin:{x:t,y:a},frameExpandRate:{x:this.Canvas.elm.width/i.width,y:this.Canvas.elm.height/i.height}}}else{let{origin:i,frameExpandRate:n}=this.dragEffectInfo,h=i.x-t,l=i.y-a,p=this.scale.current*this.Picture.revisedAspect/100,r=h/p*n.x,s=l/p*n.y;c=="move"?this.drawImage(this.pst.imageX+r,this.pst.imageY+s):c=="end"&&this.drawImage(this.pst.imageX+=r,this.pst.imageY+=s)}}pinchEffect(e){let{eventType:c,event:t}=e,{x:a,y:i}=v.getCursor(t.touches[0]),{x:n,y:h}=v.getCursor(t.touches[1]),l=n-a,p=h-i;if(c=="start")this.pinchEffectInfo.origin={x:l,y:p,scale:this.scale.current};else if(c=="move"){let{origin:r}=this.pinchEffectInfo,s=Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2)),S=Math.sqrt(Math.pow(l,2)+Math.pow(p,2))/s,g=Number(r.scale*S);this.set_scale(g)}}updateScale(e){let c=e;c=Math.max(c,this.scale.min),c=Math.min(c,this.scale.max),this.scale.current=c,this.drawImage()}updateFilter(e){this.Picture.grayScale=e.grayScale,this.Picture.tone=e.tone,this.Picture.rotate=e.rotate,this.modifyImage()}modifyImage(){return V(this,null,function*(){let{grayScale:e,tone:c,rotate:t}=this.Picture;const a=document.createElement("canvas");let i=a.getContext("2d"),n=yield v.ImageLoader(this.Picture.originDataUrl),h=n.width,l=n.height;(t==90||t==270)&&(h=n.height,l=n.width),a.width=h,a.height=l,e&&(i.filter="grayscale("+e+"%)"),t&&(i.translate(h/2,l/2),i.rotate(t*Math.PI/180),v.is.oneOf(t,90,270)?i.translate(-l/2,-h/2):i.translate(-h/2,-l/2)),i.drawImage(n,0,0,n.width,n.height);let p=i.getImageData(0,0,a.width,a.height),r=p.data;{e/=100;let g=[[255,255,255],[255,200,100],[170,170,255],[240,200,145],[128,255,255],[255,128,255],[255,255,128],[128,158,169],[128,112,162],[50,192,87],[246,100,140]][c],y=g[0]/255,d=g[1]/255,R=g[2]/255;for(let x=0;x<l;x++)for(let b=0;b<h;b++){var s=(x*h+b)*4;if(e){let D=.3*r[s]+.59*r[s+1]+.11*r[s+2];for(var C=0;C<3;C++){let E=r[s+C];r[s+C]=E+(D-E)*e}}r[s]*=y,r[s+1]*=d,r[s+2]*=R}}i.putImageData(p,0,0);let S=a.toDataURL("image/jpeg");{let g=yield v.ImageLoader(S),{width:y,height:d}=g,R=y/d;this.Picture=ne(Z({},this.Picture),{elm:g,aspect:R,revisedAspect:this.pst.frame.aspect>R?this.pst.frame.w/y:this.pst.frame.h/d})}this.drawImage()})}drawImage(e,c){let{Canvas:{ctx:t,elm:a},pst:{frame:i}}=this;t.clearRect(0,0,this.Canvas.elm.width,this.Canvas.elm.height);let n=e||this.pst.imageX,h=c||this.pst.imageY;{let l=this.scale.current/100,p=this.Picture.revisedAspect*l,r=this.pst.centerX-n*p,s=this.pst.centerY-h*p,C=this.Picture.elm.width*p,S=this.Picture.elm.height*p,g=0,y=0;this.usage.aspect<this.Picture.aspect?(g=C,y=g/this.usage.aspect):(y=S,g=y*this.usage.aspect);{let d=this.pst.frame.x-(C-g)/2,R=this.pst.frame.x+this.pst.frame.w-(C+g)/2,x=this.pst.frame.y-(S-y)/2,b=this.pst.frame.y+this.pst.frame.h-(S+y)/2,D=0;r<R&&(D=r-R),r>d&&(D=r-d);let E=0;s<b&&(E=s-b),s>x&&(E=s-x),this.dragEffectInfo.origin.x+=D/2/this.dragEffectInfo.frameExpandRate.x,this.dragEffectInfo.origin.y+=E/2/this.dragEffectInfo.frameExpandRate.y,r=Math.min(Math.max(r,R),d),s=Math.min(Math.max(s,b),x)}this.pst.outImage={x:r,y:s,w:C,h:S};{let d=1;t.lineWidth=d,t.strokeStyle="#ffffff66",t.strokeRect(r+(C-g)/2-d,s+(S-y)/2-d,g+d*2,y+d*2)}t.drawImage(this.Picture.elm,0,0,this.Picture.elm.width,this.Picture.elm.height,r,s,C,S)}{if(this.usage.aspect==1){t.fillStyle="rgba( 20,24,20,.5 )",t.beginPath();let l=a.width/3*2,p=a.height/3*2,r=Math.min(l,p),s=Math.max(l,p);t.arc(a.width/2,a.height/2,s*1.41,0,Math.PI*2,!0),t.arc(a.width/2,a.height/2,r/2,0,Math.PI*2,!1),t.closePath(),t.fill()}else t.fillStyle="rgba( 20,24,20,.5 )";{let p=v(document.body).getStyleProperty("--color-theme-hsl"),r=2;t.lineWidth=r,t.strokeStyle=`hsla( ${p},1 )`,t.strokeRect(i.x-r,i.y-r,i.w+r*2,i.h+r*2)}}}export(){return V(this,null,function*(){let{Canvas:e,develops:c,Picture:t,pst:{outImage:a,frame:i}}=this,n=a.w/t.elm.width,h=a.h/t.elm.height,l=(i.x-a.x)/n,p=i.w/n,r=(i.y-a.y)/h,s=i.h/h,C=Array.from({length:c.length}),S="image/jpeg";for(let g=0;g<c.length;g++){let{size:y,maxSize:d}=c[g];d=d||{S:1024*20,R:1024*100,L:1024*350}[y];let R={S:140,R:600,L:1200}[y],x=document.createElement("canvas");x.width=p,x.height=s;let b=document.createElement("canvas");b.width=R,b.height=R/this.usage.aspect;let D=x.getContext("2d");if(!D)return;let E=b.getContext("2d");if(!E)return;D.clearRect(0,0,x.width,x.height),D.drawImage(this.Picture.elm,l,r,p,s,0,0,p,s),E.fillStyle="black",E.drawImage(x,0,0,x.width,x.height,0,0,b.width,b.height);let $=b.toDataURL(S),A=yield $.toBlob(S);if(!A)return;if(A.size>=d){let ie=d/A.size;if($=b.toDataURL(S,ie*.92),A=yield $.toBlob(S),!A)return}let re=new File([A],this.val_file.name,{type:S});C[g]=re}return C})}}const se={Core:u=>{let{val_file:e,options:c,finishedCallback:t,abortCallback:a}=u,{use:i,develops:n=[]}=c,[h]=z(pe());const l={scale:{default:120,min:50,max:300},rotate:0,grayScale:0,tone:0};let p=2048*2048,r=1024,[s,C]=z("init"),[S,g]=z(""),[y,d]=z(l.scale.default),[R,x]=z(l.rotate),[b,D]=z(l.grayScale),[E,$]=z(l.tone),[A,re]=z(-1),[ie,ce]=z(-1);return ee(()=>{let f="CropperResize";return v(window).addEvent({eventType:"resize",eventID:f,callback:()=>{v.interval.once(()=>{var G;let I=le("#Canvas-"+h)[0];if(!I)return;let P=(G=q.get(h))==null?void 0:G.Instance;if(!P)return;let W=I.position(),U=W.width/W.height,Y=r,F=Y/U;if(Y*F>p){let K=Y*F/p;Y=Math.floor(Y/Math.sqrt(K)),F=Math.floor(F/Math.sqrt(K))}I.width=r,I.height=F;let{width:L,height:Q}=I;P.pst.centerX=L/2,P.pst.centerY=Q/2,P.frameSizing(),P.modifyImage()},250,"CropperResize")}}),()=>{v(window).removeEvent(f)}},[]),ee(()=>{q.set({[h]:{}}),V(void 0,null,function*(){try{let f=le("#Canvas-"+h)[0];if(!f)return;let I=f.position(),P=I.width/I.height,W=r,U=W/P;if(W*U>p){let _=W*U/p;W=Math.floor(W/Math.sqrt(_)),U=Math.floor(U/Math.sqrt(_))}f.width=W,f.height=U;let Y=he(e),F=yield v.ImageLoader(yield Y.toObjectURL());re(F.width),ce(F.height);let L=new ve({set_scale:d,val_file:e,develops:n,use:i,scale:l.scale,componentId:h,canvas:f,picture:{image:F,grayScale:l.grayScale,tone:l.tone,rotate:l.rotate}});q.set({[h]:{Instance:L}});const Q=function(_){if(_.preventDefault(),_.touches&&_.touches.length>1)L.pinchEffect({eventType:"start",event:_}),v(document).addEvent({eventType:"touchmove",eventID:"CropperEffectMove",options:{passive:!1},callback:M=>{M.preventDefault(),L.pinchEffect({eventType:"move",event:M})}}).addEvent({eventType:"touchend",eventID:"CropperEffectEnd",options:{passive:!1},callback:K});else{L.dragEffect(Z({eventType:"start"},v.getCursor(_)));let{type:M}=_;v(document).addEvent({eventType:M=="touchstart"?"touchmove":"mousemove",eventID:"CropperEffectMove",options:{passive:!1},callback:T=>{G("move",T)}}).addEvent({eventType:M=="touchstart"?"touchend":"mouseup",eventID:"CropperEffectEnd",options:{passive:!1},callback:T=>{G("end",T),K(T)}})}},G=function(_,M){M.preventDefault(),L.dragEffect(Z({eventType:_},v.getCursor(M)))},K=function(_){_.preventDefault(),v(document).removeEvent(["CropperEffectMove","CropperEffectEnd"])};v(f).removeEvent(["CropperMouseWheel","CropperTouchStart","CropperMouseDown"]).addEvent({eventID:"CropperMouseWheel",eventType:"wheel",callback:_=>{_.preventDefault();let M=Number(_.wheelDelta*.04),T=L.scale.current+M;T=Math.max(T,L.scale.min),T=Math.min(T,L.scale.max),d(T)},options:{passive:!1}}).addEvent({eventType:"touchstart",eventID:"CropperTouchStart",callback:Q,options:{passive:!1}}).addEvent({eventType:"mousedown",eventID:"CropperMouseDown",callback:Q,options:{passive:!1}}),yield v.pending(1e3),C("ok")}catch(f){C("error"),g((f==null?void 0:f.message)||v.Stringify(f)),console.error(f)}})},[e.id]),ee(()=>{var I;let f=(I=q.get(h))==null?void 0:I.Instance;f&&f.updateScale(y)},[y]),ee(()=>{var I;let f=(I=q.get(h))==null?void 0:I.Instance;f&&f.updateFilter({grayScale:b,tone:E,rotate:R})},[b,E,R]),o(N.Body,{borderRadius:0,height:"viewHeight",width:"viewWidth",children:m(J,{className:[O("Wrap"),O("Use_"+i)].join(" "),gap:0,height:1,position:"relative",overflow:"hidden",borderRadius:"inherit",children:[m(X,{position:"absolute",top:"50%",left:"50%",flexCenter:!0,freeCSS:{zIndex:2,transform:"translate( -50%,-50% )",pointerEvents:"none"},children:[s=="init"&&o(te.Theme.XL,{showInitial:!0}),s=="error"&&m(w.Supplement,{fontColor:"nega",children:["\u753B\u50CF\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",o(w.Description,{children:S})]})]}),m(X,{flexSizing:0,overflow:"hidden",position:"relative",flexCenter:!0,paddingBottom:6,freeCSS:{zIndex:1,backgroundColor:"#000f0f"},children:[o("canvas",{style:{width:"100%",height:"100%"},width:r,height:r,className:O("Canvas"),id:"Canvas-"+h}),o(w.Supplement,{position:"absolute",bottom:1,left:1,right:1,ssCardBox:"plain",boxShadow:"0.max",padding:1,backgroundColor:"layer.0.opa.few",freeCSS:{backdropFilter:"blur(6px)"},children:m(J,{gap:"1/2",children:[m(B.Left,{gap:"1/2",flexWrap:!0,fontColor:"white",fontSize:"0.xs",fontHeight:1.2,children:[m(w,{children:["[",e.type,"]"]}),o(w,{children:e.name}),m(w,{children:[A,"px x ",ie,"px"]}),m(w,{children:["[",e.size.rank(),"B]"]})]}),m(B.Left,{gap:"1/2",verticalAlign:"unset",flexWrap:!0,children:[o(se.SettingRegion,{DefaultOptions:l,val_scale:y,set_scale:d,val_tone:E,set_tone:$,val_grayScale:b,set_grayScale:D,val_rotate:R,set_rotate:x}),o(me,{}),o(k.Border.S,{onClick:()=>{a()},children:"\u9589\u3058\u308B"}),o(k.Prime.S,{boxShadow:"3.remark",onClick:()=>V(void 0,null,function*(){var P;let f=(P=q.get(h))==null?void 0:P.Instance;if(!f)return;te.fn.mini.active("CropperExportation");let I=yield f.export();setTimeout(()=>{te.fn.mini.stop("CropperExportation"),t(I)},1e3)}),children:m(B.Center,{gap:"1/2",children:[o(te.White.R,{loaderID:"CropperExportation"}),"\u6C7A\u5B9A"]})})]})]})})]})]})})},SettingRegion:u=>{let e=["","\u6696\u8272","\u5BD2\u8272","\u30BB\u30D4\u30A2","\u30B7\u30A2\u30F3","\u30DE\u30BC\u30F3\u30BF","\u30A4\u30A8\u30ED\u30FC","\u30AA\u30EA\u30B8\u30CA\u30EB1","\u30AA\u30EA\u30B8\u30CA\u30EB2","\u30AA\u30EA\u30B8\u30CA\u30EB3","\u30AA\u30EA\u30B8\u30CA\u30EB4"],c=t=>e[t]||"\u306A\u3057";return m(Ce,{children:[m(B.Center,{gap:"1/6",children:[m(k.Border.S,{flexCenter:!0,gap:"1/4",border:"unset",borderTopRightRadius:0,borderBottomRightRadius:0,onClick:()=>{let t=u.val_rotate-90;t<0&&(t+=360),u.set_rotate(t)},children:[o(w,{children:"90\xB0"}),o(H,{icon:ge,fontColor:"4.thin"})]}),m(k.Border.S,{flexCenter:!0,gap:"1/4",border:"unset",borderTopLeftRadius:0,borderBottomLeftRadius:0,onClick:()=>{u.set_rotate((u.val_rotate+90)%360)},children:[o(H,{icon:de,fontColor:"4.thin"}),o(w,{children:"90\xB0"})]})]}),m(k.Border.S,{flexCenter:!0,gap:"1/2",border:"unset",onClick:t=>{let a="CropperZoomEdit";j.open({tipsID:a,gravityPoint:3,event:t,closeAtParentBlur:!1,freeCSS:{minWidth:12*26},content:o(N.Body,{children:m(J,{padding:1.5,children:[m(B.Separate,{children:[o(w.Paragraph,{children:m(B.Center,{gap:"1/2",children:[o(H.Search,{fontColor:"5.translucent"}),"Zoom"]})}),o(k.Sub,{color:"cloud",ssSphere:2.5,onClick:()=>{j.close(a)},children:o(H.X,{})})]}),o(X,{borderBottom:!0,opacity:"low"}),o(ae.Slider,{override:"force",value:u.val_scale-u.DefaultOptions.scale.min,min:u.DefaultOptions.scale.min-100,max:u.DefaultOptions.scale.max-100,step:25,onUpdateValidValue:(i,n)=>{v.interval.once(()=>{u.set_scale(i+100)},250,"Cropper.UpdateScale")},onLegendRender:i=>"x"+Math.round(100+i)/100})]})})})},children:[o(w.Supplement,{fontSize:"0.xs",fontColor:"4.thin",children:"Zoom"}),m(w,{unitWidth:4,children:[u.val_scale.rate(1,0),"%"]})]}),m(k.Border.S,{flexCenter:!0,gap:"1/2",border:"unset",onClick:t=>{let a="CropperGrayScaleEdit";j.open({tipsID:a,gravityPoint:3,event:t,closeAtParentBlur:!1,freeCSS:{minWidth:12*26},content:o(N.Body,{children:m(J,{padding:1.5,children:[m(B.Separate,{children:[o(w.Paragraph,{children:m(B.Center,{gap:"1/2",children:[o(H,{icon:ue,fontColor:"5.translucent"}),"Gray Scale"]})}),o(k.Sub,{color:"cloud",ssSphere:2.5,onClick:()=>{j.close(a)},children:o(H.X,{})})]}),o(X,{borderBottom:!0,opacity:"low"}),o(ae.Slider,{value:u.val_grayScale,min:0,max:100,step:10,onUpdateValidValue:i=>{v.interval.once(()=>{u.set_grayScale(i)},250,"Cropper.GrayScale")},onLegendRender:i=>i+"%"})]})})})},children:[o(w.Supplement,{fontSize:"0.xs",fontColor:"4.thin",children:"GrayScale"}),m(w,{children:[u.val_grayScale.rate(1,0),"%"]})]}),m(k.Border.S,{flexCenter:!0,gap:"1/2",border:"unset",onClick:t=>{let a="CropperToneEdit";j.open({tipsID:a,gravityPoint:3,event:t,closeAtParentBlur:!1,freeCSS:{minWidth:12*26,maxWidth:12*24},content:()=>{let i=[];for(let n=1;n<=10;n++)i.push({value:n,label:m(B.Left,{gap:"1/3",children:[o(X,{ssSphere:1,className:[O("ToneBall"),O("ToneBall_"+n)].join(" ")}),o(X,{textAlign:"left",flexSizing:0,children:c(n)})]})});return o(N.Body,{children:m(J,{padding:1.5,children:[m(B.Separate,{children:[o(w.Paragraph,{children:m(B.Center,{gap:"1/2",children:[o(H,{icon:fe,fontColor:"5.translucent"}),"Tone"]})}),o(k.Sub,{color:"cloud",ssSphere:2.5,onClick:()=>{j.close(a)},children:o(H.X,{})})]}),o(X,{borderBottom:!0,opacity:"low"}),o(ae.Radio.Normal,{value:u.val_tone,gap:"1/2",cellStyles:{fontColor:"3.blur"},options:[{value:0,label:o(X,{flexSizing:0,textAlign:"center",children:"\u306A\u3057"})},...i],onUpdateValidValue:n=>{u.set_tone(n)}})]})})}})},children:[o(w.Supplement,{fontSize:"0.xs",fontColor:"4.thin",children:"Tone"}),o(X,{boxShadow:"2.remark",ssSphere:1,className:[O("ToneBall"),O("ToneBall_"+u.val_tone)].join(" ")}),c(u.val_tone)]})]})}},oe={openDialogNEdit:u=>{ae.Filer.fn.openDialog({accept:"image",multiple:!1,onChange:e=>{oe.openEditor(Z({imageFile:e[0]},u))}})},openEditor:u=>V(void 0,null,function*(){let e="CropperImage";N.open("middleCenter",{sheetID:e,size:"MAX",padding:0,margin:0,freeCSS:{maxWidth:"100%"},content:o(se.Core,{val_file:u.imageFile,options:u,finishedCallback:c=>{N.close(e),u.onProcessFinished(c)},abortCallback:()=>{N.close(e)}}),closeAtEscapeKeyDown:!1})})};export{oe as Cropper,oe as default};
|
|
1
|
+
import{b as K,c as ne,e as V}from"../chunk-C5N2D3ZX.js";import{Fragment as Ce,jsx as o,jsxs as m}from"react/jsx-runtime";import v,{Filer as he,UUID as pe,useStore as q}from"jmini";import{$$fromRoot as le}from"../@utils";import{useState as z,useEffect as ee}from"react";import{Box as X,FAI as H,Column as J,FlexMargin as me}from"../atoms";import{Row as B,Literal as w}from"../mols";import{Button as k}from"./Button";import N from"./Sheet";import te from"./Loader";import ae from"./Input";import{faPalette as ue}from"@fortawesome/free-solid-svg-icons/faPalette";import{faBarsStaggered as fe}from"@fortawesome/free-solid-svg-icons/faBarsStaggered";import{faRotateLeft as de}from"@fortawesome/free-solid-svg-icons/faRotateLeft";import{faRotateRight as ge}from"@fortawesome/free-solid-svg-icons/faRotateRight";import{CropperClasses as O}from"../@styles/componentClasses";import j from"./Tooltips";class ve{constructor(e){this.set_scale=e.set_scale,this.val_file=e.val_file,this.develops=e.develops;{let[h,l]=v.isArray(e.use)&&e.use||e.use.split(":").map(r=>Number(r)),p=h/l;this.usage={w:h,h:l,aspect:p}}this.componentId=e.componentId;let c=e.canvas,t=e.picture.image;this.Canvas={elm:c,ctx:c.getContext("2d")};let{width:a,height:i}=t,n=a/i;this.Picture={elm:t,originDataUrl:t.src,aspect:n,revisedAspect:1,rotate:e.picture.rotate,grayScale:e.picture.grayScale,tone:e.picture.tone},this.scale={current:e.scale.default,default:e.scale.default,min:e.scale.min,max:e.scale.max},this.usage.aspect<this.Picture.aspect?this.scale.min=100/n*this.usage.aspect:this.scale.min=100*n/this.usage.aspect,this.pst={frame:{x:0,y:0,w:0,h:0,aspect:1},outImage:{x:0,y:0,w:0,h:0},imageX:a/2,imageY:i/2,centerX:0,centerY:0},this.dragEffectInfo={origin:{x:0,y:0},frameExpandRate:{x:0,y:0}},this.pinchEffectInfo={origin:{x:0,y:0,scale:this.scale.current}},this.frameSizing(),this.modifyImage()}frameSizing(){let e=this.Canvas.elm,c=this.Picture.elm,t=0,a=0;{if(this.usage.aspect==1){let s=e.width*.6666666666666666,C=e.height*(2/3);a=t=Math.min(s,C)}else this.usage.aspect>1?(t=e.width*.9,a=t/this.usage.aspect):(a=e.height*.9,t=a*this.usage.aspect);let r=.85;a>e.height*r&&(a=e.height*r,t=a*this.usage.aspect),t>e.width*r&&(t=e.width*r,a=t/this.usage.aspect)}let{width:i,height:n}=c,h=(e.width-t)/2,l=(e.height-a)/2,p=t/a;this.pst={frame:{x:h,y:l,w:t,h:a,aspect:p},outImage:{x:0,y:0,w:0,h:0},imageX:i/2,imageY:n/2,centerX:e.width/2,centerY:e.height/2}}dragEffect(e){let{eventType:c,x:t,y:a}=e;if(c=="start"){let i=this.Canvas.elm.position();this.dragEffectInfo={origin:{x:t,y:a},frameExpandRate:{x:this.Canvas.elm.width/i.width,y:this.Canvas.elm.height/i.height}}}else{let{origin:i,frameExpandRate:n}=this.dragEffectInfo,h=i.x-t,l=i.y-a,p=this.scale.current*this.Picture.revisedAspect/100,r=h/p*n.x,s=l/p*n.y;c=="move"?this.drawImage(this.pst.imageX+r,this.pst.imageY+s):c=="end"&&this.drawImage(this.pst.imageX+=r,this.pst.imageY+=s)}}pinchEffect(e){let{eventType:c,event:t}=e,{x:a,y:i}=v.getCursor(t.touches[0]),{x:n,y:h}=v.getCursor(t.touches[1]),l=n-a,p=h-i;if(c=="start")this.pinchEffectInfo.origin={x:l,y:p,scale:this.scale.current};else if(c=="move"){let{origin:r}=this.pinchEffectInfo,s=Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2)),S=Math.sqrt(Math.pow(l,2)+Math.pow(p,2))/s,d=Number(r.scale*S);this.set_scale(d)}}updateScale(e){let c=e;c=Math.max(c,this.scale.min),c=Math.min(c,this.scale.max),this.scale.current=c,this.drawImage()}updateFilter(e){this.Picture.grayScale=e.grayScale,this.Picture.tone=e.tone,this.Picture.rotate=e.rotate,this.modifyImage()}modifyImage(){return V(this,null,function*(){let{grayScale:e,tone:c,rotate:t}=this.Picture;const a=document.createElement("canvas");let i=a.getContext("2d"),n=yield v.ImageLoader(this.Picture.originDataUrl),h=n.width,l=n.height;(t==90||t==270)&&(h=n.height,l=n.width),a.width=h,a.height=l,e&&(i.filter="grayscale("+e+"%)"),t&&(i.translate(h/2,l/2),i.rotate(t*Math.PI/180),v.isOneOf(t,90,270)?i.translate(-l/2,-h/2):i.translate(-h/2,-l/2)),i.drawImage(n,0,0,n.width,n.height);let p=i.getImageData(0,0,a.width,a.height),r=p.data;{e/=100;let d=[[255,255,255],[255,200,100],[170,170,255],[240,200,145],[128,255,255],[255,128,255],[255,255,128],[128,158,169],[128,112,162],[50,192,87],[246,100,140]][c],y=d[0]/255,g=d[1]/255,R=d[2]/255;for(let x=0;x<l;x++)for(let b=0;b<h;b++){var s=(x*h+b)*4;if(e){let D=.3*r[s]+.59*r[s+1]+.11*r[s+2];for(var C=0;C<3;C++){let E=r[s+C];r[s+C]=E+(D-E)*e}}r[s]*=y,r[s+1]*=g,r[s+2]*=R}}i.putImageData(p,0,0);let S=a.toDataURL("image/jpeg");{let d=yield v.ImageLoader(S),{width:y,height:g}=d,R=y/g;this.Picture=ne(K({},this.Picture),{elm:d,aspect:R,revisedAspect:this.pst.frame.aspect>R?this.pst.frame.w/y:this.pst.frame.h/g})}this.drawImage()})}drawImage(e,c){let{Canvas:{ctx:t,elm:a},pst:{frame:i}}=this;t.clearRect(0,0,this.Canvas.elm.width,this.Canvas.elm.height);let n=e||this.pst.imageX,h=c||this.pst.imageY;{let l=this.scale.current/100,p=this.Picture.revisedAspect*l,r=this.pst.centerX-n*p,s=this.pst.centerY-h*p,C=this.Picture.elm.width*p,S=this.Picture.elm.height*p,d=0,y=0;this.usage.aspect<this.Picture.aspect?(d=C,y=d/this.usage.aspect):(y=S,d=y*this.usage.aspect);{let g=this.pst.frame.x-(C-d)/2,R=this.pst.frame.x+this.pst.frame.w-(C+d)/2,x=this.pst.frame.y-(S-y)/2,b=this.pst.frame.y+this.pst.frame.h-(S+y)/2,D=0;r<R&&(D=r-R),r>g&&(D=r-g);let E=0;s<b&&(E=s-b),s>x&&(E=s-x),this.dragEffectInfo.origin.x+=D/2/this.dragEffectInfo.frameExpandRate.x,this.dragEffectInfo.origin.y+=E/2/this.dragEffectInfo.frameExpandRate.y,r=Math.min(Math.max(r,R),g),s=Math.min(Math.max(s,b),x)}this.pst.outImage={x:r,y:s,w:C,h:S};{let g=1;t.lineWidth=g,t.strokeStyle="#ffffff66",t.strokeRect(r+(C-d)/2-g,s+(S-y)/2-g,d+g*2,y+g*2)}t.drawImage(this.Picture.elm,0,0,this.Picture.elm.width,this.Picture.elm.height,r,s,C,S)}{if(this.usage.aspect==1){t.fillStyle="rgba( 20,24,20,.5 )",t.beginPath();let l=a.width/3*2,p=a.height/3*2,r=Math.min(l,p),s=Math.max(l,p);t.arc(a.width/2,a.height/2,s*1.41,0,Math.PI*2,!0),t.arc(a.width/2,a.height/2,r/2,0,Math.PI*2,!1),t.closePath(),t.fill()}else t.fillStyle="rgba( 20,24,20,.5 )";{let p=v(document.body).getStyleProperty("--color-theme-hsl"),r=2;t.lineWidth=r,t.strokeStyle=`hsla( ${p},1 )`,t.strokeRect(i.x-r,i.y-r,i.w+r*2,i.h+r*2)}}}export(){return V(this,null,function*(){let{Canvas:e,develops:c,Picture:t,pst:{outImage:a,frame:i}}=this,n=a.w/t.elm.width,h=a.h/t.elm.height,l=(i.x-a.x)/n,p=i.w/n,r=(i.y-a.y)/h,s=i.h/h,C=Array.from({length:c.length}),S="image/jpeg";for(let d=0;d<c.length;d++){let{size:y,maxSize:g}=c[d];g=g||{S:1024*20,R:1024*100,L:1024*350}[y];let R={S:140,R:600,L:1200}[y],x=document.createElement("canvas");x.width=p,x.height=s;let b=document.createElement("canvas");b.width=R,b.height=R/this.usage.aspect;let D=x.getContext("2d");if(!D)return;let E=b.getContext("2d");if(!E)return;D.clearRect(0,0,x.width,x.height),D.drawImage(this.Picture.elm,l,r,p,s,0,0,p,s),E.fillStyle="black",E.drawImage(x,0,0,x.width,x.height,0,0,b.width,b.height);let $=b.toDataURL(S),A=yield $.toBlob(S);if(!A)return;if(A.size>=g){let ie=g/A.size;if($=b.toDataURL(S,ie*.92),A=yield $.toBlob(S),!A)return}let re=new File([A],this.val_file.name,{type:S});C[d]=re}return C})}}const se={Core:u=>{let{val_file:e,options:c,finishedCallback:t,abortCallback:a}=u,{use:i,develops:n=[]}=c,[h]=z(pe());const l={scale:{default:120,min:50,max:300},rotate:0,grayScale:0,tone:0};let p=2048*2048,r=1024,[s,C]=z("init"),[S,d]=z(""),[y,g]=z(l.scale.default),[R,x]=z(l.rotate),[b,D]=z(l.grayScale),[E,$]=z(l.tone),[A,re]=z(-1),[ie,ce]=z(-1);return ee(()=>{let f="CropperResize";return v(window).addEvent({eventType:"resize",eventID:f,callback:()=>{v.interval.once(()=>{var G;let I=le("#Canvas-"+h)[0];if(!I)return;let P=(G=q.get(h))==null?void 0:G.Instance;if(!P)return;let W=I.position(),U=W.width/W.height,Y=r,F=Y/U;if(Y*F>p){let Z=Y*F/p;Y=Math.floor(Y/Math.sqrt(Z)),F=Math.floor(F/Math.sqrt(Z))}I.width=r,I.height=F;let{width:L,height:Q}=I;P.pst.centerX=L/2,P.pst.centerY=Q/2,P.frameSizing(),P.modifyImage()},250,"CropperResize")}}),()=>{v(window).removeEvent(f)}},[]),ee(()=>{q.set({[h]:{}}),V(void 0,null,function*(){try{let f=le("#Canvas-"+h)[0];if(!f)return;let I=f.position(),P=I.width/I.height,W=r,U=W/P;if(W*U>p){let _=W*U/p;W=Math.floor(W/Math.sqrt(_)),U=Math.floor(U/Math.sqrt(_))}f.width=W,f.height=U;let Y=he(e),F=yield v.ImageLoader(yield Y.toObjectURL());re(F.width),ce(F.height);let L=new ve({set_scale:g,val_file:e,develops:n,use:i,scale:l.scale,componentId:h,canvas:f,picture:{image:F,grayScale:l.grayScale,tone:l.tone,rotate:l.rotate}});q.set({[h]:{Instance:L}});const Q=function(_){if(_.preventDefault(),_.touches&&_.touches.length>1)L.pinchEffect({eventType:"start",event:_}),v(document).addEvent({eventType:"touchmove",eventID:"CropperEffectMove",options:{passive:!1},callback:M=>{M.preventDefault(),L.pinchEffect({eventType:"move",event:M})}}).addEvent({eventType:"touchend",eventID:"CropperEffectEnd",options:{passive:!1},callback:Z});else{L.dragEffect(K({eventType:"start"},v.getCursor(_)));let{type:M}=_;v(document).addEvent({eventType:M=="touchstart"?"touchmove":"mousemove",eventID:"CropperEffectMove",options:{passive:!1},callback:T=>{G("move",T)}}).addEvent({eventType:M=="touchstart"?"touchend":"mouseup",eventID:"CropperEffectEnd",options:{passive:!1},callback:T=>{G("end",T),Z(T)}})}},G=function(_,M){M.preventDefault(),L.dragEffect(K({eventType:_},v.getCursor(M)))},Z=function(_){_.preventDefault(),v(document).removeEvent(["CropperEffectMove","CropperEffectEnd"])};v(f).removeEvent(["CropperMouseWheel","CropperTouchStart","CropperMouseDown"]).addEvent({eventID:"CropperMouseWheel",eventType:"wheel",callback:_=>{_.preventDefault();let M=Number(_.wheelDelta*.04),T=L.scale.current+M;T=Math.max(T,L.scale.min),T=Math.min(T,L.scale.max),g(T)},options:{passive:!1}}).addEvent({eventType:"touchstart",eventID:"CropperTouchStart",callback:Q,options:{passive:!1}}).addEvent({eventType:"mousedown",eventID:"CropperMouseDown",callback:Q,options:{passive:!1}}),yield v.pending(1e3),C("ok")}catch(f){C("error"),d((f==null?void 0:f.message)||v.Stringify(f)),console.error(f)}})},[e.id]),ee(()=>{var I;let f=(I=q.get(h))==null?void 0:I.Instance;f&&f.updateScale(y)},[y]),ee(()=>{var I;let f=(I=q.get(h))==null?void 0:I.Instance;f&&f.updateFilter({grayScale:b,tone:E,rotate:R})},[b,E,R]),o(N.Body,{borderRadius:0,height:"viewHeight",width:"viewWidth",children:m(J,{className:[O("Wrap"),O("Use_"+i)].join(" "),gap:0,height:1,position:"relative",overflow:"hidden",borderRadius:"inherit",children:[m(X,{position:"absolute",top:"50%",left:"50%",flexCenter:!0,freeCSS:{zIndex:2,transform:"translate( -50%,-50% )",pointerEvents:"none"},children:[s=="init"&&o(te.Theme.XL,{showInitial:!0}),s=="error"&&m(w.Supplement,{fontColor:"nega",children:["\u753B\u50CF\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",o(w.Description,{children:S})]})]}),m(X,{flexSizing:0,overflow:"hidden",position:"relative",flexCenter:!0,paddingBottom:6,freeCSS:{zIndex:1,backgroundColor:"#000f0f"},children:[o("canvas",{style:{width:"100%",height:"100%"},width:r,height:r,className:O("Canvas"),id:"Canvas-"+h}),o(w.Supplement,{position:"absolute",bottom:1,left:1,right:1,ssCardBox:"plain",boxShadow:"0.max",padding:1,backgroundColor:"layer.0.opa.few",freeCSS:{backdropFilter:"blur(6px)"},children:m(J,{gap:"1/2",children:[m(B.Left,{gap:"1/2",flexWrap:!0,fontColor:"white",fontSize:"0.xs",fontHeight:1.2,children:[m(w,{children:["[",e.type,"]"]}),o(w,{children:e.name}),m(w,{children:[A,"px x ",ie,"px"]}),m(w,{children:["[",e.size.rank(),"B]"]})]}),m(B.Left,{gap:"1/2",verticalAlign:"unset",flexWrap:!0,children:[o(se.SettingRegion,{DefaultOptions:l,val_scale:y,set_scale:g,val_tone:E,set_tone:$,val_grayScale:b,set_grayScale:D,val_rotate:R,set_rotate:x}),o(me,{}),o(k.Border.S,{onClick:()=>{a()},children:"\u9589\u3058\u308B"}),o(k.Prime.S,{boxShadow:"3.remark",onClick:()=>V(void 0,null,function*(){var P;let f=(P=q.get(h))==null?void 0:P.Instance;if(!f)return;te.fn.mini.active("CropperExportation");let I=yield f.export();setTimeout(()=>{te.fn.mini.stop("CropperExportation"),t(I)},1e3)}),children:m(B.Center,{gap:"1/2",children:[o(te.White.R,{loaderID:"CropperExportation"}),"\u6C7A\u5B9A"]})})]})]})})]})]})})},SettingRegion:u=>{let e=["","\u6696\u8272","\u5BD2\u8272","\u30BB\u30D4\u30A2","\u30B7\u30A2\u30F3","\u30DE\u30BC\u30F3\u30BF","\u30A4\u30A8\u30ED\u30FC","\u30AA\u30EA\u30B8\u30CA\u30EB1","\u30AA\u30EA\u30B8\u30CA\u30EB2","\u30AA\u30EA\u30B8\u30CA\u30EB3","\u30AA\u30EA\u30B8\u30CA\u30EB4"],c=t=>e[t]||"\u306A\u3057";return m(Ce,{children:[m(B.Center,{gap:"1/6",children:[m(k.Border.S,{flexCenter:!0,gap:"1/4",border:"unset",borderTopRightRadius:0,borderBottomRightRadius:0,onClick:()=>{let t=u.val_rotate-90;t<0&&(t+=360),u.set_rotate(t)},children:[o(w,{children:"90\xB0"}),o(H,{icon:de,fontColor:"4.thin"})]}),m(k.Border.S,{flexCenter:!0,gap:"1/4",border:"unset",borderTopLeftRadius:0,borderBottomLeftRadius:0,onClick:()=>{u.set_rotate((u.val_rotate+90)%360)},children:[o(H,{icon:ge,fontColor:"4.thin"}),o(w,{children:"90\xB0"})]})]}),m(k.Border.S,{flexCenter:!0,gap:"1/2",border:"unset",onClick:t=>{let a="CropperZoomEdit";j.open({tipsID:a,gravityPoint:3,event:t,closeAtParentBlur:!1,freeCSS:{minWidth:12*26},content:o(N.Body,{children:m(J,{padding:1.5,children:[m(B.Separate,{children:[o(w.Paragraph,{children:m(B.Center,{gap:"1/2",children:[o(H.Search,{fontColor:"5.translucent"}),"Zoom"]})}),o(k.Sub,{color:"cloud",ssSphere:2.5,onClick:()=>{j.close(a)},children:o(H.X,{})})]}),o(X,{borderBottom:!0,opacity:"low"}),o(ae.Slider,{override:"force",value:u.val_scale-u.DefaultOptions.scale.min,min:u.DefaultOptions.scale.min-100,max:u.DefaultOptions.scale.max-100,step:25,onUpdateValidValue:(i,n)=>{v.interval.once(()=>{u.set_scale(i+100)},250,"Cropper.UpdateScale")},onLegendRender:i=>"x"+Math.round(100+i)/100})]})})})},children:[o(w.Supplement,{fontSize:"0.xs",fontColor:"4.thin",children:"Zoom"}),m(w,{unitWidth:4,children:[u.val_scale.rate(1,0),"%"]})]}),m(k.Border.S,{flexCenter:!0,gap:"1/2",border:"unset",onClick:t=>{let a="CropperGrayScaleEdit";j.open({tipsID:a,gravityPoint:3,event:t,closeAtParentBlur:!1,freeCSS:{minWidth:12*26},content:o(N.Body,{children:m(J,{padding:1.5,children:[m(B.Separate,{children:[o(w.Paragraph,{children:m(B.Center,{gap:"1/2",children:[o(H,{icon:ue,fontColor:"5.translucent"}),"Gray Scale"]})}),o(k.Sub,{color:"cloud",ssSphere:2.5,onClick:()=>{j.close(a)},children:o(H.X,{})})]}),o(X,{borderBottom:!0,opacity:"low"}),o(ae.Slider,{value:u.val_grayScale,min:0,max:100,step:10,onUpdateValidValue:i=>{v.interval.once(()=>{u.set_grayScale(i)},250,"Cropper.GrayScale")},onLegendRender:i=>i+"%"})]})})})},children:[o(w.Supplement,{fontSize:"0.xs",fontColor:"4.thin",children:"GrayScale"}),m(w,{children:[u.val_grayScale.rate(1,0),"%"]})]}),m(k.Border.S,{flexCenter:!0,gap:"1/2",border:"unset",onClick:t=>{let a="CropperToneEdit";j.open({tipsID:a,gravityPoint:3,event:t,closeAtParentBlur:!1,freeCSS:{minWidth:12*26,maxWidth:12*24},content:()=>{let i=[];for(let n=1;n<=10;n++)i.push({value:n,label:m(B.Left,{gap:"1/3",children:[o(X,{ssSphere:1,className:[O("ToneBall"),O("ToneBall_"+n)].join(" ")}),o(X,{textAlign:"left",flexSizing:0,children:c(n)})]})});return o(N.Body,{children:m(J,{padding:1.5,children:[m(B.Separate,{children:[o(w.Paragraph,{children:m(B.Center,{gap:"1/2",children:[o(H,{icon:fe,fontColor:"5.translucent"}),"Tone"]})}),o(k.Sub,{color:"cloud",ssSphere:2.5,onClick:()=>{j.close(a)},children:o(H.X,{})})]}),o(X,{borderBottom:!0,opacity:"low"}),o(ae.Radio.Normal,{value:u.val_tone,gap:"1/2",cellStyles:{fontColor:"3.blur"},options:[{value:0,label:o(X,{flexSizing:0,textAlign:"center",children:"\u306A\u3057"})},...i],onUpdateValidValue:n=>{u.set_tone(n)}})]})})}})},children:[o(w.Supplement,{fontSize:"0.xs",fontColor:"4.thin",children:"Tone"}),o(X,{boxShadow:"2.remark",ssSphere:1,className:[O("ToneBall"),O("ToneBall_"+u.val_tone)].join(" ")}),c(u.val_tone)]})]})}},oe={openDialogNEdit:u=>{ae.Filer.fn.openDialog({accept:"image",multiple:!1,onChange:e=>{oe.openEditor(K({imageFile:e[0]},u))}})},openEditor:u=>V(void 0,null,function*(){let e="CropperImage";N.open("middleCenter",{sheetID:e,size:"MAX",padding:0,margin:0,freeCSS:{maxWidth:"100%"},content:o(se.Core,{val_file:u.imageFile,options:u,finishedCallback:c=>{N.close(e),u.onProcessFinished(c)},abortCallback:()=>{N.close(e)}}),closeAtEscapeKeyDown:!1})})};export{oe as Cropper,oe as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { StyleTags, ReactElement } from '../../@declares';
|
|
3
|
-
import {
|
|
3
|
+
import { Records } from 'jmini';
|
|
4
4
|
import { InputTypes } from '.';
|
|
5
5
|
declare namespace Autocomplete {
|
|
6
6
|
type Input<T = Value> = InputTypes.CoreInput<T | T[]> & React.DOMAttributes<HTMLInputElement> & {
|
|
@@ -27,7 +27,7 @@ declare namespace Autocomplete {
|
|
|
27
27
|
pickerStyles?: StyleTags.PropsNFreeCSS;
|
|
28
28
|
pickerPosition?: 1 | 2 | 3 | 4;
|
|
29
29
|
};
|
|
30
|
-
type Value<T = any> = T extends infer V ? V : string | number | boolean |
|
|
30
|
+
type Value<T = any> = T extends infer V ? V : string | number | boolean | Records | void | null;
|
|
31
31
|
type Option<T = Value> = {
|
|
32
32
|
type?: 'selector';
|
|
33
33
|
id?: string;
|
|
@@ -58,7 +58,7 @@ declare namespace Autocomplete {
|
|
|
58
58
|
};
|
|
59
59
|
type onSelectedRenderProps<T = Value> = {
|
|
60
60
|
value: T;
|
|
61
|
-
option?:
|
|
61
|
+
option?: Records;
|
|
62
62
|
label: ReactElement;
|
|
63
63
|
onRemove(event: any): void;
|
|
64
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l,c as f,d as G,e as H}from"../../chunk-C5N2D3ZX.js";import{Fragment as N,jsx as u,jsxs as V}from"react/jsx-runtime";import{useState as A,useEffect as F,useRef as ne}from"react";import a,{UUID as v}from"jmini";import{Config as oe}from"../../@utils";import{Box as X,Span as ie,FAI as B,Column as q}from"../../atoms";import{Literal as W,Row as K}from"../../mols";import{Button as $}from"../Button";import{Loader as le}from"../Loader";import{Sheet as ae}from"../Sheet";import{OptionalInputWrapper as re,BoxWrapper as se,CoreEffects as z,DefaultBoxishStyles as ue}from"./core";import{InputAutocompleteClasses as L}from"../../@styles/componentClasses";import{InputLabel as ce}from"./Label";import{RightIcon as Q}from".";function pe(t){let{value:e,states:i}=t,{required:s,options:d,min:m,max:o}=i;m=m||0,o=o||65535;let n=[],p=e.filter(h=>h!==null).length;return s&&(p||n.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),p<m&&n.push({type:"invalid",label:m+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),p>o&&n.push({type:"invalid",label:o+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!n.filter(({type:h})=>h=="invalid").length,notice:n}}const D={InitOptions:t=>{let e=[];return t.forEach(i=>{if(!i)return;let{type:s,label:d,value:m,searchValue:o}=i,n=o||a.is.string(d)&&d||""||a.is.string(m)&&m||a.Stringify(m||"")||"";a.is.nullish(d)&&(d=String(m)),e.push(f(l({id:v(8)},i),{searchValue:n,type:s||"selector",label:d,value:m}))}),e},FilterSelectableOptions:(t,e,i)=>{let s=t;return i||(s=t.filter(d=>(d==null?void 0:d.type)!="label")),a.scope(()=>{if(!e)return;let d=e.toLower().replace(/ /g,"");s=s.filter(m=>(m.searchValue||"").toLower().replace(/ /g,"").includes(d))}),s},Button:t=>{let{rootStates:e,val_keyword:i,set_keyword:s,val_optionFocused:d,set_optionFocused:m,val_status:o,set_status:n}=t,J=e,{tone:p,required:h,form:k,className:r,multiSelect:c,enableFormSubmit:y,checkValidationAtFirst:S,onValidate:g,onValidateDelay:I,onUpdateValue:R,onUpdateValidValue:x,onUserAction:P,value:E="",options:w,leftIndicator:C,rightIndicator:_,leftIcon:de,rightIcon:fe,componentId:me,status_id:Se,wrapStyles:ve,emptySelect:ye,searchInputPlaceholder:he,onSelectedRender:ge,onSelectorRender:Ie,pickerStyles:be,pickerPosition:ke,onDynamicSearchOptions:_e,onDynamicSearchOptionsDelay:we}=J,T=G(J,["tone","required","form","className","multiSelect","enableFormSubmit","checkValidationAtFirst","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","emptySelect","searchInputPlaceholder","onSelectedRender","onSelectorRender","pickerStyles","pickerPosition","onDynamicSearchOptions","onDynamicSearchOptionsDelay"]),M="SearchInput_"+e.componentId;return F(()=>{var b;if(e.disabled||!o.isPickerOpen||a.is.exist(d))return;let O=D.FilterSelectableOptions(t.val_options,i,!1);m(((b=O[0])==null?void 0:b.id)||"")},[i]),F(()=>{if(o.eventType!="init"&&o.eventType!="override"&&e.max==o.rawValue.length){s(""),n(O=>f(l({},O),{eventID:v(8),isPickerOpen:!1}));return}},[o.rawValue]),F(()=>{let O="autocomplete-click-"+e.componentId;if(!o.isPickerOpen){a(document).removeEvent([O]);return}a('[data-input-origin="'+e.componentId+'"]')&&a(document).addEvent({eventID:O,eventType:"mousedown",callback:U=>{let j=a(U.target),Z=!!a(j).parent("."+L("Core")).length,ee=!!a(j).parent("."+L("Selector")).length;Z||ee||n(te=>f(l({},te),{eventID:v(8),isFocusing:!1,isPickerOpen:!1}))},options:{passive:!1}})},[o.isPickerOpen]),V(N,{children:[u(X,f(l({tabIndex:-1},T),{"data-disabled":e.disabled,"data-show-validation":z.isShowValidation(o,!!S),"data-component-id":o.componentId,"data-input-origin":o.componentId,"data-focus":o.isFocusing||o.isPickerOpen,className:[r,L("Core")].join(" "),onClick:O=>{if(T!=null&&T.onClick&&(T==null||T.onClick(O)),e.disabled)return;let b=document.activeElement;(b==null?void 0:b.id)!=M&&(oe.get().isTouchDevice||a("#"+M).focus()),n(U=>f(l({},U),{eventID:v(8),isPickerOpen:!0,isFocusing:!0}))},onKeyDown:O=>{let b=document.activeElement;(b==null?void 0:b.id)!=M&&(O.preventDefault(),a("#"+M).focus())},children:V(K.Left,{gap:0,children:[u(ie,{width:0,overflow:"hidden",opacity:"trans",children:"A"}),V(K.Left,{flexWrap:!0,flexSizing:0,gap:"1/2",verticalAlign:"unset",freeCSS:{letterSpacing:".5px"},children:[u(D.Selected,l({},t)),u(D.SearchInput,l({},t))]}),o.rawValue.length>1&&u($.Clear,{tabIndex:-1,color:"nega",fontColor:"4.thin",ssSphere:2,onClick:O=>{n(b=>f(l({},b),{eventType:"update",eventID:v(8),rawValue:[]}))},children:u(B.X,{})})]})})),u(D.Picker,l({},t))]})},SearchInput:t=>{let{rootStates:e,val_status:i,set_status:s}=t;if(e.disabled)return null;let d=!!i.isFocusing||!!i.isPickerOpen||!!i.rawValue.length;i.isFocusing||e.multiSelect||i.rawValue.length&&(d=!1);let m=e.searchInputPlaceholder||"\u691C\u7D22...";return u(X,{htmlTag:"input",id:"SearchInput_"+e.componentId,"data-input-value-shallow":i.componentId,placeholder:m,opacity:d?"max":"trans",transition:"middle",flexSizing:0,fontSize:"inherit",border:"0.trans",backgroundColor:"trans",isRounded:!0,padding:[0,"2/3"],value:t.val_keyword,className:[L("SearchInput"),d&&L("isActive")].join(" "),freeCSS:{outline:"none",minWidth:12*4},onFocus:o=>{s(n=>f(l({},n),{eventID:v(8),isFocusing:!0,isPickerOpen:!0}))},onBlur:o=>H(void 0,null,function*(){s(n=>f(l({},n),{eventID:v(8),isFocusing:!1}))}),onCompositionStart:o=>{s(n=>f(l({},n),{eventID:v(8),isComposing:!0}))},onCompositionEnd:o=>{s(n=>f(l({},n),{eventID:v(8),isComposing:!1}))},onKeyDown:o=>{let{key:n,metaKey:p,ctrlKey:h}=o,k=p||h;n=="Escape"?s(r=>f(l({},r),{eventID:v(12),isPickerOpen:!1})):n=="Tab"?s(r=>f(l({},r),{eventID:v(8),isFocusing:!1,isPickerOpen:!1})):n==" "?a.scope(()=>{i.isPickerOpen||t.val_keyword||(o.preventDefault(),s(r=>f(l({},r),{eventID:v(8),isPickerOpen:!0})))}):n=="Backspace"?a.scope(()=>{if(t.val_keyword)return;let r=[...t.val_status.rawValue];r.pop(),k&&(r=[]),s(c=>f(l({},c),{rawValue:r,eventType:"update",eventID:v(8),isInspected:!1}))}):n=="Enter"&&a.scope(()=>{if(i.isComposing||(o==null?void 0:o.keyCode)===229)return;if(!i.isPickerOpen){s(y=>f(l({},y),{eventID:v(8),isPickerOpen:!0}));return}if(!t.val_optionFocused)return;let r=t.val_options.find(y=>(y==null?void 0:y.id)==t.val_optionFocused);if(!r)return;let{value:c}=r;s(y=>{let S=[...y.rawValue];return a.scope(()=>{if(c===null)return S=[];y.rawValue.includes(c)?S=S.filter(I=>I!==c):e.multiSelect?S.push(c):S=[c]}),f(l({},y),{rawValue:S,eventType:"update",eventID:v(8),isInspected:!1})}),t.set_optionsModified(!0),t.set_keyword("")}),a.scope(()=>{if(!a.is.oneOf(n,"ArrowDown","ArrowUp"))return;if(o.preventDefault(),!i.isPickerOpen){s(g=>f(l({},g),{eventID:v(8),isPickerOpen:!0}));return}let r=n=="ArrowDown"?1:-1,c=D.FilterSelectableOptions(t.val_options,t.val_keyword),y=c.length-1,S=null;a.scope(()=>{var I,R,x,P,E,w,C;let g=c.findIndex(_=>(_==null?void 0:_.id)==t.val_optionFocused);if(g==-1){S=(I=c[0])==null?void 0:I.id;return}if(r==1){if(S=(R=c[0])==null?void 0:R.id,k){S=(x=c[y])==null?void 0:x.id;return}if(g==-1||g==y)return;S=(P=c[g+1])==null?void 0:P.id}else{if(S=(E=c[y])==null?void 0:E.id,k){S=(w=c[0])==null?void 0:w.id;return}if(g==-1||g==0)return;S=(C=c[g-1])==null?void 0:C.id}}),t.set_optionFocused(S)}),e.enableFormSubmit&&z.SubmitForm(o,t.rootStates.form)},onChange:o=>{let p=o.target.value;t.set_keyword(p),t.set_optionFocused(""),p&&s(h=>f(l({},h),{eventID:v(8),isPickerOpen:!0}))}},"searchInput")},Picker:t=>{var n;let{rootStates:e,val_status:i}=t,[s,d]=A("idle");F(()=>{if(!e.onDynamicSearchOptions||!i.isPickerOpen)return;if(t.val_optionsModified)return t.set_optionsModified(!1);if(i.isComposing)return;d("fetch");let p="autocomplete-search-"+e.componentId;t.set_optionFocused(""),a.interval.once(()=>H(void 0,null,function*(){var r;let h=yield e.onDynamicSearchOptions(t.val_keyword);d("idle");let k=D.InitOptions(h||[]);t.set_options(k),t.set_optionFocused(((r=k[0])==null?void 0:r.id)||"")}),e.onDynamicSearchOptionsDelay||500,p)},[t.val_keyword,i.isComposing]),F(()=>{let p=a(`[data-selector-id="${i.componentId}"]`)[0];if(!p)return;let h=a(`[data-autocomplete-input-value="${t.val_optionFocused}"]`)[0];h&&(p.scrollTop=h.offsetTop-24)},[t.val_optionFocused]);let m=D.FilterSelectableOptions(t.val_options,e.onDynamicSearchOptions?"":t.val_keyword,!0),o={};{let p=e.pickerPosition||0;a.is.oneOf(p,1,2)?o.bottom="100%":a.is.oneOf(p,3,4)&&(o.top="100%"),a.is.oneOf(p,1,3)?o.left=0:a.is.oneOf(p,2,4)&&(o.right=0)}return i.isPickerOpen?u(X,f(l({position:"absolute",padding:"1/3"},o),{freeCSS:l({minWidth:"75%",zIndex:1e3},o.freeCSS),children:u(ae.Body,f(l({className:L("Selector"),borderRadius:"2.tone.secondary",ssCardBox:!0,tabIndex:-1,boxShadow:"1.normal",overflow:"auto","data-selector-id":i.componentId},e.pickerStyles),{freeCSS:l({maxHeight:12*24},(n=e.pickerStyles)==null?void 0:n.freeCSS),children:V(q,{gap:"1/12",padding:[1,0],children:[s=="fetch"&&u(K.Center,{padding:"1/2",children:u(le.Theme.R,{showInitial:!0})}),s!="fetch"&&V(N,{children:[!m.length&&u(W.Supplement,{padding:[0,1],fontColor:"4.thin",children:"\u5019\u88DC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"}),m.map((p,h)=>{if(!p)return null;let{type:k,value:r}=p,c=t.val_optionFocused==p.id,y=i.rawValue.includes(r),S=e.onSelectorRender;return u(q,{"data-autocomplete-input-value":p.id,children:u(S,{option:p,isFocused:c,isSelected:y,onAdd:()=>{t.set_status(g=>{let I=[...g.rawValue];return a.scope(()=>{if(r===null)return I=[];if(g.rawValue.includes(r)){I=I.filter(x=>x!==r);return}e.multiSelect?I.push(r):I=[r]}),f(l({},g),{rawValue:I,eventType:"update",eventID:v(8),isFocusing:e.max!=I.length,isInspected:!1})})},onKeyDown:g=>{let{key:I}=g;I=="Tab"&&(t.set_optionFocused(""),t.set_status(R=>f(l({},R),{eventID:v(8),isPickerOpen:!1,isFocusing:!1})))}})},p.id)})]})]})}))})):null},Selected:t=>{let{rootStates:e,val_status:i,set_status:s,val_optionsDict:d}=t,m=[];return i.rawValue.forEach(o=>{let n=d[a.Stringify(o)];if(!n)return;let p=e.onSelectedRender,h=(n==null?void 0:n.selectedLabel)||(n==null?void 0:n.label);(n==null?void 0:n.value)===null&&(h=""),m.push(u(q,{position:"relative",flexCenter:!0,freeCSS:{userSelect:"none"},children:u(p,{value:n==null?void 0:n.value,label:h,onRemove:k=>{if(e.disabled)return;let r=[...i.rawValue];r=r.filter(c=>c!==o),s(c=>f(l({},c),{rawValue:r,eventType:"update",eventID:v(8),isInspected:!1,isFocusing:e.max!=r.length,isPickerOpen:!0}))}})},a.Stringify(n==null?void 0:n.value)||v(8)))}),u(N,{children:m})},Core:t=>{var x,P,E;let{value:e}=t,[i,s]=A(!1),[d,m]=A(""),[o,n]=A(t.options),[p,h]=A(((x=t.options.find(w=>{var C;return(w==null?void 0:w.value)===((C=t.value)==null?void 0:C[0])}))==null?void 0:x.id)||((P=t.options[0])==null?void 0:P.id)||""),[k,r]=A({}),[c,y]=A(z.DefaultStatus(t.componentId,e)),S=ne(!1);F(()=>{i||(S.current?n(t.options):S.current=!0)},[a.Stringify((E=t.options)==null?void 0:E.map(w=>w.value))]),F(()=>{if(!o.length)return;let w=[...o],C=l({},k);w.forEach(_=>{(_==null?void 0:_.type)!="label"&&(C[a.Stringify(_==null?void 0:_.value)]=_)}),r(C)},[o]);let g={rootStates:t,val_options:o,set_options:n,val_optionFocused:p,set_optionFocused:h,val_optionsDict:k,set_optionsDict:r,val_optionsModified:i,set_optionsModified:s,val_keyword:d,set_keyword:m,val_status:c,set_status:y},I=!!t.multiSelect;z.CommonEffects({type:I?"autocomplete.multi":"autocomplete.single",states:t,val_status:c,set_status:y,SystemValidation:pe});let R=c.rawValue.length&&c.rawValue[0]!==null||c.isPickerOpen||c.isFocusing;return V(se,{val_status:c,set_status:y,states:t,children:[u(ce,{componentId:t.componentId,fontSize:t.fontSize,required:t.required,label:t.label,isActive:R}),u(D.Button,l({},g))]})}},Y=t=>{let e=l({},t);return e=f(l({value:[],min:0,max:65535,multiSelect:!0,emptySelect:!0,onSelectorRender:i=>{var s;return i.option?((s=i.option)==null?void 0:s.type)=="label"?u(N,{children:i.option.label}):u($.Sub.S,{color:"cloud",tabIndex:-1,backgroundColor:"trans",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:["2/3",1.5],isActive:i.isFocused,isActiveStyles:{backgroundColor:"cloud"},onClick:i.onAdd,onKeyDown:i.onKeyDown,children:V(K.Left,{gap:"1/2",children:[i.isSelected&&u(B.Check,{fontColor:"theme"}),u(W.Supplement,{transition:"short",children:i.option.label})]})}):null},onSelectedRender:i=>V(K.Left,{ssCardBox:!0,borderRadius:"1.tone.primary",fontSize:"1.mini",padding:"1/3",gap:0,children:[u(W,{padding:[0,"1/2"],children:i.label}),u($.Clear,{flexSizing:"none",color:"nega",fontColor:"4.thin",tabIndex:-1,ssSphere:2,onClick:i.onRemove,freeCSS:{lineHeight:1,aspectRatio:"1/1"},children:u(B.X,{})})]}),pickerPosition:3},e),{freeCSS:l({cursor:"pointer"},e.freeCSS)}),e.multiSelect||(e.min=0,e.max=1),e.options=e.options||[],e.emptySelect&&(e.options=[{value:null,label:u(W.Supplement,{fontColor:"4.thin",children:"\u9078\u629E\u3092\u89E3\u9664"})},...e.options]),e.value=a.Arrayify(e.value),e.options=D.InitOptions(e.options),a.is.nullish(e.rightIcon)&&(e.rightIcon=u(Q,{children:u(B.Search,{})}),e.disabled&&(e.rightIcon=u(Q,{fontColor:"5.translucent",children:u(B.Ban,{})}))),e.rightIcon&&(e=l({paddingRight:3},e)),e.leftIcon&&(e=l({paddingLeft:3},e)),u(re,{componentId:e.componentId,children:D.Core,states:ue(e)})};export{Y as Autocomplete,Y as default};
|
|
1
|
+
import{b as l,c as f,d as G,e as H}from"../../chunk-C5N2D3ZX.js";import{Fragment as N,jsx as u,jsxs as T}from"react/jsx-runtime";import{useState as A,useEffect as F,useRef as ne}from"react";import a,{UUID as v}from"jmini";import{Config as oe}from"../../@utils";import{Box as X,Span as ie,FAI as B,Column as q}from"../../atoms";import{Literal as K,Row as M}from"../../mols";import{Button as $}from"../Button";import{Loader as le}from"../Loader";import{Sheet as ae}from"../Sheet";import{OptionalInputWrapper as re,BoxWrapper as se,CoreEffects as z,DefaultBoxishStyles as ue}from"./core";import{InputAutocompleteClasses as L}from"../../@styles/componentClasses";import{InputLabel as ce}from"./Label";import{RightIcon as Q}from".";function pe(t){let{value:e,states:i}=t,{required:s,options:d,min:m,max:o}=i;m=m||0,o=o||65535;let n=[],p=e.filter(h=>h!==null).length;return s&&(p||n.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),p<m&&n.push({type:"invalid",label:m+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),p>o&&n.push({type:"invalid",label:o+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!n.filter(({type:h})=>h=="invalid").length,notice:n}}const R={InitOptions:t=>{let e=[];return t.forEach(i=>{if(!i)return;let{type:s,label:d,value:m,searchValue:o}=i,n=o||a.isString(d)&&d||""||a.isString(m)&&m||a.Stringify(m||"")||"";a.isNullish(d)&&(d=String(m)),e.push(f(l({id:v(8)},i),{searchValue:n,type:s||"selector",label:d,value:m}))}),e},FilterSelectableOptions:(t,e,i)=>{let s=t;return i||(s=t.filter(d=>(d==null?void 0:d.type)!="label")),a.scope(()=>{if(!e)return;let d=e.toLower().replace(/ /g,"");s=s.filter(m=>(m.searchValue||"").toLower().replace(/ /g,"").includes(d))}),s},Button:t=>{let{rootStates:e,val_keyword:i,set_keyword:s,val_optionFocused:d,set_optionFocused:m,val_status:o,set_status:n}=t,J=e,{tone:p,required:h,form:O,className:r,multiSelect:c,enableFormSubmit:y,checkValidationAtFirst:S,onValidate:g,onValidateDelay:I,onUpdateValue:C,onUpdateValidValue:x,onUserAction:P,value:E="",options:_,leftIndicator:D,rightIndicator:k,leftIcon:de,rightIcon:fe,componentId:me,status_id:Se,wrapStyles:ve,emptySelect:ye,searchInputPlaceholder:he,onSelectedRender:ge,onSelectorRender:Ie,pickerStyles:be,pickerPosition:Oe,onDynamicSearchOptions:ke,onDynamicSearchOptionsDelay:_e}=J,V=G(J,["tone","required","form","className","multiSelect","enableFormSubmit","checkValidationAtFirst","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","emptySelect","searchInputPlaceholder","onSelectedRender","onSelectorRender","pickerStyles","pickerPosition","onDynamicSearchOptions","onDynamicSearchOptionsDelay"]),W="SearchInput_"+e.componentId;return F(()=>{var b;if(e.disabled||!o.isPickerOpen||a.isExist(d))return;let w=R.FilterSelectableOptions(t.val_options,i,!1);m(((b=w[0])==null?void 0:b.id)||"")},[i]),F(()=>{if(o.eventType!="init"&&o.eventType!="override"&&e.max==o.rawValue.length){s(""),n(w=>f(l({},w),{eventID:v(8),isPickerOpen:!1}));return}},[o.rawValue]),F(()=>{let w="autocomplete-click-"+e.componentId;if(!o.isPickerOpen){a(document).removeEvent([w]);return}a('[data-input-origin="'+e.componentId+'"]')&&a(document).addEvent({eventID:w,eventType:"mousedown",callback:U=>{let j=a(U.target),Z=!!a(j).parent("."+L("Core")).length,ee=!!a(j).parent("."+L("Selector")).length;Z||ee||n(te=>f(l({},te),{eventID:v(8),isFocusing:!1,isPickerOpen:!1}))},options:{passive:!1}})},[o.isPickerOpen]),T(N,{children:[u(X,f(l({tabIndex:-1},V),{"data-disabled":e.disabled,"data-show-validation":z.isShowValidation(o,!!S),"data-component-id":o.componentId,"data-input-origin":o.componentId,"data-focus":o.isFocusing||o.isPickerOpen,className:[r,L("Core")].join(" "),onClick:w=>{if(V!=null&&V.onClick&&(V==null||V.onClick(w)),e.disabled)return;let b=document.activeElement;(b==null?void 0:b.id)!=W&&(oe.get().isTouchDevice||a("#"+W).focus()),n(U=>f(l({},U),{eventID:v(8),isPickerOpen:!0,isFocusing:!0}))},onKeyDown:w=>{let b=document.activeElement;(b==null?void 0:b.id)!=W&&(w.preventDefault(),a("#"+W).focus())},children:T(M.Left,{gap:0,children:[u(ie,{width:0,overflow:"hidden",opacity:"trans",children:"A"}),T(M.Left,{flexWrap:!0,flexSizing:0,gap:"1/2",verticalAlign:"unset",freeCSS:{letterSpacing:".5px"},children:[u(R.Selected,l({},t)),u(R.SearchInput,l({},t))]}),o.rawValue.length>1&&u($.Clear,{tabIndex:-1,color:"nega",fontColor:"4.thin",ssSphere:2,onClick:w=>{n(b=>f(l({},b),{eventType:"update",eventID:v(8),rawValue:[]}))},children:u(B.X,{})})]})})),u(R.Picker,l({},t))]})},SearchInput:t=>{let{rootStates:e,val_status:i,set_status:s}=t;if(e.disabled)return null;let d=!!i.isFocusing||!!i.isPickerOpen||!!i.rawValue.length;i.isFocusing||e.multiSelect||i.rawValue.length&&(d=!1);let m=e.searchInputPlaceholder||"\u691C\u7D22...";return u(X,{htmlTag:"input",id:"SearchInput_"+e.componentId,"data-input-value-shallow":i.componentId,placeholder:m,opacity:d?"max":"trans",transition:"middle",flexSizing:0,fontSize:"inherit",border:"0.trans",backgroundColor:"trans",isRounded:!0,padding:[0,"2/3"],value:t.val_keyword,className:[L("SearchInput"),d&&L("isActive")].join(" "),freeCSS:{outline:"none",minWidth:12*4},onFocus:o=>{s(n=>f(l({},n),{eventID:v(8),isFocusing:!0,isPickerOpen:!0}))},onBlur:o=>H(void 0,null,function*(){s(n=>f(l({},n),{eventID:v(8),isFocusing:!1}))}),onCompositionStart:o=>{s(n=>f(l({},n),{eventID:v(8),isComposing:!0}))},onCompositionEnd:o=>{s(n=>f(l({},n),{eventID:v(8),isComposing:!1}))},onKeyDown:o=>{let{key:n,metaKey:p,ctrlKey:h}=o,O=p||h;n=="Escape"?s(r=>f(l({},r),{eventID:v(12),isPickerOpen:!1})):n=="Tab"?s(r=>f(l({},r),{eventID:v(8),isFocusing:!1,isPickerOpen:!1})):n==" "?a.scope(()=>{i.isPickerOpen||t.val_keyword||(o.preventDefault(),s(r=>f(l({},r),{eventID:v(8),isPickerOpen:!0})))}):n=="Backspace"?a.scope(()=>{if(t.val_keyword)return;let r=[...t.val_status.rawValue];r.pop(),O&&(r=[]),s(c=>f(l({},c),{rawValue:r,eventType:"update",eventID:v(8),isInspected:!1}))}):n=="Enter"&&a.scope(()=>{if(i.isComposing||(o==null?void 0:o.keyCode)===229)return;if(!i.isPickerOpen){s(y=>f(l({},y),{eventID:v(8),isPickerOpen:!0}));return}if(!t.val_optionFocused)return;let r=t.val_options.find(y=>(y==null?void 0:y.id)==t.val_optionFocused);if(!r)return;let{value:c}=r;s(y=>{let S=[...y.rawValue];return a.scope(()=>{if(c===null)return S=[];y.rawValue.includes(c)?S=S.filter(I=>I!==c):e.multiSelect?S.push(c):S=[c]}),f(l({},y),{rawValue:S,eventType:"update",eventID:v(8),isInspected:!1})}),t.set_optionsModified(!0),t.set_keyword("")}),a.scope(()=>{if(!a.isOneOf(n,"ArrowDown","ArrowUp"))return;if(o.preventDefault(),!i.isPickerOpen){s(g=>f(l({},g),{eventID:v(8),isPickerOpen:!0}));return}let r=n=="ArrowDown"?1:-1,c=R.FilterSelectableOptions(t.val_options,t.val_keyword),y=c.length-1,S=null;a.scope(()=>{var I,C,x,P,E,_,D;let g=c.findIndex(k=>(k==null?void 0:k.id)==t.val_optionFocused);if(g==-1){S=(I=c[0])==null?void 0:I.id;return}if(r==1){if(S=(C=c[0])==null?void 0:C.id,O){S=(x=c[y])==null?void 0:x.id;return}if(g==-1||g==y)return;S=(P=c[g+1])==null?void 0:P.id}else{if(S=(E=c[y])==null?void 0:E.id,O){S=(_=c[0])==null?void 0:_.id;return}if(g==-1||g==0)return;S=(D=c[g-1])==null?void 0:D.id}}),t.set_optionFocused(S)}),e.enableFormSubmit&&z.SubmitForm(o,t.rootStates.form)},onChange:o=>{let p=o.target.value;t.set_keyword(p),t.set_optionFocused(""),p&&s(h=>f(l({},h),{eventID:v(8),isPickerOpen:!0}))}},"searchInput")},Picker:t=>{var n;let{rootStates:e,val_status:i}=t,[s,d]=A("idle");F(()=>{if(!e.onDynamicSearchOptions||!i.isPickerOpen)return;if(t.val_optionsModified)return t.set_optionsModified(!1);if(i.isComposing)return;d("fetch");let p="autocomplete-search-"+e.componentId;t.set_optionFocused(""),a.interval.once(()=>H(void 0,null,function*(){var r;let h=yield e.onDynamicSearchOptions(t.val_keyword);d("idle");let O=R.InitOptions(h||[]);t.set_options(O),t.set_optionFocused(((r=O[0])==null?void 0:r.id)||"")}),e.onDynamicSearchOptionsDelay||500,p)},[t.val_keyword,i.isComposing]),F(()=>{let p=a(`[data-selector-id="${i.componentId}"]`)[0];if(!p)return;let h=a(`[data-autocomplete-input-value="${t.val_optionFocused}"]`)[0];h&&(p.scrollTop=h.offsetTop-24)},[t.val_optionFocused]);let m=R.FilterSelectableOptions(t.val_options,e.onDynamicSearchOptions?"":t.val_keyword,!0),o={};{let p=e.pickerPosition||0;a.isOneOf(p,1,2)?o.bottom="100%":a.isOneOf(p,3,4)&&(o.top="100%"),a.isOneOf(p,1,3)?o.left=0:a.isOneOf(p,2,4)&&(o.right=0)}return i.isPickerOpen?u(X,f(l({position:"absolute",padding:"1/3"},o),{freeCSS:l({minWidth:"75%",zIndex:1e3},o.freeCSS),children:u(ae.Body,f(l({className:L("Selector"),borderRadius:"2.tone.secondary",ssCardBox:!0,tabIndex:-1,boxShadow:"1.normal",overflow:"auto","data-selector-id":i.componentId},e.pickerStyles),{freeCSS:l({maxHeight:12*24},(n=e.pickerStyles)==null?void 0:n.freeCSS),children:T(q,{gap:"1/12",padding:[1,0],children:[s=="fetch"&&u(M.Center,{padding:"1/2",children:u(le.Theme.R,{showInitial:!0})}),s!="fetch"&&T(N,{children:[!m.length&&u(K.Supplement,{padding:[0,1],fontColor:"4.thin",children:"\u5019\u88DC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"}),m.map((p,h)=>{if(!p)return null;let{type:O,value:r}=p,c=t.val_optionFocused==p.id,y=i.rawValue.includes(r),S=e.onSelectorRender;return u(q,{"data-autocomplete-input-value":p.id,children:u(S,{option:p,isFocused:c,isSelected:y,onAdd:()=>{t.set_status(g=>{let I=[...g.rawValue];return a.scope(()=>{if(r===null)return I=[];if(g.rawValue.includes(r)){I=I.filter(x=>x!==r);return}e.multiSelect?I.push(r):I=[r]}),f(l({},g),{rawValue:I,eventType:"update",eventID:v(8),isFocusing:e.max!=I.length,isInspected:!1})})},onKeyDown:g=>{let{key:I}=g;I=="Tab"&&(t.set_optionFocused(""),t.set_status(C=>f(l({},C),{eventID:v(8),isPickerOpen:!1,isFocusing:!1})))}})},p.id)})]})]})}))})):null},Selected:t=>{let{rootStates:e,val_status:i,set_status:s,val_optionsDict:d}=t,m=[];return i.rawValue.forEach(o=>{let n=d[a.Stringify(o)];if(!n)return;let p=e.onSelectedRender,h=(n==null?void 0:n.selectedLabel)||(n==null?void 0:n.label);(n==null?void 0:n.value)===null&&(h=""),m.push(u(q,{position:"relative",flexCenter:!0,freeCSS:{userSelect:"none"},children:u(p,{value:n==null?void 0:n.value,label:h,onRemove:O=>{if(e.disabled)return;let r=[...i.rawValue];r=r.filter(c=>c!==o),s(c=>f(l({},c),{rawValue:r,eventType:"update",eventID:v(8),isInspected:!1,isFocusing:e.max!=r.length,isPickerOpen:!0}))}})},a.Stringify(n==null?void 0:n.value)||v(8)))}),u(N,{children:m})},Core:t=>{var x,P,E;let{value:e}=t,[i,s]=A(!1),[d,m]=A(""),[o,n]=A(t.options),[p,h]=A(((x=t.options.find(_=>{var D;return(_==null?void 0:_.value)===((D=t.value)==null?void 0:D[0])}))==null?void 0:x.id)||((P=t.options[0])==null?void 0:P.id)||""),[O,r]=A({}),[c,y]=A(z.DefaultStatus(t.componentId,e)),S=ne(!1);F(()=>{i||(S.current?n(t.options):S.current=!0)},[a.Stringify((E=t.options)==null?void 0:E.map(_=>_.value))]),F(()=>{if(!o.length)return;let _=[...o],D=l({},O);_.forEach(k=>{(k==null?void 0:k.type)!="label"&&(D[a.Stringify(k==null?void 0:k.value)]=k)}),r(D)},[o]);let g={rootStates:t,val_options:o,set_options:n,val_optionFocused:p,set_optionFocused:h,val_optionsDict:O,set_optionsDict:r,val_optionsModified:i,set_optionsModified:s,val_keyword:d,set_keyword:m,val_status:c,set_status:y},I=!!t.multiSelect;z.CommonEffects({type:I?"autocomplete.multi":"autocomplete.single",states:t,val_status:c,set_status:y,SystemValidation:pe});let C=c.rawValue.length&&c.rawValue[0]!==null||c.isPickerOpen||c.isFocusing;return T(se,{val_status:c,set_status:y,states:t,children:[u(ce,{componentId:t.componentId,fontSize:t.fontSize,required:t.required,label:t.label,isActive:C}),u(R.Button,l({},g))]})}},Y=t=>{let e=l({},t);return e=f(l({value:[],min:0,max:65535,multiSelect:!0,emptySelect:!0,onSelectorRender:i=>{var s;return i.option?((s=i.option)==null?void 0:s.type)=="label"?u(N,{children:i.option.label}):u($.Sub.S,{color:"cloud",tabIndex:-1,backgroundColor:"trans",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:["2/3",1.5],isActive:i.isFocused,isActiveStyles:{backgroundColor:"cloud"},onClick:i.onAdd,onKeyDown:i.onKeyDown,children:T(M.Left,{gap:"1/2",children:[i.isSelected&&u(B.Check,{fontColor:"theme"}),u(K.Supplement,{transition:"short",children:i.option.label})]})}):null},onSelectedRender:i=>T(M.Left,{ssCardBox:!0,borderRadius:"1.tone.primary",fontSize:"1.mini",padding:"1/3",gap:0,children:[u(K,{padding:[0,"1/2"],children:i.label}),u($.Clear,{flexSizing:"none",color:"nega",fontColor:"4.thin",tabIndex:-1,ssSphere:2,onClick:i.onRemove,freeCSS:{lineHeight:1,aspectRatio:"1/1"},children:u(B.X,{})})]}),pickerPosition:3},e),{freeCSS:l({cursor:"pointer"},e.freeCSS)}),e.multiSelect||(e.min=0,e.max=1),e.options=e.options||[],e.emptySelect&&(e.options=[{value:null,label:u(K.Supplement,{fontColor:"4.thin",children:"\u9078\u629E\u3092\u89E3\u9664"})},...e.options]),e.value=a.Arrayify(e.value),e.options=R.InitOptions(e.options),a.isNullish(e.rightIcon)&&(e.rightIcon=u(Q,{children:u(B.Search,{})}),e.disabled&&(e.rightIcon=u(Q,{fontColor:"5.translucent",children:u(B.Ban,{})}))),e.rightIcon&&(e=l({paddingRight:3},e)),e.leftIcon&&(e=l({paddingLeft:3},e)),u(re,{componentId:e.componentId,children:R.Core,states:ue(e)})};export{Y as Autocomplete,Y as default};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Records } from 'jmini';
|
|
2
2
|
declare namespace CollectForm {
|
|
3
3
|
type FN = {
|
|
4
4
|
(formName: string): Promise<Output>;
|
|
5
5
|
};
|
|
6
6
|
type Output = {
|
|
7
7
|
isValid: boolean;
|
|
8
|
-
data:
|
|
8
|
+
data: Records;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
declare const CollectForm: CollectForm.FN;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as
|
|
1
|
+
import{e as s}from"../../chunk-C5N2D3ZX.js";import c,{useStore as t}from"jmini";const p=a=>s(void 0,null,function*(){let i={},r="form-process-"+a;if(t.get(r))return console.log("[CollectForm] already processing..."),{isValid:!1,data:{}};t.set({[r]:!0});let l=1;return yield c.pending(200),yield c.scope(()=>s(void 0,null,function*(){let m=t.get(["form-data",a].join("-"));if(m){for(let[n,o]of Object.entries(m)){if(!o)continue;let e=t.get(o.componentId);e&&e.Refresh&&(yield e.Refresh())}{let n=t.get(["form-data",a].join("-"));if(!n)return;for(let[o,e]of Object.entries(n))e&&(l&=Number(e.validation),i[o]=e.value)}}})),t.set({[r]:!1}),{isValid:!!l,data:i}});export{p as CollectForm,p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,c as o,d as F}from"../../chunk-C5N2D3ZX.js";import{jsx as S}from"react/jsx-runtime";import{useState as _}from"react";import V,{UUID as I}from"jmini";import{$$fromRoot as k,GenerateHTMLProps as K}from"../../@utils";import{OptionalInputWrapper as U,BoxWrapper as W,CoreEffects as w,DefaultBoxishStyles as $}from"./core";import{Flex as z}from"../../atoms";import{InputClasses as R}from"../../@styles/componentClasses";function P(e){let{value:n,states:u}=e,{required:f,numericOnly:p=!1,digits:D}=u,s=[];return f&&!n&&s.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),n&&(p&&n.match(/\D/)&&s.push({type:"invalid",label:"\u6570\u5B57\u306E\u307F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),n.length!=D&&s.push({type:"warn",label:"\u6700\u5F8C\u307E\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"})),{ok:!s.filter(({type:C})=>C=="invalid"||C=="warn").length,notice:s}}const q=(e,n="")=>{let u=String(n),f=[];for(let p=0;p<e;p++)f[p]=u[p]||"";return{safeValue:f,rawValue:u}},A=(e="")=>{let n=e,u=n.join("");return{safeValue:n,rawValue:u}},j=e=>{let x=e,{tone:n,required:u,form:f,name:p,className:D="",digits:s,numericOnly:h=!1,enableFormSubmit:C,checkValidationAtFirst:G,onChange:J,onKeyDown:Q,onValidate:X,onValidateDelay:Y,onUpdateValue:Z,onUpdateValidValue:ee,onUserAction:te,value:
|
|
1
|
+
import{b as t,c as o,d as F}from"../../chunk-C5N2D3ZX.js";import{jsx as S}from"react/jsx-runtime";import{useState as _}from"react";import V,{UUID as I}from"jmini";import{$$fromRoot as k,GenerateHTMLProps as K}from"../../@utils";import{OptionalInputWrapper as U,BoxWrapper as W,CoreEffects as w,DefaultBoxishStyles as $}from"./core";import{Flex as z}from"../../atoms";import{InputClasses as R}from"../../@styles/componentClasses";function P(e){let{value:n,states:u}=e,{required:f,numericOnly:p=!1,digits:D}=u,s=[];return f&&!n&&s.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),n&&(p&&n.match(/\D/)&&s.push({type:"invalid",label:"\u6570\u5B57\u306E\u307F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),n.length!=D&&s.push({type:"warn",label:"\u6700\u5F8C\u307E\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"})),{ok:!s.filter(({type:C})=>C=="invalid"||C=="warn").length,notice:s}}const q=(e,n="")=>{let u=String(n),f=[];for(let p=0;p<e;p++)f[p]=u[p]||"";return{safeValue:f,rawValue:u}},A=(e="")=>{let n=e,u=n.join("");return{safeValue:n,rawValue:u}},j=e=>{let x=e,{tone:n,required:u,form:f,name:p,className:D="",digits:s,numericOnly:h=!1,enableFormSubmit:C,checkValidationAtFirst:G,onChange:J,onKeyDown:Q,onValidate:X,onValidateDelay:Y,onUpdateValue:Z,onUpdateValidValue:ee,onUserAction:te,value:O="",override:ne,freeCSS:ae,wrapStyles:ie,combineInput:re,componentId:se,listStyles:E}=x,a=F(x,["tone","required","form","name","className","digits","numericOnly","enableFormSubmit","checkValidationAtFirst","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","override","freeCSS","wrapStyles","combineInput","componentId","listStyles"]),[c,d]=_(o(t({componentId:e.componentId||""},q(s,O)),{eventType:"init",eventID:I(12)}));w.CommonEffects({type:"textfield",states:e,val_status:c,set_status:d,SystemValidation:P});let b=[];for(let i=0;i<s;i++){let M=c.safeValue[i],N={},v=D;e.combineInput&&(v=[D,R("DigitCharacterCell"),R("Combined")].join(" ")),b.push(S("input",{type:"text",inputMode:h?"numeric":e.inputMode||"text",value:M,id:"Digit-"+i+"-"+c.componentId,className:v,style:t(t({},e.style),N),onKeyDown:m=>{let{key:l,code:H}=m;if(l=="Tab")return;m.preventDefault();let y=null;if(l=="Backspace"){let r=c.safeValue;r[i]="",d(g=>o(t(t({},g),A(r)),{eventType:"update",eventID:I(12),isInspected:!1})),y=i-1}else if(V.isOneOf(l,"ArrowLeft","ArrowRight")){let r=+(l=="ArrowRight")*2-1;y=i+r}else C&&w.SubmitForm(m,f),(()=>{let r=H.match(/^(Key(.)|Digit(\d)|Numpad(\d))/);if(!r)return;let g=r[2]||r[3]||r[4];if(h&&!g.match(/\d/)||!g)return;let T=c.safeValue;T[i]=g,d(L=>o(t(t({},L),A(T)),{eventType:"update",eventID:I(12),isInspected:!1})),y=i+1})();V.isExist(y)&&k("#Digit-"+y+"-"+c.componentId).focus()},onChange:()=>{},onFocus:m=>{a!=null&&a.onFocus&&(a==null||a.onFocus(m)),d(l=>o(t({},l),{eventID:I(12),isFocusing:!0}))},onBlur:m=>{a!=null&&a.onBlur&&(a==null||a.onBlur(m)),d(l=>o(t({},l),{eventID:I(12),isFocusing:!1}))}},i))}return S(W,{val_status:c,set_status:d,states:e,children:S(z,o(t({gap:"1/2",flexChilds:"even",flexWrap:!1,flexSizing:"auto"},E),{children:b}))})},B=e=>{e=t({},e),e=t({textAlign:"center",width:0},e),e.combineInput&&(e=o(t({textAlign:"center",width:0},e),{freeCSS:t({minWidth:12*2,marginRight:-1},e.freeCSS),listStyles:t({borderRadius:"2.tone.secondary",border:"unset",gap:0},e.listStyles)}));let n=K($(e));return S(U,{componentId:e.componentId,children:j,states:n})};export{B as DigitCharacters,B as default};
|
package/dist/fn/Input/Drum.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ReactElement } from '../../@declares';
|
|
3
|
-
import {
|
|
3
|
+
import { Records } from 'jmini';
|
|
4
4
|
import { InputTypes } from '.';
|
|
5
5
|
declare namespace Drum {
|
|
6
6
|
type Input<T = Value> = InputTypes.CoreInput<T> & React.DOMAttributes<HTMLInputElement> & {
|
|
@@ -11,7 +11,7 @@ declare namespace Drum {
|
|
|
11
11
|
value?: T;
|
|
12
12
|
options: (Option<T> | null)[];
|
|
13
13
|
};
|
|
14
|
-
type Value<T = any> = T extends infer V ? V : string | number | boolean |
|
|
14
|
+
type Value<T = any> = T extends infer V ? V : string | number | boolean | Records | void | null;
|
|
15
15
|
type Option<T = Value> = {
|
|
16
16
|
type?: 'selector';
|
|
17
17
|
id?: string;
|
package/dist/fn/Input/Drum.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as r,c as p,d as _}from"../../chunk-C5N2D3ZX.js";import{Fragment as Y,jsx as a,jsxs as O}from"react/jsx-runtime";import I,{UUID as S}from"jmini";import{useState as k,useEffect as z}from"react";import{$$fromRoot as M}from"../../@utils";import{Box as v,Column as U,CacheRender as $}from"../../atoms";import{Button as j}from"../Button";import{OptionalInputWrapper as q,BoxWrapper as N,CoreEffects as w,DefaultBoxishStyles as X}from"./core";function J(o){let{value:e,states:n}=o,{required:l}=n,t=[];return l&&e===null&&t.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!t.filter(({type:u})=>u=="invalid").length,notice:t}}const c={Original:o=>{let{rootStates:e,val_status:n,set_status:l}=o,R=e,{required:t,form:u,className:d,isHorizontal:s,enableFormSubmit:C,checkValidationAtFirst:W,onValidate:G,onValidateDelay:K,onUpdateValue:Q,onUpdateValidValue:Z,onUserAction:ee,value:te="",options:E,componentId:D,status_id:oe,wrapStyles:ne}=R,A=_(R,["required","form","className","isHorizontal","enableFormSubmit","checkValidationAtFirst","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","componentId","status_id","wrapStyles"]),[i,B]=k(null);return z(()=>{let f=M(`[data-component-id="${D}"]`);if(!f[0])return;B(f[0]);let h="scroll.Drum-"+D;return f.addEvent({eventType:"scrollend",eventID:h,callback:b=>{I.interval.once(()=>{let{top:y,left:g,width:m,height:L}=f.position();const x=document.elementFromPoint(g+m/2,y+L/2);if(!x||!x.id)return;let[P,re,F]=x.id.split("-");if(P!=n.componentId)return;let T=E[Number(F)];T&&l(V=>V.rawValue==T.value?p(r({},V),{eventID:S(12)}):p(r({},V),{rawValue:T.value,eventType:"update",eventID:S(12),isInspected:!1,isValidated:!1,notice:[]}))},50,"updateDrum")}}),()=>{f.removeEvent(h)}},[]),z(()=>{if(!i)return;let f=E.findIndex(m=>(m==null?void 0:m.value)==n.rawValue);if(f===-1)return;let h=I("#"+[n.componentId,"opt",f].join("-"))[0];if(!h)return;let b=i.position(),y=h.position();if(s){let m=h.offsetLeft-b.width/2+y.width/2;if(n.eventType=="update"||n.eventType=="override"){i==null||i.scroll({left:m,behavior:"smooth"});return}i.scrollLeft=m;return}let g=h.offsetTop-b.height/2+y.height/2;if(n.eventType=="update"||n.eventType=="override"){i==null||i.scroll({top:g,behavior:"smooth"});return}i.scrollTop=g},[i,n.rawValue]),O(U,p(r({gap:"1/4",tabIndex:0,position:"relative"},A),{"data-disabled":e.disabled,"data-show-validation":w.isShowValidation(n,!!W),"data-component-id":n.componentId,"data-input-origin":n.componentId,children:[a(c.Marker,p(r({},o),{val_parent:i})),a(c.EdgePadding,{}),a(c.Options,r({},o)),a(c.EdgePadding,{})]}))},Options:o=>{let{rootStates:e,val_status:n,set_status:l}=o;return a(Y,{children:e.options.map((t,u)=>{if(!t)return null;let d=I.isEqual(t==null?void 0:t.value,n.rawValue);return t.type=="label"?a(v,{children:t.label||t.value},S(12)):a($,{params:{value:t.value,isSelected:d},forceRender:(s,C)=>s.isSelected!=C.isSelected,children:a(j.Clear,{id:[n.componentId,"opt",u].join("-"),tabIndex:-1,padding:"1/2",color:"cloud",border:"0.trans",ssEffectsOnActive:!1,isActive:d,isActiveStyles:{isSemiBoldFont:!0},freeCSS:{scrollSnapAlign:"center"},onClick:()=>{d||l(s=>p(r({},s),{rawValue:t.value,eventType:"update",eventID:S(12),isInspected:!1,isValidated:!1,notice:[]}))},children:t.label||t.value})},[u,t==null?void 0:t.value].join("-"))})})},Marker:o=>{let{rootStates:e,val_parent:n,val_status:l}=o,t=!e.isHorizontal;if(!n)return null;let u=e.options.findIndex(s=>(s==null?void 0:s.value)==l.rawValue);if(u===-1)return null;let d=I("#"+[l.componentId,"opt",u].join("-"))[0];return d?a(v,p(r({flexSizing:"none",transition:"short",position:"sticky"},t?{height:0}:{width:0}),{flexCenter:!0,freeCSS:r({pointerEvents:"none",zIndex:3},t?{top:"50%",transform:"translateY(-50%)"}:{left:"50%",transform:"translateX(-50%)"}),children:a(v,{transition:"short",boxShadow:"0.remark",borderRadius:"2.tone.secondary",backgroundColor:"theme.opa.few",border:!0,borderColor:"theme",flexSizing:"none",freeCSS:{height:d.position().height||0,width:d.position().width||0}})})):null},EdgePadding:()=>a(v,{flexSizing:"none",freeCSS:{width:"50%",height:"50%",pointerEvents:"none"}}),EdgeShadow:o=>o.position=="top"||o.position=="bottom"?a(v,{position:"absolute",borderRadius:"1.tone.primary",gradients:{deg:o.position=="top"?0:180,colors:["hsla(var(--color-layer0-hsl),0)","hsla(var(--color-layer0-hsl),.8)"]},freeCSS:{zIndex:10,[o.position]:1,left:1,right:1,height:"35%",pointerEvents:"none"}}):a(v,{position:"absolute",borderRadius:"1.tone.primary",freeCSS:{zIndex:10,[o.position]:1,top:1,bottom:1,width:"35%",pointerEvents:"none"}}),Core:o=>{let[e,n]=k(w.DefaultStatus(o.componentId,o.value)),l={rootStates:o,val_status:e,set_status:n};return w.CommonEffects({type:"drum",states:o,val_status:e,set_status:n,SystemValidation:J}),O(N,{val_status:e,set_status:n,states:o,children:[a(c.EdgeShadow,{position:o.isHorizontal?"left":"top"}),a(c.Original,r({},l)),a(c.EdgeShadow,{position:o.isHorizontal?"right":"bottom"})]})}},H=o=>{var n,l;let e=r({},o);return e=r({padding:"1/2",overflow:"auto"},e),e.isHorizontal?e=p(r({flexType:"row",flexWrap:!1},e),{freeCSS:r({whiteSpace:"nowrap",scrollSnapType:"x mandatory",maxWidth:12*24},e.freeCSS)}):e=p(r({},e),{freeCSS:r({scrollSnapType:"y mandatory",maxHeight:12*20,minWidth:12*6},e.freeCSS)}),e.value=(n=e.value)!=null?n:null,(l=e.options)==null||l.forEach((t,u)=>{if(!t)return;let{type:d,value:s}=t;e.options[u]=p(r({id:S(12)},t),{value:s,type:d||"selector"})}),a(q,{componentId:e.componentId,children:c.Core,states:X(e)})};export{H as Drum,H as default};
|
package/dist/fn/Input/Filer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as r,c as f,d as G,e as H}from"../../chunk-C5N2D3ZX.js";import{Fragment as ne,jsx as a,jsxs as m}from"react/jsx-runtime";import{useState as Q,useEffect as Y}from"react";import z,{UUID as b,useStore as ee}from"jmini";import{$$fromRoot as _,ExtractStyles as se}from"../../@utils";import{Box as S,FAI as R,Flex as L,Column as te}from"../../atoms";import{Row as re}from"../../mols";import{Button as P}from"../Button";import j from"../Snackbar";import{OptionalInputWrapper as pe,BoxWrapper as ue,CoreEffects as le,DefaultBoxishStyles as me}from"./core";import ce from"./TextField";import{InputFilerClasses as y}from"../../@styles/componentClasses";import{faCloudArrowUp as de}from"@fortawesome/free-solid-svg-icons/faCloudArrowUp";function fe(e){let{value:t,states:o}=e,{required:c}=o,l=[];return c&&!t.length&&l.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!l.filter(({type:p})=>p=="invalid").length,notice:l}}const ae={List:e=>{let{rootStates:t,val_status:o,set_status:c}=e;if(t.useSystemOnly)return null;let l=t.limit-(o.rawValue||[]).length,p=(o.rawValue||[]).map((n,u)=>a(ae.ListCell,f(r({},e),{index:u,val_file:n}),n.name));return l>0&&p.push(a(S,f(r({htmlTag:"label"},t.cellStyles),{className:[t.cellClassName,y("AddButton")].join(" "),"data-component-id":o.componentId,htmlFor:t.id,tabIndex:t.tabIndex,onKeyDown:n=>{let{key:u}=n;t.tabIndex!=-1&&z.
|
|
1
|
+
import{b as r,c as f,d as G,e as H}from"../../chunk-C5N2D3ZX.js";import{Fragment as ne,jsx as a,jsxs as m}from"react/jsx-runtime";import{useState as Q,useEffect as Y}from"react";import z,{UUID as b,useStore as ee}from"jmini";import{$$fromRoot as _,ExtractStyles as se}from"../../@utils";import{Box as S,FAI as R,Flex as L,Column as te}from"../../atoms";import{Row as re}from"../../mols";import{Button as P}from"../Button";import j from"../Snackbar";import{OptionalInputWrapper as pe,BoxWrapper as ue,CoreEffects as le,DefaultBoxishStyles as me}from"./core";import ce from"./TextField";import{InputFilerClasses as y}from"../../@styles/componentClasses";import{faCloudArrowUp as de}from"@fortawesome/free-solid-svg-icons/faCloudArrowUp";function fe(e){let{value:t,states:o}=e,{required:c}=o,l=[];return c&&!t.length&&l.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!l.filter(({type:p})=>p=="invalid").length,notice:l}}const ae={List:e=>{let{rootStates:t,val_status:o,set_status:c}=e;if(t.useSystemOnly)return null;let l=t.limit-(o.rawValue||[]).length,p=(o.rawValue||[]).map((n,u)=>a(ae.ListCell,f(r({},e),{index:u,val_file:n}),n.name));return l>0&&p.push(a(S,f(r({htmlTag:"label"},t.cellStyles),{className:[t.cellClassName,y("AddButton")].join(" "),"data-component-id":o.componentId,htmlFor:t.id,tabIndex:t.tabIndex,onKeyDown:n=>{let{key:u}=n;t.tabIndex!=-1&&z.isOneOf(u," ","Enter")&&_("#"+t.id).click()},children:m(re.Center,{padding:["1/3",0],children:[a(S,{isRounded:!0,className:y("AddIcon"),children:a(R,{icon:de,className:y("Icon"),fontColor:"theme",fontSize:"4.thirdTitle",backgroundColor:"theme.opa.low",ssSphere:3,padding:"1/2"})}),m(S,{children:[m(S,{fontColor:"theme",fontSize:"2.normal",isSemiBoldFont:!0,children:["\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E(",l,")"]}),a(S,{fontColor:"4.thin",fontSize:"0.xs",isSemiBoldFont:!0,children:"\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7"})]})]})}),"AddButton")),a(te,f(r({flexSizing:"auto"},se(t)),{className:t.className,children:p}))},ListCell:e=>{let{index:t,rootStates:o,val_file:c,val_status:l,set_status:p}=e,{name:n,size:u,type:i}=c,[d,v]=Q(!1),I=b(),J=u.rank(),[K,W]=n.replace(/\s/g,"_").replace(/(.*)\.(.*)$/,"$1 $2").split(" "),s="\u30D5\u30A1\u30A4\u30EB";return i.match(/image/)?s=i.replace(/image\//,""):i.match(/pdf/)?s="PDF":i.match(/csv/)?s="CSV":i.match(/spreadsheet/)?s="SpreadSheet":i.match(/presentation/)?s="PowerPoint":i.match(/word/)?s="Word":i.match(/zip/)?s="Zip":i.match(/powerpoint/)?s="PowerPoint":i.match(/html/)?s="HTML":i.match(/js/)?s="JavaScript":i.match(/css/)?s="CSS":i.match(/text\/plain/)&&(s="\u30C6\u30AD\u30B9\u30C8"),Y(()=>{d&&setTimeout(()=>{_("#"+I).focus()},100)},[d]),m(L,f(r({verticalAlign:"center",flexWrap:!1,gap:1,className:o.cellClassName},o.cellStyles),{children:[a(R.File,{fontSize:"4.thirdTitle",fontColor:"4.thin"}),m(S,{flexSizing:0,children:[a(S,{children:a(L,{verticalAlign:"center",gap:"2/3",flexWrap:!1,className:y("FileName"),children:d?a(ne,{children:m(te,{flexSizing:0,gap:"1/2",children:[m(L,{gap:"2/3",verticalAlign:"center",children:[a(ce,{tone:"border",wrapStyles:{flexSizing:"auto"},restrict:"fileName",name:"name",required:!0,id:I,form:"form-"+I,enableFormSubmit:!0,value:K,onKeyDown:F=>{let{key:B}=F;B=="Escape"&&v(!1)}}),m(S,{children:[". ",W]})]}),m(L,{gap:"2/3",horizontalAlign:"right",flexWrap:!1,children:[a(P.Sub.S,{padding:["2/3",1],onClick:()=>{v(!1)},children:"\u9589\u3058\u308B"}),a(P.Prime.S,{padding:["2/3",1],onFormSubmit:["form-"+I,F=>H(void 0,null,function*(){let{name:B}=F.body,w=[...l.rawValue],A=w[t],X=A.id;if(!A)return;let M=yield String(yield A.convert("dataURL")).toBlob(c.type);if(!M)return;let $=new File([M],B+"."+W,{type:A.type});$.id=X,w[t]=$,p(O=>f(r({},O),{rawValue:w,eventType:"update",eventID:b(12),isInspected:!1})),v(!1)})],children:"\u6C7A\u5B9A"})]})]})}):m(ne,{children:[n,!!o.isNameEditable&&a(P.Clear,{ssSphere:2.5,flexSizing:"none",fontColor:"4.thin",padding:"1/3",ssEffectsOnActive:"expand",color:"cloud",onClick:()=>{v(!0)},children:a(R.Pen,{})})]})})}),!d&&m(S,{fontSize:"1.mini",fontColor:"4.thin",flexSizing:0,children:[s,"\u30D5\u30A1\u30A4\u30EB / ",J,"B"]})]}),a(P.Sub,{color:"cloud",fontColor:"4.thin",ssSphere:3,onClick:()=>{let F=[...l.rawValue];F[t]&&(F.splice(t,1),p(w=>f(r({},w),{rawValue:F,eventType:"update",eventID:b(12),isInspected:!1})))},children:a(R.X,{})})]}))}},ge=e=>{let Z=e,{tone:t,required:o,form:c,isNameEditable:l,useSystemOnly:p,accept:n="*",limit:u=1,checkValidationAtFirst:i,onChange:d,onValidate:v,onValidateDelay:I,onUpdateValue:J,onUpdateValidValue:K,onUserAction:W,value:s=[],className:F,cellStyles:B,cellClassName:w,componentId:A,status_id:X,enableFormSubmit:oe,freeCSS:M,wrapStyles:$}=Z,O=G(Z,["tone","required","form","isNameEditable","useSystemOnly","accept","limit","checkValidationAtFirst","onChange","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","className","cellStyles","cellClassName","componentId","status_id","enableFormSubmit","freeCSS","wrapStyles"]),[T,N]=Q(le.DefaultStatus(e.componentId||"",s)),ie={rootStates:e,val_status:T,set_status:N};Y(()=>{ee.set({["AddFiles-"+T.componentId]:x=>{N(D=>{let C=D.rawValue,V=[];for(var g=0;g<(x==null?void 0:x.length);g++){let h=x[g],{type:k,name:E}=h;if(g+1+C.length>u){j.add({componentId:E,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u9078\u629E\u4E0A\u9650\u3092\u8D85\u3048\u305F\u305F\u3081\u3001${E}}\u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002`,backgroundColor:"nega"});continue}if(n&&n=="image"&&!k.match(/image/)){j.add({componentId:E,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u7570\u306A\u308B\u305F\u3081\u3001${E} \u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002`,backgroundColor:"nega"});continue}V.push(h)}return f(r({},D),{rawValue:[...C,...V],eventType:"update",eventID:b(12),isInspected:!1})})}})},[]),le.CommonEffects({type:"file",states:e,val_status:T,set_status:N,SystemValidation:fe});let U="";return n&&(n=="image"?U="image/png,image/jpeg":U=n),m(ue,{val_status:T,set_status:N,states:e,children:[a(S,f(r({htmlTag:"input",type:"file",className:y("Input"),"data-component-id":T.componentId,accept:U,multiple:u!=1,onChange:x=>H(void 0,null,function*(){d&&d(x);let D=x.target,C=D.files,V=[];for(var g=0;g<(C==null?void 0:C.length);g++){if(!C[g])continue;let h=C[g].clone(),k=h.name;if(h.id=b(),g+1+T.rawValue.length>u){j.add({componentId:k,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u767B\u9332\u6570\u3092\u8D85\u3048\u305F\u305F\u3081\u3001${k}}\u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002`,backgroundColor:"nega"});continue}V.push(h)}N(h=>f(r({},h),{rawValue:[...h.rawValue,...V],eventType:"update",eventID:b(12),isInspected:!1})),D.value=""})},O),{opacity:"low",tabIndex:-1,value:""})),a(ae.List,r({},ie))]})},q=e=>(e=f(r({limit:1,isNameEditable:!0,useSystemOnly:!1,tone:"border",value:[]},e),{override:"force",cellStyles:r(r({},me({tone:e.tone||"border"})),e.cellStyles)}),a(pe,{componentId:e.componentId,children:ge,states:e}));q.fn={openDialog:e=>{let{multiple:t,accept:o}=e,c=b();const l=document.createElement("input");l.type="file",l.multiple=!!t,l.value="",l.id=c,o&&(o=="image"?l.accept="image/png,image/jpeg,image/jpg,image/webp":l.accept=o),z("body").append(l),l.onchange=p=>{var i;let n=((i=p==null?void 0:p.target)==null?void 0:i.files)||[];if(!(n!=null&&n.length))return;let u=[];for(let d=0;d<n.length;d++){let I=n[d].clone();u.push(I)}e.onChange(u),z("#"+c).remove()},l.click()}},typeof window!="undefined"&&window.document&&z(document).addEvent({eventType:"dragover",callback:e=>{e.preventDefault(),_("."+y("AddButton")).addClass(y("Draggable"))},options:{passive:!1}}).addEvent({eventType:"drop",callback:e=>{e.preventDefault(),_("."+y("AddButton")).removeClass(y("Draggable"));let t=e.dataTransfer.files;if(t.length){let o=e.target;if(_(o).hasClass(y("AddButton"))){let{componentId:c}=o.dataset,l=ee.get("AddFiles-"+c);l&&l(t)}}},options:{passive:!1}});export{q as Filer,q as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { Records } from 'jmini';
|
|
3
3
|
declare namespace Hidden {
|
|
4
4
|
type Input = React.DOMAttributes<HTMLInputElement> & {
|
|
5
5
|
componentId?: string;
|
|
@@ -7,7 +7,7 @@ declare namespace Hidden {
|
|
|
7
7
|
form?: string;
|
|
8
8
|
enableFormSubmit?: boolean;
|
|
9
9
|
id?: string;
|
|
10
|
-
value?: string | number |
|
|
10
|
+
value?: string | number | Records;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
declare const Hidden: (p: Hidden.Input) => import("react/jsx-runtime").JSX.Element;
|
package/dist/fn/Input/Hidden.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as o,d as
|
|
1
|
+
import{b as n,c as o,d as s}from"../../chunk-C5N2D3ZX.js";import{jsx as m}from"react/jsx-runtime";import p,{UUID as u}from"jmini";import{useState as f,useEffect as v}from"react";import{OptionalInputWrapper as y,CoreEffects as b}from"./core";const g=e=>{let i=e,{componentId:l="",enableFormSubmit:H,form:S,value:t=""}=i,c=s(i,["componentId","enableFormSubmit","form","value"]),[r,a]=f({componentId:e.componentId||"",rawValue:t,eventType:"init",eventID:u(12)});return v(()=>{p.isEqual(r.rawValue,t)||a(I=>o(n({},I),{rawValue:t,eventType:"update",eventID:u(12),isInspected:!1}))},[e.value]),b.CommonEffects({type:"hidden",states:e,val_status:r,set_status:a,SystemValidation:()=>({ok:!0,notice:[]})}),m("input",o(n({value:p.Stringify(t),"data-component-id":l},c),{type:"hidden"}))},d=e=>m(y,{componentId:e.componentId,children:g,states:e});export{d as Hidden,d as default};
|