amotify 0.2.22 → 0.2.24
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.
|
@@ -7,9 +7,9 @@ declare namespace Checker {
|
|
|
7
7
|
tabIndex?: number;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
value?: boolean;
|
|
10
|
-
cellStyles?: TagProperty.
|
|
10
|
+
cellStyles?: TagProperty.PropsNFreeCSS;
|
|
11
11
|
cellClassName?: string;
|
|
12
|
-
cellCheckedStyles?: TagProperty.
|
|
12
|
+
cellCheckedStyles?: TagProperty.PropsNFreeCSS;
|
|
13
13
|
cellCheckedClassName?: string;
|
|
14
14
|
};
|
|
15
15
|
}
|
package/dist/fn/Input/Checker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l,c as
|
|
1
|
+
import{b as l,c as a}from"../../chunk-C5N2D3ZX.js";import{jsx as c}from"react/jsx-runtime";import n from"./List";const o=e=>(e=l({},e),c(n.Plain,a(l({},e),{tone:"plain",icon:!0,type:"checker",iconType:"checkbox",value:e.value?!0:null,cellStyles:l({padding:0},e.cellStyles),options:[{value:!0,label:e.label}],onUpdateValidValue:t=>{let r=!!t.value[0];e.onUpdateValidValue&&e.onUpdateValidValue(a(l({},t),{value:r}))}})));export{o as Checker,o as default};
|
package/dist/fn/Input/List.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,c as f,d as w}from"../../chunk-C5N2D3ZX.js";import{jsx as
|
|
1
|
+
import{b as t,c as f,d as w}from"../../chunk-C5N2D3ZX.js";import{jsx as n,jsxs as ne}from"react/jsx-runtime";import{useState as ee}from"react";import h from"@mingoo/jsmin";import{$$fromRoot as se}from"../../@utils";import P from"../../atoms/Box";import oe from"../../atoms/Flex";import re from"../../atoms/FAI";import ce from"../Button";import{BoxWrapper as ue,SubmitForm as de,CommonEffects as pe,DefaultStyles as fe,Wrapper as ye}from"./core";import me from"./Hidden";import{InputListClasses as o}from"../../@styles/componentClasses";function Ce(e){let{value:a,states:r}=e,{type:m,required:u,minSelect:l=0}=r,i=[];return u&&(a.length||m=="radio"&&i.push({type:"invalid",label:"\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"})),l&&a.length<l&&i.push({type:"invalid",label:`${l}\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044`}),{ok:!i.filter(({type:c})=>c=="invalid").length,notice:i}}const Ie=e=>{let{value:a,options:r=[]}=e,m=h.is.exist(a)?h.flatArray(a):[],u=r.map(i=>{let{value:c,label:C}=i;return f(t({},i),{value:JSON.stringify(c),label:C})}),l=[];return m.forEach(i=>{let c=JSON.stringify(i);u.findIndex(N=>N.value==c)!=-1&&l.push(c)}),n(R.Core,f(t({},e),{value:l,options:u}))},R={Core:e=>{let k=e,{type:a,tone:r,required:m,componentID:u="",form:l,override:i,icon:c,iconType:C,enableFormSubmit:N,defaultActiveStyling:W,checkValidationAtFirst:j,onValidate:z,onUpdateValue:_,onUpdateValidValue:F,value:A,options:U,leftIndicator:g,rightIndicator:q,className:H,cellStyles:O,cellClassName:K,cellCheckedStyles:G,cellCheckedClassName:M,minSelect:Q,hideInput:B,styles:v,freeCSS:T,wrapStyles:L}=k,E=w(k,["type","tone","required","componentID","form","override","icon","iconType","enableFormSubmit","defaultActiveStyling","checkValidationAtFirst","onValidate","onUpdateValue","onUpdateValidValue","value","options","leftIndicator","rightIndicator","className","cellStyles","cellClassName","cellCheckedStyles","cellCheckedClassName","minSelect","hideInput","styles","freeCSS","wrapStyles"]),b={componentID:u,dataValue:A,eventType:"init",eventID:h.uuid.gen()},[I,V]=ee(b),[x,X]=ee({ok:!1,notice:[]});return pe({type:"list",states:e,val_status:I,set_status:V,val_validate:x,set_validate:X,onUpdateValue:_,onUpdateValidValue:F,DefaultValidation:Ce}),ne(ue,{val_status:I,set_status:V,val_validate:x,states:e,children:[n(me,f(t({"data-value":JSON.stringify(I.dataValue),form:l,"data-input-type":a,"data-validation":x.ok},E),{componentID:I.componentID})),n(R.List,{states:e,val_status:I,set_status:V})]})},List:e=>{let{states:a,val_status:r,set_status:m}=e,{componentID:u,type:l,tone:i,icon:c=!0,options:C,name:N,form:W,tabIndex:j,hideInput:z,disabled:_,className:F,cellStyles:A,cellClassName:U="",cellCheckedStyles:g,cellCheckedClassName:q="",enableFormSubmit:H,defaultActiveStyling:O=!0}=a,{dataValue:K}=r,G=c?n(P,{styles:{flexSizing:"none"},children:a.iconType=="radio"?n(R.RadioIcon,{}):a.iconType=="checkbox"?n(R.CheckboxIcon,{}):null}):null,M=C.map((Q,B)=>{let Z=Q,{value:v,label:T,disabled:L=_,className:E="",checkedStyles:b,checkedClassName:I="",freeCSS:V,styles:x}=Z,X=w(Z,["value","label","disabled","className","checkedStyles","checkedClassName","freeCSS","styles"]),k=h.uuid.gen(),Y=K.findIndex(d=>d===v)!=-1,S={styles:t(t({},A),x)},$=[o("Label"),o("defaultActiveStyling_"+!!O),U,E];return Y&&(S={styles:t(t(t({},S.styles),g),b),freeCSS:t(t(t({},S==null?void 0:S.freeCSS),g==null?void 0:g.freeCSS),b==null?void 0:b.freeCSS)},$=[...$,q,I]),[n("input",{type:l=="radio"?"radio":"checkbox",className:[o("Input"),o("defaultActiveStyling_"+!!O)].join(" "),name:"RadioCheckbox-"+N,"data-list-index":u+"-"+B,id:k,value:String(v),"data-form-name":W,disabled:L,checked:Y,onFocus:d=>{if(L||l!="radio"||r.dataValue.length)return;let{value:p,checked:D}=d.target,y=[p];m(s=>f(t({},s),{dataValue:y,eventType:"update",eventID:h.uuid.gen()}))},onChange:d=>{if(L)return;let{value:p,checked:D}=d.target,y=[];if(l=="radio")y=[p];else if(l=="checkbox"||l=="checker")if(D)y=[...r.dataValue,p];else{let s=[...r.dataValue];s.splice(r.dataValue.findIndex(ie=>ie==p),1),y=s}m(s=>f(t({},s),{dataValue:y,eventType:"update",eventID:h.uuid.gen()}))},onKeyDown:d=>{let{key:p,shiftKey:D}=d;if((l=="checkbox"||l=="checker")&&p!="Tab"){if(p.match(/Arrow/)){d.preventDefault();let y=["ArrowLeft","ArrowUp"].includes(p)?-1:1,s=B+y;s<0?s=C.length-1:s>=C.length&&(s=0),se(`input[data-list-index="${u}-${s}"]`).focus()}}H&&de(d)},tabIndex:j},"List-"+JSON.stringify(v)),ne(ce.Label.Plain,f(t({htmlFor:k,className:$.join(" "),tabIndex:-1},S),{styles:t({display:"flex",ssEffectsOnActive:!1,verticalAlign:"center",gap:"1/3",flexWrap:!1},S.styles),children:[G,h.is.string(T)?n(P,{children:T}):T]}),"ListTrigger-"+JSON.stringify(v))]});return n(oe,{styles:{flexSizing:"auto"},freeCSS:t({},a==null?void 0:a.freeCSS),className:[F,o("CellBase"),o("HideInput_"+z),o("IconIndicator_"+!!c),o("Tone_"+i)].join(" "),children:M})},RadioIcon:()=>n(P,{className:o("Icon"),styles:{backgroundColor:"layer.1",border:!0,transition:"middle",position:"relative",borderRadius:"sphere",flexCenter:!0}}),CheckboxIcon:()=>n(P,{className:[o("Icon"),o("CheckboxIcon")].join(" "),styles:{borderRadius:"3.tone.tertiary",backgroundColor:"layer.1",border:!0,transition:"middle",fontColor:"white",position:"relative",flexCenter:!0},children:n(re.Check,{className:o("I"),styles:{transition:"middle",opacity:"trans"},freeCSS:{zIndex:8}})})},J=e=>{e=t({},e);let a=fe.ListCell(e);return n(ye,{componentID:e.componentID,children:Ie,states:a})},te=e=>n(J,f(t({iconType:"radio",tone:e.tone},e),{type:"radio"})),ae=e=>n(J,f(t({iconType:"checkbox",tone:e.tone},e),{type:"checkbox"})),le={Plain:J,Radio:te,Checkbox:ae};export{ae as Checkbox,le as List,te as Radio,le as default};
|
package/dist/fn/Input/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c,e as x}from"../../chunk-C5N2D3ZX.js";import{jsx as S,jsxs as V}from"react/jsx-runtime";import{useState as E,useEffect as k}from"react";import i from"@mingoo/jsmin";import{$$fromRoot as
|
|
1
|
+
import{b as o,c,e as x}from"../../chunk-C5N2D3ZX.js";import{jsx as S,jsxs as V}from"react/jsx-runtime";import{useState as E,useEffect as k}from"react";import i from"@mingoo/jsmin";import{$$fromRoot as F,Config as P,useStore as v,GenerateClassName as D}from"../../@utils";import{InputClasses as B}from"../../@styles/componentClasses";import _ from"../../atoms/Box";import w from"../../atoms/Flex";import R from"../../atoms/FAI";import N from"../../mols/Row";import O from"../../mols/Column";import z from"../Button";import T from"../Tooltips";const ie=e=>{let[t]=E(e.componentID||i.uuid.gen());e=o({},e),e.states=c(o({enableFormSubmit:!0,status_id:i.uuid.gen(),override:"never",name:i.uuid.gen(),id:i.uuid.gen(),"aria-label":"Input-"+t},e.states),{componentID:t});let{children:a}=e;return S(a,o({},e.states))},se=e=>{let{children:t,val_status:a,set_status:r,val_validate:s,states:l}=e,{clearButton:n,rightIcon:u,leftIcon:f,wrapStyles:p}=l;return a.eventType=="init"&&!l.checkValidationAtFirst&&(s.notice=[]),V(N.Center,{styles:o({position:"relative",verticalAlign:"unset",gap:0},p),freeCSS:p==null?void 0:p.freeCSS,className:B("Wrapper"),"data-notice-uid":a.componentID,children:[S(L,{notice:s.notice,val_status:a}),l.leftIndicator,V(w,{styles:{position:"relative",flexSizing:"auto"},children:[f,t,n&&a.dataValue?S(z.Button.Normal.R,{styles:{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",right:1,top:"50%"},freeCSS:{zIndex:3,transform:"translateY(-50%)"},onClick:()=>{r(C=>c(o({},C),{dataValue:"",formatValue:"",eventType:"update",eventID:i.uuid.gen()}))},children:S(R.Times,{})}):u]}),l.rightIndicator]})},L=e=>{let{notice:t,val_status:a}=e,{componentID:r}=a,s="NoticeTimer-"+r,l="NoticeTimerClose-"+r,n="notice-tips-"+r;return i.interval.clear(s),i.interval.clear(l),i.interval.standBy(s,350,()=>{if(!t.length){T.close(n);return}T.open({tipsID:n,parent:`[data-notice-uid="${r}"]`,gravityPoint:22,styles:{padding:[1,0]},close_option:{parentBlur:!1},content:V(T.Comps.Body,{styles:{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative"},children:[S(_,{styles:{position:"absolute",unitHeight:1,unitWidth:1,left:1,backgroundColor:"dark"},freeCSS:{zIndex:1,transform:"rotate(45deg)",top:-6}}),S(O,{styles:{backgroundColor:"inherit",gap:"1/3",position:"relative"},freeCSS:{zIndex:2},children:t.map((u,f)=>{let{type:p,label:C}=u,I=p=="invalid"?R.Times:p=="warn"?R.Exclamation:R.Check;return V(N.Left,{styles:{gap:0,borderRadius:"2.tone.secondary"},children:[S(I,{styles:{flexCenter:!0,fontSize:"3.paragraph",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[p]}}),S(_,{styles:{fontColor:"white"},children:C})]},f+"-"+JSON.stringify(u))})})]})})}),i.interval.standBy(l,6e3,()=>{T.close(n)}),null},ue=e=>{let{type:t,states:a,val_status:r,set_status:s,ExtraOverrideStates:l,ExtraStoreStates:n,val_validate:u,set_validate:f,DefaultValidation:p,onUpdateValue:C,onUpdateValidValue:I}=e;a=o({},a);let{componentID:b}=r;k(()=>(v.update({[b]:o({ResolveRefresh:null,Refresh:()=>new Promise((d,m)=>{v.get(b).ResolveRefresh=d,s(y=>c(o({},y),{eventType:"refresh",eventID:i.uuid.gen()}))}),GenNotice:d=>{let{ok:m,notice:y}=d;f({ok:m,notice:y})}},n)}),()=>{v.delete(b)}),[]),k(()=>{a.value=r.dataValue,i.interval.clear("ValidationTimer-"+b),A({val_status:r,set_validate:f,DefaultValidation:p,states:a})},[r.eventID]),(()=>{let{override:d}=a;if(d=="never"||d=="beforeModified"&&!["init","override"].includes(r.eventType))return;let m=v.get(r.componentID);m&&(a.value!=r.dataValue&&a.status_id!=m.status_id&&s(y=>c(o(c(o({},y),{dataValue:a.value}),l),{eventType:"override",eventID:i.uuid.gen()})),m.status_id=a.status_id)})(),k(()=>{let{componentID:d,eventType:m,dataValue:y}=r,g=y;if(t=="list"?g=y.map(h=>JSON.parse(h)):t=="select"||t=="richSelect"?g=JSON.parse(y):t=="file"&&v.update({[d]:{Files:r.dataValue}}),m=="refresh"){let h=v.get(d);h&&h.ResolveRefresh&&h.ResolveRefresh(null)}m=="update"&&(C&&C({componentID:d,value:g,storeData:v.get(d),eventType:m}),i.scope(()=>{u.ok&&I&&I({componentID:d,value:g,storeData:v.get(d),eventType:m})}))},[u])},A=e=>{let{val_status:t,states:a,set_validate:r,DefaultValidation:s}=e,l=s({value:t.dataValue,states:a});if(!l.ok){r(l);return}let n=l.notice;const u=()=>x(void 0,null,function*(){if(!a.onValidate)return;let f=yield a.onValidate({value:t.dataValue,eventType:t.eventType,props:e});if(!f.ok){r({ok:!1,notice:[...n,...f.notice]});return}r({ok:!0,notice:[...n,...f.notice]})});a.onValidate?t.eventType=="refresh"?u():i.interval.standBy("ValidationTimer-"+t.componentID,450,u):r({ok:!0,notice:n})},de=e=>{let t=e.target,{form:a,formName:r}=t.dataset;a=r||a;let s=!1,l=F(`[data-form-submit-button="${a}"]`)[0];if(!l)return s;let n=l.dataset.sdfike||"",u=e.key,f=e.ctrlKey||e.metaKey;return i.scope(()=>{n.includes("enter")&&(u!="Enter"||e.nativeEvent.isComposing||P.get().browserIs=="safari"&&e.keyCode==229)||((u=="Enter"&&(n.includes("enter")||n.includes("auxEnter")&&f)||u==" "&&n.includes("space"))&&(l.click(),e.preventDefault()),s=!0)}),s},K={Input:e=>{if(e=="plain")return{};let t={padding:"3/4",transition:"middle",flexSizing:"auto",boxShadow:"0.min"};return e=="border"?t=c(o({},t),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):e=="cloud"?t=c(o({},t),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):e=="bottomBorder"&&(t=c(o({},t),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),t},ListCell:e=>{e=o({},e),e.tone||(e.tone="border");let{tone:t}=e;return t=="plain"||(e.cellStyles=o({position:"relative",padding:["3/4",1],borderRadius:"2.tone.secondary",transition:"middle"},e.cellStyles),t=="normal"?(e.styles=o({gap:"1/2"},e.styles),e.cellStyles=o({isSemiBoldFont:!0},e.cellStyles),e.cellCheckedStyles=o({backgroundColor:"cloud"},e.cellCheckedStyles)):(e.styles=o({gap:"3/4"},e.styles),e.cellStyles=o({boxShadow:"0.min"},e.cellStyles),(t=="cloud"||t=="vivid")&&(e.cellStyles=o({border:"1.thin",backgroundColor:"layer.2"},e.cellStyles)),t=="border"?(e.cellStyles=o({border:!0,backgroundColor:"layer.1"},e.cellStyles),e.cellCheckedStyles=o({borderColor:"theme",fontColor:"theme"},e.cellCheckedStyles)):t=="cloud"?e.cellCheckedStyles=o({backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"theme"},e.cellCheckedStyles):t=="vivid"&&(e.cellCheckedStyles=o({backgroundColor:"theme",fontColor:"white",borderColor:"theme"},e.cellCheckedStyles)))),D(e)},Boxish:e=>{e=o({},e),e.tone||(e.tone="border");let t=K.Input(e.tone),a=c(o({},e),{styles:o(o(o(o({fontColor:"2.normal"},t),!!e.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!e.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),e.styles),className:[B("Input"),e.className].join(" ")});return D(a)},Indicator:e=>{if(e||(e="border"),e=="plain")return{};let t={flexSizing:"none",flexCenter:!0,padding:[0,1],borderRadius:"2.tone.secondary",backgroundColor:"cloud"};return e=="border"?t=c(o({},t),{border:!0}):e=="cloud"?t=c(o({},t),{border:"1.thin"}):e=="bottomBorder"&&(t=c(o({},t),{borderRadius:0,borderBottom:!0})),t},IndicatorIcon:{position:"absolute",ssSquare:2,top:"50%",flexCenter:!0,fontColor:"theme",fontSize:"1.mini",backgroundColor:"inherit",freeCSS:{transform:"translateY(-50%)"}}};export{se as BoxWrapper,ue as CommonEffects,K as DefaultStyles,de as SubmitForm,A as ValidationCheck,ie as Wrapper};
|
package/dist/fn/Input/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare namespace InputTypes {
|
|
|
26
26
|
};
|
|
27
27
|
type CoreInput = UniInput & {
|
|
28
28
|
className?: string;
|
|
29
|
-
wrapStyles?: TagProperty.
|
|
29
|
+
wrapStyles?: TagProperty.PropsNFreeCSS;
|
|
30
30
|
} & TagProperty.States;
|
|
31
31
|
namespace Validation {
|
|
32
32
|
type EventType = 'init' | 'update' | 'override' | 'refresh';
|