@next-bricks/advanced 0.36.0 → 0.36.1

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.
@@ -1,2 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_next_bricks_advanced=globalThis.webpackChunk_next_bricks_advanced||[]).push([[9326],{55319:(e,t,r)=>{r.r(t),r.d(t,{EoWorkbenchLayout:()=>K,EoWorkbenchLayoutComponent:()=>O});var a,i=r(74635),n=r(70918),o=r(26902),s=r(5536),l=r(86121),c=r(70829),d=r(62740),p=r(18769),h=r.n(p),g=r(24782),m=r(91389),u=r(62518),b=r(6055),w=(r(59772),r(45833)),v=r(91116);let y,f,x,k,z,A,E,C,M,I,L,N,W,B,D,H,T,R,S,Z,P,j;const{defineElement:G,property:_,event:Y,method:Q}=(0,g.createDecorators)(),F=(0,m.wrapBrick)("eo-button"),$=(0,m.wrapBrick)("eo-dropdown-button",{onActionClick:"action.click"}),J=(0,m.wrapBrick)("eo-icon"),U=(0,m.wrapBrick)("eo-checkbox",{onChange:"change"}),X=e=>null!=e&&e.includes(":")?e.split(":")[0]:e,{isAdmin:q}=b.auth.getAuth(),O=(0,p.forwardRef)((function(e,t){let{cardTitle:r="卡片列表",layouts:a,componentList:i=[],isEdit:n,onSave:o,onCancel:s,onActionClick:l}=e;const c=(0,p.useMemo)((()=>(0,w.WidthProvider)(w.Responsive)),[]),d=(0,p.useRef)(null),g=(0,p.useRef)(),m=(0,p.useRef)(null),[b,v]=(0,p.useState)(a??[]),[y,f]=(0,p.useState)(3),[x,k]=(0,p.useState)();(0,p.useImperativeHandle)(t,(()=>({setLayouts:v})));const z=(0,p.useCallback)((e=>{g.current||(g.current=e);let t=!0;for(let r=0;r<e.length;r++){const{x:a,w:i,y:n,h:o,i:s,minH:l}=e[r];if(i>1&&a>0){t=!1;break}if(1===i&&a<2){const t=e.find((e=>e.i!==s&&1===e.w&&e.y===n&&a<2));t&&(e[r].minH=e[r].minH??o,e[r].h=Math.max(t.h,o))}else e[r].h=l??o,e[r].minH=void 0}t?g.current=e:v((e=>null==e?void 0:e.map((e=>{var t;return{...null===(t=g.current)||void 0===t?void 0:t.find((t=>X(t.i)===X(e.i))),i:`${X(e.i)}:${Math.random()}`}}))))}),[]),A=(0,p.useCallback)((e=>{const t=e.detail.map((e=>e.value)),r=b.map((e=>X(e.i))),a=e.detail.filter((e=>!r.includes(e.key))).map((e=>({...e.position,x:e.w>1?0:2*b.length%y,y:1/0})));v((e=>e.filter((e=>t.includes(X(e.i)))).concat(a)))}),[b,y]),E=(0,p.useCallback)((()=>{null==o||o((g.current??[]).map((e=>({...e,i:X(e.i)}))))}),[o]),C=(0,p.useCallback)(((e,t)=>{var r;e.stopPropagation(),v((null===(r=g.current)||void 0===r?void 0:r.filter((e=>X(e.i)!==t.key)))??[])}),[]),M=e=>{e.preventDefault()},I=(0,p.useMemo)((()=>b.map((e=>{const t=i.find((t=>t.key===X(e.i)));return t?h().createElement("div",{key:e.i,"data-grid":{...t.position??{},...e},style:t.style,className:"drag-box"},n&&h().createElement("div",{className:"edit-mask",onMouseDown:M}),h().createElement(u.ReactUseBrick,{useBrick:t.useBrick}),n&&h().createElement(J,{icon:"delete",lib:"antd",className:"delete-icon",onClick:e=>C(e,t)})):null})).filter(Boolean)),[i,C,b,n]),L=(0,p.useMemo)((()=>i.map((e=>({...e,label:e.title,value:e.key})))),[i]),N=(0,p.useMemo)((()=>b.map((e=>X(e.i)))),[b]),W=(0,p.useCallback)((()=>{if(m&&n){var e;const{top:t}=(null===(e=m.current)||void 0===e||null===(e=e.getClientRects())||void 0===e?void 0:e[0])??{};void 0!==t&&k({height:document.body.clientHeight-t,overflow:"scroll"})}}),[n]);return(0,p.useEffect)((()=>{if(n)return W(),v(a||[]),window.addEventListener("resize",W),()=>{window.removeEventListener("resize",W)}}),[n,W,a]),h().createElement("div",{className:"grid-layout-wrapper",ref:d},n&&h().createElement("div",{className:"component-wrapper"},h().createElement("div",{className:"component-title"},r),h().createElement("div",{className:"component-list"},h().createElement(U,{options:L,value:N,onChange:A}),h().createElement("slot",{name:"toolbar"}))),h().createElement("div",{className:"layout-wrapper",ref:m,style:x},n&&h().createElement("div",{className:"actions-wrapper"},h().createElement(F,{type:"primary",onClick:E},"保存"),h().createElement(F,{onClick:()=>{null==s||s()}},"取消"),h().createElement($,{btnText:"更多",icon:{lib:"antd",icon:"down"},actions:[...q?[{text:"另存为模板",event:"saveAsTemplate"}]:[],{text:"从模版加载",event:"loadFromTemplate"},{text:"清除",danger:!0,event:"clear"}],onActionClick:e=>{(e=>{const{event:t}=e;"clear"===t?v([]):null==l||l(e,b)})(e.detail)},"data-testid":"edit-layout-actions"})),h().createElement(c,{className:"layout",draggableCancel:".delete-icon,.edit-actions,.ingore-item",breakpoints:{lg:1300,md:1024,sm:768},rowHeight:1,cols:{lg:3,md:3,sm:1},isResizable:!1,isDraggable:n,onDrag:(e,t,r)=>{var a;const i=null===(a=d.current)||void 0===a?void 0:a.querySelector(".react-grid-placeholder");i&&(r.w>1&&r.x>0?!i.classList.contains("forbidden")&&i.classList.add("forbidden"):i.classList.contains("forbidden")&&i.classList.remove("forbidden"))},onLayoutChange:z,onBreakpointChange:(e,t)=>{f(t)}},I)))}));let K;var V=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ae=new WeakMap,ie=new WeakMap,ne=new WeakSet,oe=new WeakMap,se=new WeakMap,le=new WeakMap,ce=new WeakMap,de=new WeakMap;class pe extends m.ReactNextElement{constructor(){super(...arguments),(0,i.A)(this,ne),(0,n.A)(this,V,(y(this),(0,p.createRef)())),(0,n.A)(this,ee,x(this)),(0,n.A)(this,te,(k(this),z(this))),(0,n.A)(this,re,(A(this),E(this))),(0,n.A)(this,ae,(C(this),M(this))),(0,n.A)(this,ie,(I(this),L(this))),(0,n.A)(this,oe,(B(this),e=>{(0,s.A)(ne,this,N).emit(e)})),(0,n.A)(this,se,D(this)),(0,n.A)(this,le,(R(this),()=>{(0,s.A)(ne,this,H).emit()})),(0,n.A)(this,ce,S(this)),(0,n.A)(this,de,(j(this),(e,t)=>{(0,s.A)(ne,this,Z).emit({action:e,layouts:t}),e.event&&this.dispatchEvent(new CustomEvent(e.event,{detail:t}))}))}get cardTitle(){return(0,c.A)(ee,this)}set cardTitle(e){(0,l.A)(ee,this,e)}get isEdit(){return(0,c.A)(te,this)}set isEdit(e){(0,l.A)(te,this,e)}get layouts(){return(0,c.A)(re,this)}set layouts(e){(0,l.A)(re,this,e)}get componentList(){return(0,c.A)(ae,this)}set componentList(e){(0,l.A)(ae,this,e)}setLayouts(e){var t;null===(t=(0,c.A)(V,this).current)||void 0===t||t.setLayouts(e)}render(){return h().createElement(O,{cardTitle:this.cardTitle,layouts:this.layouts,componentList:this.componentList,isEdit:this.isEdit,onSave:(0,c.A)(oe,this),onCancel:(0,c.A)(le,this),onActionClick:(0,c.A)(de,this),ref:(0,c.A)(V,this)})}}a=pe,({e:[x,k,z,A,E,C,M,I,L,N,W,B,D,H,T,R,S,Z,P,j,y],c:[K,f]}=(0,d.A)(a,[G("eo-workbench-layout",{styleTexts:[v.A]})],[[_(),1,"cardTitle"],[_({type:Boolean}),1,"isEdit"],[_({attribute:!1}),1,"layouts"],[_({attribute:!1}),1,"componentList"],[Y({type:"save"}),1,"saveLayoutEvent",e=>(0,c.A)(ie,e),(e,t)=>(0,l.A)(ie,e,t)],[Y({type:"cancel"}),1,"cancelEvent",e=>(0,c.A)(se,e),(e,t)=>(0,l.A)(se,e,t)],[Y({type:"action.click"}),1,"actionClickEvent",e=>(0,c.A)(ce,e),(e,t)=>(0,l.A)(ce,e,t)],[Q(),2,"setLayouts"]],0,(e=>de.has((0,o.A)(e))),m.ReactNextElement)),f()},91116:(e,t,r)=>{r.d(t,{A:()=>d});var a=r(36758),i=r.n(a),n=r(40935),o=r.n(n),s=r(34566),l=r(16322),c=o()(i());c.i(s.A),c.i(l.A),c.push([e.id,":host{display:block}:host([hidden]){display:none}.grid-layout-wrapper{display:flex;height:100%;position:relative}.grid-layout-wrapper .component-wrapper{width:150px;padding:6px 12px;overflow-y:scroll;box-shadow:1px 0 0 0 var(--palette-gray-5);background:var(--color-fill-bg-container-1);z-index:999;position:sticky;top:0}.grid-layout-wrapper .component-wrapper .component-title{font-size:16px;padding:6px 0;font-weight:500}.grid-layout-wrapper .component-wrapper .component-list{margin-top:6px}.grid-layout-wrapper .component-wrapper .component-list eo-checkbox::part(checkbox-wrapper){display:flex;flex-wrap:wrap;gap:8px}.grid-layout-wrapper .component-wrapper .component-list eo-checkbox::part(checkbox-option){margin-left:0;width:100%;background:none}.grid-layout-wrapper .layout-wrapper{flex:1}.grid-layout-wrapper .layout-wrapper .layout{max-width:1300px;margin:0 auto}.grid-layout-wrapper .layout-wrapper .actions-wrapper{position:sticky;top:0;z-index:999;margin-left:1px;display:flex;gap:8px;justify-content:flex-end;background:var(--color-fill-bg-container-1);padding:8px 12px;box-shadow:0 1px 1px 0 var(--palette-gray-5)}.grid-layout-wrapper .layout-wrapper .edit-mask{position:absolute;left:0;right:0;top:45px;bottom:0;z-index:10}.grid-layout-wrapper .layout-wrapper .delete-icon{position:absolute;right:15px;top:15px;cursor:pointer;font-size:16px;width:30px;height:30px;display:flex;justify-content:center;align-items:center;background:var(--color-fill-bg-container-1);color:var(--color-normal-text)}.grid-layout-wrapper .layout-wrapper .delete-icon:hover{color:var(--color-error)}.grid-layout-wrapper .layout-wrapper .delete-icon:active{color:var(--color-error-active)}.react-grid-item.react-grid-placeholder{background-color:#ddd}.react-grid-item.react-draggable-dragging{pointer-events:none}.react-grid-item.react-grid-placeholder.forbidden{background-color:red}",""]);const d=c.toString()},34566:(e,t,r)=>{r.d(t,{A:()=>s});var a=r(36758),i=r.n(a),n=r(40935),o=r.n(n)()(i());o.push([e.id,'.react-grid-layout{position:relative;transition:height 200ms ease}.react-grid-item{transition:all 200ms ease;transition-property:left,top,width,height}.react-grid-item img{pointer-events:none;-webkit-user-select:none;user-select:none}.react-grid-item.cssTransforms{transition-property:transform,width,height}.react-grid-item.resizing{transition:none;z-index:1;will-change:width,height}.react-grid-item.react-draggable-dragging{transition:none;z-index:3;will-change:transform}.react-grid-item.dropping{visibility:hidden}.react-grid-item.react-grid-placeholder{background:red;opacity:0.2;transition-duration:100ms;z-index:2;-webkit-user-select:none;-o-user-select:none;user-select:none}.react-grid-item.react-grid-placeholder.placeholder-resizing{transition:none}.react-grid-item > .react-resizable-handle{position:absolute;width:20px;height:20px}.react-grid-item > .react-resizable-handle::after{content:"";position:absolute;right:3px;bottom:3px;width:5px;height:5px;border-right:2px solid rgba(0,0,0,0.4);border-bottom:2px solid rgba(0,0,0,0.4)}.react-resizable-hide > .react-resizable-handle{display:none}.react-grid-item > .react-resizable-handle.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-grid-item > .react-resizable-handle.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-w,\n.react-grid-item > .react-resizable-handle.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-grid-item > .react-resizable-handle.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-n,\n.react-grid-item > .react-resizable-handle.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-grid-item > .react-resizable-handle.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}',""]);const s=o.toString()},16322:(e,t,r)=>{r.d(t,{A:()=>h});var a=r(36758),i=r.n(a),n=r(40935),o=r.n(n),s=r(20062),l=r.n(s),c=new URL(r(59224),r.b),d=o()(i()),p=l()(c);d.push([e.id,`.react-resizable{position:relative}.react-resizable-handle{position:absolute;width:20px;height:20px;background-repeat:no-repeat;background-origin:content-box;box-sizing:border-box;background-image:url(${p});background-position:bottom right;padding:0 3px 3px 0}.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-resizable-handle-w,\n.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-resizable-handle-n,\n.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}`,""]);const h=d.toString()},59224:e=>{e.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+"},5536:(e,t,r)=>{r.d(t,{A:()=>i});var a=r(12559);function i(e,t,r){return r((0,a.A)(e,t))}},74635:(e,t,r)=>{r.d(t,{A:()=>i});var a=r(72016);function i(e,t){(0,a.A)(e,t),t.add(e)}}}]);
2
- //# sourceMappingURL=eo-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IAAA,CAODlM,EAAM,CACLoH,KAAM,WACN,gBAAA4F,IAAAf,EAAAA,EAAAA,GAAAlC,GAAAiD,GAAA,CAAAA,EAAAd,KAAAC,EAAAA,EAAAA,GAAApC,GAAAiD,EAAAd,IAAA,CAcDlM,EAAM,CACLoH,KAAM,iBACN,qBAAA4F,IAAAf,EAAAA,EAAAA,GAAAhC,GAAA+C,GAAA,CAAAA,EAAAd,KAAAC,EAAAA,EAAAA,GAAAlC,GAAA+C,EAAAd,IAAA,CAYDjM,IAAQ,oBAAAgN,GAAA/C,GAAAgD,KAAAC,EAAAA,EAAAA,GAAAF,KA5DqB7C,EAAAA,mBAAgBuC,G,qGCvZ5CS,EAA0B,IAA4B,KAC1DA,EAAwB9J,EAAE,KAC1B8J,EAAwB9J,EAAE,KAE1B8J,EAAwBC,KAAK,CAACC,EAAOC,GAAI,u1DAAw1D,KAEj4D,QAAeH,EAAwBI,U,sECRnCJ,E,MAA0B,GAA4B,KAE1DA,EAAwBC,KAAK,CAACC,EAAOC,GAAI,8yEAEkR,KAE3T,QAAeH,EAAwBI,U,mGCLnCC,EAAgC,IAAIC,IAAI,cACxCN,EAA0B,IAA4B,KACtDO,EAAqC,IAAgCF,GAEzEL,EAAwBC,KAAK,CAACC,EAAOC,GAAI,4MAA4MI,4xBAExD,KAE7L,QAAeP,EAAwBI,U,ubCXxB,SAASnC,EAAoBuC,EAAGC,EAAGC,GAChD,OAAOA,GAAE,OAAiBF,EAAGC,GAC/B,C,kDCFe,SAAStD,EAA4BwD,EAAKC,IACvD,OAA0BD,EAAKC,GAC/BA,EAAWnF,IAAIkF,EACjB,C","sources":["webpack:///./src/workbench-layout/index.tsx","webpack:///./src/workbench-layout/styles.shadow.css","webpack:///../../node_modules/react-grid-layout/css/styles.css?4a73","webpack:///../../node_modules/react-resizable/css/styles.css?e4a4","webpack:///../../node_modules/@babel/runtime/helpers/esm/classPrivateGetter.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js"],"sourcesContent":["import React, {\n createRef,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { EventEmitter, createDecorators } from \"@next-core/element\";\nimport { ReactNextElement, wrapBrick } from \"@next-core/react-element\";\nimport { UseSingleBrickConf } from \"@next-core/types\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport { auth } from \"@next-core/easyops-runtime\";\nimport \"@next-core/theme\";\nimport {\n ItemCallback,\n Layout,\n Responsive,\n WidthProvider,\n} from \"react-grid-layout\";\nimport styleText from \"./styles.shadow.css\";\nimport type {\n GeneralIcon,\n GeneralIconProps,\n} from \"@next-bricks/icons/general-icon\";\nimport type { Button, ButtonProps } from \"@next-bricks/basic/button\";\nimport {\n DropdownButton,\n DropdownButtonEvents,\n DropdownButtonEventsMap,\n DropdownButtonProps,\n} from \"@next-bricks/basic/dropdown-button\";\nimport type {\n Checkbox,\n CheckboxOptionType,\n CheckboxProps,\n} from \"@next-bricks/form/checkbox\";\nimport { SimpleAction } from \"@next-bricks/basic/actions\";\n\nconst { defineElement, property, event, method } = createDecorators();\n\ntype Item = {\n position: Layout;\n key: string;\n title: string;\n style?: React.CSSProperties;\n useBrick: UseSingleBrickConf;\n};\n\ninterface CheckboxEvents {\n change: CustomEvent<CheckboxOptionType[]>;\n}\n\ninterface CheckboxEventsMap {\n onChange: \"change\";\n}\n\nconst WrappedButton = wrapBrick<Button, ButtonProps>(\"eo-button\");\nconst WrappedDropdownButton = wrapBrick<\n DropdownButton,\n DropdownButtonProps,\n DropdownButtonEvents,\n DropdownButtonEventsMap\n>(\"eo-dropdown-button\", {\n onActionClick: \"action.click\",\n});\nconst WrappedIcon = wrapBrick<GeneralIcon, GeneralIconProps>(\"eo-icon\");\nconst WrappedCheckbox = wrapBrick<\n Checkbox,\n CheckboxProps,\n CheckboxEvents,\n CheckboxEventsMap\n>(\"eo-checkbox\", {\n onChange: \"change\",\n});\n\nexport interface EoWorkbenchLayoutProps {\n cardTitle?: string;\n layouts?: Layout[];\n componentList?: Item[];\n isEdit?: boolean;\n}\n\nexport interface EoWorkbenchLayoutComponentRef {\n setLayouts(layouts: Layout[]): void;\n}\n\nexport interface EoWorkbenchLayoutComponentProps\n extends EoWorkbenchLayoutProps {\n onSave?: (layout: Layout[]) => void;\n onCancel?: () => void;\n onActionClick?: (action: SimpleAction, layouts: Layout[]) => void;\n}\n\nconst getRealKey = (key: string): string =>\n key?.includes(\":\") ? key.split(\":\")[0] : key;\nconst { isAdmin } = auth.getAuth();\n\nexport const EoWorkbenchLayoutComponent = forwardRef<\n EoWorkbenchLayoutComponentRef,\n EoWorkbenchLayoutComponentProps\n>(function EoWorkbenchLayoutComponent(\n {\n cardTitle = \"卡片列表\",\n layouts: layoutsProps,\n componentList = [],\n isEdit,\n onSave,\n onCancel,\n onActionClick,\n },\n ref\n) {\n const ResponsiveReactGridLayout = useMemo(\n () => WidthProvider(Responsive),\n []\n );\n const gridLayoutRef = useRef<HTMLDivElement>(null);\n const layoutCacheRef = useRef<Layout[]>();\n const layoutWrapperRef = useRef<HTMLDivElement>(null);\n\n const [layouts, setLayouts] = useState<Layout[]>(layoutsProps ?? []);\n const [cols, setCols] = useState<number>(3);\n const [layoutWrapperStyle, setLayoutWrapperStyle] =\n useState<React.CSSProperties>();\n\n useImperativeHandle(ref, () => ({\n setLayouts,\n }));\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const handleDragCallback: ItemCallback = (layout, oldItem, newItem) => {\n const placeholderDOM = gridLayoutRef.current?.querySelector(\n \".react-grid-placeholder\"\n );\n if (placeholderDOM) {\n if (newItem.w > 1 && newItem.x > 0) {\n !placeholderDOM.classList.contains(\"forbidden\") &&\n placeholderDOM.classList.add(\"forbidden\");\n } else {\n placeholderDOM.classList.contains(\"forbidden\") &&\n placeholderDOM.classList.remove(\"forbidden\");\n }\n }\n };\n\n const handleLayoutChange = useCallback((currentLayout: Layout[]) => {\n if (!layoutCacheRef.current) {\n layoutCacheRef.current = currentLayout;\n }\n let isAllowAction = true;\n for (let t = 0; t < currentLayout.length; t++) {\n const { x, w, y, h, i, minH } = currentLayout[t];\n if (w > 1 && x > 0) {\n isAllowAction = false;\n break;\n }\n if (w === 1 && x < 2) {\n const matchItem = currentLayout.find(\n (item) => item.i !== i && item.w === 1 && item.y === y && x < 2\n );\n if (matchItem) {\n currentLayout[t].minH = currentLayout[t].minH ?? h;\n currentLayout[t].h = Math.max(matchItem.h, h);\n }\n } else {\n currentLayout[t].h = minH ?? h;\n currentLayout[t].minH = undefined;\n }\n }\n if (!isAllowAction) {\n setLayouts((items) =>\n items?.map((item) => {\n const matchLayout = layoutCacheRef.current?.find(\n (layout) => getRealKey(layout.i) === getRealKey(item.i)\n );\n // should update key to refresh layout\n const key = `${getRealKey(item.i)}:${Math.random()}`;\n return {\n ...matchLayout,\n i: key,\n } as Layout;\n })\n );\n return;\n }\n\n layoutCacheRef.current = currentLayout;\n }, []);\n\n const handleBreakpointChange = (_newBreakpoint: string, newCols: number) => {\n setCols(newCols);\n };\n\n const handleCheckBoxChange = useCallback(\n (event: CustomEvent<CheckboxOptionType[]>): void => {\n const checkedKeys = event.detail.map((item) => item.value);\n const layoutsKeys = layouts.map((item) => getRealKey(item.i));\n const addItems = event.detail\n .filter((item) => !layoutsKeys.includes(item.key))\n .map((item) => ({\n ...item.position,\n x: item.w > 1 ? 0 : (layouts.length * 2) % cols,\n y: Infinity,\n }));\n\n setLayouts((layouts) => {\n return layouts\n .filter((layout) => checkedKeys.includes(getRealKey(layout.i)))\n .concat(addItems);\n });\n },\n [layouts, cols]\n );\n\n const handleClearLayout = () => {\n setLayouts([]);\n };\n\n const handleSave = useCallback(() => {\n onSave?.(\n (layoutCacheRef.current ?? []).map((item) => ({\n ...item,\n i: getRealKey(item.i),\n }))\n );\n }, [onSave]);\n\n const handleCancel = () => {\n onCancel?.();\n };\n\n const handleActionClick = (action: SimpleAction) => {\n const { event } = action;\n\n switch (event) {\n case \"clear\":\n handleClearLayout();\n break;\n default:\n onActionClick?.(action, layouts);\n }\n };\n\n const handleDeleteItem = useCallback(\n (e: React.MouseEvent, deteleItem: Item) => {\n e.stopPropagation();\n setLayouts(\n layoutCacheRef.current?.filter(\n (item) => getRealKey(item.i) !== deteleItem.key\n ) ?? []\n );\n },\n []\n );\n\n const handleEditMaskClcik = (e: React.MouseEvent) => {\n e.preventDefault();\n };\n\n const renderChild = useMemo(\n () =>\n layouts\n .map((layout) => {\n const component = componentList.find(\n (item) => item.key === getRealKey(layout.i)\n );\n if (!component) {\n return null;\n }\n return (\n <div\n key={layout.i}\n data-grid={{\n ...(component.position ?? {}),\n ...layout,\n }}\n style={component.style}\n className=\"drag-box\"\n >\n {isEdit && (\n <div className=\"edit-mask\" onMouseDown={handleEditMaskClcik} />\n )}\n <ReactUseBrick useBrick={component.useBrick} />\n {isEdit && (\n <WrappedIcon\n icon=\"delete\"\n lib=\"antd\"\n className=\"delete-icon\"\n onClick={(e) => handleDeleteItem(e, component)}\n />\n )}\n </div>\n );\n })\n .filter(Boolean),\n [componentList, handleDeleteItem, layouts, isEdit]\n );\n\n const computedOptions = useMemo(\n () =>\n componentList.map((item) => ({\n ...item,\n label: item.title,\n value: item.key,\n })),\n [componentList]\n );\n\n const computedSelectedComponentKeys = useMemo(\n () => layouts.map((layout) => getRealKey(layout.i)),\n [layouts]\n );\n\n const handleWatchLayoutSizeChange = useCallback(() => {\n if (layoutWrapperRef && isEdit) {\n const { top } =\n layoutWrapperRef.current?.getClientRects()?.[0] ?? ({} as DOMRect);\n top !== undefined &&\n setLayoutWrapperStyle({\n height: document.body.clientHeight - top,\n overflow: \"scroll\",\n });\n }\n }, [isEdit]);\n\n useEffect(() => {\n if (isEdit) {\n handleWatchLayoutSizeChange();\n setLayouts(layoutsProps || []); // 编辑的情况下需要动态改变一些布局\n window.addEventListener(\"resize\", handleWatchLayoutSizeChange);\n\n return () => {\n window.removeEventListener(\"resize\", handleWatchLayoutSizeChange);\n };\n }\n }, [isEdit, handleWatchLayoutSizeChange, layoutsProps]);\n\n return (\n <div className=\"grid-layout-wrapper\" ref={gridLayoutRef}>\n {isEdit && (\n <div className=\"component-wrapper\">\n <div className=\"component-title\">{cardTitle}</div>\n <div className=\"component-list\">\n <WrappedCheckbox\n options={computedOptions}\n value={computedSelectedComponentKeys}\n onChange={handleCheckBoxChange as any}\n />\n <slot name=\"toolbar\"></slot>\n </div>\n </div>\n )}\n <div\n className=\"layout-wrapper\"\n ref={layoutWrapperRef}\n style={layoutWrapperStyle}\n >\n {isEdit && (\n <div className=\"actions-wrapper\">\n <WrappedButton type=\"primary\" onClick={handleSave}>\n 保存\n </WrappedButton>\n <WrappedButton onClick={handleCancel}>取消</WrappedButton>\n <WrappedDropdownButton\n btnText=\"更多\"\n icon={{\n lib: \"antd\",\n icon: \"down\",\n }}\n actions={[\n ...(isAdmin\n ? [{ text: \"另存为模板\", event: \"saveAsTemplate\" }]\n : []),\n { text: \"从模版加载\", event: \"loadFromTemplate\" },\n { text: \"清除\", danger: true, event: \"clear\" },\n ]}\n onActionClick={(e) => {\n handleActionClick(e.detail);\n }}\n data-testid=\"edit-layout-actions\"\n />\n </div>\n )}\n <ResponsiveReactGridLayout\n className=\"layout\"\n draggableCancel=\".delete-icon,.edit-actions,.ingore-item\"\n breakpoints={{ lg: 1300, md: 1024, sm: 768 }}\n rowHeight={1}\n cols={{ lg: 3, md: 3, sm: 1 }}\n isResizable={false}\n isDraggable={isEdit}\n onDrag={handleDragCallback}\n onLayoutChange={handleLayoutChange}\n onBreakpointChange={handleBreakpointChange}\n >\n {renderChild}\n </ResponsiveReactGridLayout>\n </div>\n </div>\n );\n});\n\n/**\n * 工作台布局\n */\nexport\n@defineElement(\"eo-workbench-layout\", {\n styleTexts: [styleText],\n})\nclass EoWorkbenchLayout extends ReactNextElement {\n #componentRef = createRef<EoWorkbenchLayoutComponentRef>();\n\n @property()\n accessor cardTitle: string | undefined;\n\n @property({\n type: Boolean,\n })\n accessor isEdit: boolean | undefined;\n\n @property({\n attribute: false,\n })\n accessor layouts: Layout[] | undefined;\n\n @property({\n attribute: false,\n })\n accessor componentList: Item[] | undefined;\n\n @event({\n type: \"save\",\n })\n accessor #saveLayoutEvent!: EventEmitter<Layout[]>;\n\n #handleSaveLayout = (layout: Layout[]) => {\n this.#saveLayoutEvent.emit(layout);\n };\n\n @event({\n type: \"cancel\",\n })\n accessor #cancelEvent!: EventEmitter<void>;\n\n #handleCancel = () => {\n this.#cancelEvent.emit();\n };\n\n /**\n * 操作点击事件\n * @detail {\n action: SimpleAction;\n layouts: Layout[];\n }\n */\n @event({\n type: \"action.click\",\n })\n accessor #actionClickEvent!: EventEmitter<{\n action: SimpleAction;\n layouts: Layout[];\n }>;\n\n #handleActionClick = (action: SimpleAction, layouts: Layout[]): void => {\n this.#actionClickEvent.emit({ action, layouts });\n action.event &&\n this.dispatchEvent(new CustomEvent(action.event, { detail: layouts }));\n };\n\n @method()\n setLayouts(layouts: Layout[]) {\n this.#componentRef.current?.setLayouts(layouts);\n }\n\n render() {\n return (\n <EoWorkbenchLayoutComponent\n cardTitle={this.cardTitle}\n layouts={this.layouts}\n componentList={this.componentList}\n isEdit={this.isEdit}\n onSave={this.#handleSaveLayout}\n onCancel={this.#handleCancel}\n onActionClick={this.#handleActionClick}\n ref={this.#componentRef}\n />\n );\n }\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nimport ___CSS_LOADER_AT_RULE_IMPORT_0___ from \"-!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[0]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!../../../../node_modules/react-grid-layout/css/styles.css\";\nimport ___CSS_LOADER_AT_RULE_IMPORT_1___ from \"-!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[0]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!../../../../node_modules/react-resizable/css/styles.css\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);\n___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:host{display:block}:host([hidden]){display:none}.grid-layout-wrapper{display:flex;height:100%;position:relative}.grid-layout-wrapper .component-wrapper{width:150px;padding:6px 12px;overflow-y:scroll;box-shadow:1px 0 0 0 var(--palette-gray-5);background:var(--color-fill-bg-container-1);z-index:999;position:sticky;top:0}.grid-layout-wrapper .component-wrapper .component-title{font-size:16px;padding:6px 0;font-weight:500}.grid-layout-wrapper .component-wrapper .component-list{margin-top:6px}.grid-layout-wrapper .component-wrapper .component-list eo-checkbox::part(checkbox-wrapper){display:flex;flex-wrap:wrap;gap:8px}.grid-layout-wrapper .component-wrapper .component-list eo-checkbox::part(checkbox-option){margin-left:0;width:100%;background:none}.grid-layout-wrapper .layout-wrapper{flex:1}.grid-layout-wrapper .layout-wrapper .layout{max-width:1300px;margin:0 auto}.grid-layout-wrapper .layout-wrapper .actions-wrapper{position:sticky;top:0;z-index:999;margin-left:1px;display:flex;gap:8px;justify-content:flex-end;background:var(--color-fill-bg-container-1);padding:8px 12px;box-shadow:0 1px 1px 0 var(--palette-gray-5)}.grid-layout-wrapper .layout-wrapper .edit-mask{position:absolute;left:0;right:0;top:45px;bottom:0;z-index:10}.grid-layout-wrapper .layout-wrapper .delete-icon{position:absolute;right:15px;top:15px;cursor:pointer;font-size:16px;width:30px;height:30px;display:flex;justify-content:center;align-items:center;background:var(--color-fill-bg-container-1);color:var(--color-normal-text)}.grid-layout-wrapper .layout-wrapper .delete-icon:hover{color:var(--color-error)}.grid-layout-wrapper .layout-wrapper .delete-icon:active{color:var(--color-error-active)}.react-grid-item.react-grid-placeholder{background-color:#ddd}.react-grid-item.react-draggable-dragging{pointer-events:none}.react-grid-item.react-grid-placeholder.forbidden{background-color:red}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.react-grid-layout{position:relative;transition:height 200ms ease}.react-grid-item{transition:all 200ms ease;transition-property:left,top,width,height}.react-grid-item img{pointer-events:none;-webkit-user-select:none;user-select:none}.react-grid-item.cssTransforms{transition-property:transform,width,height}.react-grid-item.resizing{transition:none;z-index:1;will-change:width,height}.react-grid-item.react-draggable-dragging{transition:none;z-index:3;will-change:transform}.react-grid-item.dropping{visibility:hidden}.react-grid-item.react-grid-placeholder{background:red;opacity:0.2;transition-duration:100ms;z-index:2;-webkit-user-select:none;-o-user-select:none;user-select:none}.react-grid-item.react-grid-placeholder.placeholder-resizing{transition:none}.react-grid-item > .react-resizable-handle{position:absolute;width:20px;height:20px}.react-grid-item > .react-resizable-handle::after{content:\"\";position:absolute;right:3px;bottom:3px;width:5px;height:5px;border-right:2px solid rgba(0,0,0,0.4);border-bottom:2px solid rgba(0,0,0,0.4)}.react-resizable-hide > .react-resizable-handle{display:none}.react-grid-item > .react-resizable-handle.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-grid-item > .react-resizable-handle.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-w,\n.react-grid-item > .react-resizable-handle.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-grid-item > .react-resizable-handle.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-n,\n.react-grid-item > .react-resizable-handle.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-grid-item > .react-resizable-handle.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-grid-item > .react-resizable-handle.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../css-loader/dist/runtime/api.js\";\nimport ___CSS_LOADER_GET_URL_IMPORT___ from \"../../css-loader/dist/runtime/getUrl.js\";\nvar ___CSS_LOADER_URL_IMPORT_0___ = new URL(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+\", import.meta.url);\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\nvar ___CSS_LOADER_URL_REPLACEMENT_0___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_IMPORT_0___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.react-resizable{position:relative}.react-resizable-handle{position:absolute;width:20px;height:20px;background-repeat:no-repeat;background-origin:content-box;box-sizing:border-box;background-image:url(${___CSS_LOADER_URL_REPLACEMENT_0___});background-position:bottom right;padding:0 3px 3px 0}.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-resizable-handle-w,\n.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-resizable-handle-n,\n.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","import assertClassBrand from \"./assertClassBrand.js\";\nexport default function _classPrivateGetter(s, r, a) {\n return a(assertClassBrand(s, r));\n}","import checkPrivateRedeclaration from \"./checkPrivateRedeclaration.js\";\nexport default function _classPrivateMethodInitSpec(obj, privateSet) {\n checkPrivateRedeclaration(obj, privateSet);\n privateSet.add(obj);\n}"],"names":["defineElement","property","event","method","createDecorators","WrappedButton","wrapBrick","WrappedDropdownButton","onActionClick","WrappedIcon","WrappedCheckbox","onChange","getRealKey","key","includes","split","isAdmin","auth","getAuth","EoWorkbenchLayoutComponent","forwardRef","_ref","ref","cardTitle","layouts","layoutsProps","componentList","isEdit","onSave","onCancel","ResponsiveReactGridLayout","useMemo","WidthProvider","Responsive","gridLayoutRef","useRef","layoutCacheRef","layoutWrapperRef","setLayouts","useState","cols","setCols","layoutWrapperStyle","setLayoutWrapperStyle","useImperativeHandle","handleLayoutChange","useCallback","currentLayout","current","isAllowAction","t","length","x","w","y","h","i","minH","matchItem","find","item","Math","max","undefined","items","map","_layoutCacheRef$curre","layout","random","handleCheckBoxChange","checkedKeys","detail","value","layoutsKeys","addItems","filter","position","Infinity","concat","handleSave","handleDeleteItem","e","deteleItem","_layoutCacheRef$curre2","stopPropagation","handleEditMaskClcik","preventDefault","renderChild","component","React","style","className","onMouseDown","ReactUseBrick","useBrick","icon","lib","onClick","Boolean","computedOptions","label","title","computedSelectedComponentKeys","handleWatchLayoutSizeChange","_layoutWrapperRef$cur","top","getClientRects","height","document","body","clientHeight","overflow","useEffect","window","addEventListener","removeEventListener","options","name","type","handleCancel","btnText","actions","text","danger","action","handleActionClick","draggableCancel","breakpoints","lg","md","sm","rowHeight","isResizable","isDraggable","onDrag","handleDragCallback","oldItem","newItem","_gridLayoutRef$curren","placeholderDOM","querySelector","classList","contains","add","remove","onLayoutChange","onBreakpointChange","handleBreakpointChange","_newBreakpoint","newCols","_EoWorkbenchLayout","_componentRef","WeakMap","_A","_B","_C","_D","_E","_EoWorkbenchLayout_brand","WeakSet","_handleSaveLayout","_F","_handleCancel","_G","_handleActionClick","EoWorkbenchLayout","ReactNextElement","constructor","arguments","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_initProto","createRef","_init_cardTitle","_init_extra_cardTitle","_init_isEdit","_init_extra_isEdit","_init_layouts","_init_extra_layouts","_init_componentList","_init_extra_componentList","_init_saveLayoutEvent","_init_extra_saveLayoutEvent","_classPrivateGetter","this","_get_saveLayoutEvent","emit","_init_cancelEvent","_init_extra_cancelEvent","_get_cancelEvent","_init_actionClickEvent","_init_extra_actionClickEvent","_get_actionClickEvent","dispatchEvent","CustomEvent","_classPrivateFieldGet","v","_classPrivateFieldSet","_classPrivateFieldGet2","render","_EoWorkbenchLayout2","_set_saveLayoutEvent","_set_cancelEvent","_set_actionClickEvent","c","_initClass","_applyDecs","styleTexts","styleText","attribute","o","_","has","_checkInRHS","___CSS_LOADER_EXPORT___","push","module","id","toString","___CSS_LOADER_URL_IMPORT_0___","URL","___CSS_LOADER_URL_REPLACEMENT_0___","s","r","a","obj","privateSet"],"sourceRoot":""}