amotify 0.3.37 → 0.3.38
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/dist/fn/Input/Drum.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as p,d as _}from"../../chunk-C5N2D3ZX.js";import{Fragment as G,jsx as r,jsxs as W}from"react/jsx-runtime";import x,{UUID as I}from"jmini";import{useState as k,useEffect as H}from"react";import{$$fromRoot as
|
|
1
|
+
import{b as a,c as p,d as _}from"../../chunk-C5N2D3ZX.js";import{Fragment as G,jsx as r,jsxs as W}from"react/jsx-runtime";import x,{UUID as I}from"jmini";import{useState as k,useEffect as H}from"react";import{$$fromRoot as F}from"../../@utils";import{Box as v,Column as j,CacheRender as q}from"../../atoms";import{Button as N}from"../Trigger";import{OptionalInputWrapper as Z,BoxWrapper as X,CoreEffects as V,DefaultBoxishStyles as J}from"./core";function Y(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 f={Original:o=>{let{rootStates:e,val_status:n,set_status:l}=o,C=e,{required:t,form:u,className:d,isHorizontal:s,enableFormSubmit:E,showInitValidation:z,onValidate:K,onValidateDelay:Q,onUpdateValue:ee,onUpdateValidValue:te,onUserAction:oe,value:ne="",options:D,componentId:R,status_id:ae,wrapStyles:re}=C,A=_(C,["required","form","className","isHorizontal","enableFormSubmit","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","componentId","status_id","wrapStyles"]),[i,B]=k(null);return H(()=>{let c=F(`[data-component-id="${R}"]`);if(!c[0])return;B(c[0]);let h="onscrollend"in window,y="scroll.Drum-"+R,g=h?50:150;return c.onEvent(h&&"scrollend"||"scroll",S=>{x.interval.once(()=>{let{top:m,left:L,width:M,height:P}=c.position();const b=document.elementFromPoint(L+M/2,m+P/2);if(!b||!b.id)return;let[U,le,$]=b.id.split("-");if(U!=n.componentId)return;let T=D[Number($)];T&&l(w=>w.rawValue==T.value?p(a({},w),{eventID:I(12)}):p(a({},w),{rawValue:T.value,eventType:"update",eventID:I(12),isInspected:!1,isValidated:!1,notice:[]}))},g,"update-drum-input-value")},{eventID:y}),()=>{c.removeEvent(y)}},[]),H(()=>{if(!i)return;let c=D.findIndex(m=>(m==null?void 0:m.value)==n.rawValue);if(c===-1)return;let h=x("#"+[n.componentId,"opt",c].join("-"))[0];if(!h)return;let y=i.position(),g=h.position();if(s){let m=h.offsetLeft-y.width/2+g.width/2;if(n.eventType=="update"||n.eventType=="override"){i==null||i.scroll({left:m,behavior:"smooth"});return}i.scrollLeft=m;return}let S=h.offsetTop-y.height/2+g.height/2;if(n.eventType=="update"||n.eventType=="override"){i==null||i.scroll({top:S,behavior:"smooth"});return}i.scrollTop=S},[i,n.rawValue]),W(j,p(a({gap:"1/4",tabIndex:0,position:"relative"},A),{"data-disabled":e.disabled,"data-show-validation":V.isShowValidation(n,!!z),"data-component-id":n.componentId,"data-input-origin":n.componentId,children:[r(f.Marker,p(a({},o),{val_parent:i})),r(f.EdgePadding,{}),r(f.Options,a({},o)),r(f.EdgePadding,{})]}))},Options:o=>{let{rootStates:e,val_status:n,set_status:l}=o;return r(G,{children:e.options.map((t,u)=>{if(!t)return null;let d=x.isEqual(t==null?void 0:t.value,n.rawValue);return t.type=="label"?r(v,{children:t.label||t.value},I(12)):r(q,{params:{value:t.value,isSelected:d},forceRender:(s,E)=>s.isSelected!=E.isSelected,children:r(N.Clear,{id:[n.componentId,"opt",u].join("-"),tabIndex:-1,padding:"1/2",color:"cloud",border:"0.trans",ssEffectsOnActive:!1,isActive:d,isActiveStyles:{fontColor:"theme"},xcss:{scrollSnapAlign:"center"},onClick:()=>{d||l(s=>p(a({},s),{rawValue:t.value,eventType:"update",eventID:I(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=x("#"+[l.componentId,"opt",u].join("-"))[0];return d?r(v,p(a({flexSizing:"none",transition:"short",position:"sticky"},t?{height:0}:{width:0}),{flexCenter:!0,ssZIndex:3,xcss:a({pointerEvents:"none"},t?{top:"50%",transform:"translateY(-50%)"}:{left:"50%",transform:"translateX(-50%)"}),children:r(v,{transition:"short",boxShadow:"0.remark",borderRadius:"2.tone.secondary",backgroundColor:"theme.opa.few",border:!0,borderColor:"theme",flexSizing:"none",xcss:{height:d.position().height||0,width:d.position().width||0}})})):null},EdgePadding:()=>r(v,{flexSizing:"none",xcss:{width:"50%",height:"50%",pointerEvents:"none"}}),EdgeShadow:o=>o.position=="top"||o.position=="bottom"?r(v,{position:"absolute",borderRadius:"1.tone.primary",ssZIndex:10,gradients:{deg:o.position=="top"?0:180,colors:["hsla(var(--color-layer0-hsl),0)","hsla(var(--color-layer0-hsl),.6)"]},xcss:{[o.position]:1,left:1,right:1,height:"35%",pointerEvents:"none"}}):r(v,{position:"absolute",borderRadius:"1.tone.primary",ssZIndex:10,xcss:{[o.position]:1,top:1,bottom:1,width:"35%",pointerEvents:"none"}}),Core:o=>{let[e,n]=k(V.DefaultStatus(o.componentId,o.value)),l={rootStates:o,val_status:e,set_status:n};return V.CommonEffects({type:"drum",states:o,val_status:e,set_status:n,SystemValidation:Y}),W(X,{val_status:e,set_status:n,states:o,children:[r(f.EdgeShadow,{position:o.isHorizontal?"left":"top"}),r(f.Original,a({},l)),r(f.EdgeShadow,{position:o.isHorizontal?"right":"bottom"})]})}},O=o=>{var n,l;let e=a({},o);return e=a({padding:"1/2",overflow:"auto"},e),e.isHorizontal?e=p(a({flexType:"row",flexWrap:!1},e),{xcss:a({whiteSpace:"nowrap",scrollSnapType:"x mandatory",maxWidth:12*24},e.xcss)}):e=p(a({},e),{xcss:a({scrollSnapType:"y mandatory",maxHeight:12*24,minWidth:12*6},e.xcss)}),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(a({id:I(12)},t),{value:s,type:d||"selector"})}),r(Z,{componentId:e.componentId,children:f.Core,states:J(e)})};export{O as Drum,O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as p,c as g}from"../../../chunk-C5N2D3ZX.js";import{Fragment as $,jsx as e,jsxs as f}from"react/jsx-runtime";import S,{UUID as O,Time as d,useStore as W}from"jmini";import{useState as D,useEffect as R}from"react";import{Box as T,Grid as J,FAI as B,Column as L,FlexMargin as P}from"../../../atoms";import{Row as C,Literal as h}from"../../../mols";import{Button as x}from"../../Trigger";import _ from"../../Sheet";import Y from"../Select";import{LeftIcon as X,RightIcon as N}from"..";import{InputTimeClasses as V}from"../../../@styles/componentClasses";import F from"../Drum";const j=t=>{let{restrict:l}=t;return l=="year"?e(y.Year,p({},t)):l=="month"?e(y.Month,p({},t)):l=="week"?"[DEV]":l=="date"?e(y.Date,p({},t)):l=="locale.jp.warekiDate"?e(y.Locale.JP.WarekiDate,p({},t)):l=="clock"?e(y.Clock,p({},t)):l=="period.clock"?e(y.Period.Clock,p({},t)):l=="period.month"?e(y.Period.Month,p({},t)):l=="period.date"?e(y.Period.Date,p({},t)):null},y={YearOptions:t=>{var u,i,n;let l=[],v=(u=t==null?void 0:t.min)!=null?u:1900,o=(i=t==null?void 0:t.max)!=null?i:d().addYear(10).year;for(let a=v;a<=o;a++){let r=[a],[m,s]=S.transformer.wareki(a).value;((n=t.showJPWareki)==null||n)&&(m&&r.push(e(h.Micro,{fontColor:"4.thin",children:m},1)),s&&r.push(f(h.Micro,{fontColor:"4.thin",children:["[",s,"]"]},2))),l[t.reverse?"unshift":"push"]({value:a,label:e(C.Center,{gap:["1/12","1/4"],verticalAlign:"baseline",flexWrap:!0,children:r})})}return l},calendartypeState:()=>{let[t,l]=D(localStorage.getItem("@env/input/time/selector/calendartype")||"calendar");return R(()=>{localStorage.setItem("@env/input/time/selector/calendartype",String(t))},[t]),[t,l]},minutesUnitState:()=>{let[t,l]=D(Number(localStorage.getItem("@env/input/time/selector/clock/minutesUnit")||10));return R(()=>{localStorage.setItem("@env/input/time/selector/clock/minutesUnit",String(t))},[t]),[t,l]},remoteControl:function(t){let{restrict:l,pickerId:v,val_value:o,set_value:u}=t;R(()=>{v&&W.set({[v]:{onClear:()=>{if(l.match(/period\./)){u(i=>g(p({},i),{eventType:"commit",forcus:0,display:d(),from:d(null),to:d(null)}));return}u(i=>g(p({},i),{eventType:"commit",from:d(null)}))},onConfirm:()=>{u(i=>g(p({},i),{eventType:"commit"}))}}})},[])},Year:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i]=String(t.defaultValue).split(/\D/);return{eventType:"init",from:d().setYear(Number(i||d().year))}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:String(o.from.year||null),era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{flexWrap:!0,children:[f(h.Paragraph,{children:[o.from.year||"----","\u5E74"]}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let i=d();u({eventType:"update",from:i})},children:"\u4ECA\u5E74"}),e(P,{})]}),e(T,{borderTop:!0}),e(F,{override:"force",value:o.from.year||null,options:y.YearOptions({min:Number(l)||void 0,max:Number(v)||void 0}),onUpdateValidValue:i=>{u(n=>({eventType:"update",from:n.from.clone().setYear(Number(i))}))}})]})},Month:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=String(t.defaultValue).split(/\D/);(S.isNullish(i)||S.isNullish(n))&&([i,n]=d().toFormat("%Y-%M").split("-"));let a=d(),r=d().setYear(Number(i)||a.year).setMonth(Number(n)||a.month).setDate(1);return{eventType:"init",from:r,display:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:o.from.toFormatYM(),era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.toFormatYM("JP")||"----/--"}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let i=d();u({eventType:"update",from:i,display:i})},children:"\u4ECA\u6708"}),e(P,{})]}),e(T,{borderTop:!0}),e(y.Parts.DrumSelector,{type:"month",min:l,max:v,value:o.from,onChange:i=>{u(g(p({},o),{eventType:"update",from:i}))}})]})},Date:t=>{let{min:l,max:v}=t,[o,u]=y.calendartypeState(),[i,n]=D(S.scope(()=>{var b;let[a,r,m]=(b=String(t.defaultValue))==null?void 0:b.split(/\D/);(S.isNullish(a)||S.isNullish(r)||S.isNullish(m))&&([a,r,m]=d().toFormat("%Y-%M-%D").split("-"));let s=d(),c=d([Number(a)||s.year,(Number(r)||s.month).zeroEmbed(2),(Number(m)||s.date).zeroEmbed(2)].join("/"));return{eventType:"init",era:"year",display:c,from:c}}));return y.remoteControl(g(p({},t),{val_value:i,set_value:n})),R(()=>{t.onValueUpdate({value:i.from.toFormatYMD(),era:"year",eventType:i.eventType})},[i]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{flexWrap:!0,gap:"1/2",children:[e(h.Paragraph,{children:i.from.toFormatYMD("JP")||"----/--/--"}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let a=d();n({eventType:"update",era:"year",from:a,display:a})},children:"\u4ECA\u65E5"}),e(P,{}),f(x.Border.S,{padding:["1/6","1/2"],fontColor:"3.blur",fontSize:"0.xs",onClick:()=>{u(a=>a=="calendar"?"drum":"calendar")},children:[o=="calendar"&&"\u30C9\u30E9\u30E0",o=="drum"&&"\u30AB\u30EC\u30F3\u30C0\u30FC","\u8868\u793A"]})]}),e(T,{borderTop:!0}),o=="calendar"&&f($,{children:[f(C.Center,{gap:"1/2",children:[e(Y,{override:"force",emptySelect:!1,value:i.display.year,options:y.YearOptions({reverse:!0}),fontSize:"1.mini",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,pickerStyles:{xcss:{minWidth:12*12}},onUpdateValidValue:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().setYear(Number(a))}))},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})})}),e(Y,{override:"force",emptySelect:!1,value:i.display.month,options:(()=>{let a=[];for(let r=1;r<=12;r++)a.push({value:r,label:String(r)+"\u6708"});return a})(),fontSize:"1.mini",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,pickerStyles:{xcss:{minWidth:12*8}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),onUpdateValidValue:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().setMonth(Number(a))}))}}),e(y.Parts.ShiftButtons,{callback:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().addMonth(a)}))}})]}),f(L,{children:[e(T,{margin:"auto",xcss:{minWidth:"50%"},UnderBreakPointStyles:{margin:0},children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>"",targetMonth:i.display,from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})}),e(T,{unitHeight:"1/4",isRounded:!0,backgroundColor:"cloud",margin:1,ssHiddenOnBreak:!0}),f(C.Center,{verticalAlign:"unset",ssHiddenOnBreak:!0,children:[e(T,{flexSizing:0,children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>e(h.Mini,{children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:a.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:"[\u524D\u6708]"})]})}),targetMonth:i.display.clone().addMonth(-1),from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})}),e(T,{unitWidth:"1/4",isRounded:!0,backgroundColor:"cloud",margin:1}),e(T,{flexSizing:0,children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>e(h.Mini,{children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:a.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:"[\u7FCC\u6708]"})]})}),targetMonth:i.display.clone().addMonth(1),from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})})]})]})]}),o=="drum"&&e(y.Parts.DrumSelector,{type:"date",min:l,max:v,value:i.from,onChange:a=>{n(g(p({},i),{eventType:"update",from:a}))}})]})},Locale:{JP:{WarekiDate:t=>{var n;let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{var M;let[a,r,m]=(M=String(t.defaultValue))==null?void 0:M.split(/\D/),s=t.era||"year";if(S.isNullish(a)||S.isNullish(r)||S.isNullish(m)){let k=d();s=="heisei"?k.setYear(1989):s=="shouwa"?k.setYear(1926):s=="taisho"?k.setYear(1912):s=="meiji"&&k.setYear(1868),[a,r,m]=k.toFormat("%Y-%M-%D").split("-")}let c=d();return{eventType:"init",from:d([Number(a)||c.year,(Number(r)||c.month).zeroEmbed(2),(Number(m)||c.date).zeroEmbed(2)].join("/"))}}));y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:o.from.toFormatYMD(),era:o.from.wareki.toLower(),eventType:o.eventType})},[o]);let i={year:{label:"\u897F\u66A6",min:"1900/01/01",max:"2100/12/31"},reiwa:{label:"\u4EE4\u548C",min:"2019/05/01",max:d().addYear(10).setMonth(12).setDate(31).toFormatYMD()},heisei:{label:"\u5E73\u6210",min:"1989/01/08",max:"2019/04/30"},showa:{label:"\u662D\u548C",min:"1926/12/25",max:"1989/01/07"},taisho:{label:"\u5927\u6B63",min:"1912/07/30",max:"1926/12/24"},meiji:{label:"\u660E\u6CBB",min:"1868/09/08",max:"1912/07/29"}};return f(L,{children:[f(C.Left,{gap:"1/4",flexWrap:!0,children:[f(h.Paragraph,{children:[o.from.warekiLabel,(n=o.from.warekiYear)==null?void 0:n.zeroEmbed(2),"\u5E74",o.from.toFormatMD("JP")]}),e(P,{})]}),e(T,{borderTop:!0}),e(C.Left,{gap:"1/2",flexWrap:!0,children:["reiwa","heisei","showa","taisho","meiji"].map((a,r)=>{let m=i[a];return m?e(x.Border.S,{onClick:()=>{let s=o.from;if(a=="reiwa"||a=="year")s=d();else{let c=d(m.min),b=d(m.max);c.value>o.from.value&&(s=c),o.from.value>b.value&&(s=b)}if(l){let c=d(l);s.value<c.value&&(s=c)}if(v){let c=d(v);c.value<s.value&&(s=c)}u(g(p({},o),{eventType:"update",from:s}))},children:m.label},r):null})}),e(y.Parts.DrumSelector,{type:"locale.jp.warekiDate",min:t.min,max:t.max,value:o.from,onChange:a=>{u(g(p({},o),{eventType:"update",from:a}))}})]})}}},Clock:t=>{let[l,v]=D(S.scope(()=>{let r=String(t.defaultValue).split(/[^\d]/);if(!r[0]){let c=d();r=[c.hours,c.minutes]}let m=Number(r[0]),s=Number(r[1]);return{eventType:"init",from:d().setHours(m).setMinutes(s)}}));y.remoteControl(g(p({},t),{val_value:l,set_value:v})),R(()=>{t.onValueUpdate({value:l.from.toFormatHM(),era:"clock",eventType:l.eventType})},[l]);let[o,u]=y.minutesUnitState(),i=d().setFromFormatHHMM(t.min||"00:00"),n=d().setFromFormatHHMM(t.max||"23:59");const a=(r,m)=>{v(s=>{let c=s.from.clone();return S.isExist(r)&&c.setHours(r),S.isExist(m)&&c.setMinutes(m),c.toFormatHM().toNumber()>n.toFormatHM().toNumber()&&(c=n.clone()),c.toFormatHM().toNumber()<i.toFormatHM().toNumber()&&(c=i.clone()),g(p({},s),{eventType:"update",from:c})})};return f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[f(C.Center,{gap:"1/2",children:[e(T,{className:V("ClockBase"),children:e(T,{className:V("ClockUiBase"),flexCenter:!0,children:f(T,{className:V("ClockUi"),backgroundColor:"theme.opa.low",isRounded:!0,position:"relative",children:[e(T,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[V("Needle"),V("hour")].join(" "),xcss:{transform:`rotate(${l.from.hours*30+l.from.minutes/2}deg)`}}),e(T,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[V("Needle"),V("minute")].join(" "),xcss:{transform:`rotate(${l.from.minutes*6}deg)`}})]})})}),f(T,{textAlign:"center",fontHeight:1.2,children:[f(h.Paragraph,{children:[l.from.hours.zeroEmbed(2)," : ",l.from.minutes.zeroEmbed(2)]}),f(h.Mini,{fontColor:"4.thin",children:[l.from.hours>=12&&"PM"||"AM",l.from.hours%12,":",l.from.minutes.zeroEmbed(2)]})]})]}),e(x.Border.XS,{borderRadius:"2.tone.secondary",fontColor:"theme",onClick:()=>{let r=d().setSeconds(0);r.minutes=Math.round(r.minutes/o)*o,a(r.hours,r.minutes)},children:"\u73FE\u6642\u523B"}),e(P,{}),e(Y,{emptySelect:!1,value:o,paddingLeft:3.5,leftIcon:e(X,{left:"2/3",children:"\u5358\u4F4D"}),pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},padding:"1/2",options:[{value:10,label:"10\u5206"},{value:5,label:"5\u5206"},{value:1,label:"1\u5206"}],tabIndex:-1,onUpdateValidValue:r=>{u(r||1)}})]}),e(T,{borderTop:!0}),f(C.Center,{gap:"1/2",children:[e(F,{xcss:{maxHeight:12*12},override:"force",options:[{value:0,label:"\u5348\u524D"},{value:12,label:"\u5348\u5F8C"}],value:l.from.hours>=12?12:0,onUpdateValidValue:r=>{let m=l.from.hours%12+r;a(m)}}),e(F,{override:"force",value:l.from.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)}}),onUpdateValidValue:r=>{a(r)}}),e(h,{isSemiBoldFont:!0,children:"\u6642"}),e(F,{override:"force",value:l.from.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(o==5&&s%5!=0||o==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)}}),onUpdateValidValue:r=>{a(void 0,r)}},o),e(h,{isSemiBoldFont:!0,children:"\u5206"})]})]})},Period:{Clock:t=>{let[l,v]=y.minutesUnitState(),[o,u]=D(S.scope(()=>{let[r,m]=S.Arrayify(t.defaultValue),s=d().setFromFormatHHMM(r||"09:00"),c=d().setFromFormatHHMM(m||"18:00");return{eventType:"init",forcus:0,display:s,from:s,to:c}}));y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(m=>g(p({},m),{eventType:"update",from:m.to,to:m.from}));return}t.onValueUpdate({value:[o.from.toFormatHM(),o.to.toFormatHM()],era:"clock",eventType:o.eventType})},[o]);let i=d().setFromFormatHHMM(t.min||"00:00"),n=d().setFromFormatHHMM(t.max||"23:59");const a=(r,m,s)=>{u(c=>{let b=c[r].clone();return S.isExist(m)&&b.setHours(m),S.isExist(s)&&b.setMinutes(s),b.toFormatHM().toNumber()>n.toFormatHM().toNumber()&&(b=n.clone()),b.toFormatHM().toNumber()<i.toFormatHM().toNumber()&&(b=i.clone()),g(p({},c),{eventType:"update",[r]:b})})};return f(L,{width:1,xcss:{minWidth:12*24},children:[f(C.Left,{flexWrap:!0,children:[f(C.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.toFormatHM()||"--:--"}),e(h.Mini,{children:"-"}),e(h.Paragraph,{children:o.to.toFormatHM()||"--:--"})]}),e(P,{}),e(Y,{emptySelect:!1,value:l,paddingLeft:3.5,leftIcon:e(X,{left:"2/3",children:"\u5358\u4F4D"}),pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},padding:"1/2",options:[{value:10,label:"10\u5206"},{value:5,label:"5\u5206"},{value:1,label:"1\u5206"}],tabIndex:-1,onUpdateValidValue:r=>{v(r||1)}})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(r,m)=>{u({eventType:"update",forcus:0,display:d(r),from:d(r),to:d(m)})}})),f(C.Center,{gap:"1/2",children:[e(F,{override:"force",value:o.from.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)+"\u6642"}}),onUpdateValidValue:r=>{a("from",r)}}),e(F,{override:"force",value:o.from.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(l==5&&s%5!=0||l==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)+"\u5206"}}),onUpdateValidValue:r=>{a("from",void 0,r)}},l+"-from"),e(h,{isSemiBoldFont:!0,children:"~"}),e(F,{override:"force",value:o.to.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)+"\u6642"}}),onUpdateValidValue:r=>{a("to",r)}}),e(F,{override:"force",value:o.to.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(l==5&&s%5!=0||l==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)+"\u5206"}}),onUpdateValidValue:r=>{a("to",void 0,r)}},l+"-to")]})]})},Date:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=S.Arrayify(t.defaultValue),a=d(i||void 0).setFirstOfDay(),r=d(n||null).setFirstOfDay();return{eventType:"init",forcus:0,display:a,from:a,to:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(n=>g(p({},n),{eventType:"update",from:n.to,to:n.from}));return}t.onValueUpdate({value:[o.from.toFormatYMD(),o.to.toFormatYMD()],era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:0}))},children:[o.from.toFormatYMD()||"----/--/--",o.forcus==0&&e(y.Parts.PeriodFocusSign,{})]}),e(h.Mini,{fontColor:"4.thin",children:"to"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:1}))},children:[o.to.toFormatYMD()||"----/--/--",o.forcus==1&&e(y.Parts.PeriodFocusSign,{})]}),e(P,{}),f(C.Right,{gap:"1/2",marginLeft:"auto",children:[e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*12}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:y.YearOptions({reverse:!0}),value:o.display.year,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setYear(Number(i))}))}}),e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*9}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:[{value:1,label:"1\u6708"},{value:2,label:"2\u6708"},{value:3,label:"3\u6708"},{value:4,label:"4\u6708"},{value:5,label:"5\u6708"},{value:6,label:"6\u6708"},{value:7,label:"7\u6708"},{value:8,label:"8\u6708"},{value:9,label:"9\u6708"},{value:10,label:"10\u6708"},{value:11,label:"11\u6708"},{value:12,label:"12\u6708"}],value:o.display.month,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setMonth(Number(i)).setDate(1)}))}}),e(y.Parts.ShiftButtons,{callback:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().addMonth(i)}))}})]})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(i,n)=>{u({eventType:"update",forcus:0,display:d(i),from:d(i),to:d(n)})}})),e(C.Left,{verticalAlign:"top",flexWrap:!0,gap:2,children:Array.from({length:4}).map((i,n)=>{let a=y.Parts.Calendar({min:l,max:v,targetMonth:o.display.clone().addMonth(n-1),from:o.from,to:o.to,onTitleRender:r=>{let m=r.diff(o.display).months;return e(h.Mini,{ssHiddenOnBreak:!0,children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:r.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:["[\u524D\u6708]","","[\u7FCC\u6708]","[\u7FCC\u3005\u6708]"][m+1]})]})})},onChange:r=>{if(o.forcus==0){u(m=>g(p({},m),{eventType:"update",forcus:1,from:r,to:d(null)}));return}u(m=>g(p({},m),{eventType:"update",to:r}))}});return e(T,{flexSizing:"auto",ssHiddenOnBreak:n!=1,children:a},n)})})]})},Month:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=S.Arrayify(t.defaultValue),a=d(i||void 0).setDate(1).setFirstOfDay(),r=d(n||null).setDate(1).setFirstOfDay();return{eventType:"init",forcus:0,display:a,from:a,to:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(n=>g(p({},n),{eventType:"update",from:n.to,to:n.from}));return}t.onValueUpdate({value:[o.from.toFormatYM(),o.to.toFormatYM()],era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:0}))},children:[o.from.toFormatYM("JP")||"----/--",o.forcus==0&&e(y.Parts.PeriodFocusSign,{})]}),e(h.Mini,{fontColor:"4.thin",children:"to"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:1}))},children:[o.to.toFormatYM("JP")||"----/--",o.forcus==1&&e(y.Parts.PeriodFocusSign,{})]}),e(P,{}),f(C.Left,{flexWrap:!0,gap:"1/2",marginLeft:"auto",children:[e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*12}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:y.YearOptions({reverse:!0}),value:o.display.year,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setYear(Number(i))}))}}),e(y.Parts.ShiftButtons,{callback:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().addYear(i)}))}})]})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(i,n)=>{u({eventType:"update",forcus:0,display:d(i),from:d(i),to:d(n)})}})),e(C.Left,{verticalAlign:"top",flexWrap:!0,gap:2,UnderBreakPointStyles:{gap:1},children:Array.from({length:4}).map((i,n)=>{let a=y.Parts.YearCalendar({min:l,max:v,targetYear:o.display.year+n-1,from:o.from.getFirstDayOfMonth(),to:o.to.getLastDayOfMonth(),onTitleRender:r=>{let m=r-o.display.year;return e(h.Mini,{children:f(C.Left,{gap:"1/2",children:[f(h,{isSemiBoldFont:!0,children:[r,"\u5E74"]}),e(h,{fontColor:"4.thin",children:["[\u524D\u5E74]","","[\u7FCC\u5E74]","[\u7FCC\u3005\u5E74]"][m+1]})]})})},onChange:r=>{if(o.forcus==0){u(m=>g(p({},m),{eventType:"update",forcus:1,from:r,to:d(null)}));return}u(m=>g(p({},m),{eventType:"update",to:r}))}});return e(T,{flexSizing:"auto",ssHiddenOnBreak:n<1||n>2,xcss:{minWidth:"35%"},children:a},n)})})]})},Preset:t=>t.periodPresets?e(C.Right,{gap:"1/2",flexWrap:!0,children:t.periodPresets.map((l,v)=>e(x.Border.S,{padding:["1/4",1],onClick:()=>{t.onPreset(l.from,l.to)},children:l.label},v))}):null},Parts:{ShiftButtons:t=>f(C.Center,{gap:"1/3",fontSize:"1.mini",children:[e(x.Sub,{className:V("LeftButton"),tabIndex:-1,right:0,position:"relative",ssSquare:2.5,onClick:()=>{t.callback(-1)},children:e(B.ChevronLeft,{})}),e(x.Sub,{className:V("RightButton"),tabIndex:-1,left:0,position:"relative",ssSquare:2.5,onClick:()=>{t.callback(1)},children:e(B.ChevronRight,{})})]}),Calendar:t=>{let{targetMonth:l,from:v,to:o,onTitleRender:u=k=>e(h.Mini,{isSemiBoldFont:!0,children:k.toFormatYM("JP")})}=t,i=d();if(!t.targetMonth.validate)return null;let n=l.clone().setDate(1),a=n.getLastDayOfMonth(),r=d(n).addMonth(-1).getLastDayOfMonth().date,m=[],s=[],c=[],b=[];for(var M=0;M<7;M++){let k=M==6,w=M==0;m.push(e(h.Micro,{textAlign:"center",fontColor:k?"googleBlue":w?"googleRed":"inherit",children:S.transformer.weekday.shortJP(M)},M))}for(var M=0;M<n.weekday;M++)s.unshift(e(h.Mini,{fontColor:"4.thin",flexCenter:!0,children:r-M},M));for(var M=1;M<=a.date;M++){let w=l.clone().setDate(M),E=v.isSameDate(w),z=!1,H=!1;o&&o.validate&&(z=w.isInRange(v,o),H=o.isSameDate(w));let G=i.isSameDate(w),U=!1;if(t.min){let I=d(t.min);I&&w.value<I.value&&(U=!0)}if(t.max){let I=d(t.max);I&&I.value<w.value&&(U=!0)}c.push(f(x.Clear.S,{isLocked:U,color:"cloud",border:"1.thin",isActive:E||H||z,isActiveStyles:E||H?{fontColor:"white",backgroundColor:"theme",borderColor:"theme",boxShadow:"0.remark"}:{backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"0.trans"},xcss:{whiteSpace:"nowrap",minWidth:12*3,minHeight:12*3},flexCenter:!0,ssEffectsOnActive:"shrink",tabIndex:-1,onClick:()=>{t.onChange(w)},children:[M,G&&e(y.Parts.CurrentSign,{})]},w.toFormatYMD()))}for(var M=1;M<7-a.weekday;M++)b.push(e(h.Mini,{flexCenter:!0,fontColor:"4.thin",children:M},M));return f(L,{gap:"1/2",children:[u(l)||"",f(J,{gridCols:7,gap:"1/6",children:[m,s,c,b]})]},l.toFormatYM())},YearCalendar:t=>{let{targetYear:l,from:v,to:o,onTitleRender:u=a=>f(h.Mini,{isSemiBoldFont:!0,children:[a,"\u5E74"]})}=t,i=d(),n=[];for(let a=1;a<=12;a++){let r=d().setYear(t.targetYear).setMonth(a).setDate(1),m=!1;if(t.min){let k=d(t.min).getLastDayOfMonth();k&&r.value<k.value&&(m=!0)}if(t.max){let k=d(t.max).getLastDayOfMonth();k&&k.value<r.value&&(m=!0)}let s=v.year==l&&v.month==r.month,c=!1,b=!1;o&&o.validate&&(c=r.isInRange(v,o),b=o.year==l&&o.month==r.month);let M=i.year==l&&i.month==r.month;n.push(f(x.Clear.S,{isLocked:m,color:"cloud",border:"1.thin",isActive:s||b||c,isActiveStyles:s||b?{fontColor:"white",backgroundColor:"theme",borderColor:"theme",boxShadow:"0.remark"}:{backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"0.trans"},fontSize:"inherit",ssEffectsOnActive:"shrink",tabIndex:-1,xcss:{whiteSpace:"nowrap",minWidth:12*3,minHeight:12*3},flexCenter:!0,onClick:()=>{t.onChange(r)},children:[f(C.Center,{gap:"1/2",children:[e(h,{children:r.month}),e(h.Mini,{opacity:"middle",children:["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month]})]}),M&&e(y.Parts.CurrentSign,{})]},l+"-"+r.month))}return f(L,{gap:"1/2",children:[u(t.targetYear),e(J,{flexWrap:!0,gridCols:4,gap:"1/6",children:n})]},t.targetYear)},DrumSelector:t=>{let{type:l,min:v,max:o,value:u}=t;const i=(r,m,s)=>{let c=t.value.clone();if(S.isExist(r)&&(c=c.setYear(r)),S.isExist(m)&&(c=c.setMonth(m)),S.isExist(s)&&(c=c.setDate(s)),v){let b=d(v);c.value<b.value&&(c=b)}if(o){let b=d(o);b.value<c.value&&(c=b)}t.onChange(c)};let n=u.getFirstDayOfMonth(),a=u.getLastDayOfMonth();return f(C.Center,{gap:"1/2",children:[e(F,{override:"force",options:y.YearOptions({}),value:u.year,onUpdateValidValue:r=>{i(Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u5E74"}),e(F,{override:"force",options:Array.from({length:12}).map((r,m)=>{let s=m+1;return{value:s,label:s}}),value:u.month,onUpdateValidValue:r=>{i(void 0,Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u6708"}),l!="month"&&f($,{children:[e(F,{override:"force",options:Array.from({length:31}).map((r,m)=>{let s=m+1,c=(n.weekday+m)%7;return s>a.date?null:{value:s,label:f(C.Right,{gap:"1/4",ssNowrapText:!0,children:[e(h,{children:s}),f(h.Micro,{fontColor:c==0?"googleRed":c==6?"googleBlue":"4.thin",children:["(",S.transformer.weekday.shortJP(c),")"]})]})}}),value:u.date,onUpdateValidValue:r=>{i(void 0,void 0,Number(r))}},[u.year,u.month].join("-")),e(h,{isSemiBoldFont:!0,children:"\u65E5"})]})]})},MinMax:t=>{let{restrict:l,min:v,max:o}=t;if(!v&&!o)return null;let u=d(v||null),i=d(o||null),n="",a="";return l=="year"?(n=u.toFormat("%Y\u5E74"),a=i.toFormat("%Y\u5E74")):l.match(/month/)?(n=u.toFormatYM(),a=i.toFormatYM()):l.match(/date/)?(n=u.toFormatYMD(),a=i.toFormatYMD()):l.match(/clock/)&&(u=d().setFromFormatHHMM(v||""),i=d().setFromFormatHHMM(o||""),n=u.toFormatHM(),a=i.toFormatHM()),f(h.Micro,{fontHeight:1.2,children:[n&&f(h,{children:["\u6700\u5C0F: ",n]}),a&&f(h,{children:["\u6700\u5927: ",a]})]})},CurrentSign:()=>e(T,{position:"absolute",bottom:"1/6",left:"50%",width:1,unitHeight:"1/6",backgroundColor:"warn",xcss:{maxWidth:12*2.5,transform:"translateX(-50%)"},isRounded:!0}),PeriodFocusSign:()=>e(T,{position:"absolute",bottom:"1/4",left:"1/2",right:"1/2",backgroundColor:"theme",unitHeight:"1/4",boxShadow:"0.remark",isRounded:!0})}},A=j;A.picker={open:t=>{let l=null,v=null,o="init",u="L";t.restrict=="year"&&(u="S"),t.restrict=="month"&&(u="S"),t.restrict=="clock"?u="XS":(t.restrict=="locale.jp.warekiDate"||t.restrict=="period.clock")&&(u="S");let i=t.sheetID||O(),n=t.pickerId||O();_.open("middleCenter",{sheetID:i,size:u,padding:[2,0],closeAtAroundClick:!0,closeAtParentBlur:!1,onClose:()=>{o!="commit"&&t.onValueUpdate({value:l,era:v,eventType:"commit"})},content:f(L,{gap:"1/2",children:[f(C.Left,{children:[e(P,{}),e(x.Sub.S,{color:"cloud",ssSphere:3,onClick:()=>{_.close(i)},children:e(B.X,{})})]}),e(_.Body,{children:f(L,{borderRadius:"inherit",children:[e(L,{padding:1,children:e(j,{sheetID:i,pickerId:n,restrict:t.restrict,min:t.min,max:t.max,era:t.era,defaultValue:t.defaultValue,onValueUpdate:a=>{t.onValueUpdate&&t.onValueUpdate(a),l=a.value,v=a.era,o=a.eventType,a.eventType=="commit"&&_.close(i)}})}),f(C.Left,{padding:1,position:"sticky",ssZIndex:10,bottom:0,gap:"1/2",borderTop:"1.thin",backgroundColor:"layer.0.opa.low",borderBottomLeftRadius:"inherit",borderBottomRightRadius:"inherit",xcss:{backdropFilter:"blur(3px)"},children:[e(x.Clear.S,{color:"cloud",tabIndex:-1,fontColor:"4.thin",borderRadius:"2.tone.secondary",flexSizing:"none",onClick:()=>{var a,r;(r=(a=W.get(n||""))==null?void 0:a.onClear)==null||r.call(a)},children:f(C.Center,{gap:"1/2",children:[e(B.X,{}),e(h.Micro,{children:"\u30EA\u30BB\u30C3\u30C8"})]})}),e(y.Parts.MinMax,{restrict:t.restrict,min:t.min,max:t.max}),e(P,{}),e(x.Prime.S,{tabIndex:-1,xcss:{minWidth:12*6},onClick:()=>{var a,r;(r=(a=W.get(n||""))==null?void 0:a.onConfirm)==null||r.call(a)},children:"\u78BA\u5B9A"})]})]})})]})})},close:t=>{_.close(t)}};export{A as TimeSelector,A as default};
|
|
1
|
+
import{b as c,c as v,d as j}from"../../../chunk-C5N2D3ZX.js";import{Fragment as A,jsx as e,jsxs as d}from"react/jsx-runtime";import T,{UUID as X,Time as f,useStore as Y}from"jmini";import{useState as D,useEffect as B}from"react";import{Box as x,Grid as J,FAI as V,Column as k,FlexMargin as L}from"../../../atoms";import{Row as S,Literal as h}from"../../../mols";import{Button as M}from"../../Trigger";import N from"../../Sheet";import _ from"../Select";import{LeftIcon as $,RightIcon as U}from"..";import{InputTimeClasses as I}from"../../../@styles/componentClasses";import R from"../Drum";const G=t=>{let{restrict:l}=t;return l=="year"?e(y.Year,c({},t)):l=="month"?e(y.Month,c({},t)):l=="week"?"[DEV]":l=="date"?e(y.Date.index,c({},t)):l=="locale.jp.warekiDate"?e(y.Date.index,c({},t)):l=="clock"?e(y.Clock,c({},t)):l=="period.clock"?e(y.Period.Clock,c({},t)):l=="period.month"?e(y.Period.Month,c({},t)):l=="period.date"?e(y.Period.Date,c({},t)):null},y={yearNumbers:{year:{label:"\u897F\u66A6",min:"1900/01/01",max:"2100/12/31"},reiwa:{label:"\u4EE4\u548C",min:"2019/05/01",max:f().addYear(10).setMonth(12).setDate(31).fmt.ymd()},heisei:{label:"\u5E73\u6210",min:"1989/01/08",max:"2019/04/30"},shouwa:{label:"\u662D\u548C",min:"1926/12/25",max:"1989/01/07"},taisho:{label:"\u5927\u6B63",min:"1912/07/30",max:"1926/12/24"},meiji:{label:"\u660E\u6CBB",min:"1868/09/08",max:"1912/07/29"}},YearOptions:t=>{var m,a,n;let l=[],p=(m=t==null?void 0:t.min)!=null?m:1900,o=(a=t==null?void 0:t.max)!=null?a:f().addYear(10).year;for(let i=p;i<=o;i++){let[r,s]=T.transformer.wareki(i).value;l[t.reverse?"unshift":"push"]({value:i,label:d(S.Left,{gap:["1/6","1/2"],ssNowrapText:!0,children:[((n=t.showWareki)!=null?n:!0)&&d(A,{children:[r&&e(h.Micro,{children:r}),s&&d(h.Micro,{children:["[",s,"]"]})]}),e(L,{}),i]})})}return l},calendartypeState:()=>{let[t,l]=D(localStorage.getItem("@env/input/time/selector/calendartype")||"calendar");return B(()=>{localStorage.setItem("@env/input/time/selector/calendartype",String(t))},[t]),[t,l]},minutesUnitState:()=>{let[t,l]=D(Number(localStorage.getItem("@env/input/time/selector/clock/minutesUnit")||10));return B(()=>{localStorage.setItem("@env/input/time/selector/clock/minutesUnit",String(t))},[t]),[t,l]},remoteControl:function(t){let{restrict:l,pickerId:p,val_value:o,set_value:m}=t;B(()=>{p&&Y.set({[p]:{onClear:()=>{if(l.match(/period\./)){m(a=>v(c({},a),{eventType:"commit",forcus:0,display:f(),from:f(null),to:f(null)}));return}m(a=>v(c({},a),{eventType:"commit",from:f(null)}))},onConfirm:()=>{m(a=>v(c({},a),{eventType:"commit"}))}}})},[])},Year:t=>{let{min:l,max:p}=t,[o,m]=D(T.scope(()=>{let[a]=String(t.defaultValue).split(/\D/);return{eventType:"init",from:f().setYear(Number(a||f().year))}}));return y.remoteControl(v(c({},t),{val_value:o,set_value:m})),B(()=>{t.onValueUpdate({value:String(o.from.year||null),era:"year",eventType:o.eventType})},[o]),d(k,{xcss:{minWidth:12*16},children:[d(S.Left,{flexWrap:!0,children:[d(h.Paragraph,{children:[o.from.year||"----","\u5E74"]}),e(M.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let a=f();m({eventType:"update",from:a})},children:"\u4ECA\u5E74"}),e(L,{})]}),e(x,{borderTop:!0}),e(R,{override:"force",value:o.from.year||null,options:y.YearOptions({min:Number(l)||void 0,max:Number(p)||void 0}),onUpdateValidValue:a=>{m(n=>({eventType:"update",from:n.from.clone().setYear(Number(a))}))}})]})},Month:t=>{let{min:l,max:p}=t,[o,m]=D(T.scope(()=>{let[a,n]=String(t.defaultValue).split(/\D/);(T.isNullish(a)||T.isNullish(n))&&([a,n]=f().fmt.custom("%Y-%M").split("-"));let i=f(),r=f().setYear(Number(a)||i.year).setMonth(Number(n)||i.month).setDate(1);return{eventType:"init",from:r,display:r}}));return y.remoteControl(v(c({},t),{val_value:o,set_value:m})),B(()=>{t.onValueUpdate({value:o.from.fmt.ym(),era:"year",eventType:o.eventType})},[o]),d(k,{xcss:{minWidth:12*16},children:[d(S.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.fmt.ym("jp")||"----/--"}),e(M.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let a=f();m({eventType:"update",from:a,display:a})},children:"\u4ECA\u6708"}),e(L,{})]}),e(x,{borderTop:!0}),e(y.Parts.DrumSelector,{type:"month",min:l,max:p,value:o.from,onChange:a=>{m(v(c({},o),{eventType:"update",from:a}))}})]})},Date:{index:t=>{let{min:l,max:p}=t,[o,m]=y.calendartypeState(),[a,n]=D(T.scope(()=>{var C;let[i,r,s]=(C=String(t.defaultValue))==null?void 0:C.split(/\D/);(T.isNullish(i)||T.isNullish(r)||T.isNullish(s))&&([i,r,s]=f().fmt.custom("%Y-%M-%D").split("-"));let u=f(),g=f([Number(i)||u.year,(Number(r)||u.month).zeroEmbed(2),(Number(s)||u.date).zeroEmbed(2)].join("/"));return{eventType:"init",era:"year",display:g,from:g}}));return y.remoteControl(v(c({},t),{val_value:a,set_value:n})),B(()=>{t.onValueUpdate({value:a.from.fmt.ymd(),era:"year",eventType:a.eventType})},[a]),d(k,{xcss:{minWidth:12*16},children:[d(S.Left,{flexWrap:!0,gap:"1/2",children:[e(h.Micro,{fontColor:"4.thin",children:"[\u9078\u629E\u4E2D]"}),e(h.Paragraph,{children:a.from.fmt.ymd("jp")||"----/--/--"}),e(M.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let i=f();n({eventType:"update",era:"year",from:i,display:i})},children:"\u4ECA\u65E5"}),e(L,{}),d(M.Clear.S,{fontSize:"0.xs",onClick:()=>{m(i=>i=="calendar"?"drum":"calendar")},children:[o=="calendar"&&"\u30C9\u30E9\u30E0",o=="drum"&&"\u30AB\u30EC\u30F3\u30C0\u30FC","\u8868\u793A"]})]}),e(x,{borderTop:!0}),o=="calendar"&&d(A,{children:[d(S.Left,{flexWrap:!0,gap:"1/2",UnderBreakPointStyles:{flexType:"col"},children:[e(y.Date.warekiSelector,v(c({},t),{min:l,max:p,val_value:a,set_value:n})),e(L,{}),e(_,{override:"force",emptySelect:!1,value:a.display.year,options:y.YearOptions({}),fontSize:"1.mini",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,pickerPosition:4,pickerStyles:{xcss:{minWidth:12*16}},onUpdateValidValue:i=>{n(r=>v(c({},r),{eventType:"update",display:r.display.clone().setYear(Number(i))}))},rightIcon:e(U,{right:"2/3",children:e(V.AngleDown,{})})}),e(y.Parts.ShiftButtons,{onShiftClicked:i=>{n(r=>v(c({},r),{eventType:"update",display:r.display.clone().addYear(i)}))}})]}),d(k,{children:[e(x,{margin:"auto",xcss:{minWidth:"50%"},UnderBreakPointStyles:{margin:0},children:y.Parts.Calendar({min:l,max:p,onTitleRender:i=>e(h.Mini,{children:e(y.Parts.ShiftButtons,{onShiftClicked:r=>{n(s=>v(c({},s),{eventType:"update",display:s.display.clone().addMonth(r)}))},children:e(_,{override:"force",emptySelect:!1,value:a.display.month,options:(()=>{let r=[];for(let s=1;s<=12;s++)r.push({value:s,label:[a.display.year,"\u5E74",s.zeroEmbed(2),"\u6708"].join("")});return r})(),fontSize:"1.mini",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},rightIcon:e(U,{right:"2/3",children:e(V.AngleDown,{})}),onUpdateValidValue:r=>{n(s=>v(c({},s),{eventType:"update",display:s.display.clone().setMonth(Number(r))}))}})})}),targetMonth:a.display,from:a.from,onChange:i=>{n(r=>v(c({},r),{eventType:"update",from:i}))}})}),e(x,{unitHeight:"1/4",isRounded:!0,backgroundColor:"cloud",margin:1,ssHiddenOnBreak:!0}),d(S.Center,{verticalAlign:"unset",ssHiddenOnBreak:!0,children:[e(x,{flexSizing:0,children:y.Parts.Calendar({min:l,max:p,onTitleRender:i=>e(h.Mini,{children:d(S.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:i.fmt.ym("jp")}),e(h,{fontColor:"4.thin",children:"[\u524D\u6708]"})]})}),targetMonth:a.display.clone().addMonth(-1),from:a.from,onChange:i=>{n(r=>v(c({},r),{eventType:"update",from:i}))}})}),e(x,{unitWidth:"1/4",isRounded:!0,backgroundColor:"cloud"}),e(x,{flexSizing:0,children:y.Parts.Calendar({min:l,max:p,onTitleRender:i=>e(h.Mini,{children:d(S.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:i.fmt.ym("jp")}),e(h,{fontColor:"4.thin",children:"[\u6B21\u6708]"})]})}),targetMonth:a.display.clone().addMonth(1),from:a.from,onChange:i=>{n(r=>v(c({},r),{eventType:"update",from:i}))}})})]})]})]}),o=="drum"&&d(A,{children:[e(y.Date.warekiSelector,v(c({},t),{min:l,max:p,val_value:a,set_value:n})),e(y.Parts.DrumSelector,{type:"date",min:l,max:p,value:a.from,onChange:i=>{n(v(c({},a),{eventType:"update",display:i,from:i}))}})]})]})},warekiSelector:t=>{let{min:l,max:p,val_value:o,set_value:m}=t;return e(S.Center,{gap:"1/3",flexWrap:!0,children:["meiji","taisho","shouwa","heisei","reiwa"].map((a,n)=>{let i=y.yearNumbers[a];return i?e(M.Border.XS,{borderColor:"1.thin",borderRadius:"2.tone.secondary",onClick:()=>{let r=o.from,s=r.clone();if(a=="reiwa"||a=="year")s=f();else{let u=f(i.min),g=f(i.max);u.value>r.value&&(s=u),r.value>g.value&&(s=g)}if(l){let u=f(l);s.value<u.value&&(s=u)}if(p){let u=f(p);u.value<s.value&&(s=u)}m(u=>v(c({},u),{eventType:"update",display:s,from:s}))},children:i.label},n):null})})}},Clock:t=>{let[l,p]=D(T.scope(()=>{let r=String(t.defaultValue).split(/[^\d]/);if(!r[0]){let g=f();r=[g.hours,g.minutes]}let s=Number(r[0]),u=Number(r[1]);return{eventType:"init",from:f().setHours(s).setMinutes(u)}}));y.remoteControl(v(c({},t),{val_value:l,set_value:p})),B(()=>{t.onValueUpdate({value:l.from.fmt.hi(),era:"clock",eventType:l.eventType})},[l]);let[o,m]=y.minutesUnitState(),a=f().setFromFormatHHMM(t.min||"00:00"),n=f().setFromFormatHHMM(t.max||"23:59");const i=(r,s)=>{p(u=>{let g=u.from.clone();return T.isExist(r)&&g.setHours(r),T.isExist(s)&&g.setMinutes(s),g.fmt.hi().toNumber()>n.fmt.hi().toNumber()&&(g=n.clone()),g.fmt.hi().toNumber()<a.fmt.hi().toNumber()&&(g=a.clone()),v(c({},u),{eventType:"update",from:g})})};return d(k,{xcss:{minWidth:12*16},children:[d(S.Left,{gap:"1/2",flexWrap:!0,children:[d(S.Center,{gap:"1/2",children:[e(x,{className:I("ClockBase"),children:e(x,{className:I("ClockUiBase"),flexCenter:!0,children:d(x,{className:I("ClockUi"),backgroundColor:"theme.opa.low",isRounded:!0,position:"relative",children:[e(x,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[I("Needle"),I("hour")].join(" "),xcss:{transform:`rotate(${l.from.hours*30+l.from.minutes/2}deg)`}}),e(x,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[I("Needle"),I("minute")].join(" "),xcss:{transform:`rotate(${l.from.minutes*6}deg)`}})]})})}),d(x,{textAlign:"center",fontHeight:1.2,children:[d(h.Paragraph,{children:[l.from.hours.zeroEmbed(2)," : ",l.from.minutes.zeroEmbed(2)]}),d(h.Mini,{fontColor:"4.thin",children:[l.from.hours>=12&&"PM"||"AM",l.from.hours%12,":",l.from.minutes.zeroEmbed(2)]})]})]}),e(M.Border.XS,{borderRadius:"2.tone.secondary",fontColor:"theme",onClick:()=>{let r=f().setSeconds(0);r.minutes=Math.round(r.minutes/o)*o,i(r.hours,r.minutes)},children:"\u73FE\u6642\u523B"}),e(L,{}),e(_,{emptySelect:!1,value:o,paddingLeft:3.5,leftIcon:e($,{left:"2/3",children:"\u5358\u4F4D"}),pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},padding:"1/2",options:[{value:10,label:"10\u5206"},{value:5,label:"5\u5206"},{value:1,label:"1\u5206"}],tabIndex:-1,onUpdateValidValue:r=>{m(r||1)}})]}),e(x,{borderTop:!0}),d(S.Center,{gap:"1/2",children:[e(R,{xcss:{maxHeight:12*12},override:"force",options:[{value:0,label:"\u5348\u524D"},{value:12,label:"\u5348\u5F8C"}],value:l.from.hours>=12?12:0,onUpdateValidValue:r=>{let s=l.from.hours%12+r;i(s)}}),e(R,{override:"force",value:l.from.hours,options:Array.from({length:24}).map((r,s)=>{let u=s;return a.hours>u||n.hours<u?null:{value:u,label:u.zeroEmbed(2)}}),onUpdateValidValue:r=>{i(r)}}),e(h,{isSemiBoldFont:!0,children:"\u6642"}),e(R,{override:"force",value:l.from.minutes,options:Array.from({length:60}).map((r,s)=>{let u=s;return u!=59&&(o==5&&u%5!=0||o==10&&u%10!=0)?null:{value:u,label:u.zeroEmbed(2)}}),onUpdateValidValue:r=>{i(void 0,r)}},o),e(h,{isSemiBoldFont:!0,children:"\u5206"})]})]})},Period:{Clock:t=>{let[l,p]=y.minutesUnitState(),[o,m]=D(T.scope(()=>{let[r,s]=T.Arrayify(t.defaultValue),u=f().setFromFormatHHMM(r||"09:00"),g=f().setFromFormatHHMM(s||"18:00");return{eventType:"init",forcus:0,display:u,from:u,to:g}}));y.remoteControl(v(c({},t),{val_value:o,set_value:m})),B(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){m(s=>v(c({},s),{eventType:"update",from:s.to,to:s.from}));return}t.onValueUpdate({value:[o.from.fmt.hi(),o.to.fmt.hi()],era:"clock",eventType:o.eventType})},[o]);let a=f().setFromFormatHHMM(t.min||"00:00"),n=f().setFromFormatHHMM(t.max||"23:59");const i=(r,s,u)=>{m(g=>{let C=g[r].clone();return T.isExist(s)&&C.setHours(s),T.isExist(u)&&C.setMinutes(u),C.fmt.hi().toNumber()>n.fmt.hi().toNumber()&&(C=n.clone()),C.fmt.hi().toNumber()<a.fmt.hi().toNumber()&&(C=a.clone()),v(c({},g),{eventType:"update",[r]:C})})};return d(k,{width:1,xcss:{minWidth:12*24},children:[d(S.Left,{flexWrap:!0,children:[d(S.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.fmt.hi()||"--:--"}),e(h.Mini,{children:"-"}),e(h.Paragraph,{children:o.to.fmt.hi()||"--:--"})]}),e(L,{}),e(_,{emptySelect:!1,value:l,paddingLeft:3.5,leftIcon:e($,{left:"2/3",children:"\u5358\u4F4D"}),pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},padding:"1/2",options:[{value:10,label:"10\u5206"},{value:5,label:"5\u5206"},{value:1,label:"1\u5206"}],tabIndex:-1,onUpdateValidValue:r=>{p(r||1)}})]}),e(x,{borderBottom:"1.thin"}),e(y.Period.Preset,v(c({},t),{onPreset:(r,s)=>{m({eventType:"update",forcus:0,display:f(r),from:f(r),to:f(s)})}})),d(S.Center,{gap:"1/2",children:[e(R,{override:"force",value:o.from.hours,options:Array.from({length:24}).map((r,s)=>{let u=s;return a.hours>u||n.hours<u?null:{value:u,label:u.zeroEmbed(2)+"\u6642"}}),onUpdateValidValue:r=>{i("from",r)}}),e(R,{override:"force",value:o.from.minutes,options:Array.from({length:60}).map((r,s)=>{let u=s;return u!=59&&(l==5&&u%5!=0||l==10&&u%10!=0)?null:{value:u,label:u.zeroEmbed(2)+"\u5206"}}),onUpdateValidValue:r=>{i("from",void 0,r)}},l+"-from"),e(h,{isSemiBoldFont:!0,children:"~"}),e(R,{override:"force",value:o.to.hours,options:Array.from({length:24}).map((r,s)=>{let u=s;return a.hours>u||n.hours<u?null:{value:u,label:u.zeroEmbed(2)+"\u6642"}}),onUpdateValidValue:r=>{i("to",r)}}),e(R,{override:"force",value:o.to.minutes,options:Array.from({length:60}).map((r,s)=>{let u=s;return u!=59&&(l==5&&u%5!=0||l==10&&u%10!=0)?null:{value:u,label:u.zeroEmbed(2)+"\u5206"}}),onUpdateValidValue:r=>{i("to",void 0,r)}},l+"-to")]})]})},Date:t=>{let{min:l,max:p}=t,[o,m]=D(T.scope(()=>{let[a,n]=T.Arrayify(t.defaultValue),i=f(a||void 0).setFirstOfDay(),r=f(n||null).setFirstOfDay();return{eventType:"init",forcus:0,display:i,from:i,to:r}}));return y.remoteControl(v(c({},t),{val_value:o,set_value:m})),B(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){m(n=>v(c({},n),{eventType:"update",from:n.to,to:n.from}));return}t.onValueUpdate({value:[o.from.fmt.ymd(),o.to.fmt.ymd()],era:"year",eventType:o.eventType})},[o]),d(k,{xcss:{minWidth:12*16},children:[d(S.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),d(M.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{m(a=>v(c({},a),{forcus:0}))},children:[o.from.fmt.ymd()||"----/--/--",o.forcus==0&&e(y.Parts.PeriodFocusSign,{})]}),e(h.Mini,{fontColor:"4.thin",children:"to"}),d(M.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{m(a=>v(c({},a),{forcus:1}))},children:[o.to.fmt.ymd()||"----/--/--",o.forcus==1&&e(y.Parts.PeriodFocusSign,{})]}),e(L,{}),d(S.Right,{gap:"1/2",marginLeft:"auto",children:[e(_,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*16}},rightIcon:e(U,{right:"2/3",children:e(V.AngleDown,{})}),options:y.YearOptions({reverse:!0}),value:o.display.year,onUpdateValidValue:a=>{m(n=>v(c({},n),{eventType:"update",display:n.display.clone().setYear(Number(a))}))}}),e(_,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*9}},rightIcon:e(U,{right:"2/3",children:e(V.AngleDown,{})}),options:[{value:1,label:"1\u6708"},{value:2,label:"2\u6708"},{value:3,label:"3\u6708"},{value:4,label:"4\u6708"},{value:5,label:"5\u6708"},{value:6,label:"6\u6708"},{value:7,label:"7\u6708"},{value:8,label:"8\u6708"},{value:9,label:"9\u6708"},{value:10,label:"10\u6708"},{value:11,label:"11\u6708"},{value:12,label:"12\u6708"}],value:o.display.month,onUpdateValidValue:a=>{m(n=>v(c({},n),{eventType:"update",display:n.display.clone().setMonth(Number(a)).setDate(1)}))}}),e(y.Parts.ShiftButtons,{onShiftClicked:a=>{m(n=>v(c({},n),{eventType:"update",display:n.display.clone().addMonth(a)}))}})]})]}),e(x,{borderBottom:"1.thin"}),e(y.Period.Preset,v(c({},t),{onPreset:(a,n)=>{m({eventType:"update",forcus:0,display:f(a),from:f(a),to:f(n)})}})),e(S.Left,{verticalAlign:"top",flexWrap:!0,gap:2,children:Array.from({length:4}).map((a,n)=>{let i=y.Parts.Calendar({min:l,max:p,targetMonth:o.display.clone().addMonth(n-1),from:o.from,to:o.to,onTitleRender:r=>{let s=r.diff(o.display).months;return e(h.Mini,{ssHiddenOnBreak:!0,children:d(S.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:r.fmt.ym("jp")}),e(h,{fontColor:"4.thin",children:["[\u524D\u6708]","","[\u7FCC\u6708]","[\u7FCC\u3005\u6708]"][s+1]})]})})},onChange:r=>{if(o.forcus==0){m(s=>v(c({},s),{eventType:"update",forcus:1,from:r,to:f(null)}));return}m(s=>v(c({},s),{eventType:"update",to:r}))}});return e(x,{flexSizing:"auto",ssHiddenOnBreak:n!=1,children:i},n)})})]})},Month:t=>{let{min:l,max:p}=t,[o,m]=D(T.scope(()=>{let[a,n]=T.Arrayify(t.defaultValue),i=f(a||void 0).setDate(1).setFirstOfDay(),r=f(n||null).setDate(1).setFirstOfDay();return{eventType:"init",forcus:0,display:i,from:i,to:r}}));return y.remoteControl(v(c({},t),{val_value:o,set_value:m})),B(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){m(n=>v(c({},n),{eventType:"update",from:n.to,to:n.from}));return}t.onValueUpdate({value:[o.from.fmt.ym(),o.to.fmt.ym()],era:"year",eventType:o.eventType})},[o]),d(k,{xcss:{minWidth:12*16},children:[d(S.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),d(M.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{m(a=>v(c({},a),{forcus:0}))},children:[o.from.fmt.ym("jp")||"----/--",o.forcus==0&&e(y.Parts.PeriodFocusSign,{})]}),e(h.Mini,{fontColor:"4.thin",children:"to"}),d(M.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{m(a=>v(c({},a),{forcus:1}))},children:[o.to.fmt.ym("jp")||"----/--",o.forcus==1&&e(y.Parts.PeriodFocusSign,{})]}),e(L,{}),d(S.Left,{flexWrap:!0,gap:"1/2",marginLeft:"auto",children:[e(_,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*16}},rightIcon:e(U,{right:"2/3",children:e(V.AngleDown,{})}),options:y.YearOptions({reverse:!0}),value:o.display.year,onUpdateValidValue:a=>{m(n=>v(c({},n),{eventType:"update",display:n.display.clone().setYear(Number(a))}))}}),e(y.Parts.ShiftButtons,{onShiftClicked:a=>{m(n=>v(c({},n),{eventType:"update",display:n.display.clone().addYear(a)}))}})]})]}),e(x,{borderBottom:"1.thin"}),e(y.Period.Preset,v(c({},t),{onPreset:(a,n)=>{m({eventType:"update",forcus:0,display:f(a),from:f(a),to:f(n)})}})),e(S.Left,{verticalAlign:"top",flexWrap:!0,gap:2,UnderBreakPointStyles:{gap:1},children:Array.from({length:4}).map((a,n)=>{let i=y.Parts.YearCalendar({min:l,max:p,targetYear:o.display.year+n-1,from:o.from.getFirstDayOfMonth(),to:o.to.getLastDayOfMonth(),onTitleRender:r=>{let s=r-o.display.year;return e(h.Mini,{children:d(S.Left,{gap:"1/2",children:[d(h,{isSemiBoldFont:!0,children:[r,"\u5E74"]}),e(h,{fontColor:"4.thin",children:["[\u524D\u5E74]","","[\u7FCC\u5E74]","[\u7FCC\u3005\u5E74]"][s+1]})]})})},onChange:r=>{if(o.forcus==0){m(s=>v(c({},s),{eventType:"update",forcus:1,from:r,to:f(null)}));return}m(s=>v(c({},s),{eventType:"update",to:r}))}});return e(x,{flexSizing:"auto",ssHiddenOnBreak:n<1||n>2,xcss:{minWidth:"35%"},children:i},n)})})]})},Preset:t=>t.periodPresets?e(S.Right,{gap:"1/2",flexWrap:!0,children:t.periodPresets.map((l,p)=>e(M.Border.S,{padding:["1/4",1],onClick:()=>{t.onPreset(l.from,l.to)},children:l.label},p))}):null},Parts:{ShiftButtons:t=>{let m=t,{onShiftClicked:l,children:p}=m,o=j(m,["onShiftClicked","children"]);return d(S.Center,v(c({gap:"1/3",fontSize:"1.mini"},o),{children:[e(M.Sub.S,{className:I("LeftButton"),tabIndex:-1,right:0,position:"relative",ssSquare:2.5,onClick:()=>{l(-1)},children:e(V.ChevronLeft,{})}),p,e(M.Sub.S,{className:I("RightButton"),tabIndex:-1,left:0,position:"relative",ssSquare:2.5,onClick:()=>{l(1)},children:e(V.ChevronRight,{})})]}))},Calendar:t=>{let{targetMonth:l,from:p,to:o,onTitleRender:m=P=>e(h.Mini,{isSemiBoldFont:!0,children:P.fmt.ym("jp")})}=t,a=f();if(!t.targetMonth.validate)return null;let n=l.clone().setDate(1),i=n.getLastDayOfMonth(),r=f(n).addMonth(-1).getLastDayOfMonth().date,s=[],u=[],g=[],C=[];for(var b=0;b<7;b++){let P=b==6,w=b==0;s.push(e(h.Micro,{textAlign:"center",fontColor:P?"googleBlue":w?"googleRed":"inherit",children:T.transformer.weekday.shortJP(b)},b))}for(var b=0;b<n.weekday;b++)u.unshift(e(h.Mini,{fontColor:"4.thin",flexCenter:!0,children:r-b},b));for(var b=1;b<=i.date;b++){let w=l.clone().setDate(b),O=p.isSameDate(w),z=!1,W=!1;o&&o.validate&&(z=w.isInRange(p,o),W=o.isSameDate(w));let q=a.isSameDate(w),H=!1;if(t.min){let F=f(t.min);F&&w.value<F.value&&(H=!0)}if(t.max){let F=f(t.max);F&&F.value<w.value&&(H=!0)}g.push(d(M.Clear.S,{isLocked:H,color:"cloud",border:"1.thin",isActive:O||W||z,isActiveStyles:O||W?{fontColor:"white",backgroundColor:"theme",borderColor:"theme",boxShadow:"0.remark"}:{backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"0.trans"},xcss:{whiteSpace:"nowrap",minWidth:12*3,minHeight:12*3},flexCenter:!0,ssEffectsOnActive:"shrink",tabIndex:-1,onClick:()=>{t.onChange(w)},children:[b,q&&e(y.Parts.CurrentSign,{})]},w.fmt.ymd()))}for(var b=1;b<7-i.weekday;b++)C.push(e(h.Mini,{flexCenter:!0,fontColor:"4.thin",children:b},b));return d(k,{gap:"1/2",children:[m(l)||"",d(J,{gridCols:7,gap:"1/6",children:[s,u,g,C]})]},l.fmt.ym())},YearCalendar:t=>{let{targetYear:l,from:p,to:o,onTitleRender:m=i=>d(h.Mini,{isSemiBoldFont:!0,children:[i,"\u5E74"]})}=t,a=f(),n=[];for(let i=1;i<=12;i++){let r=f().setYear(t.targetYear).setMonth(i).setDate(1),s=!1;if(t.min){let P=f(t.min).getLastDayOfMonth();P&&r.value<P.value&&(s=!0)}if(t.max){let P=f(t.max).getLastDayOfMonth();P&&P.value<r.value&&(s=!0)}let u=p.year==l&&p.month==r.month,g=!1,C=!1;o&&o.validate&&(g=r.isInRange(p,o),C=o.year==l&&o.month==r.month);let b=a.year==l&&a.month==r.month;n.push(d(M.Clear.S,{isLocked:s,color:"cloud",border:"1.thin",isActive:u||C||g,isActiveStyles:u||C?{fontColor:"white",backgroundColor:"theme",borderColor:"theme",boxShadow:"0.remark"}:{backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"0.trans"},fontSize:"inherit",ssEffectsOnActive:"shrink",tabIndex:-1,xcss:{whiteSpace:"nowrap",minWidth:12*3,minHeight:12*3},flexCenter:!0,onClick:()=>{t.onChange(r)},children:[d(S.Center,{gap:"1/2",children:[e(h,{children:r.month}),e(h.Mini,{opacity:"middle",children:["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month]})]}),b&&e(y.Parts.CurrentSign,{})]},l+"-"+r.month))}return d(k,{gap:"1/2",children:[m(t.targetYear),e(J,{flexWrap:!0,gridCols:4,gap:"1/6",children:n})]},t.targetYear)},DrumSelector:t=>{let{type:l,min:p,max:o,value:m}=t;const a=(r,s,u)=>{let g=f([r!=null?r:t.value.year,s!=null?s:t.value.month,u!=null?u:t.value.date].join("/"));if(p){let C=f(p);g.value<C.value&&(g=C)}if(o){let C=f(o);C.value<g.value&&(g=C)}t.onChange(g)};let n=m.getFirstDayOfMonth(),i=m.getLastDayOfMonth();return d(k,{gap:"1/2",children:[d(S.Center,{gap:"1/2",children:[e(R,{override:"force",options:y.YearOptions({}),value:m.year,onUpdateValidValue:r=>{a(Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u5E74"}),e(R,{override:"force",options:Array.from({length:12}).map((r,s)=>{let u=s+1;return{value:u,label:u}}),value:m.month,onUpdateValidValue:r=>{a(void 0,Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u6708"}),l!="month"&&d(A,{children:[e(R,{override:"force",options:Array.from({length:31}).map((r,s)=>{let u=s+1,g=(n.weekday+s)%7;return u>i.date?null:{value:u,label:d(S.Right,{gap:"1/4",ssNowrapText:!0,children:[e(h,{children:u}),d(h.Micro,{fontColor:g==0?"googleRed":g==6?"googleBlue":"4.thin",children:["(",T.transformer.weekday.shortJP(g),")"]})]})}}),value:m.date,onUpdateValidValue:r=>{a(void 0,void 0,Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u65E5"})]})]}),e(h.Micro,{textAlign:"center",fontColor:"4.thin",children:String(t.value.value)})]})},MinMax:t=>{let{restrict:l,min:p,max:o}=t;if(!p&&!o)return null;let m=f(p||null),a=f(o||null),n="",i="";return l=="year"?(n=m.fmt.custom("%Y\u5E74"),i=a.fmt.custom("%Y\u5E74")):l.match(/month/)?(n=m.fmt.ym(),i=a.fmt.ym()):l.match(/date/)?(n=m.fmt.ymd(),i=a.fmt.ymd()):l.match(/clock/)&&(m=f().setFromFormatHHMM(p||""),a=f().setFromFormatHHMM(o||""),n=m.fmt.hi(),i=a.fmt.hi()),d(h.Micro,{fontHeight:1.2,children:[n&&d(h,{children:["\u6700\u5C0F: ",n]}),i&&d(h,{children:["\u6700\u5927: ",i]})]})},CurrentSign:()=>e(x,{position:"absolute",bottom:"1/6",left:"50%",width:1,unitHeight:"1/6",backgroundColor:"warn",xcss:{maxWidth:12*2.5,transform:"translateX(-50%)"},isRounded:!0}),PeriodFocusSign:()=>e(x,{position:"absolute",bottom:"1/4",left:"1/2",right:"1/2",backgroundColor:"theme",unitHeight:"1/4",boxShadow:"0.remark",isRounded:!0})}},E=G;E.picker={open:t=>{let l=null,p=null,o="init",m="L";t.restrict=="year"?m="XS":t.restrict=="month"?m="S":t.restrict=="clock"?m="XS":t.restrict=="period.clock"&&(m="S");let a=t.sheetID||X(),n=t.pickerId||X();N.open("topCenter",{sheetID:a,size:m,padding:[2,0],closeAtAroundClick:!0,closeAtParentBlur:!1,onClose:()=>{o!="commit"&&t.onValueUpdate({value:l,era:p,eventType:"commit"})},content:d(k,{gap:"1/2",children:[d(S.Left,{children:[e(L,{}),e(M.Sub.S,{color:"cloud",ssSphere:3,onClick:()=>{N.close(a)},children:e(V.X,{})})]}),e(N.Body,{children:d(k,{borderRadius:"inherit",children:[e(k,{padding:1,children:e(G,{sheetID:a,pickerId:n,restrict:t.restrict,min:t.min,max:t.max,era:t.era,defaultValue:t.defaultValue,onValueUpdate:i=>{t.onValueUpdate&&t.onValueUpdate(i),l=i.value,p=i.era,o=i.eventType,i.eventType=="commit"&&N.close(a)}})}),d(S.Left,{padding:1,position:"sticky",ssZIndex:10,bottom:0,gap:"1/2",borderTop:"1.thin",backgroundColor:"layer.0.opa.low",borderBottomLeftRadius:"inherit",borderBottomRightRadius:"inherit",xcss:{backdropFilter:"blur(3px)"},children:[e(M.Clear.S,{color:"cloud",tabIndex:-1,fontColor:"4.thin",borderRadius:"2.tone.secondary",flexSizing:"none",onClick:()=>{var i,r;(r=(i=Y.get(n||""))==null?void 0:i.onClear)==null||r.call(i)},children:d(S.Center,{gap:"1/2",children:[e(V.X,{}),e(h.Micro,{children:"\u30EA\u30BB\u30C3\u30C8"})]})}),e(y.Parts.MinMax,{restrict:t.restrict,min:t.min,max:t.max}),e(L,{}),e(M.Prime.S,{tabIndex:-1,xcss:{minWidth:12*6},onClick:()=>{var i,r;(r=(i=Y.get(n||""))==null?void 0:i.onConfirm)==null||r.call(i)},children:"\u78BA\u5B9A"})]})]})})]})})},close:t=>{N.close(t)}};export{E as TimeSelector,E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as re,b as i,c as v,d as Q}from"../../../chunk-C5N2D3ZX.js";import{Fragment as Ee,jsx as f,jsxs as le}from"react/jsx-runtime";import M,{UUID as $,useStore as W}from"jmini";import*as K from"jmini";import{useState as B,useEffect as z,useRef as me}from"react";import{$$fromRoot as ue,Config as ie,ExtractStyles as de}from"../../../@utils";import{Box as H,FAI as fe}from"../../../atoms";import{Literal as he}from"../../../mols";import{Button as oe}from"../../Trigger";import{faClock as ge}from"@fortawesome/free-solid-svg-icons/faClock";import{faCalendarAlt as ye}from"@fortawesome/free-solid-svg-icons/faCalendarAlt";import{OptionalInputWrapper as Ie,BoxWrapper as ve,CoreEffects as Y,DefaultBoxishStyles as Se}from"../core";import{RightIcon as we}from"..";import Te from"../Select";import{InputLabel as De}from"../Label";import{TimeSelector as ne}from"./Selector";const A=" ~ ",be={clock:{defaultValue:"--:--",format:/^\d{2}\D\d{2}$/,ranges:[{type:"hour",from:0,length:2},{type:"minute",from:3,length:2}],sets:1},date:{defaultValue:"----/--/--",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2},{type:"date",from:8,length:2}],sets:1},week:{defaultValue:"----\u5E74\u7B2C--\u9031",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4,region:6},{type:"week",from:6,length:2,region:3}],sets:1},month:{defaultValue:"----\u5E74--\u6708",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2,region:3}],sets:1},year:{defaultValue:"----\u5E74",format:/^\d{4}$/,ranges:[{type:"year",from:0,length:4,region:5}],sets:1},"period.clock":{defaultValue:"--:--",format:/^\d{2}\D\d{2}$/,ranges:[{type:"hour",from:0,length:2},{type:"minute",from:3,length:2},{type:"hour",from:5+A.length,length:2},{type:"minute",from:8+A.length,length:2}],sets:2},"period.date":{defaultValue:"----/--/--",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2},{type:"date",from:8,length:2,region:5},{type:"year",from:10+A.length,length:4},{type:"month",from:15+A.length,length:2},{type:"date",from:18+A.length,length:2}],sets:2},"period.month":{defaultValue:"----\u5E74--\u6708",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2,region:6},{type:"year",from:8+A.length,length:4},{type:"month",from:13+A.length,length:2,region:3}],sets:2},"locale.jp.warekiDate":{defaultValue:"----\u5E74--\u6708--\u65E5",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"locale.jp.warekiDate",from:0,length:4,region:5},{type:"month",from:5,length:2,region:3},{type:"date",from:8,length:2,region:3}],sets:1}},N={PeriodMargin:" ~ ",SyncValue:e=>{let{restrict:a,value:I,era:o}=e,h=M.Arrayify(I||""),{defaultValue:E,format:w,ranges:l,sets:r}=be[a],_=[],D=a.match(/clock/)?":":"/";for(let t=0;t<h.length;t++)h[t]=String(h[t]).replace(/\D/ig,D);for(let t=0;t<r;t++){let p=h[t]||"";if(!p.match(w))h[t]="",_.push(E);else{let m=E;p.split(/\D/).forEach((b,k)=>{if(k==0&&a=="locale.jp.warekiDate"){let g=Number(b);o!="year"&&(g>=2019?o=="reiwa"?g-=2018:o=="heisei"&&(g=31):g>=1989?o=="heisei"?g-=1988:o=="shouwa"&&(g=64):g>=1926?o=="shouwa"?g-=1925:o=="taisho"&&(g=15):g>=1912?o=="taisho"?g-=1911:o=="meiji"&&(g=45):g>=1868&&(g-=1867)),b=g.zeroEmbed(4)}m=m.replace(new RegExp("------------------".slice(0,b.length)),b)}),_.push(m)}}return{safeValue:_.join(A),rawValue:a.startsWith("period.")?h:h[0],ranges:l}},SystemValidation:e=>{let{states:a}=e,{restrict:I,min:o,max:h,required:E}=a,w=[],l=M.Arrayify(e.value),r={empty:!1,escalated:1,filled:!0,correct:!0,prohibited:!1};(()=>{let D=I.match(/clock/)?":":"/";for(let t=0;t<l.length;t++)l[t]=String(l[t]).replace(/\D/ig,D);for(let t=0;t<l.length;t++){let p=l[t],m=l[t-1];p.removeLetters()||(r.empty=!0),t>0&&(r.escalated&=+(p>=m))}r.escalated&&(r.empty||(I.match(/clock/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);!p||!m?r.filled=!1:(Number(p)>23||Number(m)>59)&&(r.correct=!1)}):I.match(/date/)?l.forEach(t=>{let[p,m,b]=t.split(/\D+/);if(!p||!m||!b)r.filled=!1;else{let k=K.Time(t);(!k.validate||t!=k.toFormatYMD())&&(r.correct=!1)}}):I.match(/week/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);if(!p||!m)r.filled=!1;else{let b=K.Time(p+"/01/01").weekday,g=K.Time(p+"/01/0"+(7-b+1)).addWeek(Number(m)-1);p!=String(g.year)&&(r.correct=!1)}}):I.match(/month/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);!p||!m?r.filled=!1:K.Time([p,m,"01"].join("/")).validate||(r.correct=!1)}):I.match(/year/),r.filled&&r.correct&&l.forEach(t=>{{let p=Number(String(t).replace(/\D/ig,""));if(o&&Number(String(o).replace(/\D/ig,""))>p&&(r.prohibited=!0),h){let m=Number(String(h).replace(/\D/ig,""));p>m&&(r.prohibited=!0)}}})))})();{let{empty:D,escalated:t,filled:p,correct:m,prohibited:b}=r;D&&E&&(w=[{type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}]),t||w.push({type:"invalid",label:"\u6642\u7CFB\u5217\u3092\u6B63\u3057\u304F\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),m||w.push({type:"invalid",label:"\u7121\u52B9\u306A\u5024\u304C\u5165\u529B\u3055\u308C\u3066\u3044\u307E\u3059"}),p||w.push({type:"invalid",label:"\u6700\u5F8C\u307E\u3067\u5024\u3092\u57CB\u3081\u3066\u304F\u3060\u3055\u3044"}),b&&w.push({type:"invalid",label:le(Ee,{children:[f(H,{children:"\u5165\u529B\u7BC4\u56F2\u304C\u5236\u9650\u3055\u308C\u3066\u3044\u307E\u3059"}),"[",o||"\u4E0B\u9650\u7121\u3057","] ~ [",h||"\u4E0A\u9650\u7121\u3057","]"]})})}return{ok:!w.filter(({type:D})=>D=="invalid").length,notice:w}},KeyDownEvent:e=>{let{val_era:a,restrict:I,event:o,val_status:h,set_status:E,val_focus:w,set_focus:l}=e,{key:r,shiftKey:_,ctrlKey:D,metaKey:t}=o,p=D||t,{selectionStart:m,selectionEnd:b}=o.target,{index:k,prevIndex:g}=w,{ranges:q,safeValue:Z}=h,F=q.length-1;if(M.isOneOf(r,"Tab","ArrowLeft","ArrowRight")){let u=0;if(r=="Tab"){let c=+!_*2-1;if(u=w.index+c,u<0||u>F)return}else{let c=r=="ArrowLeft"?-1:r=="ArrowRight"?1:0;p||m==0&&b==String(h.safeValue).length?u=c==1?F:0:u=Math.max(0,Math.min(k+c,F))}l(c=>v(i({},c),{index:u,prevIndex:k})),o.preventDefault()}if(M.isOneOf(r,"Backspace","ArrowUp","ArrowDown","0","1","2","3","4","5","6","7","8","9")){o.preventDefault();let u=k;u=Math.max(u,0),u=Math.min(u,F);let{type:c,from:X,length:G}=q[u],C=Z.slice(X,X+G),S;if(r=="Backspace")S="------".slice(0,G);else if(M.isOneOf(r,"ArrowUp","ArrowDown")){let P=r=="ArrowUp"?1:-1;C=C|0,S=C+P;let[T,s,x]=c=="locale.jp.warekiDate"?a=="year"?[0,2999,4]:a=="reiwa"?[1,2999,4]:a=="heisei"?[1,31,4]:a=="shouwa"?[1,64,4]:a=="taisho"?[1,15,4]:a=="meiji"?[1,45,4]:[0,0,0]:c=="minute"?[0,59,2]:c=="hour"?[0,23,2]:c=="date"?[1,31,2]:c=="week"?[1,53,2]:c=="month"?[1,12,2]:c=="year"?[0,2999,4]:[0,0,0];S>s?S=T:S<T&&(S=s),S=Number(S).zeroEmbed(x)}else if(M.isOneOf(r,"0","1","2","3","4","5","6","7","8","9")){let P=C|0,T=r,s=`${P}${T}`;if(g!=k&&(P=0,s="0"+T),c=="year"||c=="locale.jp.warekiDate"&&a=="year")Number(s)>1e4?S=T:S=s,(S|0)>1e3&&u++;else if(M.isOneOf(c,"hour","minute","date","week","month")||c=="locale.jp.warekiDate"&&a!="year"){let x=c=="locale.jp.warekiDate"?a=="reiwa"?100:a=="heisei"?31:a=="shouwa"?64:a=="taisho"?15:a=="meiji"?45:0:c=="minute"?59:c=="hour"?23:c=="date"?31:c=="week"?53:c=="month"?12:0;S=(s|0)>x?T:s,(Number(T)>Number(String(x)[0])||C=="0000".slice(0,String(x).length)&&(s!="0000".slice(0,String(x).length)||M.isOneOf(c,"minute","hour")&&g==k)||(s|0)>=re(10,String(x).length-1))&&u++}c=="year"||c=="locale.jp.warekiDate"?S=(S|0).zeroEmbed(4):S=(S|0).zeroEmbed(2)}{let P=String(Z).partReplace(X,String(S)),T=P.split(A).map(s=>s.replace(/(^\D|\D$)/,"").split(/\D+/).join(I.match(/clock/)&&":"||"/").replace(/(^\D|\D$)/,""));if(I=="locale.jp.warekiDate"){let s=T[0].split(/\D/),[x,d,R]=s;s.length==3&&x&&(T=[[Number(x)-1+Number({year:1,reiwa:2019,heisei:1989,shouwa:1926,taisho:1912,meiji:1868}[a]),d,R].join("/")])}u=Math.max(u,0),u=Math.min(u,F),E(s=>v(i({},s),{rawValue:I.startsWith("period.")?T:T[0],safeValue:P,eventType:"update",eventID:$(12),isInspected:!1})),l(s=>v(i({},s),{index:u,prevIndex:s.index}))}}},Shallow:e=>{let{rootStates:a,val_status:I}=e,[o]=de(a);return f(H,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",ssZIndex:3,opacity:"trans",xcss:{pointerEvents:"none"},children:f(he.Description,v(i({className:a.className},o),{position:"absolute",width:1,xcss:v(i({},o.xcss),{color:"orange"}),children:f(H,{"data-input-value-shallow":I.componentId,children:"A"})}))})}},xe=e=>{let te=e,{tone:a,required:I,restrict:o="clock",componentId:h,era:E,form:w,name:l,min:r,max:_,className:D,enableFormSubmit:t,showInitValidation:p,onKeyDown:m,periodPresets:b,onValidate:k,onValidateDelay:g,onUpdateValue:q,onUpdateValidValue:Z,onUserAction:F,value:u="",leftIndicator:c,rightIndicator:X,leftIcon:G,rightIcon:C,xcss:S,wrapStyles:P}=te,T=Q(te,["tone","required","restrict","componentId","era","form","name","min","max","className","enableFormSubmit","showInitValidation","onKeyDown","periodPresets","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","xcss","wrapStyles"]),[s,x]=B(E||"year"),[d,R]=B(()=>v(i({componentId:e.componentId||""},N.SyncValue({restrict:o,value:u,era:s})),{ranges:[],eventType:"init",eventID:$(12)})),[J,j]=B({active:!1,index:0,prevIndex:-1}),se={rootStates:e,val_status:d,set_status:R,val_era:s,set_era:x,val_focus:J,set_focus:j};Y.CommonEffects({type:"time",states:e,val_status:d,set_status:R,SystemValidation:N.SystemValidation,ExtraOverrideStates:n=>N.SyncValue({restrict:o,value:n,era:s})}),z(()=>{R(n=>v(i(i({},n),N.SyncValue({restrict:o,value:u,era:s})),{isInspected:!1}))},[]);const ee=me(!1);return z(()=>{if(ee.current){R(y=>v(i(i({},y),N.SyncValue({restrict:o,value:y.rawValue,era:s})),{isInspected:!1}));let n=W.get("refreshEra_"+d.componentId);n&&n.refreshEra(s)}else ee.current=!0},[s]),W.update({[d.componentId]:{openPicker:n=>{e.disabled||ne.picker.open({restrict:o,era:E,defaultValue:d.rawValue,min:r,max:_,periodPresets:e.periodPresets,onValueUpdate:y=>{y.eventType=="commit"&&(R(O=>v(i(i({},O),N.SyncValue({restrict:o,value:y.value,era:y.era})),{eventType:"update",eventID:$(12),isInspected:!1,isValidated:!1,notice:[]})),x(y.era))}})},resetEra:n=>{x(n),R(y=>v(i(i({},y),N.SyncValue({restrict:o,value:"",era:s})),{eventType:"update",eventID:$(12),isInspected:!1}))}}}),z(()=>{let{index:n,active:y}=J;if(y){n=Math.max(n,0),n=Math.min(n,d.ranges.length-1);let{from:O,length:L}=d.ranges[n],U=ue("#"+e.id)[0];U&&U.setSelectionRange&&U.setSelectionRange(O,O+L)}R(O=>v(i({},O),{isFocusing:y}))},[J]),le(ve,{val_status:d,set_status:R,states:e,children:[f(N.Shallow,i({},se)),f(De,{componentId:e.componentId,fontSize:e.fontSize,required:e.required,label:e.label,isActive:!0,val_status:d}),ie.get().isTouchDevice?f(oe.Plain,v(i({"data-show-validation":Y.isShowValidation(d,!!p),"data-component-id":d.componentId,"data-input-origin":d.componentId,"data-disabled":e.disabled,className:D,xcss:{textAlign:"left"}},T),{children:d.safeValue,onClick:n=>{let y=W.get(d.componentId);y&&y.openPicker(`[data-input-origin="${d.componentId}"]`),n.stopPropagation()},onFocus:()=>{j(n=>v(i({},n),{active:!0}))},onBlur:()=>{j(n=>v(i({},n),{active:!1}))}})):f(H,i({htmlTag:"input",type:"text",inputMode:"numeric","data-show-validation":Y.isShowValidation(d,!!p),"data-input-origin":d.componentId,"data-disabled":e.disabled,value:d.safeValue,className:D,tabIndex:ie.get().isTouchDevice?-1:0,onKeyDown:n=>{N.KeyDownEvent({restrict:o,event:n,val_era:s,val_status:d,set_status:R,val_focus:J,set_focus:j}),m&&m(n),t&&Y.SubmitForm(n,w)},onKeyUp:n=>{n.key=="Tab"&&j(y=>v(i({},y),{active:!0}))},onClick:n=>{let y=n.target.selectionEnd,O=0;d.ranges.forEach((L,U)=>{let{from:ae,length:ce,region:pe}=L;ae<=y&&y<=ae+(pe||ce)&&(O=U)}),j(L=>v(i({},L),{active:!0,index:O})),n.preventDefault()},onBlur:()=>{j(n=>v(i({},n),{active:!1}))},onChange:()=>{}},T))]})},V={Origin:e=>{let a=i({fontSize:"inherit",width:1,value:""},e);a.value=a.value||"";let[I]=B(e.componentId||$(12));if(a.componentId=I,M.isNullish(a.rightIcon)){let o=(e.restrict||"").match(/clock/)?ge:ye;a.rightIcon=f(we,{ssSphere:2.5,xcss:{pointerEvents:"all"},children:f(oe.Sub,{color:"cloud",border:"unset",ssSphere:2.5,fontColor:"theme",boxShadow:"0.normal",borderRadius:"3.tone.tertiary",flexCenter:!0,ssEffectsOnActive:"push",tabIndex:-1,id:"Picker-"+a.componentId,onClick:()=>{let h=W.get(a.componentId);h&&h.openPicker("#Picker-"+a.componentId)},children:f(fe,{icon:o})})})}return f(Ie,{componentId:a.componentId,children:xe,states:Se(a)})},Clock:e=>f(V.Origin,i({restrict:"clock",era:"clock"},e)),Date:e=>f(V.Origin,i({restrict:"date"},e)),Week:e=>f(V.Origin,i({restrict:"week"},e)),Month:e=>f(V.Origin,i({restrict:"month"},e)),Year:e=>f(V.Origin,i({restrict:"year"},e)),Locale:{JP:{WarekiDate:e=>{e=i({},e);let[a]=B(e.componentId||$(12));e.componentId=a;let w=e,{defaultEra:I="wareki"}=w,o=Q(w,["defaultEra"]),[h,E]=B((()=>{let l="year";if(I=="wareki"&&(l="reiwa",e.value)){let[r,_,D]=e.value.split(/\D/);if(r&&_&&D){let t=Number(r);t>=2019?(t-=2019,l="reiwa"):t>=1989?(t-=1989,l="heisei"):t>=1926?(t-=1926,l="shouwa"):t>=1912?(t-=1912,l="taisho"):t>=1868&&(t-=1868,l="meiji"),t+=1}}return l})());return z(()=>{W.set({["refreshEra_"+a]:{refreshEra:l=>{E(l)}}})},[]),f(V.Origin,v(i({restrict:"locale.jp.warekiDate",leftIndicator:f(Te,{label:"\u5143\u53F7",emptySelect:!1,value:h,tone:e.tone||"border",override:"force",flexCenter:!0,borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",height:1,xcss:{whiteSpace:"nowrap"},options:[{value:"year",label:"\u897F\u66A6"},{value:"reiwa",label:"\u4EE4\u548C"},{value:"heisei",label:"\u5E73\u6210"},{value:"shouwa",label:"\u662D\u548C"},{value:"taisho",label:"\u5927\u6B63"},{value:"meiji",label:"\u660E\u6CBB"}],onUpdateValidValue:l=>{E(l);let r=W.get(e.componentId);r&&r.resetEra&&r.resetEra(l)}})},o),{era:h}))}}},Periods:{Clock:e=>f(V.Origin,i({restrict:"period.clock",era:"clock"},e)),Date:e=>f(V.Origin,i({restrict:"period.date"},e)),Month:e=>f(V.Origin,i({restrict:"period.month"},e))}};export{V as Time,ne as TimeSelector,V as default};
|
|
1
|
+
import{a as re,b as i,c as v,d as Q}from"../../../chunk-C5N2D3ZX.js";import{Fragment as ke,jsx as f,jsxs as le}from"react/jsx-runtime";import A,{UUID as $,useStore as W}from"jmini";import*as K from"jmini";import{useState as B,useEffect as z,useRef as me}from"react";import{$$fromRoot as ue,Config as ie,ExtractStyles as de}from"../../../@utils";import{Box as H,FAI as fe}from"../../../atoms";import{Literal as he}from"../../../mols";import{Button as oe}from"../../Trigger";import{faClock as ge}from"@fortawesome/free-solid-svg-icons/faClock";import{faCalendarAlt as ye}from"@fortawesome/free-solid-svg-icons/faCalendarAlt";import{OptionalInputWrapper as Ie,BoxWrapper as ve,CoreEffects as Y,DefaultBoxishStyles as Se}from"../core";import{RightIcon as we}from"..";import Te from"../Select";import{InputLabel as xe}from"../Label";import{TimeSelector as ne}from"./Selector";const M=" ~ ",be={clock:{defaultValue:"--:--",format:/^\d{2}\D\d{2}$/,ranges:[{type:"hour",from:0,length:2},{type:"minute",from:3,length:2}],sets:1},date:{defaultValue:"----/--/--",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2},{type:"date",from:8,length:2}],sets:1},week:{defaultValue:"----\u5E74\u7B2C--\u9031",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4,region:6},{type:"week",from:6,length:2,region:3}],sets:1},month:{defaultValue:"----\u5E74--\u6708",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2,region:3}],sets:1},year:{defaultValue:"----\u5E74",format:/^\d{4}$/,ranges:[{type:"year",from:0,length:4,region:5}],sets:1},"period.clock":{defaultValue:"--:--",format:/^\d{2}\D\d{2}$/,ranges:[{type:"hour",from:0,length:2},{type:"minute",from:3,length:2},{type:"hour",from:5+M.length,length:2},{type:"minute",from:8+M.length,length:2}],sets:2},"period.date":{defaultValue:"----/--/--",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2},{type:"date",from:8,length:2,region:5},{type:"year",from:10+M.length,length:4},{type:"month",from:15+M.length,length:2},{type:"date",from:18+M.length,length:2}],sets:2},"period.month":{defaultValue:"----\u5E74--\u6708",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2,region:6},{type:"year",from:8+M.length,length:4},{type:"month",from:13+M.length,length:2,region:3}],sets:2},"locale.jp.warekiDate":{defaultValue:"----\u5E74--\u6708--\u65E5",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"locale.jp.warekiDate",from:0,length:4,region:5},{type:"month",from:5,length:2,region:3},{type:"date",from:8,length:2,region:3}],sets:1}},P={PeriodMargin:" ~ ",SyncValue:e=>{let{restrict:a,value:I,era:o}=e,h=A.Arrayify(I||""),{defaultValue:k,format:w,ranges:l,sets:r}=be[a],_=[],x=a.match(/clock/)?":":"/";for(let t=0;t<h.length;t++)h[t]=String(h[t]).replace(/\D/ig,x);for(let t=0;t<r;t++){let p=h[t]||"";if(!p.match(w))h[t]="",_.push(k);else{let m=k;p.split(/\D/).forEach((b,E)=>{if(E==0&&a=="locale.jp.warekiDate"){let g=Number(b);o!="year"&&(g>=2019?o=="reiwa"?g-=2018:o=="heisei"&&(g=31):g>=1989?o=="heisei"?g-=1988:o=="shouwa"&&(g=64):g>=1926?o=="shouwa"?g-=1925:o=="taisho"&&(g=15):g>=1912?o=="taisho"?g-=1911:o=="meiji"&&(g=45):g>=1868&&(g-=1867)),b=g.zeroEmbed(4)}m=m.replace(new RegExp("------------------".slice(0,b.length)),b)}),_.push(m)}}return{safeValue:_.join(M),rawValue:a.startsWith("period.")?h:h[0],ranges:l}},SystemValidation:e=>{let{states:a}=e,{restrict:I,min:o,max:h,required:k}=a,w=[],l=A.Arrayify(e.value),r={empty:!1,escalated:1,filled:!0,correct:!0,prohibited:!1};(()=>{let x=I.match(/clock/)?":":"/";for(let t=0;t<l.length;t++)l[t]=String(l[t]).replace(/\D/ig,x);for(let t=0;t<l.length;t++){let p=l[t],m=l[t-1];p.removeLetters()||(r.empty=!0),t>0&&(r.escalated&=+(p>=m))}r.escalated&&(r.empty||(I.match(/clock/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);!p||!m?r.filled=!1:(Number(p)>23||Number(m)>59)&&(r.correct=!1)}):I.match(/date/)?l.forEach(t=>{let[p,m,b]=t.split(/\D+/);if(!p||!m||!b)r.filled=!1;else{let E=K.Time(t);(!E.validate||t!=E.fmt.ymd())&&(r.correct=!1)}}):I.match(/week/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);if(!p||!m)r.filled=!1;else{let b=K.Time(p+"/01/01").weekday,g=K.Time(p+"/01/0"+(7-b+1)).addWeek(Number(m)-1);p!=String(g.year)&&(r.correct=!1)}}):I.match(/month/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);!p||!m?r.filled=!1:K.Time([p,m,"01"].join("/")).validate||(r.correct=!1)}):I.match(/year/),r.filled&&r.correct&&l.forEach(t=>{{let p=Number(String(t).replace(/\D/ig,""));if(o&&Number(String(o).replace(/\D/ig,""))>p&&(r.prohibited=!0),h){let m=Number(String(h).replace(/\D/ig,""));p>m&&(r.prohibited=!0)}}})))})();{let{empty:x,escalated:t,filled:p,correct:m,prohibited:b}=r;x&&k&&(w=[{type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}]),t||w.push({type:"invalid",label:"\u6642\u7CFB\u5217\u3092\u6B63\u3057\u304F\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),m||w.push({type:"invalid",label:"\u7121\u52B9\u306A\u5024\u304C\u5165\u529B\u3055\u308C\u3066\u3044\u307E\u3059"}),p||w.push({type:"invalid",label:"\u6700\u5F8C\u307E\u3067\u5024\u3092\u57CB\u3081\u3066\u304F\u3060\u3055\u3044"}),b&&w.push({type:"invalid",label:le(ke,{children:[f(H,{children:"\u5165\u529B\u7BC4\u56F2\u304C\u5236\u9650\u3055\u308C\u3066\u3044\u307E\u3059"}),"[",o||"\u4E0B\u9650\u7121\u3057","] ~ [",h||"\u4E0A\u9650\u7121\u3057","]"]})})}return{ok:!w.filter(({type:x})=>x=="invalid").length,notice:w}},KeyDownEvent:e=>{let{val_era:a,restrict:I,event:o,val_status:h,set_status:k,val_focus:w,set_focus:l}=e,{key:r,shiftKey:_,ctrlKey:x,metaKey:t}=o,p=x||t,{selectionStart:m,selectionEnd:b}=o.target,{index:E,prevIndex:g}=w,{ranges:q,safeValue:Z}=h,j=q.length-1;if(A.isOneOf(r,"Tab","ArrowLeft","ArrowRight")){let u=0;if(r=="Tab"){let c=+!_*2-1;if(u=w.index+c,u<0||u>j)return}else{let c=r=="ArrowLeft"?-1:r=="ArrowRight"?1:0;p||m==0&&b==String(h.safeValue).length?u=c==1?j:0:u=Math.max(0,Math.min(E+c,j))}l(c=>v(i({},c),{index:u,prevIndex:E})),o.preventDefault()}if(A.isOneOf(r,"Backspace","ArrowUp","ArrowDown","0","1","2","3","4","5","6","7","8","9")){o.preventDefault();let u=E;u=Math.max(u,0),u=Math.min(u,j);let{type:c,from:X,length:G}=q[u],C=Z.slice(X,X+G),S;if(r=="Backspace")S="------".slice(0,G);else if(A.isOneOf(r,"ArrowUp","ArrowDown")){let N=r=="ArrowUp"?1:-1;C=C|0,S=C+N;let[T,s,D]=c=="locale.jp.warekiDate"?a=="year"?[0,2999,4]:a=="reiwa"?[1,2999,4]:a=="heisei"?[1,31,4]:a=="shouwa"?[1,64,4]:a=="taisho"?[1,15,4]:a=="meiji"?[1,45,4]:[0,0,0]:c=="minute"?[0,59,2]:c=="hour"?[0,23,2]:c=="date"?[1,31,2]:c=="week"?[1,53,2]:c=="month"?[1,12,2]:c=="year"?[0,2999,4]:[0,0,0];S>s?S=T:S<T&&(S=s),S=Number(S).zeroEmbed(D)}else if(A.isOneOf(r,"0","1","2","3","4","5","6","7","8","9")){let N=C|0,T=r,s=`${N}${T}`;if(g!=E&&(N=0,s="0"+T),c=="year"||c=="locale.jp.warekiDate"&&a=="year")Number(s)>1e4?S=T:S=s,(S|0)>1e3&&u++;else if(A.isOneOf(c,"hour","minute","date","week","month")||c=="locale.jp.warekiDate"&&a!="year"){let D=c=="locale.jp.warekiDate"?a=="reiwa"?100:a=="heisei"?31:a=="shouwa"?64:a=="taisho"?15:a=="meiji"?45:0:c=="minute"?59:c=="hour"?23:c=="date"?31:c=="week"?53:c=="month"?12:0;S=(s|0)>D?T:s,(Number(T)>Number(String(D)[0])||C=="0000".slice(0,String(D).length)&&(s!="0000".slice(0,String(D).length)||A.isOneOf(c,"minute","hour")&&g==E)||(s|0)>=re(10,String(D).length-1))&&u++}c=="year"||c=="locale.jp.warekiDate"?S=(S|0).zeroEmbed(4):S=(S|0).zeroEmbed(2)}{let N=String(Z).partReplace(X,String(S)),T=N.split(M).map(s=>s.replace(/(^\D|\D$)/,"").split(/\D+/).join(I.match(/clock/)&&":"||"/").replace(/(^\D|\D$)/,""));if(I=="locale.jp.warekiDate"){let s=T[0].split(/\D/),[D,d,R]=s;s.length==3&&D&&(T=[[Number(D)-1+Number({year:1,reiwa:2019,heisei:1989,shouwa:1926,taisho:1912,meiji:1868}[a]),d,R].join("/")])}u=Math.max(u,0),u=Math.min(u,j),k(s=>v(i({},s),{rawValue:I.startsWith("period.")?T:T[0],safeValue:N,eventType:"update",eventID:$(12),isInspected:!1})),l(s=>v(i({},s),{index:u,prevIndex:s.index}))}}},Shallow:e=>{let{rootStates:a,val_status:I}=e,[o]=de(a);return f(H,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",ssZIndex:3,opacity:"trans",xcss:{pointerEvents:"none"},children:f(he.Description,v(i({className:a.className},o),{position:"absolute",width:1,xcss:v(i({},o.xcss),{color:"orange"}),children:f(H,{"data-input-value-shallow":I.componentId,children:"A"})}))})}},De=e=>{let te=e,{tone:a,required:I,restrict:o="clock",componentId:h,era:k,form:w,name:l,min:r,max:_,className:x,enableFormSubmit:t,showInitValidation:p,onKeyDown:m,periodPresets:b,onValidate:E,onValidateDelay:g,onUpdateValue:q,onUpdateValidValue:Z,onUserAction:j,value:u="",leftIndicator:c,rightIndicator:X,leftIcon:G,rightIcon:C,xcss:S,wrapStyles:N}=te,T=Q(te,["tone","required","restrict","componentId","era","form","name","min","max","className","enableFormSubmit","showInitValidation","onKeyDown","periodPresets","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","xcss","wrapStyles"]),[s,D]=B(k||"year"),[d,R]=B(()=>v(i({componentId:e.componentId||""},P.SyncValue({restrict:o,value:u,era:s})),{ranges:[],eventType:"init",eventID:$(12)})),[J,F]=B({active:!1,index:0,prevIndex:-1}),se={rootStates:e,val_status:d,set_status:R,val_era:s,set_era:D,val_focus:J,set_focus:F};Y.CommonEffects({type:"time",states:e,val_status:d,set_status:R,SystemValidation:P.SystemValidation,ExtraOverrideStates:n=>P.SyncValue({restrict:o,value:n,era:s})}),z(()=>{R(n=>v(i(i({},n),P.SyncValue({restrict:o,value:u,era:s})),{isInspected:!1}))},[]);const ee=me(!1);return z(()=>{if(ee.current){R(y=>v(i(i({},y),P.SyncValue({restrict:o,value:y.rawValue,era:s})),{isInspected:!1}));let n=W.get("refreshEra_"+d.componentId);n&&n.refreshEra(s)}else ee.current=!0},[s]),W.update({[d.componentId]:{openPicker:n=>{e.disabled||ne.picker.open({restrict:o,era:k,defaultValue:d.rawValue,min:r,max:_,periodPresets:e.periodPresets,onValueUpdate:y=>{y.eventType=="commit"&&(R(O=>v(i(i({},O),P.SyncValue({restrict:o,value:y.value,era:y.era})),{eventType:"update",eventID:$(12),isInspected:!1,isValidated:!1,notice:[]})),D(y.era))}})},resetEra:n=>{D(n),R(y=>v(i(i({},y),P.SyncValue({restrict:o,value:"",era:s})),{eventType:"update",eventID:$(12),isInspected:!1}))}}}),z(()=>{let{index:n,active:y}=J;if(y){n=Math.max(n,0),n=Math.min(n,d.ranges.length-1);let{from:O,length:L}=d.ranges[n],U=ue("#"+e.id)[0];U&&U.setSelectionRange&&U.setSelectionRange(O,O+L)}R(O=>v(i({},O),{isFocusing:y}))},[J]),le(ve,{val_status:d,set_status:R,states:e,children:[f(P.Shallow,i({},se)),f(xe,{componentId:e.componentId,fontSize:e.fontSize,required:e.required,label:e.label,isActive:!0,val_status:d}),ie.get().isTouchDevice?f(oe.Plain,v(i({"data-show-validation":Y.isShowValidation(d,!!p),"data-component-id":d.componentId,"data-input-origin":d.componentId,"data-disabled":e.disabled,className:x,xcss:{textAlign:"left"}},T),{children:d.safeValue,onClick:n=>{let y=W.get(d.componentId);y&&y.openPicker(`[data-input-origin="${d.componentId}"]`),n.stopPropagation()},onFocus:()=>{F(n=>v(i({},n),{active:!0}))},onBlur:()=>{F(n=>v(i({},n),{active:!1}))}})):f(H,i({htmlTag:"input",type:"text",inputMode:"numeric","data-show-validation":Y.isShowValidation(d,!!p),"data-input-origin":d.componentId,"data-disabled":e.disabled,value:d.safeValue,className:x,tabIndex:ie.get().isTouchDevice?-1:0,onKeyDown:n=>{P.KeyDownEvent({restrict:o,event:n,val_era:s,val_status:d,set_status:R,val_focus:J,set_focus:F}),m&&m(n),t&&Y.SubmitForm(n,w)},onKeyUp:n=>{n.key=="Tab"&&F(y=>v(i({},y),{active:!0}))},onClick:n=>{let y=n.target.selectionEnd,O=0;d.ranges.forEach((L,U)=>{let{from:ae,length:ce,region:pe}=L;ae<=y&&y<=ae+(pe||ce)&&(O=U)}),F(L=>v(i({},L),{active:!0,index:O})),n.preventDefault()},onBlur:()=>{F(n=>v(i({},n),{active:!1}))},onChange:()=>{}},T))]})},V={Origin:e=>{let a=i({fontSize:"inherit",width:1,value:""},e);a.value=a.value||"";let[I]=B(e.componentId||$(12));if(a.componentId=I,A.isNullish(a.rightIcon)){let o=(e.restrict||"").match(/clock/)?ge:ye;a.rightIcon=f(we,{ssSphere:2.5,xcss:{pointerEvents:"all"},children:f(oe.Sub,{color:"cloud",border:"unset",ssSphere:2.5,fontColor:"theme",boxShadow:"0.normal",borderRadius:"3.tone.tertiary",flexCenter:!0,ssEffectsOnActive:"push",tabIndex:-1,id:"Picker-"+a.componentId,onClick:()=>{let h=W.get(a.componentId);h&&h.openPicker("#Picker-"+a.componentId)},children:f(fe,{icon:o})})})}return f(Ie,{componentId:a.componentId,children:De,states:Se(a)})},Clock:e=>f(V.Origin,i({restrict:"clock",era:"clock"},e)),Date:e=>f(V.Origin,i({restrict:"date"},e)),Week:e=>f(V.Origin,i({restrict:"week"},e)),Month:e=>f(V.Origin,i({restrict:"month"},e)),Year:e=>f(V.Origin,i({restrict:"year"},e)),Locale:{JP:{WarekiDate:e=>{e=i({},e);let[a]=B(e.componentId||$(12));e.componentId=a;let w=e,{defaultEra:I="wareki"}=w,o=Q(w,["defaultEra"]),[h,k]=B((()=>{let l="year";if(I=="wareki"&&(l="reiwa",e.value)){let[r,_,x]=e.value.split(/\D/);if(r&&_&&x){let t=Number(r);t>=2019?(t-=2019,l="reiwa"):t>=1989?(t-=1989,l="heisei"):t>=1926?(t-=1926,l="shouwa"):t>=1912?(t-=1912,l="taisho"):t>=1868&&(t-=1868,l="meiji"),t+=1}}return l})());return z(()=>{W.set({["refreshEra_"+a]:{refreshEra:l=>{k(l)}}})},[]),f(V.Origin,v(i({restrict:"locale.jp.warekiDate",leftIndicator:f(Te,{label:"\u5143\u53F7",emptySelect:!1,value:h,tone:e.tone||"border",override:"force",flexCenter:!0,borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",height:1,pickerPosition:3,pickerStyles:{xcss:{minWidth:12*8}},xcss:{whiteSpace:"nowrap"},options:[{value:"year",label:"\u897F\u66A6"},{value:"reiwa",label:"\u4EE4\u548C"},{value:"heisei",label:"\u5E73\u6210"},{value:"shouwa",label:"\u662D\u548C"},{value:"taisho",label:"\u5927\u6B63"},{value:"meiji",label:"\u660E\u6CBB"}],onUpdateValidValue:l=>{k(l);let r=W.get(e.componentId);r&&r.resetEra&&r.resetEra(l)}})},o),{era:h}))}}},Periods:{Clock:e=>f(V.Origin,i({restrict:"period.clock",era:"clock"},e)),Date:e=>f(V.Origin,i({restrict:"period.date"},e)),Month:e=>f(V.Origin,i({restrict:"period.month"},e))}};export{V as Time,ne as TimeSelector,V as default};
|