UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1 lines 63.9 kB
(function(K,X){typeof exports=="object"&&typeof module<"u"?X(exports,require("../../components/common/index.umd.js"),require("../../components/dynamic-resolver/index.umd.js"),require("../../components/response-toolbar/index.umd.js"),require("vue"),require("../../components/locale/index.umd.js"),require("../../components/designer-canvas/index.umd.js"),require("../../components/property-panel/index.umd.js"),require("lodash-es"),require("../../components/tabs/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","../../components/common/index.umd.js","../../components/dynamic-resolver/index.umd.js","../../components/response-toolbar/index.umd.js","vue","../../components/locale/index.umd.js","../../components/designer-canvas/index.umd.js","../../components/property-panel/index.umd.js","lodash-es","../../components/tabs/index.umd.js"],X):(K=typeof globalThis<"u"?globalThis:K||self,X(K["response-toolbar"]={},K.common,K.dynamicResolver,K.responseToolbar,K.Vue,K.locale,K.designerCanvas,K.propertyPanel,K.LodashES,K.tabs))})(this,function(K,X,ue,qe,a,lt,ye,Fe,we,at){"use strict";var Jt=Object.defineProperty;var Kt=(K,X,ue)=>X in K?Jt(K,X,{enumerable:!0,configurable:!0,writable:!0,value:ue}):K[X]=ue;var J=(K,X,ue)=>Kt(K,typeof X!="symbol"?X+"":X,ue);const ct=new Map([["buttons","items"],["appearance",ue.resolveAppearance]]);function Ie(e,C,t){return C}const dt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/response-toolbar.schema.json",title:"response-toolbar",description:"A Farris Toolbar Component",type:"object",properties:{id:{description:"The unique identifier for a Response Toolbar",type:"string"},type:{description:"The type string of Response Toolbar",type:"string",default:"response-toolbar"},appearance:{description:"",type:"object",properties:{class:{type:"string",default:""}}},alignment:{description:"The alignment of Response Toolbar Button.",type:"string",default:"right"},buttons:{description:"The items of Response Toolbar.",type:"array",default:[]},buttonSize:{type:"string",default:""},visible:{description:"",type:"boolean",default:!0},moreButtonClass:{description:"处于下拉菜单时的样式",type:"string",default:"btn-secondary"}},required:["id","type","buttons"],events:{onClick:"点击事件"}},ut={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/response-toolbar-item.schema.json",title:"response-toolbar-item",description:"A Farris Toolbar Item Component",type:"object",properties:{id:{description:"The unique identifier for a Response Toolbar",type:"string"},type:{description:"The type string of Response Toolbar",type:"string",default:"response-toolbar-item"},appearance:{description:"",type:"object",properties:{class:{type:"string",default:""}}},alignment:{description:"对齐",type:"string",default:"right"},text:{description:"文本",type:"string",default:"按钮"},icon:{description:"图标",type:"string",default:""},disabled:{description:"禁用",type:"boolean",default:!1},visible:{description:"是否可见",type:"boolean",default:!0},onClick:{description:"点击事件",type:"string",default:""},tipsEnable:{description:"",type:"boolean",default:!1},tipsText:{description:"",type:"string",default:""},dropdownClass:{description:"处于下拉菜单时的样式",type:"string",default:""},split:{description:"",type:"boolean",default:!1}},required:["id","type","text"],events:{onClick:"点击事件"}},ft=Object.assign({},qe.responseToolbarProps,{componentId:{type:String,default:""}}),Pe=ue.createPropsResolver(qe.responseToolbarProps,dt,ct,Ie),We={id:{type:String,default:""},item:{type:Object,default:{}},items:{type:Object,default:{}},class:{type:String,default:""},text:{type:String,default:""},disabled:{type:Boolean,default:!1},icon:{type:String,default:""},componentId:{type:String,default:""},expanded:{type:Boolean,default:!1},alignment:{Type:String,default:"right"},split:{type:Boolean,default:!1},isDP:{type:Boolean,default:!1},isDPItem:{type:Boolean,default:!1},dropdownClass:{Type:String,default:""}},ze=Object.assign({},We,{item:{type:Object,default:{}},items:{type:Object,default:{}},class:{type:String,default:"btn-secondary"},alignment:{Type:String,default:"right"}}),pt=ue.createPropsResolver(ze,ut,void 0,Ie),ht=ue.createResponseToolbarEventHandlerResolver(),gt={id:{type:String,default:""},customClass:{type:String,default:""},alignment:{Type:String,default:"right"},items:{Type:Array,default:[]},visible:{type:Boolean,default:!0},buttonSize:{type:String,default:""},moreButtonClass:{type:String,default:"btn-secondary"}};class Ge{constructor(C){J(this,"id","");J(this,"class","btn-secondary");J(this,"icon","");J(this,"groupId","");J(this,"order",-1);J(this,"asDropDownTop",!1);J(this,"text","");J(this,"visible",!0);J(this,"shown",!0);J(this,"responsed",!1);J(this,"tipsEnable",!1);J(this,"tipsText","");J(this,"width",0);J(this,"dropdownClass","");J(this,"onClick",()=>{});J(this,"options");var h,u;this.options=C;const t=["id","class","icon","groupId","order","asDropDownTop","text","isDP","visible","responsed","width","tipsEnable","tipsText","dropdownClass","onClick"];Object.keys(C).filter(i=>t.indexOf(i)>-1).forEach(i=>{i==="visible"?this[i]=C[i]===void 0?!0:C[i]:this[i]=C[i]}),this.shown=this.visible,(h=C.appearance)!=null&&h.class&&(this.class=(u=C.appearance)==null?void 0:u.class),this.class||(this.class="btn-secondary")}get enable(){return Object.keys(this.options).indexOf("disabled")>-1?!this.options.disabled:a.computed(()=>!0)}setWidth(C){this.width=parseInt(C,10)}getWidth(){return this.visible?this.width:!1}}class bt extends Ge{constructor(C){super(C)}}function Ue(){function e(C){const t=[];return C.reduce((h,u)=>(u.children&&u.children.length>0?h.push(new De(u)):h.push(new bt(u)),h),t),t}return{buildResponseToolbarItems:e}}const{buildResponseToolbarItems:mt}=Ue();class De extends Ge{constructor(t){super(t);J(this,"placement","");J(this,"visible",!0);J(this,"dropdownClass","");J(this,"menuClass","");J(this,"split",!1);J(this,"children",[]);J(this,"expanded",!1);J(this,"shown",!0);const h=["visible","icon","isDP","class","dropdownClass","menuClass","placement","split","expanded"];Object.keys(t).filter(u=>h.indexOf(u)>-1).forEach(u=>{u==="visible"?this[u]=t[u]===void 0?!0:t[u]:this[u]=t[u]}),this.shown=this.visible,t.children&&t.children.length&&(this.children=mt(t.children))}}function Ee(){function e(t){const h={"f-icon":!0};if(t.icon){const u=t.icon.trim().split(" ");u&&u.length&&u.reduce((i,T)=>(i[T]=!0,i),h)}return h}function C(t){return!!(t.icon&&t.icon.trim())}return{iconClass:e,shouldShowIcon:C}}function vt(e,C){function t(m){const o={"dropdown-menu":!0};return X.getCustomClass(o,m.menuClass)}function h(m){const o={disabled:!m.enable,"dropdown-submenu":!0,"f-rt-dropdown":!0,"text-truncate":!0};return X.getCustomClass(o,m.dropdownClass)}function u(m){const o={disabled:!m.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0};return X.getCustomClass(o,m.dropdownClass)}function i(m){const o={disabled:!m.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0,"f-rt-toggle":!m.split,"btn-icontext":!!(m.icon&&m.icon.trim()),"dropdown-toggle":!m.split,"btn-secondary":!0};return X.getCustomClass(o,m.dropdownClass)}function T(m){const o={"f-rt-btn":!0,"text-truncate":!0,"btn-icontext":!!(m.icon&&m.icon.trim()),"d-block":!0};return X.getCustomClass(o,m.dropdownClass)}let w;const g=new Map;let M="";function P(m){M="#"+m}function p(m,o,V){m.stopPropagation();const E=V?V.id:"__top_item__";if(o.children&&o.children.length&&(o.expanded=!o.expanded,o.expanded)){if(g.has(E)&&g.get(E)!==o){const d=g.get(E);d&&(d.expanded=!1,g.delete(E))}g.set(E,o)}}function r(m,o){document.body.click(),o.enable&&(m.stopPropagation(),typeof o.onClick=="function"&&o.onClick(m,o.id),e.emit("click",m,o.id))}function f(m,o){const V=m.target;V.className.indexOf("dropdown-item")<0||(V.title=V.scrollWidth>V.clientWidth?o:"")}function s(m,o,V){if(o.tipsEnable&&o.tipsText){const E=a.reactive({content:o.tipsText,enable:o.tipsEnable});return a.withDirectives(a.createVNode("li",{class:u(o),id:o.id,key:o.id+"_"+V,onClick:d=>r(d,o)},[a.createVNode("span",{class:T(o)},[C.shouldShowIcon(o)&&a.createVNode("i",{class:C.iconClass(o)},null),o.text])]),[[a.resolveDirective("tooltip"),E]])}return a.createVNode("li",{class:u(o),id:o.id,onClick:E=>r(E,o)},[a.createVNode("span",{class:T(o),onMouseenter:E=>f(E,o.text)},[C.shouldShowIcon(o)&&a.createVNode("i",{class:C.iconClass(o)},null),o.text])])}function n(m,o,V){o.enable&&(typeof o.onClick=="function"&&V.onClick(m,o.id),e.emit("click",m,o.id),V.split||p(m,o,V))}function D(m,o,V){m&&m.stopPropagation(),p(m,o,V)}function B(m,o){m.stopPropagation();const V=o.id;if(o.children&&o.children.length&&o.expanded&&g.has(V)){const E=g.get(V);E&&(E.expanded=!1,g.delete(V))}}function R(m,o,V){if(o.tipsEnable&&o.tipsText){const E=a.reactive({content:o.tipsText,enable:o.tipsEnable});return a.createVNode("li",{class:h(o),id:o.id,key:o.id+"_"+V,onClick:d=>n(d,o,m)},[a.withDirectives(a.createVNode("span",{class:i(o)},[C.shouldShowIcon(o)&&a.createVNode("i",{class:C.iconClass(o)},null),o.text]),[[a.resolveDirective("tooltip"),E]]),o.split&&a.createVNode("span",{class:"dropdown-toggle dropdown-toggle-split f-rt-toggle",onClick:d=>D(d,o,m)},null),w(o,o)])}return a.createVNode("li",{class:h(o),id:o.id,onClick:E=>n(E,o,m),onMouseenter:E=>f(E,o.text)},[a.createVNode("span",{class:i(o)},[C.shouldShowIcon(o)&&a.createVNode("i",{class:C.iconClass(o)},null),o.text]),o.split&&a.createVNode("span",{class:"dropdown-toggle dropdown-toggle-split f-rt-toggle",onClick:E=>D(E,o,m)},null),w(o,o)])}function A(m){return m.children.filter(o=>o.visible).map((o,V)=>o.children&&o.children.length?R(m,o,V):s(m,o,V))}function k(m,o){if(!m)return 1080;let V=-1;const E=m.children.length;for(let d=0;d<E;d++)if(m.children[d].id===o){V=d;break}return 1080+E-V}function S(m,o,V){var L,H;const E={display:m.expanded?"block":"none",position:"fixed",maxWidth:"300px",minWidth:"120px",zIndex:1080,overflowY:"auto",maxHeight:"none"},d=document.querySelector(M);if(!d)return E;const y=a.getCurrentInstance();let l=(H=(L=y==null?void 0:y.exposed)==null?void 0:L.elementRef.value)==null?void 0:H.querySelector("#"+o);if(l||(l=d==null?void 0:d.querySelector("#"+o)),!l)return E;const b=window.innerWidth,I=window.innerHeight,j=l==null?void 0:l.getClientRects();if(l&&j&&j.length){const{top:G,width:oe,left:O,right:z,height:Y}=j[0],U=Math.ceil(Y+G);E.top=`${U}px`,E.left=`${O}px`;const q=m.id+"_menu",ee=(l==null?void 0:l.querySelector("#"+q))||(d==null?void 0:d.querySelector("#"+q))||null;if(ee){ee.style.visibility="hidden",ee.style.display="block";const ae=ee.offsetHeight;E.zIndex=m.expanded?k(d,q):1080,E.display==="block"&&(ee.style.display="block");const v=ee.getBoundingClientRect();if(V){E.top=`${G-6}px`;const x=Math.ceil(oe+O);E.left=`${x}px`}b-O-oe<v.width&&(E.left=`${(V?O:z)-v.width}px`),I-G-Y<ae?G>ae?(E.top=`${G-ae-6}px`,E.maxHeight=`${G-16}px`):(E.maxHeight=`${I-U}px`,G>I-G-Y&&(E.top="10px",E.maxHeight=`${G-16}px`)):E.maxHeight=`${I-U}px`,ee.style.visibility="visible"}}return E}w=function(m,o){const V=o?o.id:m.id;return a.createVNode(a.Teleport,{to:M,disabled:!m.expanded},{default:()=>[a.createVNode("ul",{class:t(m),style:S(m,V,o),id:m.id+"_menu",onWheel:E=>B(E,m)},[A(m)])]})};function F(){g.forEach(m=>{m.expanded=!1}),g.clear()}return{renderDropdownMenu:w,clearAllDropDownMenu:F,updateContainerId:P}}function yt(e,C,t){const h=a.ref(e.alignment),{renderDropdownMenu:u,clearAllDropDownMenu:i,updateContainerId:T}=vt(C,t);function w(n){const D={"btn-group":!0,"f-rt-dropdown":!0,"f-btn-ml":h.value==="right"||h.value==="center","f-btn-mr":h.value==="left"};return X.getCustomClass(D,n.dropdownClass)}function g(n){const D={btn:!0,disabled:!n.enable,"f-rt-btn":!0,"btn-icontext":!!(n.icon&&n.icon.trim())&&n.text,"f-rt-toggle":!n.split,"dropdown-toggle":!n.split,"f-btn-icon":n.icon&&!n.text};return X.getCustomClass(D,n.class)}function M(n){const D={btn:!0,"dropdown-toggle":!0,"dropdown-toggle-split":!0};return X.getCustomClass(D,n.class)}function P(n){return n.split?{display:"flex"}:{display:"flex","border-radius":"6px"}}function p(n,D){n.stopPropagation();const B=D.expanded;document.body.click(),typeof D.onClick=="function"&&D.onClick(n,D.id),C.emit("click",n,D.id),D.split||(D.expanded=!B)}function r(n,D){n.stopPropagation();const B=D.expanded;document.body.click(),D.expanded=!B}function f(n,D=!0){if(n.tipsEnable&&n.tipsText){const B=a.reactive({content:n.tipsText,enable:n.tipsEnable});return a.createVNode("div",{id:n.id,class:w(n)},[a.withDirectives(a.createVNode("div",{class:g(n),style:P(n),onClick:R=>n.enable&&p(R,n)},[t.shouldShowIcon(n)&&a.createVNode("i",{class:t.iconClass(n)},null),n.text&&a.createVNode("span",null,[n.text])]),[[a.resolveDirective("tooltip"),B]]),n.split&&a.createVNode("button",{class:M(n),style:"border-radius:0 6px 6px 0;",onClick:R=>r(R,n)},null),D&&u(n)])}return a.createVNode("div",{id:n.id,class:w(n)},[a.createVNode("div",{class:g(n),style:P(n),onClick:B=>n.enable&&p(B,n)},[t.shouldShowIcon(n)&&a.createVNode("i",{class:t.iconClass(n)},null),n.text&&a.createVNode("span",null,[n.text])]),n.split&&a.createVNode("button",{class:M(n),style:"border-radius:0 6px 6px 0;",onClick:B=>r(B,n)},null),D&&u(n)])}function s(){i()}return{renderToolbarDropdown:f,clearAllDropDown:s,updateContainerId:T}}const{buildResponseToolbarItems:Ye}=Ue(),wt=a.defineComponent({name:"FResponseToolbar",props:gt,emits:["click"],setup(e,C){const t=a.ref(Ye(e.items)),h=a.ref(),u=a.ref(),i=a.ref(),T=X.isMobilePhone(),w={id:"__more_buttons__",text:T?"":lt.LocaleService.getLocaleValue("responseToolbar.more"),icon:T?"f-icon-more-horizontal":""},g=a.ref(new De(w)),M=Object.assign({},w,{id:w.id+"width"}),P=a.ref(-1),p=Ee();let r=!1;const{guid:f,uuid:s}=X.useGuid(),n=e.id?e.id:"toolbar-"+f(),D=a.ref(),B="dropdown-container-"+n+"-"+s(4),{renderToolbarDropdown:R,clearAllDropDown:A,updateContainerId:k}=yt(e,C,p);k(B);const S=a.computed(()=>g.value.children.length>0),F=a.computed(()=>e.visible?g.value.children.length>0?!0:t.value.findIndex(v=>v.shown&&v.children&&v.children.length>0)>-1:!1);function m(){e.visible&&!D.value&&document&&(D.value=document.createElement("div"),D.value.id=B,document.body.appendChild(D.value))}m();function o(){D.value&&document.body.contains(D.value)&&(document.body.removeChild(D.value),D.value=null)}a.watch(F,(v,x)=>{v?m():o()});const V=a.computed(()=>{const v={"f-toolbar":!0,"f-response-toolbar":!0,"position-relative":!0,"f-response-toolbar-sm":e.buttonSize==="sm","f-response-toolbar-lg":e.buttonSize==="lg","d-none":!e.visible,"is-mobile":T};return X.getCustomClass(v,e.customClass)}),E=a.computed(()=>({"w-100":!0,"d-flex":!0,"flex-nowrap":!0,"justify-content-end":e.alignment==="right","justify-content-start":e.alignment==="left","justify-content-center":e.alignment==="center"}));function d(v){v&&v.target.closest("ul.dropdown-menu")&&v.type==="wheel"||(t.value.filter(x=>x.children&&x.children.length>0).forEach(x=>{x.expanded=!1}),g.value.expanded=!1,A())}function y(v,x){var ne;const $={btn:!0,"f-rt-btn":!0,"f-btn-ml":e.alignment==="right"||x>0&&e.alignment==="center","f-btn-mr":e.alignment==="left","btn-icontext":!!(v.icon&&v.icon.trim())},te=((ne=v==null?void 0:v.appearance)==null?void 0:ne.class)||v.class||"btn-secondary";return X.getCustomClass($,te)}function l(v,x){document.body.click(),typeof x.onClick=="function"&&x.onClick(v,x.id),C.emit("click",v,x.id)}function b(v,x){if(v.tipsEnable&&v.tipsText){const $=a.reactive({content:v.tipsText,enable:v.tipsEnable});return a.withDirectives(a.createVNode("button",{type:"button",class:y(v,x),id:v.id,disabled:!v.enable,onClick:te=>l(te,v)},[p.shouldShowIcon(v)&&a.createVNode("i",{class:p.iconClass(v)},null),v.text]),[[a.resolveDirective("tooltip"),$]])}return a.createVNode("button",{type:"button",class:y(v,x),id:v.id,disabled:!v.enable,onClick:$=>l($,v)},[p.shouldShowIcon(v)&&a.createVNode("i",{class:p.iconClass(v)},null),v.text])}let I=new Map,j=[];function L(v){const x=Math.ceil(parseFloat(getComputedStyle(v).getPropertyValue("margin-left"))),$=Math.ceil(parseFloat(getComputedStyle(v).getPropertyValue("margin-right")));return(x||0)+v.getBoundingClientRect().width+($||0)}function H(v,x,$){if(x<P.value){let te=$-1;for(;te>=0;te--){const ne=v[te],re=L(ne);if(x+=re,x>=P.value)break}$=te}return x-=P.value,$=$<0?0:$,{start:$,space:x}}function G(v){const x=i.value;let $=v;const ne=Array.from(x.children).filter(ce=>ce.id!=="__more_buttons__"),re=ne.length;let Ce=!1,se=0;for(;se<re;se++){const ce=ne[se],xe=L(ce);if(xe<=$)$-=xe;else{const he=H(ne,$,se);se=he.start,$=he.space,Ce=!0;break}}if(!Ce&&j.length>0){const ce=H(ne,$,se);se=ce.start,$=ce.space}const ke=j.length>0;for(;se<re;se++){const ce=ne[se],xe=L(ce);I.set(ce.id,!0);const he=j.find(Re=>Re.id===ce.id);he?he.width=xe:j[ke?"unshift":"push"]({id:ce.id,width:xe})}return $}function oe(){I=new Map,j=[]}function O(v=!1){const x=Object.assign({},g.value);x.children=[];const $=new De(x),te=t.value.reduce((ne,re)=>{const Ce=e.items.find(se=>se.id===re.id);return v?($.children.push(re),re.shown=!1,ne):(I.has(re.id)?($.children.push(re),re.shown=!1):re.shown=Ce.visible!==!1,ne.push(re),ne)},[]);g.value=$,t.value=te}function z(v){if(T){oe(),O(!0);return}let x=G(v);if(j.length){let $=0;for(;$<j.length;$++){const te=e.items.find(ne=>ne.id===j[$].id);if(te&&te.visible!==!1){const ne=j[$].width;if(x>=ne||$===j.length-1&&x+P.value>=ne)x-=ne;else break}}for(let te=0;te<$;te++)I.delete(j[te].id);j.splice(0,$-1)}O()}function Y(){if(h.value&&P.value<0){const v=h.value.querySelector("#"+M.id);if(!v)return;v.getBoundingClientRect().width===0?P.value=-1:P.value=L(v)}}function U(v=-1){if(v===0||!i.value||!u.value)return;v<0&&(v=u.value.getBoundingClientRect().width),v=Math.ceil(v);const x=Math.ceil(i.value.getBoundingClientRect().width);if(T){z(v),d();return}(v>=0&&v<x||j.length)&&(Y(),z(v),d())}function q(){return P.value<0&&a.createVNode("div",{style:"position:fixed;top:-40px;visibility:hidden;"},[R(new De(M))])}const ee=new ResizeObserver(v=>{if(v.length){if(T)return;const $=v[0].contentRect.width;U($)}});function ae(){u.value&&!r&&(ee.observe(u.value),r=!0)}return a.onMounted(()=>{Y(),U(),ae(),document.body.addEventListener("click",d),document.body.addEventListener("wheel",d)}),a.onUnmounted(()=>{ee.disconnect(),o(),document.body.removeEventListener("click",d),document.body.removeEventListener("wheel",d)}),a.watch(()=>e.items,()=>{t.value=Ye(e.items),g.value.children=[],a.nextTick(()=>{Y(),oe(),U()})},{deep:!0}),a.watch(()=>e.visible,v=>{v&&a.nextTick(()=>{Y(),U(),ae()})}),C.expose({elementRef:h}),()=>a.createVNode("div",{class:V.value,id:n,ref:h,style:{"overflow-y":P.value<0?"hidden":"initial"}},[e.visible&&q(),e.visible&&a.createVNode("div",{ref:u,class:E.value},[a.createVNode("div",{ref:i,class:"d-inline-block f-response-content",style:"white-space: nowrap;"},[t.value.filter(v=>v.shown).map((v,x)=>v.children&&v.children.length>0?R(v):b(v,x)),S.value&&R(g.value)])])])}});class Ct extends Fe.BaseControlProperty{constructor(t,h,u="response-toolbar"){super(t,h);J(this,"toolbarType","response-toolbar");this.toolbarType=u}getPropertyConfig(t){return this.propertyConfig.categories.basic=this.getBasicPropConfig(t),this.toolbarType!=="tab-toolbar"&&this.getAppearancePropConfig(t),this.propertyConfig.categories.behavior=this.getBehaviorConfig(t),this.propertyConfig}getAppearancePropConfig(t){this.propertyConfig.categories.appearance={title:"外观",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"}}}}getBehaviorProperties(t){this.propertyConfig.categories.behavior={title:"行为",description:"",properties:{alignment:{title:"对齐方式",description:"在工具栏区域内按钮组的位置",type:"enum",editor:{type:"combo-list",textField:"name",valueField:"value",data:[{value:"left",name:"左对齐"},{value:"center",name:"居中"},{value:"right",name:"右对齐"}]}}}}}}function xt(e,C,t){const h=e.schema;function u(){var n,D,B;let s=((n=e.parent)==null?void 0:n.schema.type)||"";s==="drawer"&&(((D=e.parent)==null?void 0:D.schema.headerToolbar.id)===h.id?s="drawer-header-toolbar":((B=e.parent)==null?void 0:B.schema.footerToolbar.id)===h.id&&(s="drawer-footer-toolbar")),["page-header","tabs","section","drawer-header-toolbar","drawer-footer-toolbar"].findIndex(R=>R===s)===-1&&(s=""),t.toolbarPosition=s}u();function i(s){return!1}function T(s,n){return n.text=s.label,n}function w(){return!1}function g(){return!1}function M(){return!1}function P(){return!0}function p(s){return new Ct(s,C,h.type).getPropertyConfig(h)}function r(s){var R;s&&(s.stopPropagation(),s.preventDefault());const{schema:n}=e;n.buttons||(n.buttons=[]);let D="";if(n.type)D=n.type+"-item";else switch((R=e.parent)==null?void 0:R.schema.type){case"tabs":D="tab-toolbar-item";break;case"section":D="section-toolbar-item";break;case"drawer":D="drawer-toolbar-item";break;default:D="response-toolbar-item"}const B=ue.getSchemaByType(D);B.id=`toolbar_item_${Math.random().toString().slice(2,6)}`,n.buttons.push(B),t.updateToolbarItems(),t.changeSelectedId("")}function f(){return[{id:"appendItem",title:"新增按钮",text:"",icon:"f-icon f-icon-plus-circle text-white",onClick:s=>r(s)}]}return{canAccepts:i,checkCanAddComponent:M,checkCanDeleteComponent:g,checkCanMoveComponent:w,hideNestedPaddingInDesginerView:P,onResolveNewComponentSchema:T,getPropsConfig:p,getCustomButtons:f}}var be=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Se(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Xe={exports:{}};(function(e,C){(function(t){e.exports=t()})(function(){return function(){function t(h,u,i){function T(M,P){if(!u[M]){if(!h[M]){var p=typeof Se=="function"&&Se;if(!P&&p)return p(M,!0);if(w)return w(M,!0);var r=new Error("Cannot find module '"+M+"'");throw r.code="MODULE_NOT_FOUND",r}var f=u[M]={exports:{}};h[M][0].call(f.exports,function(s){var n=h[M][1][s];return T(n||s)},f,f.exports,t,h,u,i)}return u[M].exports}for(var w=typeof Se=="function"&&Se,g=0;g<i.length;g++)T(i[g]);return T}return t}()({1:[function(t,h,u){var i={},T="(?:^|\\s)",w="(?:\\s|$)";function g(p){var r=i[p];return r?r.lastIndex=0:i[p]=r=new RegExp(T+p+w,"g"),r}function M(p,r){var f=p.className;f.length?g(r).test(f)||(p.className+=" "+r):p.className=r}function P(p,r){p.className=p.className.replace(g(r)," ").trim()}h.exports={add:M,rm:P}},{}],2:[function(t,h,u){(function(i){var T=t("contra/emitter"),w=t("crossvent"),g=t("./classes"),M=document,P=M.documentElement;function p(d,y){var l=arguments.length;l===1&&Array.isArray(d)===!1&&(y=d,d=[]);var b,I,j,L,H,G,oe,O,z,Y=null,U,q,ee=!1,ae=0,v,x=y||{};x.moves===void 0&&(x.moves=R),x.accepts===void 0&&(x.accepts=R),x.invalid===void 0&&(x.invalid=Vt),x.containers===void 0&&(x.containers=d||[]),x.isContainer===void 0&&(x.isContainer=B),x.copy===void 0&&(x.copy=!1),x.copySortSource===void 0&&(x.copySortSource=!1),x.revertOnSpill===void 0&&(x.revertOnSpill=!1),x.removeOnSpill===void 0&&(x.removeOnSpill=!1),x.direction===void 0&&(x.direction="vertical"),x.ignoreInputTextSelection===void 0&&(x.ignoreInputTextSelection=!0),x.mirrorContainer===void 0&&(x.mirrorContainer=M.body);var $=T({containers:x.containers,start:At,end:Ke,cancel:ot,remove:nt,destroy:se,canMove:Re,dragging:!1});return x.removeOnSpill===!0&&$.on("over",Lt).on("out",qt),ne(),$;function te(c){return $.containers.indexOf(c)!==-1||x.isContainer(c)}function ne(c){var N=c?"remove":"add";s(P,N,"mousedown",ce),s(P,N,"mouseup",Be)}function re(c){var N=c?"remove":"add";s(P,N,"mousemove",xe)}function Ce(c){var N=c?"remove":"add";w[N](P,"selectstart",ke),w[N](P,"click",ke)}function se(){ne(!0),Be({})}function ke(c){U&&c.preventDefault()}function ce(c){L=c.clientX,H=c.clientY;var N=n(c)!==1||c.metaKey||c.ctrlKey;if(!N){var _=c.target,W=he(_);W&&(U=W,re(),c.type==="mousedown"&&(F(_)?_.focus():c.preventDefault()))}}function xe(c){if(U){if(n(c)===0){Be({});return}if(!(c.clientX!==void 0&&Math.abs(c.clientX-L)<=(x.slideFactorX||0)&&c.clientY!==void 0&&Math.abs(c.clientY-H)<=(x.slideFactorY||0))){if(x.ignoreInputTextSelection){var N=E("clientX",c)||0,_=E("clientY",c)||0,W=M.elementFromPoint(N,_);if(F(W))return}var Q=U;re(!0),Ce(),Ke(),Je(Q),g.add(O||j,"gu-transit"),Wt(),Ft(),ae=0,Ae(c)}}}function he(c){if(!($.dragging&&b)&&!te(c)){for(var N=c;S(c)&&te(S(c))===!1;)if(x.invalid(c,N)||(c=S(c),!c))return;var _=S(c);if(_&&!x.invalid(c,N)){var W=x.moves(c,_,N,o(c));if(W)return{item:c,source:_}}}}function Re(c){return!!he(c)}function At(c){var N=he(c);N&&Je(N)}function Je(c){Zt(c.item,c.source)&&(O=c.item.cloneNode(!0),$.emit("cloned",O,c.item,"copy")),I=c.source,j=c.item,G=oe=o(c.item),$.dragging=!0,$.emit("drag",j,I)}function Vt(){return!1}function Ke(){if($.dragging){var c=O||j;tt(c,S(c))}}function et(){U=!1,re(!0),Ce(!0)}function Be(c){if(et(),!!$.dragging){var N=O||j,_=E("clientX",c)||0,W=E("clientY",c)||0,Q=D(b,_,W),Z=rt(Q,_,W);Z&&(O&&x.copySortSource||!O||Z!==I)?tt(N,Z):x.removeOnSpill?nt():ot()}}function tt(c,N){var _=S(c);O&&x.copySortSource&&N===I&&_.removeChild(j),_e(N)?$.emit("cancel",c,I):$.emit("drop",c,N,I,oe),Oe()}function nt(){if($.dragging){var c=O||j,N=S(c);N&&N.removeChild(c),$.emit(O?"cancel":"remove",c,N,I),Oe()}}function ot(c){if($.dragging){var N=arguments.length>0?c:x.revertOnSpill,_=O||j,W=S(_),Q=_e(W);Q===!1&&N&&(O?W&&W.removeChild(O):I.insertBefore(_,G)),Q||N?$.emit("cancel",_,I,I):$.emit("drop",_,W,I,oe),Oe()}}function Oe(){var c=O||j;et(),zt(),Gt(),c&&g.rm(c,"gu-transit"),z&&clearTimeout(z),$.dragging=!1,Y&&$.emit("out",c,Y,I),$.emit("dragend",c,ae),I=j=O=G=oe=z=Y=null}function _e(c,N){var _;return N!==void 0?_=N:b?_=oe:_=o(O||j),c===I&&_===G}function rt(c,N,_){for(var W=c;W&&!Q();)W=S(W);return W;function Q(){var Z=te(W);if(Z===!1)return!1;var ge=it(W,c),de=st(W,ge,N,_),pe=_e(W,de);return pe?!0:x.accepts(j,W,I,de)}}function Ae(c){if(!b)return;c.preventDefault();var N=E("clientX",c)||0,_=E("clientY",c)||0;b.style.left=N-2+"px",b.style.top=_-2+"px";var W=O||j,Q=D(b,N,_),Z=rt(Q,N,_),ge=Z!==null&&Z!==Y;(ge||Z===null)&&(fe(),Y=Z,ve()),Qt(Q,_);var de=S(W);if(Z===I&&O&&!x.copySortSource){de&&de.removeChild(W);return}var pe,me=it(Z,Q);if(ee=Ut(me,Z),me!==null)pe=st(Z,me,N,_);else if(x.revertOnSpill===!0&&!O)pe=G,Z=I;else{O&&de&&de.removeChild(W),O&&q&&(q.style.display="none");return}q.style.display="block",$t(pe,W,ge),pe?Xt(me,pe):Ht(Z);function ie(le){$.emit(le,W,Y,I)}function ve(){ge&&ie("over")}function fe(){Y&&ie("out")}}function $t(c,N,_){(c===N||c===o(N))&&(oe=o(N)),(c===null&&_||c!==N&&c!==o(N))&&(oe=c)}function Lt(c){g.rm(c,"gu-hide")}function qt(c){$.dragging&&g.add(c,"gu-hide")}function Ft(){b||(b=document.createElement("div"),b.style="background: grey; color: white; height: 24px; text-align: center; padding: 3px 10px; min-width: 100px;border-radius: 4px; box-shadow: 0 0 6px grey;",b.innerHTML=x.getMirrorText&&x.getMirrorText(j)||"控件",g.add(b,"gu-mirror"),x.mirrorContainer.appendChild(b),s(P,"add","mousemove",Ae),g.add(x.mirrorContainer,"gu-unselectable"),$.emit("cloned",b,j,"mirror"))}function Wt(){if(q=document.createElement("div"),g.add(q,"gu-insertion"),j){var c=j.getBoundingClientRect();q.style.left=c.left+"px",q.style.top=c.top+"px"}ee=!1,x.mirrorContainer.appendChild(q)}function zt(){b&&(g.rm(x.mirrorContainer,"gu-unselectable"),s(P,"remove","mousemove",Ae),S(b).removeChild(b),b=null)}function Gt(){q&&(S(q).removeChild(q),q=null)}function it(c,N){for(var _=N;_!==c&&S(_)!==c;)_=S(_);return _===P?null:_}function Ut(c,N){if(!N)return ee;var _=c||N&&N.lastElementChild;if(!_)return!0;var W=getComputedStyle(c),Q=/^inline/.test(W.getPropertyValue("display"))||/^(left|right)$/.test(W.getPropertyValue("float"));if(Q)return!0;if(N){var Z=getComputedStyle(N),ge=Z.getPropertyValue("display");if(/flex$/.test(ge)){var de=Z.getPropertyValue("flex-direction")||"row";if(de==="row"||de==="row-reverse")return!Yt(N)}return!1}return!0}function Yt(c){if(!c.children||!c.children.length)return!1;for(const N of Array.from(c.children)){const W=(N.className&&N.className.split(" ")||[]).filter(Q=>/^col(-md|-xl|-el){0,1}-([1-9]|10|11|12)$/.test(Q));if(!W.length)return!1;for(const Q of W){const Z=Q.slice(Q.lastIndexOf("-")+1);if(parseInt(Z,10)!==12)return!1}}return!0}function Xt(c,N){const _=N.getBoundingClientRect();if(q.style.left=_.left+"px",q.style.top=_.top+"px",ee){if(q.style.height=_.height+"px",q.style.width="4px",c){const W=c.getBoundingClientRect();W.top!==_.top&&(q.style.left=W.right+"px",q.style.top=W.top+"px",q.style.height=W.height+"px")}}else if(q.style.height="4px",q.style.width=_.width+"px",v){const W=v.getBoundingClientRect();_.top<W.top&&(q.style.display="none")}N===j&&j&&(q.style.display="none")}function Ht(c){oe=null;var N=c.lastElementChild;if(N){var _=N.getBoundingClientRect();ee?(q.style.left=_.right+"px",q.style.top=_.top+"px",q.style.height=_.height+"px",q.style.width="4px"):(q.style.left=_.left+"px",q.style.top=_.bottom+"px",q.style.height="4px",q.style.width=_.width+"px"),N===j&&j&&(q.style.display="none")}else q.style.display="none"}function Qt(c,N){if(!x.mirrorContainer.contains(c)||!window.scrollContainerList||!Array.from(window.scrollContainerList).length||(v=r(c),!v||!v.contains(c)))return;const _=document.querySelector(".dgComponentSelected"),W=v.getBoundingClientRect();if(N-30<W.top&&v.scrollTop>0){let Q=v.scrollTop<10?v.scrollTop:10;v.scrollBy(0,-1*Q),_&&v.contains(_)&&(ae=ae+-1*Q)}if(N+30>W.bottom&&v.scrollTop<v.scrollHeight-v.clientHeight){const Q=v.scrollHeight-v.clientHeight-v.scrollTop;let Z=Q<10?Q:10;v.scrollBy(0,Z),_&&v.contains(_)&&(ae=ae+Z)}}function st(c,N,_,W){var Q=x.direction==="horizontal",Z=x.direction==="mixed",ge=N!==c?pe():de();return ge;function de(){var ie=c.children.length,ve,fe,le;for(ve=0;ve<ie;ve++)if(fe=c.children[ve],le=fe.getBoundingClientRect(),Q&&le.left+le.width/2>_||!Z&&!Q&&le.top+le.height/2>W||Z&&le.left+le.width>_&&le.top+le.height>W)return fe;return null}function pe(){var ie=N.getBoundingClientRect();if(Z){var ve=W-ie.top,fe=_-ie.left,le=ie.bottom-W,Ve=ie.right-_,$e=Math.min(fe,Ve,ve,le),Le;return ee?Le=Ve<fe:Le=le===$e||Ve===$e||fe===$e,me(Le)}return me(Q?_>ie.left+A(ie)/2:W>ie.top+k(ie)/2)}function me(ie){return ie?o(N):N}}function Zt(c,N){return typeof x.copy=="boolean"?x.copy:x.copy(c,N)}}function r(d){const y=Array.from(window.scrollContainerList);if(y.length===1){const b=Array.from(window.scrollContainerList)[0];return document.getElementById(b)}const l=f(y);for(const b of l)if(b.contains(d))return b;return null}function f(d){const y=[];return d.forEach(l=>{const b=document.getElementById(l);b&&y.push(b)}),y.sort((l,b)=>l.contains(b)?1:b.contains(l)?-1:0),y}function s(d,y,l,b){var I={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},j={mouseup:"pointerup",mousedown:"pointerdown",mousemove:"pointermove"},L={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};i.navigator.pointerEnabled?w[y](d,j[l],b):i.navigator.msPointerEnabled?w[y](d,L[l],b):(w[y](d,I[l],b),w[y](d,l,b))}function n(d){if(d.touches!==void 0)return d.touches.length;if(d.which!==void 0&&d.which!==0)return d.which;if(d.buttons!==void 0)return d.buttons;var y=d.button;if(y!==void 0)return y&1?1:y&2?3:y&4?2:0}function D(d,y,l){d=d||{};var b=d.className||"",I;return d.className+=" gu-hide",I=M.elementFromPoint(y,l),d.className=b,I}function B(){return!1}function R(){return!0}function A(d){return d.width||d.right-d.left}function k(d){return d.height||d.bottom-d.top}function S(d){return d.parentNode===M?null:d.parentNode}function F(d){return d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.tagName==="SELECT"||m(d)}function m(d){return!d||d.contentEditable==="false"?!1:d.contentEditable==="true"?!0:m(S(d))}function o(d){return d.nextElementSibling||y();function y(){var l=d;do l=l.nextSibling;while(l&&l.nodeType!==1);return l}}function V(d){return d.targetTouches&&d.targetTouches.length?d.targetTouches[0]:d.changedTouches&&d.changedTouches.length?d.changedTouches[0]:d}function E(d,y){var l=V(y),b={pageX:"clientX",pageY:"clientY"};return d in b&&!(d in l)&&b[d]in l&&(d=b[d]),l[d]}h.exports=p}).call(this,typeof be<"u"?be:typeof self<"u"?self:typeof window<"u"?window:{})},{"./classes":1,"contra/emitter":5,crossvent:6}],3:[function(t,h,u){h.exports=function(T,w){return Array.prototype.slice.call(T,w)}},{}],4:[function(t,h,u){var i=t("ticky");h.exports=function(w,g,M){w&&i(function(){w.apply(M||null,g||[])})}},{ticky:10}],5:[function(t,h,u){var i=t("atoa"),T=t("./debounce");h.exports=function(g,M){var P=M||{},p={};return g===void 0&&(g={}),g.on=function(r,f){return p[r]?p[r].push(f):p[r]=[f],g},g.once=function(r,f){return f._once=!0,g.on(r,f),g},g.off=function(r,f){var s=arguments.length;if(s===1)delete p[r];else if(s===0)p={};else{var n=p[r];if(!n)return g;n.splice(n.indexOf(f),1)}return g},g.emit=function(){var r=i(arguments);return g.emitterSnapshot(r.shift()).apply(this,r)},g.emitterSnapshot=function(r){var f=(p[r]||[]).slice(0);return function(){var s=i(arguments),n=this||g;if(r==="error"&&P.throws!==!1&&!f.length)throw s.length===1?s[0]:s;return f.forEach(function(B){P.async?T(B,s,n):B.apply(n,s),B._once&&g.off(r,B)}),g}},g}},{"./debounce":4,atoa:3}],6:[function(t,h,u){(function(i){var T=t("custom-event"),w=t("./eventmap"),g=i.document,M=r,P=s,p=[];i.addEventListener||(M=f,P=n),h.exports={add:M,remove:P,fabricate:D};function r(S,F,m,o){return S.addEventListener(F,m,o)}function f(S,F,m){return S.attachEvent("on"+F,R(S,F,m))}function s(S,F,m,o){return S.removeEventListener(F,m,o)}function n(S,F,m){var o=A(S,F,m);if(o)return S.detachEvent("on"+F,o)}function D(S,F,m){var o=w.indexOf(F)===-1?E():V();S.dispatchEvent?S.dispatchEvent(o):S.fireEvent("on"+F,o);function V(){var d;return g.createEvent?(d=g.createEvent("Event"),d.initEvent(F,!0,!0)):g.createEventObject&&(d=g.createEventObject()),d}function E(){return new T(F,{detail:m})}}function B(S,F,m){return function(V){var E=V||i.event;E.target=E.target||E.srcElement,E.preventDefault=E.preventDefault||function(){E.returnValue=!1},E.stopPropagation=E.stopPropagation||function(){E.cancelBubble=!0},E.which=E.which||E.keyCode,m.call(S,E)}}function R(S,F,m){var o=A(S,F,m)||B(S,F,m);return p.push({wrapper:o,element:S,type:F,fn:m}),o}function A(S,F,m){var o=k(S,F,m);if(o){var V=p[o].wrapper;return p.splice(o,1),V}}function k(S,F,m){var o,V;for(o=0;o<p.length;o++)if(V=p[o],V.element===S&&V.type===F&&V.fn===m)return o}}).call(this,typeof be<"u"?be:typeof self<"u"?self:typeof window<"u"?window:{})},{"./eventmap":7,"custom-event":8}],7:[function(t,h,u){(function(i){var T=[],w="",g=/^on/;for(w in i)g.test(w)&&T.push(w.slice(2));h.exports=T}).call(this,typeof be<"u"?be:typeof self<"u"?self:typeof window<"u"?window:{})},{}],8:[function(t,h,u){(function(i){var T=i.CustomEvent;function w(){try{var g=new T("cat",{detail:{foo:"bar"}});return g.type==="cat"&&g.detail.foo==="bar"}catch{}return!1}h.exports=w()?T:typeof document<"u"&&typeof document.createEvent=="function"?function(M,P){var p=document.createEvent("CustomEvent");return P?p.initCustomEvent(M,P.bubbles,P.cancelable,P.detail):p.initCustomEvent(M,!1,!1,void 0),p}:function(M,P){var p=document.createEventObject();return p.type=M,P?(p.bubbles=!!P.bubbles,p.cancelable=!!P.cancelable,p.detail=P.detail):(p.bubbles=!1,p.cancelable=!1,p.detail=void 0),p}}).call(this,typeof be<"u"?be:typeof self<"u"?self:typeof window<"u"?window:{})},{}],9:[function(t,h,u){var i=h.exports={},T,w;function g(){throw new Error("setTimeout has not been defined")}function M(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?T=setTimeout:T=g}catch{T=g}try{typeof clearTimeout=="function"?w=clearTimeout:w=M}catch{w=M}})();function P(k){if(T===setTimeout)return setTimeout(k,0);if((T===g||!T)&&setTimeout)return T=setTimeout,setTimeout(k,0);try{return T(k,0)}catch{try{return T.call(null,k,0)}catch{return T.call(this,k,0)}}}function p(k){if(w===clearTimeout)return clearTimeout(k);if((w===M||!w)&&clearTimeout)return w=clearTimeout,clearTimeout(k);try{return w(k)}catch{try{return w.call(null,k)}catch{return w.call(this,k)}}}var r=[],f=!1,s,n=-1;function D(){!f||!s||(f=!1,s.length?r=s.concat(r):n=-1,r.length&&B())}function B(){if(!f){var k=P(D);f=!0;for(var S=r.length;S;){for(s=r,r=[];++n<S;)s&&s[n].run();n=-1,S=r.length}s=null,f=!1,p(k)}}i.nextTick=function(k){var S=new Array(arguments.length-1);if(arguments.length>1)for(var F=1;F<arguments.length;F++)S[F-1]=arguments[F];r.push(new R(k,S)),r.length===1&&!f&&P(B)};function R(k,S){this.fun=k,this.array=S}R.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={};function A(){}i.on=A,i.addListener=A,i.once=A,i.off=A,i.removeListener=A,i.removeAllListeners=A,i.emit=A,i.prependListener=A,i.prependOnceListener=A,i.listeners=function(k){return[]},i.binding=function(k){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(k){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],10:[function(t,h,u){(function(i){var T=typeof i=="function",w;T?w=function(g){i(g)}:w=function(g){setTimeout(g,0)},h.exports=w}).call(this,t("timers").setImmediate)},{timers:11}],11:[function(t,h,u){(function(i,T){var w=t("process/browser.js").nextTick,g=Function.prototype.apply,M=Array.prototype.slice,P={},p=0;u.setTimeout=function(){return new r(g.call(setTimeout,window,arguments),clearTimeout)},u.setInterval=function(){return new r(g.call(setInterval,window,arguments),clearInterval)},u.clearTimeout=u.clearInterval=function(f){f.close()};function r(f,s){this._id=f,this._clearFn=s}r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},u.enroll=function(f,s){clearTimeout(f._idleTimeoutId),f._idleTimeout=s},u.unenroll=function(f){clearTimeout(f._idleTimeoutId),f._idleTimeout=-1},u._unrefActive=u.active=function(f){clearTimeout(f._idleTimeoutId);var s=f._idleTimeout;s>=0&&(f._idleTimeoutId=setTimeout(function(){f._onTimeout&&f._onTimeout()},s))},u.setImmediate=typeof i=="function"?i:function(f){var s=p++,n=arguments.length<2?!1:M.call(arguments,1);return P[s]=!0,w(function(){P[s]&&(n?f.apply(null,n):f.call(null),u.clearImmediate(s))}),s},u.clearImmediate=typeof T=="function"?T:function(f){delete P[f]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":9,timers:11}]},{},[2])(2)})})(Xe);var Dt=Xe.exports;const He=Tt(Dt);function St(e){let C;function t(u,i,T,w){const g=e.schema;if(!(g!=null&&g.buttons))return;let M;if(T){const f=T.getAttribute("id");M=Array.from(i.children).findIndex(s=>s.getAttribute("id")===f)}else M=Array.from(i.children).length;const P=u.getAttribute("id"),p=Array.from(i.children).findIndex(f=>f.getAttribute("id")===P),r=g.buttons[p];p!==M&&p>-1&&M>-1&&(p<M&&(M=M-1),g.buttons.splice(p,1),g.buttons.splice(M,0,r),w(),a.nextTick(()=>{const f=i.querySelector(".dgComponentSelected");f!=null&&f.className.includes("dgComponentSelected")&&(f.classList.remove("dgComponentSelected"),f.classList.remove("dgComponentFocused"),f.click()),ye.canvasChanged.value++}))}function h(u,i,T){C&&C.destroy(),!(!He||!u||!i)&&(C=He([u],{mirrorContainer:i,direction:"horizontal",getMirrorText(w){return w.innerText},moves(w,g,M){let P=!0;return M.classList.contains("dropdown-item")?(P=!1,P):(w.classList.contains("no-drag")&&(P=!1),P)}}).on("drop",(w,g,M,P)=>t(w,g,P,T)))}return{dragulaInstance:C,initDragula:h}}function kt(e,C,t){const{renderToolbarItemDesigner:h,actionHandlers:u}=t;let i;function T(R){i=R}function w(R,A=null){const k=C.value.find(S=>S.id===R.id);if(k.isDP)if(document.body.click(),typeof A=="boolean")k.expanded=A;else{const S=R.expanded;k.expanded=!S}}u.toggleDropdownMenu=w;function g(R){var k;const A={"dropdown-menu":!0};if(R.class){const S=(k=R.menuClass)==null?void 0:k.split(" ");S&&S.length&&S.reduce((F,m)=>(F[m]=!0,F),A)}return A}function M(R){const A={disabled:R.disabled===!1,"dropdown-submenu":!0,"f-rt-dropdown":!0,"text-truncate":!0};return X.getCustomClass(A,R.dropdownClass||"")}function P(R){const A={disabled:!1,"dropdown-item":!0,"f-rt-btn":!0,"position-relative":!0,"farris-component":!0,"text-truncate":!0};return X.getCustomClass(A,R.class||"")}let p;const r=new Map;function f(R,A,k){R.stopPropagation();const S=k?k.id:"__top_item__";if(A.children&&A.children.length&&(A.expanded=!A.expanded,A.expanded)){if(r.has(S)&&r.get(S)!==A){const F=r.get(S);F&&(F.expanded=!1,r.delete(S))}r.set(S,A)}}function s(R){var A;return(A=R.children)==null?void 0:A.map((k,S)=>k.children&&k.children.length?a.createVNode("li",{class:M(k),id:k.id},[a.createVNode("span",{class:P(k),onClick:F=>f(F,k,R)},[k.text,a.createVNode("i",{class:"f-icon f-icon-arrow-chevron-right",style:"display: inline-block;float: right;line-height: 1.25rem;"},null)]),p(k,k)]):h(k,S,!0))}function n(R,A,k,S){const{height:o,left:V,top:E}=S[0],{width:d,height:y}=k.getBoundingClientRect(),{marginTop:l,marginBottom:b}=getComputedStyle(k),I=Math.ceil(parseFloat(l))+Math.ceil(parseFloat(b)),j=E+o,L=A==null?void 0:A.getBoundingClientRect();function H(){let z=0,Y="left";const U=L?L.right:window.innerWidth,q=L?L.left:0;return z=U-V-10,U-V<d&&V-q>U-V&&(Y="right",z=V-q-10),{hposition:Y,maxWidth:Math.min(z,300)}}let G=0,oe="bottom";if(R==="tabs"||R==="section")G=A.getBoundingClientRect().bottom-j-I-10;else{const z=L?L.bottom:window.innerHeight;oe=z-j>=E?"bottom":"top",G=Math.max(E,z-j),G=G-I-10}const O=H();return{position:oe+"-"+O.hposition,maxWidth:O.maxWidth,maxHeight:G}}function D(R){var m,o,V,E;const A="300px",k={display:R.expanded===!0?"block":"none",position:"absolute",maxWidth:A,minWidth:"120px"};if(!(i!=null&&i.value))return k;const S=i.value.querySelector("#"+R.id),F=S==null?void 0:S.getClientRects();if(S&&F&&F.length>0){const d=S?S.querySelector("#"+R.id+"_menu"):null;if(!d||R.expanded!==!0)return k;d.style.visibility="hidden",d.style.display="block",d.style.maxHeight="auto",d.style.maxWidth=A;let y;switch(u.toolbarPosition){case"tabs":y=(m=i.value)==null?void 0:m.closest(".farris-tabs");break;case"section":y=(o=i.value)==null?void 0:o.closest(".f-section");break;case"drawer-header-toolbar":case"drawer-footer-toolbar":y=(V=i.value)==null?void 0:V.closest(".f-drawer-container");break;default:y=(E=i.value)==null?void 0:E.closest(".f-page")}const l=n(u.toolbarPosition,y,d,F),{position:b,maxHeight:I,maxWidth:j}=l;d.style.visibility="visible";const L={left:b.indexOf("left")>-1?0:"unset",right:b.indexOf("left")>-1?"unset":0,bottom:b.indexOf("bottom")>-1?"unset":"100%",top:b.indexOf("bottom")>-1?"!00%":"unset",maxWidth:j?j+"px":"300px",maxHeight:I?I+"px":"auto",overflowY:I?"auto":"unset"};Object.assign(k,L)}return k}u.changeMenuPosition=D,p=function(R,A){return a.createVNode("ul",{class:g(R),style:D(R),id:R.id+"_menu"},[s(R)])};function B(R=""){R&&r.has(R)?r.forEach((A,k)=>{k!==R&&(A.expanded=!1,r.delete(k))}):(r.forEach(A=>{A.expanded=!1}),r.clear())}return{renderDropdownMenu:p,clearAllDropDownMenu:B,setResponseToolbarRef:T}}class It extends Fe.BaseControlProperty{constructor(t,h,u="response-toolbar-item"){super(t,h);J(this,"toolbarType","response-toolbar-item");this.toolbarType=u}getPropertyConfig(t,h=!1){this.propertyConfig.categories.basic=this.getBasicPropConfig(t),this.propertyConfig.categories.basic.properties.text={title:"文本",type:"string",description:"",refreshPanelAfterChanged:!0},this.propertyConfig.categories.basic.setPropertyRelates=i=>{if(i)switch(i&&i.propertyID){case"text":{i.needRefreshControlTree=!0;break}}},this.getAppearanceProperties(t,h);const u=this.getPropertyEditorParams(t,["Const","Variable","StateMachine","Custom","Expression"],"disabled");return this.propertyConfig.categories.behavior=this.getBehaviorConfig(t,"",{disabled:{title:"禁用",type:"boolean",description:"按钮禁用状态",editor:u}}),this.getEventPropConfig(t),this.propertyConfig}getAppearanceProperties(t,h=!1){this.propertyConfig.categories.appearance={title:"外观",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"",$converter:"/converter/appearance.converter",parentPropertyID:"appearance",visible:!h},icon:{title:"图标",type:"string",description:""},dropdownClass:{title:"下拉按钮样式",type:"string",description:"下拉按钮样式",visible:!!(t.children&&t.children.length>0)},split:{title:"下拉按钮分离",type:"boolean",description:"启用下拉按钮分离,可以单独点击按钮。单独点击下拉按钮展开下拉面板",visible:!!(t.children&&t.children.length>0)},tipsEnable:{title:"启用提示",type:"boolean",description:"当启用提示时,鼠标滑过按钮会有消息提示框",refreshPanelAfterChanged:!0,visible:this.toolbarType==="response-toolbar-item"},tipsText:{title:"提示消息内容",type:"string",description:"消息提示框内的展示内容",visible:t.tipsEnable===!0}}}}getEventPropConfig(t){const h=[{label:"onClick",name:"点击事件"}],u=this,i=u.eventsEditorUtils.formProperties(t,u.viewModelId,h),T=u.createBaseEventProperty(i);this.propertyConfig.categories.eventsEditor={title:"事件",hideTitle:!0,properties:T,refreshPanelAfterChanged:!0,tabId:X.EVENT_PROPERTY_TAB_IDS,tabName:"交互",setPropertyRelates(w,g){const M=w.propertyValue;delete t[u.viewModelId],M&&(M.setPropertyRelates=this.setPropertyRelates,u.eventsEditorUtils.saveRelatedParameters(t,u.viewModelId,M.events,M))}}}}function Me(e,C){if(!e)return!1;const t=C||[];return(t==null?void 0:t.findIndex(u=>u.id===e))===-1}function Qe(e,C){const t=C||[];let h={parentIndex:-1,itemIndex:-1};return t.some((u,i)=>{if(u.children&&u.children.length>0){const T=u.children.findIndex(w=>w.id===e);return T>-1?(h={parentIndex:i,itemIndex:T},!0):!1}}),h}function Ze(e,C){const t=C||[];let h={parentIndex:-1,itemIndex:-1};const u=t==null?void 0:t.findIndex(i=>i.id===e);return u>-1?{parent:null,item:t[u]}:(t.some((i,T)=>{if(i.children&&i.children.length>0){const w=i.children.findIndex(g=>g.id===e);return w>-1?(h={parentIndex:T,itemIndex:w},!0):!1}}),h.parentIndex<0?{parent:null,item:null}:{parent:t[h.parentIndex],item:t[h.parentIndex].children[h.itemIndex]})}function Pt(e,C){const t=C||[],h=t==null?void 0:t.findIndex(u=>u.id===e);return h>-1&&t[h].children&&t[h].children.length>0?t[h].expanded===!0:!1}function Et(e,C){let t;function h(p){const{properties:r,title:f,ignore:s}=p,n=s&&Array.isArray(s),D=Object.keys(r).reduce((B,R)=>((!n||!s.find(A=>A===R))&&(B[R]=r[R].type==="object"&&r[R].properties?h(r[R]):we.cloneDeep(r[R].default)),B),{});if(f&&(!n||!s.find(B=>B==="id"))){const B=f.toLowerCase().replace(/-/g,"_");D.id=`${B}_${Math.random().toString().slice(2,6)}`}return D}function u(p){const{properties:r,title:f,required:s}=p;if(s&&Array.isArray(s)){const n=s.reduce((D,B)=>(D[B]=r[B].type==="object"&&r[B].properties?h(r[B]):we.cloneDeep(r[B].default),D),{});if(f&&s.find(D=>D==="id")){const D=f.toLowerCase().replace(/-/g,"_");n.id=`${D}_${Math.random().toString().slice(2,6)}`}return n}return{type:f}}function i(p,r={},f){const s=e[p];if(s){let n=u(s);const D=C[p];return n=D?D({getSchemaByType:i},n,r,f):n,t!=null&&t.appendIdentifyForNewControl&&t.appendIdentifyForNewControl(n),n}return null}function T(p,r){const f=h(r);return Object.keys(f).reduce((s,n)=>(Object.prototype.hasOwnProperty.call(p,n)&&(s[n]&&we.isPlainObject(s[n])&&we.isPlainObject(p[n]||!p[n])?Object.assign(s[n],p[n]||{}):s[n]=p[n]),s),f),f}function w(p,r){return Object.keys(p).filter(s=>p[s]!=null).reduce((s,n)=>{if(r.has(n)){const D=r.get(n);if(typeof D=="string")s[D]=p[n];else{const B=D(n,p[n],p);Object.assign(s,B)}}else s[n]=p[n];return s},{})}function g(p,r,f=new Map){const s=T(p,r);return w(s,f)}function M(p){var f;const r=p.type;if(r){const s=e[r];if(!s)return p;const n=T(p,s),D=((f=p.editor)==null?void 0:f.type)||"";if(D){const B=e[D],R=T(p.editor,B);n.editor=R}return n}return p}function P(p){t=p}return{getSchemaByType:i,resolveSchemaWithDefaultValue:M,resolveSchemaToProps:g,mappingSchemaToProps:w,setDesignerContext:P}}const Mt={},jt={},{getSchemaByType:Nt}=Et(Mt,jt);function Rt(e,C,t){function h(y){return!1}function u(){return!1}function i(){return!1}function T(){return!1}function w(){return t.toolbarContext.schema.buttons||[]}function g(y,l=""){setTimeout(()=>{var L,H;const b=(L=e.parent)==null?void 0:L.designerItemElementRef.value;let I;l&&(I=b==null?void 0:b.querySelector("#"+l));const j=(H=I||b)==null?void 0:H.querySelector("#"+y);j==null||j.click()},0)}function M(y,l){l.disabled&&l.disabled.expressionId&&(l.disabled.expressionId=`${l.id}_disabled`),l.visible&&l.visible.expressionId&&(l.visible.expressionId=`${l.id}_visible`);const b=C.formSchemaUtils.getExpressions(),I=b.find(L=>L.target===y.id);if(!I||!I.rules||!I.rules.length)return;const j={target:l.id,rules:[],targetType:"Button"};I.rules.forEach(L=>{const H=Object.assign(we.cloneDeep(L),{id:`${l.id}_${L.type}`});j.rules.push(H)}),b.push(j)}function P(){var I;const y=e.schema,l=Object.assign(we.cloneDeep(y),{id:`${e.schema.type}-cloned-${Math.random().toString(36).slice(2,6)}`,onClick:null});(I=C==null?void 0:C.designerContext)!=null&&I.appendIdentifyForNewControl&&C.designerContext.appendIdentifyForNewControl(l);let b=[];return l.children&&l.children.length&&(b=l.children.map(j=>{var H;const L=we.cloneDeep(j);return Object.assign(L,{id:`${e.schema.type}-cloned-${Math.random().toString(36).slice(2,6)}`,onClick:null}),(H=C==null?void 0:C.designerContext)!=null&&H.appendIdentifyForNewControl&&C.designerContext.appendIdentifyForNewControl(L),M(j,L),L}),l.children=b),M(y,l),l}function p(){const y=e.schema.type||"response-toolbar-item",l=Nt(y),b=y.toLowerCase().replace("-","_");return l&&!l.id&&l.type===y&&(l.id=`${b}_${Math.random().toString().slice(2,6)}`,l.text="按钮"),l}function r(y){const l=w(),b=l==null?void 0:l.findIndex(j=>j.id===y),I=b===-1?null:l[b];return{index:b,toolbarItem:I}}function f(){const y=e.schema.id,l=w();return Me(y,l)}functio