@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
2 lines (1 loc) • 23 kB
JavaScript
(function(M,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue"),require("lodash-es"),require("bignumber.js"),require("../common/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","bignumber.js","../common/index.umd.js"],a):(M=typeof globalThis<"u"?globalThis:M||self,a(M.layout={},M.Vue,M.LodashES))})(this,function(M,a,k){"use strict";const V={},q={};function A(n){const{properties:e,title:t,ignore:o}=n,r=o&&Array.isArray(o),l=Object.keys(e).reduce((s,z)=>((!r||!o.find(w=>w===z))&&(s[z]=e[z].type==="object"&&e[z].properties?A(e[z]):k.cloneDeep(e[z].default)),s),{});if(t&&(!r||!o.find(s=>s==="id"))){const s=t.toLowerCase().replace(/-/g,"_");l.id=`${s}_${Math.random().toString().slice(2,6)}`}return l}function Z(n){const{properties:e,title:t,required:o}=n;if(o&&Array.isArray(o)){const r=o.reduce((l,s)=>(l[s]=e[s].type==="object"&&e[s].properties?A(e[s]):k.cloneDeep(e[s].default),l),{});if(t&&o.find(l=>l==="id")){const l=t.toLowerCase().replace(/-/g,"_");r.id=`${l}_${Math.random().toString().slice(2,6)}`}return r}return{type:t}}function F(n,e={},t){const o=V[n];if(o){let r=Z(o);const l=q[n];return r=l?l({getSchemaByType:F},r,e,t):r,r}return null}function K(n,e){const t=A(e);return Object.keys(t).reduce((o,r)=>(Object.prototype.hasOwnProperty.call(n,r)&&(o[r]&&k.isPlainObject(o[r])&&k.isPlainObject(n[r]||!n[r])?Object.assign(o[r],n[r]||{}):o[r]=n[r]),o),t),t}function W(n,e){return Object.keys(n).filter(o=>n[o]!=null).reduce((o,r)=>{if(e.has(r)){const l=e.get(r);if(typeof l=="string")o[l]=n[r];else{const s=l(r,n[r],n);Object.assign(o,s)}}else o[r]=n[r];return o},{})}function x(n,e,t=new Map){const o=K(n,e);return W(o,t)}function I(n={}){function e(i,d,u,P){if(typeof u=="number")return P[i].length===u;if(typeof u=="object"){const $=Object.keys(u)[0],j=u[$];if($==="not")return Number(P[i].length)!==Number(j);if($==="moreThan")return Number(P[i].length)>=Number(j);if($==="lessThan")return Number(P[i].length)<=Number(j)}return!1}function t(i,d,u,P){return P[i]&&P[i].propertyValue&&String(P[i].propertyValue.value)===String(u)}const o=new Map([["length",e],["getProperty",t]]);Object.keys(n).reduce((i,d)=>(i.set(d,n[d]),i),o);function r(i,d){const u=i;return typeof d=="number"?[{target:u,operator:"length",param:null,value:Number(d)}]:typeof d=="boolean"?[{target:u,operator:"getProperty",param:i,value:!!d}]:typeof d=="object"?Object.keys(d).map(P=>{if(P==="length")return{target:u,operator:"length",param:null,value:d[P]};const $=P,j=d[P];return{target:u,operator:"getProperty",param:$,value:j}}):[]}function l(i){return Object.keys(i).reduce((u,P)=>{const $=r(P,i[P]);return u.push(...$),u},[])}function s(i,d){if(o.has(i.operator)){const u=o.get(i.operator);return u&&u(i.target,i.param,i.value,d)||!1}return!1}function z(i,d){return l(i).reduce(($,j)=>$&&s(j,d),!0)}function w(i,d){const u=Object.keys(i),P=u.includes("allOf"),$=u.includes("anyOf"),j=P||$,f=(j?i[j?P?"allOf":"anyOf":"allOf"]:[i]).map(g=>z(g,d));return P?!f.includes(!1):f.includes(!0)}return{parseValueSchema:w}}const D={button:{type:"button",name:"按钮"},"response-toolbar":{type:"response-toolbar",name:"工具栏"},"response-toolbar-item":{type:"response-toolbar-item",name:"按钮"},"content-container":{type:"content-container",name:"容器"},"input-group":{type:"input-group",name:"文本"},textarea:{type:"textarea",name:"多行文本"},lookup:{type:"lookup",name:"帮助"},"number-spinner":{type:"number-spinner",name:"数值"},"date-picker":{type:"date-picker",name:"日期"},switch:{type:"switch",name:"开关"},"radio-group":{type:"radio-group",name:"单选组"},"check-box":{type:"check-box",name:"复选框"},"check-group":{type:"check-group",name:"复选框组"},"combo-list":{type:"combo-list",name:"下拉列表"},"response-form":{type:"response-form",name:"卡片面板"},"response-layout":{type:"response-layout",name:"布局容器",icon:"response-layout-3"},"response-layout-item":{type:"response-layout-item",name:"布局",icon:"response-layout-1"},"tree-grid":{type:"tree-grid",name:"树表格"},"tree-grid-column":{type:"tree-grid-column",name:"树表格列"},"data-grid":{type:"data-grid",name:"表格"},"data-grid-column":{type:"data-grid-column",name:"表格列"},module:{type:"Module",name:"模块"},component:{type:"component",name:"组件"},tabs:{type:"tabs",name:"标签页"},"tab-page":{type:"tab-page",name:"标签页项",dependentParentControl:"Tab"},"tab-toolbar-item":{type:"tab-toolbar-item",name:"标签页工具栏按钮"},"time-picker":{type:"time-picker",name:"时间选择"},section:{type:"section",name:"分组面板"},"section-toolbar":{type:"section-toolbar",name:"分组面板工具栏"},"section-toolbar-item":{type:"section-toolbar-item",name:"分组面板按钮"},splitter:{type:"splitter",name:"分栏面板"},"splitter-pane":{type:"splitter-pane",name:"分栏面板项",dependentParentControl:"Splitter"},"component-ref":{type:"component-ref",name:"组件引用节点"},uploader:{type:"uploader",name:"附件上传"},"page-header":{type:"page-header",name:"页头"},"page-footer":{type:"page-footer",name:"页脚"},"tab-toolbar":{type:"tab-toolbar",name:"标签页工具栏"},fieldset:{type:"fieldset",name:"分组"},"query-solution":{type:"query-solution",name:"筛选方案"},drawer:{type:"drawer",name:"抽屉"}},ee={},te={};I();function _(n,e,t=new Map,o=(s,z,w,i)=>z,r={},l=s=>s){return V[e.title]=e,q[e.title]=o,ee[e.title]=r,te[e.title]=l,(s={},z=!0)=>{if(!z)return W(s,t);const w=x(s,e,t),i=Object.keys(n).reduce((d,u)=>(d[u]=n[u].default,d),{});return Object.assign(i,w)}}function ne(n,e){return{customClass:e.class,customStyle:e.style}}const Y=new Map([["appearance",ne]]);function X(n,e,t){return e}const oe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/layout.schema.json",title:"layout",description:"A Farris Container Component",type:"object",properties:{id:{description:"The unique identifier for layout component",type:"string"},type:{description:"The type string of layout component",type:"string",default:"layout"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},contents:{description:"",type:"array",default:[]},collapsable:{description:"",type:"boolean",default:!1},resizable:{description:"",type:"boolean",default:!0},visible:{description:"",type:"boolean",default:!0}},required:["id","type","contents"]},ae={title:"layout",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"类型",title:"类型",type:"string",readonly:!0}}},behavior:{description:"Basic Infomation",title:"行为",properties:{collapsable:{description:"",title:"可收折",type:"boolean"},resizable:{description:"",title:"可调整尺寸",type:"boolean"}}}}},H={customStyle:{type:String,defaut:""},customClass:{type:String,defaut:""}},L=_(H,oe,Y,X,ae);function U(n){const e=a.ref(-1),t=a.ref(-1),o=a.ref(0),r=a.ref(0),l=a.ref(!1),s=a.ref(!1),z=a.computed(()=>({display:l.value?"block":"none",left:`${o.value}px`,cursor:"e-resize"})),w=a.computed(()=>({display:s.value?"block":"none",top:`${r.value}px`,cursor:"n-resize"})),i=a.computed(()=>({display:s.value||l.value?"block":"none"}));function d(v,f,b,g){const S=n.value;if(S){const{left:p,right:h,width:c}=S.getBoundingClientRect();let y=v.clientX-p;g==="right"&&(y=h-v.clientX),y>f&&(y=f),y<b&&(y=b),g==="right"&&(y=c-y),o.value=y}}function u(v,f,b,g){const S=n.value;if(S){const{top:p,bottom:h,height:c}=S.getBoundingClientRect();let y=v.clientY-p;g==="bottom"&&(y=h-v.clientY),y>f&&(y=f),y<b&&(y=b),g==="bottom"&&(y=c-y),r.value=y}}function P(){const v=n.value;if(v){const{width:f,height:b}=v.getBoundingClientRect();return{width:f,height:b}}return null}function $(){const v=n.value;return v?Array.from(v.querySelectorAll("[data-position]")).reduce((f,b)=>{const g=b.getAttribute("data-position");return f=Object.assign(f,{[g]:b}),f},{}):null}function j(v,f){const b=P(),g=$();if(b&&g){const S=g==null?void 0:g.right,p=g==null?void 0:g.left;if(v==="left"&&p)return S?b.width-S.clientWidth-f:b.width-f;if(v==="right"&&S)return p?b.width-p.clientWidth-f:b.width-f}}function C(v,f){const b=P(),g=$();if(b&&g){const S=g==null?void 0:g.bottom,p=g==null?void 0:g.top;if(v==="top"&&p)return S?b.height-S.clientHeight-f:b.height-f;if(v==="bottom"&&S)return p?b.height-p.clientHeight-f:b.height-f}}return{horizontalResizeHandleStyle:z,verticalResizeHandleStyle:w,resizeOverlayStyle:i,showHorizontalResizeHandle:l,showVerticalResizeHandle:s,horizontalResizeBarPosition:e,verticalResizeBarPosition:t,verticalResizeHandleOffset:r,horizontalResizeHandleOffset:o,draggingHorizontalResizeHandle:d,draggingVerticalResizeHandle:u,getPanelMaxHeight:C,getPanelMaxWidth:j}}const re=["moz","ms","webkit"];function ie(){let n=0;return e=>{const t=new Date().getTime(),o=Math.max(0,16-(t-n)),r=setTimeout(()=>{e(t+o)},o);return n=t+o,r}}function le(){if(typeof window>"u")return()=>0;if(window.requestAnimationFrame)return window.requestAnimationFrame.bind(window);const n=re.filter(e=>`${e}RequestAnimationFrame`in window)[0];return n?window[`${n}RequestAnimationFrame`]:ie()}le();function se(n,e){return((e==null?void 0:e.split(" "))||[]).reduce((o,r)=>(r&&(o[r]=!0),o),n),n}function ce(n,e){return((e==null?void 0:e.split(";"))||[]).reduce((o,r)=>{if(r){const l=r.split(":");o[l[0]]=l[1]}return o},n),n}const T=a.defineComponent({name:"FLayout",props:H,emits:[],setup(n,e){const t=a.ref(),o=U(t),{horizontalResizeHandleStyle:r,verticalResizeHandleStyle:l,resizeOverlayStyle:s}=o;a.provide("layout",{useResizeHandleComposition:o});const z=a.computed(()=>se({"f-layout":!0},n==null?void 0:n.customClass)),w=a.computed(()=>ce({},n==null?void 0:n.customStyle));return()=>a.createVNode("div",{class:z.value,style:w.value,ref:t},[e.slots.default&&e.slots.default(),a.createVNode("div",{class:"f-layout-resize-overlay",style:s.value},null),a.createVNode("div",{class:"f-layout-horizontal-resize-proxy",style:r.value},null),a.createVNode("div",{class:"f-layout-vertical-resize-proxy",style:l.value},null)])}}),ue={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/layout-pane.schema.json",title:"layout-pane",description:"A Farris Container Component",type:"object",properties:{id:{description:"The unique identifier for a layout pane",type:"string"},type:{description:"The type string of layout paney",type:"string",default:"layout-pane"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},collapsable:{description:"",type:"boolean",default:!1},contents:{description:"",type:"array",default:[]},height:{description:"",type:"number"},position:{description:"",type:"string",default:"left",enum:["left","center","right","top","bottom"]},resizeable:{description:"",type:"boolean",default:!0},width:{description:"",type:"number"},visible:{description:"",type:"number",default:!0}},required:["id","type","contents"]},pe={title:"layout-pane",description:"A Farris Container Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"enum"},width:{description:"",type:"number",title:"宽度"},height:{description:"",type:"number",title:"高度"}}},appearance:{title:"样式",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:""},style:{title:"style",type:"string",description:""}}},behavior:{description:"",title:"行为",properties:{collapsable:{description:"",type:"boolean",title:"允许收折"},position:{description:"",type:"enum",title:"位置",editor:{type:"combo-list",data:[{id:"left",name:"左侧"},{id:"center",name:"居中"},{id:"right",name:"右侧"},{id:"top",name:"顶部"},{id:"bottom",name:"底部"}]}},resizeable:{description:"",type:"boolean",title:"允许调整尺寸"},visible:{description:"运行时组件是否可见",type:"boolean",title:"是否可见"}}}}},E={customClass:{type:String,defaut:""},customStyle:{type:String,defaut:""},width:{type:Number,default:-1},height:{type:Number,default:-1},position:{type:String,default:"left"},visible:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},collapsable:{type:Boolean,default:!1},minWidth:{type:Number,default:100},minHeight:{type:Number,default:100}},G=_(E,ue,Y,X,pe);function J(n,e,t,o,r){const{horizontalResizeBarPosition:l,horizontalResizeHandleOffset:s,showHorizontalResizeHandle:z,showVerticalResizeHandle:w,verticalResizeBarPosition:i,verticalResizeHandleOffset:d,draggingHorizontalResizeHandle:u,draggingVerticalResizeHandle:P,getPanelMaxHeight:$,getPanelMaxWidth:j}=r;let C="",v,f,b;function g(h){if((C==="left"||C==="right")&&f){const{left:c}=f.getBoundingClientRect(),{width:y}=v.getBoundingClientRect(),O=h.clientX-c;let m=C==="left"?(y||0)+(O-l.value):(y||0)-(O-l.value);m=t.value>0?Math.max(t.value,m):m;const B=j(C,t.value);B!=null&&(m=B>m?m:B),n.value=m}if((C==="top"||C==="bottom")&&f){const{top:c}=f.getBoundingClientRect(),{height:y}=v.getBoundingClientRect(),O=h.clientY-c;let m=C==="top"?(y||0)+(O-i.value):(y||0)-(O-i.value);m=o.value>0?Math.max(o.value,m):m;const B=$(C,o.value);B!=null&&(m=B>m?m:B),e.value=m}s.value=0,d.value=0,l.value=-1,i.value=-1,z.value=!1,w.value=!1,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",g),document.body.style.userSelect="",C="",v=null,f=null}function S(h,c,y){if(C=c,v=y,z.value=!0,f=h.composedPath().find(m=>(m.className||"").split(" ")[0]==="f-layout"),f){const{left:m}=f.getBoundingClientRect(),B=h.clientX-m;s.value=B,l.value=B;const R=j(C,t.value)||0;b=be=>u(be,R,t.value,C),document.addEventListener("mousemove",b),document.addEventListener("mouseup",g),document.body.style.userSelect="none"}}function p(h,c,y){if(C=c,v=y,w.value=!0,f=h.composedPath().find(m=>(m.className||"").split(" ")[0]==="f-layout"),f){const{top:m}=f.getBoundingClientRect();d.value=h.clientY-m,i.value=h.clientY-m;const B=$(C,o.value)||0;b=R=>P(R,B,o.value,C),document.addEventListener("mousemove",b),document.addEventListener("mouseup",g),document.body.style.userSelect="none"}}return{onClickHorizontalResizeBar:S,onClickVerticalResizeBar:p}}const N=a.defineComponent({name:"FLayoutPane",props:E,emits:[],setup(n,e){const t=a.ref(n.minHeight<=0?100:n.minHeight),o=a.ref(n.minWidth<=0?100:n.minWidth),r=a.ref(n.width<=0?100:n.width),l=a.ref(n.height<=100?100:n.height),s=a.ref(Math.max(t.value,l.value)),z=a.ref(Math.max(o.value,r.value)),w=a.ref(),i=a.ref(n.position),d=a.ref(n.resizable);a.watch(()=>n.resizable,p=>{d.value=p});const u=a.inject("layout"),{useResizeHandleComposition:P}=u,$=J(z,s,o,t,P),{onClickHorizontalResizeBar:j,onClickVerticalResizeBar:C}=$,v=a.computed(()=>({"f-layout-resize-bar":!0,"f-layout-resize-bar-e":i.value==="left","f-layout-resize-bar-n":i.value==="bottom","f-layout-resize-bar-s":i.value==="top","f-layout-resize-bar-w":i.value==="right"})),f=a.computed(()=>i.value!=="center"&&d.value);function b(p,h){(h==="left"||h==="right")&&j(p,h,w.value),(h==="top"||h==="bottom")&&C(p,h,w.value)}const g=a.computed(()=>{const p={"f-layout-pane":!0,"f-page-content-nav":i.value==="left"||i.value==="right","f-page-content-main":i.value==="center"};return n.customClass&&String(n.customClass).split(" ").reduce((h,c)=>(h[c]=!0,h),p),p}),S=a.computed(()=>{const p={};return(z.value&&i.value==="left"||i.value==="right")&&(p.width=`${z.value}px`),(s.value&&i.value==="bottom"||i.value==="top")&&(p.height=`${s.value}px`),n.visible||(p.display="none"),p});return()=>a.createVNode("div",{ref:w,class:g.value,style:S.value,"data-position":i.value},[e.slots.default&&e.slots.default(),f.value&&a.createVNode("span",{class:v.value,onMousedown:p=>b(p,i.value)},null)])}});function fe(n,e){function t(){return!1}return{canAccepts:t}}function Q(n,e,t){var h;const o=t&&t.getStyles&&t.getStyles()||"",r=t&&t.getDesignerClass&&t.getDesignerClass()||"",l=a.ref();function s(){return(e==null?void 0:e.schema.componentType)==="frame"?!1:t&&t.checkCanMoveComponent?t.checkCanMoveComponent():!0}function z(){return!1}function w(){return(e==null?void 0:e.schema.componentType)==="frame"?!1:t&&t.checkCanDeleteComponent?t.checkCanDeleteComponent():!0}function i(){return(e==null?void 0:e.schema.componentType)==="frame"?!0:t&&t.hideNestedPaddingInDesginerView?t.hideNestedPaddingInDesginerView():!1}function d(c){if(!c||!c.value)return null;if(c.value.schema&&c.value.schema.type==="component")return c.value;const y=a.ref(c==null?void 0:c.value.parent),O=d(y);return O||null}function u(c=e){var B;if(t!=null&&t.getDraggableDesignItemElement)return t.getDraggableDesignItemElement(c);const{componentInstance:y,designerItemElementRef:O}=c;if(!y||!y.value)return null;const{getCustomButtons:m}=y.value;return y.value.canMove||m&&((B=m())!=null&&B.length)?O:u(c.parent)}function P(c){return!!t&&t.canAccepts(c)}function $(){return(e==null?void 0:e.schema.label)||(e==null?void 0:e.schema.title)||(e==null?void 0:e.schema.name)}function j(){}function C(c,y){var O;!c||!y||(t!=null&&t.onAcceptMovedChildElement&&t.onAcceptMovedChildElement(c,y),(O=e==null?void 0:e.setupContext)==null||O.emit("dragEnd"))}function v(c,y){const{componentType:O}=c;let m=F(O,c,y);t&&t.onResolveNewComponentSchema&&(m=t.onResolveNewComponentSchema(c,m));const B=O.toLowerCase().replace(/-/g,"_");return m&&!m.id&&m.type===O&&(m.id=`${B}_${Math.random().toString().slice(2,6)}`),m}function f(c){c&&t!=null&&t.onChildElementMovedOut&&t.onChildElementMovedOut(c)}function b(...c){if(t&&t.getPropsConfig)return t.getPropsConfig(...c)}function g(){t&&t.onRemoveComponent&&t.onRemoveComponent(),e!=null&&e.schema.contents&&e.schema.contents.map(c=>{let y=c.id;c.type==="component-ref"&&(y=c.component);const O=n.value.querySelectorAll(`#${y}-design-item`);O!=null&&O.length&&Array.from(O).map(m=>{var B;(B=m==null?void 0:m.componentInstance)!=null&&B.value.onRemoveComponent&&m.componentInstance.value.onRemoveComponent()})})}function S(){if(t&&t.getCustomButtons)return t.getCustomButtons()}function p(c){if(t&&t.onPropertyChanged)return t.onPropertyChanged(c)}return l.value={canMove:s(),canSelectParent:z(),canDelete:w(),canNested:!i(),contents:e==null?void 0:e.schema.contents,elementRef:n,parent:(h=e==null?void 0:e.parent)==null?void 0:h.componentInstance,schema:e==null?void 0:e.schema,styles:o,designerClass:r,canAccepts:P,getBelongedComponentInstance:d,getDraggableDesignItemElement:u,getDraggingDisplayText:$,getPropConfig:b,getDragScopeElement:j,onAcceptMovedChildElement:C,onChildElementMovedOut:f,addNewChildComponentSchema:v,triggerBelongedComponentToMoveWhenMoved:!!t&&t.triggerBelongedComponentToMoveWhenMoved||a.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:!!t&&t.triggerBelongedComponentToDeleteWhenDeleted||a.ref(!1),onRemoveComponent:g,getCustomButtons:S,onPropertyChanged:p},l}const ye=a.defineComponent({name:"FLayoutDesign",props:H,emits:[],setup(n,e){var d;const t=a.ref(),o=a.inject("design-item-context"),r=fe(o.schema,(d=o.parent)==null?void 0:d.schema),l=Q(t,o,r);l.value.canNested=!1;const s=U(t),{horizontalResizeHandleStyle:z,verticalResizeHandleStyle:w,resizeOverlayStyle:i}=s;return a.provide("layout",{useResizeHandleComposition:s}),a.onMounted(()=>{t.value.componentInstance=l}),e.expose(l.value),()=>a.createVNode("div",{class:"f-layout f-page-content",ref:t},[e.slots.default&&e.slots.default(),a.createVNode("div",{class:"f-layout-resize-overlay",style:i.value},null),a.createVNode("div",{class:"f-layout-horizontal-resize-proxy",style:z.value},null),a.createVNode("div",{class:"f-layout-vertical-resize-proxy",style:w.value},null)])}});function me(){function n(e,t){var s;if(!e)return!1;const o=((s=e.targetContainer)==null?void 0:s.componentInstance)&&e.targetContainer.componentInstance.value;if(!o)return!1;const r=o.schema.type,l=t==null?void 0:t.formSchemaUtils.getComponentById(o.belongedComponentId);return!((e.componentCategory==="input"||e.componentType==="form-group")&&![D["response-layout-item"].type,D["response-form"].type,D.fieldset.type].includes(r)||(e.componentType===D.tabs.type||e.componentType===D.section.type)&&((l==null?void 0:l.componentType)!=="frame"||![D["content-container"].type,D["splitter-pane"].type,D["response-layout-item"].type].includes(r))||e.componentType===D["query-solution"].type||e.componentType===D.fieldset.type&&r!==D["response-form"].type)}return{basalDragulaRuleForContainer:n}}function de(n,e){const t=n.schema;function o(l){return!!me().basalDragulaRuleForContainer(l)}function r(){const l=["f-layout-pane"];return(t.position==="left"||t.position==="right")&&l.push("f-page-content-nav"),t.position==="center"&&l.push("f-page-content-main"),l.join(" ")}return{canAccepts:o,getDesignerClass:r}}const he=a.defineComponent({name:"FLayoutPaneDesign",props:E,emits:[],setup(n,e){const t=a.ref(),o=a.ref();a.inject("designer-host-service");const r=a.inject("design-item-context"),l=de(r),s=Q(o,r,l);s.value.canNested=!1,s.value.canMove=!1,s.value.canDelete=!1,a.onMounted(()=>{o.value.componentInstance=s}),e.expose(s.value);const z=a.ref(Math.max(n.minHeight,n.height)),w=a.ref(Math.max(n.minWidth,n.width)),i=a.ref(n.minHeight),d=a.ref(n.minWidth),u=a.ref(n.position),P=a.inject("layout"),{useResizeHandleComposition:$}=P,j=J(w,z,d,i,$),{onClickHorizontalResizeBar:C,onClickVerticalResizeBar:v}=j,f=a.computed(()=>({"f-layout-resize-bar":!0,"f-layout-resize-bar-e":u.value==="left","f-layout-resize-bar-n":u.value==="bottom","f-layout-resize-bar-s":u.value==="top","f-layout-resize-bar-w":u.value==="right"}));function b(p,h){(h==="left"||h==="right")&&C(p,h,t.value),(h==="top"||h==="bottom")&&v(p,h,t.value)}const g=a.computed(()=>{const p={"f-layout-pane":!0,"f-page-content-nav":u.value==="left"||u.value==="right","f-page-content-main":u.value==="center"};return n.customClass&&String(n.customClass).split(" ").reduce((h,c)=>(h[c]=!0,h),p),p}),S=a.computed(()=>{const p={flex:"1"};return(w.value&&u.value==="left"||u.value==="right")&&(p.width=`${w.value}px`),(z.value&&u.value==="bottom"||u.value==="top")&&(p.height=`${z.value}px`),p});return()=>a.createVNode("div",{ref:t,class:g.value,style:S.value},[a.createVNode("div",{ref:o,class:"drag-container","data-dragref":`${r.schema.id}-container`},[e.slots.default&&e.slots.default()]),a.createVNode("span",{class:f.value,onMousedown:p=>b(p,u.value)},null)])}});T.install=n=>{n.component(T.name,T),n.component(N.name,N)},T.register=(n,e,t,o)=>{n.layout=T,e.layout=L,n["layout-pane"]=N,e["layout-pane"]=G},T.registerDesigner=(n,e,t)=>{n.layout=ye,e.layout=L,n["layout-pane"]=he,e["layout-pane"]=G},M.FLayout=T,M.FLayoutPane=N,M.default=T,M.layoutProps=H,M.layoutPropsResolver=L,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});