UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1 lines 82.1 kB
(function(J,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue"),require("lodash-es"),require("bignumber.js"),require("../common/index.umd.js"),require("../designer-canvas/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","bignumber.js","../common/index.umd.js","../designer-canvas/index.umd.js"],c):(J=typeof globalThis<"u"?globalThis:J||self,c(J["response-toolbar"]={},J.Vue,J.LodashES,J.BigNumber,J.common,J.designerCanvas))})(this,function(J,c,oe,Pn,fe,Oe){"use strict";var In=Object.defineProperty;var En=(J,c,oe)=>c in J?In(J,c,{enumerable:!0,configurable:!0,writable:!0,value:oe}):J[c]=oe;var q=(J,c,oe)=>En(J,typeof c!="symbol"?c+"":c,oe);class je{constructor(t){q(this,"id","");q(this,"class","btn-secondary");q(this,"icon","");q(this,"groupId","");q(this,"order",-1);q(this,"asDropDownTop",!1);q(this,"text","");q(this,"visible",!0);q(this,"shown",!0);q(this,"responsed",!1);q(this,"tipsEnable",!1);q(this,"tipsText","");q(this,"width",0);q(this,"dropdownClass","");q(this,"onClick",()=>{});q(this,"options");var n,r;this.options=t;const e=["id","class","icon","groupId","order","asDropDownTop","text","isDP","visible","responsed","width","tipsEnable","tipsText","dropdownClass","onClick"];Object.keys(t).filter(i=>e.indexOf(i)>-1).forEach(i=>{i==="visible"?this[i]=t[i]===void 0?!0:t[i]:this[i]=t[i]}),this.shown=this.visible,(n=t.appearance)!=null&&n.class&&(this.class=(r=t.appearance)==null?void 0:r.class)}get enable(){return Object.keys(this.options).indexOf("disabled")>-1?!this.options.disabled:c.computed(()=>!0)}setWidth(t){this.width=parseInt(t,10)}getWidth(){return this.visible?this.width:!1}}class _e extends je{constructor(t){super(t)}}function $e(){function o(t){const e=[];return t.reduce((n,r)=>(r.children&&r.children.length>0?n.push(new pe(r)):n.push(new _e(r)),n),e),e}return{buildResponseToolbarItems:o}}const{buildResponseToolbarItems:ft}=$e();class pe extends je{constructor(e){super(e);q(this,"placement","");q(this,"visible",!0);q(this,"dropdownClass","");q(this,"menuClass","");q(this,"split",!1);q(this,"children",[]);q(this,"expanded",!1);q(this,"shown",!0);const n=["visible","icon","isDP","class","dropdownClass","menuClass","placement","split","expanded"];Object.keys(e).filter(r=>n.indexOf(r)>-1).forEach(r=>{r==="visible"?this[r]=e[r]===void 0?!0:e[r]:this[r]=e[r]}),this.shown=this.visible,e.children&&e.children.length&&(this.children=ft(e.children))}}class pt{constructor(t,e){q(this,"id");q(this,"name");q(this,"presetId",[]);q(this,"responsedIndex",[]);q(this,"width");this.id=t,this.name=e,this.width=0}setWidth(t){this.width=parseInt(t+"",10)}getWidth(){return this.width}setPreset(t){Array.isArray(t)?this.presetId=this.presetId.concat(t):this.presetId.push(t)}delPreset(){this.presetId=[]}removeResponsed(t){this.responsedIndex.splice(t,1)}setResponsed(t){Array.isArray(t)?this.responsedIndex=this.responsedIndex.concat(t):this.responsedIndex.push(t)}isResponsing(){return this.responsedIndex.length>0}isResponsed(){return this.presetId.length===this.responsedIndex.length}}const Fe={},Le={};function ve(o){const{properties:t,title:e,ignore:n}=o,r=n&&Array.isArray(n),i=Object.keys(t).reduce((s,g)=>((!r||!n.find(d=>d===g))&&(s[g]=t[g].type==="object"&&t[g].properties?ve(t[g]):oe.cloneDeep(t[g].default)),s),{});if(e&&(!r||!n.find(s=>s==="id"))){const s=e.toLowerCase().replace(/-/g,"_");i.id=`${s}_${Math.random().toString().slice(2,6)}`}return i}function gt(o){const{properties:t,title:e,required:n}=o;if(n&&Array.isArray(n)){const r=n.reduce((i,s)=>(i[s]=t[s].type==="object"&&t[s].properties?ve(t[s]):oe.cloneDeep(t[s].default),i),{});if(e&&n.find(i=>i==="id")){const i=e.toLowerCase().replace(/-/g,"_");r.id=`${i}_${Math.random().toString().slice(2,6)}`}return r}return{type:e}}function ge(o,t={},e){const n=Fe[o];if(n){let r=gt(n);const i=Le[o];return r=i?i({getSchemaByType:ge},r,t,e):r,r}return null}function ht(o,t){const e=ve(t);return Object.keys(e).reduce((n,r)=>(Object.prototype.hasOwnProperty.call(o,r)&&(n[r]&&oe.isPlainObject(n[r])&&oe.isPlainObject(o[r]||!o[r])?Object.assign(n[r],o[r]||{}):n[r]=o[r]),n),e),e}function qe(o,t){return Object.keys(o).filter(n=>o[n]!=null).reduce((n,r)=>{if(t.has(r)){const i=t.get(r);if(typeof i=="string")n[i]=o[r];else{const s=i(r,o[r],o);Object.assign(n,s)}}else n[r]=o[r];return n},{})}function mt(o,t,e=new Map){const n=ht(o,t);return qe(n,e)}function bt(o={}){function t(p,m,a,h){if(typeof a=="number")return h[p].length===a;if(typeof a=="object"){const f=Object.keys(a)[0],b=a[f];if(f==="not")return Number(h[p].length)!==Number(b);if(f==="moreThan")return Number(h[p].length)>=Number(b);if(f==="lessThan")return Number(h[p].length)<=Number(b)}return!1}function e(p,m,a,h){return h[p]&&h[p].propertyValue&&String(h[p].propertyValue.value)===String(a)}const n=new Map([["length",t],["getProperty",e]]);Object.keys(o).reduce((p,m)=>(p.set(m,o[m]),p),n);function r(p,m){const a=p;return typeof m=="number"?[{target:a,operator:"length",param:null,value:Number(m)}]:typeof m=="boolean"?[{target:a,operator:"getProperty",param:p,value:!!m}]:typeof m=="object"?Object.keys(m).map(h=>{if(h==="length")return{target:a,operator:"length",param:null,value:m[h]};const f=h,b=m[h];return{target:a,operator:"getProperty",param:f,value:b}}):[]}function i(p){return Object.keys(p).reduce((a,h)=>{const f=r(h,p[h]);return a.push(...f),a},[])}function s(p,m){if(n.has(p.operator)){const a=n.get(p.operator);return a&&a(p.target,p.param,p.value,m)||!1}return!1}function g(p,m){return i(p).reduce((f,b)=>f&&s(b,m),!0)}function d(p,m){const a=Object.keys(p),h=a.includes("allOf"),f=a.includes("anyOf"),b=h||f,y=(b?p[b?h?"allOf":"anyOf":"allOf"]:[p]).map(I=>g(I,m));return h?!y.includes(!1):y.includes(!0)}return{parseValueSchema:d}}const vt={button:{type:"button",name:"按钮"},"response-toolbar":{type:"response-toolbar",name:"工具栏"},"response-toolbar-item":{type:"response-toolbar-item",name:"按钮"},"content-container":{type:"content-container",name:"容器"},"input-group":{type:"input-group",name:"文本"},textarea:{type:"textarea",name:"多行文本"},lookup:{type:"lookup",name:"帮助"},"number-spinner":{type:"number-spinner",name:"数值"},"date-picker":{type:"date-picker",name:"日期"},switch:{type:"switch",name:"开关"},"radio-group":{type:"radio-group",name:"单选组"},"check-box":{type:"check-box",name:"复选框"},"check-group":{type:"check-group",name:"复选框组"},"combo-list":{type:"combo-list",name:"下拉列表"},"response-form":{type:"response-form",name:"卡片面板"},"response-layout":{type:"response-layout",name:"布局容器",icon:"response-layout-3"},"response-layout-item":{type:"response-layout-item",name:"布局",icon:"response-layout-1"},"tree-grid":{type:"tree-grid",name:"树表格"},"tree-grid-column":{type:"tree-grid-column",name:"树表格列"},"data-grid":{type:"data-grid",name:"表格"},"data-grid-column":{type:"data-grid-column",name:"表格列"},module:{type:"Module",name:"模块"},component:{type:"component",name:"组件"},tabs:{type:"tabs",name:"标签页"},"tab-page":{type:"tab-page",name:"标签页项",dependentParentControl:"Tab"},"tab-toolbar-item":{type:"tab-toolbar-item",name:"标签页工具栏按钮"},"html-template":{type:"html-template",name:"模板容器"},"time-picker":{type:"time-picker",name:"时间选择"},section:{type:"section",name:"分组面板"},"section-toolbar":{type:"section-toolbar",name:"分组面板工具栏"},"section-toolbar-item":{type:"section-toolbar-item",name:"分组面板按钮"},splitter:{type:"splitter",name:"分栏面板"},"splitter-pane":{type:"splitter-pane",name:"分栏面板项",dependentParentControl:"Splitter"},"component-ref":{type:"component-ref",name:"组件引用节点"},uploader:{type:"uploader",name:"附件上传"},"page-header":{type:"page-header",name:"页头"},"page-footer":{type:"page-footer",name:"页脚"},"tab-toolbar":{type:"tab-toolbar",name:"标签页工具栏"},fieldset:{type:"fieldset",name:"分组"},"query-solution":{type:"query-solution",name:"筛选方案"},drawer:{type:"drawer",name:"抽屉"},"external-container":{type:"external-container",name:"外部容器",icon:"content-container"},"list-nav":{type:"list-nav",name:"列表导航"},"filter-bar":{type:"filter-bar",name:"筛选条"}},yt={},Ct={};bt();function Ue(o,t,e=new Map,n=(s,g,d,p)=>g,r={},i=s=>s){return Fe[t.title]=t,Le[t.title]=n,yt[t.title]=r,Ct[t.title]=i,(s={},g=!0)=>{if(!g)return qe(s,e);const d=mt(s,t,e),p=Object.keys(o).reduce((m,a)=>(m[a]=o[a].default,m),{});return Object.assign(p,d)}}function wt(o,t){return{customClass:t.class,customStyle:t.style}}function xt(o,t){if(!o||o.length<1)return null;for(const e of o){if(e.id===t)return e;if(e.children){const n=e.children.find(r=>r.id===t);if(n)return n}}return null}function Tt(){function o(t,e){const n=t.buttons;if(!n||n.length<1)return null;const[r,i]=e.payloads,s=xt(n,i);return s?s.onClick||s.click:null}return{resolve:o}}const St=new Map([["buttons","items"],["appearance",wt]]);function He(o,t,e){return t}const It={$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}},required:["id","type","buttons"],events:{onClick:"点击事件"}},Et={$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"]},ye={id:{type:String,default:""},customClass:{type:String,default:""},alignment:{Type:String,default:"right"},items:{Type:Array,default:[]},visible:{type:Boolean,default:!0}},Pt=Object.assign({},ye,{componentId:{type:String,default:""}}),Ce=Ue(ye,It,St,He),We={id:{type:String,default:""},item:{type:Object,default:{}},items:{type:Object,default:{}},class:{type:String,default:"btn-secondary"},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}},Mt=Ue(We,Et,void 0,He),kt=Tt();function we(){function o(e){const n={"f-icon":!0};if(e.icon){const r=e.icon.trim().split(" ");r&&r.length&&r.reduce((i,s)=>(i[s]=!0,i),n)}return n}function t(e){return!!(e.icon&&e.icon.trim())}return{iconClass:o,shouldShowIcon:t}}const Dt=["moz","ms","webkit"];function Vt(){let o=0;return t=>{const e=new Date().getTime(),n=Math.max(0,16-(e-o)),r=setTimeout(()=>{t(e+n)},n);return o=e+n,r}}function Nt(){if(typeof window>"u")return()=>0;if(window.requestAnimationFrame)return window.requestAnimationFrame.bind(window);const o=Dt.filter(t=>`${t}RequestAnimationFrame`in window)[0];return o?window[`${o}RequestAnimationFrame`]:Vt()}Nt();function xe(o,t){return((t==null?void 0:t.split(" "))||[]).reduce((n,r)=>(r&&(n[r]=!0),n),o),o}function Rt(o,t){function e(y){const u={"dropdown-menu":!0};if(y.class){const I=y.menuClass.split(" ");I&&I.length&&I.reduce((V,k)=>(V[k]=!0,V),u)}return u}function n(y){const u={disabled:!y.enable,"dropdown-submenu":!0,"f-rt-dropdown":!0,"text-truncate":!0};return xe(u,y.dropdownClass)}function r(y){const u={disabled:!y.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0};return xe(u,y.dropdownClass)}function i(y){const u={disabled:!y.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0,"f-rt-toggle":!0};return xe(u,y.dropdownClass)}let s;const g=new Map;function d(y,u,I){y.stopPropagation();const V=I?I.id:"__top_item__";if(u.children&&u.children.length&&(u.expanded=!u.expanded,u.expanded)){if(g.has(V)&&g.get(V)!==u){const k=g.get(V);k&&(k.expanded=!1,g.delete(V))}g.set(V,u)}}function p(y,u){document.body.click(),u.enable&&(y.stopPropagation(),typeof u.onClick=="function"&&u.onClick(y,u.id),o.emit("click",y,u.id))}function m(y,u){const I=y.target;I.className.indexOf("dropdown-item")<0||(I.title=I.scrollWidth>I.clientWidth?u:"")}function a(y,u){if(u.tipsEnable&&u.tipsText){const I=c.reactive({content:u.tipsText,enable:u.tipsEnable});return c.withDirectives(c.createVNode("li",{class:r(u),id:u.id,onClick:V=>p(V,u)},[c.createVNode("span",{class:"f-rt-btn text-truncate"},[t.shouldShowIcon(u)&&c.createVNode("i",{class:t.iconClass(u)},null),u.text])]),[[c.resolveDirective("tooltip"),I]])}return c.createVNode("li",{class:r(u),id:u.id,onClick:I=>p(I,u)},[c.createVNode("span",{class:"f-rt-btn text-truncate",onMouseenter:I=>m(I,u.text)},[t.shouldShowIcon(u)&&c.createVNode("i",{class:t.iconClass(u)},null),u.text])])}function h(y,u,I){u.enable&&(typeof u.onClick=="function"&&I.onClick(y,u.id),o.emit("click",y,u.id),d(y,u,I))}function f(y,u){if(u.tipsEnable&&u.tipsText){const I=c.reactive({content:u.tipsText,enable:u.tipsEnable});return c.createVNode("li",{class:n(u),id:u.id,onClick:V=>h(V,u,y)},[c.withDirectives(c.createVNode("span",{class:i(u)},[t.shouldShowIcon(u)&&c.createVNode("i",{class:t.iconClass(u)},null),u.text]),[[c.resolveDirective("tooltip"),I]]),s(u,u)])}return c.createVNode("li",{class:n(u),id:u.id,onClick:I=>h(I,u,y),onMouseenter:I=>m(I,u.text)},[c.createVNode("span",{class:i(u)},[t.shouldShowIcon(u)&&c.createVNode("i",{class:t.iconClass(u)},null),u.text]),s(u,u)])}function b(y){return y.children.filter(u=>u.visible).map(u=>u.children&&u.children.length?f(y,u):a(y,u))}function w(y,u,I){var _;const V={display:y.expanded?"block":"none",position:"fixed",maxWidth:"300px",minWidth:"120px",zIndex:1040},k=(_=document.getElementsByTagName("body")[0].getClientRects()[0])==null?void 0:_.width,A=u,O=A==null?void 0:A.getClientRects();if(A&&O&&O.length){const{top:U,width:T,left:l,right:E,height:D}=O[0],C=Math.ceil(D+U);V.top=`${C}px`,V.left=`${l}px`;const P=y.id+"_menu",R=u?u.querySelector("#"+P):null;if(R){R.style.visibility="hidden",R.style.display="block";const x=R.offsetHeight;V.display==="block"&&(R.style.display="block");const S=R.getBoundingClientRect();if(I){V.top=`${U-6}px`;const j=Math.ceil(T+l);V.left=`${j}px`}k-l-T<S.width&&(V.left=`${(I?l:E)-S.width}px`),window.innerHeight-U-D<x&&(U>x?V.top=`${U-x-6}px`:(V.maxHeight=`${U-16}px`,V.overflowY="auto",U-D>window.innerHeight-U&&(V.top="10px"))),R.style.visibility="visible"}}return V}s=function(y,u){var A,O;const I=c.getCurrentInstance(),V=u?u.id:y.id,k=(O=(A=I==null?void 0:I.exposed)==null?void 0:A.elementRef.value)==null?void 0:O.querySelector("#"+V);return c.createVNode("ul",{class:e(y),style:w(y,k,u),id:y.id+"_menu"},[b(y)])};function M(){g.forEach(y=>{y.expanded=!1}),g.clear()}return{renderDropdownMenu:s,clearAllDropDownMenu:M}}function Bt(o,t,e){const n=c.ref(o.alignment),{renderDropdownMenu:r,clearAllDropDownMenu:i}=Rt(t,e);function s(a){const h={"btn-group":!0,"f-rt-dropdown":!0,"f-btn-ml":n.value==="right"||n.value==="center","f-btn-mr":n.value==="left"},f=a.dropdownClass.split(" ");return f&&f.length&&f.reduce((b,w)=>(b[w]=!0,b),h),h}function g(a){const h={btn:!0,disabled:!a.enable,"f-rt-btn":!0,"btn-icontext":!!(a.icon&&a.icon.trim())};if(a.class){const f=a.class.split(" ");f&&f.length&&f.reduce((b,w)=>(b[w]=!0,b),h)}return h}function d(a,h){a.stopPropagation();const f=h.expanded;document.body.click(),typeof h.onClick=="function"&&h.onClick(a,h.id),t.emit("click",a,h.id),h.expanded=!f}function p(a,h=!0){if(a.tipsEnable&&a.tipsText){const f=c.reactive({content:a.tipsText,enable:a.tipsEnable});return c.createVNode("div",{id:a.id,class:s(a)},[c.withDirectives(c.createVNode("div",{class:g(a),style:"display: flex;padding-right: 0.1rem;border-top-right-radius: 6px;border-bottom-right-radius: 6px",onClick:b=>a.enable&&d(b,a)},[e.shouldShowIcon(a)&&c.createVNode("i",{class:e.iconClass(a)},null),c.createVNode("span",null,[a.text]),c.createVNode("i",{class:"f-icon f-icon-arrow-chevron-down",style:"display: inline-block;float: right;line-height: 1.25rem;margin-left: .25rem;margin-right: .25rem;"},null)]),[[c.resolveDirective("tooltip"),f]]),h&&r(a)])}return c.createVNode("div",{id:a.id,class:s(a)},[c.createVNode("div",{class:g(a),style:"display: flex;padding-right: 0.1rem;border-top-right-radius: 6px;border-bottom-right-radius: 6px",onClick:f=>a.enable&&d(f,a)},[e.shouldShowIcon(a)&&c.createVNode("i",{class:e.iconClass(a)},null),c.createVNode("span",null,[a.text]),c.createVNode("i",{class:"f-icon f-icon-arrow-chevron-down",style:"display: inline-block;float: right;line-height: 1.25rem;margin-left: .25rem;margin-right: .25rem;"},null)]),h&&r(a)])}function m(){i()}return{renderToolbarDropdown:p,clearAllDropDown:m}}const{buildResponseToolbarItems:ze}=$e(),he=c.defineComponent({name:"FResponseToolbar",props:ye,emits:["click"],setup(o,t){const e=c.ref(ze(o.items)),n=c.ref(),r=c.ref(),i=c.ref(),s={id:"__more_buttons__",text:"更多"},g=c.ref(new pe(s)),d={id:s.id+"width",text:s.text},p=c.ref(-1),m=we();let a=!1;const h=c.computed(()=>g.value.children.length>0),f=c.computed(()=>{const x={"f-toolbar":!0,"f-response-toolbar":!0,"position-relative":!0,"f-response-toolbar-sm":o.buttonSize==="sm","f-response-toolbar-lg":o.buttonSize==="lg","d-none":!o.visible};return fe.getCustomClass(x,o.customClass)}),b=c.computed(()=>({"w-100":!0,"d-flex":!0,"flex-nowrap":!0,"justify-content-end":o.alignment==="right","justify-content-start":o.alignment==="left","justify-content-center":o.alignment==="center"})),{renderToolbarDropdown:w,clearAllDropDown:M}=Bt(o,t,m);function y(x){x&&x.target.closest("ul.dropdown-menu")&&x.type==="wheel"||(e.value.filter(S=>S.children&&S.children.length>0).forEach(S=>{S.expanded=!1}),g.value.expanded=!1,M())}function u(x,S){var L;const j={btn:!0,"f-rt-btn":!0,"f-btn-ml":o.alignment==="right"||S>0&&o.alignment==="center","f-btn-mr":o.alignment==="left","btn-icontext":!!(x.icon&&x.icon.trim())},H=((L=x==null?void 0:x.appearance)==null?void 0:L.class)||x.class||"btn-secondary";if(H){const z=H.split(" ");z&&z.length&&z.reduce((X,Q)=>(X[Q]=!0,X),j)}return j}function I(x,S){document.body.click(),typeof S.onClick=="function"&&S.onClick(x,S.id),t.emit("click",x,S.id)}function V(x,S){if(x.tipsEnable&&x.tipsText){const j=c.reactive({content:x.tipsText,enable:x.tipsEnable});return c.withDirectives(c.createVNode("button",{type:"button",class:u(x,S),id:x.id,disabled:!x.enable,onClick:H=>I(H,x)},[m.shouldShowIcon(x)&&c.createVNode("i",{class:m.iconClass(x)},null),x.text]),[[c.resolveDirective("tooltip"),j]])}return c.createVNode("button",{type:"button",class:u(x,S),id:x.id,disabled:!x.enable,onClick:j=>I(j,x)},[m.shouldShowIcon(x)&&c.createVNode("i",{class:m.iconClass(x)},null),x.text])}let k=new Map,A=[];function O(x){const S=x.computedStyleMap().get("margin-left"),j=x.computedStyleMap().get("margin-right");return(S?S.value:0)+x.getBoundingClientRect().width+(j?j.value:0)}function _(x,S,j){if(S<p.value){let H=j-1;for(;H>=0;H--){const L=x[H],z=O(L);if(S+=z,S>=p.value)break}j=H}return S-=p.value,{start:j,space:S}}function U(x){const S=i.value;let j=x;const L=Array.from(S.children).filter(ee=>ee.id!=="__more_buttons__"),z=L.length;let X=!1,Q=0;for(;Q<z;Q++){const ee=L[Q],ie=O(ee);if(ie<=j)j-=ie;else{const Z=_(L,j,Q);Q=Z.start,j=Z.space,X=!0;break}}if(!X&&A.length>0){const ee=_(L,j,Q);Q=ee.start,j=ee.space}const W=A.length>0;for(;Q<z;Q++){const ee=L[Q],ie=O(ee);k.set(ee.id,!0),A[W?"unshift":"push"]({id:ee.id,width:ie})}return j}function T(x){let S=U(x);if(A.length){let z=0;for(;z<A.length;z++){const X=o.items.find(Q=>Q.id===A[z].id);if(X&&X.visible!==!1){const Q=A[z].width;if(S>=Q||z===A.length-1&&S+p.value>=Q)S-=Q;else break}}for(let X=0;X<z;X++)k.delete(A[X].id);A.splice(0,z-1)}const j=Object.assign({},g.value);j.children=[];const H=new pe(j),L=e.value.reduce((z,X)=>{const Q=o.items.find(W=>W.id===X.id);return k.has(X.id)?(H.children.push(X),X.shown=!1):X.shown=Q.visible!==!1,z.push(X),z},[]);g.value=H,e.value=L}function l(x=-1){if(x===0||!i.value||!r.value)return;x<0&&(x=r.value.getBoundingClientRect().width);const S=i.value.getBoundingClientRect().width;(x>=0&&x<S||A.length)&&(T(x),y())}function E(){return p.value<0&&c.createVNode("div",{style:"position:absolute;top:-30px;visibility:hidden;"},[w(new pe(d))])}const D=new ResizeObserver(x=>{if(x.length){const j=x[0].contentRect.width;l(j)}});function C(){k=new Map,A=[]}function P(){r.value&&!a&&(D.observe(r.value),a=!0)}function R(){if(n.value&&p.value<0){const x=n.value.querySelector("#"+d.id);x&&(p.value=O(x))}}return c.onMounted(()=>{R(),l(),P(),document.body.addEventListener("click",y),document.body.addEventListener("wheel",y)}),c.onUnmounted(()=>{D.disconnect(),document.body.removeEventListener("click",y),document.body.removeEventListener("wheel",y)}),c.watch(()=>o.items,()=>{e.value=ze(o.items),g.value.children=[],c.nextTick(()=>{C(),l()})},{deep:!0}),c.watch(()=>o.visible,x=>{x&&c.nextTick(()=>{R(),l(),P()})}),t.expose({elementRef:n}),()=>c.createVNode("div",{class:f.value,id:o.id,ref:n,style:{"overflow-y":p.value<0?"hidden":"initial"}},[o.visible&&E(),o.visible&&c.createVNode("div",{ref:r,class:b.value},[c.createVNode("div",{ref:i,class:"d-inline-block f-response-content",style:"white-space: nowrap;"},[e.value.filter(x=>x.shown).map((x,S)=>x.children&&x.children.length>0?w(x):V(x,S)),h.value&&w(g.value)])])])}}),At=c.ref(0);function Ot(){At.value++}const me=c.ref(0);function jt(o,t){const e=t.getBoundingClientRect(),n=o.getBoundingClientRect(),r=n.top>=e.top,i=n.top<=e.bottom;return r&&i}function Xe(o){const t=o.querySelector(".component-btn-group");if(!t)return;t.style.display="";const e=t.getBoundingClientRect();if(!(e.top===0&&e.left===0)){const n=t.querySelector("div");if(n){const r=n.getBoundingClientRect();n.style.top=e.top+"px";let i=e.left-r.width;const s=document.querySelector(".editorDiv");if(s){const g=s.getBoundingClientRect();i<g.left&&({left:i}=o.getBoundingClientRect())}n.style.left=i+"px"}}}function _t(o){if(!window.scrollContainerList)return;const t=Array.from(window.scrollContainerList);if(t.length&&t.length===1){const e=t[0],n=document.querySelector(`[id=${e}]`);if(n&&n.contains(o))return n}}function Ye(o){if(!o)return;const t=o.getBoundingClientRect();if(t.width===0&&t.height===0)return;const e=o.querySelector(".component-btn-group");if(e){let n=!0;const r=_t(o);if(r&&(n=jt(o,r)),!n){e.style.display="none";return}Xe(o)}}function $t(o){if(!o)return;let t;o.className.includes("dgComponentSelected")?t=o:t=o.querySelector(".dgComponentSelected"),t&&Ye(t)}function Ft(o){const{formSchemaUtils:t,formStateMachineUtils:e}=o;function n(d,p=""){return{path:p+d.code,field:d.id,fullPath:d.code}}function r(d,p=""){return t.getViewModelById(d).states.map(a=>n(a,p))}function i(d){const p=t.getRootViewModelId(),m=r(d);if(d===p)return m;const a=r(p,"root-component.");return[...m,...a]}function s(d){return d.binding&&d.binding.path||d.id||""}function g(){return e&&e.getRenderStates()||[]}return{getVariables:i,getControlName:s,getStateMachines:g}}class Lt{constructor(t){q(this,"sessionVariables",[{key:"CurrentSysOrgName",name:"当前组织Name",description:"当前组织Name"},{key:"CurrentSysOrgId",name:"当前组织Id",description:"当前组织Id"},{key:"CurrentUserName",name:"当前用户Name",description:"当前用户Name"},{key:"CurrentUserCode",name:"当前用户Code",description:"当前用户Code"},{key:"CurrentUserId",name:"当前用户Id",description:"当前用户Id"},{key:"CurrentLanguage",name:"当前语言编号",description:"当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'"}]);q(this,"expressionNames",{compute:"计算表达式",dependency:"依赖表达式",validate:"验证表达式",dataPicking:"帮助前表达式",visible:"可见表达式",readonly:"只读表达式",required:"必填表达式"});q(this,"getExpressionConverter",(t,e)=>({convertFrom:(n,r,i,s)=>{const g=i.getExpressionRuleValue(t,e||r);return g&&g.value||""},convertTo:(n,r,i,s,g)=>{var d;if(r==="dataPicking"&&(i!=null&&i.target)){const p=`${i.target}_dataPicking`;((d=i.rules)==null?void 0:d.some(a=>a.id===p&&a.value))?n.dictPickingExpressionId=p:delete n.dictPickingExpressionId}s.updateExpression(i)}}));this.formSchemaService=t}getExpressionRule(t,e){const n=this.formSchemaService.getExpressions();if(!n)return"";const r=n.find(s=>s.target===t);if(!r)return"";const i=r.rules.find(s=>s.type===e);return i||""}getContextFormVariables(){const{module:t}=this.formSchemaService.getFormSchema();if(!t.viewmodels||t.viewmodels.length===0)return[];const e=this.formSchemaService.getRootViewModelId(),n=this.formSchemaService.getViewModelById(e);if(!n||!n.states||n.states.length===0)return[];const r=[];return n.states.forEach(i=>{r.push({key:i.code,name:i.name,description:i.name,category:i.category})}),r}createTreeNode(t,e,n="label"){return{id:t.id,name:t.name,bindingPath:t[n],parents:e}}buildEntityFieldsTreeData(t=null,e){const n=[];return t==null||t.forEach(r=>{var g;const i=this.createTreeNode(r,e);let s=[];(g=r.type)!=null&&g.fields&&(s=this.buildEntityFieldsTreeData(r.type.fields,[...e,r.label])),n.push({data:i,children:s,expanded:!0})}),n}buildChildEntityTreeData(t=null,e){const n=[];return t==null||t.forEach(r=>{var d,p;const i=this.createTreeNode(r,e),s=this.buildEntityFieldsTreeData((d=r.type)==null?void 0:d.fields,[...e,r.label]),g=this.buildChildEntityTreeData((p=r.type)==null?void 0:p.entities,[...e,r.label]);g!=null&&g.length&&(s==null||s.push(...g)),n.push({data:i,children:s||[],expanded:!0})}),n}getEntitiesTreeData(){const t=this.formSchemaService.getSchemaEntities();if(!(t!=null&&t.length))return[];const e=t[0];if(!(e!=null&&e.type))return[];const n=this.buildEntityFieldsTreeData(e.type.fields,[e.code]),r=this.buildChildEntityTreeData(e.type.entities,[e.code]);return r!=null&&r.length&&(n==null||n.push(...r)),{entityCode:e.code,fields:[{data:this.createTreeNode(e,[],"code"),children:n||[]}]}}getEntitiesAndVariables(){return{entities:this.getEntitiesTreeData(),variables:{session:{name:"系统变量",items:this.sessionVariables,visible:!1},forms:{name:"表单变量",items:this.getContextFormVariables(),visible:!0}}}}onBeforeOpenExpression(t,e,n){const r=n==="Field"?t.binding.field:t.id,i=this.getExpressionRule(r,e),s=this.getEntitiesAndVariables(),g={message:["validate","required","dataPicking"].includes(e)&&i?i.message:"",...s};return i.messageType!=null&&(g.messageType=i.messageType),g}buildRule(t,e,n,r){const{expression:i,message:s,messageType:g}=e,d={id:`${t}_${n}`,type:n,value:i};return(n==="validate"||n==="dataPicking"||n==="required")&&(d.message=s),n==="dataPicking"&&(d.messageType=g),n==="validate"&&r&&(d.elementId=r),d}getExpressionData(){const{expressions:t}=this.formSchemaService.getFormSchema().module;return t||[]}updateExpression(t,e,n,r){const i=e==="Field"?t.binding.field:t.id,s=this.buildRule(i,n,r,t.type==="form-group"?t.id:"");let d=this.getExpressionData().find(m=>m.targetType===e&&m.target===i);const p=m=>m.value.trim()==="";if(d){const m=d.rules.find(a=>a.id===s.id);if(m)p(s)?d.rules=d.rules.filter(a=>a.id!==s.id):(Object.assign(m,s),r==="validate"&&t.type==="form-group"&&(m.elementId=t.id));else{if(p(s))return null;d.rules=d.rules||[],d.rules.push(s)}}else{if(p(s))return null;d={target:`${i}`,rules:[s],targetType:e}}return d}getExpressionEditorOptions(t,e,n,r){return n.reduce((i,s)=>{var d,p;const g=e==="Field"?(d=t==null?void 0:t.binding)==null?void 0:d.field:t.id;return i[s]={hide:e==="Field"?!!((p=t==null?void 0:t.binding)!=null&&p.field):!1,description:"",title:this.expressionNames[s],type:"string",$converter:this.getExpressionConverter(g),editor:{type:"expression-editor",singleExpand:!1,dialogTitle:`${this.expressionNames[s]}编辑器`,showMessage:s==="validate"||s==="dataPicking"||s==="required",showMessageType:s==="dataPicking",beforeOpen:()=>this.onBeforeOpenExpression(t,s,e),onSubmitModal:m=>{const a=this.updateExpression(t,e,m,s);if(r){const h=this.buildRule(g,m,s);r(h)}return a}}},i},{})}getExpressionInfo(t,e,n){const r=e==="Field"?t.binding.field:t.id,i=this.getExpressionRule(r,n),s={value:i&&i.value,targetId:r,targetType:e,expressionType:n};return i&&i.message&&(s.message=i.message),s}getExpressionConfig(t,e,n=["compute","dependency","validate"],r){return{description:"表达式",title:"表达式",properties:{...this.getExpressionEditorOptions(t,e,n,r)}}}getExpressionOptions(t,e,n){const r=this.getExpressionInfo(t,e,n);return{dialogTitle:`${this.expressionNames[n]}编辑器`,singleExpand:!1,showMessage:n==="required",beforeOpen:()=>this.onBeforeOpenExpression(t,n,e),expressionInfo:r}}}class Te{constructor(t,e){q(this,"componentId");q(this,"viewModelId");q(this,"eventsEditorUtils");q(this,"formSchemaUtils");q(this,"formMetadataConverter");q(this,"designViewModelUtils");q(this,"designViewModelField");q(this,"controlCreatorUtils");q(this,"designerHostService");q(this,"schemaService",null);q(this,"metadataService",null);q(this,"propertyConfig",{type:"object",categories:{}});var n;this.componentId=t,this.designerHostService=e,this.eventsEditorUtils=e.eventsEditorUtils,this.formSchemaUtils=e.formSchemaUtils,this.formMetadataConverter=e.formMetadataConverter,this.viewModelId=((n=this.formSchemaUtils)==null?void 0:n.getViewModelIdByComponentId(t))||"",this.designViewModelUtils=e.designViewModelUtils,this.controlCreatorUtils=e.controlCreatorUtils,this.metadataService=e.metadataService,this.schemaService=e.schemaService}getTableInfo(){var t;return(t=this.schemaService)==null?void 0:t.getTableInfoByViewModelId(this.viewModelId)}setDesignViewModelField(t){var n;const e=t.binding&&t.binding.type==="Form"&&t.binding.field;if(e){if(!this.designViewModelField){const r=this.designViewModelUtils.getDgViewModel(this.viewModelId);this.designViewModelField=r.fields.find(i=>i.id===e)}t.updateOn=(n=this.designViewModelField)==null?void 0:n.updateOn}}getBasicPropConfig(t){return{description:"Basic Information",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"combo-list",textField:"name",valueField:"value",idField:"value",editable:!1,data:[{value:t.type,name:vt[t.type].name}]}}}}}getAppearanceConfig(t=null,e={},n){const r={title:"外观",description:"Appearance"},i={class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter"}};for(const s in e)i[s]=Object.assign(i[s]||{},e[s]);return{...r,properties:{...i},setPropertyRelates(s,g){if(s){switch(s&&s.propertyID){case"class":case"style":{me.value++;break}}n&&n(s,t,g)}}}}getPropertyEditorParams(t,e=[],n="visible",r={},i={}){const{getVariables:s,getControlName:g,getStateMachines:d}=Ft(this.designerHostService),p=this.getRealTargetType(t),m=e&&e.length>0?e:["Const","Variable","StateMachine","Expression"],a={type:"property-editor",propertyTypes:m};return m.map(h=>{switch(h){case"Const":Object.assign(a,{constType:"enum",constEnums:[{id:!0,name:"是"},{id:!1,name:"否"}]},r);break;case"Expression":a.expressionConfig=this.getExpressionOptions(t,p,n);break;case"StateMachine":a.stateMachines=d();break;case"Variable":Object.assign(a,{controlName:g(t),newVariablePrefix:"is",newVariableType:"Boolean",variables:s(this.viewModelId),onBeforeOpenVariables:f=>{f.value=s(this.viewModelId)}},i);break}}),a}getVisibleProperty(t,e=""){return{visible:{title:"是否可见",type:"boolean",description:"运行时组件是否可见",editor:this.getPropertyEditorParams(t,e==="gridFieldEditor"?["Const","Expression"]:["Const","Variable","StateMachine","Expression"],"visible")}}}getBehaviorConfig(t,e="",n={},r){const i={title:"行为",description:""},s=this.getVisibleProperty(t,e);for(const d in n)s[d]=Object.assign(s[d]||{},n[d]);const g=this;return{...i,properties:{...s},setPropertyRelates(d,p){if(d){switch(d.propertyID){case"disabled":case"readonly":case"visible":g.afterMutilEditorChanged(t,d);break}r&&r(d,p)}}}}afterMutilEditorChanged(t,e){this.addNewVariableToViewModel(e,this.viewModelId),this.updateExpressionValue(e),this.clearExpression(e,t)}updateElementByParentContainer(t,e){const n=e&&e.parent&&e.parent.schema;if(!n)return;const r=n.contents.findIndex(s=>s.id===t),i=oe.cloneDeep(n.contents[r]);n.contents.splice(r,1),n.contents.splice(r,0,i),Ot()}addNewVariableToViewModel(t,e){const n=t.propertyValue;if(!(n&&typeof n=="object")||!(n.type==="Variable"&&n.isNewVariable))return;const s={id:n.field,category:"locale",code:n.fullPath,name:n.fullPath,type:n.newVariableType||"String"};delete n.newVariableType,delete n.isNewVariable,this.formSchemaUtils.getVariableByCode(s.code)||this.formSchemaUtils.getViewModelById(e).states.push(s)}updateExpressionValue(t){const e=t.propertyValue;if(!((e&&e.type)==="Expression"&&e.expressionInfo))return;const{expressionId:i,expressionInfo:s}=e,{targetId:g,targetType:d,expressionType:p,value:m,message:a}=s,h=this.formSchemaUtils.getModule();h.expressions??(h.expressions=[]);const{expressions:f}=h;let b=f.find(M=>M.target===g);b||(b={target:g,rules:[],targetType:d},f.push(b));const w=b.rules.find(M=>M.type===p);if(w)w.value=m,w.message=a;else{const M={id:i,type:p,value:m,message:a};b.rules.push(M)}delete e.expressionInfo}clearExpression(t,e){const n=t.propertyValue;if(n&&n.type==="Expression")return;const i=t.propertyID,s=this.formSchemaUtils.getExpressions(),g=e.binding?e.binding.field:e.id,d=s.find(p=>p.target===g);!d||!d.rules||(d.rules=d.rules.filter(p=>p.type!==i))}getExpressionOptions(t,e,n){return new Lt(this.formSchemaUtils).getExpressionOptions(t,e,n)}getRealTargetType(t){return["response-toolbar-item","tab-toolbar-item","section-toolbar-item"].indexOf(t.type)>-1?"Button":t.binding&&t.binding.field?"Field":"Container"}}class qt extends Te{constructor(t,e){super(t,e)}getPropertyConfig(t){return this.propertyConfig.categories.basic=this.getBasicPropConfig(t),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"}}}}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 Ut(o,t,e){const n=o.schema;function r(f){return!1}function i(f,b){return b.text=f.label,b}function s(){return!1}function g(){return!1}function d(){return!1}function p(){return!0}function m(f){return new qt(f,t).getPropertyConfig(n)}function a(f){var y;f&&(f.stopPropagation(),f.preventDefault());const{schema:b}=o;b.buttons||(b.buttons=[]);let w="";if(b.type)w=b.type+"-item";else{const u=(y=o.parent)==null?void 0:y.schema.type;w=u==="tabs"?"tab-toolbar-item":u==="section"?"section-toolbar-item":"response-toolbar-item"}const M=ge(w);M.id=`toolbar_item_${Math.random().toString().slice(2,6)}`,b.buttons.push(M),e.updateToolbarItems(),e.changeSelectedId("")}function h(){return[{id:"appendItem",title:"新增按钮",text:"",icon:"f-icon f-icon-plus-circle text-white",onClick:f=>a(f)}]}return{canAccepts:r,checkCanAddComponent:d,checkCanDeleteComponent:g,checkCanMoveComponent:s,hideNestedPaddingInDesginerView:p,onResolveNewComponentSchema:i,getPropsConfig:m,getCustomButtons:h}}var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ht(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function be(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ge={exports:{}};(function(o,t){(function(e){o.exports=e()})(function(){return function(){function e(n,r,i){function s(p,m){if(!r[p]){if(!n[p]){var a=typeof be=="function"&&be;if(!m&&a)return a(p,!0);if(g)return g(p,!0);var h=new Error("Cannot find module '"+p+"'");throw h.code="MODULE_NOT_FOUND",h}var f=r[p]={exports:{}};n[p][0].call(f.exports,function(b){var w=n[p][1][b];return s(w||b)},f,f.exports,e,n,r,i)}return r[p].exports}for(var g=typeof be=="function"&&be,d=0;d<i.length;d++)s(i[d]);return s}return e}()({1:[function(e,n,r){var i={},s="(?:^|\\s)",g="(?:\\s|$)";function d(a){var h=i[a];return h?h.lastIndex=0:i[a]=h=new RegExp(s+a+g,"g"),h}function p(a,h){var f=a.className;f.length?d(h).test(f)||(a.className+=" "+h):a.className=h}function m(a,h){a.className=a.className.replace(d(h)," ").trim()}n.exports={add:p,rm:m}},{}],2:[function(e,n,r){(function(i){var s=e("contra/emitter"),g=e("crossvent"),d=e("./classes"),p=document,m=p.documentElement;function a(l,E){var D=arguments.length;D===1&&Array.isArray(l)===!1&&(E=l,l=[]);var C,P,R,x,S,j,H,L,z,X=null,Q,W,ee=!1,ie=0,Z,$=E||{};$.moves===void 0&&($.moves=u),$.accepts===void 0&&($.accepts=u),$.invalid===void 0&&($.invalid=un),$.containers===void 0&&($.containers=l||[]),$.isContainer===void 0&&($.isContainer=y),$.copy===void 0&&($.copy=!1),$.copySortSource===void 0&&($.copySortSource=!1),$.revertOnSpill===void 0&&($.revertOnSpill=!1),$.removeOnSpill===void 0&&($.removeOnSpill=!1),$.direction===void 0&&($.direction="vertical"),$.ignoreInputTextSelection===void 0&&($.ignoreInputTextSelection=!0),$.mirrorContainer===void 0&&($.mirrorContainer=p.body);var K=s({containers:$.containers,start:dn,end:rt,cancel:lt,remove:at,destroy:sn,canMove:cn,dragging:!1});return $.removeOnSpill===!0&&K.on("over",pn).on("out",gn),et(),K;function Ee(v){return K.containers.indexOf(v)!==-1||$.isContainer(v)}function et(v){var N=v?"remove":"add";b(m,N,"mousedown",an),b(m,N,"mouseup",ke)}function Pe(v){var N=v?"remove":"add";b(m,N,"mousemove",ln)}function tt(v){var N=v?"remove":"add";g[N](m,"selectstart",nt),g[N](m,"click",nt)}function sn(){et(!0),ke({})}function nt(v){Q&&v.preventDefault()}function an(v){x=v.clientX,S=v.clientY;var N=w(v)!==1||v.metaKey||v.ctrlKey;if(!N){var B=v.target,F=Me(B);F&&(Q=F,Pe(),v.type==="mousedown"&&(A(B)?B.focus():v.preventDefault()))}}function ln(v){if(Q){if(w(v)===0){ke({});return}if(!(v.clientX!==void 0&&Math.abs(v.clientX-x)<=($.slideFactorX||0)&&v.clientY!==void 0&&Math.abs(v.clientY-S)<=($.slideFactorY||0))){if($.ignoreInputTextSelection){var N=T("clientX",v)||0,B=T("clientY",v)||0,F=p.elementFromPoint(N,B);if(A(F))return}var Y=Q;Pe(!0),tt(),rt(),ot(Y),d.add(L||R,"gu-transit"),mn(),hn(),ie=0,Ne(v)}}}function Me(v){if(!(K.dragging&&C)&&!Ee(v)){for(var N=v;k(v)&&Ee(k(v))===!1;)if($.invalid(v,N)||(v=k(v),!v))return;var B=k(v);if(B&&!$.invalid(v,N)){var F=$.moves(v,B,N,_(v));if(F)return{item:v,source:B}}}}function cn(v){return!!Me(v)}function dn(v){var N=Me(v);N&&ot(N)}function ot(v){Sn(v.item,v.source)&&(L=v.item.cloneNode(!0),K.emit("cloned",L,v.item,"copy")),P=v.source,R=v.item,j=H=_(v.item),K.dragging=!0,K.emit("drag",R,P)}function un(){return!1}function rt(){if(K.dragging){var v=L||R;st(v,k(v))}}function it(){Q=!1,Pe(!0),tt(!0)}function ke(v){if(it(),!!K.dragging){var N=L||R,B=T("clientX",v)||0,F=T("clientY",v)||0,Y=M(C,B,F),G=ct(Y,B,F);G&&(L&&$.copySortSource||!L||G!==P)?st(N,G):$.removeOnSpill?at():lt()}}function st(v,N){var B=k(v);L&&$.copySortSource&&N===P&&B.removeChild(R),Ve(N)?K.emit("cancel",v,P):K.emit("drop",v,N,P,H),De()}function at(){if(K.dragging){var v=L||R,N=k(v);N&&N.removeChild(v),K.emit(L?"cancel":"remove",v,N,P),De()}}function lt(v){if(K.dragging){var N=arguments.length>0?v:$.revertOnSpill,B=L||R,F=k(B),Y=Ve(F);Y===!1&&N&&(L?F&&F.removeChild(L):P.insertBefore(B,j)),Y||N?K.emit("cancel",B,P,P):K.emit("drop",B,F,P,H),De()}}function De(){var v=L||R;it(),bn(),vn(),v&&d.rm(v,"gu-transit"),z&&clearTimeout(z),K.dragging=!1,X&&K.emit("out",v,X,P),K.emit("dragend",v,ie),P=R=L=j=H=z=X=null}function Ve(v,N){var B;return N!==void 0?B=N:C?B=H:B=_(L||R),v===P&&B===j}function ct(v,N,B){for(var F=v;F&&!Y();)F=k(F);return F;function Y(){var G=Ee(F);if(G===!1)return!1;var le=dt(F,v),re=ut(F,le,N,B),ae=Ve(F,re);return ae?!0:$.accepts(R,F,P,re)}}function Ne(v){if(!C)return;v.preventDefault();var N=T("clientX",v)||0,B=T("clientY",v)||0;C.style.left=N-2+"px",C.style.top=B-2+"px";var F=L||R,Y=M(C,N,B),G=ct(Y,N,B),le=G!==null&&G!==X;(le||G===null)&&(se(),X=G,ue()),Tn(Y,B);var re=k(F);if(G===P&&L&&!$.copySortSource){re&&re.removeChild(F);return}var ae,de=dt(G,Y);if(ee=yn(de,G),de!==null)ae=ut(G,de,N,B);else if($.revertOnSpill===!0&&!L)ae=j,G=P;else{L&&re&&re.removeChild(F),L&&W&&(W.style.display="none");return}W.style.display="block",fn(ae,F,le),ae?wn(de,ae):xn(G);function te(ne){K.emit(ne,F,X,P)}function ue(){le&&te("over")}function se(){X&&te("out")}}function fn(v,N,B){(v===N||v===_(N))&&(H=_(N)),(v===null&&B||v!==N&&v!==_(N))&&(H=v)}function pn(v){d.rm(v,"gu-hide")}function gn(v){K.dragging&&d.add(v,"gu-hide")}function hn(){C||(C=document.createElement("div"),C.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;",C.innerHTML=$.getMirrorText&&$.getMirrorText(R)||"控件",d.add(C,"gu-mirror"),$.mirrorContainer.appendChild(C),b(m,"add","mousemove",Ne),d.add($.mirrorContainer,"gu-unselectable"),K.emit("cloned",C,R,"mirror"))}function mn(){if(W=document.createElement("div"),d.add(W,"gu-insertion"),R){var v=R.getBoundingClientRect();W.style.left=v.left+"px",W.style.top=v.top+"px"}ee=!1,$.mirrorContainer.appendChild(W)}function bn(){C&&(d.rm($.mirrorContainer,"gu-unselectable"),b(m,"remove","mousemove",Ne),k(C).removeChild(C),C=null)}function vn(){W&&(k(W).removeChild(W),W=null)}function dt(v,N){for(var B=N;B!==v&&k(B)!==v;)B=k(B);return B===m?null:B}function yn(v,N){if(!N)return ee;var B=v||N&&N.lastElementChild;if(!B)return!0;var F=getComputedStyle(v),Y=/^inline/.test(F.getPropertyValue("display"))||/^(left|right)$/.test(F.getPropertyValue("float"));if(Y)return!0;if(N){var G=getComputedStyle(N),le=G.getPropertyValue("display");if(/flex$/.test(le)){var re=G.getPropertyValue("flex-direction")||"row";if(re==="row"||re==="row-reverse")return!Cn(N)}return!1}return!0}function Cn(v){if(!v.children||!v.children.length)return!1;for(const N of Array.from(v.children)){const F=(N.className&&N.className.split(" ")||[]).filter(Y=>/^col(-md|-xl|-el){0,1}-([1-9]|10|11|12)$/.test(Y));if(!F.length)return!1;for(const Y of F){const G=Y.slice(Y.lastIndexOf("-")+1);if(parseInt(G,10)!==12)return!1}}return!0}function wn(v,N){const B=N.getBoundingClientRect();if(W.style.left=B.left+"px",W.style.top=B.top+"px",ee){if(W.style.height=B.height+"px",W.style.width="4px",v){const F=v.getBoundingClientRect();F.top!==B.top&&(W.style.left=F.right+"px",W.style.top=F.top+"px",W.style.height=F.height+"px")}}else if(W.style.height="4px",W.style.width=B.width+"px",Z){const F=Z.getBoundingClientRect();B.top<F.top&&(W.style.display="none")}N===R&&R&&(W.style.display="none")}function xn(v){H=null;var N=v.lastElementChild;if(N){var B=N.getBoundingClientRect();ee?(W.style.left=B.right+"px",W.style.top=B.top+"px",W.style.height=B.height+"px",W.style.width="4px"):(W.style.left=B.left+"px",W.style.top=B.bottom+"px",W.style.height="4px",W.style.width=B.width+"px"),N===R&&R&&(W.style.display="none")}else W.style.display="none"}function Tn(v,N){if(!$.mirrorContainer.contains(v)||!window.scrollContainerList||!Array.from(window.scrollContainerList).length||(Z=h(v),!Z||!Z.contains(v)))return;const B=document.querySelector(".dgComponentSelected"),F=Z.getBoundingClientRect();if(N-30<F.top&&Z.scrollTop>0){let Y=Z.scrollTop<10?Z.scrollTop:10;Z.scrollBy(0,-1*Y),B&&Z.contains(B)&&(ie=ie+-1*Y)}if(N+30>F.bottom&&Z.scrollTop<Z.scrollHeight-Z.clientHeight){const Y=Z.scrollHeight-Z.clientHeight-Z.scrollTop;let G=Y<10?Y:10;Z.scrollBy(0,G),B&&Z.contains(B)&&(ie=ie+G)}}function ut(v,N,B,F){var Y=$.direction==="horizontal",G=$.direction==="mixed",le=N!==v?ae():re();return le;function re(){var te=v.children.length,ue,se,ne;for(ue=0;ue<te;ue++)if(se=v.children[ue],ne=se.getBoundingClientRect(),Y&&ne.left+ne.width/2>B||!G&&!Y&&ne.top+ne.height/2>F||G&&ne.left+ne.width>B&&ne.top+ne.height>F)return se;return null}function ae(){var te=N.getBoundingClientRect();if(G){var ue=F-te.top,se=B-te.left,ne=te.bottom-F,Re=te.right-B,Be=Math.min(se,Re,ue,ne),Ae;return ee?Ae=Re<se:Ae=ne===Be||Re===Be||se===Be,de(Ae)}return de(Y?B>te.left+I(te)/2:F>te.top+V(te)/2)}function de(te){return te?_(N):N}}function Sn(v,N){return typeof $.copy=="boolean"?$.copy:$.copy(v,N)}}function h(l){const E=Array.from(window.scrollContainerList);if(E.length===1){const C=Array.from(window.scrollContainerList)[0];return document.getElementById(C)}const D=f(E);for(const C of D)if(C.contains(l))return C;return null}function f(l){const E=[];return l.forEach(D=>{const C=document.getElementById(D);C&&E.push(C)}),E.sort((D,C)=>D.contains(C)?1:C.contains(D)?-1:0),E}function b(l,E,D,C){var P={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},R={mouseup:"pointerup",mousedown:"pointerdown",mousemove:"pointermove"},x={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};i.navigator.pointerEnabled?g[E](l,R[D],C):i.navigator.msPointerEnabled?g[E](l,x[D],C):(g[E](l,P[D],C),g[E](l,D,C))}function w(l){if(l.touches!==void 0)return l.touches.length;if(l.which!==void 0&&l.which!==0)return l.which;if(l.buttons!==void 0)return l.buttons;var E=l.button;if(E!==void 0)return E&1?1:E&2?3:E&4?2:0}function M(l,E,D){l=l||{};var C=l.className||"",P;return l.className+=" gu-hide",P=p.elementFromPoint(E,D),l.className=C,P}function y(){return!1}function u(){return!0}function I(l){return l.width||l.right-l.left}function V(l){return l.height||l.bottom-l.top}function k(l){return l.parentNode===p?null:l.parentNode}function A(l){return l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"||O(l)}function O(l){return!l||l.contentEditable==="false"?!1:l.contentEditable==="true"?!0:O(k(l))}function _(l){return l.nextElementSibling||E();function E(){var D=l;do D=D.nextSibling;while(D&&D.nodeType!==1);return D}}function U(l){return l.targetTouches&&l.targetTouches.length?l.targetTouches[0]:l.changedTouches&&l.changedTouches.length?l.changedTouches[0]:l}function T(l,E){var D=U(E),C={pageX:"clientX",pageY:"clientY"};return l in C&&!(l in D)&&C[l]in D&&(l=C[l]),D[l]}n.exports=a}).call(this,typeof ce<"u"?ce:typeof self<"u"?self:typeof window<"u"?window:{})},{"./classes":1,"contra/emitter":5,crossvent:6}],3:[function(e,n,r){n.exports=function(s,g){return Array.prototype.slice.call(s,g)}},{}],4:[function(e,n,r){var i=e("ticky");n.exports=function(g,d,p){g&&i(function(){g.apply(p||null,d||[])})}},{ticky:10}],5:[function(e,n,r){var i=e("atoa"),s=e("./debounce");n.exports=function(d,p){var m=p||{},a={};return d===void 0&&(d={}),d.on=function(h,f){return a[h]?a[h].push(f):a[h]=[f],d},d.once=function(h,f){return f._once=!0,d.on(h,f),d},d.off=function(h,f){var b=arguments.length;if(b===1)delete a[h];else if(b===0)a={};else{var w=a[h];if(!w)return d;w.splice(w.indexOf(f),1)}return d},d.emit=function(){var h=i(arguments);return d.emitterSnapshot(h.shift()).apply(this,h)},d.emitterSnapshot=function(h){var f=(a[h]||[]).slice(0);return function(){var b=i(arguments),w=this||d;if(h==="error"&&m.throws!==!1&&!f.length)throw b.length===1?b[0]:b;return f.forEach(function(y){m.async?s(y,b,w):y.apply(w,b),y._once&&d.off(h,y)}),d}},d}},{"./debounce":4,atoa:3}],6:[function(e,n,r){(function(i){var s=e("custom-event"),g=e("./eventmap"),d=i.document,p=h,m=b,a=[];i.addEventListener||(p=f,m=w),n.exports={add:p,remove:m,fabricate:M};function h(k,A,O,_){return k.addEventListener(A,O,_)}function f(k,A,O){return k.attachEvent("on"+A,u(k,A,O))}function b(k,A,O,_){return k.removeEventListener(A,O,_)}function w(k,A,O){var _=I(k,A,O);if(_)return k.detachEvent("on"+A,_)}function M(k,A,O){var _=g.indexOf(A)===-1?T():U();k.dispatchEvent?k.dispatchEvent(_):k.fireEvent("on"+A,_);function U(){var l;return d.createEvent?(l=d.createEvent("Event"),l.initEvent(A,!0,!0)):d.createEventObject&&(l=d.createEventObject()),l}function T(){return new s(A,{detail:O})}}function y(k,A,O){return function(U){var T=U||i.event;T.target=T.target||T.srcElement,T.preventDefault=T.preventDefault||function(){T.returnValue=!1},T.stopPropagation=T.stopPropagation||function(){T.cancelBubble=!0},T.which=T.which||T.keyCode,O.call(k,T)}}function u(k,A,O){var _=I(k,A,O)||y(k,A,O);return a.push({wrapper:_,element:k,type:A,fn:O}),_}function I(k,A,O){var _=V(k,A,O);if(_){var U=a[_].wrapper;return a.splice(_,1),U}}function V(k,A,O){var _,U;for(_=0;_<a.length;_++)if(U=a[_],U.element===k&&U.type===A&&U.fn===O)return _}}).call(this,typeof ce<"u"?ce:typeof self<"u"?self:typeof window<"u"?window:{})},{"./eventmap":7,"custom-event":8}],7:[function(e,n,r){(function(i){var s=[],g="",d=/^on/;for(g in i)d.test(g)&&s.push(g.slice(2));n.exports=s}).call(this,typeof ce<"u"?ce:typeof self<"u"?self:typeof window<"u"?window:{})},{}],8:[function(e,n,r){(function(i){var s=i.CustomEvent;function g(){try{var d=new s("cat",{detail:{foo:"bar"}});return d.type==="cat"&&d.detail.fo