1 line
9.7 KiB
JavaScript
1 line
9.7 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[888],{1118:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return t(4926)}])},8846:function(e,r,t){"use strict";t.d(r,{N:function(){return c},W:function(){return l}});var o=t(5893),n=t(7294),s=t(9415);let i=(0,n.createContext)(null);function l(e){let{children:r}=e,[t,l]=(0,n.useState)(null),c=(0,n.useCallback)(e=>new Promise(r=>{l({title:e.title||"请确认操作",description:e.description||"",confirmText:e.confirmText||"确认",cancelText:e.cancelText||"取消",tone:e.tone||"danger",resolve:r})}),[]),a=(0,n.useCallback)(e=>{l(r=>(null==r||r.resolve(e),null))},[]),d=(0,n.useMemo)(()=>({confirm:c}),[c]);return(0,o.jsxs)(i.Provider,{value:d,children:[r,t?(0,o.jsx)("div",{className:"modal-overlay modal-overlay--center",onClick:()=>a(!1),children:(0,o.jsxs)("div",{className:"confirm-card",onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"confirm-title",children:[(0,o.jsx)("div",{className:"confirm-card__icon confirm-card__icon--".concat(t.tone),children:(0,o.jsx)(s.J,{name:"danger"===t.tone?"trash":"info",size:18})}),(0,o.jsxs)("div",{className:"confirm-card__body",children:[(0,o.jsx)("h2",{id:"confirm-title",children:t.title}),t.description?(0,o.jsx)("p",{children:t.description}):null]}),(0,o.jsxs)("div",{className:"confirm-card__actions",children:[(0,o.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:()=>a(!1),children:t.cancelText}),(0,o.jsx)("button",{type:"button",className:"btn ".concat("danger"===t.tone?"btn-danger":"btn-primary"),onClick:()=>a(!0),children:t.confirmText})]})]})}):null]})}function c(){let e=(0,n.useContext)(i);if(!e)throw Error("useConfirm must be used within ConfirmProvider");return e}},5546:function(e,r,t){"use strict";t.d(r,{V:function(){return l},p:function(){return c}});var o=t(5893),n=t(7294),s=t(9415);let i=(0,n.createContext)(null);function l(e){let{children:r}=e,[t,l]=(0,n.useState)([]),c=(0,n.useRef)(new Map),a=(0,n.useCallback)(e=>{let r=c.current.get(e);r&&(clearTimeout(r),c.current.delete(e)),l(r=>r.filter(r=>r.id!==e))},[]),d=(0,n.useCallback)(function(e){var r;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o="".concat(Date.now(),"-").concat(Math.random()),n={id:o,message:e,tone:t.tone||"info"};l(e=>[...e,n]);let s=setTimeout(()=>a(o),null!==(r=t.duration)&&void 0!==r?r:2600);return c.current.set(o,s),o},[a]),u=(0,n.useMemo)(()=>({showToast:d,removeToast:a}),[d,a]);return(0,o.jsxs)(i.Provider,{value:u,children:[r,(0,o.jsx)("div",{className:"toast-stack","aria-live":"polite","aria-atomic":"true",children:t.map(e=>(0,o.jsxs)("div",{className:"toast toast--".concat(e.tone),children:[(0,o.jsx)("span",{className:"toast__icon",children:(0,o.jsx)(s.J,{name:"success"===e.tone?"check":"error"===e.tone?"close":"info",size:16})}),(0,o.jsx)("span",{className:"toast__message",children:e.message}),(0,o.jsx)("button",{type:"button",className:"icon-button icon-button--ghost toast__close","aria-label":"关闭提示",onClick:()=>a(e.id),children:(0,o.jsx)(s.J,{name:"close",size:16})})]},e.id))})]})}function c(){let e=(0,n.useContext)(i);if(!e)throw Error("useToast must be used within ToastProvider");return e}},9415:function(e,r,t){"use strict";t.d(r,{J:function(){return i}});var o=t(5893),n=t(7294);let s={home:(0,o.jsx)("path",{d:"M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5.5v-6h-5v6H4a1 1 0 0 1-1-1v-9.5Z",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),chart:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("path",{d:"M4 20h16",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M7 16v-4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 16V8",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M17 16v-7",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]}),repeat:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("path",{d:"M17 3l4 4-4 4",fill:"none",str
|