mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
73 lines
9.4 KiB
JavaScript
73 lines
9.4 KiB
JavaScript
(("undefined"!=typeof globalThis?globalThis:self).makoChunk_antd=("undefined"!=typeof globalThis?globalThis:self).makoChunk_antd||[]).push([["9177d378"],{"1827d03d":function(e,t,r){"use strict";r.d(t,"__esModule",{value:!0}),r.d(t,"default",{enumerable:!0,get:function(){return s;}});var a=r("777fffbe"),n=r("f19d2b93");r("169d676f");var l=a._(r("072ab8a9"));r("2a5e301e");var o=r("a9d1a279"),d=a._(r("bb46b683"));l.default.extend(d.default);var s=()=>{let{token:e}=o.theme.useToken(),t={width:300,border:`1px solid ${e.colorBorderSecondary}`,borderRadius:e.borderRadiusLG};return(0,n.jsx)("div",{style:t,children:(0,n.jsx)(o.Calendar,{fullscreen:!1,headerRender:({value:e,type:t,onChange:r,onTypeChange:a})=>{let l=[],d=e.clone(),s=e.localeData(),i=[];for(let e=0;e<12;e++)d=d.month(e),i.push(s.monthsShort(d));for(let e=0;e<12;e++)l.push((0,n.jsx)(o.Select.Option,{value:e,className:"month-item",children:i[e]},e));let u=e.year(),c=e.month(),h=[];for(let e=u-10;e<u+10;e+=1)h.push((0,n.jsx)(o.Select.Option,{value:e,className:"year-item",children:e},e));return(0,n.jsxs)("div",{style:{padding:8},children:[(0,n.jsx)(o.Typography.Title,{level:4,children:"Custom header"}),(0,n.jsxs)(o.Row,{gutter:8,children:[(0,n.jsx)(o.Col,{children:(0,n.jsxs)(o.Radio.Group,{size:"small",onChange:e=>a(e.target.value),value:t,children:[(0,n.jsx)(o.Radio.Button,{value:"month",children:"Month"}),(0,n.jsx)(o.Radio.Button,{value:"year",children:"Year"})]})}),(0,n.jsx)(o.Col,{children:(0,n.jsx)(o.Select,{size:"small",popupMatchSelectWidth:!1,className:"my-year-select",value:u,onChange:t=>{r(e.clone().year(t));},children:h})}),(0,n.jsx)(o.Col,{children:(0,n.jsx)(o.Select,{size:"small",popupMatchSelectWidth:!1,value:c,onChange:t=>{r(e.clone().month(t));},children:l})})]})]});},onPanelChange:(e,t)=>{console.log(e.format("YYYY-MM-DD"),t);}})});};},"254d5ab0":function(e,t,r){"use strict";r.d(t,"__esModule",{value:!0}),r.d(t,"default",{enumerable:!0,get:function(){return h;}});var a=r("777fffbe"),n=r("f19d2b93");r("0f1d0b1d");var l=a._(r("5b220c3d")),o=r("a9d1a279"),d=r("3835a2b7"),s=a._(r("600aabe0")),i=a._(r("072ab8a9")),u=r("466fa8f0");let c=(0,d.createStyles)(({token:e,css:t,cx:r})=>{let a=t`
|
|
color: ${e.colorTextTertiary};
|
|
font-size: ${e.fontSizeSM}px;
|
|
`,n=t`
|
|
color: ${e.colorError};
|
|
&.gray {
|
|
opacity: 0.4;
|
|
}
|
|
`;return{wrapper:t`
|
|
width: 450px;
|
|
border: 1px solid ${e.colorBorderSecondary};
|
|
border-radius: ${e.borderRadiusOuter};
|
|
padding: 5px;
|
|
`,dateCell:t`
|
|
position: relative;
|
|
&:before {
|
|
content: '';
|
|
position: absolute;
|
|
inset-inline-start: 0;
|
|
inset-inline-end: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
margin: auto;
|
|
max-width: 40px;
|
|
max-height: 40px;
|
|
background: transparent;
|
|
transition: background-color 300ms;
|
|
border-radius: ${e.borderRadiusOuter}px;
|
|
border: 1px solid transparent;
|
|
box-sizing: border-box;
|
|
}
|
|
&:hover:before {
|
|
background: rgba(0, 0, 0, 0.04);
|
|
}
|
|
`,today:t`
|
|
&:before {
|
|
border: 1px solid ${e.colorPrimary};
|
|
}
|
|
`,text:t`
|
|
position: relative;
|
|
z-index: 1;
|
|
`,lunar:a,current:t`
|
|
color: ${e.colorTextLightSolid};
|
|
&:before {
|
|
background: ${e.colorPrimary};
|
|
}
|
|
&:hover:before {
|
|
background: ${e.colorPrimary};
|
|
opacity: 0.8;
|
|
}
|
|
.${r(a)} {
|
|
color: ${e.colorTextLightSolid};
|
|
opacity: 0.9;
|
|
}
|
|
.${r(n)} {
|
|
color: ${e.colorTextLightSolid};
|
|
}
|
|
`,monthCell:t`
|
|
width: 120px;
|
|
color: ${e.colorTextBase};
|
|
border-radius: ${e.borderRadiusOuter}px;
|
|
padding: 5px 0;
|
|
&:hover {
|
|
background: rgba(0, 0, 0, 0.04);
|
|
}
|
|
`,monthCellCurrent:t`
|
|
color: ${e.colorTextLightSolid};
|
|
background: ${e.colorPrimary};
|
|
&:hover {
|
|
background: ${e.colorPrimary};
|
|
opacity: 0.8;
|
|
}
|
|
`,weekend:n};});var h=()=>{let{styles:e}=c({test:!0}),[t,r]=l.default.useState((0,i.default)()),[a,d]=l.default.useState((0,i.default)()),h=e=>{let t=u.Lunar.fromDate(new Date(e+1,0));return`${t.getYearInChinese()}\u{5E74}\u{FF08}${t.getYearInGanZhi()}${t.getYearShengXiao()}\u{5E74}\u{FF09}`;},f=(e,t)=>{let r=u.Lunar.fromDate(new Date(t.year(),e)).getMonthInChinese();return`${e+1}\u{6708}\u{FF08}${r}\u{6708}\u{FF09}`;};return(0,n.jsx)("div",{className:e.wrapper,children:(0,n.jsx)(o.Calendar,{fullCellRender:(r,o)=>{let d=u.Lunar.fromDate(r.toDate()),c=d.getDayInChinese(),h=d.getJieQi(),f=6===r.day()||0===r.day(),g=u.HolidayUtil.getHoliday(r.get("year"),r.get("month")+1,r.get("date")),m=(null==g?void 0:g.getTarget())===(null==g?void 0:g.getDay())?null==g?void 0:g.getName():void 0;if("date"===o.type)return l.default.cloneElement(o.originNode,{...o.originNode.props,className:(0,s.default)(e.dateCell,{[e.current]:t.isSame(r,"date"),[e.today]:r.isSame((0,i.default)(),"date")}),children:(0,n.jsxs)("div",{className:e.text,children:[(0,n.jsx)("span",{className:(0,s.default)({[e.weekend]:f,gray:!a.isSame(r,"month")}),children:r.get("date")}),"date"===o.type&&(0,n.jsx)("div",{className:e.lunar,children:m||h||c})]})});if("month"===o.type){let a=u.Lunar.fromDate(new Date(r.get("year"),r.get("month"))).getMonthInChinese();return(0,n.jsxs)("div",{className:(0,s.default)(e.monthCell,{[e.monthCellCurrent]:t.isSame(r,"month")}),children:[r.get("month")+1,"\u6708\uFF08",a,"\u6708\uFF09"]});}},fullscreen:!1,onPanelChange:(e,t)=>{console.log(e.format("YYYY-MM-DD"),t),d(e);},onSelect:(e,t)=>{"date"===t.source&&r(e);},headerRender:({value:e,type:t,onChange:r,onTypeChange:a})=>{let l=[],d=e.clone(),s=e.localeData(),i=[];for(let e=0;e<12;e++)d=d.month(e),i.push(s.monthsShort(d));for(let t=0;t<12;t++)l.push({label:f(t,e),value:t});let u=e.year(),c=e.month(),g=[];for(let e=u-10;e<u+10;e+=1)g.push({label:h(e),value:e});return(0,n.jsxs)(o.Row,{justify:"end",gutter:8,style:{padding:8},children:[(0,n.jsx)(o.Col,{children:(0,n.jsx)(o.Select,{size:"small",popupMatchSelectWidth:!1,className:"my-year-select",value:u,options:g,onChange:t=>{r(e.clone().year(t));}})}),(0,n.jsx)(o.Col,{children:(0,n.jsx)(o.Select,{size:"small",popupMatchSelectWidth:!1,value:c,options:l,onChange:t=>{r(e.clone().month(t));}})}),(0,n.jsx)(o.Col,{children:(0,n.jsxs)(o.Radio.Group,{size:"small",onChange:e=>a(e.target.value),value:t,children:[(0,n.jsx)(o.Radio.Button,{value:"month",children:"\u6708"}),(0,n.jsx)(o.Radio.Button,{value:"year",children:"\u5E74"})]})})]});}})});};},"2b7fe20b":function(e,t,r){"use strict";r.d(t,"__esModule",{value:!0}),r.d(t,"default",{enumerable:!0,get:function(){return l;}});var a=r("f19d2b93");r("437b09ed");var n=r("a9d1a279"),l=()=>(0,a.jsx)(n.Calendar,{onPanelChange:(e,t)=>{console.log(e.format("YYYY-MM-DD"),t);}});},"8afc0b8d":function(e,t,r){"use strict";r.d(t,"__esModule",{value:!0}),r.d(t,"default",{enumerable:!0,get:function(){return d;}});var a=r("f19d2b93");r("853ad754");var n=r("a9d1a279");let l=e=>{let t=[];switch(e.date()){case 8:t=[{type:"warning",content:"This is warning event."},{type:"success",content:"This is usual event."}];break;case 10:t=[{type:"warning",content:"This is warning event."},{type:"success",content:"This is usual event."},{type:"error",content:"This is error event."}];break;case 15:t=[{type:"warning",content:"This is warning event"},{type:"success",content:"This is very long usual event......"},{type:"error",content:"This is error event 1."},{type:"error",content:"This is error event 2."},{type:"error",content:"This is error event 3."},{type:"error",content:"This is error event 4."}];}return t||[];},o=e=>{if(8===e.month())return 1394;};var d=()=>{let e=e=>{let t=o(e);return t?(0,a.jsxs)("div",{className:"notes-month",children:[(0,a.jsx)("section",{children:t}),(0,a.jsx)("span",{children:"Backlog number"})]}):null;},t=e=>{let t=l(e);return(0,a.jsx)("ul",{className:"events",children:t.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(n.Badge,{status:e.type,text:e.content})},e.content))});};return(0,a.jsx)(n.Calendar,{cellRender:(r,a)=>"date"===a.type?t(r):"month"===a.type?e(r):a.originNode});};},da87304f:function(e,t,r){"use strict";r.d(t,"__esModule",{value:!0}),r.d(t,"default",{enumerable:!0,get:function(){return l;}});var a=r("f19d2b93");r("fbf17e09");var n=r("a9d1a279"),l=()=>{let e=(e,t)=>{console.log(e.format("YYYY-MM-DD"),t);};return(0,a.jsxs)(n.ConfigProvider,{theme:{components:{Calendar:{fullBg:"red",fullPanelBg:"green",itemActiveBg:"black"}}},children:[(0,a.jsx)(n.Calendar,{onPanelChange:e}),(0,a.jsx)("br",{}),(0,a.jsx)(n.Calendar,{onPanelChange:e,fullscreen:!1})]});};},e8885d73:function(e,t,r){"use strict";r.d(t,"__esModule",{value:!0}),r.d(t,"default",{enumerable:!0,get:function(){return o;}});var a=r("f19d2b93");r("fd2a6204");var n=r("a9d1a279");let l=(e,t)=>{console.log(e.format("YYYY-MM-DD"),t);};var o=()=>{let{token:e}=n.theme.useToken(),t={width:300,border:`1px solid ${e.colorBorderSecondary}`,borderRadius:e.borderRadiusLG};return(0,a.jsx)("div",{style:t,children:(0,a.jsx)(n.Calendar,{fullscreen:!1,onPanelChange:l})});};},fd9ca1e1:function(e,t,r){"use strict";r.d(t,"__esModule",{value:!0}),r.d(t,"default",{enumerable:!0,get:function(){return s;}});var a=r("777fffbe"),n=r("f19d2b93");r("a0fb7dae");var l=r("5b220c3d"),o=r("a9d1a279"),d=a._(r("072ab8a9")),s=()=>{let[e,t]=(0,l.useState)(()=>(0,d.default)("2017-01-25")),[r,a]=(0,l.useState)(()=>(0,d.default)("2017-01-25"));return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.Alert,{message:`You selected date: ${null==r?void 0:r.format("YYYY-MM-DD")}`}),(0,n.jsx)(o.Calendar,{value:e,onSelect:e=>{t(e),a(e);},onPanelChange:e=>{t(e);}})]});};}}]); |