amotify 0.2.7 → 0.2.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,c as o,d as
|
|
1
|
+
import{b as t,c as o,d as O}from"../../chunk-C5N2D3ZX.js";import{jsx as l}from"react/jsx-runtime";import{useState as R}from"react";import p from"@mingoo/jsmin";import W from"../../atoms/Box";import K from"../../atoms/FAI";import q from"../../mols/Column";import M from"../Button";import P from"../Tooltips";import{Wrapper as $,BoxWrapper as j,CommonEffects as z,DefaultStyles as G}from"./core";import Q from"./Parts";import{InputRichSelectClasses as X,InputClasses as Y}from"../../@styles/componentClasses";function Z(e){let{value:a,states:u}=e,{required:n,options:i}=u,s=[];return n&&(!i.length||i.length&&p.is.nullish(JSON.parse(a)))&&s.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!s.filter(({type:d})=>d=="invalid").length,notice:s}}const ee=e=>{let E=e,{tone:a,required:u,form:n,className:i,enableFormSubmit:s,enableUnSelected:d,checkValidationAtFirst:b,onChange:I,onKeyDown:V,onValidate:C,onUpdateValue:m,onUpdateValidValue:h,value:y="",options:D,placeholder:k,leftIndicator:ae,rightIndicator:le,leftIcon:ne,rightIcon:oe,componentID:ie,status_id:re,cellStyles:A,sheetStyles:f,gravityPoint:F}=E,L=O(E,["tone","required","form","className","enableFormSubmit","enableUnSelected","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","options","placeholder","leftIndicator","rightIndicator","leftIcon","rightIcon","componentID","status_id","cellStyles","sheetStyles","gravityPoint"]),w={componentID:e.componentID||"",dataValue:y,eventType:"init",eventID:p.uuid.gen()},[x]=R(p.uuid.gen()),[r,S]=R(w),[v,H]=R({ok:!1,notice:[]});z({type:"richSelect",states:e,val_status:r,set_status:S,ExtraOverrideStates:{dataValue:y,formatValue:y},val_validate:v,set_validate:H,DefaultValidation:Z,onUpdateValue:m,onUpdateValidValue:h});let T=l(W,{fontColor:"4.thin",textAlign:"left",children:k||"\u9078\u629E"});if(r.dataValue){let c=D.find(g=>g.type=="button"&&g.value==r.dataValue);c&&(T=c.selectedLabel||c.label)}return l(j,{val_status:r,set_status:S,val_validate:v,states:e,children:l("button",o(t({},L),{"data-form":n,"data-validation":v.ok,"data-component-id":r.componentID,"data-value":r.dataValue,"data-input-type":"richSelect",className:[i,X("SelectLegend"),Y("InputCover")].join(" "),onClick:c=>{P.open({tipsID:x,parent:c.currentTarget,gravityPoint:F||13,close_option:{parentBlur:!1},content:()=>{let g=D.map(J=>{let{type:U,value:B,label:_}=J;return U=="button"?l(M.Button.Clear.R,o(t({color:"cloud",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:0,onClick:()=>{S(o(t({},r),{dataValue:B,eventType:"update",eventID:p.uuid.gen()})),P.close(x)}},A),{children:_}),String(B)):_});return l(q,o(t({ssCardBox:!0,padding:[1,0],gap:0,overflow:"auto"},f),{freeCSS:t({minWidth:12*20,maxHeight:"90vh"},f==null?void 0:f.freeCSS),children:g}))}})},children:T}))})},te=e=>{let{value:a=null,placeholder:u,options:n=[]}=e,i=0,s=JSON.stringify(a),d=n.map(I=>{let{type:V,value:C}=I,m=JSON.stringify(C),h=m==s;return i|=Number(h),o(t({},I),{type:V||"button",value:m})});i||(a=null);let b=JSON.stringify(a);return l(ee,o(t({},e),{value:b,options:d}))},N=e=>{var u,n;e=t({},e),p.is.nullish(e.rightIcon)&&(e.rightIcon=l(Q.RightIcon,o(t({flexType:"col"},e.rightIconStyles),{children:l(K.AngleDown,{})}))),e.rightIcon&&(e.paddingRight=(u=e.paddingRight)!=null?u:3),e.leftIcon&&(e.paddingLeft=(n=e.paddingLeft)!=null?n:3);let a=G.Boxish(e);return delete a.rightIconStyles,l($,{componentID:e.componentID,children:te,states:a})};export{N as RichSelect,N as default};
|