amotify 0.3.38 → 0.3.40
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/atoms/Box.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as p,d as
|
|
1
|
+
import{b as o,c as p,d as a}from"../chunk-C5N2D3ZX.js";import{jsx as c}from"react/jsx-runtime";import{GenerateHTMLProps as s}from"../@utils";const m=e=>{let{ref:l}=e,n=s(e),{htmlTag:r}=n,T=a(n,["htmlTag"]);const t=r||"div";return t?c(t,p(o({},T),{ref:l})):null};export{m as Box,m as default};
|
package/dist/atoms/Grid.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import Box from './Box';
|
|
|
4
4
|
declare namespace Grid {
|
|
5
5
|
namespace Layout {
|
|
6
6
|
type Input = Box.DefaultInput & {
|
|
7
|
-
gridTemplateColumns
|
|
8
|
-
gridTemplateRows
|
|
9
|
-
gridChildTemplates
|
|
7
|
+
gridTemplateColumns?: StandardLonghandProperties['gridTemplateColumns'];
|
|
8
|
+
gridTemplateRows?: StandardLonghandProperties['gridTemplateRows'];
|
|
9
|
+
gridChildTemplates?: [
|
|
10
10
|
StandardShorthandProperties['gridColumn'] | void,
|
|
11
11
|
StandardShorthandProperties['gridRow'] | void
|
|
12
12
|
][];
|
package/dist/atoms/Grid.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o,c as u,d as h}from"../chunk-C5N2D3ZX.js";import{jsx as c}from"react/jsx-runtime";import g,{UUID as S}from"jmini";import x from"./Box";import{GridClasses as L}from"../@styles/componentClasses";import{useEffect as
|
|
2
|
-
`)}),
|
|
1
|
+
import{b as o,c as u,d as h}from"../chunk-C5N2D3ZX.js";import{jsx as c}from"react/jsx-runtime";import g,{UUID as S}from"jmini";import x from"./Box";import{GridClasses as L}from"../@styles/componentClasses";import{useEffect as $,useState as G}from"react";const T=t=>c(x,o({display:"grid"},t)),i=T;i.Layout=t=>{let n=t,{gridTemplateColumns:f,gridTemplateRows:y,gridChildTemplates:d=[]}=n,C=h(n,["gridTemplateColumns","gridTemplateRows","gridChildTemplates"]),[r]=G(S(12));return $(()=>{let s="inlinestyle-"+r,a=document.createElement("style");return a.textContent="",d.forEach(([l,p],m)=>{let e=[`[data-grid-layout-id='${r}'] > *:nth-child(${d.length}n + ${m+1}) {`];d.length==m+1&&(e=[`[data-grid-layout-id='${r}'] > *:nth-child(${d.length}n) {`]),l&&e.push(` grid-column:${l};`),p&&e.push(` grid-row:${p};`),e.push("}",""),a.textContent+=e.join(`
|
|
2
|
+
`)}),a.id=s,g("head").append(a),()=>{g("#"+s).remove()}},[]),c(i,u(o({},C),{"data-grid-layout-id":r,className:[t.className,L("GridLayout")].join(" "),xcss:o({gridTemplateColumns:f,gridTemplateRows:y},t.xcss)}))};export{i as Grid,i as default};
|
|
@@ -4,8 +4,9 @@ import { $themecolor } from '../../@utils';
|
|
|
4
4
|
import { InputTypes } from '.';
|
|
5
5
|
declare namespace Switch {
|
|
6
6
|
type Size = 'small' | 'regular' | 'large';
|
|
7
|
-
type Input = InputTypes.
|
|
7
|
+
type Input = InputTypes.CoreInput<boolean> & React.DOMAttributes<HTMLLabelElement> & {
|
|
8
8
|
color?: Color;
|
|
9
|
+
label?: ReactElement;
|
|
9
10
|
id?: string;
|
|
10
11
|
tabIndex?: number;
|
|
11
12
|
size?: Size;
|
package/dist/fn/Input/Switch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as t,c as a,d as V}from"../../chunk-C5N2D3ZX.js";import{jsx as n,jsxs as x}from"react/jsx-runtime";import{UUID as y}from"jmini";import{useState as B}from"react";import m from"../../atoms/Box";import{Row as E}from"../../mols";import{Label as L}from"../Trigger";import{OptionalInputWrapper as A,BoxWrapper as P,CoreEffects as T}from"./core";import{InputSwitchClasses as b}from"../../@styles/componentClasses";function U(e){let{value:o,states:i}=e,{required:S}=i,l=[];return S&&!o&&l.push({type:"invalid",label:"ON\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093"}),{ok:!l.filter(({type:h})=>h=="invalid").length,notice:l}}const W=e=>{let F=e,{componentId:o,color:i="posi",required:S,form:l,id:h,wrapStyles:O,enableFormSubmit:N,showInitValidation:_,onChange:H,onKeyDown:$,onValidate:q,onValidateDelay:K,onUpdateValue:j,onUpdateValidValue:G,onUserAction:J,label:k,size:w="regular",value:z="",icon:R="",isApply:s=!1}=F,v=V(F,["componentId","color","required","form","id","wrapStyles","enableFormSubmit","showInitValidation","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","label","size","value","icon","isApply"]),[r,p]=B({componentId:e.componentId||"",rawValue:z,eventType:"init",eventID:y(12)}),c=!!r.rawValue;T.CommonEffects({type:"switch",states:e,val_status:r,set_status:p,SystemValidation:U});let I="middle",C=5,f=3;return s&&(f=4),x(P,{val_status:r,set_status:p,states:e,children:[n(m,{htmlTag:"input",type:"checkbox","data-component-id":r.componentId,checked:r.rawValue,className:b("Input"),id:h,onKeyDown:u=>{N&&T.SubmitForm(u,l)},onChange:u=>{let{checked:d}=u.target;p(M=>a(t({},M),{rawValue:d,eventType:"update",eventID:y(12),isInspected:!1,isValidated:!1,notice:[]}))},onFocus:u=>{p(d=>a(t({},d),{eventID:y(12),isFocusing:!0}))},onBlur:u=>{p(d=>a(t({},d),{eventID:y(12),isFocusing:!1}))}}),x(L.Plain,a(t({tabIndex:-1,htmlFor:h,padding:"1/4",display:"flex",horizontalAlign:"left",verticalAlign:"center",flexSizing:0,gap:"1/2",transition:I,borderRadius:"1.tone.primary"},v),{className:[b("Label"),...v.className||[]].join(" "),children:[n(m,a(t({},s?{padding:"1/4",isRounded:!0,backgroundColor:c?i:"layer.3"}:{}),{children:x(E.Center,{unitHeight:w=="small"?2:w=="regular"?2.5:w=="large"?3:0,position:"relative",xcss:{aspectRatio:(C+f)/C},children:[!s&&n(m,{position:"absolute",backgroundColor:c?i:"layer.5",isRounded:!0,transition:I,width:1,opacity:"middle",className:b("Bar"),xcss:{height:"40%"}}),n(m,{position:"absolute",top:0,backgroundColor:!s&&c?i:"white",transition:I,isRounded:!0,flexCenter:!0,boxShadow:"1.remark",className:b("Dot"),xcss:{height:"100%",aspectRatio:"1",left:c?`calc(${f.toRate(C+f)}%)`:0},children:R&&n(m,{transition:I,flexCenter:!0,fontColor:c?s?i:"white":"6.clear",children:R})})]})})),k]}))]})},g=e=>{let o=t({},e);return o.value=!!o.value,o.color=o.color||"theme",n(A,{componentId:o.componentId,children:W,states:o})},D=Object.assign(g,{S:e=>n(g,a(t({},e),{size:"small"})),R:e=>n(g,a(t({},e),{size:"regular"})),L:e=>n(g,a(t({},e),{size:"large"}))});export{D as Switch,D as default};
|
|
@@ -1 +1 @@
|
|
|
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
|
+
import{b as c,c as v,d as j}from"../../../chunk-C5N2D3ZX.js";import{Fragment as W,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 P,useEffect as B}from"react";import{Box as x,Grid as J,FAI as D,Column as M,FlexMargin as L}from"../../../atoms";import{Row as S,Literal as h}from"../../../mols";import{Button as k}from"../../Trigger";import U from"../../Sheet";import _ from"../Select";import{LeftIcon as $,RightIcon as A}from"..";import{InputTimeClasses as V}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(W,{children:[r&&e(h.Micro,{children:r}),s&&d(h.Micro,{children:["[",s,"]"]})]}),e(L,{}),i]})})}return l},calendartypeState:()=>{let[t,l]=P(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]=P(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]=P(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(M,{xcss:{minWidth:12*16},children:[d(S.Left,{flexWrap:!0,children:[d(h.Paragraph,{children:[o.from.year||"----","\u5E74"]}),e(k.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]=P(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(M,{xcss:{minWidth:12*16},children:[d(S.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.fmt.ym("jp")||"----/--"}),e(k.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]=P(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(M,{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(k.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(k.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(W,{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(A,{right:"2/3",children:e(D.AngleDown,{})})}),e(y.Parts.ShiftButtons,{onShiftClicked:i=>{n(r=>v(c({},r),{eventType:"update",display:r.display.clone().addYear(i)}))}})]}),d(M,{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(A,{right:"2/3",children:e(D.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(W,{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(k.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]=P(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().setHHII(t.min||"00:00"),n=f().setHHII(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(M,{xcss:{minWidth:12*16},children:[d(S.Left,{gap:"1/2",flexWrap:!0,children:[d(S.Center,{gap:"1/2",children:[e(x,{className:V("ClockBase"),children:e(x,{className:V("ClockUiBase"),flexCenter:!0,children:d(x,{className:V("ClockUi"),backgroundColor:"theme.opa.low",isRounded:!0,position:"relative",children:[e(x,{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(x,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[V("Needle"),V("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(k.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]=P(T.scope(()=>{let[r,s]=T.Arrayify(t.defaultValue),u=f().setHHII(r||"09:00"),g=f().setHHII(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().setHHII(t.min||"00:00"),n=f().setHHII(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(M,{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]=P(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(M,{xcss:{minWidth:12*16},children:[d(S.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),d(k.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(k.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(A,{right:"2/3",children:e(D.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(A,{right:"2/3",children:e(D.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]=P(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(M,{xcss:{minWidth:12*16},children:[d(S.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),d(k.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(k.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(A,{right:"2/3",children:e(D.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(k.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(k.Sub.S,{className:V("LeftButton"),tabIndex:-1,right:0,position:"relative",ssSquare:2.5,onClick:()=>{l(-1)},children:e(D.ChevronLeft,{})}),p,e(k.Sub.S,{className:V("RightButton"),tabIndex:-1,left:0,position:"relative",ssSquare:2.5,onClick:()=>{l(1)},children:e(D.ChevronRight,{})})]}))},Calendar:t=>{let{targetMonth:l,from:p,to:o,onTitleRender:m=I=>e(h.Mini,{isSemiBoldFont:!0,children:I.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 I=b==6,w=b==0;s.push(e(h.Micro,{textAlign:"center",fontColor:I?"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,F=!1;o&&o.validate&&(z=w.isInRange(p,o),F=o.isSameDate(w));let q=a.isSameDate(w),H=!1;if(t.min){let N=f(t.min);N&&w.value<N.value&&(H=!0)}if(t.max){let N=f(t.max);N&&N.value<w.value&&(H=!0)}g.push(d(k.Clear.S,{isLocked:H,color:"cloud",border:"1.thin",isActive:O||F||z,isActiveStyles:O||F?{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(M,{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 I=f(t.min).getLastDayOfMonth();I&&r.value<I.value&&(s=!0)}if(t.max){let I=f(t.max).getLastDayOfMonth();I&&I.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(k.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(M,{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(M,{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(W,{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().setHHII(p||""),a=f().setHHII(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();U.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(M,{gap:"1/2",children:[d(S.Left,{children:[e(L,{}),e(k.Sub.S,{color:"cloud",ssSphere:3,onClick:()=>{U.close(a)},children:e(D.X,{})})]}),e(U.Body,{children:d(M,{borderRadius:"inherit",children:[e(M,{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"&&U.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(k.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(D.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(k.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=>{U.close(t)}};export{E as TimeSelector,E as default};
|