@farris/ui-vue 1.7.2-beta.1 → 1.7.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/avatar/index.esm.js +155 -148
- package/components/avatar/index.umd.cjs +1 -1
- package/components/button-edit/index.esm.js +1 -1
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +226 -224
- package/components/calendar/index.umd.cjs +3 -3
- package/components/collection-property-editor/index.esm.js +225 -223
- package/components/collection-property-editor/index.umd.cjs +2 -2
- package/components/combo-list/index.esm.js +76 -71
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/comment/index.esm.js +169 -167
- package/components/comment/index.umd.cjs +6 -6
- package/components/component/index.esm.js +3691 -3043
- package/components/component/index.umd.cjs +2 -2
- package/components/condition/index.esm.js +2015 -1352
- package/components/condition/index.umd.cjs +2 -2
- package/components/data-grid/index.esm.js +407 -430
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.esm.js +3082 -3196
- package/components/data-view/index.umd.cjs +1 -1
- package/components/designer-canvas/index.esm.js +3364 -2713
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/drawer/index.esm.js +66 -64
- package/components/drawer/index.umd.cjs +2 -2
- package/components/dynamic-form/index.esm.js +1176 -524
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +182 -180
- package/components/dynamic-resolver/index.umd.cjs +2 -2
- package/components/dynamic-view/index.esm.js +531 -455
- package/components/dynamic-view/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +2352 -1700
- package/components/events-editor/index.umd.cjs +3 -3
- package/components/expression-editor/index.esm.js +8 -3
- package/components/expression-editor/index.umd.cjs +2 -2
- package/components/filter-bar/index.esm.js +422 -413
- package/components/filter-bar/index.umd.cjs +2 -2
- package/components/filter-condition-editor/index.esm.js +8 -3
- package/components/filter-condition-editor/index.umd.cjs +1 -1
- package/components/image/index.esm.js +363 -354
- package/components/image/index.umd.cjs +2 -2
- package/components/language-textbox/index.esm.js +189 -187
- package/components/language-textbox/index.umd.cjs +2 -2
- package/components/list-view/index.esm.js +388 -389
- package/components/list-view/index.umd.cjs +5 -5
- package/components/mapping-editor/index.esm.js +1465 -1488
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/number-range/index.esm.js +180 -173
- package/components/number-range/index.umd.cjs +1 -1
- package/components/order/index.esm.js +815 -811
- package/components/order/index.umd.cjs +5 -5
- package/components/property-panel/index.esm.js +429 -420
- package/components/property-panel/index.umd.cjs +3 -3
- package/components/query-solution/index.esm.js +4746 -4085
- package/components/query-solution/index.umd.cjs +7 -7
- package/components/schema-selector/index.esm.js +1401 -1402
- package/components/schema-selector/index.umd.cjs +5 -5
- package/components/section/index.esm.js +102 -100
- package/components/section/index.umd.cjs +2 -2
- package/components/sort-condition-editor/index.esm.js +8 -3
- package/components/sort-condition-editor/index.umd.cjs +1 -1
- package/components/transfer/index.esm.js +537 -538
- package/components/transfer/index.umd.cjs +5 -5
- package/components/tree-grid/index.esm.js +280 -283
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.esm.js +200 -202
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +533 -519
- package/components/uploader/index.umd.cjs +2 -2
- package/designer/data-grid/index.esm.js +3806 -3905
- package/designer/data-grid/index.umd.cjs +9 -9
- package/designer/drawer/index.esm.js +188 -186
- package/designer/drawer/index.umd.cjs +2 -2
- package/designer/dynamic-form/index.esm.js +1562 -1073
- package/designer/dynamic-form/index.umd.cjs +2 -2
- package/designer/farris-designer.all.esm.js +9793 -8613
- package/designer/farris-designer.all.umd.cjs +8 -8
- package/designer/list-view/index.esm.js +564 -564
- package/designer/list-view/index.umd.cjs +6 -6
- package/designer/radio-group/index.esm.js +236 -229
- package/designer/radio-group/index.umd.cjs +1 -1
- package/designer/response-layout-editor/index.esm.js +178 -171
- package/designer/response-layout-editor/index.umd.cjs +1 -1
- package/designer/tabs/index.esm.js +3154 -2508
- package/designer/tabs/index.umd.cjs +2 -2
- package/designer/time-picker/index.esm.js +193 -186
- package/designer/time-picker/index.umd.cjs +1 -1
- package/designer/tree-grid/index.esm.js +444 -447
- package/designer/tree-grid/index.umd.cjs +1 -1
- package/farris.all.esm.js +60126 -59649
- package/farris.all.umd.cjs +30 -30
- package/index.css +1 -1
- package/package.json +1 -1
- package/types/components.d.ts +1 -1
- package/types/condition/src/composition/condition-value/dropdown-value.d.ts +4 -0
- package/types/data-grid/index.d.ts +2 -5
- package/types/data-grid/src/data-grid.component.d.ts +1 -2
- package/types/data-view/components/row/hierarchy-row.component.d.ts +2 -2
- package/types/data-view/composition/appearance/use-cell-position.d.ts +1 -1
- package/types/data-view/composition/types.d.ts +0 -4
- package/types/data-view/composition/visualization/use-virtual-scroll.d.ts +2 -2
- package/types/data-view/composition/visualization/use-visual-data-bound.d.ts +2 -3
- package/types/data-view/composition/visualization/use-visual-data-row.d.ts +1 -2
- package/types/designer-canvas/src/composition/dg-control.d.ts +24 -0
- package/types/dynamic-form/designer.d.ts +0 -1
- package/types/dynamic-form/index.d.ts +4 -3
- package/types/dynamic-form/src/designer/dynamic-form.design.component.d.ts +8 -0
- package/types/dynamic-form/src/designer/response-form.design.props.d.ts +14 -0
- package/types/dynamic-form/src/designer/use-dynamic-form-rules.d.ts +2 -0
- package/types/dynamic-form/src/dynamic-form.component.d.ts +8 -0
- package/types/dynamic-form/src/response-form.props.d.ts +13 -1
- package/types/dynamic-form/src/schema/response-form-schema-resolver.d.ts +1 -0
- package/types/dynamic-form/src/types.d.ts +1 -0
- package/types/dynamic-resolver/src/types.d.ts +1 -0
- package/types/dynamic-view/index.d.ts +43 -3
- package/types/dynamic-view/src/components/maps.d.ts +6 -6
- package/types/dynamic-view/src/composition/index.d.ts +5 -0
- package/types/dynamic-view/src/composition/use-utils.d.ts +12 -0
- package/types/dynamic-view/src/dynamic-view.component.d.ts +6 -6
- package/types/language-textbox/index.d.ts +3 -3
- package/types/language-textbox/src/components/language-contents.component.d.ts +1 -1
- package/types/language-textbox/src/language-textbox.component.d.ts +1 -1
- package/types/lookup/src/components/favorite/lookup-favorite.component.d.ts +1 -1
- package/types/lookup/src/components/popup-container.component.d.ts +3 -3
- package/types/property-panel/src/property-panel.component.d.ts +3 -3
- package/types/tree-grid/src/components/data/data-area.component.d.ts +2 -2
- package/types/tree-grid/src/tree-grid.props.d.ts +0 -1
- package/types/tree-view/src/components/data/tree-area.component.d.ts +1 -1
- package/types/tree-view/src/tree-view.props.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(b,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("vue"),require("../dynamic-resolver/index.umd.js"),require("../locale/index.umd.js"),require("../designer-canvas/index.umd.js"),require("lodash-es"),require("../common/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../dynamic-resolver/index.umd.js","../locale/index.umd.js","../designer-canvas/index.umd.js","lodash-es","../common/index.umd.js"],h):(b=typeof globalThis<"u"?globalThis:b||self,h(b.avatar={},b.Vue,b.dynamicResolver,null,b.designerCanvas,b.LodashES,b.common))})(this,function(b,h,E,ie,s,U,x){"use strict";var ee=Object.defineProperty;var te=(b,h,E)=>h in b?ee(b,h,{enumerable:!0,configurable:!0,writable:!0,value:E}):b[h]=E;var A=(b,h,E)=>te(b,typeof h!="symbol"?h+"":h,E);function R(f,o,e){return o}const q=new Map([["appearance",E.resolveAppearance]]),L={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/avatar.schema.json",title:"avatar",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for avatar",type:"string"},type:{description:"The type string of avatar",type:"string",default:"avatar"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disabled:{type:"boolean",default:!1},avatarWidth:{description:"",type:"number",default:100},avatarHeight:{description:"",type:"number",default:100},readonly:{description:"",type:"boolean",default:!1},cover:{description:"",type:"string",default:""},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0}},required:["id","type"],ignore:["id","appearance","binding","visible"]},M={avatarWidth:{type:Number,default:100},avatarHeight:{type:Number,default:100},cover:{type:String},readonly:{type:Boolean,default:!1},shape:{type:String,default:"circle"},maxSize:{type:Number,default:1},modelValue:{type:String,default:""},title:{type:String,default:""},imageType:{type:Array,default:["jpeg"]}},k=E.createPropsResolver(M,L,q,R);function D(f,o,e,t){const i="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAAwICQoJBwwKCQoNDAwOER0TERAQESMZGxUdKiUsKyklKCguNEI4LjE/MigoOk46P0RHSktKLTdRV1FIVkJJSkf/2wBDAQwNDREPESITEyJHMCgwR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0f/wAARCAEsASwDASIAAhEBAxEB/8QAGgABAQEBAQEBAAAAAAAAAAAAAAECAwQFB//EADMQAQEAAQEECAQGAgMBAAAAAAABAhEDITFBBBRRUmFxgaESkcHwEyIysdHhM3IjQvE0/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAH/xAAXEQEBAQEAAAAAAAAAAAAAAAAAEQEh/9oADAMBAAIRAxEAPwD9BBYqCiyAGhougIqyGgEhIui6AyuixdATQ0WQA0BdA4houhoCaGgugMrouhoCaJoum80BNDRdDQGTRbEBNCxdDQGTRUBE0asQGRTQGTT71WxNPP5AugqyACyAC6dpIsgGgshoBISKAiroQDQ0OSyAgoBoaABoaABomigJTRQGV0XRATRGizUGRSwGdEsaqAljLQDOiNWJQZNJ4KffEFIRYAsFkAkFkAJFFkAkNCLIAAAC6AguhoCCl3TW2TzugIHx4S788Z6wmWN4ZY3ysoA1pu+qAgpYCAAaIoDIoCaJZvVAQ03LUBlGqWAzYmimn3vAaRYA1IkWASKKACgirIgAsgBoBdJNbZNN9t3aeIHNw2vSccbZhPxLN27dJ68/Rx222u1/LjbNn8vi/ieHPm58N03SKN5bfa58c7jOzHd78XOyXfd98bqoCaScp8jSdk+SgLjlljdccssfK12w6TlN2cmXjN1/iuAD34Z47Sa43XTjLus82nz5bjl8WNss4WPXsNtNpNLuzk3zlZ2wHUsBBF5CAFgAhouiUGRUBErSAyffFamgKqKCqkUBYcgBpADiuhoAKeYA8fStp8WX4WPCfq8b2eT1bXObPZZZ8bJrJ23lHz5rpvutu+3tvOqAAAAAAAACy3HKZY3Sy6yoA+hs85tMJlN2vGdlaeTomem0+C/9pu849SAKlARQERrkgJUWoCUVKDIqb/ugqxFBVRQFFBFABRAUAHn6bl+XDGc7bfT/ANeV26XddvJ2Yz3tcVAAAAAAAAAAFxy+HKZTjLq+l+z5j6Gzuuywt54z9jRoEQAARSoCCoCIqAIJQaCLzBZxCAKC8wIAChOIAADxdL/+i/6z6uTt0yabfXtxnta4qAAAAAAAAAAD37H/AAbP/WPBwfQ2c02WE7MYaNAIIoAhzCggHMEqaNIDNPviHoAsRqcAFSKC8iIoHNUAUAAAHl6ZPzbPLtln1ed7el467DXu2X0+68SgAAAAAAAAABpru7bo+npy7Po8HR8fi2+M46XW+Ue4ABAAAQAQUvAEvBL6BQS8U3feqpv7fcFnBUUBUUBScQFRUBQAAATKTLG43nLL6vnaWWy8ZdL5x9J4ulY/DtrZwymvrzUcgAAAAAAAANdwPT0LH9Wd8MZ+9elnY4fh7HHG8prfOtIAABQAQAKi1AE5KlBD09hPl7gKjUAVFBeYTiAqKgKAAAA5dKw+PY2ya5Y/mn19nVQfMG9th+HtbjOF3zyrCgAAAAAA6dHw+PbSWfln5r6Ob29Gw+DZS2fmy33y5T6g7cbreaAgAAAAgqAcgqfIBOapQSnr7lPS/IEaScAFVFgKIoKioCgAABgADj0nZ/HstZvyx3zxnN4+T6b52ePw7TLGcJbIoyAAAAADex2f4m1mN1+Gb75Tl9H0PbweboeOmGWXO3T0n/r0AAIAAAACKgHJFpyBEpyARFT74gKnNQVeaRQF5IoKTiigCKAAACZWY4/FlZMZxt3SAvnuna+dnlM8885wyts8nXb9I/Elw2e7G7rleN8J4ePNxUAAAAAAeroeUuFx7LrPKvQ+djlcMpljdLHs2W3x2k0/Tl2W8fLtB1C8ewQAAEUBDmt4oBeJeCAIUARFvBN3gByVAFUIChzWcAOSpGdpnjs5rnlMdeHbfKcwb58x5c+l23TZ7P1y3e0+rldvtcuO0snZjJFHvtmM1ysnjbpHHLpOyx3TK5eGM1eKyW63W3tt1UHfPpeV3YYTGduW+/JwyuWd1zyuVnDXhPKcgAAAAAAAAAAB0w2+0w3TKZTsy3+7tj0vG/rxyxvbN8eUB9DDa7PP9OeNvZrpfdu8OD5mkvGNY55Y/pzyx8ruIPePJj0nazj8OU8ZpfZ1w6Ts8rJlrhfHfPmg7FKgAF4AgVARPW/NanoAsZaBVlZUFVF4g57fbfhY7pLld0l/e+EeO23K5ZW5ZXjb97o1tcvj22WXHS/DPKMqAAAAAAAAAAAAAAAAAAAAAAOux212d0ttwvGdnjHr3ceMfPevo2XxbLTu3T0B1TmHJAZVOYF4p98xPviBFScQGlRZxBdS3TG3slvsibS/8WX+t/YHhx/TPGaqk4TyVQAAAAAAAAAAAAAAAAAAAAAAd+iX82c7ZL9/Nwdui/5b/rfoD00vARAQqAhfvcVNfL3A1WMqDSxmVQVNr/iz4/pv7LDOXLDLGcbNPDeDxTh6DtOjZaafFju816tlf+2Puo4Dv1bPvY+51bLvY+5RwHfq2Xex9zquXex9yjgO/Vcu9j7nVc+9j7lHAd+q597H3Oq597H3BwHfqufex9zqufex9yjgO/Vc+9j7nVc+9j7lHAd+q597H3Oq597H3KOA79Vz72PudVz72PuUcB36rl3sfc6rn3sfco4DvejZd7H3OrZd7H3KOA79Wy72PudWz72PuDg7dG/y3/W/Q6tl3sfdvY7K7PO25S6yzSdoOqWlEBmhaBamt+6J6AnmqaqDQy0CxYyoNCKC6m/VAGhPJdQBOSgKi6+QGu41QBRAF1LUABbUABNdAVOYUC0tE13gIWloCcTXeloFQLQTmffMtT74gixOa6gqysrzBVSVQVdWdQGpRNV1BV10SUlBYIvIF1E1Ne0F5iAKIAohaCmqWgBaapqC2ohqC6pqWoC2paa70tAqCACACa+F+RanyAWJ/a8vkAuqT6fVf7AVOz0X+AXVYh2egNSifx9T+wVWefyX+PqCyrqn807PQFEn0+p/YKH9H37gAc/kC6onL0P5BRP6OV8vqC2of2l/gAOSAuqan9J/AKmon9AUtL9PqnP1oCWl5ehfv5gh635nP1qWg//Z",n=h.ref(f.readonly);function r(g){return g.match(/\.(jpeg|jpg|gif|png|svg|bmp|webp)$/)!=null}function d(g){return g.indexOf("data:image/")>-1}function l(g){return"data:image/jpeg;base64,"+g}const u=h.computed(()=>{var p;if(!f.imageType||!f.imageType.length)return"";const g=(p=f.imageType)==null?void 0:p.map(y=>(y==="jpg"&&(y="jpeg"),`image/${y}`));return!g||!g.length?"image/*":g.join(",")}),c=h.computed(()=>{const g=t.value||f.cover||i;return r(g)||d(g)?g:l(g)}),a=h.computed(()=>n.value?"":f.title);function m(){n.value||e&&e.value&&e.value.click()}return{acceptTypes:u,imageSource:c,imageTitle:a,onClickImage:m}}const V=h.defineComponent({name:"FAvatar",props:M,emits:["change","update:modelValue"],setup(f,o){const e=h.computed(()=>({"f-avatar":!0,"f-avatar-readonly":f.readonly,"f-avatar-circle":f.shape==="circle","f-avatar-square":f.shape==="square"})),t=h.ref(f.modelValue),i=h.computed(()=>({width:f.avatarWidth+"px",height:f.avatarHeight+"px"})),n=!1;function r(){return""}function d(){}const l=h.ref(null),{acceptTypes:u,imageSource:c,onClickImage:a}=D(f,o,l,t);return()=>h.createVNode("div",{class:e.value,style:i.value,onClick:a},[n,h.createVNode("img",{title:f.title,class:"f-avatar-image",src:c.value,onError:r},null),!f.readonly&&h.createVNode("div",{class:"f-avatar-icon"},[h.createVNode("span",{class:"f-icon f-icon-camera"},null)]),h.createVNode("input",{ref:"file",name:"file-input",type:"file",class:"f-avatar-upload",accept:u.value,onChange:d,style:"display: none;"},null)])}});function H(f){const{formSchemaUtils:o,formStateMachineUtils:e}=f;function t(l,u=""){return{path:u+l.code,field:l.id,fullPath:l.code}}function i(l,u=""){const c=o.getViewModelById(l);return c?c.states.map(a=>t(a,u)):[]}function n(l){const u=o.getRootViewModelId(),c=i(l);if(l===u)return c;const a=i(u,"root-component.");return[...c,...a]}function r(l){return l.binding&&l.binding.path||l.id||""}function d(){return e&&e.getRenderStates()||[]}return{getVariables:n,getControlName:r,getStateMachines:d}}class N{constructor(o){A(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'"}]);A(this,"expressionNames",{compute:"计算表达式",dependency:"依赖表达式",validate:"验证表达式",dataPicking:"帮助前表达式",visible:"可见表达式",readonly:"只读表达式",required:"必填表达式"});A(this,"getExpressionConverter",(o,e)=>({convertFrom:(t,i,n,r)=>{const d=n.getExpressionRuleValue(o,e||i);return d&&d.value||""},convertTo:(t,i,n,r,d)=>{var l;if(i==="dataPicking"&&(n!=null&&n.target)){const u=`${n.target}_dataPicking`;((l=n.rules)==null?void 0:l.some(a=>a.id===u&&a.value))?t.dictPickingExpressionId=u:delete t.dictPickingExpressionId}r.updateExpression(n)}}));this.formSchemaService=o}getExpressionRule(o,e){const t=this.formSchemaService.getExpressions();if(!t)return"";const i=t.find(r=>r.target===o);if(!i)return"";const n=i.rules.find(r=>r.type===e);return n||""}getContextFormVariables(){const{module:o}=this.formSchemaService.getFormSchema();if(!o.viewmodels||o.viewmodels.length===0)return[];const e=this.formSchemaService.getRootViewModelId(),t=this.formSchemaService.getViewModelById(e);if(!t||!t.states||t.states.length===0)return[];const i=[];return t.states.filter(n=>n.category==="remote").forEach(n=>{i.push({key:n.code,name:n.name,description:n.name,category:n.category})}),i}createTreeNode(o,e,t="label"){return{id:o.id,name:o.name,bindingPath:o[t],parents:e,type:"field"}}buildEntityFieldsTreeData(o=null,e){const t=[];return o==null||o.forEach(i=>{var d;const n=this.createTreeNode(i,e);let r=[];(d=i.type)!=null&&d.fields&&(r=this.buildEntityFieldsTreeData(i.type.fields,[...e,i.label])),t.push({data:n,children:r,expanded:!0})}),t}buildChildEntityTreeData(o=null,e){const t=[];return o==null||o.forEach(i=>{var l,u;const n=this.createTreeNode(i,e);n.type="entity";const r=this.buildEntityFieldsTreeData((l=i.type)==null?void 0:l.fields,[...e,i.label]),d=this.buildChildEntityTreeData((u=i.type)==null?void 0:u.entities,[...e,i.label]);d!=null&&d.length&&(r==null||r.push(...d)),t.push({data:n,children:r||[],expanded:!0})}),t}getEntitiesTreeData(){const o=this.formSchemaService.getSchemaEntities();if(!(o!=null&&o.length))return[];const e=o[0];if(!(e!=null&&e.type))return[];const t=this.buildEntityFieldsTreeData(e.type.fields,[e.code]),i=this.buildChildEntityTreeData(e.type.entities,[e.code]);return i!=null&&i.length&&(t==null||t.push(...i)),{entityCode:e.code,fields:[{data:this.createTreeNode(e,[],"code"),children:t||[]}]}}getEntitiesAndVariables(){return{entities:this.getEntitiesTreeData(),variables:{session:{name:"系统变量",items:this.sessionVariables,visible:!1},forms:{name:"表单变量",items:this.getContextFormVariables(),visible:!0}}}}onBeforeOpenExpression(o,e,t){const i=t==="Field"?o.binding.field:o.id,n=this.getExpressionRule(i,e),r=this.getEntitiesAndVariables(),d={message:["validate","required","dataPicking"].includes(e)&&n?n.message:"",...r};return n.messageType!=null&&(d.messageType=n.messageType),d}buildRule(o,e,t,i){const{expression:n,message:r,messageType:d}=e,l={id:`${o}_${t}`,type:t,value:n};return(t==="validate"||t==="dataPicking"||t==="required")&&(l.message=r),t==="dataPicking"&&(l.messageType=d),t==="validate"&&i&&(l.elementId=i),l}getExpressionData(){const{expressions:o}=this.formSchemaService.getFormSchema().module;return o||[]}updateExpression(o,e,t,i){const n=e==="Field"?o.binding.field:o.id,r=this.buildRule(n,t,i,o.type==="form-group"?o.id:"");let l=this.getExpressionData().find(c=>c.targetType===e&&c.target===n);const u=c=>c.value.trim()==="";if(l){const c=l.rules.find(a=>a.id===r.id);if(c)u(r)?l.rules=l.rules.filter(a=>a.id!==r.id):(Object.assign(c,r),i==="validate"&&o.type==="form-group"&&(c.elementId=o.id));else{if(u(r))return null;l.rules=l.rules||[],l.rules.push(r)}}else{if(u(r))return null;l={target:`${n}`,rules:[r],targetType:e}}return l}getExpressionEditorOptions(o,e,t,i){return t.reduce((n,r)=>{var l,u;const d=e==="Field"?(l=o==null?void 0:o.binding)==null?void 0:l.field:o.id;return n[r]={hide:e==="Field"?!!((u=o==null?void 0:o.binding)!=null&&u.field):!1,description:"",title:this.expressionNames[r],type:"string",$converter:this.getExpressionConverter(d),refreshPanelAfterChanged:!0,editor:{type:"expression-editor",singleExpand:!1,dialogTitle:`${this.expressionNames[r]}编辑器`,showMessage:r==="validate"||r==="dataPicking"||r==="required",showMessageType:r==="dataPicking",beforeOpen:()=>this.onBeforeOpenExpression(o,r,e),onSubmitModal:c=>{const a=this.updateExpression(o,e,c,r);if(i){const m=this.buildRule(d,c,r);i(m)}return a}}},n},{})}getExpressionInfo(o,e,t){const i=e==="Field"?o.binding.field:o.id,n=this.getExpressionRule(i,t),r={value:n&&n.value,targetId:i,targetType:e,expressionType:t};return n&&n.message&&(r.message=n.message),r}getExpressionConfig(o,e,t=["compute","dependency","validate"],i){return{description:"表达式",title:"表达式",hide:!o.binding,properties:{...this.getExpressionEditorOptions(o,e,t,i)}}}getExpressionOptions(o,e,t){const i=this.getExpressionInfo(o,e,t);return{dialogTitle:`${this.expressionNames[t]}编辑器`,singleExpand:!1,showMessage:t==="required",beforeOpen:()=>this.onBeforeOpenExpression(o,t,e),expressionInfo:i}}}class W{constructor(o,e){A(this,"componentId");A(this,"viewModelId");A(this,"eventsEditorUtils");A(this,"formSchemaUtils");A(this,"formMetadataConverter");A(this,"designViewModelUtils");A(this,"designViewModelField");A(this,"controlCreatorUtils");A(this,"designerHostService");A(this,"designerContext");A(this,"schemaService",null);A(this,"metadataService",null);A(this,"propertyConfig",{type:"object",categories:{}});var t;this.componentId=o,this.designerHostService=e,this.eventsEditorUtils=e.eventsEditorUtils,this.formSchemaUtils=e.formSchemaUtils,this.formMetadataConverter=e.formMetadataConverter,this.viewModelId=((t=this.formSchemaUtils)==null?void 0:t.getViewModelIdByComponentId(o))||"",this.designViewModelUtils=e.designViewModelUtils,this.controlCreatorUtils=e.controlCreatorUtils,this.metadataService=e.metadataService,this.schemaService=e.schemaService,this.designerContext=e.designerContext}getFormDesignerInstance(){var o,e;return(e=(o=this.designerContext)==null?void 0:o.instances)==null?void 0:e.formDesigner.value}getTableInfo(){var o;return(o=this.schemaService)==null?void 0:o.getTableInfoByViewModelId(this.viewModelId)}setDesignViewModelField(o){var t;const e=o.binding&&o.binding.type==="Form"&&o.binding.field;if(e){if(!this.designViewModelField){const i=this.designViewModelUtils.getDgViewModel(this.viewModelId);this.designViewModelField=i.fields.find(n=>n.id===e)}o.updateOn=(t=this.designViewModelField)==null?void 0:t.updateOn}}getBasicPropConfig(o){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:o.type,name:s.DgControl[o.type]&&s.DgControl[o.type].name}]}}}}}getAppearanceConfig(o=null,e={},t){const i={title:"外观",description:"Appearance"},n={class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"}};for(const r in e)n[r]=Object.assign(n[r]||{},e[r]);return{...i,properties:{...n},setPropertyRelates(r,d){if(r){switch(r&&r.propertyID){case"class":case"style":{s.canvasChanged.value++;break}}t&&t(r,o,d)}}}}getPropertyEditorParams(o,e=[],t="visible",i={},n={},r=""){const{getVariables:d,getControlName:l,getStateMachines:u}=H(this.designerHostService),c=this.getRealTargetType(o),a=e&&e.length>0?e:["Const","Variable","StateMachine","Expression"],m={type:"property-editor",propertyTypes:a};return a.map(g=>{switch(g){case"Const":Object.assign(m,{constType:"enum",constEnums:[{id:!0,name:"是"},{id:!1,name:"否"}]},i);break;case"Expression":m.expressionConfig=this.getExpressionOptions(o,c,r||t);break;case"StateMachine":m.stateMachines=u();break;case"Variable":Object.assign(m,{controlName:l(o),newVariablePrefix:"is",newVariableType:"Boolean",variables:d(this.viewModelId),parentComponentId:this.componentId==="root-component"?"":"root-component",onBeforeOpenVariables:p=>{p.value=d(this.viewModelId)}},n),this.designerContext.designerMode==="PC_RTC"&&(m.newVariablePrefix="ext_"+m.newVariablePrefix);break}}),m}getVisibleProperty(o,e=""){var n;let t=["Const","Variable","StateMachine","Expression"];return e==="gridFieldEditor"?t=["Const","Expression"]:e==="form-group"&&!((n=o.binding)!=null&&n.field)&&(t=["Const","Variable","StateMachine"]),{visible:{title:"是否可见",type:"boolean",description:"运行时组件是否可见",editor:this.getPropertyEditorParams(o,t,"visible")}}}getBehaviorConfig(o,e="",t={},i){const n={title:"行为",description:""},r=this.getVisibleProperty(o,e);for(const l in t)r[l]=Object.assign(r[l]||{},t[l]);const d=this;return{...n,properties:{...r},setPropertyRelates(l,u){if(l){switch(l.propertyID){case"disabled":case"readonly":case"visible":d.afterMutilEditorChanged(o,l);break}i&&i(l,u)}}}}afterMutilEditorChanged(o,e){this.addNewVariableToViewModel(e,this.viewModelId),this.updateExpressionValue(e),this.clearExpression(e,o)}updateElementByParentContainer(o,e){const t=e&&e.parent&&e.parent.schema;if(!t)return;const i=t.contents.findIndex(r=>r.id===o),n=U.cloneDeep(t.contents[i]);t.contents.splice(i,1),t.contents.splice(i,0,n),s.refreshCanvas()}addNewVariableToViewModel(o,e){const t=o.propertyValue;if(!(t&&typeof t=="object")||!(t.type==="Variable"&&t.isNewVariable))return;const r={id:t.field,category:"locale",code:t.fullPath,name:t.fullPath,type:t.newVariableType||"String",isRtcVariable:this.designerContext.designerMode==="PC_RTC"?!0:void 0};delete t.newVariableType,delete t.isNewVariable,this.formSchemaUtils.getVariableByCode(r.code)||this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(r)}updateExpressionValue(o){const e=o.propertyValue;if(!((e&&e.type)==="Expression"&&e.expressionInfo))return;const{expressionId:n,expressionInfo:r}=e,{targetId:d,targetType:l,expressionType:u,value:c,message:a}=r,m=this.formSchemaUtils.getModule();m.expressions=m.expressions||[];const{expressions:g}=m;let p=g.find(C=>C.target===d);p||(p={target:d,rules:[],targetType:l},g.push(p));const y=p.rules.find(C=>C.type===u);if(y)y.value=c,y.message=a;else{const C={id:n,type:u,value:c,message:a};p.rules.push(C)}delete e.expressionInfo}clearExpression(o,e){const t=o.propertyValue;if(t&&t.type==="Expression")return;const n=o.propertyID,r=this.formSchemaUtils.getExpressions(),d=e.binding?e.binding.field:e.id,l=r.find(u=>u.target===d);!l||!l.rules||(l.rules=l.rules.filter(u=>u.type!==n))}getExpressionOptions(o,e,t){return new N(this.formSchemaUtils).getExpressionOptions(o,e,t)}getRealTargetType(o){return["response-toolbar-item","tab-toolbar-item","section-toolbar-item","drawer-toolbar-item"].indexOf(o.type)>-1?"Button":o.binding&&o.binding.field?"Field":"Container"}createBaseEventProperty(o){const e={};return e[this.viewModelId]={type:"events-editor",editor:{initialData:o,viewSourceHandle:t=>{var i;((i=t.controller)==null?void 0:i.label.indexOf(this.formSchemaUtils.getModule().code))>-1&&this.eventsEditorUtils.jumpToMethod(t)}}},e}}const v=class v{static getEditorTypesByMDataType(o,e=!1,t=""){if(e)return[{key:s.DgControl["language-textbox"].type,value:s.DgControl["language-textbox"].name}];let i=v.fieldControlTypeMapping[o];if(t==="data-grid-column"&&(i!=null&&i.length)){const n=[s.DgControl["check-group"].type,s.DgControl["radio-group"].type,s.DgControl.image.type,s.DgControl["rich-text-editor"].type];i=i.filter(r=>!n.includes(r.key))}return i}static getAllInputTypes(){const o=[];for(const e in v.fieldControlTypeMapping)v.fieldControlTypeMapping[e].forEach(t=>{o.find(i=>i.key===t.key&&i.value===t.value)||o.push({key:t.key,value:t.value})});return o}static mappingDomPropAndSchemaProp(o,e){var n;const t=(n=o.editor)==null?void 0:n.type,i=[];return(o.type===s.DgControl["data-grid-column"].type||o.type===s.DgControl["tree-grid-column"].type)&&e&&e.categoryId&&e.categoryId.indexOf("gridFieldEditor")<0&&i.push({domField:"title",schemaField:"name"}),i.push({domField:"label",schemaField:"name"}),i.push({domField:"editor.required",schemaField:"require"}),i.push({domField:"editor.readonly",schemaField:"readonly"}),(t===s.DgControl["input-group"].type||t===s.DgControl.textarea.type||t===s.DgControl["number-spinner"].type)&&i.push({domField:"editor.maxLength",schemaField:"type.length"}),t===s.DgControl["number-spinner"].type&&i.push({domField:"editor.precision",schemaField:"type.precision"}),(o.type===s.DgControl["data-grid-column"].type||o.type===s.DgControl["tree-grid-column"].type)&&i.push({domField:"formatter.precision",schemaField:"type.precision"}),(t===s.DgControl["combo-list"].type||t===s.DgControl["radio-group"].type)&&i.push({domField:"editor.data",schemaField:"type.enumValues"}),(o.type===s.DgControl["data-grid-column"].type||o.type===s.DgControl["tree-grid-column"].type)&&i.push({domField:"formatter.data",schemaField:"type.enumValues"}),t===s.DgControl["date-picker"].type&&(i.push({domField:"editor.displayFormat",schemaField:"editor.format"}),i.push({domField:"editor.fieldType",schemaField:"type.name"})),t===s.DgControl["number-spinner"].type&&(i.push({domField:"editor.max",schemaField:"editor.maxValue"}),i.push({domField:"editor.min",schemaField:"editor.minValue"})),t===s.DgControl.lookup.type&&(i.push({domField:"editor.dataSource",schemaField:"editor.dataSource"}),i.push({domField:"editor.valueField",schemaField:"editor.valueField"}),i.push({domField:"editor.textField",schemaField:"editor.textField"}),i.push({domField:"editor.displayType",schemaField:"editor.displayType"}),i.push({domField:"editor.mapFields",schemaField:"editor.mapFields"}),i.push({domField:"editor.helpId",schemaField:"editor.helpId"})),i.push({domField:"path",schemaField:"bindingPath"}),i.push({domField:"binding.path",schemaField:"bindingField"}),i.push({domField:"binding.fullPath",schemaField:"path"}),(o.type===s.DgControl["data-grid-column"].type||o.type===s.DgControl["tree-grid-column"].type)&&i.push({domField:"field",schemaField:"bindingPath"}),i}};A(v,"fieldControlTypeMapping",{String:[{key:s.DgControl["input-group"].type,value:s.DgControl["input-group"].name},{key:s.DgControl.lookup.type,value:s.DgControl.lookup.name},{key:s.DgControl.image.type,value:s.DgControl.image.name},{key:s.DgControl["date-picker"].type,value:s.DgControl["date-picker"].name},{key:s.DgControl.switch.type,value:s.DgControl.switch.name},{key:s.DgControl["check-box"].type,value:s.DgControl["check-box"].name},{key:s.DgControl["check-group"].type,value:s.DgControl["check-group"].name},{key:s.DgControl["radio-group"].type,value:s.DgControl["radio-group"].name},{key:s.DgControl["combo-list"].type,value:s.DgControl["combo-list"].name},{key:s.DgControl.textarea.type,value:s.DgControl.textarea.name},{key:s.DgControl["time-picker"].type,value:s.DgControl["time-picker"].name}],Text:[{key:s.DgControl.textarea.type,value:s.DgControl.textarea.name},{key:s.DgControl.lookup.type,value:s.DgControl.lookup.name},{key:s.DgControl.image.type,value:s.DgControl.image.name},{key:s.DgControl["rich-text-editor"].type,value:s.DgControl["rich-text-editor"].name}],Decimal:[{key:s.DgControl["number-spinner"].type,value:s.DgControl["number-spinner"].name}],Integer:[{key:s.DgControl["number-spinner"].type,value:s.DgControl["number-spinner"].name}],Number:[{key:s.DgControl["number-spinner"].type,value:s.DgControl["number-spinner"].name},{key:s.DgControl.switch.type,value:s.DgControl.switch.name},{key:s.DgControl["check-box"].type,value:s.DgControl["check-box"].name}],BigNumber:[{key:s.DgControl["number-spinner"].type,value:s.DgControl["number-spinner"].name}],Date:[{key:s.DgControl["date-picker"].type,value:s.DgControl["date-picker"].name}],DateTime:[{key:s.DgControl["date-picker"].type,value:s.DgControl["date-picker"].name}],Boolean:[{key:s.DgControl.switch.type,value:s.DgControl.switch.name},{key:s.DgControl["check-box"].type,value:s.DgControl["check-box"].name}],Enum:[{key:s.DgControl["combo-list"].type,value:s.DgControl["combo-list"].name},{key:s.DgControl["radio-group"].type,value:s.DgControl["radio-group"].name}],Object:[{key:s.DgControl.lookup.type,value:s.DgControl.lookup.name},{key:s.DgControl["combo-list"].type,value:s.DgControl["combo-list"].name},{key:s.DgControl["radio-group"].type,value:s.DgControl["radio-group"].name}]});let S=v;var P=(f=>(f.Form="Form",f.Variable="Variable",f))(P||{});class Q{constructor(){A(this,"label","");A(this,"id","");A(this,"columnInSM",12);A(this,"columnInMD",6);A(this,"columnInLG",3);A(this,"columnInEL",2);A(this,"displayWidthInSM",1);A(this,"displayWidthInMD",1);A(this,"displayWidthInLG",1);A(this,"displayWidthInEL",1);A(this,"displayColumnCountAtBreakPoint","md");A(this,"tagRow",0);A(this,"showTopBorder",0);A(this,"group",1);A(this,"isSupportedClass",!0);A(this,"fieldSetId","")}}function G(f){let o,e;const t=new Map;let i=[];function n(c,a){const g=c.split(" ").filter(F=>F.startsWith("col-"));if(g.length===0){a.isSupportedClass=!1;return}let p=g.find(F=>/^col-([1-9]|10|11|12)$/.test(F)),y=g.find(F=>/^col-md-([1-9]|10|11|12)$/.test(F)),C=g.find(F=>/^col-xl-([1-9]|10|11|12)$/.test(F)),I=g.find(F=>/^col-el-([1-9]|10|11|12)$/.test(F));p=p||"col-12",a.columnInSM=parseInt(p.replace("col-",""),10),a.displayWidthInSM=a.columnInSM/12,a.displayWidthInSM!==1&&(a.isSupportedClass=!1),y=y||"col-md-"+a.columnInSM,a.columnInMD=parseInt(y.replace("col-md-",""),10),a.displayWidthInMD=a.columnInMD/6,[1,2].includes(a.displayWidthInMD)||(a.isSupportedClass=!1),C=C||"col-xl-"+a.columnInMD,a.columnInLG=parseInt(C.replace("col-xl-",""),10),a.displayWidthInLG=a.columnInLG/3,[1,2,3,4].includes(a.displayWidthInLG)||(a.isSupportedClass=!1),I=I||"col-el-"+a.columnInLG,a.columnInEL=parseInt(I.replace("col-el-",""),10),a.displayWidthInEL=a.columnInEL/2,[1,2,3,4,5,6].includes(a.displayWidthInEL)||(a.isSupportedClass=!1)}function r(c,a,m,g=!1){let p=!1;c.contents.forEach(y=>{if(y.type==="fieldset"){m+=1,r(y,a,m,!0),p=!0;return}p&&(m+=1,p=!1);const C=y.appearance&&y.appearance.class,I=new Q;C?n(C,I):I.isSupportedClass=!1,I.label=y.label||y.id,I.id=y.id,I.group=m,g&&(I.fieldSetId=c.id),e===y.id&&(o=m),t.set(y.id,y),a.push(I)})}function d(c){const a=f.getComponentById(c);if(!a||!a.componentType||!a.componentType.startsWith("form"))return{result:!1,message:"只可以在响应式表单组件中调整响应式布局配置"};const m=f.selectNode(a,g=>g.type===s.DgControl["response-form"].type);return!m||!m.contents||m.contents.length===0?{result:!1,message:"Form区域内没有控件,请先添加控件"}:{result:!0,message:"",formNode:m}}function l(c,a){a=a||c.id;const{result:m,message:g,formNode:p}=d(a);if(!m)return{result:m,message:g};e=c.id,i=[],t.clear();const y=p.contents[0].type===s.DgControl.fieldset.type?0:1;r(p,i,y);const C=i.find(F=>!F.isSupportedClass);return{defaultState:{defaultGroupNumber:o||1,model:C?"customize":"standard"},importData:i}}function u(c,a){a=a;const{result:m,formNode:g}=d(a);if(!m)return"";const p=[];return c.forEach(y=>{var F;const C=t.get(y.id),I=C.appearance&&C.appearance.class;if(I){const T=I.split(" ").filter(_=>!_.startsWith("col-")),w="col-"+y.columnInSM,$="col-md-"+y.columnInMD,J="col-xl-"+y.columnInLG,X="col-el-"+y.columnInEL,Y=[w,$,J,X].concat(T);C.appearance.class=Y.join(" ")}if(y.fieldSetId){const B=g.contents.find(w=>w.id===y.fieldSetId),T=p.find(w=>w.id===y.fieldSetId);T?(F=T.contents)==null||F.push(C):(p.push(B),B.contents=[C])}else p.push(C)}),g.contents=p,g.id}return{checkCanFindFormNode:d,checkCanOpenLayoutEditor:l,changeFormControlsByResponseLayoutConfig:u,getResonseFormLayoutConfig:r}}class O extends W{constructor(e,t){super(e,t);A(this,"responseLayoutEditorFunction");A(this,"bindingVarible");A(this,"numberEditorOptions",{type:"number-spinner",useThousands:!1,keyboard:!1,showButton:!1});this.responseLayoutEditorFunction=G(this.formSchemaUtils)}getCommonPropertyConfig(e,t,i="Card"){this.propertyConfig.categories.basic=this.getBasicProperties(e,t,i),this.propertyConfig.categories.appearance=this.getAppearanceProperties(e,t),this.propertyConfig.categories.behavior=this.getBehaviorConfig(e,"form-group")}getPropertyConfig(e,t){return this.getCommonPropertyConfig(e,t,"Card"),this.propertyConfig.categories.editor=this.getEditorProperties(e),this.propertyConfig.categories.expressions=this.getExpressionConfig(e,"Field"),this.propertyConfig.categories.eventsEditor=this.getEventPropertyConfig(e),this.propertyConfig}getGridFieldEdtiorPropConfig(e,t){return this.propertyConfig.categories={},this.getCommonPropertyConfig(e,t,"Grid"),this.getGridFieldEdtiorProperties?this.propertyConfig.categories.editor=this.getGridFieldEdtiorProperties(e):this.propertyConfig.categories.editor=this.getEditorProperties(e),this.propertyConfig.categories.expressons=this.getExpressionConfig(e,"Field"),this.propertyConfig.categories}getBasicProperties(e,t,i="Card"){var u;const n=this;this.setDesignViewModelField(e);const{canChangeControlType:r,editorTypeList:d}=this.getAvailableEditorType(e),l={description:"Basic Information",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"编辑器类型",title:"编辑器类型",type:"string",$converter:"/converter/change-editor.converter",parentPropertyID:"editor",editor:{type:"combo-list",textField:"value",valueField:"key",idField:"key",editable:!1,data:d,readonly:!r}},label:{title:"标签",type:"string",$converter:"/converter/form-group-label.converter"},showLabelType:{description:"标签显示方式:1、显示:显示标签 2、占位:保留标签空间,但不显示文本 3、不显示:不显示标签",title:"标签显示",type:"enum",editor:{data:[{id:"visible",name:"显示"},{id:"reserve-space",name:"占位"},{id:"none",name:"不显示"}]},defaultValue:((u=e.editor)==null?void 0:u.type)==="image"?"none":"visible"},binding:{description:"绑定的表单字段",title:"绑定",editor:{type:"binding-selector",bindingType:{enable:!1},editorParams:{componentSchema:e,needSyncToViewModel:!0,viewModelId:this.viewModelId,designerHostService:this.designerHostService,disableOccupiedFields:!0},textField:"bindingField"},refreshPanelAfterChanged:!0,readonly:this.formSchemaUtils.designerMode==="PC_RTC"&&!e.isRtcControl}},setPropertyRelates(c,a,m){if(c)switch(c&&c.propertyID){case"type":{n.changeControlType(e,c,t);break}case"label":{c.needRefreshControlTree=!0;break}case"binding":{n.changeBindingField(e,c,m);break}}}};return i.toLocaleLowerCase()!=="card"&&delete l.properties.showLabelType,l}checkCanChangeControlType(e,t){if(!e.binding)return!1;if(e.binding.type==="Variable"){if(this.bindingVarible=this.formSchemaUtils.getVariableById(e.binding.field),!this.bindingVarible)return!1}else if(!this.designViewModelField||this.designViewModelField.$type!==x.FormSchemaEntityField$Type.SimpleField)return!1;return!0}getAvailableEditorType(e){var n,r;const t=this.checkCanChangeControlType(e,this.viewModelId);if(!t)return{canChangeControlType:!1,editorTypeList:[{key:e.editor.type,value:((n=s.DgControl[e.editor.type])==null?void 0:n.name)||e.editor.type}]};let i=[];return this.designViewModelField&&this.designViewModelField.$type===x.FormSchemaEntityField$Type.SimpleField?i=S.getEditorTypesByMDataType(this.designViewModelField.type.name,this.designViewModelField.multiLanguage):this.bindingVarible&&(i=S.getEditorTypesByMDataType(this.bindingVarible.type,!!((r=this.designViewModelField)!=null&&r.multiLanguage))),{canChangeControlType:t,editorTypeList:i}}changeBindingField(e,t,i){t.needRefreshEntityTree=!0}getAppearanceProperties(e,t){const i=this;return{title:"外观",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"},style:{title:"style样式",type:"string",description:"组件的内联样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"},fill:{title:"填充宽度",description:"启用后,控件占满父容器宽度",type:"boolean",parentPropertyID:"appearance"},responseLayout:{description:"响应式列宽",title:"响应式列宽",type:"boolean",visible:!0,refreshPanelAfterChanged:!0,editor:{type:"response-layout-editor-setting",beforeOpen:()=>i.responseLayoutEditorFunction.checkCanOpenLayoutEditor(e,i.componentId)}}},setPropertyRelates(n,r){if(n)switch(n&&n.propertyID){case"responseLayout":i.responseLayoutEditorFunction.changeFormControlsByResponseLayoutConfig(n.propertyValue,i.componentId||e.id),i.updateUnifiedLayoutAfterResponseLayoutChanged(i.componentId),i.updateElementByParentContainer(e.id,t),delete e.responseLayout;break;case"class":i.updateUnifiedLayoutAfterControlChanged(n.propertyValue,e.id,this.componentId),s.canvasChanged.value++;break;case"style":{s.canvasChanged.value++;break}}}}}getEditorProperties(e){return this.getComponentConfig(e)}changeControlType(e,t,i){const n=t.propertyValue,r=i&&i.parent&&i.parent.schema;if(!r)return;const d=r.contents.findIndex(c=>c.id===e.id);if(d===-1)return;const l=r.contents[d];let u;if(this.designViewModelField){const m=this.formSchemaUtils.getViewModelById(this.viewModelId).fields.find(p=>p.id===this.designViewModelField.id).fieldSchema||{};m.editor||(m.editor={}),m.editor.$type=n,this.designViewModelUtils.getDgViewModel(this.viewModelId).changeField(this.designViewModelField.id,m,!1),u=this.controlCreatorUtils.setFormFieldProperty(this.designViewModelField,n)}u||(u=this.controlCreatorUtils.createFormGroupWithoutField(n)),Object.assign(u,{id:l.id,appearance:l.appearance,size:l.size,label:l.label,binding:l.binding}),Object.prototype.hasOwnProperty.call(l,"visible")&&Object.assign(u,{visible:l.visible}),l.editor&&["readonly","required","placeholder"].map(c=>{Object.prototype.hasOwnProperty.call(l.editor,c)&&(u.editor[c]=l.editor[c])}),i!=null&&i.updateContextSchema?i.updateContextSchema(u):(i.schema=Object.assign(l,u),Object.assign(e,u)),Array.from(document.getElementsByClassName("dgComponentSelected")).forEach(c=>c.classList.remove("dgComponentSelected")),Array.from(document.getElementsByClassName("dgComponentFocused")).forEach(c=>c.classList.remove("dgComponentFocused")),s.canvasChanged.value++,h.nextTick(()=>{this.getFormDesignerInstance().reloadPropertyPanel()})}getComponentConfig(e,t={},i={},n){var m,g;const r=Object.assign({description:"编辑器",title:"编辑器",type:"input-group",$converter:"/converter/property-editor.converter",parentPropertyID:"editor"},t),d=(m=e.binding)!=null&&m.field?[]:["Const","Variable","StateMachine"],l=this.getPropertyEditorParams(e,d,"readonly"),u=this.getPropertyEditorParams(e,d,"required"),c={readonly:{description:"",title:"只读",editor:l},required:{description:"",title:"必填",type:"boolean",editor:u,visible:!!((g=e.binding)!=null&&g.field)},placeholder:{description:"当控件没有值时在输入框中显示的文本",title:"提示文本",type:"string"}};for(const p in i)c[p]=Object.assign(c[p]||{},i[p]);const a=this;return{...r,properties:{...c},setPropertyRelates(p,y){if(p){switch(p.propertyID){case"readonly":case"required":a.afterMutilEditorChanged(e,p);break}n&&n.bind(a)(p,e,y)}}}}updateUnifiedLayoutAfterControlChanged(e,t,i){const n=e.split(" ");let r=n.find(a=>/^col-([1-9]|10|11|12)$/.test(a)),d=n.find(a=>/^col-md-([1-9]|10|11|12)$/.test(a)),l=n.find(a=>/^col-xl-([1-9]|10|11|12)$/.test(a)),u=n.find(a=>/^col-el-([1-9]|10|11|12)$/.test(a));r=r||"col-12",d=d||"col-md-"+r.replace("col-",""),l=l||"col-xl-"+d.replace("col-md-",""),u=u||"col-el-"+l.replace("col-xl-","");const c={id:t,columnInSM:parseInt(r.replace("col-",""),10),columnInMD:parseInt(d.replace("col-md-",""),10),columnInLG:parseInt(l.replace("col-xl-",""),10),columnInEL:parseInt(u.replace("col-el-",""),10)};this.updateUnifiedLayoutAfterResponseLayoutChanged(i,c)}updateUnifiedLayoutAfterResponseLayoutChanged(e,t){const{formNode:i}=this.responseLayoutEditorFunction.checkCanFindFormNode(e);if(!i||!i.unifiedLayout)return;const n=[];if(this.responseLayoutEditorFunction.getResonseFormLayoutConfig(i,n,1),t){const p=n.find(y=>y.id===t.id);Object.assign(p||{},t)}const r=n.map(p=>p.columnInSM),d=n.map(p=>p.columnInMD),l=n.map(p=>p.columnInLG),u=n.map(p=>p.columnInEL),c=this.checkIsUniqueColumn(r)?r[0]:null,a=this.checkIsUniqueColumn(d)?d[0]:null,m=this.checkIsUniqueColumn(l)?l[0]:null,g=this.checkIsUniqueColumn(u)?u[0]:null;Object.assign(i.unifiedLayout,{uniqueColClassInSM:c,uniqueColClassInMD:a,uniqueColClassInLG:m,uniqueColClassInEL:g})}checkIsUniqueColumn(e){const t=new Set(e);return Array.from(t).length===1}getItemCollectionEditor(e,t,i){return t=t||"value",i=i||"name",{editor:{columns:[{field:t,title:"值",dataType:"string"},{field:i,title:"名称",dataType:"string"}],type:"item-collection-editor",valueField:t,nameField:i,requiredFields:[t,i],uniqueFields:[t,i],readonly:this.checkEnumDataReadonly(e)}}}checkEnumDataReadonly(e){return!e.binding||e.binding.type!=="Form"?!1:!!(this.designViewModelField&&this.designViewModelField.type&&this.designViewModelField.type.$type===x.FormSchemaEntityFieldType$Type.EnumType)}appendFieldValueChangeEvents(e,t){e.binding&&e.binding.type===P.Form&&e.binding.field?(t.find(i=>i.label==="fieldValueChanging"),t.find(i=>i.label==="fieldValueChanged"),this.designViewModelField&&(e.fieldValueChanging=this.designViewModelField.valueChanging,e.fieldValueChanged=this.designViewModelField.valueChanged)):t=t.filter(i=>i.label!=="fieldValueChanging"&&i.label!=="fieldValueChanged")}getControlMethodType(e){if(!e.binding)return e.type;switch(e.binding.type){case P.Form:return e.binding.path||e.type;case P.Variable:return e.binding.fullPath||e.type}return e.type}getEventPropertyConfig(e,t="card",i,n){const r=this;let d=[];if(i&&(d=d.concat(i)),d.length===0)return{title:"事件",hideTitle:!0,properties:{},tabId:"commands",tabName:"交互",hide:!0};this.appendFieldValueChangeEvents(e,d);const l=r.eventsEditorUtils.formProperties(e,r.viewModelId,d);return{title:"事件",hideTitle:!0,properties:r.createBaseEventProperty(l),tabId:"commands",tabName:"交互",setPropertyRelates(a,m){const g=a.propertyValue;delete e[r.viewModelId],g&&(g.setPropertyRelates=this.setPropertyRelates,g.controlInfo={type:r.getControlMethodType(e),name:e.title},r.eventsEditorUtils.saveRelatedParameters(e,r.viewModelId,g.events,g)),n&&n(a,m,g);const p=r.designViewModelUtils.getDgViewModel(r.viewModelId);p&&r.designViewModelField&&p.changeField(r.designViewModelField.id,{valueChanging:e.fieldValueChanging,valueChanged:e.fieldValueChanged})}}}getExpressionConfig(e,t,i=["compute","dependency","validate"],n){return new N(this.formSchemaUtils).getExpressionConfig(e,t,i,n)}getBindingDataType(){return this.designViewModelField?this.designViewModelField.type.name==="Number"?"number":this.designViewModelField.type.name==="String"?"string":"boolean":"boolean"}getEditor(){return this.getBindingDataType()==="number"?this.numberEditorOptions:{}}updatePropertyValue(e,t,i){var n;e.editor[t]!==i?e.editor[t]=i:(n=this.getFormDesignerInstance())==null||n.reloadPropertyPanel()}setBooleanValue(e,t,i){let n=i;this.getBindingDataType()==="string"&&(n=(n||"").trim()||(t==="trueValue"?"true":"false"));const d=t==="trueValue"?"falseValue":"trueValue";e.editor[d]===n&&(n=n+1),this.updatePropertyValue(e,t,n)}getBooleanValueConverter(){return{convertFrom:(e,t)=>e.editor[t],convertTo:(e,t,i)=>{this.setBooleanValue(e,t,i)}}}}class j extends O{constructor(o,e){super(o,e)}getEditorProperties(o){return{description:"编辑器",title:"编辑器",type:"avatar",$converter:"/converter/property-editor.converter",parentPropertyID:"editor",properties:{readonly:{description:"",title:"只读",type:"boolean"},avatarWidth:{description:"",title:"头像宽度",type:"number"},avatarHeight:{description:"",title:"头像高度",type:"number"},cover:{description:"",title:"封面",type:"string"}}}}}function K(f,o){const e=f.schema;function t(i,n){return new j(i,o).getPropertyConfig(e,n)}return{getPropsConfig:t}}const Z=h.defineComponent({name:"FAvatarDesign",props:M,emits:["change","update:modelValue"],setup(f,o){const e=h.ref(),t=h.inject("designer-host-service"),i=h.inject("design-item-context"),n=K(i,t),r=s.useDesignerComponent(e,i,n);h.onMounted(()=>{e.value.componentInstance=r}),o.expose(r.value);const d=h.computed(()=>({"f-avatar":!0,"f-avatar-readonly":f.readonly,"f-avatar-circle":f.shape==="circle","f-avatar-square":f.shape==="square"})),l=h.ref(f.modelValue),u=h.computed(()=>({width:f.avatarWidth+"px",height:f.avatarHeight+"px"})),c=!1;function a(){return""}function m(){}const g=h.ref(null),{acceptTypes:p,imageSource:y,onClickImage:C}=D(f,o,g,l);return()=>h.createVNode("div",{ref:e,class:d.value,style:u.value,onClick:C},[c,h.createVNode("img",{title:f.title,class:"f-avatar-image",src:y.value,onError:a},null),!f.readonly&&h.createVNode("div",{class:"f-avatar-icon"},[h.createVNode("span",{class:"f-icon f-icon-camera"},null)]),h.createVNode("input",{ref:"file",name:"file-input",type:"file",class:"f-avatar-upload",accept:p.value,onChange:m,style:"display: none;"},null)])}});V.register=(f,o,e,t)=>{f.avatar=V,o.avatar=k},V.registerDesigner=(f,o,e)=>{f.avatar=Z,o.avatar=k};const z=x.withInstall(V);b.FAvatar=V,b.avatarProps=M,b.default=z,b.propsResolver=k,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(C,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("vue"),require("../dynamic-resolver/index.umd.js"),require("../locale/index.umd.js"),require("../designer-canvas/index.umd.js"),require("lodash-es"),require("../common/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../dynamic-resolver/index.umd.js","../locale/index.umd.js","../designer-canvas/index.umd.js","lodash-es","../common/index.umd.js"],y):(C=typeof globalThis<"u"?globalThis:C||self,y(C.avatar={},C.Vue,C.dynamicResolver,null,C.designerCanvas,C.LodashES,C.common))})(this,function(C,y,E,ie,s,R,x){"use strict";var ee=Object.defineProperty;var te=(C,y,E)=>y in C?ee(C,y,{enumerable:!0,configurable:!0,writable:!0,value:E}):C[y]=E;var A=(C,y,E)=>te(C,typeof y!="symbol"?y+"":y,E);function q(f,o,e){return o}const L=new Map([["appearance",E.resolveAppearance]]),H={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/avatar.schema.json",title:"avatar",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for avatar",type:"string"},type:{description:"The type string of avatar",type:"string",default:"avatar"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disabled:{type:"boolean",default:!1},avatarWidth:{description:"",type:"number",default:100},avatarHeight:{description:"",type:"number",default:100},readonly:{description:"",type:"boolean",default:!1},cover:{description:"",type:"string",default:""},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0}},required:["id","type"],ignore:["id","appearance","binding","visible"]},M={avatarWidth:{type:Number,default:100},avatarHeight:{type:Number,default:100},cover:{type:String},readonly:{type:Boolean,default:!1},shape:{type:String,default:"circle"},maxSize:{type:Number,default:1},modelValue:{type:String,default:""},title:{type:String,default:""},imageType:{type:Array,default:["jpeg"]}},k=E.createPropsResolver(M,H,L,q);function D(f,o,e,t){const i="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAAwICQoJBwwKCQoNDAwOER0TERAQESMZGxUdKiUsKyklKCguNEI4LjE/MigoOk46P0RHSktKLTdRV1FIVkJJSkf/2wBDAQwNDREPESITEyJHMCgwR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0f/wAARCAEsASwDASIAAhEBAxEB/8QAGgABAQEBAQEBAAAAAAAAAAAAAAECAwQFB//EADMQAQEAAQEECAQGAgMBAAAAAAABAhEDITFBBBRRUmFxgaESkcHwEyIysdHhM3IjQvE0/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAH/xAAXEQEBAQEAAAAAAAAAAAAAAAAAEQEh/9oADAMBAAIRAxEAPwD9BBYqCiyAGhougIqyGgEhIui6AyuixdATQ0WQA0BdA4houhoCaGgugMrouhoCaJoum80BNDRdDQGTRbEBNCxdDQGTRUBE0asQGRTQGTT71WxNPP5AugqyACyAC6dpIsgGgshoBISKAiroQDQ0OSyAgoBoaABoaABomigJTRQGV0XRATRGizUGRSwGdEsaqAljLQDOiNWJQZNJ4KffEFIRYAsFkAkFkAJFFkAkNCLIAAAC6AguhoCCl3TW2TzugIHx4S788Z6wmWN4ZY3ysoA1pu+qAgpYCAAaIoDIoCaJZvVAQ03LUBlGqWAzYmimn3vAaRYA1IkWASKKACgirIgAsgBoBdJNbZNN9t3aeIHNw2vSccbZhPxLN27dJ68/Rx222u1/LjbNn8vi/ieHPm58N03SKN5bfa58c7jOzHd78XOyXfd98bqoCaScp8jSdk+SgLjlljdccssfK12w6TlN2cmXjN1/iuAD34Z47Sa43XTjLus82nz5bjl8WNss4WPXsNtNpNLuzk3zlZ2wHUsBBF5CAFgAhouiUGRUBErSAyffFamgKqKCqkUBYcgBpADiuhoAKeYA8fStp8WX4WPCfq8b2eT1bXObPZZZ8bJrJ23lHz5rpvutu+3tvOqAAAAAAAACy3HKZY3Sy6yoA+hs85tMJlN2vGdlaeTomem0+C/9pu849SAKlARQERrkgJUWoCUVKDIqb/ugqxFBVRQFFBFABRAUAHn6bl+XDGc7bfT/ANeV26XddvJ2Yz3tcVAAAAAAAAAAFxy+HKZTjLq+l+z5j6Gzuuywt54z9jRoEQAARSoCCoCIqAIJQaCLzBZxCAKC8wIAChOIAADxdL/+i/6z6uTt0yabfXtxnta4qAAAAAAAAAAD37H/AAbP/WPBwfQ2c02WE7MYaNAIIoAhzCggHMEqaNIDNPviHoAsRqcAFSKC8iIoHNUAUAAAHl6ZPzbPLtln1ed7el467DXu2X0+68SgAAAAAAAAABpru7bo+npy7Po8HR8fi2+M46XW+Ue4ABAAAQAQUvAEvBL6BQS8U3feqpv7fcFnBUUBUUBScQFRUBQAAATKTLG43nLL6vnaWWy8ZdL5x9J4ulY/DtrZwymvrzUcgAAAAAAAANdwPT0LH9Wd8MZ+9elnY4fh7HHG8prfOtIAABQAQAKi1AE5KlBD09hPl7gKjUAVFBeYTiAqKgKAAAA5dKw+PY2ya5Y/mn19nVQfMG9th+HtbjOF3zyrCgAAAAAA6dHw+PbSWfln5r6Ob29Gw+DZS2fmy33y5T6g7cbreaAgAAAAgqAcgqfIBOapQSnr7lPS/IEaScAFVFgKIoKioCgAABgADj0nZ/HstZvyx3zxnN4+T6b52ePw7TLGcJbIoyAAAAADex2f4m1mN1+Gb75Tl9H0PbweboeOmGWXO3T0n/r0AAIAAAACKgHJFpyBEpyARFT74gKnNQVeaRQF5IoKTiigCKAAACZWY4/FlZMZxt3SAvnuna+dnlM8885wyts8nXb9I/Elw2e7G7rleN8J4ePNxUAAAAAAeroeUuFx7LrPKvQ+djlcMpljdLHs2W3x2k0/Tl2W8fLtB1C8ewQAAEUBDmt4oBeJeCAIUARFvBN3gByVAFUIChzWcAOSpGdpnjs5rnlMdeHbfKcwb58x5c+l23TZ7P1y3e0+rldvtcuO0snZjJFHvtmM1ysnjbpHHLpOyx3TK5eGM1eKyW63W3tt1UHfPpeV3YYTGduW+/JwyuWd1zyuVnDXhPKcgAAAAAAAAAAB0w2+0w3TKZTsy3+7tj0vG/rxyxvbN8eUB9DDa7PP9OeNvZrpfdu8OD5mkvGNY55Y/pzyx8ruIPePJj0nazj8OU8ZpfZ1w6Ts8rJlrhfHfPmg7FKgAF4AgVARPW/NanoAsZaBVlZUFVF4g57fbfhY7pLld0l/e+EeO23K5ZW5ZXjb97o1tcvj22WXHS/DPKMqAAAAAAAAAAAAAAAAAAAAAAOux212d0ttwvGdnjHr3ceMfPevo2XxbLTu3T0B1TmHJAZVOYF4p98xPviBFScQGlRZxBdS3TG3slvsibS/8WX+t/YHhx/TPGaqk4TyVQAAAAAAAAAAAAAAAAAAAAAAd+iX82c7ZL9/Nwdui/5b/rfoD00vARAQqAhfvcVNfL3A1WMqDSxmVQVNr/iz4/pv7LDOXLDLGcbNPDeDxTh6DtOjZaafFju816tlf+2Puo4Dv1bPvY+51bLvY+5RwHfq2Xex9zquXex9yjgO/Vcu9j7nVc+9j7lHAd+q597H3Oq597H3BwHfqufex9zqufex9yjgO/Vc+9j7nVc+9j7lHAd+q597H3Oq597H3KOA79Vz72PudVz72PuUcB36rl3sfc6rn3sfco4DvejZd7H3OrZd7H3KOA79Wy72PudWz72PuDg7dG/y3/W/Q6tl3sfdvY7K7PO25S6yzSdoOqWlEBmhaBamt+6J6AnmqaqDQy0CxYyoNCKC6m/VAGhPJdQBOSgKi6+QGu41QBRAF1LUABbUABNdAVOYUC0tE13gIWloCcTXeloFQLQTmffMtT74gixOa6gqysrzBVSVQVdWdQGpRNV1BV10SUlBYIvIF1E1Ne0F5iAKIAohaCmqWgBaapqC2ohqC6pqWoC2paa70tAqCACACa+F+RanyAWJ/a8vkAuqT6fVf7AVOz0X+AXVYh2egNSifx9T+wVWefyX+PqCyrqn807PQFEn0+p/YKH9H37gAc/kC6onL0P5BRP6OV8vqC2of2l/gAOSAuqan9J/AKmon9AUtL9PqnP1oCWl5ehfv5gh635nP1qWg//Z",n=y.ref(f.readonly);function r(g){return g.match(/\.(jpeg|jpg|gif|png|svg|bmp|webp)$/)!=null}function c(g){return g.indexOf("data:image/")>-1}function l(g){return"data:image/jpeg;base64,"+g}const u=y.computed(()=>{var p;if(!f.imageType||!f.imageType.length)return"";const g=(p=f.imageType)==null?void 0:p.map(h=>(h==="jpg"&&(h="jpeg"),`image/${h}`));return!g||!g.length?"image/*":g.join(",")}),d=y.computed(()=>{const g=t.value||f.cover||i;return r(g)||c(g)?g:l(g)}),a=y.computed(()=>n.value?"":f.title);function m(){n.value||e&&e.value&&e.value.click()}return{acceptTypes:u,imageSource:d,imageTitle:a,onClickImage:m}}const V=y.defineComponent({name:"FAvatar",props:M,emits:["change","update:modelValue"],setup(f,o){const e=y.computed(()=>({"f-avatar":!0,"f-avatar-readonly":f.readonly,"f-avatar-circle":f.shape==="circle","f-avatar-square":f.shape==="square"})),t=y.ref(f.modelValue),i=y.computed(()=>({width:f.avatarWidth+"px",height:f.avatarHeight+"px"})),n=!1;function r(){return""}function c(){}const l=y.ref(null),{acceptTypes:u,imageSource:d,onClickImage:a}=D(f,o,l,t);return()=>y.createVNode("div",{class:e.value,style:i.value,onClick:a},[n,y.createVNode("img",{title:f.title,class:"f-avatar-image",src:d.value,onError:r},null),!f.readonly&&y.createVNode("div",{class:"f-avatar-icon"},[y.createVNode("span",{class:"f-icon f-icon-camera"},null)]),y.createVNode("input",{ref:"file",name:"file-input",type:"file",class:"f-avatar-upload",accept:u.value,onChange:c,style:"display: none;"},null)])}});function W(f){const{formSchemaUtils:o,formStateMachineUtils:e}=f;function t(l,u=""){return{path:u+l.code,field:l.id,fullPath:l.code}}function i(l,u=""){const d=o.getViewModelById(l);return d?d.states.map(a=>t(a,u)):[]}function n(l){const u=o.getRootViewModelId(),d=i(l);if(l===u)return d;const a=i(u,"root-component.");return[...d,...a]}function r(l){return l.binding&&l.binding.path||l.id||""}function c(){return e&&e.getRenderStates()||[]}return{getVariables:n,getControlName:r,getStateMachines:c}}class N{constructor(o){A(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'"}]);A(this,"expressionNames",{compute:"计算表达式",dependency:"依赖表达式",validate:"验证表达式",dataPicking:"帮助前表达式",visible:"可见表达式",readonly:"只读表达式",required:"必填表达式"});A(this,"getExpressionConverter",(o,e)=>({convertFrom:(t,i,n,r)=>{const c=n.getExpressionRuleValue(o,e||i);return c&&c.value||""},convertTo:(t,i,n,r,c)=>{var l;if(i==="dataPicking"&&(n!=null&&n.target)){const u=`${n.target}_dataPicking`;((l=n.rules)==null?void 0:l.some(a=>a.id===u&&a.value))?t.dictPickingExpressionId=u:delete t.dictPickingExpressionId}r.updateExpression(n)}}));this.formSchemaService=o}getExpressionRule(o,e){const t=this.formSchemaService.getExpressions();if(!t)return"";const i=t.find(r=>r.target===o);if(!i)return"";const n=i.rules.find(r=>r.type===e);return n||""}getContextFormVariables(){const{module:o}=this.formSchemaService.getFormSchema();if(!o.viewmodels||o.viewmodels.length===0)return[];const e=this.formSchemaService.getRootViewModelId(),t=this.formSchemaService.getViewModelById(e);if(!t||!t.states||t.states.length===0)return[];const i=[];return t.states.filter(n=>n.category==="remote").forEach(n=>{i.push({key:n.code,name:n.name,description:n.name,category:n.category})}),i}createTreeNode(o,e,t="label"){return{id:o.id,name:o.name,bindingPath:o[t],parents:e,type:"field"}}buildEntityFieldsTreeData(o=null,e){const t=[];return o==null||o.forEach(i=>{var c;const n=this.createTreeNode(i,e);let r=[];(c=i.type)!=null&&c.fields&&(r=this.buildEntityFieldsTreeData(i.type.fields,[...e,i.label])),t.push({data:n,children:r,expanded:!0})}),t}buildChildEntityTreeData(o=null,e){const t=[];return o==null||o.forEach(i=>{var l,u;const n=this.createTreeNode(i,e);n.type="entity";const r=this.buildEntityFieldsTreeData((l=i.type)==null?void 0:l.fields,[...e,i.label]),c=this.buildChildEntityTreeData((u=i.type)==null?void 0:u.entities,[...e,i.label]);c!=null&&c.length&&(r==null||r.push(...c)),t.push({data:n,children:r||[],expanded:!0})}),t}getEntitiesTreeData(){const o=this.formSchemaService.getSchemaEntities();if(!(o!=null&&o.length))return[];const e=o[0];if(!(e!=null&&e.type))return[];const t=this.buildEntityFieldsTreeData(e.type.fields,[e.code]),i=this.buildChildEntityTreeData(e.type.entities,[e.code]);return i!=null&&i.length&&(t==null||t.push(...i)),{entityCode:e.code,fields:[{data:this.createTreeNode(e,[],"code"),children:t||[]}]}}getEntitiesAndVariables(){return{entities:this.getEntitiesTreeData(),variables:{session:{name:"系统变量",items:this.sessionVariables,visible:!1},forms:{name:"表单变量",items:this.getContextFormVariables(),visible:!0}}}}onBeforeOpenExpression(o,e,t){const i=t==="Field"?o.binding.field:o.id,n=this.getExpressionRule(i,e),r=this.getEntitiesAndVariables(),c={message:["validate","required","dataPicking"].includes(e)&&n?n.message:"",...r};return n.messageType!=null&&(c.messageType=n.messageType),c}buildRule(o,e,t,i){const{expression:n,message:r,messageType:c}=e,l={id:`${o}_${t}`,type:t,value:n};return(t==="validate"||t==="dataPicking"||t==="required")&&(l.message=r),t==="dataPicking"&&(l.messageType=c),t==="validate"&&i&&(l.elementId=i),l}getExpressionData(){const{expressions:o}=this.formSchemaService.getFormSchema().module;return o||[]}updateExpression(o,e,t,i){const n=e==="Field"?o.binding.field:o.id,r=this.buildRule(n,t,i,o.type==="form-group"?o.id:"");let l=this.getExpressionData().find(d=>d.targetType===e&&d.target===n);const u=d=>d.value.trim()==="";if(l){const d=l.rules.find(a=>a.id===r.id);if(d)u(r)?l.rules=l.rules.filter(a=>a.id!==r.id):(Object.assign(d,r),i==="validate"&&o.type==="form-group"&&(d.elementId=o.id));else{if(u(r))return null;l.rules=l.rules||[],l.rules.push(r)}}else{if(u(r))return null;l={target:`${n}`,rules:[r],targetType:e}}return l}getExpressionEditorOptions(o,e,t,i){return t.reduce((n,r)=>{var l,u;const c=e==="Field"?(l=o==null?void 0:o.binding)==null?void 0:l.field:o.id;return n[r]={hide:e==="Field"?!!((u=o==null?void 0:o.binding)!=null&&u.field):!1,description:"",title:this.expressionNames[r],type:"string",$converter:this.getExpressionConverter(c),refreshPanelAfterChanged:!0,editor:{type:"expression-editor",singleExpand:!1,dialogTitle:`${this.expressionNames[r]}编辑器`,showMessage:r==="validate"||r==="dataPicking"||r==="required",showMessageType:r==="dataPicking",beforeOpen:()=>this.onBeforeOpenExpression(o,r,e),onSubmitModal:d=>{const a=this.updateExpression(o,e,d,r);if(i){const m=this.buildRule(c,d,r);i(m)}return a}}},n},{})}getExpressionInfo(o,e,t){const i=e==="Field"?o.binding.field:o.id,n=this.getExpressionRule(i,t),r={value:n&&n.value,targetId:i,targetType:e,expressionType:t};return n&&n.message&&(r.message=n.message),r}getExpressionConfig(o,e,t=["compute","dependency","validate"],i){return{description:"表达式",title:"表达式",hide:!o.binding,properties:{...this.getExpressionEditorOptions(o,e,t,i)}}}getExpressionOptions(o,e,t){const i=this.getExpressionInfo(o,e,t);return{dialogTitle:`${this.expressionNames[t]}编辑器`,singleExpand:!1,showMessage:t==="required",beforeOpen:()=>this.onBeforeOpenExpression(o,t,e),expressionInfo:i}}}class Q{constructor(o,e){A(this,"componentId");A(this,"viewModelId");A(this,"eventsEditorUtils");A(this,"formSchemaUtils");A(this,"formMetadataConverter");A(this,"designViewModelUtils");A(this,"designViewModelField");A(this,"controlCreatorUtils");A(this,"designerHostService");A(this,"designerContext");A(this,"schemaService",null);A(this,"metadataService",null);A(this,"propertyConfig",{type:"object",categories:{}});var t;this.componentId=o,this.designerHostService=e,this.eventsEditorUtils=e.eventsEditorUtils,this.formSchemaUtils=e.formSchemaUtils,this.formMetadataConverter=e.formMetadataConverter,this.viewModelId=((t=this.formSchemaUtils)==null?void 0:t.getViewModelIdByComponentId(o))||"",this.designViewModelUtils=e.designViewModelUtils,this.controlCreatorUtils=e.controlCreatorUtils,this.metadataService=e.metadataService,this.schemaService=e.schemaService,this.designerContext=e.designerContext}getFormDesignerInstance(){var o,e;return(e=(o=this.designerContext)==null?void 0:o.instances)==null?void 0:e.formDesigner.value}getTableInfo(){var o;return(o=this.schemaService)==null?void 0:o.getTableInfoByViewModelId(this.viewModelId)}setDesignViewModelField(o){var t;const e=o.binding&&o.binding.type==="Form"&&o.binding.field;if(e){if(!this.designViewModelField){const i=this.designViewModelUtils.getDgViewModel(this.viewModelId);this.designViewModelField=i.fields.find(n=>n.id===e)}o.updateOn=(t=this.designViewModelField)==null?void 0:t.updateOn}}getBasicPropConfig(o){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:o.type,name:s.DgControl[o.type]&&s.DgControl[o.type].name}]}}}}}getAppearanceConfig(o=null,e={},t){const i={title:"外观",description:"Appearance"},n={class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"}};for(const r in e)n[r]=Object.assign(n[r]||{},e[r]);return{...i,properties:{...n},setPropertyRelates(r,c){if(r){switch(r&&r.propertyID){case"class":case"style":{s.canvasChanged.value++;break}}t&&t(r,o,c)}}}}getPropertyEditorParams(o,e=[],t="visible",i={},n={},r=""){const{getVariables:c,getControlName:l,getStateMachines:u}=W(this.designerHostService),d=this.getRealTargetType(o),a=e&&e.length>0?e:["Const","Variable","StateMachine","Expression"],m={type:"property-editor",propertyTypes:a};return a.map(g=>{switch(g){case"Const":Object.assign(m,{constType:"enum",constEnums:[{id:!0,name:"是"},{id:!1,name:"否"}]},i);break;case"Expression":m.expressionConfig=this.getExpressionOptions(o,d,r||t);break;case"StateMachine":m.stateMachines=u();break;case"Variable":Object.assign(m,{controlName:l(o),newVariablePrefix:"is",newVariableType:"Boolean",variables:c(this.viewModelId),parentComponentId:this.componentId==="root-component"?"":"root-component",onBeforeOpenVariables:p=>{p.value=c(this.viewModelId)}},n),this.designerContext.designerMode==="PC_RTC"&&(m.newVariablePrefix="ext_"+m.newVariablePrefix);break}}),m}getVisibleProperty(o,e=""){var n;let t=["Const","Variable","StateMachine","Expression"];return e==="gridFieldEditor"?t=["Const","Expression"]:e==="form-group"&&!((n=o.binding)!=null&&n.field)&&(t=["Const","Variable","StateMachine"]),{visible:{title:"是否可见",type:"boolean",description:"运行时组件是否可见",editor:this.getPropertyEditorParams(o,t,"visible")}}}getBehaviorConfig(o,e="",t={},i){const n={title:"行为",description:""},r=this.getVisibleProperty(o,e);for(const l in t)r[l]=Object.assign(r[l]||{},t[l]);const c=this;return{...n,properties:{...r},setPropertyRelates(l,u){if(l){switch(l.propertyID){case"disabled":case"readonly":case"visible":c.afterMutilEditorChanged(o,l);break}i&&i(l,u)}}}}afterMutilEditorChanged(o,e){this.addNewVariableToViewModel(e,this.viewModelId),this.updateExpressionValue(e),this.clearExpression(e,o)}updateElementByParentContainer(o,e){const t=e&&e.parent&&e.parent.schema;if(!t)return;const i=t.contents.findIndex(r=>r.id===o),n=R.cloneDeep(t.contents[i]);t.contents.splice(i,1),t.contents.splice(i,0,n),s.refreshCanvas()}addNewVariableToViewModel(o,e){const t=o.propertyValue;if(!(t&&typeof t=="object")||!(t.type==="Variable"&&t.isNewVariable))return;const r={id:t.field,category:"locale",code:t.fullPath,name:t.fullPath,type:t.newVariableType||"String",isRtcVariable:this.designerContext.designerMode==="PC_RTC"?!0:void 0};delete t.newVariableType,delete t.isNewVariable,this.formSchemaUtils.getVariableByCode(r.code)||this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(r)}updateExpressionValue(o){const e=o.propertyValue;if(!((e&&e.type)==="Expression"&&e.expressionInfo))return;const{expressionId:n,expressionInfo:r}=e,{targetId:c,targetType:l,expressionType:u,value:d,message:a}=r,m=this.formSchemaUtils.getModule();m.expressions=m.expressions||[];const{expressions:g}=m;let p=g.find(b=>b.target===c);p||(p={target:c,rules:[],targetType:l},g.push(p));const h=p.rules.find(b=>b.type===u);if(h)h.value=d,h.message=a;else{const b={id:n,type:u,value:d,message:a};p.rules.push(b)}delete e.expressionInfo}clearExpression(o,e){const t=o.propertyValue;if(t&&t.type==="Expression")return;const n=o.propertyID,r=this.formSchemaUtils.getExpressions(),c=e.binding?e.binding.field:e.id,l=r.find(u=>u.target===c);!l||!l.rules||(l.rules=l.rules.filter(u=>u.type!==n))}getExpressionOptions(o,e,t){return new N(this.formSchemaUtils).getExpressionOptions(o,e,t)}getRealTargetType(o){return["response-toolbar-item","tab-toolbar-item","section-toolbar-item","drawer-toolbar-item"].indexOf(o.type)>-1?"Button":o.binding&&o.binding.field?"Field":"Container"}createBaseEventProperty(o){const e={};return e[this.viewModelId]={type:"events-editor",editor:{initialData:o,viewSourceHandle:t=>{var i;((i=t.controller)==null?void 0:i.label.indexOf(this.formSchemaUtils.getModule().code))>-1&&this.eventsEditorUtils.jumpToMethod(t)}}},e}}const v=class v{static getEditorTypesByMDataType(o,e=!1,t=""){if(e)return[{key:s.DgControl["language-textbox"].type,value:s.DgControl["language-textbox"].name}];let i=v.fieldControlTypeMapping[o];if(t==="data-grid-column"&&(i!=null&&i.length)){const n=[s.DgControl["check-group"].type,s.DgControl["radio-group"].type,s.DgControl.image.type,s.DgControl["rich-text-editor"].type];i=i.filter(r=>!n.includes(r.key))}return i}static getAllInputTypes(){const o=[];for(const e in v.fieldControlTypeMapping)v.fieldControlTypeMapping[e].forEach(t=>{o.find(i=>i.key===t.key&&i.value===t.value)||o.push({key:t.key,value:t.value})});return o}static mappingDomPropAndSchemaProp(o,e){var n;const t=(n=o.editor)==null?void 0:n.type,i=[];return(o.type===s.DgControl["data-grid-column"].type||o.type===s.DgControl["tree-grid-column"].type)&&e&&e.categoryId&&e.categoryId.indexOf("gridFieldEditor")<0&&i.push({domField:"title",schemaField:"name"}),i.push({domField:"label",schemaField:"name"}),i.push({domField:"editor.required",schemaField:"require"}),i.push({domField:"editor.readonly",schemaField:"readonly"}),(t===s.DgControl["input-group"].type||t===s.DgControl.textarea.type||t===s.DgControl["number-spinner"].type)&&i.push({domField:"editor.maxLength",schemaField:"type.length"}),t===s.DgControl["number-spinner"].type&&i.push({domField:"editor.precision",schemaField:"type.precision"}),(o.type===s.DgControl["data-grid-column"].type||o.type===s.DgControl["tree-grid-column"].type)&&i.push({domField:"formatter.precision",schemaField:"type.precision"}),(t===s.DgControl["combo-list"].type||t===s.DgControl["radio-group"].type)&&i.push({domField:"editor.data",schemaField:"type.enumValues"}),(o.type===s.DgControl["data-grid-column"].type||o.type===s.DgControl["tree-grid-column"].type)&&i.push({domField:"formatter.data",schemaField:"type.enumValues"}),t===s.DgControl["date-picker"].type&&(i.push({domField:"editor.displayFormat",schemaField:"editor.format"}),i.push({domField:"editor.fieldType",schemaField:"type.name"})),t===s.DgControl["number-spinner"].type&&(i.push({domField:"editor.max",schemaField:"editor.maxValue"}),i.push({domField:"editor.min",schemaField:"editor.minValue"})),t===s.DgControl.lookup.type&&(i.push({domField:"editor.dataSource",schemaField:"editor.dataSource"}),i.push({domField:"editor.valueField",schemaField:"editor.valueField"}),i.push({domField:"editor.textField",schemaField:"editor.textField"}),i.push({domField:"editor.displayType",schemaField:"editor.displayType"}),i.push({domField:"editor.mapFields",schemaField:"editor.mapFields"}),i.push({domField:"editor.helpId",schemaField:"editor.helpId"})),i.push({domField:"path",schemaField:"bindingPath"}),i.push({domField:"binding.path",schemaField:"bindingField"}),i.push({domField:"binding.fullPath",schemaField:"path"}),(o.type===s.DgControl["data-grid-column"].type||o.type===s.DgControl["tree-grid-column"].type)&&i.push({domField:"field",schemaField:"bindingPath"}),i}};A(v,"fieldControlTypeMapping",{String:[{key:s.DgControl["input-group"].type,value:s.DgControl["input-group"].name},{key:s.DgControl.lookup.type,value:s.DgControl.lookup.name},{key:s.DgControl.image.type,value:s.DgControl.image.name},{key:s.DgControl["date-picker"].type,value:s.DgControl["date-picker"].name},{key:s.DgControl.switch.type,value:s.DgControl.switch.name},{key:s.DgControl["check-box"].type,value:s.DgControl["check-box"].name},{key:s.DgControl["check-group"].type,value:s.DgControl["check-group"].name},{key:s.DgControl["radio-group"].type,value:s.DgControl["radio-group"].name},{key:s.DgControl["combo-list"].type,value:s.DgControl["combo-list"].name},{key:s.DgControl.textarea.type,value:s.DgControl.textarea.name},{key:s.DgControl["time-picker"].type,value:s.DgControl["time-picker"].name}],Text:[{key:s.DgControl.textarea.type,value:s.DgControl.textarea.name},{key:s.DgControl.lookup.type,value:s.DgControl.lookup.name},{key:s.DgControl.image.type,value:s.DgControl.image.name},{key:s.DgControl["rich-text-editor"].type,value:s.DgControl["rich-text-editor"].name}],Decimal:[{key:s.DgControl["number-spinner"].type,value:s.DgControl["number-spinner"].name}],Integer:[{key:s.DgControl["number-spinner"].type,value:s.DgControl["number-spinner"].name}],Number:[{key:s.DgControl["number-spinner"].type,value:s.DgControl["number-spinner"].name},{key:s.DgControl.switch.type,value:s.DgControl.switch.name},{key:s.DgControl["check-box"].type,value:s.DgControl["check-box"].name}],BigNumber:[{key:s.DgControl["number-spinner"].type,value:s.DgControl["number-spinner"].name}],Date:[{key:s.DgControl["date-picker"].type,value:s.DgControl["date-picker"].name}],DateTime:[{key:s.DgControl["date-picker"].type,value:s.DgControl["date-picker"].name}],Boolean:[{key:s.DgControl.switch.type,value:s.DgControl.switch.name},{key:s.DgControl["check-box"].type,value:s.DgControl["check-box"].name}],Enum:[{key:s.DgControl["combo-list"].type,value:s.DgControl["combo-list"].name},{key:s.DgControl["radio-group"].type,value:s.DgControl["radio-group"].name}],Object:[{key:s.DgControl.lookup.type,value:s.DgControl.lookup.name},{key:s.DgControl["combo-list"].type,value:s.DgControl["combo-list"].name},{key:s.DgControl["radio-group"].type,value:s.DgControl["radio-group"].name}]});let S=v;var P=(f=>(f.Form="Form",f.Variable="Variable",f))(P||{});class U{constructor(){A(this,"label","");A(this,"id","");A(this,"columnInSM",12);A(this,"columnInMD",6);A(this,"columnInLG",3);A(this,"columnInEL",2);A(this,"displayWidthInSM",1);A(this,"displayWidthInMD",1);A(this,"displayWidthInLG",1);A(this,"displayWidthInEL",1);A(this,"displayColumnCountAtBreakPoint","md");A(this,"tagRow",0);A(this,"showTopBorder",0);A(this,"group",1);A(this,"isSupportedClass",!0);A(this,"fieldSetId","")}}function G(f){let o,e;const t=new Map;let i=[];function n(d,a){const g=((d==null?void 0:d.split(" "))||[]).filter(F=>F.startsWith("col-"));if(g.length===0){a.isSupportedClass=!1;return}let p=g.find(F=>/^col-([1-9]|10|11|12)$/.test(F)),h=g.find(F=>/^col-md-([1-9]|10|11|12)$/.test(F)),b=g.find(F=>/^col-xl-([1-9]|10|11|12)$/.test(F)),I=g.find(F=>/^col-el-([1-9]|10|11|12)$/.test(F));p=p||"col-12",a.columnInSM=parseInt(p.replace("col-",""),10),a.displayWidthInSM=a.columnInSM/12,a.displayWidthInSM!==1&&(a.isSupportedClass=!1),h=h||"col-md-"+a.columnInSM,a.columnInMD=parseInt(h.replace("col-md-",""),10),a.displayWidthInMD=a.columnInMD/6,[1,2].includes(a.displayWidthInMD)||(a.isSupportedClass=!1),b=b||"col-xl-"+a.columnInMD,a.columnInLG=parseInt(b.replace("col-xl-",""),10),a.displayWidthInLG=a.columnInLG/3,[1,2,3,4].includes(a.displayWidthInLG)||(a.isSupportedClass=!1),I=I||"col-el-"+a.columnInLG,a.columnInEL=parseInt(I.replace("col-el-",""),10),a.displayWidthInEL=a.columnInEL/2,[1,2,3,4,5,6].includes(a.displayWidthInEL)||(a.isSupportedClass=!1)}function r(d,a,m,g=!1){let p=!1;if(!d.contents||d.contents.length===0){const h=new U;n(d.layout,h),a.push(h);return}d.contents.forEach(h=>{if(h.type==="fieldset"){m+=1,r(h,a,m,!0),p=!0;return}if(h.type==="dynamic-form")return;p&&(m+=1,p=!1);const b=h.appearance&&h.appearance.class,I=new U;b?n(b,I):I.isSupportedClass=!1,I.label=h.label||h.id,I.id=h.id,I.group=m,g&&(I.fieldSetId=d.id),e===h.id&&(o=m),t.set(h.id,h),a.push(I)})}function c(d){const a=f.getComponentById(d);if(!a||!a.componentType||!a.componentType.startsWith("form"))return{result:!1,message:"只可以在响应式表单组件中调整响应式布局配置"};const m=f.selectNode(a,g=>g.type===s.DgControl["response-form"].type);return!m||!m.contents||m.contents.length===0?{result:!1,message:"Form区域内没有控件,请先添加控件"}:{result:!0,message:"",formNode:m}}function l(d,a){a=a||d.id;const{result:m,message:g,formNode:p}=c(a);if(!m)return{result:m,message:g};e=d.id,i=[],t.clear();const h=p.contents[0].type===s.DgControl.fieldset.type?0:1;r(p,i,h);const b=i.find(F=>!F.isSupportedClass);return{defaultState:{defaultGroupNumber:o||1,model:b?"customize":"standard"},importData:i}}function u(d,a){a=a;const{result:m,formNode:g}=c(a);if(!m)return"";const p=[];return d.forEach(h=>{var F;const b=t.get(h.id),I=b.appearance&&b.appearance.class;if(I){const T=I.split(" ").filter(_=>!_.startsWith("col-")),w="col-"+h.columnInSM,$="col-md-"+h.columnInMD,J="col-xl-"+h.columnInLG,X="col-el-"+h.columnInEL,Y=[w,$,J,X].concat(T);b.appearance.class=Y.join(" ")}if(h.fieldSetId){const B=g.contents.find(w=>w.id===h.fieldSetId),T=p.find(w=>w.id===h.fieldSetId);T?(F=T.contents)==null||F.push(b):(p.push(B),B.contents=[b])}else p.push(b)}),g.contents=p,g.id}return{checkCanFindFormNode:c,checkCanOpenLayoutEditor:l,changeFormControlsByResponseLayoutConfig:u,getResonseFormLayoutConfig:r}}class O extends Q{constructor(e,t){super(e,t);A(this,"responseLayoutEditorFunction");A(this,"bindingVarible");A(this,"numberEditorOptions",{type:"number-spinner",useThousands:!1,keyboard:!1,showButton:!1});this.responseLayoutEditorFunction=G(this.formSchemaUtils)}getCommonPropertyConfig(e,t,i="Card"){this.propertyConfig.categories.basic=this.getBasicProperties(e,t,i),this.propertyConfig.categories.appearance=this.getAppearanceProperties(e,t),this.propertyConfig.categories.behavior=this.getBehaviorConfig(e,"form-group")}getPropertyConfig(e,t){return this.getCommonPropertyConfig(e,t,"Card"),this.propertyConfig.categories.editor=this.getEditorProperties(e),this.propertyConfig.categories.expressions=this.getExpressionConfig(e,"Field"),this.propertyConfig.categories.eventsEditor=this.getEventPropertyConfig(e),this.propertyConfig}getGridFieldEdtiorPropConfig(e,t){return this.propertyConfig.categories={},this.getCommonPropertyConfig(e,t,"Grid"),this.getGridFieldEdtiorProperties?this.propertyConfig.categories.editor=this.getGridFieldEdtiorProperties(e):this.propertyConfig.categories.editor=this.getEditorProperties(e),this.propertyConfig.categories.expressons=this.getExpressionConfig(e,"Field"),this.propertyConfig.categories}getBasicProperties(e,t,i="Card"){var u;const n=this;this.setDesignViewModelField(e);const{canChangeControlType:r,editorTypeList:c}=this.getAvailableEditorType(e),l={description:"Basic Information",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"编辑器类型",title:"编辑器类型",type:"string",$converter:"/converter/change-editor.converter",parentPropertyID:"editor",editor:{type:"combo-list",textField:"value",valueField:"key",idField:"key",editable:!1,data:c,readonly:!r}},label:{title:"标签",type:"string",$converter:"/converter/form-group-label.converter"},showLabelType:{description:"标签显示方式:1、显示:显示标签 2、占位:保留标签空间,但不显示文本 3、不显示:不显示标签",title:"标签显示",type:"enum",editor:{data:[{id:"visible",name:"显示"},{id:"reserve-space",name:"占位"},{id:"none",name:"不显示"}]},defaultValue:((u=e.editor)==null?void 0:u.type)==="image"?"none":"visible"},binding:{description:"绑定的表单字段",title:"绑定",editor:{type:"binding-selector",bindingType:{enable:!1},editorParams:{componentSchema:e,needSyncToViewModel:!0,viewModelId:this.viewModelId,designerHostService:this.designerHostService,disableOccupiedFields:!0},textField:"bindingField"},refreshPanelAfterChanged:!0,readonly:this.formSchemaUtils.designerMode==="PC_RTC"&&!e.isRtcControl}},setPropertyRelates(d,a,m){if(d)switch(d&&d.propertyID){case"type":{n.changeControlType(e,d,t);break}case"label":{d.needRefreshControlTree=!0;break}case"binding":{n.changeBindingField(e,d,m);break}}}};return i.toLocaleLowerCase()!=="card"&&delete l.properties.showLabelType,l}checkCanChangeControlType(e,t){if(!e.binding)return!1;if(e.binding.type==="Variable"){if(this.bindingVarible=this.formSchemaUtils.getVariableById(e.binding.field),!this.bindingVarible)return!1}else if(!this.designViewModelField||this.designViewModelField.$type!==x.FormSchemaEntityField$Type.SimpleField)return!1;return!0}getAvailableEditorType(e){var n,r;const t=this.checkCanChangeControlType(e,this.viewModelId);if(!t)return{canChangeControlType:!1,editorTypeList:[{key:e.editor.type,value:((n=s.DgControl[e.editor.type])==null?void 0:n.name)||e.editor.type}]};let i=[];return this.designViewModelField&&this.designViewModelField.$type===x.FormSchemaEntityField$Type.SimpleField?i=S.getEditorTypesByMDataType(this.designViewModelField.type.name,this.designViewModelField.multiLanguage):this.bindingVarible&&(i=S.getEditorTypesByMDataType(this.bindingVarible.type,!!((r=this.designViewModelField)!=null&&r.multiLanguage))),{canChangeControlType:t,editorTypeList:i}}changeBindingField(e,t,i){t.needRefreshEntityTree=!0}getAppearanceProperties(e,t){const i=this;return{title:"外观",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"},style:{title:"style样式",type:"string",description:"组件的内联样式",$converter:"/converter/appearance.converter",parentPropertyID:"appearance"},fill:{title:"填充宽度",description:"启用后,控件占满父容器宽度",type:"boolean",parentPropertyID:"appearance"},responseLayout:{description:"响应式列宽",title:"响应式列宽",type:"boolean",visible:!0,refreshPanelAfterChanged:!0,editor:{type:"response-layout-editor-setting",beforeOpen:()=>i.responseLayoutEditorFunction.checkCanOpenLayoutEditor(e,i.componentId)}}},setPropertyRelates(n,r){if(n)switch(n&&n.propertyID){case"responseLayout":i.responseLayoutEditorFunction.changeFormControlsByResponseLayoutConfig(n.propertyValue,i.componentId||e.id),i.updateUnifiedLayoutAfterResponseLayoutChanged(i.componentId),i.updateElementByParentContainer(e.id,t),delete e.responseLayout;break;case"class":i.updateUnifiedLayoutAfterControlChanged(n.propertyValue,e.id,this.componentId),s.canvasChanged.value++;break;case"style":{s.canvasChanged.value++;break}}}}}getEditorProperties(e){return this.getComponentConfig(e)}changeControlType(e,t,i){const n=t.propertyValue,r=i&&i.parent&&i.parent.schema;if(!r)return;const c=r.contents.findIndex(d=>d.id===e.id);if(c===-1)return;const l=r.contents[c];let u;if(this.designViewModelField){const m=this.formSchemaUtils.getViewModelById(this.viewModelId).fields.find(p=>p.id===this.designViewModelField.id).fieldSchema||{};m.editor||(m.editor={}),m.editor.$type=n,this.designViewModelUtils.getDgViewModel(this.viewModelId).changeField(this.designViewModelField.id,m,!1),u=this.controlCreatorUtils.setFormFieldProperty(this.designViewModelField,n)}u||(u=this.controlCreatorUtils.createFormGroupWithoutField(n)),Object.assign(u,{id:l.id,appearance:l.appearance,size:l.size,label:l.label,binding:l.binding}),Object.prototype.hasOwnProperty.call(l,"visible")&&Object.assign(u,{visible:l.visible}),l.editor&&["readonly","required","placeholder"].map(d=>{Object.prototype.hasOwnProperty.call(l.editor,d)&&(u.editor[d]=l.editor[d])}),i!=null&&i.updateContextSchema?i.updateContextSchema(u):(i.schema=Object.assign(l,u),Object.assign(e,u)),Array.from(document.getElementsByClassName("dgComponentSelected")).forEach(d=>d.classList.remove("dgComponentSelected")),Array.from(document.getElementsByClassName("dgComponentFocused")).forEach(d=>d.classList.remove("dgComponentFocused")),s.canvasChanged.value++,y.nextTick(()=>{this.getFormDesignerInstance().reloadPropertyPanel()})}getComponentConfig(e,t={},i={},n){var m,g;const r=Object.assign({description:"编辑器",title:"编辑器",type:"input-group",$converter:"/converter/property-editor.converter",parentPropertyID:"editor"},t),c=(m=e.binding)!=null&&m.field?[]:["Const","Variable","StateMachine"],l=this.getPropertyEditorParams(e,c,"readonly"),u=this.getPropertyEditorParams(e,c,"required"),d={readonly:{description:"",title:"只读",editor:l},required:{description:"",title:"必填",type:"boolean",editor:u,visible:!!((g=e.binding)!=null&&g.field)},placeholder:{description:"当控件没有值时在输入框中显示的文本",title:"提示文本",type:"string"}};for(const p in i)d[p]=Object.assign(d[p]||{},i[p]);const a=this;return{...r,properties:{...d},setPropertyRelates(p,h){if(p){switch(p.propertyID){case"readonly":case"required":a.afterMutilEditorChanged(e,p);break}n&&n.bind(a)(p,e,h)}}}}updateUnifiedLayoutAfterControlChanged(e,t,i){const n=e.split(" ");let r=n.find(a=>/^col-([1-9]|10|11|12)$/.test(a)),c=n.find(a=>/^col-md-([1-9]|10|11|12)$/.test(a)),l=n.find(a=>/^col-xl-([1-9]|10|11|12)$/.test(a)),u=n.find(a=>/^col-el-([1-9]|10|11|12)$/.test(a));r=r||"col-12",c=c||"col-md-"+r.replace("col-",""),l=l||"col-xl-"+c.replace("col-md-",""),u=u||"col-el-"+l.replace("col-xl-","");const d={id:t,columnInSM:parseInt(r.replace("col-",""),10),columnInMD:parseInt(c.replace("col-md-",""),10),columnInLG:parseInt(l.replace("col-xl-",""),10),columnInEL:parseInt(u.replace("col-el-",""),10)};this.updateUnifiedLayoutAfterResponseLayoutChanged(i,d)}updateUnifiedLayoutAfterResponseLayoutChanged(e,t){const{formNode:i}=this.responseLayoutEditorFunction.checkCanFindFormNode(e);if(!i||!i.unifiedLayout)return;const n=[];if(this.responseLayoutEditorFunction.getResonseFormLayoutConfig(i,n,1),t){const p=n.find(h=>h.id===t.id);Object.assign(p||{},t)}const r=n.map(p=>p.columnInSM),c=n.map(p=>p.columnInMD),l=n.map(p=>p.columnInLG),u=n.map(p=>p.columnInEL),d=this.checkIsUniqueColumn(r)?r[0]:null,a=this.checkIsUniqueColumn(c)?c[0]:null,m=this.checkIsUniqueColumn(l)?l[0]:null,g=this.checkIsUniqueColumn(u)?u[0]:null;Object.assign(i.unifiedLayout,{uniqueColClassInSM:d,uniqueColClassInMD:a,uniqueColClassInLG:m,uniqueColClassInEL:g})}checkIsUniqueColumn(e){const t=new Set(e);return Array.from(t).length===1}getItemCollectionEditor(e,t,i){return t=t||"value",i=i||"name",{editor:{columns:[{field:t,title:"值",dataType:"string"},{field:i,title:"名称",dataType:"string"}],type:"item-collection-editor",valueField:t,nameField:i,requiredFields:[t,i],uniqueFields:[t,i],readonly:this.checkEnumDataReadonly(e)}}}checkEnumDataReadonly(e){return!e.binding||e.binding.type!=="Form"?!1:!!(this.designViewModelField&&this.designViewModelField.type&&this.designViewModelField.type.$type===x.FormSchemaEntityFieldType$Type.EnumType)}appendFieldValueChangeEvents(e,t){e.binding&&e.binding.type===P.Form&&e.binding.field?(t.find(i=>i.label==="fieldValueChanging"),t.find(i=>i.label==="fieldValueChanged"),this.designViewModelField&&(e.fieldValueChanging=this.designViewModelField.valueChanging,e.fieldValueChanged=this.designViewModelField.valueChanged)):t=t.filter(i=>i.label!=="fieldValueChanging"&&i.label!=="fieldValueChanged")}getControlMethodType(e){if(!e.binding)return e.type;switch(e.binding.type){case P.Form:return e.binding.path||e.type;case P.Variable:return e.binding.fullPath||e.type}return e.type}getEventPropertyConfig(e,t="card",i,n){const r=this;let c=[];if(i&&(c=c.concat(i)),c.length===0)return{title:"事件",hideTitle:!0,properties:{},tabId:"commands",tabName:"交互",hide:!0};this.appendFieldValueChangeEvents(e,c);const l=r.eventsEditorUtils.formProperties(e,r.viewModelId,c);return{title:"事件",hideTitle:!0,properties:r.createBaseEventProperty(l),tabId:"commands",tabName:"交互",setPropertyRelates(a,m){const g=a.propertyValue;delete e[r.viewModelId],g&&(g.setPropertyRelates=this.setPropertyRelates,g.controlInfo={type:r.getControlMethodType(e),name:e.title},r.eventsEditorUtils.saveRelatedParameters(e,r.viewModelId,g.events,g)),n&&n(a,m,g);const p=r.designViewModelUtils.getDgViewModel(r.viewModelId);p&&r.designViewModelField&&p.changeField(r.designViewModelField.id,{valueChanging:e.fieldValueChanging,valueChanged:e.fieldValueChanged})}}}getExpressionConfig(e,t,i=["compute","dependency","validate"],n){return new N(this.formSchemaUtils).getExpressionConfig(e,t,i,n)}getBindingDataType(){return this.designViewModelField?this.designViewModelField.type.name==="Number"?"number":this.designViewModelField.type.name==="String"?"string":"boolean":"boolean"}getEditor(){return this.getBindingDataType()==="number"?this.numberEditorOptions:{}}updatePropertyValue(e,t,i){var n;e.editor[t]!==i?e.editor[t]=i:(n=this.getFormDesignerInstance())==null||n.reloadPropertyPanel()}setBooleanValue(e,t,i){let n=i;this.getBindingDataType()==="string"&&(n=(n||"").trim()||(t==="trueValue"?"true":"false"));const c=t==="trueValue"?"falseValue":"trueValue";e.editor[c]===n&&(n=n+1),this.updatePropertyValue(e,t,n)}getBooleanValueConverter(){return{convertFrom:(e,t)=>e.editor[t],convertTo:(e,t,i)=>{this.setBooleanValue(e,t,i)}}}}class j extends O{constructor(o,e){super(o,e)}getEditorProperties(o){return{description:"编辑器",title:"编辑器",type:"avatar",$converter:"/converter/property-editor.converter",parentPropertyID:"editor",properties:{readonly:{description:"",title:"只读",type:"boolean"},avatarWidth:{description:"",title:"头像宽度",type:"number"},avatarHeight:{description:"",title:"头像高度",type:"number"},cover:{description:"",title:"封面",type:"string"}}}}}function K(f,o){const e=f.schema;function t(i,n){return new j(i,o).getPropertyConfig(e,n)}return{getPropsConfig:t}}const Z=y.defineComponent({name:"FAvatarDesign",props:M,emits:["change","update:modelValue"],setup(f,o){const e=y.ref(),t=y.inject("designer-host-service"),i=y.inject("design-item-context"),n=K(i,t),r=s.useDesignerComponent(e,i,n);y.onMounted(()=>{e.value.componentInstance=r}),o.expose(r.value);const c=y.computed(()=>({"f-avatar":!0,"f-avatar-readonly":f.readonly,"f-avatar-circle":f.shape==="circle","f-avatar-square":f.shape==="square"})),l=y.ref(f.modelValue),u=y.computed(()=>({width:f.avatarWidth+"px",height:f.avatarHeight+"px"})),d=!1;function a(){return""}function m(){}const g=y.ref(null),{acceptTypes:p,imageSource:h,onClickImage:b}=D(f,o,g,l);return()=>y.createVNode("div",{ref:e,class:c.value,style:u.value,onClick:b},[d,y.createVNode("img",{title:f.title,class:"f-avatar-image",src:h.value,onError:a},null),!f.readonly&&y.createVNode("div",{class:"f-avatar-icon"},[y.createVNode("span",{class:"f-icon f-icon-camera"},null)]),y.createVNode("input",{ref:"file",name:"file-input",type:"file",class:"f-avatar-upload",accept:p.value,onChange:m,style:"display: none;"},null)])}});V.register=(f,o,e,t)=>{f.avatar=V,o.avatar=k},V.registerDesigner=(f,o,e)=>{f.avatar=Z,o.avatar=k};const z=x.withInstall(V);C.FAvatar=V,C.avatarProps=M,C.default=z,C.propsResolver=k,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1482,7 +1482,7 @@ function Tt(e, t, n) {
|
|
|
1482
1482
|
const Et = /* @__PURE__ */ ie({
|
|
1483
1483
|
name: "FButtonEdit",
|
|
1484
1484
|
props: ut,
|
|
1485
|
-
emits: ["updateExtendInfo", "clear", "change", "click", "clickButton", "blur", "focus", "mouseEnterIcon", "mouseLeaveIcon", "keyup", "keydown", "inputClick", "input", "update:modelValue", "beforeClearValue"],
|
|
1485
|
+
emits: ["updateExtendInfo", "clear", "change", "click", "clickButton", "blur", "focus", "mouseEnterIcon", "mouseLeaveIcon", "keyup", "keydown", "inputClick", "input", "update:modelValue", "beforeClearValue", "shown"],
|
|
1486
1486
|
setup(e, t) {
|
|
1487
1487
|
const n = o(), l = o(e.customClass), i = o(e.modelValue), s = xt(e, t, n, i), {
|
|
1488
1488
|
shouldPopupContent: c,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(H,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("../locale/index.umd.js"),require("../common/index.umd.js"),require("../property-panel/index.umd.js"),require("../tags/index.umd.js"),require("lodash-es"),require("../popover/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../locale/index.umd.js","../common/index.umd.js","../property-panel/index.umd.js","../tags/index.umd.js","lodash-es","../popover/index.umd.js"],t):(H=typeof globalThis<"u"?globalThis:H||self,t(H["button-edit"]={},H.Vue,H.locale,H.common,null,H.FTags,H.LodashES,H.FPopover))})(this,function(H,t,q,J,at,de,fe,he){"use strict";var tt=Object.defineProperty;var nt=(H,t,q)=>t in H?tt(H,t,{enumerable:!0,configurable:!0,writable:!0,value:q}):H[t]=q;var $=(H,t,q)=>nt(H,typeof t!="symbol"?t+"":t,q);const ne={id:{type:String,default:""},buttonContent:{type:String,default:'<i class="f-icon f-icon-lookup"></i>'},buttonBehavior:{type:String,default:"Popup"},autoComplete:{type:Boolean,default:!1},customClass:{type:String,default:""},disable:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},enableClear:{type:Boolean,default:!1},modelValue:{type:String,default:""},readonly:{type:Boolean,default:!1},showButtonWhenDisabled:{type:Boolean,default:!1},enableTitle:{type:Boolean,default:!1},inputType:{type:String,default:"text"},forcePlaceholder:{type:Boolean,default:!1},placeholder:{type:String,default:""},minLength:Number,maxLength:{type:Number},tabIndex:Number,popupHost:{type:Object},popupRightBoundary:{type:Object},popupOffsetX:{type:Object},popupOnInput:{type:Boolean,default:!1},popupOnFocus:{type:Boolean,default:!1},popupOnClick:{type:Boolean,default:!1},popupClass:{type:String,default:""},popupMinWidth:{type:Number,default:160},modalOptions:{type:Object,default:{}},wrapText:{type:Boolean,default:!1},multiSelect:{type:Boolean,default:!1},separator:{type:String,default:","},textAlign:{type:String,default:"left"},beforeClickButton:{type:Function,default:null},focusOnCreated:{type:Boolean,default:!1},selectOnCreated:{type:Boolean,default:!1},beforeOpen:{type:Function,default:null},updateOn:{type:String,default:"change"},keepWidthWithReference:{type:Boolean,default:!0},placement:{type:String,default:"bottom-left"},limitContentBySpace:{type:Boolean,default:!1},beforeClosePopup:{type:Function,default:null}},me={popupContentPosition:{type:Object,default:{left:0,top:0}},host:{type:Object},backgroundColor:{type:String,default:""}},ve=t.defineComponent({name:"FOverlay",props:me,emits:["click"],setup(e,n){const a=t.ref(e.popupContentPosition),l=t.ref(e.host),i=t.computed(()=>({backgroundColor:e.backgroundColor||"",pointerEvents:"auto"}));function s(u){n.emit("click"),u.preventDefault(),u.stopPropagation()}t.computed(()=>{const u=l.value;if(u){const f=u.getBoundingClientRect(),{left:v,top:y,height:p}=f;return{left:v,top:y+p}}return a.value});const c=t.computed(()=>({}));return()=>t.createVNode(t.Teleport,{to:"body"},{default:()=>{var u,f;return[t.createVNode("div",{class:"overlay-container",onClick:v=>s(v),style:i.value},[t.createVNode("div",{style:c.value},[(f=(u=n.slots).default)==null?void 0:f.call(u)])])]}})}});function ge(e){if(e.content&&e.content.render)return e.content.render;if(e.render&&typeof e.render=="function")return e.render}function ye(e){const n=document.createElement("div");n.style.display="contents";let a;const l=e.onClickCallback||(()=>{}),i=()=>{l(),a&&a.unmount()};return a=t.createApp({setup(){t.onUnmounted(()=>{document.body.removeChild(n)});const s=ge(e);return()=>t.createVNode(ve,{"popup-content-position":e.popupPosition,host:e.host,onClick:i,backgroundColor:e.backgroundColor},{default:()=>[s&&s()]})}}),document.body.appendChild(n),a.mount(n),a}class pe{static show(n){return ye(n)}}const be={allowClickMaskToClose:{type:Boolean,default:!1},beforeClose:{type:Function,default:()=>!0},class:{type:String,default:""},maskClass:{type:String,default:""},title:{type:String,default:""},width:{type:Number,default:500},height:{type:Number,default:320},buttons:{type:Array,default:[]},modelValue:{type:Boolean,default:!1},mask:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!0},fitContent:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0},showMaxButton:{type:Boolean,default:!1},minHeight:{type:Number},maxHeight:{type:Number},minWidth:{type:Number},maxWidth:{type:Number},containment:{type:Object,default:null},resizeable:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},dragHandle:{type:Object,default:null},closedCallback:{type:Function,default:null},resizeHandle:{type:Function,default:null},render:{type:Function,default:null},acceptCallback:{type:Function,default:null},rejectCallback:{type:Function,default:null},enableEsc:{type:Boolean,default:!0},enableEnter:{type:Boolean,default:!1},dialogType:{type:String,default:""},src:{type:String,default:""},footerHeight:{type:Number,default:60},host:{type:Object,default:"body"},isMessager:{type:Boolean,default:!1}};class R{constructor(n,a){this.x=n,this.y=a}static getTransformInfo(n){const l=window.getComputedStyle(n).getPropertyValue("transform").replace(/[^-\d,]/g,"").split(",");if(l.length>=6){const i=parseInt(l[4],10),s=parseInt(l[5],10);return{x:i,y:s}}return{x:0,y:0}}static fromEvent(n,a=null){if(this.isMouseEvent(n))return new R(n.clientX,n.clientY);if(a===null||n.changedTouches.length===1)return new R(n.changedTouches[0].clientX,n.changedTouches[0].clientY);for(let l=0;l<n.changedTouches.length;l++)if(n.changedTouches[l].target===a)return new R(n.changedTouches[l].clientX,n.changedTouches[l].clientY)}static isMouseEvent(n){return Object.prototype.toString.apply(n).indexOf("MouseEvent")===8}static isIPosition(n){return!!n&&"x"in n&&"y"in n}static getCurrent(n){const a=new R(0,0);if(window){const l=window.getComputedStyle(n);if(l){const i=parseInt(l.getPropertyValue("left"),10),s=parseInt(l.getPropertyValue("top"),10);a.x=isNaN(i)?0:i,a.y=isNaN(s)?0:s}return a}return null}static copy(n){return new R(0,0).set(n)}get value(){return{x:this.x,y:this.y}}add(n){return this.x+=n.x,this.y+=n.y,this}subtract(n){return this.x-=n.x,this.y-=n.y,this}multiply(n){this.x*=n,this.y*=n}divide(n){this.x/=n,this.y/=n}reset(){return this.x=0,this.y=0,this}set(n){return this.x=n.x,this.y=n.y,this}}class K{constructor(n,a){this.width=n,this.height=a}static getCurrent(n){const a=new K(0,0);if(window){const l=window.getComputedStyle(n);return l&&(a.width=parseInt(l.getPropertyValue("width"),10),a.height=parseInt(l.getPropertyValue("height"),10)),a}return null}static copy(n){return new K(0,0).set(n)}set(n){return this.width=n.width,this.height=n.height,this}}function we(e,n){const a=t.ref(),l=t.ref(),i=t.ref(),s=t.ref(),c=t.ref(),u=t.ref(),f=t.ref(),v=t.ref(),y=t.ref(),p=t.ref(),M=t.ref(),b=t.ref(e.resizeable),g=t.ref(),x=t.ref(e.draggable),T=t.ref(!1);function O(){const r=l.value||document.body,h=window.getComputedStyle(r);if(!h||!a.value)return;const V=R.getTransformInfo(a.value),k={};f.value&&(k.deltaL=a.value.offsetLeft-f.value.x,k.deltaT=a.value.offsetTop-f.value.y);const j=h.getPropertyValue("position");k.width=r.clientWidth,k.height=r.clientHeight,k.pr=parseInt(h.getPropertyValue("padding-right"),10),k.pb=parseInt(h.getPropertyValue("padding-bottom"),10),k.position=h.getPropertyValue("position"),j==="static"&&(r.style.position="relative"),k.translateX=V.x,k.translateY=V.y,p.value=k}function P(r){if(a.value){s.value=K.getCurrent(a.value),c.value=R.getCurrent(a.value),u.value=s.value?K.copy(s.value):null,f.value=c.value?R.copy(c.value):null,O();const h=r.target.getAttribute("type")||"";v.value={n:!!h.match(/n/),s:!!h.match(/s/),w:!!h.match(/w/),e:!!h.match(/e/)}}}function S(){var r,h,V,k;if(a.value){const j=a.value;v.value&&((v.value.n||v.value.s)&&((r=u.value)!=null&&r.height)&&(j.style.height=u.value.height+"px"),(v.value.w||v.value.e)&&((h=u.value)!=null&&h.width)&&(j.style.width=u.value.width+"px"),f.value&&((V=f.value)!=null&&V.x&&(j.style.left=f.value.x+"px"),(k=f.value)!=null&&k.y&&(j.style.top=f.value.y+"px")))}}function D(){const r=e.minHeight?e.minHeight:1,h=e.minWidth?e.minWidth:1;u.value&&f.value&&v.value&&s.value&&(u.value.height<r&&(u.value.height=r,v.value.n&&c.value&&(f.value.y=c.value.y+(s.value.height-r))),u.value.width<h&&(u.value.width=h,v.value.w&&c.value&&(f.value.x=c.value.x+(s.value.width-h))),e.maxHeight&&u.value.height>e.maxHeight&&(u.value.height=e.maxHeight,c.value&&v.value.n&&(f.value.y=c.value.y+(s.value.height-e.maxHeight))),e.maxWidth&&u.value.width>e.maxWidth&&(u.value.width=e.maxWidth,v.value.w&&c.value&&(f.value.x=c.value.x+(s.value.width-e.maxWidth))))}function B(){if(l.value){const r=p.value;if(f.value&&u.value&&v.value&&s.value){const h=r.width-r.pr-r.deltaL-r.translateX-f.value.x,V=r.height-r.pb-r.deltaT-r.translateY-f.value.y;v.value.n&&f.value.y+r.translateY<0&&c.value&&(f.value.y=-r.translateY,u.value.height=s.value.height+c.value.y+r.translateY),v.value.w&&f.value.x+r.translateX<0&&c.value&&(f.value.x=-r.translateX,u.value.width=s.value.width+c.value.x+r.translateX),u.value.width>h&&(u.value.width=h),u.value.height>V&&(u.value.height=V)}}}function N(r){if(!i.value||!s.value||!c.value||!v.value)return;r.subtract(i.value);const h=r.x,V=r.y;v.value.n?(f.value.y=c.value.y+V,u.value.height=s.value.height-V):v.value.s&&(u.value.height=s.value.height+V),v.value.e?u.value.width=s.value.width+h:v.value.w&&(u.value.width=s.value.width-h,f.value.x=c.value.x+h),B(),D(),S()}function d(r){if(!y.value)return;const h=R.fromEvent(r);h&&N(h)}function w(){if(a.value){const{width:r,height:h,x:V,y:k}=a.value.getBoundingClientRect(),j=R.getTransformInfo(a.value);return{size:{width:r,height:h},position:{x:V-j.x,y:k-j.y}}}return null}function z(r){if(a.value){const h=w();M.value=h}i.value=void 0,s.value=null,c.value=null,u.value=null,f.value=null,v.value=null,y.value=null,document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",z)}function L(){document.addEventListener("mousemove",d),document.addEventListener("mouseup",z)}function m(r){r instanceof MouseEvent&&r.button===2||x.value&&(document.body.click(),r.stopPropagation(),r.preventDefault(),i.value=R.fromEvent(r),y.value=r.target,P(r),L())}function I(r){return a.value=r,b.value&&t.createVNode(t.Fragment,null,[t.createVNode("div",{class:"fv-resizable-handle fv-resizable-n",type:"n",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-e",type:"e",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-s",type:"s",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-w",type:"w",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-ne",type:"ne",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-se fv-resizable-diagonal",type:"se",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-sw",type:"sw",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-nw",type:"nw",onMousedown:h=>m(h)},null)])}function _(r=!0){document.body.click();const h=l.value||document.body,V=K.getCurrent(h),k=a.value;r&&k&&(g.value=w(),g.value.transform=k.style.transform),V&&k&&(u.value=V,u.value.height-=14,u.value.width-=14,k.style.height=u.value.height+"px",k.style.width=u.value.width+"px",k.style.left="7px",k.style.top="7px",k.style.transform="",M.value={size:u.value,position:{x:0,y:0}},x.value=!1,T.value=!0)}function U(){var r,h;if(document.body.click(),g.value){const V={width:g.value.size.width||0,height:g.value.size.height||0},k={x:(window.innerWidth-V.width)/2,y:(window.innerHeight-V.height)/2};(r=u.value)==null||r.set(V),(h=f.value)==null||h.set(k);const j=a.value;j.style.height=V.height+"px",j.style.width=V.width+"px",j.style.left=`${k.x}px`,j.style.top=`${k.y}px`,j.style.transform="",M.value={size:V,position:k},x.value=e.draggable,T.value=!1}}function G(){if(a.value){const r=K.getCurrent(a.value);if(r){const{width:h,height:V}=r;a.value.style.left=`${(window.innerWidth-h)/2}px`,a.value.style.top=`${(window.innerHeight-V)/2}px`,a.value.style.transform=""}}}function E(){const r=()=>{T.value?_(!1):G(),document.body.click()};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}}const F=E();return{renderResizeBar:I,boundingElement:l,resizedEventParam:M,maximize:_,restore:U,allowDrag:x,isMaximized:T,unWindowResizeHandle:F,moveToCenter:G}}function Ce(e,n,a){const l=t.ref(),i=t.ref(e.draggable),s=t.ref(e.lockAxis),c=t.ref(),u=t.ref(),f=t.ref(!1),v=t.ref(new R(0,0)),y=t.ref(new R(0,0)),p=t.ref(new R(0,0)),M=t.ref(new R(0,0));t.watch(()=>a.value,d=>{c.value.style.cursor=d?"move":"default"});function b(d,w){if(w.tagName==="BUTTON")return!1;if(w===d)return!0;for(const z in w.children)if(Object.prototype.hasOwnProperty.call(w.children,z)&&b(d,w.children[z]))return!0;return!1}function g(){var L,m;let d=p.value.x+y.value.x,w=p.value.y+y.value.y;s.value==="x"?(d=((L=v.value)==null?void 0:L.x)||0,p.value.x=0):s.value==="y"&&(w=((m=v.value)==null?void 0:m.y)||0,p.value.y=0);const z=`translate3d(${Math.round(d)}px, ${Math.round(w)}px, 0px)`;l.value&&(l.value.style.transform=z),M.value.x=d,M.value.y=w}function x(){if(!u.value||!l.value)return null;const d=u.value.getBoundingClientRect(),w=l.value.getBoundingClientRect(),z={top:d.top<w.top,right:d.right>w.right,bottom:d.bottom>w.bottom,left:d.left<w.left};return z.top||(p.value.y-=w.top-d.top),z.bottom||(p.value.y-=w.bottom-d.bottom),z.right||(p.value.x-=w.right-d.right),z.left||(p.value.x-=w.left-d.left),g(),z}function T(d){d&&(v.value&&d.subtract(v.value),p.value.set(d),g(),x())}function O(d){f.value&&i.value&&(d.stopPropagation(),d.preventDefault(),T(R.fromEvent(d,c.value)))}function P(){var d;f.value&&(f.value=!1,y.value.add(p.value),p.value.reset(),(d=l.value)==null||d.classList.remove("ng-dragging"),n.emit("stopMove"),document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",P))}function S(){!f.value&&c.value&&(f.value=!0,c.value.classList.add("ng-dragging"),document.addEventListener("mousemove",O),document.addEventListener("mouseup",P))}function D(){if(l.value){const d=R.getTransformInfo(l.value);y.value.set(d);return}y.value.reset()}function B(d){if(!a.value||d instanceof MouseEvent&&d.button===2)return;const w=d.target||d.srcElement;c.value!==void 0&&w&&!b(w,c.value)||i.value!==!1&&(document.body.click(),d.stopPropagation(),d.preventDefault(),v.value=R.fromEvent(d,l.value),D(),S())}function N(d,w,z){if(i.value&&w){if(d)c.value=d;else if(e.dragHandle){if(e.dragHandle instanceof HTMLElement)c.value=e.dragHandle;else if(typeof e.dragHandle=="string"){const L=w.querySelector(e.dragHandle);L&&(c.value=L)}}l.value=w,u.value=z,c.value?(c.value.classList.add("ng-draggable"),c.value.addEventListener("mousedown",B)):i.value=!1}}return{registerDraggle:N,resetTranslate:D}}function ae(e,n){if(e){const a=l=>{l.key.toLowerCase()===e.toLowerCase()&&n({event:l,key:e})};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}}}function xe(e,n){const a=t.ref(e.enableEsc);let l=null;return a.value?(l=ae("Escape",i=>{n.emit("esc",{event:i.event,type:"esc"})}),{remove:l}):null}function Be(e,n){const a=t.ref(e.enableEnter);let l=null;return a.value?(l=ae("Enter",i=>{n.emit("enter",{event:i.event,type:"enter"})}),{remove:l}):null}const Z=t.defineComponent({name:"FModal",props:be,emits:["update:modelValue","accept","cancel","closed","resize","esc","enter","stopMove"],setup(e,n){const a=t.ref(e.width||300),l=t.ref(e.height||200),i=t.ref(e.modelValue),s=t.ref(""),c=t.ref(e.class),u=t.ref(e.fitContent),f=t.ref(e.showHeader),v=t.ref(""),y=t.ref(e.showCloseButton),p=t.ref(e.showMaxButton),M=t.ref(!1),b=t.ref(e.dialogType),g=t.ref(e.src),x=t.ref(""),T=t.ref(e.showButtons),O=t.ref(e.title),P=t.ref(e.containment||null),S=t.ref();O.value==="错误提示"&&(O.value=q.LocaleService.getLocaleValue("messageBox.errorTitle"));const D=t.ref(!1);function B(o,C){const A=C?"accept":"cancel";Promise.resolve().then(()=>{var W;return(W=e.beforeClose)==null?void 0:W.call(e,{closeType:A})}).then(W=>{W&&(i.value=!1,n.emit("update:modelValue",!1),C!=null&&n.emit(C?"accept":"cancel"),n.emit("closed",o))})}const N=[{name:"cancel",text:q.LocaleService.getLocaleValue("messageBox.cancel")||"取消",class:"btn btn-secondary",handle:o=>{B(o,!1)}},{name:"accept",text:q.LocaleService.getLocaleValue("messageBox.ok")||"确定",class:"btn btn-primary",handle:o=>{B(o,!0)}}],d=t.ref(e.buttons&&e.buttons.length?e.buttons:N),w=t.computed(()=>!!v.value),z=t.computed(()=>!!T.value&&!!d.value),L=t.ref(),m=t.ref(),I=t.ref(!1),{renderResizeBar:_,maximize:U,restore:G,boundingElement:E,resizedEventParam:F,allowDrag:r,unWindowResizeHandle:h,moveToCenter:V}=we(e),{registerDraggle:k}=Ce(e,n,r);function j(){return!!document.querySelectorAll(".farris-modal").length&&document.body.classList.contains("modal-open")}function He(){const o=document.querySelectorAll(".farris-modal").length;(!o||o-1<=0)&&document.body.classList.remove("modal-open"),S.value&&S.value.classList.remove("show")}t.watch(()=>e.title,(o,C)=>{o!==C&&(O.value=o)}),t.watch(()=>e.modelValue,(o,C)=>{o!==C&&(i.value=o,i.value&&e.draggable&&t.nextTick(()=>{m.value&&!P.value&&(P.value=m.value.parentElement,E.value=P.value,k(L.value,m.value,E.value),V())}),o||(P.value&&(P.value=null),He())),i.value?D.value=j():(I.value=!1,r.value=e.draggable)}),t.watch(()=>e.showHeader,(o,C)=>{o!==C&&(f.value=o)}),t.watch(()=>e.showButtons,(o,C)=>{o!==C&&(T.value=o)}),t.watch(()=>F.value,(o,C)=>{const A=o||{},W=C||{};JSON.stringify(A)!==JSON.stringify(W)&&n.emit("resize",{newSize:o,oldSize:C,isMaximized:I.value})}),t.watch([()=>e.width,()=>e.height],(o,C)=>{(o[0]!==C[0]||o[1]!==C[1])&&(a.value=o[0]||500,l.value=o[1]||600)}),t.watch(()=>e.class,(o,C)=>{c.value=o});const Q=t.computed(()=>(i.value&&document.body.classList.add("modal-open"),i.value)),Re=t.computed(()=>{var A;const o={modal:!0,"farris-modal":!0,fade:!0};o["f-modal-fitContent"]=!!u.value,o.show=!!Q.value;const C=(A=e.maskClass)==null?void 0:A.split(" ");return C==null||C.reduce((W,X)=>(W[X]=!0,W),o),o}),je=t.computed(()=>{var A;const o={"modal-dialog":!0},C=(A=c.value)==null?void 0:A.split(" ");return C==null||C.reduce((W,X)=>(W[X]=!0,W),o),o}),se=()=>J.isMobilePhone()&&!e.isMessager,Le=t.computed(()=>{const o=document.documentElement.clientWidth,C=document.documentElement.clientHeight,A=Math.min(a.value,o),W=u.value?"auto":`${Math.min(l.value,C-10)}px`,X={position:"absolute",top:`${(window.innerHeight-parseInt(W==="auto"?"0":W))/2}px`,left:`${(window.innerWidth-A)/2}px`,width:`${A}px`,height:W};return se()&&(X.top="0px",X.left="0px",X.width=`${window.innerWidth}px`,X.height=`${window.innerHeight}px`),e.mask||(X.pointerEvents="auto"),X}),re=t.ref(J.getMaxZIndex()||1050),Fe=t.computed(()=>{const o={display:"block",overflow:"hidden"};return e.mask||(o.pointerEvents="none",o.backgroundColor="transparent"),D.value&&(o.backgroundColor="transparent"),o.zIndex=re.value,o}),We=t.computed(()=>({"modal-content":!0,"modal-content-has-header":f.value,"is-mobile":se()})),De=t.computed(()=>{const o={display:f.value?"":"none"};return o["pointer-events"]=r.value?"auto":"none",o}),Ae=t.computed(()=>({"f-icon":!0,modal_maximize:!0,modalrevert:I.value})),Ue=t.computed(()=>({"modal-body":!0,"f-utils-flex-column":b.value==="iframe","f-utils-fill":!0}));function Xe(){return{height:`${e.footerHeight||60}px`}}const qe=t.computed(()=>{const o={textAlgin:x.value},C=Xe();return Object.assign(o,C)});function ce(o){if(o==null||o.stopPropagation(),I.value){I.value=!1,G();return}U(),I.value=!0}async function Ke(o,C){o.handle&&await o.handle(C,o)&&n.emit("closed",C)}function Ye(o){o.width&&(a.value=o.width),o.height&&(l.value=o.height),o.buttons&&(d.value=o.buttons),o.title&&(O.value=o.title)}let ee=null,te=null;t.onBeforeMount(()=>{D.value=j()}),t.onMounted(()=>{m.value&&!P.value&&(P.value=m.value.parentElement,E.value=P.value,k(L.value,m.value,E.value)),Q.value&&document.body.classList.add("modal-open"),ee=xe(e,n),te=Be(e,n)}),t.onUnmounted(()=>{h&&h(),ee&&ee.remove(),te&&te.remove()}),n.expose({modalElementRef:m,updateModalOptions:Ye,close:B,maxDialog:ce,isMaximized:I});function Ge(){return t.createVNode("ul",null,[M.value&&t.createVNode("li",{class:"f-btn-icon f-bare"},[t.createVNode("span",{class:"f-icon modal_minimize"},null)]),p.value&&t.createVNode("li",{onClick:ce,class:"f-btn-icon f-bare",style:"pointer-events: auto;"},[t.createVNode("span",{class:Ae.value},null)]),y.value&&t.createVNode("li",{class:"f-btn-icon f-bare",onClick:o=>B(o,!1),style:"pointer-events: auto;"},[t.createVNode("span",{class:"f-icon modal_close"},null)])])}function $e(){return t.createVNode("div",{class:"modal-footer",style:qe.value},[d.value&&d.value.map(o=>{const C=t.ref(o.disabled);return t.createVNode("button",{name:o.name,type:"button",disabled:C.value,class:o.class+(o.iconClass?" btn-icontext":""),onClick:A=>{Ke(o,A)}},[!!o.iconClass&&t.createVNode("i",{class:o.iconClass},null),o.text])})])}function _e(){return t.createVNode("div",{ref:L,class:"modal-header",style:De.value},[n.slots.headerTemplate?n.slots.headerTemplate():t.createVNode("div",{class:"modal-title"},[w.value&&t.createVNode("span",{class:v.value,style:"margin-right: 8px"},null),t.createVNode("span",{class:"modal-title-label"},[O.value])]),t.createVNode("div",{class:"actions"},[Ge()])])}function Je(){return n.slots.footerTemplate?n.slots.footerTemplate():z.value&&$e()}function Ze(o){if(o.stopPropagation(),e.allowClickMaskToClose){if(o.target!==S.value)return;B(o,!1)}}function Qe(){var o,C;return t.createVNode("div",{id:s.value,class:je.value,style:Le.value,ref:m},[t.createVNode("div",{class:We.value},[f.value&&_e(),t.createVNode("div",{class:Ue.value},[(C=(o=n.slots).default)==null?void 0:C.call(o),b.value==="iframe"&&t.createVNode("iframe",{title:s.value,class:"f-utils-fill",width:"100%",frameborder:"0",src:g.value},null)]),Je()]),!u.value&&m.value&&!I.value&&_(m.value)])}function et(o){return o||"body"}return t.watchEffect(()=>{Q.value&&(re.value=J.getMaxZIndex()||1050)}),()=>t.createVNode(t.Teleport,{to:et(e.host)},{default:()=>[Q.value&&t.createVNode(t.Transition,{name:"fade",appear:!0},{default:()=>[t.createVNode("div",{ref:S,class:Re.value,style:Fe.value,onClick:Ze},[Qe()])]})]})}});function le(e){if(e.content&&e.content.render)return e.content.render;if(e.render&&typeof e.render=="function")return e.render}function Me(e){const n=document.createElement("div");n.style.display="contents";const a=t.createApp({setup(l,i){t.onUnmounted(()=>{document.body.removeChild(n)});const s=t.ref(),c=t.ref(e.class||""),u=t.ref(!!e.showButtons),f=t.ref(!!e.showHeader),v=t.ref(e.showCloseButton==null?!0:e.showCloseButton),y=t.ref(!0),p=t.ref(e.title||""),M=e.acceptCallback||(()=>{}),b=e.rejectCallback||(()=>{}),g=e.closedCallback||(S=>{}),x=e.resizeHandle||(S=>{}),T=e.stopMoveHandle||(S=>{}),O=le(e),P=S=>{y.value=!1,a.unmount(),g(S)};return t.onMounted(()=>{}),i.expose({modalRef:s}),()=>t.createVNode(Z,{ref:s,class:c.value,modelValue:y.value,"onUpdate:modelValue":S=>y.value=S,title:p.value,width:e.width,height:e.height,buttons:e.buttons,"show-header":f.value,"show-buttons":u.value,"show-close-button":v.value,"show-max-button":!1,onAccept:M,onCancel:b,fitContent:e.fitContent==null?!0:e.fitContent,onClosed:P,onResize:x,onStopMove:T},{default:()=>[O&&O(a)]})}});return document.body.appendChild(n),a.use(q.LocaleService.i18n),a.mount(n),a}class ke{constructor(n){$(this,"appContext",null);$(this,"modalRef",t.ref());$(this,"activeModalIndex",t.ref(0));$(this,"modalRefs",{});$(this,"isUseEscCloseModal",t.ref(!1));$(this,"activeModalInstance",t.computed(()=>this.modalRefs[this.activeModalIndex.value]));this.app=n,this.appContext=n?n._context:null}getCurrentModal(){return this.activeModalInstance.value}adaptToWindow(n,a){const{width:l,height:i}={width:window.innerWidth,height:window.innerHeight};return l<n&&(n=l-14),i<a&&(a=i-14),{width:n,height:a}}static show(n){const a=Object.assign({title:"",showButtons:!0,showHeader:!0},n);return Me(a)}close(n){var a,l;n?(l=n.value)==null||l.close():(a=this.getCurrentModal())==null||a.close()}open(n){const a=document.createDocumentFragment();n.showMaxButton&&n.fitContent&&(n.showMaxButton=!1);const l=t.shallowRef(Object.assign({title:"",showButtons:!0,showHeader:!0},n)),i=t.ref(!0),s=l.value.acceptCallback||(()=>{}),c=l.value.rejectCallback||(()=>{}),u=l.value.closedCallback||((B,N)=>{}),f=l.value.resizeHandle||(B=>{}),v=n.stopMoveHandle||(B=>{});let y;const p=le(l.value),M=B=>{var d;i.value=!1;const N=(d=B==null?void 0:B.target)==null?void 0:d.classList.contains("modal_close");u(B,this.isUseEscCloseModal.value?"esc":N?"icon":"button")},b=B=>{M(B),y&&t.nextTick(()=>{if(this.modalRefs[this.activeModalIndex.value]&&delete this.modalRefs[this.activeModalIndex.value],t.render(null,a),y=null,this.modalRef.value=null,this.modalRefs){const N=Object.keys(this.modalRefs).map(d=>Number(d));N.length>0?this.activeModalIndex.value=Math.max(...N):this.activeModalIndex.value=0}this.isUseEscCloseModal.value=!1})},g=B=>{var N;this.isUseEscCloseModal.value=!0,this.activeModalInstance&&((N=this.activeModalInstance.value)==null||N.close(B==null?void 0:B.event))},{width:x,height:T}=l.value,O=this.adaptToWindow(x||500,T||320);Object.assign(l.value,O);const P=()=>t.createVNode(Z,t.mergeProps({ref:this.modalRef,modelValue:i.value,"onUpdate:modelValue":B=>i.value=B},l.value,{isMessager:l.value.class&&l.value.class.indexOf("modal-message")>-1,onAccept:s,onCancel:c,onClosed:b,onResize:f,onEsc:g,onStopMove:v}),{default:()=>[p&&p(this.app)]});return y=(B=>{const N=t.h(P,B);return N.appContext=this.appContext,t.render(N,a),N})({...l.value}),this.activeModalIndex.value++,this.modalRefs[this.activeModalIndex.value]=this.modalRef.value,{update:B=>{l.value={...l.value,...B},y&&t.render(t.cloneVNode(y,{...l}),a)},destroy:b,modalRef:this.activeModalInstance,close:()=>this.close()}}}const oe=Symbol("FModalService");Z.install=e=>{e.component(Z.name,Z);const n=new ke(e);e.provide(oe,n),e.provide("FModalService",n)};function ue(e,n){function a(){const l=e.beforeOpen||e.beforeClickButton||null;let i=Promise.resolve(!0);if(l){const s=l(n.value);if(typeof s>"u")return i;typeof s=="boolean"?i=Promise.resolve(s):i=s}return i}return{judgeCanOpen:a}}function Te(e,n,a,l,i){const s=t.ref(e.buttonBehavior),c=t.ref(e.popupOnInput),u=t.computed(()=>({"input-group-append":!0,"append-force-show":e.showButtonWhenDisabled&&(e.readonly||e.disable)})),{judgeCanOpen:f}=ue(e,i),v=t.computed(()=>e.showButtonWhenDisabled||(!e.editable||!e.readonly)&&!e.disable),y=t.inject(oe,null),p=t.ref();async function M(x){if(await f()&&v.value){const T=!!n.slots.default;if(s.value==="Modal"){const O=e.modalOptions,P=y==null?void 0:y.open({...O,render:()=>n.slots.default&&n.slots.default()});p.value=P==null?void 0:P.modalRef}s.value==="Overlay"&&pe.show({host:document.body,backgroundColor:"rgba(0,0,0,.15)",render:()=>n.slots.default&&n.slots.default()}),T&&s.value==="Popup"&&l.togglePopup(!0),T&&c.value&&l.hidePopup(),n.emit("clickButton",{origin:x,value:e.modelValue})}}function b(x){n.emit("mouseEnterIcon",x)}function g(x){n.emit("mouseLeaveIcon",x)}return{buttonGroupClass:u,onClickButton:M,onMouseEnterButton:b,onMouseLeaveButton:g,modalRef:p}}function Ee(e,n,a,l,i,s){const c=t.ref(!1),u=t.computed(()=>e.enableClear&&!e.readonly&&!e.disable),{changeTextBoxValue:f,hasClearClass:v}=s;function y(g){c.value=g,v.value=g}t.watch(i,()=>{y(!!i.value)});function p(g){const x=!e.readonly&&!e.disable&&e.editable,T=!e.editable;g.stopPropagation(),(x||T)&&(f(""),i.value="",y(!c.value),n.emit("clear"))}function M(g){if(u.value){if(!a.value){y(!1);return}!e.disable&&!e.readonly&&y(!0)}}function b(g){u.value&&y(!1)}return{enableClearButton:u,showClearButton:c,onClearValue:p,onMouseEnterTextBox:M,onMouseLeaveTextBox:b}}function Ve(e,n,a,l,i){const s=t.computed(()=>e.popupOnInput),c=t.computed(()=>e.popupOnFocus),{shouldPopupContent:u,closeAllPopover:f}=i,v=t.ref(!1),y=t.computed(()=>e.enableTitle?a.value:""),p=t.computed(()=>(e.disable||e.readonly)&&!e.forcePlaceholder?"":e.placeholder),M=t.computed(()=>e.readonly||!e.editable),b=t.ref(!1),g=t.computed(()=>!e.disable&&b.value),x=t.computed(()=>({"text-left":e.textAlign==="left","text-center":e.textAlign==="center","text-right":e.textAlign==="right","form-control":!0,"f-utils-fill":!0})),T=t.computed(()=>({"input-group":!0,"f-state-disabled":e.disable,"f-state-editable":e.editable&&!e.disable&&!e.readonly,"f-state-readonly":e.readonly,"f-state-focus":g.value,"input-group--has-clear":e.enableClear&&v.value}));function O(m,I=!0){a.value=m,I&&(n.emit("change",m),n.emit("update:modelValue",m))}function P(m){u.value=!1,O(m,!0)}t.watch(()=>e.modelValue,m=>{a.value=m});function S(m){b.value=!1,n.emit("blur",m),m.stopPropagation()}function D(m){n.emit("click",m),f(),n.slots.default&&!e.disable&&!e.readonly&&e.popupOnClick&&i.togglePopup()}function B(m){!e.disable&&!e.readonly&&(b.value=!0,M.value||(n.emit("focus",m),c.value&&!u.value&&i.popup()))}function N(m){n.emit("input",m);const I=m.target.value;l.value=I,a.value!==I&&O(I,e.updateOn==="change"),s.value&&!u.value&&i.popup()}function d(m){m.target.tagName!=="INPUT"&&m.preventDefault(),m.stopPropagation()}function w(m){n.emit("keydown",m)}function z(m){m.key==="Enter"&&(s.value||c.value)&&i.hidePopup(),n.emit("keyup",m)}function L(m){const I=m.target.value;m.stopPropagation(),O(I)}return{hasFocusedTextBox:g,isTextBoxReadonly:M,textBoxClass:x,textBoxPlaceholder:p,textBoxTitle:y,inputGroupClass:T,hasClearClass:v,changeTextBoxValue:O,commitValue:P,onBlurTextBox:S,onClickTextBox:D,onFocusTextBox:B,onInput:N,onKeyDownTextBox:w,onKeyUpTextBox:z,onMouseDownTextBox:d,onTextBoxValueChange:L}}const Y="FarrisVue_PopoverInstancesKey";function Oe(e,n,a,l){const i=t.ref(),s=t.ref(!1),{judgeCanOpen:c}=ue(e,l);t.watch(()=>i.value,(b,g)=>{window[Y]=window[Y]||new WeakMap,b?window[Y].set(a.value,b):window[Y].delete(a.value)});function u(){if(window[Y]){const b=window[Y];document.querySelectorAll(".f-button-edit,.v-popover").forEach(g=>{const x=b.get(g);x&&g!==a.value&&!a.value.closest(".popover-fitcontent")&&x.hide()})}}function f(){const b=i.value;b&&b.show(a.value)}async function v(b=!1){if(!!n.slots.default){if(!b&&!s.value&&!await c())return;s.value=!s.value,s.value&&(await t.nextTick(),f())}}async function y(b=!1){if(!!n.slots.default){if(!b&&!await c())return;s.value=!0,await t.nextTick(),f()}}function p(){s.value=!1}function M(){s.value=!0,t.nextTick(()=>{f()})}return{hidePopup:p,showPopup:M,popup:y,shouldPopupContent:s,togglePopup:v,popoverRef:i,closeAllPopover:u}}function Pe(e,n,a){const l=t.ref(),{isTextBoxReadonly:i,textBoxClass:s,textBoxPlaceholder:c,textBoxTitle:u,onBlurTextBox:f,onClickTextBox:v,onFocusTextBox:y,onInput:p,onKeyDownTextBox:M,onKeyUpTextBox:b,onMouseDownTextBox:g,onTextBoxValueChange:x}=a,T=t.ref(e.id),{uuid:O}=J.useGuid(),P=t.computed(()=>({}));t.onMounted(()=>{var d,w;e.selectOnCreated&&((d=l.value)==null||d.select()),e.focusOnCreated&&((w=l.value)==null||w.focus({preventScroll:!0})),T.value||(T.value="button-edit_"+O(8)),T.value=T.value+"-textbox"});const S=t.ref(!1),D=d=>{d.preventDefault(),S.value=!0},B=d=>{d.preventDefault(),S.value=!1,p(d)};function N(d){S.value||p(d)}return()=>t.createVNode("input",{id:e.id?e.id+"-textbox":void 0,ref:l,name:"input-group-value",autocomplete:e.autoComplete?"on":"off",class:s.value,style:P.value,disabled:e.disable,maxlength:e.maxLength,minlength:e.minLength,placeholder:c.value,readonly:i.value,tabindex:e.tabIndex,title:u.value,type:e.inputType,value:n.value,onBlur:f,onChange:x,onClick:v,onFocus:y,onInput:N,onKeydown:M,onKeyup:b,onMousedown:g,onCompositionend:B,onCompositionstart:D},null)}function Se(e,n,a){const l=t.ref(e.separator),i=t.computed(()=>e.readonly||e.disable),{changeTextBoxValue:s,onFocusTextBox:c,onBlurTextBox:u,onClickTextBox:f,textBoxPlaceholder:v}=a,y=t.computed(()=>n.value?n.value.split(l.value).map(g=>({name:g,selectable:!0})):[]);function p(g){s(g.map(x=>x.name).join(l.value),!0)}t.watch(()=>e.separator,g=>{l.value=g});const M=t.ref(!e.disable&&!e.readonly);t.watch([()=>e.disable,()=>e.readonly],([g,x],[T,O])=>{M.value=!g&&!x});function b(g){f(g)}return()=>t.createVNode(de,{tabindex:e.tabIndex,onFocus:c,onBlur:u,id:`${e.id}-tag-editor`,class:"form-control",placeholder:v.value,data:y.value,showClose:!i.value,showInput:!0,disable:i.value,onChange:p,onClick:b},null)}function Ne(e,n,a,l){const{buttonGroupClass:i,onClickButton:s,onMouseEnterButton:c,onMouseLeaveButton:u}=a,{enableClearButton:f,showClearButton:v,onClearValue:y}=l,p=t.ref(),M=fe.debounce(g=>{s(g)},e.buttonBehavior==="Modal"?0:200),b=()=>{n.emit("beforeClearValue")};return{renderButtonGroup:()=>t.createVNode("div",{id:e.id?`${e.id}-button-group`:void 0,class:i.value},[f.value&&t.withDirectives(t.createVNode("span",{class:"input-group-text input-group-clear",onClick:y,onMousedown:b},[t.createVNode("i",{class:"f-icon modal_close"},null)]),[[t.vShow,v.value]]),n.slots.buttonContent?t.createVNode("span",{class:"input-group-text input-group-append-button",onClick:M,onMouseenter:c,onMouseleave:u},[n.slots.buttonContent()]):e.buttonContent?t.createVNode("span",{class:"input-group-text input-group-append-button",innerHTML:e.buttonContent,ref:p,onClick:g=>M(g),onMouseenter:c,onMouseleave:u},null):null]),buttonHandleElement:p}}function ze(e,n,a){const l=t.ref(e.popupMinWidth),{hidePopup:i,popoverRef:s}=a,c=()=>{n.emit("shown")};return()=>t.createVNode(he,{id:`${e.id}-popover`,ref:s,placement:e.placement,host:e.popupHost,"keep-width-with-reference":e.keepWidthWithReference,fitContent:!0,"right-boundary":e.popupRightBoundary,minWidth:l.value,class:e.popupClass,offsetX:e.popupOffsetX,onHidden:i,onShown:c,beforeClose:e.beforeClosePopup,limitContentBySpace:e.limitContentBySpace},{default:()=>{var u,f;return[(f=(u=n.slots).default)==null?void 0:f.call(u)]}})}const ie=t.defineComponent({name:"FButtonEdit",props:ne,emits:["updateExtendInfo","clear","change","click","clickButton","blur","focus","mouseEnterIcon","mouseLeaveIcon","keyup","keydown","inputClick","input","update:modelValue","beforeClearValue"],setup(e,n){const a=t.ref(),l=t.ref(e.customClass),i=t.ref(e.modelValue),s=Oe(e,n,a,i),{shouldPopupContent:c,hidePopup:u,showPopup:f,togglePopup:v}=s,y=Te(e,n,a,s,i),p=t.ref(""),M=Ve(e,n,i,p,s),{hasFocusedTextBox:b,commitValue:g,inputGroupClass:x}=M,T=Ee(e,n,i,b,p,M),{onMouseEnterTextBox:O,onMouseLeaveTextBox:P}=T,S=t.ref(!1),D=t.computed(()=>{const E={"f-button-edit":!0,"f-cmp-inputgroup":!0,"f-button-edit-nowrap":!e.wrapText};return l.value&&l.value.split(" ").reduce((F,r)=>(F[r]=!0,F),E),E}),B=t.computed(()=>({overflow:e.wrapText?"hidden":""})),N=t.computed(()=>({}));function d(){if(!e.multiSelect||e.inputType!=="tag"||!a.value)return 0;let E=0;const F=Array.from(a.value.querySelectorAll(".farris-tag-item"));return F&&F.length&&(E=F.map(r=>r.offsetTop).filter(r=>r>20).length),E}const w=t.ref(d());t.onUpdated(()=>{w.value=d()});function z(){return e.multiSelect&&e.inputType==="tag"?()=>t.createVNode(t.Fragment,null,[Se(e,i,M)(),!!w.value&&t.createVNode("div",{class:"d-flex flex-row mr-2 more-tags","more-tags":!0},[t.createVNode("span",{class:"multi--more-text"},[t.createTextVNode("+"),w.value])])]):Pe(e,i,M)}let L=z();t.watch([()=>e.multiSelect,()=>e.inputType],()=>{L=z()});const{renderButtonGroup:m,buttonHandleElement:I}=Ne(e,n,y,T),_=ze(e,n,s),U=t.ref(c.value),G={displayText:p,commitValue:g,elementRef:a,hidePopup:u,showPopup:f,popoverRef:s.popoverRef,shouldPopupContent:c,togglePopup:v,openDialog:()=>{I.value&&e.buttonBehavior==="Modal"&&I.value.click()},getModal:()=>{var E;return e.buttonBehavior==="Modal"?(E=y.modalRef.value)==null?void 0:E.value:null},getTextbox:()=>{var E;return(E=a.value)==null?void 0:E.querySelector("input")},forceClosePopup:()=>{U.value=!1,S.value=!0,c.value=!1}};return t.onMounted(()=>{a.value.componentInstance=G,window.onresize=()=>{document.body.click()}}),t.onBeforeUnmount(()=>{var E;window.onresize=null,(E=window[Y])==null||E.delete(a.value)}),n.expose(G),t.watch(()=>c.value,async(E,F)=>{if(S.value){U.value=E,S.value=!1;return}if(!E&&e.beforeClosePopup&&typeof e.beforeClosePopup=="function"){try{const r=await e.beforeClosePopup();U.value=!r,(!r||e.readonly)&&(c.value=!0)}catch(r){console.error("Error in beforeClosePopup:",r),U.value=F,c.value=F}return}U.value=E}),()=>{var E,F;return t.createVNode(t.Fragment,null,[t.createVNode("div",t.mergeProps(n.attrs,{ref:a,class:D.value,id:e.id?e.id:void 0,style:B.value}),[t.createVNode("div",{id:e.id?`${e.id}-input-group`:void 0,class:x.value,style:N.value,onMouseenter:O,onMouseleave:P},[(F=(E=n.slots).precontent)==null?void 0:F.call(E),L(),m()])]),U.value&&_()])}}}),Ie=J.withInstall(ie);H.FButtonEdit=ie,H.buttonEditProps=ne,H.default=Ie,Object.defineProperties(H,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(H,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("../locale/index.umd.js"),require("../common/index.umd.js"),require("../property-panel/index.umd.js"),require("../tags/index.umd.js"),require("lodash-es"),require("../popover/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../locale/index.umd.js","../common/index.umd.js","../property-panel/index.umd.js","../tags/index.umd.js","lodash-es","../popover/index.umd.js"],t):(H=typeof globalThis<"u"?globalThis:H||self,t(H["button-edit"]={},H.Vue,H.locale,H.common,null,H.FTags,H.LodashES,H.FPopover))})(this,function(H,t,q,J,at,de,fe,he){"use strict";var tt=Object.defineProperty;var nt=(H,t,q)=>t in H?tt(H,t,{enumerable:!0,configurable:!0,writable:!0,value:q}):H[t]=q;var $=(H,t,q)=>nt(H,typeof t!="symbol"?t+"":t,q);const ne={id:{type:String,default:""},buttonContent:{type:String,default:'<i class="f-icon f-icon-lookup"></i>'},buttonBehavior:{type:String,default:"Popup"},autoComplete:{type:Boolean,default:!1},customClass:{type:String,default:""},disable:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},enableClear:{type:Boolean,default:!1},modelValue:{type:String,default:""},readonly:{type:Boolean,default:!1},showButtonWhenDisabled:{type:Boolean,default:!1},enableTitle:{type:Boolean,default:!1},inputType:{type:String,default:"text"},forcePlaceholder:{type:Boolean,default:!1},placeholder:{type:String,default:""},minLength:Number,maxLength:{type:Number},tabIndex:Number,popupHost:{type:Object},popupRightBoundary:{type:Object},popupOffsetX:{type:Object},popupOnInput:{type:Boolean,default:!1},popupOnFocus:{type:Boolean,default:!1},popupOnClick:{type:Boolean,default:!1},popupClass:{type:String,default:""},popupMinWidth:{type:Number,default:160},modalOptions:{type:Object,default:{}},wrapText:{type:Boolean,default:!1},multiSelect:{type:Boolean,default:!1},separator:{type:String,default:","},textAlign:{type:String,default:"left"},beforeClickButton:{type:Function,default:null},focusOnCreated:{type:Boolean,default:!1},selectOnCreated:{type:Boolean,default:!1},beforeOpen:{type:Function,default:null},updateOn:{type:String,default:"change"},keepWidthWithReference:{type:Boolean,default:!0},placement:{type:String,default:"bottom-left"},limitContentBySpace:{type:Boolean,default:!1},beforeClosePopup:{type:Function,default:null}},me={popupContentPosition:{type:Object,default:{left:0,top:0}},host:{type:Object},backgroundColor:{type:String,default:""}},ve=t.defineComponent({name:"FOverlay",props:me,emits:["click"],setup(e,n){const a=t.ref(e.popupContentPosition),l=t.ref(e.host),i=t.computed(()=>({backgroundColor:e.backgroundColor||"",pointerEvents:"auto"}));function s(u){n.emit("click"),u.preventDefault(),u.stopPropagation()}t.computed(()=>{const u=l.value;if(u){const f=u.getBoundingClientRect(),{left:v,top:y,height:p}=f;return{left:v,top:y+p}}return a.value});const c=t.computed(()=>({}));return()=>t.createVNode(t.Teleport,{to:"body"},{default:()=>{var u,f;return[t.createVNode("div",{class:"overlay-container",onClick:v=>s(v),style:i.value},[t.createVNode("div",{style:c.value},[(f=(u=n.slots).default)==null?void 0:f.call(u)])])]}})}});function ge(e){if(e.content&&e.content.render)return e.content.render;if(e.render&&typeof e.render=="function")return e.render}function ye(e){const n=document.createElement("div");n.style.display="contents";let a;const l=e.onClickCallback||(()=>{}),i=()=>{l(),a&&a.unmount()};return a=t.createApp({setup(){t.onUnmounted(()=>{document.body.removeChild(n)});const s=ge(e);return()=>t.createVNode(ve,{"popup-content-position":e.popupPosition,host:e.host,onClick:i,backgroundColor:e.backgroundColor},{default:()=>[s&&s()]})}}),document.body.appendChild(n),a.mount(n),a}class pe{static show(n){return ye(n)}}const be={allowClickMaskToClose:{type:Boolean,default:!1},beforeClose:{type:Function,default:()=>!0},class:{type:String,default:""},maskClass:{type:String,default:""},title:{type:String,default:""},width:{type:Number,default:500},height:{type:Number,default:320},buttons:{type:Array,default:[]},modelValue:{type:Boolean,default:!1},mask:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!0},fitContent:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0},showMaxButton:{type:Boolean,default:!1},minHeight:{type:Number},maxHeight:{type:Number},minWidth:{type:Number},maxWidth:{type:Number},containment:{type:Object,default:null},resizeable:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},dragHandle:{type:Object,default:null},closedCallback:{type:Function,default:null},resizeHandle:{type:Function,default:null},render:{type:Function,default:null},acceptCallback:{type:Function,default:null},rejectCallback:{type:Function,default:null},enableEsc:{type:Boolean,default:!0},enableEnter:{type:Boolean,default:!1},dialogType:{type:String,default:""},src:{type:String,default:""},footerHeight:{type:Number,default:60},host:{type:Object,default:"body"},isMessager:{type:Boolean,default:!1}};class R{constructor(n,a){this.x=n,this.y=a}static getTransformInfo(n){const l=window.getComputedStyle(n).getPropertyValue("transform").replace(/[^-\d,]/g,"").split(",");if(l.length>=6){const i=parseInt(l[4],10),s=parseInt(l[5],10);return{x:i,y:s}}return{x:0,y:0}}static fromEvent(n,a=null){if(this.isMouseEvent(n))return new R(n.clientX,n.clientY);if(a===null||n.changedTouches.length===1)return new R(n.changedTouches[0].clientX,n.changedTouches[0].clientY);for(let l=0;l<n.changedTouches.length;l++)if(n.changedTouches[l].target===a)return new R(n.changedTouches[l].clientX,n.changedTouches[l].clientY)}static isMouseEvent(n){return Object.prototype.toString.apply(n).indexOf("MouseEvent")===8}static isIPosition(n){return!!n&&"x"in n&&"y"in n}static getCurrent(n){const a=new R(0,0);if(window){const l=window.getComputedStyle(n);if(l){const i=parseInt(l.getPropertyValue("left"),10),s=parseInt(l.getPropertyValue("top"),10);a.x=isNaN(i)?0:i,a.y=isNaN(s)?0:s}return a}return null}static copy(n){return new R(0,0).set(n)}get value(){return{x:this.x,y:this.y}}add(n){return this.x+=n.x,this.y+=n.y,this}subtract(n){return this.x-=n.x,this.y-=n.y,this}multiply(n){this.x*=n,this.y*=n}divide(n){this.x/=n,this.y/=n}reset(){return this.x=0,this.y=0,this}set(n){return this.x=n.x,this.y=n.y,this}}class K{constructor(n,a){this.width=n,this.height=a}static getCurrent(n){const a=new K(0,0);if(window){const l=window.getComputedStyle(n);return l&&(a.width=parseInt(l.getPropertyValue("width"),10),a.height=parseInt(l.getPropertyValue("height"),10)),a}return null}static copy(n){return new K(0,0).set(n)}set(n){return this.width=n.width,this.height=n.height,this}}function we(e,n){const a=t.ref(),l=t.ref(),i=t.ref(),s=t.ref(),c=t.ref(),u=t.ref(),f=t.ref(),v=t.ref(),y=t.ref(),p=t.ref(),M=t.ref(),b=t.ref(e.resizeable),g=t.ref(),x=t.ref(e.draggable),T=t.ref(!1);function O(){const r=l.value||document.body,h=window.getComputedStyle(r);if(!h||!a.value)return;const V=R.getTransformInfo(a.value),k={};f.value&&(k.deltaL=a.value.offsetLeft-f.value.x,k.deltaT=a.value.offsetTop-f.value.y);const j=h.getPropertyValue("position");k.width=r.clientWidth,k.height=r.clientHeight,k.pr=parseInt(h.getPropertyValue("padding-right"),10),k.pb=parseInt(h.getPropertyValue("padding-bottom"),10),k.position=h.getPropertyValue("position"),j==="static"&&(r.style.position="relative"),k.translateX=V.x,k.translateY=V.y,p.value=k}function P(r){if(a.value){s.value=K.getCurrent(a.value),c.value=R.getCurrent(a.value),u.value=s.value?K.copy(s.value):null,f.value=c.value?R.copy(c.value):null,O();const h=r.target.getAttribute("type")||"";v.value={n:!!h.match(/n/),s:!!h.match(/s/),w:!!h.match(/w/),e:!!h.match(/e/)}}}function S(){var r,h,V,k;if(a.value){const j=a.value;v.value&&((v.value.n||v.value.s)&&((r=u.value)!=null&&r.height)&&(j.style.height=u.value.height+"px"),(v.value.w||v.value.e)&&((h=u.value)!=null&&h.width)&&(j.style.width=u.value.width+"px"),f.value&&((V=f.value)!=null&&V.x&&(j.style.left=f.value.x+"px"),(k=f.value)!=null&&k.y&&(j.style.top=f.value.y+"px")))}}function D(){const r=e.minHeight?e.minHeight:1,h=e.minWidth?e.minWidth:1;u.value&&f.value&&v.value&&s.value&&(u.value.height<r&&(u.value.height=r,v.value.n&&c.value&&(f.value.y=c.value.y+(s.value.height-r))),u.value.width<h&&(u.value.width=h,v.value.w&&c.value&&(f.value.x=c.value.x+(s.value.width-h))),e.maxHeight&&u.value.height>e.maxHeight&&(u.value.height=e.maxHeight,c.value&&v.value.n&&(f.value.y=c.value.y+(s.value.height-e.maxHeight))),e.maxWidth&&u.value.width>e.maxWidth&&(u.value.width=e.maxWidth,v.value.w&&c.value&&(f.value.x=c.value.x+(s.value.width-e.maxWidth))))}function B(){if(l.value){const r=p.value;if(f.value&&u.value&&v.value&&s.value){const h=r.width-r.pr-r.deltaL-r.translateX-f.value.x,V=r.height-r.pb-r.deltaT-r.translateY-f.value.y;v.value.n&&f.value.y+r.translateY<0&&c.value&&(f.value.y=-r.translateY,u.value.height=s.value.height+c.value.y+r.translateY),v.value.w&&f.value.x+r.translateX<0&&c.value&&(f.value.x=-r.translateX,u.value.width=s.value.width+c.value.x+r.translateX),u.value.width>h&&(u.value.width=h),u.value.height>V&&(u.value.height=V)}}}function N(r){if(!i.value||!s.value||!c.value||!v.value)return;r.subtract(i.value);const h=r.x,V=r.y;v.value.n?(f.value.y=c.value.y+V,u.value.height=s.value.height-V):v.value.s&&(u.value.height=s.value.height+V),v.value.e?u.value.width=s.value.width+h:v.value.w&&(u.value.width=s.value.width-h,f.value.x=c.value.x+h),B(),D(),S()}function d(r){if(!y.value)return;const h=R.fromEvent(r);h&&N(h)}function w(){if(a.value){const{width:r,height:h,x:V,y:k}=a.value.getBoundingClientRect(),j=R.getTransformInfo(a.value);return{size:{width:r,height:h},position:{x:V-j.x,y:k-j.y}}}return null}function z(r){if(a.value){const h=w();M.value=h}i.value=void 0,s.value=null,c.value=null,u.value=null,f.value=null,v.value=null,y.value=null,document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",z)}function L(){document.addEventListener("mousemove",d),document.addEventListener("mouseup",z)}function m(r){r instanceof MouseEvent&&r.button===2||x.value&&(document.body.click(),r.stopPropagation(),r.preventDefault(),i.value=R.fromEvent(r),y.value=r.target,P(r),L())}function I(r){return a.value=r,b.value&&t.createVNode(t.Fragment,null,[t.createVNode("div",{class:"fv-resizable-handle fv-resizable-n",type:"n",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-e",type:"e",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-s",type:"s",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-w",type:"w",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-ne",type:"ne",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-se fv-resizable-diagonal",type:"se",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-sw",type:"sw",onMousedown:h=>m(h)},null),t.createVNode("div",{class:"fv-resizable-handle fv-resizable-nw",type:"nw",onMousedown:h=>m(h)},null)])}function _(r=!0){document.body.click();const h=l.value||document.body,V=K.getCurrent(h),k=a.value;r&&k&&(g.value=w(),g.value.transform=k.style.transform),V&&k&&(u.value=V,u.value.height-=14,u.value.width-=14,k.style.height=u.value.height+"px",k.style.width=u.value.width+"px",k.style.left="7px",k.style.top="7px",k.style.transform="",M.value={size:u.value,position:{x:0,y:0}},x.value=!1,T.value=!0)}function U(){var r,h;if(document.body.click(),g.value){const V={width:g.value.size.width||0,height:g.value.size.height||0},k={x:(window.innerWidth-V.width)/2,y:(window.innerHeight-V.height)/2};(r=u.value)==null||r.set(V),(h=f.value)==null||h.set(k);const j=a.value;j.style.height=V.height+"px",j.style.width=V.width+"px",j.style.left=`${k.x}px`,j.style.top=`${k.y}px`,j.style.transform="",M.value={size:V,position:k},x.value=e.draggable,T.value=!1}}function G(){if(a.value){const r=K.getCurrent(a.value);if(r){const{width:h,height:V}=r;a.value.style.left=`${(window.innerWidth-h)/2}px`,a.value.style.top=`${(window.innerHeight-V)/2}px`,a.value.style.transform=""}}}function E(){const r=()=>{T.value?_(!1):G(),document.body.click()};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}}const F=E();return{renderResizeBar:I,boundingElement:l,resizedEventParam:M,maximize:_,restore:U,allowDrag:x,isMaximized:T,unWindowResizeHandle:F,moveToCenter:G}}function Ce(e,n,a){const l=t.ref(),i=t.ref(e.draggable),s=t.ref(e.lockAxis),c=t.ref(),u=t.ref(),f=t.ref(!1),v=t.ref(new R(0,0)),y=t.ref(new R(0,0)),p=t.ref(new R(0,0)),M=t.ref(new R(0,0));t.watch(()=>a.value,d=>{c.value.style.cursor=d?"move":"default"});function b(d,w){if(w.tagName==="BUTTON")return!1;if(w===d)return!0;for(const z in w.children)if(Object.prototype.hasOwnProperty.call(w.children,z)&&b(d,w.children[z]))return!0;return!1}function g(){var L,m;let d=p.value.x+y.value.x,w=p.value.y+y.value.y;s.value==="x"?(d=((L=v.value)==null?void 0:L.x)||0,p.value.x=0):s.value==="y"&&(w=((m=v.value)==null?void 0:m.y)||0,p.value.y=0);const z=`translate3d(${Math.round(d)}px, ${Math.round(w)}px, 0px)`;l.value&&(l.value.style.transform=z),M.value.x=d,M.value.y=w}function x(){if(!u.value||!l.value)return null;const d=u.value.getBoundingClientRect(),w=l.value.getBoundingClientRect(),z={top:d.top<w.top,right:d.right>w.right,bottom:d.bottom>w.bottom,left:d.left<w.left};return z.top||(p.value.y-=w.top-d.top),z.bottom||(p.value.y-=w.bottom-d.bottom),z.right||(p.value.x-=w.right-d.right),z.left||(p.value.x-=w.left-d.left),g(),z}function T(d){d&&(v.value&&d.subtract(v.value),p.value.set(d),g(),x())}function O(d){f.value&&i.value&&(d.stopPropagation(),d.preventDefault(),T(R.fromEvent(d,c.value)))}function P(){var d;f.value&&(f.value=!1,y.value.add(p.value),p.value.reset(),(d=l.value)==null||d.classList.remove("ng-dragging"),n.emit("stopMove"),document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",P))}function S(){!f.value&&c.value&&(f.value=!0,c.value.classList.add("ng-dragging"),document.addEventListener("mousemove",O),document.addEventListener("mouseup",P))}function D(){if(l.value){const d=R.getTransformInfo(l.value);y.value.set(d);return}y.value.reset()}function B(d){if(!a.value||d instanceof MouseEvent&&d.button===2)return;const w=d.target||d.srcElement;c.value!==void 0&&w&&!b(w,c.value)||i.value!==!1&&(document.body.click(),d.stopPropagation(),d.preventDefault(),v.value=R.fromEvent(d,l.value),D(),S())}function N(d,w,z){if(i.value&&w){if(d)c.value=d;else if(e.dragHandle){if(e.dragHandle instanceof HTMLElement)c.value=e.dragHandle;else if(typeof e.dragHandle=="string"){const L=w.querySelector(e.dragHandle);L&&(c.value=L)}}l.value=w,u.value=z,c.value?(c.value.classList.add("ng-draggable"),c.value.addEventListener("mousedown",B)):i.value=!1}}return{registerDraggle:N,resetTranslate:D}}function ae(e,n){if(e){const a=l=>{l.key.toLowerCase()===e.toLowerCase()&&n({event:l,key:e})};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}}}function xe(e,n){const a=t.ref(e.enableEsc);let l=null;return a.value?(l=ae("Escape",i=>{n.emit("esc",{event:i.event,type:"esc"})}),{remove:l}):null}function Be(e,n){const a=t.ref(e.enableEnter);let l=null;return a.value?(l=ae("Enter",i=>{n.emit("enter",{event:i.event,type:"enter"})}),{remove:l}):null}const Z=t.defineComponent({name:"FModal",props:be,emits:["update:modelValue","accept","cancel","closed","resize","esc","enter","stopMove"],setup(e,n){const a=t.ref(e.width||300),l=t.ref(e.height||200),i=t.ref(e.modelValue),s=t.ref(""),c=t.ref(e.class),u=t.ref(e.fitContent),f=t.ref(e.showHeader),v=t.ref(""),y=t.ref(e.showCloseButton),p=t.ref(e.showMaxButton),M=t.ref(!1),b=t.ref(e.dialogType),g=t.ref(e.src),x=t.ref(""),T=t.ref(e.showButtons),O=t.ref(e.title),P=t.ref(e.containment||null),S=t.ref();O.value==="错误提示"&&(O.value=q.LocaleService.getLocaleValue("messageBox.errorTitle"));const D=t.ref(!1);function B(o,C){const A=C?"accept":"cancel";Promise.resolve().then(()=>{var W;return(W=e.beforeClose)==null?void 0:W.call(e,{closeType:A})}).then(W=>{W&&(i.value=!1,n.emit("update:modelValue",!1),C!=null&&n.emit(C?"accept":"cancel"),n.emit("closed",o))})}const N=[{name:"cancel",text:q.LocaleService.getLocaleValue("messageBox.cancel")||"取消",class:"btn btn-secondary",handle:o=>{B(o,!1)}},{name:"accept",text:q.LocaleService.getLocaleValue("messageBox.ok")||"确定",class:"btn btn-primary",handle:o=>{B(o,!0)}}],d=t.ref(e.buttons&&e.buttons.length?e.buttons:N),w=t.computed(()=>!!v.value),z=t.computed(()=>!!T.value&&!!d.value),L=t.ref(),m=t.ref(),I=t.ref(!1),{renderResizeBar:_,maximize:U,restore:G,boundingElement:E,resizedEventParam:F,allowDrag:r,unWindowResizeHandle:h,moveToCenter:V}=we(e),{registerDraggle:k}=Ce(e,n,r);function j(){return!!document.querySelectorAll(".farris-modal").length&&document.body.classList.contains("modal-open")}function He(){const o=document.querySelectorAll(".farris-modal").length;(!o||o-1<=0)&&document.body.classList.remove("modal-open"),S.value&&S.value.classList.remove("show")}t.watch(()=>e.title,(o,C)=>{o!==C&&(O.value=o)}),t.watch(()=>e.modelValue,(o,C)=>{o!==C&&(i.value=o,i.value&&e.draggable&&t.nextTick(()=>{m.value&&!P.value&&(P.value=m.value.parentElement,E.value=P.value,k(L.value,m.value,E.value),V())}),o||(P.value&&(P.value=null),He())),i.value?D.value=j():(I.value=!1,r.value=e.draggable)}),t.watch(()=>e.showHeader,(o,C)=>{o!==C&&(f.value=o)}),t.watch(()=>e.showButtons,(o,C)=>{o!==C&&(T.value=o)}),t.watch(()=>F.value,(o,C)=>{const A=o||{},W=C||{};JSON.stringify(A)!==JSON.stringify(W)&&n.emit("resize",{newSize:o,oldSize:C,isMaximized:I.value})}),t.watch([()=>e.width,()=>e.height],(o,C)=>{(o[0]!==C[0]||o[1]!==C[1])&&(a.value=o[0]||500,l.value=o[1]||600)}),t.watch(()=>e.class,(o,C)=>{c.value=o});const Q=t.computed(()=>(i.value&&document.body.classList.add("modal-open"),i.value)),Re=t.computed(()=>{var A;const o={modal:!0,"farris-modal":!0,fade:!0};o["f-modal-fitContent"]=!!u.value,o.show=!!Q.value;const C=(A=e.maskClass)==null?void 0:A.split(" ");return C==null||C.reduce((W,X)=>(W[X]=!0,W),o),o}),je=t.computed(()=>{var A;const o={"modal-dialog":!0},C=(A=c.value)==null?void 0:A.split(" ");return C==null||C.reduce((W,X)=>(W[X]=!0,W),o),o}),se=()=>J.isMobilePhone()&&!e.isMessager,Le=t.computed(()=>{const o=document.documentElement.clientWidth,C=document.documentElement.clientHeight,A=Math.min(a.value,o),W=u.value?"auto":`${Math.min(l.value,C-10)}px`,X={position:"absolute",top:`${(window.innerHeight-parseInt(W==="auto"?"0":W))/2}px`,left:`${(window.innerWidth-A)/2}px`,width:`${A}px`,height:W};return se()&&(X.top="0px",X.left="0px",X.width=`${window.innerWidth}px`,X.height=`${window.innerHeight}px`),e.mask||(X.pointerEvents="auto"),X}),re=t.ref(J.getMaxZIndex()||1050),Fe=t.computed(()=>{const o={display:"block",overflow:"hidden"};return e.mask||(o.pointerEvents="none",o.backgroundColor="transparent"),D.value&&(o.backgroundColor="transparent"),o.zIndex=re.value,o}),We=t.computed(()=>({"modal-content":!0,"modal-content-has-header":f.value,"is-mobile":se()})),De=t.computed(()=>{const o={display:f.value?"":"none"};return o["pointer-events"]=r.value?"auto":"none",o}),Ae=t.computed(()=>({"f-icon":!0,modal_maximize:!0,modalrevert:I.value})),Ue=t.computed(()=>({"modal-body":!0,"f-utils-flex-column":b.value==="iframe","f-utils-fill":!0}));function Xe(){return{height:`${e.footerHeight||60}px`}}const qe=t.computed(()=>{const o={textAlgin:x.value},C=Xe();return Object.assign(o,C)});function ce(o){if(o==null||o.stopPropagation(),I.value){I.value=!1,G();return}U(),I.value=!0}async function Ke(o,C){o.handle&&await o.handle(C,o)&&n.emit("closed",C)}function Ye(o){o.width&&(a.value=o.width),o.height&&(l.value=o.height),o.buttons&&(d.value=o.buttons),o.title&&(O.value=o.title)}let ee=null,te=null;t.onBeforeMount(()=>{D.value=j()}),t.onMounted(()=>{m.value&&!P.value&&(P.value=m.value.parentElement,E.value=P.value,k(L.value,m.value,E.value)),Q.value&&document.body.classList.add("modal-open"),ee=xe(e,n),te=Be(e,n)}),t.onUnmounted(()=>{h&&h(),ee&&ee.remove(),te&&te.remove()}),n.expose({modalElementRef:m,updateModalOptions:Ye,close:B,maxDialog:ce,isMaximized:I});function Ge(){return t.createVNode("ul",null,[M.value&&t.createVNode("li",{class:"f-btn-icon f-bare"},[t.createVNode("span",{class:"f-icon modal_minimize"},null)]),p.value&&t.createVNode("li",{onClick:ce,class:"f-btn-icon f-bare",style:"pointer-events: auto;"},[t.createVNode("span",{class:Ae.value},null)]),y.value&&t.createVNode("li",{class:"f-btn-icon f-bare",onClick:o=>B(o,!1),style:"pointer-events: auto;"},[t.createVNode("span",{class:"f-icon modal_close"},null)])])}function $e(){return t.createVNode("div",{class:"modal-footer",style:qe.value},[d.value&&d.value.map(o=>{const C=t.ref(o.disabled);return t.createVNode("button",{name:o.name,type:"button",disabled:C.value,class:o.class+(o.iconClass?" btn-icontext":""),onClick:A=>{Ke(o,A)}},[!!o.iconClass&&t.createVNode("i",{class:o.iconClass},null),o.text])})])}function _e(){return t.createVNode("div",{ref:L,class:"modal-header",style:De.value},[n.slots.headerTemplate?n.slots.headerTemplate():t.createVNode("div",{class:"modal-title"},[w.value&&t.createVNode("span",{class:v.value,style:"margin-right: 8px"},null),t.createVNode("span",{class:"modal-title-label"},[O.value])]),t.createVNode("div",{class:"actions"},[Ge()])])}function Je(){return n.slots.footerTemplate?n.slots.footerTemplate():z.value&&$e()}function Ze(o){if(o.stopPropagation(),e.allowClickMaskToClose){if(o.target!==S.value)return;B(o,!1)}}function Qe(){var o,C;return t.createVNode("div",{id:s.value,class:je.value,style:Le.value,ref:m},[t.createVNode("div",{class:We.value},[f.value&&_e(),t.createVNode("div",{class:Ue.value},[(C=(o=n.slots).default)==null?void 0:C.call(o),b.value==="iframe"&&t.createVNode("iframe",{title:s.value,class:"f-utils-fill",width:"100%",frameborder:"0",src:g.value},null)]),Je()]),!u.value&&m.value&&!I.value&&_(m.value)])}function et(o){return o||"body"}return t.watchEffect(()=>{Q.value&&(re.value=J.getMaxZIndex()||1050)}),()=>t.createVNode(t.Teleport,{to:et(e.host)},{default:()=>[Q.value&&t.createVNode(t.Transition,{name:"fade",appear:!0},{default:()=>[t.createVNode("div",{ref:S,class:Re.value,style:Fe.value,onClick:Ze},[Qe()])]})]})}});function le(e){if(e.content&&e.content.render)return e.content.render;if(e.render&&typeof e.render=="function")return e.render}function Me(e){const n=document.createElement("div");n.style.display="contents";const a=t.createApp({setup(l,i){t.onUnmounted(()=>{document.body.removeChild(n)});const s=t.ref(),c=t.ref(e.class||""),u=t.ref(!!e.showButtons),f=t.ref(!!e.showHeader),v=t.ref(e.showCloseButton==null?!0:e.showCloseButton),y=t.ref(!0),p=t.ref(e.title||""),M=e.acceptCallback||(()=>{}),b=e.rejectCallback||(()=>{}),g=e.closedCallback||(S=>{}),x=e.resizeHandle||(S=>{}),T=e.stopMoveHandle||(S=>{}),O=le(e),P=S=>{y.value=!1,a.unmount(),g(S)};return t.onMounted(()=>{}),i.expose({modalRef:s}),()=>t.createVNode(Z,{ref:s,class:c.value,modelValue:y.value,"onUpdate:modelValue":S=>y.value=S,title:p.value,width:e.width,height:e.height,buttons:e.buttons,"show-header":f.value,"show-buttons":u.value,"show-close-button":v.value,"show-max-button":!1,onAccept:M,onCancel:b,fitContent:e.fitContent==null?!0:e.fitContent,onClosed:P,onResize:x,onStopMove:T},{default:()=>[O&&O(a)]})}});return document.body.appendChild(n),a.use(q.LocaleService.i18n),a.mount(n),a}class ke{constructor(n){$(this,"appContext",null);$(this,"modalRef",t.ref());$(this,"activeModalIndex",t.ref(0));$(this,"modalRefs",{});$(this,"isUseEscCloseModal",t.ref(!1));$(this,"activeModalInstance",t.computed(()=>this.modalRefs[this.activeModalIndex.value]));this.app=n,this.appContext=n?n._context:null}getCurrentModal(){return this.activeModalInstance.value}adaptToWindow(n,a){const{width:l,height:i}={width:window.innerWidth,height:window.innerHeight};return l<n&&(n=l-14),i<a&&(a=i-14),{width:n,height:a}}static show(n){const a=Object.assign({title:"",showButtons:!0,showHeader:!0},n);return Me(a)}close(n){var a,l;n?(l=n.value)==null||l.close():(a=this.getCurrentModal())==null||a.close()}open(n){const a=document.createDocumentFragment();n.showMaxButton&&n.fitContent&&(n.showMaxButton=!1);const l=t.shallowRef(Object.assign({title:"",showButtons:!0,showHeader:!0},n)),i=t.ref(!0),s=l.value.acceptCallback||(()=>{}),c=l.value.rejectCallback||(()=>{}),u=l.value.closedCallback||((B,N)=>{}),f=l.value.resizeHandle||(B=>{}),v=n.stopMoveHandle||(B=>{});let y;const p=le(l.value),M=B=>{var d;i.value=!1;const N=(d=B==null?void 0:B.target)==null?void 0:d.classList.contains("modal_close");u(B,this.isUseEscCloseModal.value?"esc":N?"icon":"button")},b=B=>{M(B),y&&t.nextTick(()=>{if(this.modalRefs[this.activeModalIndex.value]&&delete this.modalRefs[this.activeModalIndex.value],t.render(null,a),y=null,this.modalRef.value=null,this.modalRefs){const N=Object.keys(this.modalRefs).map(d=>Number(d));N.length>0?this.activeModalIndex.value=Math.max(...N):this.activeModalIndex.value=0}this.isUseEscCloseModal.value=!1})},g=B=>{var N;this.isUseEscCloseModal.value=!0,this.activeModalInstance&&((N=this.activeModalInstance.value)==null||N.close(B==null?void 0:B.event))},{width:x,height:T}=l.value,O=this.adaptToWindow(x||500,T||320);Object.assign(l.value,O);const P=()=>t.createVNode(Z,t.mergeProps({ref:this.modalRef,modelValue:i.value,"onUpdate:modelValue":B=>i.value=B},l.value,{isMessager:l.value.class&&l.value.class.indexOf("modal-message")>-1,onAccept:s,onCancel:c,onClosed:b,onResize:f,onEsc:g,onStopMove:v}),{default:()=>[p&&p(this.app)]});return y=(B=>{const N=t.h(P,B);return N.appContext=this.appContext,t.render(N,a),N})({...l.value}),this.activeModalIndex.value++,this.modalRefs[this.activeModalIndex.value]=this.modalRef.value,{update:B=>{l.value={...l.value,...B},y&&t.render(t.cloneVNode(y,{...l}),a)},destroy:b,modalRef:this.activeModalInstance,close:()=>this.close()}}}const oe=Symbol("FModalService");Z.install=e=>{e.component(Z.name,Z);const n=new ke(e);e.provide(oe,n),e.provide("FModalService",n)};function ue(e,n){function a(){const l=e.beforeOpen||e.beforeClickButton||null;let i=Promise.resolve(!0);if(l){const s=l(n.value);if(typeof s>"u")return i;typeof s=="boolean"?i=Promise.resolve(s):i=s}return i}return{judgeCanOpen:a}}function Te(e,n,a,l,i){const s=t.ref(e.buttonBehavior),c=t.ref(e.popupOnInput),u=t.computed(()=>({"input-group-append":!0,"append-force-show":e.showButtonWhenDisabled&&(e.readonly||e.disable)})),{judgeCanOpen:f}=ue(e,i),v=t.computed(()=>e.showButtonWhenDisabled||(!e.editable||!e.readonly)&&!e.disable),y=t.inject(oe,null),p=t.ref();async function M(x){if(await f()&&v.value){const T=!!n.slots.default;if(s.value==="Modal"){const O=e.modalOptions,P=y==null?void 0:y.open({...O,render:()=>n.slots.default&&n.slots.default()});p.value=P==null?void 0:P.modalRef}s.value==="Overlay"&&pe.show({host:document.body,backgroundColor:"rgba(0,0,0,.15)",render:()=>n.slots.default&&n.slots.default()}),T&&s.value==="Popup"&&l.togglePopup(!0),T&&c.value&&l.hidePopup(),n.emit("clickButton",{origin:x,value:e.modelValue})}}function b(x){n.emit("mouseEnterIcon",x)}function g(x){n.emit("mouseLeaveIcon",x)}return{buttonGroupClass:u,onClickButton:M,onMouseEnterButton:b,onMouseLeaveButton:g,modalRef:p}}function Ee(e,n,a,l,i,s){const c=t.ref(!1),u=t.computed(()=>e.enableClear&&!e.readonly&&!e.disable),{changeTextBoxValue:f,hasClearClass:v}=s;function y(g){c.value=g,v.value=g}t.watch(i,()=>{y(!!i.value)});function p(g){const x=!e.readonly&&!e.disable&&e.editable,T=!e.editable;g.stopPropagation(),(x||T)&&(f(""),i.value="",y(!c.value),n.emit("clear"))}function M(g){if(u.value){if(!a.value){y(!1);return}!e.disable&&!e.readonly&&y(!0)}}function b(g){u.value&&y(!1)}return{enableClearButton:u,showClearButton:c,onClearValue:p,onMouseEnterTextBox:M,onMouseLeaveTextBox:b}}function Ve(e,n,a,l,i){const s=t.computed(()=>e.popupOnInput),c=t.computed(()=>e.popupOnFocus),{shouldPopupContent:u,closeAllPopover:f}=i,v=t.ref(!1),y=t.computed(()=>e.enableTitle?a.value:""),p=t.computed(()=>(e.disable||e.readonly)&&!e.forcePlaceholder?"":e.placeholder),M=t.computed(()=>e.readonly||!e.editable),b=t.ref(!1),g=t.computed(()=>!e.disable&&b.value),x=t.computed(()=>({"text-left":e.textAlign==="left","text-center":e.textAlign==="center","text-right":e.textAlign==="right","form-control":!0,"f-utils-fill":!0})),T=t.computed(()=>({"input-group":!0,"f-state-disabled":e.disable,"f-state-editable":e.editable&&!e.disable&&!e.readonly,"f-state-readonly":e.readonly,"f-state-focus":g.value,"input-group--has-clear":e.enableClear&&v.value}));function O(m,I=!0){a.value=m,I&&(n.emit("change",m),n.emit("update:modelValue",m))}function P(m){u.value=!1,O(m,!0)}t.watch(()=>e.modelValue,m=>{a.value=m});function S(m){b.value=!1,n.emit("blur",m),m.stopPropagation()}function D(m){n.emit("click",m),f(),n.slots.default&&!e.disable&&!e.readonly&&e.popupOnClick&&i.togglePopup()}function B(m){!e.disable&&!e.readonly&&(b.value=!0,M.value||(n.emit("focus",m),c.value&&!u.value&&i.popup()))}function N(m){n.emit("input",m);const I=m.target.value;l.value=I,a.value!==I&&O(I,e.updateOn==="change"),s.value&&!u.value&&i.popup()}function d(m){m.target.tagName!=="INPUT"&&m.preventDefault(),m.stopPropagation()}function w(m){n.emit("keydown",m)}function z(m){m.key==="Enter"&&(s.value||c.value)&&i.hidePopup(),n.emit("keyup",m)}function L(m){const I=m.target.value;m.stopPropagation(),O(I)}return{hasFocusedTextBox:g,isTextBoxReadonly:M,textBoxClass:x,textBoxPlaceholder:p,textBoxTitle:y,inputGroupClass:T,hasClearClass:v,changeTextBoxValue:O,commitValue:P,onBlurTextBox:S,onClickTextBox:D,onFocusTextBox:B,onInput:N,onKeyDownTextBox:w,onKeyUpTextBox:z,onMouseDownTextBox:d,onTextBoxValueChange:L}}const Y="FarrisVue_PopoverInstancesKey";function Oe(e,n,a,l){const i=t.ref(),s=t.ref(!1),{judgeCanOpen:c}=ue(e,l);t.watch(()=>i.value,(b,g)=>{window[Y]=window[Y]||new WeakMap,b?window[Y].set(a.value,b):window[Y].delete(a.value)});function u(){if(window[Y]){const b=window[Y];document.querySelectorAll(".f-button-edit,.v-popover").forEach(g=>{const x=b.get(g);x&&g!==a.value&&!a.value.closest(".popover-fitcontent")&&x.hide()})}}function f(){const b=i.value;b&&b.show(a.value)}async function v(b=!1){if(!!n.slots.default){if(!b&&!s.value&&!await c())return;s.value=!s.value,s.value&&(await t.nextTick(),f())}}async function y(b=!1){if(!!n.slots.default){if(!b&&!await c())return;s.value=!0,await t.nextTick(),f()}}function p(){s.value=!1}function M(){s.value=!0,t.nextTick(()=>{f()})}return{hidePopup:p,showPopup:M,popup:y,shouldPopupContent:s,togglePopup:v,popoverRef:i,closeAllPopover:u}}function Pe(e,n,a){const l=t.ref(),{isTextBoxReadonly:i,textBoxClass:s,textBoxPlaceholder:c,textBoxTitle:u,onBlurTextBox:f,onClickTextBox:v,onFocusTextBox:y,onInput:p,onKeyDownTextBox:M,onKeyUpTextBox:b,onMouseDownTextBox:g,onTextBoxValueChange:x}=a,T=t.ref(e.id),{uuid:O}=J.useGuid(),P=t.computed(()=>({}));t.onMounted(()=>{var d,w;e.selectOnCreated&&((d=l.value)==null||d.select()),e.focusOnCreated&&((w=l.value)==null||w.focus({preventScroll:!0})),T.value||(T.value="button-edit_"+O(8)),T.value=T.value+"-textbox"});const S=t.ref(!1),D=d=>{d.preventDefault(),S.value=!0},B=d=>{d.preventDefault(),S.value=!1,p(d)};function N(d){S.value||p(d)}return()=>t.createVNode("input",{id:e.id?e.id+"-textbox":void 0,ref:l,name:"input-group-value",autocomplete:e.autoComplete?"on":"off",class:s.value,style:P.value,disabled:e.disable,maxlength:e.maxLength,minlength:e.minLength,placeholder:c.value,readonly:i.value,tabindex:e.tabIndex,title:u.value,type:e.inputType,value:n.value,onBlur:f,onChange:x,onClick:v,onFocus:y,onInput:N,onKeydown:M,onKeyup:b,onMousedown:g,onCompositionend:B,onCompositionstart:D},null)}function Se(e,n,a){const l=t.ref(e.separator),i=t.computed(()=>e.readonly||e.disable),{changeTextBoxValue:s,onFocusTextBox:c,onBlurTextBox:u,onClickTextBox:f,textBoxPlaceholder:v}=a,y=t.computed(()=>n.value?n.value.split(l.value).map(g=>({name:g,selectable:!0})):[]);function p(g){s(g.map(x=>x.name).join(l.value),!0)}t.watch(()=>e.separator,g=>{l.value=g});const M=t.ref(!e.disable&&!e.readonly);t.watch([()=>e.disable,()=>e.readonly],([g,x],[T,O])=>{M.value=!g&&!x});function b(g){f(g)}return()=>t.createVNode(de,{tabindex:e.tabIndex,onFocus:c,onBlur:u,id:`${e.id}-tag-editor`,class:"form-control",placeholder:v.value,data:y.value,showClose:!i.value,showInput:!0,disable:i.value,onChange:p,onClick:b},null)}function Ne(e,n,a,l){const{buttonGroupClass:i,onClickButton:s,onMouseEnterButton:c,onMouseLeaveButton:u}=a,{enableClearButton:f,showClearButton:v,onClearValue:y}=l,p=t.ref(),M=fe.debounce(g=>{s(g)},e.buttonBehavior==="Modal"?0:200),b=()=>{n.emit("beforeClearValue")};return{renderButtonGroup:()=>t.createVNode("div",{id:e.id?`${e.id}-button-group`:void 0,class:i.value},[f.value&&t.withDirectives(t.createVNode("span",{class:"input-group-text input-group-clear",onClick:y,onMousedown:b},[t.createVNode("i",{class:"f-icon modal_close"},null)]),[[t.vShow,v.value]]),n.slots.buttonContent?t.createVNode("span",{class:"input-group-text input-group-append-button",onClick:M,onMouseenter:c,onMouseleave:u},[n.slots.buttonContent()]):e.buttonContent?t.createVNode("span",{class:"input-group-text input-group-append-button",innerHTML:e.buttonContent,ref:p,onClick:g=>M(g),onMouseenter:c,onMouseleave:u},null):null]),buttonHandleElement:p}}function ze(e,n,a){const l=t.ref(e.popupMinWidth),{hidePopup:i,popoverRef:s}=a,c=()=>{n.emit("shown")};return()=>t.createVNode(he,{id:`${e.id}-popover`,ref:s,placement:e.placement,host:e.popupHost,"keep-width-with-reference":e.keepWidthWithReference,fitContent:!0,"right-boundary":e.popupRightBoundary,minWidth:l.value,class:e.popupClass,offsetX:e.popupOffsetX,onHidden:i,onShown:c,beforeClose:e.beforeClosePopup,limitContentBySpace:e.limitContentBySpace},{default:()=>{var u,f;return[(f=(u=n.slots).default)==null?void 0:f.call(u)]}})}const ie=t.defineComponent({name:"FButtonEdit",props:ne,emits:["updateExtendInfo","clear","change","click","clickButton","blur","focus","mouseEnterIcon","mouseLeaveIcon","keyup","keydown","inputClick","input","update:modelValue","beforeClearValue","shown"],setup(e,n){const a=t.ref(),l=t.ref(e.customClass),i=t.ref(e.modelValue),s=Oe(e,n,a,i),{shouldPopupContent:c,hidePopup:u,showPopup:f,togglePopup:v}=s,y=Te(e,n,a,s,i),p=t.ref(""),M=Ve(e,n,i,p,s),{hasFocusedTextBox:b,commitValue:g,inputGroupClass:x}=M,T=Ee(e,n,i,b,p,M),{onMouseEnterTextBox:O,onMouseLeaveTextBox:P}=T,S=t.ref(!1),D=t.computed(()=>{const E={"f-button-edit":!0,"f-cmp-inputgroup":!0,"f-button-edit-nowrap":!e.wrapText};return l.value&&l.value.split(" ").reduce((F,r)=>(F[r]=!0,F),E),E}),B=t.computed(()=>({overflow:e.wrapText?"hidden":""})),N=t.computed(()=>({}));function d(){if(!e.multiSelect||e.inputType!=="tag"||!a.value)return 0;let E=0;const F=Array.from(a.value.querySelectorAll(".farris-tag-item"));return F&&F.length&&(E=F.map(r=>r.offsetTop).filter(r=>r>20).length),E}const w=t.ref(d());t.onUpdated(()=>{w.value=d()});function z(){return e.multiSelect&&e.inputType==="tag"?()=>t.createVNode(t.Fragment,null,[Se(e,i,M)(),!!w.value&&t.createVNode("div",{class:"d-flex flex-row mr-2 more-tags","more-tags":!0},[t.createVNode("span",{class:"multi--more-text"},[t.createTextVNode("+"),w.value])])]):Pe(e,i,M)}let L=z();t.watch([()=>e.multiSelect,()=>e.inputType],()=>{L=z()});const{renderButtonGroup:m,buttonHandleElement:I}=Ne(e,n,y,T),_=ze(e,n,s),U=t.ref(c.value),G={displayText:p,commitValue:g,elementRef:a,hidePopup:u,showPopup:f,popoverRef:s.popoverRef,shouldPopupContent:c,togglePopup:v,openDialog:()=>{I.value&&e.buttonBehavior==="Modal"&&I.value.click()},getModal:()=>{var E;return e.buttonBehavior==="Modal"?(E=y.modalRef.value)==null?void 0:E.value:null},getTextbox:()=>{var E;return(E=a.value)==null?void 0:E.querySelector("input")},forceClosePopup:()=>{U.value=!1,S.value=!0,c.value=!1}};return t.onMounted(()=>{a.value.componentInstance=G,window.onresize=()=>{document.body.click()}}),t.onBeforeUnmount(()=>{var E;window.onresize=null,(E=window[Y])==null||E.delete(a.value)}),n.expose(G),t.watch(()=>c.value,async(E,F)=>{if(S.value){U.value=E,S.value=!1;return}if(!E&&e.beforeClosePopup&&typeof e.beforeClosePopup=="function"){try{const r=await e.beforeClosePopup();U.value=!r,(!r||e.readonly)&&(c.value=!0)}catch(r){console.error("Error in beforeClosePopup:",r),U.value=F,c.value=F}return}U.value=E}),()=>{var E,F;return t.createVNode(t.Fragment,null,[t.createVNode("div",t.mergeProps(n.attrs,{ref:a,class:D.value,id:e.id?e.id:void 0,style:B.value}),[t.createVNode("div",{id:e.id?`${e.id}-input-group`:void 0,class:x.value,style:N.value,onMouseenter:O,onMouseleave:P},[(F=(E=n.slots).precontent)==null?void 0:F.call(E),L(),m()])]),U.value&&_()])}}}),Ie=J.withInstall(ie);H.FButtonEdit=ie,H.buttonEditProps=ne,H.default=Ie,Object.defineProperties(H,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|