amotify 0.2.214 → 0.2.215
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.
|
@@ -87,6 +87,9 @@ let Page = () => {
|
|
|
87
87
|
|
|
88
88
|
let [ val_value,set_value ] = useState( '1996' )
|
|
89
89
|
|
|
90
|
+
let [ val_checked1,set_checked1 ] = useState( false )
|
|
91
|
+
let [ val_checked2,set_checked2 ] = useState( true )
|
|
92
|
+
|
|
90
93
|
return <Plate
|
|
91
94
|
padding={ 3 }
|
|
92
95
|
size="XS"
|
|
@@ -100,7 +103,7 @@ let Page = () => {
|
|
|
100
103
|
<Literal>
|
|
101
104
|
val_value { val_value || "null" }
|
|
102
105
|
</Literal>
|
|
103
|
-
|
|
106
|
+
<Input.TextField
|
|
104
107
|
form='form_test'
|
|
105
108
|
name='testInput'
|
|
106
109
|
override='force'
|
|
@@ -118,11 +121,33 @@ let Page = () => {
|
|
|
118
121
|
)
|
|
119
122
|
set_value( value )
|
|
120
123
|
} }
|
|
121
|
-
/> */}
|
|
122
|
-
<Input.Select
|
|
123
|
-
override='force'
|
|
124
|
-
options={ [] }
|
|
125
124
|
/>
|
|
125
|
+
{/* <Column>
|
|
126
|
+
<Input.Checker
|
|
127
|
+
override='force'
|
|
128
|
+
label='checker1'
|
|
129
|
+
name='checker1'
|
|
130
|
+
// options={ [
|
|
131
|
+
// { label: 'checker1',value: true }
|
|
132
|
+
// ] }
|
|
133
|
+
value={ !!val_checked1 }
|
|
134
|
+
onUpdateValidValue={ value => {
|
|
135
|
+
set_checked1( !!value )
|
|
136
|
+
} }
|
|
137
|
+
/>
|
|
138
|
+
<Input.Checker
|
|
139
|
+
override='force'
|
|
140
|
+
label='checker2'
|
|
141
|
+
name='checker2'
|
|
142
|
+
// options={ [
|
|
143
|
+
// { label: 'checker2',value: true }
|
|
144
|
+
// ] }
|
|
145
|
+
value={ !!val_checked2 }
|
|
146
|
+
onUpdateValidValue={ value => {
|
|
147
|
+
set_checked2( !!value )
|
|
148
|
+
} }
|
|
149
|
+
/>
|
|
150
|
+
</Column> */}
|
|
126
151
|
{/* <Input.Time.DateWareki
|
|
127
152
|
form='form_test'
|
|
128
153
|
name='dateInput'
|
package/dist/fn/Input/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as u,e as _}from"../../chunk-C5N2D3ZX.js";import{jsx as
|
|
1
|
+
import{b as n,c as u,e as _}from"../../chunk-C5N2D3ZX.js";import{jsx as f,jsxs as R}from"react/jsx-runtime";import{useState as x,useEffect as S}from"react";import c,{UUID as v,useStore as g}from"jmini";import{$$fromRoot as D}from"../../@utils";import{InputClasses as b}from"../../@styles/componentClasses";import{Box as B,Flex as E,FAI as V,Column as F}from"../../atoms";import{Row as k,Literal as N}from"../../mols";import{Button as w}from"../Button";import C from"../Tooltips";const et=t=>{let[i]=x(t.componentId||v());t=n({},t),t.states=u(n({enableFormSubmit:!0,status_id:v(),override:"never",form:"",id:v(),"aria-label":"Input-"+i},t.states),{componentId:i});let{children:a}=t;return f(a,n({},t.states))},at=t=>{let{children:i,val_status:a,val_validate:e,states:s}=t,{leftIcon:r,wrapStyles:o}=s;return s.checkValidationAtFirst||a.eventType=="init"&&(e.notice=[]),R(k.Center,u(n({position:"relative",verticalAlign:"unset",gap:0},o),{className:b("Wrapper"),"data-notice-uid":a.componentId,children:[f(T.Notice,{notice:e.notice,val_status:a}),s.leftIndicator,R(E,{position:"relative",flexSizing:"auto",children:[i,r,f(T.RightIcon,n({},t)),f(T.ClearButton,n({},t))]}),s.rightIndicator]}))},T={ClearButton:t=>!t.states.clearButton||!t.val_status.dataValue?null:f(w.Normal,{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",right:1,top:"50%",freeCSS:{zIndex:3,transform:"translateY(-50%)"},onClick:()=>{t.set_status(i=>u(n({},i),{dataValue:"",formatValue:"",eventType:"update",eventID:v()}))},children:f(V.X,{})}),RightIcon:t=>t.states.clearButton&&t.val_status.dataValue?null:t.states.rightIcon,Notice:t=>{let{notice:i,val_status:a}=t,{componentId:e}=a,s="NoticeTimer-"+e,r="NoticeTimerClose-"+e,o="notice-tips-"+e;return S(()=>{c.interval.once(()=>{if(!i.length){C.close(o);return}C.open({tipsID:o,parent:`[data-notice-uid="${e}"]`,gravityPoint:24,padding:[1,0],closeAtParentBlur:!1,content:R(C.Body,{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative",children:[f(B,{position:"absolute",unitHeight:1,unitWidth:1,right:1,backgroundColor:"dark",freeCSS:{zIndex:1,transform:"rotate(45deg)",top:-6}}),f(F,{backgroundColor:"inherit",gap:"1/3",position:"relative",freeCSS:{zIndex:2},children:i.map((y,I)=>{let{type:l,label:d}=y,m=l=="invalid"?V.Exclamation:l=="warn"?V.Exclamation:V.Check;return R(k.Left,{gap:0,borderRadius:"2.tone.secondary",children:[f(m,{flexCenter:!0,fontSize:"2.normal",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[l]}),f(N.Supplement,{fontSize:"0.xs",fontColor:"white",children:d})]},I+"-"+c.Stringify(y))})})]})})},350,s),c.interval.once(()=>{C.close(o)},6e3,r)},[i]),null}},A={DefaultStatus:(t,i)=>({componentId:t,dataValue:i,eventType:"init",eventID:v()}),CommonEffects:function(t){let{type:i,states:a,val_status:e,set_status:s,val_validate:r,set_validate:o,SystemValidation:y}=t;a=n({},a);let{componentId:I}=e;S(()=>(g.update({[I]:{ResolveRefresh:null,Refresh:()=>new Promise((l,d)=>{g.get(I).ResolveRefresh=l,s(m=>u(n({},m),{isValidating:!0,eventType:"refresh",eventID:v()}))}),GenNotice:l=>{let{ok:d,notice:m}=l;o({ok:d,notice:m})}}}),()=>{g.delete(I)}),[]),c.scope(()=>{let{override:l}=a;if(l=="never"||l=="beforeModified"&&!["init","override"].includes(e.eventType)||e.isComposing)return;let d=g.get(e.componentId);if(d){if(c.is.equal(c.SortifyObject(a.value),c.SortifyObject(e.dataValue))){d.status_id=a.status_id;return}a.status_id!=d.status_id&&e.eventType!="override"&&s(m=>u(n(u(n({},m),{dataValue:a.value}),t.ExtraOverrideStates&&t.ExtraOverrideStates()),{eventType:"override",eventID:v()}))}}),S(()=>{A.ValidationCheck({val_status:e,set_status:s,set_validate:o,SystemValidation:y,states:a})},[e.eventID,e.dataValue]);{let{componentId:l,eventType:d,dataValue:m}=e,p=m;i=="autocomplete.single"||i=="list.radio"?p=p[0]:a.isChecker&&(p=!!p[0]),S(()=>(c.scope(()=>{if(a.form=a.form||"testForm",a.name&&a.form&&g.update({[["form-data",a.form].join("-")]:{[a.name]:{componentId:l,type:i,value:p,validation:r.ok}}}),e.isValidating||d!="refresh")return;let h=g.get(l);h&&h.ResolveRefresh&&h.ResolveRefresh(null)}),()=>{g.update({[["form-data",a.form].join("-")]:{[a.name]:null}})}),[e,r]),S(()=>{a.onUserAction&&a.onUserAction(p,{eventType:d,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing})},[e]),S(()=>{d=="update"&&(a.onUpdateValue&&a.onUpdateValue(p,{eventType:d,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing}),a.onUpdateValidValue&&r.ok&&a.onUpdateValidValue(p,{eventType:d,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing}))},[r.ok,e.dataValue])}},ValidationCheck:t=>{let{states:i}=t,a="ValidationTimer-"+t.val_status.componentId;c.interval.abort(a),t.set_status(o=>u(n({},o),{isValidating:!0}));let e=t.SystemValidation({value:t.val_status.dataValue,states:i});if(!e.ok){t.set_validate(e),t.set_status(o=>u(n({},o),{isValidating:!1}));return}let s=e.notice;const r=()=>_(void 0,null,function*(){if(!i.onValidate)return;let o=yield i.onValidate(t.val_status.dataValue,t.val_status.eventType,t);t.set_validate({ok:o.ok,notice:[...s,...o.notice]}),t.set_status(y=>u(n({},y),{isValidating:!1}))});if(i.onValidate){if(t.val_status.eventType=="refresh"){r();return}c.interval.once(r,i.onValidateDelay||500,a);return}t.set_validate({ok:!0,notice:s}),t.set_status(o=>u(n({},o),{isValidating:!1}))},SubmitForm:(t,i)=>{let a=!1;if(!i)return a;let e=D(`[data-form-submit-button="${i}"]`)[0];if(!e)return a;let s=e.dataset.sdfike||"",r=t.key,o=t.ctrlKey||t.metaKey;return c.scope(()=>{s.includes("enter")&&(r!="Enter"||t.nativeEvent.isComposing||(t==null?void 0:t.keyCode)==229)||((r=="Enter"&&(s.includes("enter")||s.includes("auxEnter")&&o)||r==" "&&s.includes("space"))&&(e.click(),t.preventDefault()),a=!0)}),a},isShowValidation:(t,i,a)=>{let e=t.ok;return!a&&i.eventType=="init"?!0:e}},it=function(t){t=n({tone:"border"},t);let i=c.scope(()=>{if(t.tone=="plain")return{};let e={padding:1,transition:"middle",flexSizing:"auto",boxShadow:"0.min"};return t.tone=="border"?e=u(n({},e),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):t.tone=="cloud"?e=u(n({},e),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):t.tone=="bottomBorder"&&(e=u(n({},e),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),e});return u(n(n(n(n(n(n({fontColor:"2.normal"},i),!!t.rightIcon&&{paddingRight:3}),!!t.leftIcon&&{paddingLeft:3}),!!t.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!t.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),t),{freeCSS:n({letterSpacing:"1px",resize:"none"},t.freeCSS),className:[b("Input"),t.className].join(" ")})};export{at as BoxWrapper,A as CoreEffects,it as DefaultBoxishStyles,et as OptionalInputWrapper};
|