You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
12 KiB
17 lines
12 KiB
var N=(e,t,s)=>new Promise((l,p)=>{var d=o=>{try{r(s.next(o))}catch(a){p(a)}},m=o=>{try{r(s.throw(o))}catch(a){p(a)}},r=o=>o.done?l(o.value):Promise.resolve(o.value).then(d,m);r((s=s.apply(e,t)).next())});import{useDesignerStore as te}from"./form-77f01638.js";import oe from"./useValidator-cdb08363.js";import ne from"./Entity-b0538236.js";import{d as S,k as q,f as v,dO as j,a8 as g,r as ie,p as se,o as k,g as b,j as P,bl as re,P as le,J as ae,aT as ce,aU as D,F as de,b as T,bJ as A,w as V,h as ue,t as pe,i as fe,aV as me,x as ge,a9 as ve}from"./index-f4658ae7.js";import{deleteComponent as he}from"./FromApi-4c170a8f.js";import R from"./Events-141c34ea.js";import{p as Ce,k as we,N as Pe,a as _e}from"./Popover-ab55c8ff.js";import{a as ye,u as G}from"./use-config-816d55a6.js";import{u as W}from"./Loading-fead3a83.js";import{u as Se}from"./use-css-vars-class-3ae3b4b3.js";import{a as L,r as ke,c as M}from"./use-merged-state-66be05d7.js";import{b as be,N as U}from"./Button-53926a3b.js";import{N as xe}from"./Icon-e3cbad7d.js";import{W as Ne}from"./Warning-d0098cab.js";import{k as Te}from"./keysOf-5d5107c5.js";import{j as ze,k as Be,e as H,g as z,c as K,b as J}from"./light-0dfdc1ad.js";import{o as Ie}from"./omit-b0e7e098.js";import{u as Ee}from"./use-message-f27d95bf.js";import{N as Fe}from"./Icon-fc5d8913.js";const Oe={iconSize:"22px"},$e=e=>{const{fontSize:t,warningColor:s}=e;return Object.assign(Object.assign({},Oe),{fontSize:t,iconColor:s})},je=ze({name:"Popconfirm",common:Be,peers:{Button:be,Popover:Ce},self:$e}),De=je,Q=ye("n-popconfirm"),X={positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0}},Z=Te(X),Ae=S({name:"NPopconfirmPanel",props:X,setup(e){const{localeRef:t}=W("Popconfirm"),{inlineThemeDisabled:s}=G(),{mergedClsPrefixRef:l,mergedThemeRef:p,props:d}=q(Q),m=v(()=>{const{common:{cubicBezierEaseInOut:o},self:{fontSize:a,iconSize:h,iconColor:C}}=p.value;return{"--n-bezier":o,"--n-font-size":a,"--n-icon-size":h,"--n-icon-color":C}}),r=s?Se("popconfirm-panel",void 0,m,d):void 0;return Object.assign(Object.assign({},W("Popconfirm")),{mergedClsPrefix:l,cssVars:s?void 0:m,localizedPositiveText:v(()=>e.positiveText||t.value.positiveText),localizedNegativeText:v(()=>e.negativeText||t.value.negativeText),positiveButtonProps:j(d,"positiveButtonProps"),negativeButtonProps:j(d,"negativeButtonProps"),handlePositiveClick(o){e.onPositiveClick(o)},handleNegativeClick(o){e.onNegativeClick(o)},themeClass:r==null?void 0:r.themeClass,onRender:r==null?void 0:r.onRender})},render(){var e;const{mergedClsPrefix:t,showIcon:s,$slots:l}=this,p=L(l.action,()=>this.negativeText===null&&this.positiveText===null?[]:[this.negativeText!==null&&g(U,Object.assign({size:"small",onClick:this.handleNegativeClick},this.negativeButtonProps),{default:()=>this.localizedNegativeText}),this.positiveText!==null&&g(U,Object.assign({size:"small",type:"primary",onClick:this.handlePositiveClick},this.positiveButtonProps),{default:()=>this.localizedPositiveText})]);return(e=this.onRender)===null||e===void 0||e.call(this),g("div",{class:[`${t}-popconfirm__panel`,this.themeClass],style:this.cssVars},ke(l.default,d=>s||d?g("div",{class:`${t}-popconfirm__body`},s?g("div",{class:`${t}-popconfirm__icon`},L(l.icon,()=>[g(xe,{clsPrefix:t},{default:()=>g(Ne,null)})])):null,d):null),p?g("div",{class:[`${t}-popconfirm__action`]},p):null)}}),Ve=H("popconfirm",[z("body",`
|
|
font-size: var(--n-font-size);
|
|
display: flex;
|
|
align-items: center;
|
|
flex-wrap: nowrap;
|
|
position: relative;
|
|
`,[z("icon",`
|
|
display: flex;
|
|
font-size: var(--n-icon-size);
|
|
color: var(--n-icon-color);
|
|
transition: color .3s var(--n-bezier);
|
|
margin: 0 8px 0 0;
|
|
`)]),z("action",`
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
`,[K("&:not(:first-child)","margin-top: 8px"),H("button",[K("&:not(:last-child)","margin-right: 8px;")])])]),Re=Object.assign(Object.assign(Object.assign({},J.props),_e),{positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},trigger:{type:String,default:"click"},positiveButtonProps:Object,negativeButtonProps:Object,onPositiveClick:Function,onNegativeClick:Function}),We=S({name:"Popconfirm",props:Re,__popover__:!0,setup(e){const{mergedClsPrefixRef:t}=G(),s=J("Popconfirm","-popconfirm",Ve,De,e,t),l=ie(null);function p(r){var o;if(!(!((o=l.value)===null||o===void 0)&&o.getMergedShow()))return;const{onPositiveClick:a,"onUpdate:show":h}=e;Promise.resolve(a?a(r):!0).then(C=>{var w;C!==!1&&((w=l.value)===null||w===void 0||w.setShow(!1),h&&M(h,!1))})}function d(r){var o;if(!(!((o=l.value)===null||o===void 0)&&o.getMergedShow()))return;const{onNegativeClick:a,"onUpdate:show":h}=e;Promise.resolve(a?a(r):!0).then(C=>{var w;C!==!1&&((w=l.value)===null||w===void 0||w.setShow(!1),h&&M(h,!1))})}return se(Q,{mergedThemeRef:s,mergedClsPrefixRef:t,props:e}),{setShow(r){var o;(o=l.value)===null||o===void 0||o.setShow(r)},syncPosition(){var r;(r=l.value)===null||r===void 0||r.syncPosition()},mergedTheme:s,popoverInstRef:l,handlePositiveClick:p,handleNegativeClick:d}},render(){const{$slots:e,$props:t,mergedTheme:s}=this;return g(Pe,Ie(t,Z,{theme:s.peers.Popover,themeOverrides:s.peerOverrides.Popover,internalExtraClass:["popconfirm"],ref:"popoverInstRef"}),{trigger:e.activator||e.trigger,default:()=>{const l=we(t,Z);return g(Ae,Object.assign(Object.assign({},l),{onPositiveClick:this.handlePositiveClick,onNegativeClick:this.handleNegativeClick}),e)}})}}),Le={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Me=P("path",{d:"M262.29 192.31a64 64 0 1 0 57.4 57.4a64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22a155.3 155.3 0 0 1-21.46-12.57a16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22a155.3 155.3 0 0 1 21.46 12.57a16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Ue=[Me],He=S({name:"SettingsOutline",render:function(t,s){return k(),b("svg",Le,Ue)}}),Ke={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},Ze=P("path",{d:"M12 12h2v12h-2z",fill:"currentColor"},null,-1),qe=P("path",{d:"M18 12h2v12h-2z",fill:"currentColor"},null,-1),Ge=P("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"},null,-1),Je=P("path",{d:"M12 2h8v2h-8z",fill:"currentColor"},null,-1),Qe=[Ze,qe,Ge,Je],Xe=S({name:"Delete",render:function(t,s){return k(),b("svg",Ke,Qe)}}),Ye=S({name:"SelectHelper",components:{NIcon:Fe,NPopconfirm:We},props:{widget:{type:Object,default:()=>{}},settingUrl:{type:String,default:""}},setup(e){const t=te(),s=v(()=>t.globalFormConfig),l=oe(),p=()=>{var c,f;let n="";const i=(c=t==null?void 0:t.selectedWidgetDto)==null?void 0:c.getPara("EnName"),u=e.widget.id;e.widget.dto&&e.widget.dto.UIContralType==60?n=`../../Comm/EnOnly.htm?EnName=${i}&PKVal=HtmlText_${u}`:i?n+=`?EnName=${i}&PKVal=${u}`:n=e.settingUrl,t.professionSettingType="EN",t.professionSettingUrl=n,t.professionSettingTitle=(f=e.widget)==null?void 0:f.title,t.professionSettingVisible=!0},d=v(()=>{const{selectedWidget:n}=t,{widget:i}=e;return!!n&&!!i&&n.id===i.id}),m=v(()=>{const{labelSpan:n=1,inputSpan:i=1}=e.widget;return{"--cus-form-item-grids":`${n}fr ${i}fr`,width:`calc(${I.value} / 24 * 100%)`}}),r=n=>{var i;return((i=n==null?void 0:n.dto)==null?void 0:i.GroupID)!==void 0},o=()=>N(this,null,function*(){var u,c,f,_;if(((u=t.selectedWidget)==null?void 0:u.id)===((c=e.widget)==null?void 0:c.id))return;t.selectedWidget=null,t.selectedWidgetDto=null,yield ae(),t.settingsCollapse=!1,t.settingPanelLoading=!0,t.selectedWidget=e.widget;const n=(f=e.widget)==null?void 0:f.id,i=new ne(((_=e.widget)==null?void 0:_.dtoClassName)||"",n);yield i.Init(),t.selectedWidgetDto=i,R.emit("chooseWidget",null),t.settingPanelLoading=!1}),a=Ee(),h=v(()=>e.widget.visible?{}:s.value.showHiddenField==1?{opacity:"0.45"}:{display:"none"}),C=q("editable"),w=v(()=>{const{category:n,key:i}=e.widget;return{"--cus-selector-color":l.isContainer(n,i)&&d.value&&C?"2px dotted #1890ff":"1px solid #1890ff","--base-border":l.isContainer(n,i)&&C?"2px dotted transparent":"1px solid transparent"}}),Y=re(),ee=()=>{var c;const{FrmID:n}=Y.query;if(!e.settingUrl)return a.error("\u7F3A\u5C11\u94FE\u63A5"),{};const i=(c=e.settingUrl)==null?void 0:c.split("?")[1];if(!i)return a.error("\u7F3A\u5C11\u53C2\u6570"),{};const u={};return i.split("&").forEach(f=>{const[_,x]=f.split("=");u[_]=x}),u.FrmID=n+"",u};le(()=>{R.on("deleteNode",n=>{var i;n===((i=e.widget)==null?void 0:i.id)&&B()})});const B=()=>N(this,null,function*(){var n,i,u;try{const c=(n=t.selectedWidgetDto)==null?void 0:n.getData();if(c!=null&&c.hasOwnProperty("EditType")&&c.EditType!=0){a.warning("\u6B64\u7EC4\u4EF6\u4E0D\u53EF\u8FDB\u884C\u5220\u9664");return}yield he(ee()),t.selectedWidget=null,t.selectedWidgetDto=null;const{category:f,key:_}=e.widget;if(l.isContainer(f,_)){t.widgetsList.splice(t.widgetsList.findIndex(y=>y.id===e.widget.id),1),a.success("\u5220\u9664\u6210\u529F");return}if(!r(e.widget))return;const x=(u=(i=e.widget)==null?void 0:i.dto)==null?void 0:u.GroupID,E=t.widgetsList.findIndex(y=>y.id==x);if(E===-1){a.error("\u6CA1\u6709\u627E\u5230\u7236\u5BB9\u5668\uFF0C\u5220\u9664\u5931\u8D25");return}const F=t.widgetsList[E].children,O=F.findIndex(y=>{var $;return y.id===(($=e.widget)==null?void 0:$.id)});if(O===-1){a.error("\u6CA1\u6709\u627E\u5230\u6B64\u5B50\u8282\u70B9");return}F.splice(O,1),a.success("\u5220\u9664\u6210\u529F")}catch(c){a.error(c.toString())}}),I=v(()=>{const n=s.value.cols===6?4:6,{inputSpan:i=1,labelSpan:u=1}=e.widget,f=(i+u)*n;return f>24?24:f});return{dropZoneActive:v(()=>{var n;return t.activeDropZoneId===((n=e.widget)==null?void 0:n.id)}),chooseItem:o,isActive:d,calcSpan:I,SettingsOutline:He,Delete:Xe,deleteNode:B,computedCols:m,openProfessionSetting:p,handleContainer:w,handleVisible:h,editable:C}}});const et={class:"icon icon-delete",title:"\u5220\u9664"};function tt(e,t,s,l,p,d){const m=D("n-icon"),r=D("n-popconfirm");return k(),b("div",{class:ge(["select-helper",{"is-active":e.isActive&&e.editable,"drop-zone-active":e.dropZoneActive}]),style:ve([e.computedCols,e.handleVisible,e.handleContainer]),onClick:t[1]||(t[1]=A((...o)=>e.chooseItem&&e.chooseItem(...o),["stop"]))},[e.isActive&&e.editable?(k(),b(de,{key:0},[P("div",{class:"icon icon-duplicate",title:"\u9AD8\u7EA7\u8BBE\u7F6E",onClick:t[0]||(t[0]=A((...o)=>e.openProfessionSetting&&e.openProfessionSetting(...o),["stop"]))},[T(m,{component:e.SettingsOutline,size:"16",color:"#1890ff"},null,8,["component"])]),T(r,{onPositiveClick:e.deleteNode,"positive-button-props":{color:"#d03050"}},{trigger:V(()=>[P("div",et,[T(m,{component:e.Delete,size:"16",color:"#ff5555"},null,8,["component"])])]),default:V(()=>[ue(" \u786E\u5B9A\u8981\u5220\u9664\u7EC4\u4EF6[ "+pe(e.widget.title)+" ] \u5417\uFF1F ",1)]),_:1},8,["onPositiveClick"])],64)):fe("",!0),me(e.$slots,"default",{},void 0,!0)],6)}const ot=ce(Ye,[["render",tt],["__scopeId","data-v-e01c5c56"]]),kt=Object.freeze(Object.defineProperty({__proto__:null,default:ot},Symbol.toStringTag,{value:"Module"}));export{Xe as D,We as N,ot as S,kt as a};
|