import{d as x,w as d,g as l,A as p,J as u,_ as b,P as _,O as y,H as T,c as $,r as C}from"./index-DOFLUERq.js";import{_ as E}from"./_plugin-vue_export-helper-DlAUqK2U.js";const H={class:"field-label"},L={key:0,class:"required"},j=["innerHTML"],k=x({__name:"HTML",props:{df:{},record:{},canEdit:{type:Boolean},ctx:{}},setup(r,{expose:m}){const t=r,f=$(()=>t.df.label_layout||"vertical"),i=C(""),c=()=>{if(t.df.fieldname==="preview_html")return v();let e=t.df.options||"";e=t.ctx.t?t.ctx.t(e):e;try{return t.ctx.render?t.ctx.render(e,t):e}catch(o){return console.warn("HTML模板渲染失败:",o),e}},v=()=>{const e=t.record,o=e.file_url,a=e.file_type?.toLowerCase();return o?g(o)?`<div class="img_preview">
      <img
        class="img-responsive"
        src="${s(o)}"
        onerror="this.parentElement.style.display='none'"
      />
    </div>`:w(o)?`<div class="img_preview">
      <video width="480" height="320" controls>
        <source src="${s(o)}">
        ${t.ctx.t?t.ctx.t("Your browser does not support the video element."):"Your browser does not support the video element."}
      </video>
    </div>`:a==="pdf"?`<div class="img_preview">
      <object style="background:#323639;" width="100%">
        <embed
          style="background:#323639;"
          width="100%"
          height="1190"
          src="${s(o)}" type="application/pdf"
        >
      </object>
    </div>`:a==="mp3"?`<div class="img_preview">
      <audio width="480" height="60" controls>
        <source src="${s(o)}" type="audio/mpeg">
        ${t.ctx.t?t.ctx.t("Your browser does not support the audio element."):"Your browser does not support the audio element."}
      </audio>
    </div>`:"":""},g=e=>/\.(gif|jpg|jpeg|tiff|png|webp|bmp|svg)$/i.test(e),w=e=>/\.(mp4|avi|mov|wmv|flv|webm|mkv)$/i.test(e),s=e=>{const o=document.createElement("div");return o.textContent=e,o.innerHTML},n=()=>{i.value=c()},h=e=>{e&&typeof e=="object"&&e.appendTo?(console.warn("jQuery对象在Vue中需要特殊处理"),t.df.options=e.toString()):t.df.options=e,n()};return d(()=>t.df.options,()=>{n()},{immediate:!0}),d(()=>t.record,()=>{n()},{deep:!0,immediate:!0}),m({setValue:h,refreshContent:n,getContent:c}),(e,o)=>(l(),p("div",{class:T(["field-wrapper",`layout-${f.value}`])},[u("label",H,[b(_(r.ctx.t(r.df.label||r.df.fieldname))+" ",1),r.df.reqd?(l(),p("span",L,"*")):y("",!0)]),u("div",{class:"html-content",innerHTML:i.value},null,8,j)],2))}}),B=E(k,[["__scopeId","data-v-de6666a8"]]);export{B as default};
