UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1 lines 66.2 kB
(function(X,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("lodash-es"),require("../response-toolbar/index.umd.js"),require("../common/index.umd.js"),require("../designer-canvas/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","../response-toolbar/index.umd.js","../common/index.umd.js","../designer-canvas/index.umd.js"],o):(X=typeof globalThis<"u"?globalThis:X||self,o(X["page-header"]={},X.Vue,X.LodashES,X.FResponseToolbar$1,X.common,X.designerCanvas))})(this,function(X,o,re,pt,fe,Oe){"use strict";var En=Object.defineProperty;var kn=(X,o,re)=>o in X?En(X,o,{enumerable:!0,configurable:!0,writable:!0,value:re}):X[o]=re;var q=(X,o,re)=>kn(X,typeof o!="symbol"?o+"":o,re);const $e={},Re={};function we(n){const{properties:e,title:t,ignore:r}=n,a=r&&Array.isArray(r),s=Object.keys(e).reduce((u,h)=>((!a||!r.find(p=>p===h))&&(u[h]=e[h].type==="object"&&e[h].properties?we(e[h]):re.cloneDeep(e[h].default)),u),{});if(t&&(!a||!r.find(u=>u==="id"))){const u=t.toLowerCase().replace(/-/g,"_");s.id=`${u}_${Math.random().toString().slice(2,6)}`}return s}function mt(n){const{properties:e,title:t,required:r}=n;if(r&&Array.isArray(r)){const a=r.reduce((s,u)=>(s[u]=e[u].type==="object"&&e[u].properties?we(e[u]):re.cloneDeep(e[u].default),s),{});if(t&&r.find(s=>s==="id")){const s=t.toLowerCase().replace(/-/g,"_");a.id=`${s}_${Math.random().toString().slice(2,6)}`}return a}return{type:t}}function pe(n,e={},t){const r=$e[n];if(r){let a=mt(r);const s=Re[n];return a=s?s({getSchemaByType:pe},a,e,t):a,a}return null}function gt(n,e){const t=we(e);return Object.keys(t).reduce((r,a)=>(Object.prototype.hasOwnProperty.call(n,a)&&(r[a]&&re.isPlainObject(r[a])&&re.isPlainObject(n[a]||!n[a])?Object.assign(r[a],n[a]||{}):r[a]=n[a]),r),t),t}function _e(n,e){return Object.keys(n).filter(r=>n[r]!=null).reduce((r,a)=>{if(e.has(a)){const s=e.get(a);if(typeof s=="string")r[s]=n[a];else{const u=s(a,n[a],n);Object.assign(r,u)}}else r[a]=n[a];return r},{})}function ht(n,e,t=new Map){const r=gt(n,e);return _e(r,t)}function vt(n={}){function e(d,v,c,m){if(typeof c=="number")return m[d].length===c;if(typeof c=="object"){const i=Object.keys(c)[0],l=c[i];if(i==="not")return Number(m[d].length)!==Number(l);if(i==="moreThan")return Number(m[d].length)>=Number(l);if(i==="lessThan")return Number(m[d].length)<=Number(l)}return!1}function t(d,v,c,m){return m[d]&&m[d].propertyValue&&String(m[d].propertyValue.value)===String(c)}const r=new Map([["length",e],["getProperty",t]]);Object.keys(n).reduce((d,v)=>(d.set(v,n[v]),d),r);function a(d,v){const c=d;return typeof v=="number"?[{target:c,operator:"length",param:null,value:Number(v)}]:typeof v=="boolean"?[{target:c,operator:"getProperty",param:d,value:!!v}]:typeof v=="object"?Object.keys(v).map(m=>{if(m==="length")return{target:c,operator:"length",param:null,value:v[m]};const i=m,l=v[m];return{target:c,operator:"getProperty",param:i,value:l}}):[]}function s(d){return Object.keys(d).reduce((c,m)=>{const i=a(m,d[m]);return c.push(...i),c},[])}function u(d,v){if(r.has(d.operator)){const c=r.get(d.operator);return c&&c(d.target,d.param,d.value,v)||!1}return!1}function h(d,v){return s(d).reduce((i,l)=>i&&u(l,v),!0)}function p(d,v){const c=Object.keys(d),m=c.includes("allOf"),i=c.includes("anyOf"),l=m||i,j=(l?d[l?m?"allOf":"anyOf":"allOf"]:[d]).map(x=>h(x,v));return m?!j.includes(!1):j.includes(!0)}return{parseValueSchema:p}}const yt={button:{type:"button",name:"按钮"},"response-toolbar":{type:"response-toolbar",name:"工具栏"},"response-toolbar-item":{type:"response-toolbar-item",name:"按钮"},"content-container":{type:"content-container",name:"容器"},"input-group":{type:"input-group",name:"文本"},textarea:{type:"textarea",name:"多行文本"},lookup:{type:"lookup",name:"帮助"},"number-spinner":{type:"number-spinner",name:"数值"},"date-picker":{type:"date-picker",name:"日期"},switch:{type:"switch",name:"开关"},"radio-group":{type:"radio-group",name:"单选组"},"check-box":{type:"check-box",name:"复选框"},"check-group":{type:"check-group",name:"复选框组"},"combo-list":{type:"combo-list",name:"下拉列表"},"response-form":{type:"response-form",name:"卡片面板"},"response-layout":{type:"response-layout",name:"布局容器",icon:"response-layout-3"},"response-layout-item":{type:"response-layout-item",name:"布局",icon:"response-layout-1"},"tree-grid":{type:"tree-grid",name:"树表格"},"tree-grid-column":{type:"tree-grid-column",name:"树表格列"},"data-grid":{type:"data-grid",name:"表格"},"data-grid-column":{type:"data-grid-column",name:"表格列"},module:{type:"Module",name:"模块"},component:{type:"component",name:"组件"},tabs:{type:"tabs",name:"标签页"},"tab-page":{type:"tab-page",name:"标签页项",dependentParentControl:"Tab"},"tab-toolbar-item":{type:"tab-toolbar-item",name:"标签页工具栏按钮"},"time-picker":{type:"time-picker",name:"时间选择"},section:{type:"section",name:"分组面板"},"section-toolbar":{type:"section-toolbar",name:"分组面板工具栏"},"section-toolbar-item":{type:"section-toolbar-item",name:"分组面板按钮"},splitter:{type:"splitter",name:"分栏面板"},"splitter-pane":{type:"splitter-pane",name:"分栏面板项",dependentParentControl:"Splitter"},"component-ref":{type:"component-ref",name:"组件引用节点"},uploader:{type:"uploader",name:"附件上传"},"page-header":{type:"page-header",name:"页头"},"page-footer":{type:"page-footer",name:"页脚"},"tab-toolbar":{type:"tab-toolbar",name:"标签页工具栏"},fieldset:{type:"fieldset",name:"分组"},"query-solution":{type:"query-solution",name:"筛选方案"},drawer:{type:"drawer",name:"抽屉"}},bt={},Ct={};vt();function Te(n,e,t=new Map,r=(u,h,p,d)=>h,a={},s=u=>u){return $e[e.title]=e,Re[e.title]=r,bt[e.title]=a,Ct[e.title]=s,(u={},h=!0)=>{if(!h)return _e(u,t);const p=ht(u,e,t),d=Object.keys(n).reduce((v,c)=>(v[c]=n[c].default,v),{});return Object.assign(d,p)}}function Le(n,e){return{customClass:e.class,customStyle:e.style}}function wt(n,e){const t=[];return e==null||e.buttons.map(r=>{const a={};Object.keys(r).map(s=>{var u;s==="appearance"?a.class=((u=r[s])==null?void 0:u.class)||"":a[s]=r[s]}),t.push(a)}),{buttons:t}}function Tt(){function n(e,t){var h;const r=(h=e.toolbar)==null?void 0:h.buttons;if(!r||r.length<1)return null;const[a,s]=t.payloads,u=r.find(p=>p.id===s);return u?u.onClick||u.click:null}return{resolve:n}}function St(){function n(e,t){const r=e.buttons;if(!r||r.length<1)return null;const[a,s]=t.payloads,u=r.find(h=>h.id===s);return u?u.onClick||u.click:null}return{resolve:n}}function Pt(n,e,t){var a;const r=t.toolbar;return{buttonClass:(a=r==null?void 0:r.appearance)==null?void 0:a.class}}const Dt=new Map([["appearance",Le],["toolbar",wt],["buttonClass",Pt]]),Et={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/page-header.schema.json",title:"page-header",description:"A Farris Container Component",type:"object",properties:{id:{description:"The unique identifier for a Page Header",type:"string"},type:{description:"The type string of Page Header component",type:"string",default:"page-header"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},showIcon:{description:"",type:"boolean",default:!0},icon:{description:"",type:"string",default:"f-icon-page-title-record"},iconClass:{description:"",type:"string",default:"f-text-orna-bill"},title:{description:"",type:"string",default:""},subTitle:{description:"",type:"string",default:""},toolbar:{description:"",type:"object",properties:{appearance:{description:"",type:"object",properties:{class:{type:"string",default:"col-6"}}},id:{description:"",type:"string"},type:{description:"",type:"string",default:"response-toolbar"},alignment:{description:"The alignment of Response Toolbar Button.",type:"string",default:"right"},buttons:{description:"The items of Response Toolbar.",type:"array",default:[]}}},buttonClass:{description:"",type:"string",default:"col-6"},titleContentClass:{description:"",type:"string",default:""},contentClass:{description:"",type:"string",default:""},downContentClass:{description:"",type:"string",default:""},showPagination:{description:"",type:"boolean",default:!1},prePaginationDisabled:{description:"",type:"boolean",default:!0},nextPaginationDisabled:{description:"",type:"boolean",default:!1}},required:["id","type"]};function kt(n,e,t){return e.title="标题",e}const ge={customClass:{type:String,default:""},showIcon:{type:Boolean,default:!0},icon:{type:String,default:"f-icon-page-title-record"},iconClass:{type:String,default:"f-text-orna-bill"},title:{type:String,default:""},subTitle:{type:String,default:""},buttonClass:{type:String,default:"col-6"},buttons:{type:Array,default:[]},titleContentClass:{type:String,default:""},contentClass:{type:String,default:""},downContentClass:{type:String,default:""},showPagination:{type:Boolean,default:!1},prePaginationDisabled:{type:Boolean,default:!0},nextPaginationDisabled:{type:Boolean,default:!1}},Fe=Object.assign({},ge,{componentId:{type:String,default:""}}),Se=Te(ge,Et,Dt,kt),qe=Tt(),he=o.defineComponent({name:"FPageHeader",props:ge,emits:["click","prePaginationClick","nextPaginationClick"],setup(n,e){const t=o.ref(n.buttons),r=(x,O)=>{e.emit("click",x,O)};function a(x,O){x&&O&&O.split(" ").reduce((w,g)=>(w[g]=!0,w),x)}const s=o.computed(()=>{const x={"f-page-header":!0};return a(x,n.customClass),x}),u=o.computed(()=>{const x={"f-title-icon":!0};return a(x,n.iconClass),x}),h=o.computed(()=>{const x={"f-icon":!0};return a(x,n.icon),x}),p=o.computed(()=>{const x={"f-title":!0};return a(x,n.titleContentClass),x}),d=o.computed(()=>{const x={"f-content":!0};return a(x,n.contentClass),x}),v=o.computed(()=>{const x={"f-content":!0};return a(x,n.downContentClass),x}),c=o.computed(()=>({"f-icon f-icon-arrow-w":!0,"f-state-disabled":n.prePaginationDisabled})),m=o.computed(()=>({"f-icon f-icon-arrow-e":!0,"f-state-disabled":n.nextPaginationDisabled}));function i(x){n.prePaginationDisabled||e.emit("prePaginationClick",x)}function l(x){n.nextPaginationDisabled||e.emit("nextPaginationClick",x)}function y(){return e.slots.titleContent?o.createVNode("div",{class:p.value},[o.createTextVNode(" "),e.slots.titleContent()]):o.createVNode("div",{class:"f-title"},[n.showIcon&&n.icon?o.createVNode("span",{class:u.value},[o.createVNode("i",{class:h.value},null)]):"",o.createVNode("h4",{class:"f-title-text"},[n.title]),n.subTitle?o.createVNode("h5",{class:"f-title-subtitle"},[n.subTitle]):"",n.showPagination?o.createVNode("div",{class:"f-title-pagination"},[o.createVNode("span",{class:c.value,onClick:i},null),o.createVNode("span",{class:m.value,onClick:l},null)]):""])}function N(){return e.slots.content?o.createVNode("div",{class:d.value},[o.createTextVNode(" "),e.slots.content()]):""}function j(){if(n.buttons&&n.buttons.length>0)return o.createVNode(pt,{customClass:n.buttonClass,items:t.value,onClick:r},null)}function L(){return e.slots.downContent?o.createVNode("div",{class:v.value},[o.createTextVNode(" "),e.slots.downContent()]):""}return o.watch(()=>n.buttons,x=>{t.value=x},{deep:!0}),()=>o.createVNode("div",{class:s.value},[o.createVNode("nav",{class:"f-page-header-base"},[y(),N(),j()]),L()])}});function Mt(n,e,t){var w;const r=t&&t.getStyles&&t.getStyles()||"",a=t&&t.getDesignerClass&&t.getDesignerClass()||"",s=o.ref();function u(){return(e==null?void 0:e.schema.componentType)==="frame"?!1:t&&t.checkCanMoveComponent?t.checkCanMoveComponent():!0}function h(){return!1}function p(){return(e==null?void 0:e.schema.componentType)==="frame"?!1:t&&t.checkCanDeleteComponent?t.checkCanDeleteComponent():!0}function d(){return(e==null?void 0:e.schema.componentType)==="frame"?!0:t&&t.hideNestedPaddingInDesginerView?t.hideNestedPaddingInDesginerView():!1}function v(g){if(!g||!g.value)return null;if(g.value.schema&&g.value.schema.type==="component")return g.value;const k=o.ref(g==null?void 0:g.value.parent),B=v(k);return B||null}function c(g=e){var C;if(t!=null&&t.getDraggableDesignItemElement)return t.getDraggableDesignItemElement(g);const{componentInstance:k,designerItemElementRef:B}=g;if(!k||!k.value)return null;const{getCustomButtons:A}=k.value;return k.value.canMove||A&&((C=A())!=null&&C.length)?B:c(g.parent)}function m(g){return!!t&&t.canAccepts(g)}function i(){return(e==null?void 0:e.schema.label)||(e==null?void 0:e.schema.title)||(e==null?void 0:e.schema.name)}function l(){}function y(g,k){var B;!g||!k||(t!=null&&t.onAcceptMovedChildElement&&t.onAcceptMovedChildElement(g,k),(B=e==null?void 0:e.setupContext)==null||B.emit("dragEnd"))}function N(g,k){const{componentType:B}=g;let A=pe(B,g,k);t&&t.onResolveNewComponentSchema&&(A=t.onResolveNewComponentSchema(g,A));const C=B.toLowerCase().replace(/-/g,"_");return A&&!A.id&&A.type===B&&(A.id=`${C}_${Math.random().toString().slice(2,6)}`),A}function j(g){g&&t!=null&&t.onChildElementMovedOut&&t.onChildElementMovedOut(g)}function L(...g){if(t&&t.getPropsConfig)return t.getPropsConfig(...g)}function x(){t&&t.onRemoveComponent&&t.onRemoveComponent(),e!=null&&e.schema.contents&&e.schema.contents.map(g=>{let k=g.id;g.type==="component-ref"&&(k=g.component);const B=n.value.querySelectorAll(`#${k}-design-item`);B!=null&&B.length&&Array.from(B).map(A=>{var C;(C=A==null?void 0:A.componentInstance)!=null&&C.value.onRemoveComponent&&A.componentInstance.value.onRemoveComponent()})})}function O(){if(t&&t.getCustomButtons)return t.getCustomButtons()}function S(g){if(t&&t.onPropertyChanged)return t.onPropertyChanged(g)}return s.value={canMove:u(),canSelectParent:h(),canDelete:p(),canNested:!d(),contents:e==null?void 0:e.schema.contents,elementRef:n,parent:(w=e==null?void 0:e.parent)==null?void 0:w.componentInstance,schema:e==null?void 0:e.schema,styles:r,designerClass:a,canAccepts:m,getBelongedComponentInstance:v,getDraggableDesignItemElement:c,getDraggingDisplayText:i,getPropConfig:L,getDragScopeElement:l,onAcceptMovedChildElement:y,onChildElementMovedOut:j,addNewChildComponentSchema:N,triggerBelongedComponentToMoveWhenMoved:!!t&&t.triggerBelongedComponentToMoveWhenMoved||o.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:!!t&&t.triggerBelongedComponentToDeleteWhenDeleted||o.ref(!1),onRemoveComponent:x,getCustomButtons:O,onPropertyChanged:S},s}const xt=o.ref(0);function Nt(){xt.value++}const ve=o.ref(0);function Bt(n,e){const t=e.getBoundingClientRect(),r=n.getBoundingClientRect(),a=r.top>=t.top,s=r.top<=t.bottom;return a&&s}function It(n){const e=n.querySelector(".component-btn-group");if(!e)return;e.style.display="";const t=e.getBoundingClientRect();if(!(t.top===0&&t.left===0)){const r=e.querySelector("div");if(r){const a=r.getBoundingClientRect();r.style.top=t.top+"px";let s=t.left-a.width;const u=document.querySelector(".editorDiv");if(u){const h=u.getBoundingClientRect();s<h.left&&({left:s}=n.getBoundingClientRect())}r.style.left=s+"px"}}}function Vt(n){if(!window.scrollContainerList)return;const e=Array.from(window.scrollContainerList);if(e.length&&e.length===1){const t=e[0],r=document.querySelector(`[id=${t}]`);if(r&&r.contains(n))return r}}function He(n){if(!n)return;const e=n.getBoundingClientRect();if(e.width===0&&e.height===0)return;const t=n.querySelector(".component-btn-group");if(t){let r=!0;const a=Vt(n);if(a&&(r=Bt(n,a)),!r){t.style.display="none";return}It(n)}}function At(n){if(!n)return;let e;n.className.includes("dgComponentSelected")?e=n:e=n.querySelector(".dgComponentSelected"),e&&He(e)}class ye{constructor(e,t){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 r;this.componentId=e,this.designerHostService=t,this.eventsEditorUtils=t.eventsEditorUtils,this.formSchemaUtils=t.formSchemaUtils,this.formMetadataConverter=t.formMetadataConverter,this.viewModelId=((r=this.formSchemaUtils)==null?void 0:r.getViewModelIdByComponentId(e))||"",this.designViewModelUtils=t.designViewModelUtils,this.controlCreatorUtils=t.controlCreatorUtils,this.metadataService=t.metadataService,this.schemaService=t.schemaService}getTableInfo(){var e;return(e=this.schemaService)==null?void 0:e.getTableInfoByViewModelId(this.viewModelId)}setDesignViewModelField(e){var r;const t=e.binding&&e.binding.type==="Form"&&e.binding.field;if(t){if(!this.designViewModelField){const a=this.designViewModelUtils.getDgViewModel(this.viewModelId);this.designViewModelField=a.fields.find(s=>s.id===t)}e.updateOn=(r=this.designViewModelField)==null?void 0:r.updateOn}}getBasicPropConfig(e){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",editable:!1,data:[{value:e.type,name:yt[e.type].name}]}}}}}getAppearanceConfig(e=null){return{title:"外观",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter"}},setPropertyRelates(t,r){if(t)switch(t&&t.propertyID){case"class":case"style":{ve.value++;break}}}}}updateElementByParentContainer(e,t){const r=t&&t.parent&&t.parent.schema;if(!r)return;const a=r.contents.findIndex(u=>u.id===e),s=re.cloneDeep(r.contents[a]);r.contents.splice(a,1),r.contents.splice(a,0,s),Nt()}}class jt extends ye{constructor(e,t){super(e,t)}getPropertyConfig(e){return this.propertyConfig.categories.basic=this.getBasicPropConfig(e),this.propertyConfig.categories.appearance=this.getAppearanceProperties(e),this.propertyConfig}getAppearanceProperties(e){return{title:"外观",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式"},icon:{title:"图标",type:"string",description:"图标"},title:{title:"标题",type:"string",description:"标题"}},setPropertyRelates(t,r){if(t)switch(t&&t.propertyID){case"title":{t.needRefreshControlTree=!0;break}}}}}}function Ot(n,e){function t(h){return!1}function r(){return!1}function a(){return!1}function s(){return!0}function u(h){return new jt(h,e).getPropertyConfig(n)}return{canAccepts:t,hideNestedPaddingInDesginerView:s,getPropsConfig:u,checkCanDeleteComponent:r,checkCanMoveComponent:a}}class Ue{constructor(e){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,"responsed",!1);q(this,"tipsEnable",!1);q(this,"tipsText","");q(this,"width",0);q(this,"onClick",()=>{});q(this,"options");var r,a;this.options=e;const t=["id","class","icon","groupId","order","asDropDownTop","text","isDP","visible","responsed","width","tipsEnable","tipsText","onClick"];Object.keys(e).filter(s=>t.indexOf(s)>-1).forEach(s=>{this[s]=e[s]}),(r=e.appearance)!=null&&r.class&&(this.class=(a=e.appearance)==null?void 0:a.class)}get enable(){return Object.keys(this.options).indexOf("disabled")>-1?!this.options.disabled:o.computed(()=>!0)}setWidth(e){this.width=parseInt(e,10)}getWidth(){return this.visible?this.width:!1}}class $t extends Ue{constructor(e){super(e)}}function We(){function n(e){const t=[];return e.reduce((r,a)=>(a.children&&a.children.length>0?r.push(new me(a)):r.push(new $t(a)),r),t),t}return{buildResponseToolbarItems:n}}const{buildResponseToolbarItems:Rt}=We();class me extends Ue{constructor(t){super(t);q(this,"placement","");q(this,"dropdownClass","");q(this,"menuClass","");q(this,"split",!1);q(this,"children",[]);q(this,"expanded",!1);const r=["isDP","class","dropdownClass","menuClass","placement","split","expanded"];Object.keys(t).filter(a=>r.indexOf(a)>-1).forEach(a=>{this[a]=t[a]}),t.children&&t.children.length&&(this.children=Rt(t.children))}}const _t=new Map([["buttons","items"],["appearance",Le]]);function ze(n,e,t){return e}const Lt={$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:""}},required:["id","type","buttons"]},Ft={$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:"btn-secondary"}}},alignment:{description:"对齐",type:"string",default:"right"},text:{description:"文本",type:"string",default:"按钮"},icon:{description:"图标",type:"string",default:""},disabled:{description:"禁用",type:"boolean",default:!1},onClick:{description:"点击事件",type:"string",default:""}},required:["id","type","text"]},Pe={customClass:{type:String,default:""},buttonSize:{type:String,default:""},alignment:{Type:String,default:"right"},items:{Type:Array,default:[]}},qt=Object.assign({},Pe,{componentId:{type:String,default:""}}),De=Te(Pe,Lt,_t,ze),Xe={id:{type:String,default:""},items:{type:Object,default:{}},class:{type:String,default:""},text:{type:String,default:""},icon:{type:String,default:""},componentId:{type:String,default:""},alignment:{Type:String,default:"right"}},Ht=Te(Xe,Ft,void 0,ze),Ut=St();function Wt(){function n(t){const r={"f-icon":!0};if(t.icon){const a=t.icon.trim().split(" ");a&&a.length&&a.reduce((s,u)=>(s[u]=!0,s),r)}return r}function e(t){return!!(t.icon&&t.icon.trim())}return{iconClass:n,shouldShowIcon:e}}function zt(n,e){function t(i){const l={"dropdown-menu":!0};if(i.class){const y=i.menuClass.split(" ");y&&y.length&&y.reduce((N,j)=>(N[j]=!0,N),l)}return l}function r(i){const l={disabled:!i.enable,"dropdown-submenu":!0,"f-rt-dropdown":!0,"text-truncate":!0},y=i.dropdownClass.split(" ");return y&&y.length&&y.reduce((N,j)=>(N[j]=!0,N),l),l}function a(i){const l={disabled:!i.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0},y=i.class.split(" ");return y&&y.length&&y.reduce((N,j)=>(N[j]=!0,N),l),l}let s;const u=new Map;function h(i,l,y){var j;((j=i.target)==null?void 0:j.id)===l.id&&i.stopPropagation();const N=y?y.id:"__top_item__";if(l.children&&l.children.length&&(l.expanded=!l.expanded,l.expanded?u.set(N,l):u.delete(N)),u.has(N)&&u.get(N)!==l){const L=u.get(N);L&&(L.expanded=!1)}}function p(i,l){document.body.click(),l.enable&&(typeof l.onClick=="function"&&l.onClick(i,l.id),n.emit("click",i,l.id))}function d(i,l){const y=i.target;y.className.indexOf("dropdown-item")<0||(y.title=y.scrollWidth>y.clientWidth?l:"")}function v(i){return i.children.map(l=>l.children&&l.children.length?o.createVNode("li",{class:r(l),id:l.id,onClick:y=>l.enable&&h(y,l,i)},[o.createVNode("span",{id:l.id,class:a(l),onMouseover:y=>l.enable&&h(y,l,i)},[l.text,o.createVNode("i",{class:"f-icon f-icon-arrow-chevron-right",style:"display: inline-block;float: right;line-height: 1.25rem;"},null)]),s(l,l)]):o.createVNode("li",{class:a(l),id:l.id,onClick:y=>p(y,l),onMouseover:y=>l.enable&&h(y,l,i),onMouseenter:y=>d(y,l.text)},[e.shouldShowIcon(l)&&o.createVNode("i",{class:e.iconClass(l)},null),l.text]))}function c(i,l,y){var O;const N={display:i.expanded?"block":"none",position:"fixed",maxWidth:"300px",width:"180px",minWidth:"120px",zIndex:1e4},j=(O=document.getElementsByTagName("body")[0].getClientRects()[0])==null?void 0:O.width,L=l,x=L==null?void 0:L.getClientRects();if(L&&x&&x.length){const{top:S,width:w,left:g,right:k,height:B}=x[0],A=Math.ceil(B+S);N.top=`${A}px`,N.left=`${g}px`;const C=i.id+"_menu",_=l?l.querySelector("#"+C):null;if(_){_.style.visibility="hidden",_.style.display="block";const M=_.offsetHeight;N.display==="block"&&(_.style.display="block");const P=_.getBoundingClientRect();if(y){N.top=`${S-6}px`;const b=Math.ceil(w+g);N.left=`${b}px`}j-g-w<P.width&&(N.left=`${(y?g:k)-P.width}px`),window.innerHeight-S-B<M&&(S>M?N.top=`${S-M-6}px`:(N.maxHeight=`${S-16}px`,N.overflowY="auto",S-B>window.innerHeight-S&&(N.top="10px"))),_.style.visibility="visible"}}return N}s=function(i,l){var L,x;const y=o.getCurrentInstance(),N=l?l.id:i.id,j=(x=(L=y==null?void 0:y.exposed)==null?void 0:L.elementRef.value)==null?void 0:x.querySelector("#"+N);return o.createVNode("ul",{class:t(i),style:c(i,j,l),id:i.id+"_menu"},[v(i)])};function m(){u.forEach(i=>{i.expanded=!1}),u.clear()}return{renderDropdownMenu:s,clearAllDropDownMenu:m}}function Xt(n,e,t){const r=o.ref(n.alignment),{renderDropdownMenu:a,clearAllDropDownMenu:s}=zt(e,t);function u(c){const m={"btn-group":!0,"f-rt-dropdown":!0,"f-btn-ml":r.value==="right"||r.value==="center","f-btn-mr":r.value==="left"},i=c.dropdownClass.split(" ");return i&&i.length&&i.reduce((l,y)=>(l[y]=!0,l),m),m}function h(c){const m={btn:!0,disabled:!c.enable,"f-rt-btn":!0,"btn-icontext":!!(c.icon&&c.icon.trim())};if(c.class){const i=c.class.split(" ");i&&i.length&&i.reduce((l,y)=>(l[y]=!0,l),m)}return m}function p(c,m){c.stopPropagation();const i=m.expanded;document.body.click(),m.expanded=!i}function d(c,m=!0){return o.createVNode("div",{id:c.id,class:u(c)},[o.createVNode("div",{class:h(c),style:"display: flex;padding-right: 0.1rem;border-top-right-radius: 6px;border-bottom-right-radius: 6px",onClick:i=>c.enable&&p(i,c)},[t.shouldShowIcon(c)&&o.createVNode("i",{class:t.iconClass(c)},null),o.createVNode("span",null,[c.text]),o.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)]),m&&a(c)])}function v(){s()}return{renderToolbarDropdown:d,clearAllDropDown:v}}const{buildResponseToolbarItems:Ye}=We(),be=o.defineComponent({name:"FResponseToolbar",props:Pe,emits:["click"],setup(n,e){const t=o.ref(Ye(n.items)),r=o.ref(),a=o.ref(),s=o.ref(),u=o.ref(n.alignment),h={id:"__more_buttons__",text:"更多"},p=o.ref(new me(h)),d={id:h.id+"width",text:h.text},v=o.ref(-1),c=Wt(),m=o.computed(()=>p.value.children.length>0),i=o.computed(()=>{const b={"f-toolbar":!0,"f-response-toolbar":!0,"position-relative":!0,"f-response-toolbar-sm":n.buttonSize==="sm","f-response-toolbar-lg":n.buttonSize==="lg"};return fe.getCustomClass(b,n.customClass)}),l=o.computed(()=>({"w-100":!0,"d-flex":!0,"flex-nowrap":!0,"justify-content-end":u.value==="right","justify-content-start":u.value==="left","justify-content-center":u.value==="center"})),{renderToolbarDropdown:y,clearAllDropDown:N}=Xt(n,e,c);function j(b){b&&b.target.closest("ul.dropdown-menu")&&b.type==="wheel"||(t.value.filter(D=>D.children&&D.children.length>0).forEach(D=>{D.expanded=!1}),p.value.expanded=!1,N())}function L(b,D){var J;const F={btn:!0,"f-rt-btn":!0,"f-btn-ml":u.value==="right"||D>0&&u.value==="center","f-btn-mr":u.value==="left","btn-icontext":!!(b.icon&&b.icon.trim())},Y=((J=b==null?void 0:b.appearance)==null?void 0:J.class)||b.class;if(Y){const U=Y.split(" ");U&&U.length&&U.reduce(($,z)=>($[z]=!0,$),F)}return F}function x(b,D){document.body.click(),typeof D.onClick=="function"&&D.onClick(b,D.id),e.emit("click",b,D.id)}function O(b,D){return o.createVNode("button",{type:"button",class:L(b,D),id:b.id,disabled:!b.enable,onClick:F=>x(F,b)},[c.shouldShowIcon(b)&&o.createVNode("i",{class:c.iconClass(b)},null),b.text])}let S=new Map,w=[];function g(b){const D=b.computedStyleMap().get("margin-left"),F=b.computedStyleMap().get("margin-right");return(D?D.value:0)+b.getBoundingClientRect().width+(F?F.value:0)}function k(b,D,F){if(D<v.value){let Y=F-1;for(;Y>=0;Y--){const J=b[Y],U=g(J);if(D+=U,D>=v.value)break}F=Y}return D-=v.value,{start:F,space:D}}function B(b){const D=s.value;let F=b;const J=Array.from(D.children).filter(Z=>Z.id!=="__more_buttons__"),U=J.length;let $=!1,z=0;for(;z<U;z++){const Z=J[z],R=g(Z);if(R<=F)F-=R;else{const ae=k(J,F,z);z=ae.start,F=ae.space,$=!0;break}}if(!$&&w.length>0){const Z=k(J,F,z);z=Z.start,F=Z.space}const ne=w.length>0;for(;z<U;z++){const Z=J[z],R=g(Z);S.set(Z.id,!0),w[ne?"unshift":"push"]({id:Z.id,width:R})}return F}function A(b){let D=B(b);if(w.length){let U=0;for(;U<w.length;U++){const $=n.items.find(z=>z.id===w[U].id);if($&&$.visible!==!1){const z=w[U].width;if(D>=z||U===w.length-1&&D+v.value>=z)D-=z;else break}}for(let $=0;$<U;$++)S.delete(w[$].id);w.splice(0,U-1)}const F=Object.assign({},p.value);F.children=[];const Y=new me(F),J=t.value.reduce((U,$)=>{const z=n.items.find(ne=>ne.id===$.id);return S.has($.id)?(Y.children.push($),$.visible=!1):$.visible=z.visible!==!1,U.push($),U},[]);p.value=Y,t.value=J}function C(b=-1){var Y;if(b===0)return;b<0&&(b=((Y=a.value)==null?void 0:Y.getBoundingClientRect().width)||-1);const F=s.value.getBoundingClientRect().width;(b>=0&&b<F||w.length)&&(A(b),j())}function _(){return v.value<0&&o.createVNode("div",{style:"position:absolute;top:-30px;visibility:hidden;"},[y(new me(d))])}const M=new ResizeObserver(b=>{if(b.length){const F=b[0].contentRect.width;C(F)}});function P(){S=new Map,w=[]}return o.onMounted(()=>{if(v.value<0){const D=r.value.querySelector("#"+d.id);D&&(v.value=g(D))}C();const b=a.value;M.observe(b),document.body.addEventListener("click",j),document.body.addEventListener("wheel",j)}),o.onUnmounted(()=>{M.disconnect(),document.body.removeEventListener("click",j),document.body.removeEventListener("wheel",j)}),o.watch(()=>n.items,()=>{t.value=Ye(n.items),o.nextTick(()=>{P(),C()})},{deep:!0}),e.expose({elementRef:r}),()=>o.createVNode("div",{class:i.value,ref:r,style:{"overflow-y":v.value<0?"hidden":"initial"}},[_(),o.createVNode("div",{ref:a,class:l.value},[o.createVNode("div",{ref:s,class:"d-inline-block f-response-content",style:"white-space: nowrap;"},[t.value.filter(b=>b.visible).map((b,D)=>b.children&&b.children.length>0?y(b):O(b,D)),m.value&&y(p.value)])])])}});class Yt extends ye{constructor(e,t){super(e,t)}getPropertyConfig(e){return this.propertyConfig.categories.basic=this.getBasicPropConfig(e),this.getAppearancePropConfig(e),this.propertyConfig}getAppearancePropConfig(e){this.propertyConfig.categories.appearance={title:"外观",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter"}}}}getBehaviorProperties(e){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 Gt(n,e){const t=n.schema;function r(m){return!1}function a(m,i){return i.text=m.label,i}function s(){return!1}function u(){return!1}function h(){return!0}function p(){return!0}function d(m){return new Yt(m,e).getPropertyConfig(t)}function v(m){m&&(m.stopPropagation(),m.preventDefault());const{schema:i}=n;i.buttons||(i.buttons=[]);const l=pe("response-toolbar-item");l.id=`toolbar_item_${Math.random().toString().slice(2,6)}`,l.appearance={class:"btn btn-secondary"},i.buttons.push(l)}function c(){return[{id:"appendItem",title:"新增按钮",icon:"f-icon f-icon-plus-circle text-white",onClick:m=>v(m)}]}return{canAccepts:r,checkCanAddComponent:h,checkCanDeleteComponent:u,checkCanMoveComponent:s,hideNestedPaddingInDesginerView:p,onResolveNewComponentSchema:a,getPropsConfig:d,getCustomButtons:c}}const Qt={id:{type:String,default:""},componentId:{type:String,default:""},canAdd:{type:Boolean,default:!1},canDelete:{type:Boolean,default:!1},canMove:{type:Boolean,default:!1},contentKey:{type:String,default:"contents"},childLabel:{type:String,default:""},childType:{type:String,default:""},modelValue:{type:Object}};function Jt(n,e,t){var S;const r="",a=o.ref();function s(){return!0}function u(){return!1}function h(){return!0}function p(){return!0}function d(){return!0}function v(w){if(!w||!w.value)return null;const g=o.ref(w==null?void 0:w.value.parent),k=v(g);return k||null}function c(w=e){const{componentInstance:g,designerItemElementRef:k}=w;return!g||!g.value?null:g.value.canMove||g.value.canAdd||g.value.canDelete?k:c(w.parent)}function m(w){return!!t}function i(){return(e==null?void 0:e.schema.label)||(e==null?void 0:e.schema.title)||(e==null?void 0:e.schema.name)}function l(){}function y(w,g){}function N(w){const{componentType:g}=w,k=o.inject("designer-host-service");let B=pe(g,w,k);const A=g.toLowerCase().replace(/-/g,"_");return B&&!B.id&&B.type===g&&(B.id=`${A}_${Math.random().toString().slice(2,6)}`),B}function j(w){}function L(...w){return[]}function x(){}function O(w){}return a.value={canMove:s(),canSelectParent:u(),canAdd:p(),canDelete:h(),canNested:!d(),contents:[],elementRef:n,parent:(S=e.parent)==null?void 0:S.componentInstance,schema:e.schema,styles:r,canAccepts:m,getBelongedComponentInstance:v,getDraggableDesignItemElement:c,getDraggingDisplayText:i,getPropConfig:L,getDragScopeElement:l,onAcceptMovedChildElement:y,onChildElementMovedOut:j,addNewChildComponentSchema:N,onRemoveComponent:x,triggerBelongedComponentToMoveWhenMoved:o.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:o.ref(!1),onPropertyChanged:O},a}const Ge=o.defineComponent({name:"FDesignerInnerItem",props:Qt,emits:["selectionChange","addComponent","removeComponent"],setup(n,e){const t=o.ref(n.canMove),r=o.ref(n.canAdd),a=o.ref(n.canDelete),s=o.ref(!1),u=o.ref(n.contentKey),h=o.ref(n.childType),p=o.ref(n.childLabel),d=o.ref(n.modelValue),v=o.ref(""),c=o.ref(),m=o.inject("canvas-dragula"),i=o.ref(),l=o.inject("design-item-context"),y={designerItemElementRef:c,componentInstance:i,schema:d.value,parent:l,setupContext:e};o.provide("design-item-context",y);const N=o.computed(()=>({"farris-component":!0,"flex-fill":n.id==="root-component","position-relative":t.value||a.value,"farris-nested":s.value,"can-move":t.value,"d-none":c.value&&c.value.classList.contains("d-none")})),j=o.computed(()=>{const M={};return v.value&&v.value.split(";").reduce((P,b)=>{const[D,F]=b.split(":");return D&&(P[D]=F),P},M),M});function L(M,P){if(l&&l.schema[u.value]){const b=l.schema[u.value].findIndex(D=>D.id===P.id);if(b>-1){const D=l.schema[u.value].length,F=l.schema[u.value][b%D];l.designerItemElementRef.value.querySelector(`#${F.id}-design-item`),l.schema[u.value].splice(b,1),ve.value++,e.emit("removeComponent"),e.emit("selectionChange")}}}function x(M){if(i.value.addNewChildComponentSchema){const P={componentType:h.value,label:p.value,parentComponentInstance:i.value,targetPosition:-1},b=i.value.addNewChildComponentSchema(P);d.value[u.value].push(b),e.emit("addComponent")}}function O(){return r.value&&o.createVNode("div",{role:"button",class:"btn component-settings-button",title:"新增",ref:"removeComponent",onClick:M=>{x()}},[o.createVNode("i",{class:"f-icon f-icon-plus-circle"},null)])}function S(M){return a.value&&o.createVNode("div",{role:"button",class:"btn component-settings-button",title:"删除",ref:"removeComponent",onClick:o.withModifiers(P=>L(P,M),["stop"])},[o.createVNode("i",{class:"f-icon f-icon-yxs_delete"},null)])}function w(){return t.value&&o.createVNode("div",{role:"button",class:"btn component-settings-button",title:"移动",ref:"moveComponent"},[o.createVNode("i",{"data-dragging-icon":"true",class:"cmp_move f-icon f-icon-yxs_move"},null)])}function g(M){return o.createVNode("div",{class:"component-btn-group","data-noattach":"true"},[o.createVNode("div",null,[O(),w(),S(M)])])}o.watch(()=>n.modelValue,M=>{d.value=M,y.schema=M});function k(M){window.scrollContainerList||(window.scrollContainerList=new Set);const P=M.getAttribute("id");P&&window.scrollContainerList.add(P)}function B(M){const P=M.target;k(P),At(P)}function A(){var M,P;(P=(M=d.value)==null?void 0:M.contents)!=null&&P.length&&c.value&&c.value.addEventListener("scroll",B)}function C(){const M=c.value,P=o.ref(M.children[1]);return Jt(P,y).value}o.onMounted(()=>{if(c.value){const M=c.value.querySelector(`[data-dragref='${d.value.id}-container']`);i.value=M&&M.componentInstance?M.componentInstance.value:C(),m&&M&&m.attachComponents(M,d.value),s.value=i.value.canNested!==void 0?i.value.canNested:s.value,r.value=i.value.canAdd!==void 0?i.value.canAdd:r.value,a.value=i.value.canDelete!==void 0?i.value.canDelete:a.value,t.value=i.value.canMove!==void 0?i.value.canMove:t.value,v.value=i.value.styles||"",c.value&&(c.value.componentInstance=i,c.value.designItemContext=y)}A(),ve.value++}),o.onBeforeUnmount(()=>{c.value&&c.value.removeEventListener("scroll",B)});function _(M){M&&(M.preventDefault(),M.stopPropagation());let P=y.designerItemElementRef;const b=c.value;if(b){const D=document.getElementsByClassName("dgComponentFocused");D&&D.length===1&&D[0]===c.value||(Array.from(D).forEach(Y=>Y.classList.remove("dgComponentFocused")),Array.from(document.getElementsByClassName("dgComponentSelected")).forEach(Y=>Y.classList.remove("dgComponentSelected")),b.classList.add("dgComponentFocused"),e.emit("selectionChange",d.value.type,d.value,n.componentId,i.value),i.value.getDraggableDesignItemElement&&(P=i.value.getDraggableDesignItemElement(y),P&&P.value&&P.value.classList.add("dgComponentSelected")))}He(P==null?void 0:P.value)}return()=>o.createVNode("div",{id:`${n.id}-design-item`,ref:c,class:N.value,style:j.value,onClick:_},[g(d.value),e.slots.default&&e.slots.default()])}});class Zt extends ye{constructor(e,t){super(e,t)}getPropertyConfig(e){return this.propertyConfig.categories.basic=this.getBasicPropConfig(e),this.propertyConfig.categories.basic.properties.text={title:"文本",type:"string",description:"",refreshPanelAfterChanged:!0},this.getAppearanceProperties(e),this.getbBehaviorConfig(),this.getEventPropConfig(e),this.propertyConfig}getAppearanceProperties(e){this.propertyConfig.categories.appearance={title:"外观",properties:{class:{description:"组件的CSS样式",title:"class样式"},icon:{title:"图标",type:"string",description:""}}}}getbBehaviorConfig(){this.propertyConfig.categories.behavior={title:"行为",description:"Behavior",properties:{disabled:{title:"禁用",type:"boolean",description:"按钮禁用状态",refreshPanelAfterChanged:!0,editor:{enableClear:!0,editable:!0}}}}}getEventPropConfig(e){const t=[{label:"onClick",name:"点击事件"}],r=this,a=r.eventsEditorUtils.formProperties(e,r.viewModelId,t),s={};s[r.viewModelId]={type:"events-editor",editor:{initialData:a}},this.propertyConfig.categories.eventsEditor={title:"事件",hideTitle:!0,properties:s,refreshPanelAfterChanged:!0,tabId:"commands",tabName:"交互",setPropertyRelates(u,h){const p=u.propertyValue;delete e[r.viewModelId],p&&(p.setPropertyRelates=this.setPropertyRelates,r.eventsEditorUtils.saveRelatedParameters(e,r.viewModelId,p.events,p))}}}}class Kt extends ye{constructor(e,t){super(e,t)}getPropertyConfig(e){return this.propertyConfig.categories.basic=this.getBasicPropConfig(e),this.propertyConfig.categories.basic.properties.text={title:"文本",type:"string",description:"",refreshPanelAfterChanged:!0},this.getAppearanceProperties(e),this.getBehaviorConfig(),this.getEventPropConfig(e),this.propertyConfig}getBehaviorConfig(){this.propertyConfig.categories.behavior={title:"行为",description:"Behavior",properties:{disabled:{title:"禁用",type:"boolean",description:"按钮禁用状态",refreshPanelAfterChanged:!0,editor:{enableClear:!0,editable:!0}}}}}getAppearanceProperties(e){this.propertyConfig.categories.appearance={title:"外观",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"",$converter:"/converter/appearance.converter"},icon:{title:"图标",type:"string",description:""}},setPropertyRelates(t){if(t)switch(t&&t.propertyID){case"text":{t.needRefreshControlTree=!0;break}}}}}getEventPropConfig(e){const t=[{label:"onClick",name:"点击事件"}],r=this,a=r.eventsEditorUtils.formProperties(e,r.viewModelId,t),s={};s[r.viewModelId]={type:"events-editor",editor:{initialData:a}},this.propertyConfig.categories.eventsEditor={title:"事件",hideTitle:!0,properties:s,refreshPanelAfterChanged:!0,tabId:"commands",tabName:"交互",setPropertyRelates(u,h){const p=u.propertyValue;delete e[r.viewModelId],p&&(p.setPropertyRelates=this.setPropertyRelates,r.eventsEditorUtils.saveRelatedParameters(e,r.viewModelId,p.events,p))}}}}function en(n,e){function t(d){return!1}function r(){return!1}function a(){return!0}function s(){return!1}function u(d){let v;switch(n.schema.type){case"tab-toolbar-item":v=new Zt(d,e);break;default:v=new Kt(d,e)}return v.getPropertyConfig(n.schema)}function h(){n.designerItemElementRef.value&&o.nextTick(()=>{n.designerItemElementRef.value.click()})}function p(d){if(!d)return;const{changeObject:v}=d;v&&["text","icon","class"].includes(v.propertyID)&&h()}return{canAccepts:t,checkCanMoveComponent:r,checkCanDeleteComponent:a,checkCanAddComponent:s,getPropsConfig:u,onPropertyChanged:p}}const Qe=o.defineComponent({name:"FResponseToolbarItemDesign",props:Xe,emits:["Click"],setup(n,e){o.ref(),o.ref();const t=o.ref(n.alignment),r={id:"__more_buttons__",text:"More"},a=o.ref(new me(r));o.computed(()=>a.value.children.length>0);const s=o.ref(),u=o.inject("designer-host-service"),h=o.inject("design-item-context"),p=en(h,u),d=Oe.useDesignerInnerComponent(s,h,p);o.inject("toolbar-item-handler",()=>{}),o.onMounted(()=>{s.value.componentInstance=d}),e.expose(d.value);function v(){const i={"f-icon":!0},l=n.icon?n.icon.trim():"";return fe.getCustomClass(i,l)}function c(){return!!(n.icon&&n.icon.trim())}function m(){const i={btn:!0,"f-rt-btn":!0,"f-btn-ml":t.value==="right"||t.value==="center","f-btn-mr":t.value==="left","btn-icontext":!!(n.icon&&n.icon.trim()),disabled:n.disabled===!0,"no-drag":!0};return fe.getCustomClass(i,n.class)}return()=>o.createVNode("div",{ref:s,"data-dragref":`${h.schema.id}-container`,class:"farris-component position-relative",style:"display:inline-block!important;"},[o.createVNode("button",{type:"button",class:m(),id:n.id},[c()&&o.createVNode("i",{class:v()},null),n.text])])}});var le=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Ce(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Je={exports:{}};(function(n,e){(function(t){n.exports=t()})(function(){return function(){function t(r,a,s){function u(d,v){if(!a[d]){if(!r[d]){var c=typeof Ce=="function"&&Ce;if(!v&&c)return c(d,!0);if(h)return h(d,!0);var m=new Error("Cannot find module '"+d+"'");throw m.code="MODULE_NOT_FOUND",m}var i=a[d]={exports:{}};r[d][0].call(i.exports,function(l){var y=r[d][1][l];return u(y||l)},i,i.exports,t,r,a,s)}return a[d].exports}for(var h=typeof Ce=="function"&&Ce,p=0;p<s.length;p++)u(s[p]);return u}return t}()({1:[function(t,r,a){var s={},u="(?:^|\\s)",h="(?:\\s|$)";function p(c){var m=s[c];return m?m.lastIndex=0:s[c]=m=new RegExp(u+c+h,"g"),m}function d(c,m){var i=c.className;i.length?p(m).test(i)||(c.className+=" "+m):c.className=m}function v(c,m){c.className=c.className.replace(p(m)," ").trim()}r.exports={add:d,rm:v}},{}],2:[function(t,r,a){(function(s){var u=t("contra/emitter"),h=t("crossvent"),p=t("./classes"),d=document,v=d.documentElement;function c(C,_){var M=arguments.length;M===1&&Array.isArray(C)===!1&&(_=C,C=[]);var P,b,D,F,Y,J,U,$,z,ne=null,Z,R,ae=!1,de=0,Q,I=_||{};I.moves===void 0&&(I.moves=L),I.accepts===void 0&&(I.accepts=L),I.invalid===void 0&&(I.invalid=fn),I.containers===void 0&&(I.containers=C||[]),I.isContainer===void 0&&(I.isContainer=j),I.copy===void 0&&(I.copy=!1),I.copySortSource===void 0&&(I.copySortSource=!1),I.revertOnSpill===void 0&&(I.revertOnSpill=!1),I.removeOnSpill===void 0&&(I.removeOnSpill=!1),I.direction===void 0&&(I.direction="vertical"),I.ignoreInputTextSelection===void 0&&(I.ignoreInputTextSelection=!0),I.mirrorContainer===void 0&&(I.mirrorContainer=d.body);var G=u({containers:I.containers,start:dn,end:it,cancel:ct,remove:lt,destroy:sn,canMove:un,dragging:!1});return I.removeOnSpill===!0&&G.on("over",mn).on("out",gn),tt(),G;function Ee(f){return G.containers.indexOf(f)!==-1||I.isContainer(f)}function tt(f){var T=f?"remove":"add";l(v,T,"mousedown",ln),l(v,T,"mouseup",xe)}function ke(f){var T=f?"remove":"add";l(v,T,"mousemove",cn)}function nt(f){var T=f?"remove":"add";h[T](v,"selectstart",ot),h[T](v,"click",ot)}function sn(){tt(!0),xe({})}function ot(f){Z&&f.preventDefault()}function ln(f){F=f.clientX,Y=f.clientY;var T=y(f)!==1||f.metaKey||f.ctrlKey;if(!T){var E=f.target,V=Me(E);V&&(Z=V,ke(),f.type==="mousedown"&&(w(E)?E.focus():f.preventDefault()))}}function cn(f){if(Z){if(y(f)===0){xe({});return}if(!(f.clientX!==void 0&&Math.abs(f.clientX-F)<=(I.slideFactorX||0)&&f.clientY!==void 0&&Math.abs(f.clientY-Y)<=(I.slideFactorY||0))){if(I.ignoreInputTextSelection){var T=A("clientX",f)||0,E=A("clientY",f)||0,V=d.elementFromPoint(T,E);if(w(V))return}var H=Z;ke(!0),nt(),it(),rt(H),p.add($||D,"gu-transit"),vn(),hn(),de=0,Ie(f)}}}function Me(f){if(!(G.dragging&&P)&&!Ee(f)){for(var T=f;S(f)&&Ee(S(f))===!1;)if(I.invalid(f,T)||(f=S(f),!f))return;var E=S(f);if(E&&!I.invalid(f,T)){var V=I.moves(f,E,T,k(f));if(V)return{item:f,source:E}}}}function un(f){return!!Me(f)}function dn(f){var T=Me(f);T&&rt(T)}function rt(f){Dn(f.item,f.source)&&($=f.item.cloneNode(!0),G.emit("cloned",$,f.item,"copy")),b=f.source,D=f.item,J=U=k(f.item),G.dragging=!0,G.emit("drag",D,b)}function fn(){return!1}function it(){if(G.dragging){var f=$||D;st(f,S(f))}}function at(){Z=!1,ke(!0),nt(!0)}function xe(f){if(at(),!!G.dragging){var T=$||D,E=A("clientX",f)||0,V=A("clientY",f)||0,H=N(P,E,V),W=ut(H,E,V);W&&($&&I.copySortSource||!$||W!==b)?st(T,W):I.removeOnSpill?lt():ct()}}function st(f,T){var E=S(f);$&&I.copySortSource&&T===b&&E.removeChild(D),Be(T)?G.emit("cancel",f,b):G.emit("drop",f,T,b,U),Ne()}function lt(){if(G.dragging){var f=$||D,T=S(f);T&&T.removeChild(f),G.emit($?"cancel":"remove",f,T,b),Ne()}}function ct(f){if(G.dragging){var T=arguments.length>0?f:I.revertOnSpill,E=$||D,V=S(E),H=Be(V);H===!1&&T&&($?V&&V.removeChild($):b.insertBefore(E,J)),H||T?G.emit("cancel",E,b,b):G.emit("drop",E,V,b,U),Ne()}}function Ne(){var f=$||D;at(),yn(),bn(),f&&p.rm(f,"gu-transit"),z&&clearTimeout(z),G.dragging=!1,ne&&G.emit("out",f,ne,b),G.emit("dragend",f,de),b=D=$=J=U=z=ne=null}function Be(f,T){var E;return T!==void 0?E=T:P?E=U:E=k($||D),f===b&&E===J}function ut(f,T,E){for(var V=f;V&&!H();)V=S(V);return V;function H(){var W=Ee(V);if(W===!1)return!1;var se=dt(V,f),te=ft(V,se,T,E),ie=Be(V,te);return ie?!0:I.accepts(D,V,b,te)}}function Ie(f){if(!P)return;f.preventDefault();var T=A("clientX",f)||0,E=A("clientY",f)||0;P.style.left=T-2+"px",P.style.top=E-2+"px";var V=$||D,H=N(P,T,E),W=ut(H,T,E),se=W!==null&&W!==ne;(se||W===null)&&(oe(),ne=W,ue()),Pn(H,E);var te=S(V);if(W===b&&$&&!I.copySortSource){te&&te.removeChild(V);return}var ie,ce=dt(W,H);if(ae=Cn(ce,W),ce!==null)ie=ft(W,ce,T,E);else if(I.revertOnSpill===!0&&!$)ie=J,W=b;else{$&&te&&te.removeChild(V),$&&R&&(R.style.display="none");return}R.style.display="block",pn(ie,V,se),ie?Tn(ce,ie):Sn(W);function K(ee){G.emit(ee,V,ne,b)}function ue(){se&&K("over")}function oe(){ne&&K("out")}}function pn(f,T,E){(f===T||f===k(T))&&(U=k(T)),(f===null&&E||f!==T&&f!==k(T))&&(U=f)}function mn(f){p.rm(f,"gu-hide")}function gn(f){G.dragging&&p.add(f,"gu-hide")}function hn(){P||(P=document.createElement("div"),P.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;",P.innerHTML=I.getMirrorText&&I.getMirrorText(D)||"控件",p.add(P,"gu-mirror"),I.mirrorContainer.appendChild(P),l(v,"add","mousemove",Ie),p.add(I.mirrorContainer,"gu-unselectable"),G.emit("cloned",P,D,"mirror"))}function vn(){if(R=document.createElement("div"),p.add(R,"gu-insertion"),D){var f=D.getBoundingClientRect();R.style.left=f.left+"px",R.style.top=f.top+"px"}ae=!1,I.mirrorContainer.appendChild(R)}function yn(){P&&(p.rm(I.mirrorContainer,"gu-unselectable"),l(v,"remove","mousemove",Ie),S(P).removeChild(P),P=null)}function bn(){R&&(S(R).removeChild(R),R=null)}function dt(f,T){for(var E=T;E!==f&&S(E)!==f;)E=S(E);return E===v?null:E}function Cn(f,T){if(!T)return ae;var E=f||T&&T.lastElementChild;if(!E)return!0;var V=getComputedStyle(f),H=/^inline/.test(V.getPropertyValue("display"))||/^(left|right)$/.test(V.getPropertyValue("float"));if(H)return!0;if(T){var W=getComputedStyle(T),se=W.getPropertyValue("display");if(/flex$/.test(se)){var te=W.getPropertyValue("flex-direction")||"row";if(te==="row"||te==="row-reverse")return!wn(T)}return!1}return!0}function wn(f){if(!f.children||!f.children.length)return!1;for(const T of Array.from(f.children)){const V=(T.className&&T.className.split(" ")||[]).filter(H=>/^col(-md|-xl|-el){0,1}-([1-9]|10|11|12)$/.test(H));if(!V.length)return!1;for(const H of V){const W=H.slice(H.lastIndexOf("-")+1);if(parseInt(W,10)!==12)return!1}}return!0}function Tn(f,T){const E=T.getBoundingClientRect();if(R.style.left=E.left+"px",R.style.top=E.top+"px",ae){if(R.style.height=E.height+"px",R.style.width="4px",f){const V=f.getBoundingClientRect();V.top!==E.top&&(R.style.left=V.right+"px",R.style.top=V.top+"px",R.style.height=V.height+"px")}}else if(R.style.height="4px",R.style.width=E.width+"px",Q){const V=Q.getBoundingClientRect();E.top<V.top&&(R.style.display="none")}T===D&&D&&(R.style.display="none")}function Sn(f){U=null;var T=f.lastElementChild;if(T){var E=T.getBoundingClientRect();ae?(R.style.left=E.right+"px",R.style.top=E.top+"px",R.style.height=E.height+"px",R.sty