beancount-gs/public/static/js/550.19e37c86.chunk.js

1 line
7.9 KiB
JavaScript

"use strict";(self.webpackChunkbeancount_web=self.webpackChunkbeancount_web||[]).push([[550],{2550:(e,t,n)=>{n.r(t),n.d(t,{default:()=>D});var s=n(9284),r=n(9379);const i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M288 421a48 48 0 1096 0 48 48 0 10-96 0zm352 0a48 48 0 1096 0 48 48 0 10-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 01248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 01249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 01775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 01775 775zM664 533h-48.1c-4.2 0-7.8 3.2-8.1 7.4C604 589.9 562.5 629 512 629s-92.1-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 00-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 00-8-8.4z"}}]},name:"smile",theme:"outlined"};var a=n(3768),o=function(e,t){return s.createElement(a.A,(0,r.A)((0,r.A)({},e),{},{ref:t,icon:i}))};const l=s.forwardRef(o);var c=n(2069),d=n(2475),p=n(1896),h=n(7691),m=n(8168),u=n(4467),v=n(5547),y=n(4480),f=n.n(y),g=n(3135),x=n(7458),A=function(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]])}return n};const b=function(e){var t=e.prefixCls,n=e.className,r=e.color,i=void 0===r?"blue":r,a=e.dot,o=e.pending,l=void 0!==o&&o,c=(e.position,e.label),d=e.children,p=A(e,["prefixCls","className","color","dot","pending","position","label","children"]),h=(0,s.useContext(g.QO).getPrefixCls)("timeline",t),v=f()((0,u.A)((0,u.A)({},"".concat(h,"-item"),!0),"".concat(h,"-item-pending"),l),n),y=f()((0,u.A)((0,u.A)((0,u.A)({},"".concat(h,"-item-head"),!0),"".concat(h,"-item-head-custom"),!!a),"".concat(h,"-item-head-").concat(i),!0)),x=/blue|red|green|gray/.test(i||"")?void 0:i;return s.createElement("li",(0,m.A)({},p,{className:v}),c&&s.createElement("div",{className:"".concat(h,"-item-label")},c),s.createElement("div",{className:"".concat(h,"-item-tail")}),s.createElement("div",{className:y,style:{borderColor:x,color:x}},a),s.createElement("div",{className:"".concat(h,"-item-content")},d))};var C=function(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]])}return n},j=function(e){var t=s.useContext(g.QO),n=t.getPrefixCls,r=t.direction,i=e.prefixCls,a=e.pending,o=void 0===a?null:a,l=e.pendingDot,c=e.children,d=e.className,p=e.reverse,h=void 0!==p&&p,y=e.mode,A=void 0===y?"":y,j=C(e,["prefixCls","pending","pendingDot","children","className","reverse","mode"]),O=n("timeline",i),w="boolean"===typeof o?null:o,N=o?s.createElement(b,{pending:!!o,dot:l||s.createElement(v.A,null)},w):null,E=s.Children.toArray(c);E.push(N),h&&E.reverse();var S=function(e,t){return"alternate"===A?"right"===e.props.position?"".concat(O,"-item-right"):"left"===e.props.position?"".concat(O,"-item-left"):"".concat(O,t%2===0?"-item-left":"-item-right"):"left"===A?"".concat(O,"-item-left"):"right"===A||"right"===e.props.position?"".concat(O,"-item-right"):""},T=E.filter((function(e){return!!e})),M=s.Children.count(T),I="".concat(O,"-item-last"),P=s.Children.map(T,(function(e,t){var n=t===M-2?I:"",s=t===M-1?I:"";return(0,x.Ob)(e,{className:f()([e.props.className,!h&&o?n:s,S(e,t)])})})),Y=E.some((function(e){var t;return!!(null===(t=null===e||void 0===e?void 0:e.props)||void 0===t?void 0:t.label)})),z=f()(O,(0,u.A)((0,u.A)((0,u.A)((0,u.A)((0,u.A)({},"".concat(O,"-pending"),!!o),"".concat(O,"-reverse"),!!h),"".concat(O,"-").concat(A),!!A&&!Y),"".concat(O,"-label"),Y),"".concat(O,"-rtl"),"rtl"===r),d);return s.createElement("ul",(0,m.A)({},j,{className:z}),P)};j.Item=b;const O=j;var w=n(8409),N=n.n(w),E=n(6668),S=n(1619),T=n(2942),M=n(9636),I=n(4760),P=n(712);const Y={required:"${label} \u4e0d\u80fd\u4e3a\u7a7a\uff01"},z=e=>{const[t]=E.A.useForm(),[n,r]=(0,s.useState)(!1);return(0,P.jsx)("div",{className:"add-event-drawer component",children:(0,P.jsx)(S.A,{title:"\u65b0\u589e\u4e8b\u4ef6",placement:"bottom",closable:!0,height:"60vh",className:"page-drawer",bodyStyle:{display:"flex",justifyContent:"center"},forceRender:!0,...e,children:(0,P.jsx)("div",{className:"page-form",children:(0,P.jsxs)(E.A,{name:"add-event-form",className:"page-form",size:"large",style:{textAlign:"left"},form:t,onFinish:()=>{const n=t.getFieldsValue();r(!0),(0,I.hd)("/api/auth/event",{method:"POST",body:n}).then((n=>{t.resetFields(),e.onClose(n)})).catch(console.error).finally((()=>{r(!1)}))},validateMessages:Y,children:[(0,P.jsx)(E.A.Item,{name:"date",initialValue:N()().format("YYYY-MM-DD"),rules:[{required:!0}],children:(0,P.jsx)(T.A,{type:"date",placeholder:"\u65f6\u95f4"})}),(0,P.jsx)(E.A.Item,{name:"types",rules:[{required:!0}],children:(0,P.jsx)(M.A,{mode:"tags",allowClear:!0,placeholder:"\u4e8b\u4ef6\u540d\u79f0",options:(e.types||[]).map((e=>({label:e,value:e})))})}),(0,P.jsx)(E.A.Item,{name:"description",rules:[{required:!0}],children:(0,P.jsx)(T.A,{placeholder:"\u4e8b\u4ef6\u5185\u5bb9"})}),(0,P.jsx)(E.A.Item,{children:(0,P.jsx)(p.A,{type:"primary",htmlType:"submit",loading:n,className:"submit-button",children:"\u4fdd\u5b58"})})]})})})})};var L=n(9811);class k extends s.Component{constructor(){super(...arguments),this.theme=this.context.theme,this.currentMonth=N()().format("YYYY-M"),this.eventTypeList=[],this.eventTypes=[],this.state={loading:!1,events:[],selectedMonth:this.currentMonth,drawerOpen:!1},this.handleOpenAddrawer=()=>{this.setState({drawerOpen:!0})},this.handleCloseAddDrawer=e=>{e&&e instanceof Array&&this.setState({events:[...this.state.events,...e]},(()=>{this.formatEventTypeList(this.state.events)})),this.setState({drawerOpen:!1})},this.formatEventTypeList=e=>{const t={};e.forEach((e=>{let{date:n,type:s,description:r}=e;t[s]?t[s].push({date:n,type:s,description:r}):t[s]=[{date:n,type:s,description:r}]})),this.eventTypeList=[],this.eventTypes=Object.keys(t).sort(),this.eventTypes.forEach((e=>{this.eventTypeList.push({type:e,events:t[e]||[]})}))},this.getAllEvents=()=>{this.setState({loading:!0}),(0,I.hd)("/api/auth/event/all").then((e=>{this.setState({events:e},(()=>{this.formatEventTypeList(e)}))})).catch(console.error).finally((()=>{this.setState({loading:!1})}))}}componentDidMount(){this.getAllEvents()}render(){return this.context.theme!==this.theme&&(this.theme=this.context.theme),(0,P.jsxs)("div",{className:"event-page",children:[(0,P.jsx)(z,{open:this.state.drawerOpen,types:this.eventTypes,onClose:this.handleCloseAddDrawer}),(0,P.jsx)("div",{className:"top-wrapper",children:(0,P.jsx)("div",{children:(0,P.jsx)(p.A,{size:"small",icon:(0,P.jsx)(l,{}),onClick:this.handleOpenAddrawer,children:"\u8bb0\u5f55\u4e8b\u4ef6"})})}),(0,P.jsx)("div",{children:this.state.loading?(0,P.jsx)(L.A,{}):(0,P.jsx)(h.A,{defaultActiveKey:"1",items:this.eventTypeList.map((e=>{let{type:t,events:n}=e;return{label:t,key:t,children:(0,P.jsx)(O,{children:n.map((e=>{let{date:t,description:n}=e;return(0,P.jsxs)(O.Item,{children:[n,(0,P.jsx)("span",{style:{fontSize:"12px",marginLeft:"10px",color:"gray"},children:t})]})}))})}}))})})]})}}k.contextType=d.A;const D=(0,c.A)(k)},2069:(e,t,n)=>{n.d(t,{A:()=>i});var s=n(9284),r=n(712);const i=e=>class extends s.Component{constructor(){super(...arguments),this.defaultCommodity={currency:"CNY",symbol:"\uffe5"},this.currentCommodity=window.localStorage.getItem("ledgerCurrency")}render(){return(0,r.jsx)(e,{...this.props,commodity:this.currentCommodity?JSON.parse(this.currentCommodity):this.defaultCommodity})}}}}]);