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