@agile-team/mach-report 2.11.0 → 2.11.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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),R=require("./region-binding-workflow-DhQvu1co.cjs"),I=require("./_plugin-vue_export-helper-BLmdZLlg.cjs"),_e=require("./useLocalDraft-Yiw1wFgI.cjs"),Fe=require("./designer.cjs");function be(t,h){const u=/^\$\.datasets\[(\d+)\]/.exec(t.path)?.[1];return u!==void 0?h[Number(u)]?.id:h.find(d=>t.path.startsWith(`$.datasets.${d.id}.samples`))?.id}function pe(t,h){const u=/\.fields\[(\d+)\]/.exec(t)?.[1];return u!==void 0?{control:"field",fieldIndex:Number(u)}:{control:t.split(".").at(-1)||h}}function ye(t,h,u){const d=/^\$\.recipe\.regions\[(\d+)\]/.exec(t.path)?.[1],f=be(t,u),a=d===void 0?h.regions.find(V=>V.dataset===f):h.regions[Number(d)];if(!a)return{control:t.path.endsWith("footerRange")?"footer":"regions",...h.footerRange?{range:h.footerRange}:{}};if(t.path.startsWith("$.datasets"))return{regionId:a.id,range:a.range,control:t.code==="row-key"?"rowKey":"contract"};const B=pe(t.path,"range"),k=t.code==="row-key"?"rowKey":B.control.startsWith("regions[")?"range":B.control;return{...B,control:k,regionId:a.id,range:a.range}}function Me(t,h,u){if(t.path.startsWith("$.datasets")){const f=be(t,u);return f===void 0?[]:h.regions.filter(a=>a.dataset===f).map(a=>a.id)}const d=ye(t,h,u).regionId;return d?[d]:[]}function Te(t,h){const u=/^\$\.recipe\.regions\.(title|header|detail|footer)$/.exec(t.path)?.[1];return u?{control:u,range:h.regions[u]}:t.path.startsWith("$.datasets")?{control:t.code==="row-key"?"rowKey":"contract",range:h.regions.detail}:{...pe(t.path,"detail"),range:h.regions.detail}}function ie(t){if(t.range)try{const h=R.parseImportRange(t.range);return t.fieldIndex!==void 0&&(h.left=h.right=h.left+t.fieldIndex),h}catch{return}}function Ke(t,h,u){return h.control==="dataset"?!u.dataset:h.control==="rowKey"?!u.rowKey:h.control==="field"&&h.fieldIndex!==void 0?!u.fields[h.fieldIndex]:!1}const Le=["aria-label"],ze={class:"mr-binding-group"},Pe={class:"mr-binding-note"},We=["title","disabled"],Ae={class:"mr-binding-region-list",role:"list",tabindex:"-1","data-binding-control":"regions"},He=["data-state"],qe=["aria-pressed","onClick"],Oe=["title"],Je={class:"mr-binding-region-state"},je={key:0},Ue=["aria-label","disabled","onClick"],Ge=["disabled"],Xe={key:0,class:"mr-binding-group"},Qe={class:"mr-binding-label",tabindex:"-1"},Ye=["value","aria-label"],Ze={class:"mr-binding-label"},et=["value","aria-label"],tt={value:"record"},nt={value:"repeat"},at={class:"mr-binding-note"},lt={class:"mr-binding-label",tabindex:"-1"},ot=["value","aria-label"],rt={value:""},it=["value"],st={key:0,class:"mr-binding-label",tabindex:"-1"},ut=["value","aria-label"],ct={value:""},dt=["value"],gt={class:"mr-binding-region-tools"},mt=["disabled"],ft=["aria-label"],vt={key:1,class:"mr-binding-mappings"},bt={class:"mr-binding-field-search"},pt=["placeholder","aria-label"],yt={key:0,class:"mr-binding-note"},ht=["data-binding-control","value","onChange","aria-label"],kt={value:""},Et=["value"],Nt={key:0},Vt={key:2,class:"mr-binding-map-pages"},wt=["disabled","aria-label"],Bt=["disabled","aria-label"],St={key:3,class:"mr-binding-concurrency"},xt=["data-binding-control","value","onChange"],Dt={value:""},$t=["value"],Ct={class:"mr-binding-group",tabindex:"-1","data-binding-control":"footer"},Rt={class:"mr-binding-note"},It={class:"mr-binding-region-tools"},_t=["disabled"],Ft=["aria-label"],Mt=e.defineComponent({__name:"ExcelRegionBindingPanel",props:{controller:{},datasets:{},disabled:{type:Boolean},messages:{}},setup(t){const h=t,u=e.ref(0),d=e.ref(),f=e.ref(""),a=h.controller.active,B=e.computed(()=>h.datasets.find(m=>m.id===a.value?.dataset)),k=e.computed(()=>{if(!a.value)return[];let m=1;try{m=R.parseImportRange(a.value.range).left}catch{}return a.value.fields.slice(u.value*12,u.value*12+12).map((p,r)=>({field:p,index:u.value*12+r,physical:R.columnName(m+u.value*12+r)}))}),V=e.computed(()=>Math.max(1,Math.ceil((a.value?.fields.length??0)/12))),C=e.computed(()=>{const m=f.value.trim().toLocaleLowerCase(),p=B.value?.fields??[],r=p.filter(D=>[D.field,D.label,D.unit].some(K=>K?.toLocaleLowerCase().includes(m))).slice(0,64),E=new Set(k.value.map(D=>D.field));return[...r,...p.filter(D=>E.has(D.field)&&!r.includes(D))]});function z(m){return m.target.value}function X(m){h.controller.setActive(m),u.value=0,f.value=""}e.watch(()=>h.controller.focusTarget.value,async m=>{if(!m)return;u.value=Math.floor((m.target.fieldIndex??0)/12),f.value="",await e.nextTick();const p=m.target.control==="field"?`field-${m.target.fieldIndex}`:m.target.control==="contract"?"dataset":m.target.control,r=d.value?.querySelector(`[data-binding-control="${p}"]`),E=r?.closest("details");E&&(E.open=!0);const D=h.disabled&&r?.matches("input,select,textarea,button")?r.closest("label"):r;D?.focus(),D?.scrollIntoView?.({block:"nearest"})});function U(m){if(!(!a.value||h.disabled)){a.value.range=z(m);try{const p=R.parseImportRange(a.value.range),r=p.right-p.left+1;r<=2048&&(a.value.fields=Array.from({length:r},(E,D)=>a.value.fields[D]??""))}catch{}}}return(m,p)=>(e.openBlock(),e.createElementBlock("section",{ref_key:"panel",ref:d,class:"mr-binding-multi","aria-label":t.messages.multiRegions},[e.createElementVNode("div",ze,[e.createElementVNode("h3",null,[e.createTextVNode(e.toDisplayString(t.messages.multiRegions),1),e.createElementVNode("span",null,e.toDisplayString(t.controller.recipe.value.regions.length)+"/128",1)]),e.createElementVNode("p",Pe,e.toDisplayString(t.messages.multiHint),1),e.createElementVNode("button",{type:"button",class:"mr-binding-add-region",title:t.controller.recipe.value.regions.length>=128?t.messages.limitRegions:t.controller.selection.value?t.messages.addRegion:t.messages.noCellSelection,disabled:t.disabled||!t.controller.selection.value||t.controller.recipe.value.regions.length>=128,onClick:p[0]||(p[0]=(...r)=>t.controller.add&&t.controller.add(...r))},[e.createVNode(I._sfc_main,{name:"grid",size:13}),e.createTextVNode(e.toDisplayString(t.messages.addRegion),1),e.createElementVNode("code",null,e.toDisplayString(t.controller.selection.value||"—"),1)],8,We),e.createElementVNode("div",Ae,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.controller.directory.value,r=>(e.openBlock(),e.createElementBlock("div",{key:r.region.id,class:e.normalizeClass(["mr-binding-region-entry",{"is-active":r.region.id===t.controller.activeId.value}]),"data-state":r.state},[e.createElementVNode("button",{type:"button","aria-pressed":r.region.id===t.controller.activeId.value,onClick:E=>X(r.region.id)},[e.createElementVNode("strong",{title:r.region.id},e.toDisplayString(r.region.id),9,Oe),e.createElementVNode("code",null,e.toDisplayString(r.region.range),1),e.createElementVNode("small",null,e.toDisplayString(r.region.mode==="record"?t.messages.recordMode:t.messages.repeatMode)+" · "+e.toDisplayString(r.region.dataset||t.messages.chooseDataset),1),e.createElementVNode("span",Je,[e.createTextVNode(e.toDisplayString(r.state==="ready"?t.messages.regionReady:r.state==="pending"?t.messages.regionPending:t.messages.regionError),1),r.issues.length?(e.openBlock(),e.createElementBlock("span",je," · "+e.toDisplayString(r.issues.length),1)):e.createCommentVNode("",!0)])],8,qe),e.createElementVNode("button",{type:"button","aria-label":`${t.messages.removeRegion} ${r.region.id}`,disabled:t.disabled,onClick:E=>t.controller.remove(r.region.id)},[e.createVNode(I._sfc_main,{name:"close",size:12})],8,Ue)],10,He))),128))])]),e.createElementVNode("fieldset",{disabled:t.disabled,class:"mr-binding-region-editor"},[e.unref(a)?(e.openBlock(),e.createElementBlock("section",Xe,[e.createElementVNode("h3",null,[e.createTextVNode(e.toDisplayString(t.messages.regionProperties),1),e.createElementVNode("code",null,e.toDisplayString(e.unref(a).id),1)]),e.createElementVNode("label",Qe,[e.createTextVNode(e.toDisplayString(t.messages.regionCoordinates),1),e.createElementVNode("input",{"data-binding-control":"range",value:e.unref(a).range,"aria-label":t.messages.regionCoordinates,onChange:U},null,40,Ye)]),e.createElementVNode("label",Ze,[e.createTextVNode(e.toDisplayString(t.messages.regionMode),1),e.createElementVNode("select",{value:e.unref(a).mode,"aria-label":t.messages.regionMode,onChange:p[1]||(p[1]=r=>t.controller.property("mode",z(r)))},[e.createElementVNode("option",tt,e.toDisplayString(t.messages.recordMode),1),e.createElementVNode("option",nt,e.toDisplayString(t.messages.repeatMode),1)],40,et)]),e.createElementVNode("p",at,e.toDisplayString(e.unref(a).mode==="record"?t.messages.recordHint:t.messages.repeatHint),1),e.createElementVNode("label",lt,[e.createTextVNode(e.toDisplayString(t.messages.dataset),1),e.createElementVNode("select",{"data-binding-control":"dataset",value:e.unref(a).dataset,"aria-label":t.messages.dataset,onChange:p[2]||(p[2]=r=>t.controller.dataset(z(r)))},[e.createElementVNode("option",rt,e.toDisplayString(t.messages.chooseDataset),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.datasets,r=>(e.openBlock(),e.createElementBlock("option",{key:r.id,value:r.id},e.toDisplayString(r.label||r.id),9,it))),128))],40,ot)]),B.value?(e.openBlock(),e.createElementBlock("label",st,[e.createTextVNode(e.toDisplayString(t.messages.rowKey),1),e.createElementVNode("select",{"data-binding-control":"rowKey",value:e.unref(a).rowKey,"aria-label":t.messages.rowKey,onChange:p[3]||(p[3]=r=>t.controller.property("rowKey",z(r)))},[e.createElementVNode("option",ct,e.toDisplayString(t.messages.chooseRowKey),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value.fields.filter(r=>r.type!=="boolean"),r=>(e.openBlock(),e.createElementBlock("option",{key:r.field,value:r.field},e.toDisplayString(r.label||r.field),9,dt))),128))],40,ut)])):e.createCommentVNode("",!0),e.createElementVNode("div",gt,[e.createElementVNode("button",{type:"button",disabled:!t.controller.selection.value,onClick:p[4]||(p[4]=(...r)=>t.controller.header&&t.controller.header(...r))},e.toDisplayString(t.messages.bindRegionHeader),9,mt),e.createElementVNode("code",null,e.toDisplayString(e.unref(a).headerRange||t.messages.noRegionHeader),1),e.unref(a).headerRange?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button","aria-label":t.messages.clearHeader,onClick:p[5]||(p[5]=(...r)=>t.controller.clearHeader&&t.controller.clearHeader(...r))},[e.createVNode(I._sfc_main,{name:"close",size:11})],8,ft)):e.createCommentVNode("",!0)]),B.value?(e.openBlock(),e.createElementBlock("div",vt,[e.createElementVNode("label",bt,[e.createVNode(I._sfc_main,{name:"search",size:13}),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[6]||(p[6]=r=>f.value=r),type:"search",placeholder:t.messages.searchFields,"aria-label":t.messages.searchFields},null,8,pt),[[e.vModelText,f.value]])]),B.value.fields.length>64?(e.openBlock(),e.createElementBlock("small",yt,e.toDisplayString(t.messages.fieldLimit),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,r=>(e.openBlock(),e.createElementBlock("label",{key:r.index,class:"mr-binding-map",tabindex:"-1"},[e.createElementVNode("span",null,e.toDisplayString(r.physical),1),e.createElementVNode("div",null,[e.createElementVNode("select",{"data-binding-control":`field-${r.index}`,value:e.unref(a).fields[r.index],onChange:E=>t.controller.mapping(r.index,z(E)),"aria-label":`${t.messages.physical} ${r.physical} · ${t.messages.business}`},[e.createElementVNode("option",kt,e.toDisplayString(t.messages.chooseField),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,E=>(e.openBlock(),e.createElementBlock("option",{key:E.field,value:E.field},e.toDisplayString(E.label||E.field)+" · "+e.toDisplayString(E.field),9,Et))),128))],40,ht),r.field?(e.openBlock(),e.createElementBlock("small",Nt,e.toDisplayString(B.value.fields.find(E=>E.field===r.field)?.type)+" · "+e.toDisplayString(B.value.fields.find(E=>E.field===r.field)?.unit||"—"),1)):e.createCommentVNode("",!0)])]))),128))])):e.createCommentVNode("",!0),V.value>1?(e.openBlock(),e.createElementBlock("div",Vt,[e.createElementVNode("button",{type:"button",disabled:u.value<=0,"aria-label":t.messages.previousColumns,onClick:p[7]||(p[7]=r=>u.value--)},[e.createVNode(I._sfc_main,{name:"chevron-left",size:13})],8,wt),e.createElementVNode("span",null,e.toDisplayString(u.value+1)+"/"+e.toDisplayString(V.value),1),e.createElementVNode("button",{type:"button",disabled:u.value+1>=V.value,"aria-label":t.messages.nextColumns,onClick:p[8]||(p[8]=r=>u.value++)},[e.createVNode(I._sfc_main,{name:"chevron-right",size:13})],8,Bt)])):e.createCommentVNode("",!0),B.value?(e.openBlock(),e.createElementBlock("details",St,[e.createElementVNode("summary",null,e.toDisplayString(t.messages.concurrency),1),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(["revisionField","sourceTokenField"],r=>e.createElementVNode("label",{key:r,class:"mr-binding-label",tabindex:"-1"},[e.createTextVNode(e.toDisplayString(r==="revisionField"?t.messages.revisionField:t.messages.sourceTokenField),1),e.createElementVNode("select",{"data-binding-control":r,value:e.unref(a)[r]||"",onChange:E=>t.controller.property(r,z(E))},[e.createElementVNode("option",Dt,e.toDisplayString(t.messages.optional),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value.fields,E=>(e.openBlock(),e.createElementBlock("option",{key:E.field,value:E.field},e.toDisplayString(E.label||E.field),9,$t))),128))],40,xt)])),64))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("section",Ct,[e.createElementVNode("h3",null,e.toDisplayString(t.messages.flowFooter),1),e.createElementVNode("p",Rt,e.toDisplayString(t.messages.flowFooterHint),1),e.createElementVNode("div",It,[e.createElementVNode("button",{type:"button",disabled:!t.controller.selection.value,onClick:p[9]||(p[9]=(...r)=>t.controller.footer&&t.controller.footer(...r))},e.toDisplayString(t.messages.bindFooter),9,_t),e.createElementVNode("code",null,e.toDisplayString(t.controller.recipe.value.footerRange||"—"),1),t.controller.recipe.value.footerRange?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button","aria-label":t.messages.clearFooter,onClick:p[10]||(p[10]=(...r)=>t.controller.clearFooter&&t.controller.clearFooter(...r))},[e.createVNode(I._sfc_main,{name:"close",size:11})],8,Ft)):e.createCommentVNode("",!0)])])],8,Ge)],8,Le))}});function ve(t=""){return{version:"2.0",sheet:t,regions:[]}}function Tt(t,h,u,d){const f=e.ref(ve()),a=e.ref(""),B=e.ref(),k=e.ref(),V=e.ref(),C=e.computed(()=>!t.value||!k.value||!V.value?"":R.excelBindingCellRange(t.value,h.value,k.value,V.value)),z=e.computed(()=>({...f.value,regions:f.value.regions.map(s=>({...s,fields:[]}))})),X=e.computed(()=>t.value?R.validateExcelRegionGeometry(t.value,z.value):[]),U=e.computed(()=>{const s=R.validateExcelRegionFields(f.value,d()),v=[...X.value,...s.issues];return{...s,ok:!v.length,issues:v}}),m=e.computed(()=>f.value.regions.find(s=>s.id===a.value));function p(s){return ye(s,f.value,d())}const r=e.computed(()=>{const s=new Map;for(const v of U.value.issues){const M=p(v);for(const N of Me(v,f.value,d())){const j=s.get(N)??[];j.push({issue:v,target:{...M,regionId:N}}),s.set(N,j)}}return f.value.regions.map(v=>{const M=s.get(v.id)??[],N=M.length?M.every(j=>Ke(j.issue,j.target,v))?"pending":"error":"ready";return{region:v,state:N,issues:M}})});function E(s=ve(h.value)){f.value=JSON.parse(JSON.stringify(s)),a.value=f.value.regions[0]?.id??"",k.value=void 0,V.value=void 0,B.value=void 0}function D(s){s.regionId&&(a.value=s.regionId);const v=ie(s);v&&(k.value={row:v.top,column:v.left},V.value={row:v.bottom,column:v.right}),B.value={target:s,sequence:(B.value?.sequence??0)+1}}function K(s){D(p(s))}function i(s,v,M){u.value||((!M||!k.value)&&(k.value={row:s,column:v}),V.value={row:s,column:v})}function w(){if(u.value||!C.value||f.value.regions.length>=128)return;let s=1;for(;f.value.regions.some(N=>N.id===`region-${s}`);)s++;const v=`region-${s}`,M=Math.abs(V.value.column-k.value.column)+1;f.value.regions.push({id:v,range:C.value,mode:"repeat",dataset:"",fields:Array.from({length:M},()=>""),rowKey:""}),a.value=v}function P(s){u.value||(f.value.regions=f.value.regions.filter(v=>v.id!==s),a.value===s&&(a.value=f.value.regions[0]?.id??""))}function x(s){!u.value&&m.value&&(m.value.dataset=s,m.value.rowKey="",m.value.fields.fill(""),delete m.value.revisionField,delete m.value.sourceTokenField)}function T(s,v){if(!(u.value||!m.value)){if(s==="mode"){(v==="record"||v==="repeat")&&(m.value.mode=v);return}v||s==="rowKey"?m.value[s]=v:delete m.value[s]}}function $(s,v){!u.value&&m.value&&s>=0&&s<m.value.fields.length&&(m.value.fields[s]=v)}function W(){!u.value&&m.value&&delete m.value.headerRange}function J(){!u.value&&m.value&&C.value&&(m.value.headerRange=C.value)}function O(){!u.value&&C.value&&(f.value.footerRange=C.value)}function _(){u.value||delete f.value.footerRange}function H(s){const v=f.value.regions.find(M=>M.id===s);v&&D({regionId:s,control:"range",range:v.range})}function y(s,v){return!!k.value&&!!V.value&&s>=Math.min(k.value.row,V.value.row)&&s<=Math.max(k.value.row,V.value.row)&&v>=Math.min(k.value.column,V.value.column)&&v<=Math.max(k.value.column,V.value.column)}return{recipe:f,activeId:a,active:m,selection:C,validation:U,directory:r,focusTarget:B,target:p,locate:K,reset:E,select:i,add:w,remove:P,dataset:x,property:T,mapping:$,header:J,clearHeader:W,footer:O,clearFooter:_,setActive:H,selected:y}}function re(t="",h=0){return{version:"1.0",sheet:t,dataset:"",regions:{header:"",detail:""},fields:Array.from({length:h},()=>""),rowKey:""}}function ce(t){return t instanceof Error?t.message:String(t)}function Kt(t,h){const u=e.shallowRef(),d=e.ref(re()),f=e.ref("table"),a=Tt(u,e.computed(()=>d.value.sheet),e.computed(()=>s.value),()=>t.datasets),B=new Map,k=new Map,V=e.ref({table:[],regions:[]});function C(){B.clear(),k.clear(),V.value={table:[],regions:[]}}function z(){d.value.sheet&&(B.set(d.value.sheet,X(d.value)),k.set(d.value.sheet,JSON.parse(JSON.stringify(a.recipe.value))),V.value={table:[...B.values()],regions:[...k.values()]})}const X=o=>JSON.parse(JSON.stringify(o));function U(o,c){return X(B.get(o)??re(o,c))}const m=e.ref({id:t.identity?.id??"excel-template",name:t.identity?.name??"Excel 业务模板"}),p=e.ref(""),r=e.ref(0),E=_e.useLocalDraft(()=>({source:r.value,recipe:d.value,mode:f.value,regions:a.recipe.value,cached:V.value,identity:m.value})),D=e.ref([]);let K;function i(){K?.dispose(),K=void 0}const w=e.ref(""),P=e.ref(!1),x=e.ref(!1),T=e.ref(!1),$=e.ref(!1),W=e.ref(1),J=e.ref(1),O=e.ref(),_=e.ref(),H=e.ref(0),y=e.computed(()=>({...Fe.EXCEL_BINDING_MESSAGES,...t.messages})),s=e.computed(()=>!!t.readonly||P.value||$.value),v=e.computed(()=>!P.value&&!$.value),M=e.computed(()=>u.value?.sheets.find(o=>o.name===d.value.sheet)),N=e.computed(()=>M.value?R.parseImportRange(M.value.range):void 0),j=e.computed(()=>t.datasets.find(o=>o.id===d.value.dataset)),Z=e.computed(()=>u.value&&M.value?R.getExcelSheetWindow(u.value,M.value.name,{row:W.value,column:J.value}):void 0),te=e.computed(()=>u.value?R.validateExcelBindingRegions(u.value,d.value):[]),G=e.computed(()=>{if(!u.value)return{ok:!1,issues:[],mapped:0,total:0};const o=R.validateExcelBindingFields(u.value,d.value,t.datasets),c=[...te.value,...o.issues];return{...o,ok:c.length===0,issues:c}}),Q=e.computed(()=>f.value==="regions"?a.validation.value:G.value),ne=e.ref(),se=e.computed(()=>f.value==="regions"?a.focusTarget.value:ne.value);function ae(o){return f.value==="regions"?a.target(o):Te(o,d.value)}function de(o){const c={dataset:y.value.dataset,contract:y.value.dataContract,rowKey:y.value.rowKey,range:y.value.regionCoordinates,field:y.value.mapping,fields:y.value.mapping,footer:y.value.flowFooter,header:y.value.headerRegion,detail:y.value.detailRegion,title:y.value.titleRegion,sheet:y.value.sheet,regions:f.value==="regions"?y.value.multiRegions:y.value.regionLegend,revisionField:y.value.revisionField,sourceTokenField:y.value.sourceTokenField},S=ie(o),F=o.fieldIndex===void 0?"":` ${R.columnName(S?.left??o.fieldIndex+1)}`;return`${o.regionId?`${o.regionId} · `:""}${c[o.control]??y.value.regionCoordinates}${F}`}const ge=e.computed(()=>Q.value.issues.map(o=>({issue:o,label:de(ae(o)),message:o.message.replace(/\$\.recipe\.regions\[(\d+)\]/g,(c,S)=>a.recipe.value.regions[Number(S)]?.id??y.value.regionProperties)})));function ue(o){return o?{dataset:y.value.nextDataset,rowKey:y.value.nextRowKey,field:y.value.nextField,fields:y.value.nextField,range:y.value.nextRange,regions:y.value.nextRegion,footer:y.value.nextFooter,header:y.value.nextHeader,detail:y.value.nextHeader,title:y.value.nextHeader}[o.control]??y.value.nextContract:f.value==="regions"?y.value.nextRegion:y.value.nextHeader}const g=e.computed(()=>t.readonly?y.value.readonly:P.value?y.value.loading:$.value?y.value.applying:T.value?y.value.applied:Q.value.ok?y.value.ready:ue(Q.value.issues[0]?ae(Q.value.issues[0]):void 0));e.watch(se,o=>{const c=o&&ie(o.target);!c||!N.value||(W.value=Math.max(N.value.top,Math.min(N.value.bottom,c.top)),J.value=Math.max(N.value.left,Math.min(N.value.right,c.left)))});function l(o){if(f.value==="regions"){a.locate(o);return}const c=ae(o),S=ie(c);S&&(O.value=S.top,_.value=S.bottom),c.fieldIndex!==void 0&&(H.value=Math.floor(c.fieldIndex/12)),ne.value={target:c,sequence:(ne.value?.sequence??0)+1}}const n=e.computed(()=>d.value.fields.slice(H.value*12,(H.value+1)*12).map((o,c)=>({index:H.value*12+c,field:o,physical:R.columnName((N.value?.left??1)+H.value*12+c)}))),b=e.computed(()=>j.value?.fields.filter(o=>o.type!=="boolean")??[]),L=e.computed(()=>O.value!==void 0&&_.value!==void 0?{top:Math.min(O.value,_.value),bottom:Math.max(O.value,_.value)}:void 0);let q,A=0;function Y(){A++,q?.abort(),q=void 0,P.value=!1}function le(){W.value=N.value?.top??1,J.value=N.value?.left??1,O.value=void 0,_.value=void 0,H.value=0,x.value=!1,T.value=!1}function fe(o){Y();try{const c=o.version==="2.0"?R.parseExcelRegionBindingSession(o):R.parseExcelBindingSession(o);Y(),i(),D.value=c.source.sheets.map(S=>({name:S.name,index:S.index})),u.value=c.source,C(),c.version==="2.0"?(d.value=re(c.recipe.sheet,c.source.sheets.find(S=>S.name===c.recipe.sheet).columnCount),a.reset(c.recipe),f.value="regions"):(d.value=c.recipe,a.reset(),f.value="table"),m.value={...c.identity,...t.lockId&&t.identity?{id:t.identity.id}:{}},p.value=c.recipe.sheet,w.value="",le(),r.value++,E.accept()}catch(c){w.value=ce(c)}}e.watch(()=>t.session,o=>{o&&fe(o)},{immediate:!0}),e.watch(()=>t.readonly,o=>{o&&(Y(),i())}),e.watch([d,m,f,a.recipe],()=>{x.value=!1,T.value=!1},{deep:!0,flush:"sync"}),e.watch(()=>t.datasets,()=>{x.value=!1,T.value=!1}),e.onBeforeUnmount(()=>{Y(),i()});async function he(o){if(t.readonly)return;if(Y(),!/\.xlsx$/i.test(o.name)){w.value=y.value.invalidFile;return}const c=++A;q=new AbortController,P.value=!0,w.value="";let S;try{const{openExcelWorkbook:F}=await Promise.resolve().then(()=>require("./workbook-session-CLYLhZWu.cjs")).then(ee=>ee.workbookSession);if(c!==A||t.readonly||(S=await F(o,{...t.importOptions,signal:q.signal}),c!==A||t.readonly))return;const oe=S.inspect().sheets.filter(ee=>ee.visible);if(!oe.length)throw new Error("Excel 中没有可导入的可见工作表");const me=await S.importTemplate({sheets:[oe[0].name],signal:q.signal});if(c!==A||t.readonly)return;i(),K=S,S=void 0,u.value=me,r.value++,p.value=o.name,D.value=oe.map(ee=>({name:ee.name,index:ee.index})),C(),d.value=re(me.sheets[0].name,me.sheets[0].columnCount),a.reset(),le()}catch(F){c===A&&(w.value=ce(F))}finally{S?.dispose(),c===A&&(P.value=!1,q=void 0)}}async function ke(o){if(s.value||!D.value.some(F=>F.name===o)||d.value.sheet===o)return;z();const c=u.value?.sheets.find(F=>F.name===o);if(c){d.value=U(o,c.columnCount),a.reset(k.get(o)),w.value="",le();return}if(!K||K.disposed)return;Y();const S=++A;q=new AbortController,P.value=!0,w.value="";try{const F=await K.importTemplate({sheets:[o],signal:q.signal});if(S!==A||t.readonly)return;u.value=F,d.value=U(o,F.sheets[0].columnCount),a.reset(k.get(o)),le()}catch(F){S===A&&(w.value=ce(F))}finally{S===A&&(P.value=!1,q=void 0)}}function Ee(o){s.value||(d.value.dataset=o,d.value.rowKey="",d.value.fields.fill(""),x.value=!1,T.value=!1)}function Ne(o,c){s.value||!N.value||o<N.value.top||o>N.value.bottom||((!c||O.value===void 0)&&(O.value=o),_.value=o)}function Ve(o){if(s.value||!u.value||!L.value){s.value||(w.value=y.value.emptySelection);return}d.value.regions[o]=R.excelBindingRowRange(u.value,d.value.sheet,L.value.top,L.value.bottom),x.value=!1,T.value=!1,w.value=""}function we(o){s.value||(delete d.value.regions[o],x.value=!1,T.value=!1)}function Be(o,c){!s.value&&o>=0&&o<d.value.fields.length&&(d.value.fields[o]=c,x.value=!1,T.value=!1)}function Se(o){s.value||(d.value.rowKey=o)}function xe(o,c){!s.value&&!(o==="id"&&t.lockId)&&(m.value[o]=c)}function De(o){for(const c of["title","header","detail","footer"]){const S=d.value.regions[c];if(!S)continue;const F=R.parseImportRange(S);if(o>=F.top&&o<=F.bottom)return c}}function $e(o,c){N.value&&(o==="row"?W.value=Math.max(N.value.top,Math.min(N.value.bottom,W.value+c)):J.value=Math.max(N.value.left,Math.min(N.value.right,J.value+c)))}function Ce(){if(!t.readonly){if(t.session){fe(t.session);return}Y(),i(),u.value=void 0,D.value=[],p.value="",C(),d.value=re(),m.value={id:t.identity?.id??"excel-template",name:t.identity?.name??"Excel 业务模板"},a.reset(),f.value="table",le(),r.value++,E.accept(),w.value=""}}function Re(){v.value&&(x.value=!0,w.value="")}async function Ie(){if(!(s.value||!u.value)&&(x.value=!0,w.value="",!!Q.value.ok)){$.value=!0;try{const o={...m.value,...t.lockId&&t.identity?{id:t.identity.id}:{}},c=f.value==="regions"?R.createExcelRegionBindingDocument(u.value,a.recipe.value,t.datasets,o):R.createExcelBindingDocument(u.value,d.value,t.datasets,o),S=f.value==="regions"?R.createExcelRegionBindingSession(u.value,a.recipe.value,o):R.createExcelBindingSession(u.value,d.value,o),F={...c,session:S},oe=E.snapshot();if(t.accept&&!await t.accept(F)||t.readonly||oe!==E.snapshot()&&E.pending.value)return;t.accept||h(F),C(),E.accept(),T.value=!0}catch(o){w.value=ce(o)}finally{$.value=!1}}}return{imported:u,mode:f,regionBindings:a,pendingLocalChanges:E.pending,recipe:d,identity:m,sourceName:p,sheetChoices:D,error:w,loading:P,checked:x,applied:T,row:W,column:J,mappingPage:H,m:y,disabled:s,canCheck:v,sheet:M,sourceRange:N,dataset:j,window:Z,validation:Q,focusTarget:se,issueEntries:ge,guidance:g,locateIssue:l,mappings:n,rowKeys:b,selection:L,cancel:Y,importFile:he,chooseSheet:ke,chooseDataset:Ee,chooseRow:Ne,markRegion:Ve,clearRegion:we,setMapping:Be,setRowKey:Se,setIdentity:xe,regionAt:De,moveWindow:$e,check:Re,restoreDraft:Ce,apply:Ie}}const Lt=["aria-label","aria-busy"],zt={class:"mr-binding-bar"},Pt={class:"mr-binding-heading"},Wt=["aria-label","disabled"],At=["disabled"],Ht={key:0,class:"mr-binding-error",role:"alert"},qt={key:1,class:"mr-binding-placeholder",role:"status"},Ot={key:2,class:"mr-binding-placeholder"},Jt=["disabled"],jt={class:"mr-binding-sourcebar"},Ut=["value","aria-label","disabled"],Gt=["value"],Xt=["aria-label"],Qt=["aria-pressed","disabled"],Yt=["aria-pressed","disabled"],Zt={class:"mr-binding-range"},en={class:"mr-binding-sample-note"},tn={class:"mr-binding-layout"},nn={class:"mr-binding-source"},an={class:"mr-binding-grid-heading"},ln=["aria-label"],on={class:"mr-binding-grid"},rn=["data-region"],sn={scope:"row"},un=["data-source-row","aria-label","aria-pressed","disabled","onPointerdown","onPointerenter","onKeydown"],cn=["rowspan","colspan","title","data-source-cell","tabindex","aria-label","aria-selected","onPointerdown","onPointerenter","onKeydown"],dn={key:1,class:"mr-binding-grid-footer"},gn={class:"mr-binding-window"},mn=["aria-label","disabled"],fn=["min","max","value","aria-label"],vn=["aria-label","disabled"],bn={class:"mr-binding-window"},pn=["aria-label","disabled"],yn=["min","max","value","aria-label"],hn=["aria-label","disabled"],kn={class:"mr-binding-inspector"},En=["disabled"],Nn={class:"mr-binding-group"},Vn=["data-role"],wn={key:0},Bn=["aria-label","data-binding-control","title","disabled","onClick"],Sn=["aria-label","onClick"],xn={key:0,class:"mr-binding-note"},Dn={class:"mr-binding-group"},$n={class:"mr-binding-label",tabindex:"-1"},Cn=["value","aria-label"],Rn={value:""},In=["value"],_n={key:0,class:"mr-binding-note"},Fn={key:1,class:"mr-binding-label",tabindex:"-1"},Mn=["value","aria-label"],Tn={value:""},Kn=["value"],Ln={key:2,class:"mr-binding-mappings"},zn=["data-binding-control","aria-label","value","onChange"],Pn={value:""},Wn=["value"],An={key:0},Hn={key:3,class:"mr-binding-map-pages"},qn=["disabled","aria-label"],On=["disabled","aria-label"],Jn=["disabled"],jn={class:"mr-binding-group"},Un={class:"mr-binding-label"},Gn=["value","readonly"],Xn={class:"mr-binding-label"},Qn=["value"],Yn={key:0,class:"mr-binding-issues",open:""},Zn=["aria-label","onClick"],ea={key:0,class:"mr-binding-issue-pages"},ta=["disabled","aria-label"],na=["disabled","aria-label"],aa={key:1,class:"mr-binding-warnings"},la={class:"mr-binding-actions"},oa=["title"],ra=["disabled"],ia=["disabled"],sa=["disabled","title"],ua=e.defineComponent({__name:"ExcelBindingWizard",props:{datasets:{},accept:{type:Function},session:{},identity:{},lockId:{type:Boolean},readonly:{type:Boolean},importOptions:{},messages:{}},emits:["apply","dirty"],setup(t,{expose:h,emit:u}){const d=t,f=u,a=Kt(d,g=>f("apply",g)),{imported:B,mode:k,regionBindings:V,recipe:C,identity:z,sourceName:X,sheetChoices:U,error:m,loading:p,checked:r,row:E,column:D,mappingPage:K,m:i,disabled:w,sheet:P,sourceRange:x,dataset:T,window:$,validation:W,mappings:J,rowKeys:O,selection:_}=a;e.watch([a.pendingLocalChanges,C,z],()=>f("dirty",a.pendingLocalChanges.value),{immediate:!0,deep:!0,flush:"sync"});const H=e.ref(),y=e.ref(),s=e.ref(0),v=e.computed(()=>Math.max(1,Math.ceil(a.issueEntries.value.length/12))),M=e.computed(()=>a.issueEntries.value.slice(s.value*12,(s.value+1)*12));e.watch(v,g=>{s.value=Math.min(s.value,g-1)}),e.watch(a.focusTarget,async g=>{if(!g)return;await e.nextTick();const l=ie(g.target);if(l&&y.value?.querySelector(`td[data-source-cell="${l.top}:${l.left}"]`)?.scrollIntoView?.({block:"nearest",inline:"nearest"}),k.value==="regions")return;const n=g.target.control==="field"?`field-${g.target.fieldIndex}`:g.target.control==="contract"?"dataset":g.target.control,b=y.value?.querySelector(`.mr-binding-table-editor [data-binding-control="${n}"]`),L=w.value?b?.closest("label"):b;L?.focus(),L?.scrollIntoView?.({block:"nearest"})});const N=e.ref(!1),j=["title","header","detail","footer"],Z=e.computed(()=>({title:i.value.titleRegion,header:i.value.headerRegion,detail:i.value.detailRegion,footer:i.value.footerRegion})),te=e.computed(()=>Math.max(1,Math.ceil(C.value.fields.length/12)));function G(g){return g.target.value}function Q(g){const l=g.target,n=l.files?.[0];n&&a.importFile(n),l.value=""}function ne(g,l){g.button!==0||w.value||(g.preventDefault(),N.value=!0,a.chooseRow(l,g.shiftKey),k.value==="regions"&&x.value&&(V.select(l,x.value.left,!1),V.select(l,x.value.right,!0)),g.currentTarget.focus())}function se(g,l,n){k.value!=="regions"||g.button!==0||w.value||(g.preventDefault(),N.value=!0,V.select(l,n,g.shiftKey),g.currentTarget.focus())}function ae(g,l,n){if(k.value!=="regions")return;(g.key===" "||g.key==="Enter")&&(g.preventDefault(),V.select(l,n,g.shiftKey));const L={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]}[g.key];if(!L||!x.value)return;g.preventDefault();const q=Math.max(x.value.top,Math.min(x.value.bottom,l+L[0])),A=Math.max(x.value.left,Math.min(x.value.right,n+L[1]));g.shiftKey&&V.select(q,A,!0),g.currentTarget.closest("table")?.querySelector(`td[data-source-cell="${q}:${A}"]`)?.focus()}function de(g,l){if((g.key===" "||g.key==="Enter")&&(g.preventDefault(),a.chooseRow(l,g.shiftKey)),g.key==="ArrowDown"||g.key==="ArrowUp"){g.preventDefault();const n=l+(g.key==="ArrowDown"?1:-1);g.shiftKey&&a.chooseRow(n,!0),g.currentTarget.closest("table")?.querySelector(`button[data-source-row="${n}"]`)?.focus()}}function ge(g){const l=T.value?.fields.find(n=>n.field===g);return l?[l.type,l.unit,l.digits===void 0?void 0:`${l.digits}${i.value.precision}`,l.sample===void 0?void 0:`${i.value.sample}: ${String(l.sample)}`].filter(n=>n!==void 0&&n!=="").join(" · "):""}function ue(g,l){const n=Number(G(g));!Number.isInteger(n)||!x.value||(l==="row"?E.value=Math.max(x.value.top,Math.min(x.value.bottom,n)):D.value=Math.max(x.value.left,Math.min(x.value.right,n)))}return h({get pendingLocalChanges(){return a.pendingLocalChanges.value},importFile:a.importFile,apply:a.apply,cancel:a.cancel}),(g,l)=>(e.openBlock(),e.createElementBlock("section",{ref_key:"element",ref:y,class:"mr-binding","aria-label":e.unref(i).title,"aria-busy":e.unref(p),onPointerup:l[23]||(l[23]=n=>N.value=!1),onPointercancel:l[24]||(l[24]=n=>N.value=!1),onPointerleave:l[25]||(l[25]=n=>N.value=!1)},[e.createElementVNode("header",zt,[e.createElementVNode("div",Pt,[e.createVNode(I._sfc_main,{name:"file",size:17}),e.createElementVNode("strong",null,e.toDisplayString(e.unref(i).title),1),e.createElementVNode("span",null,e.toDisplayString(e.unref(X)||e.unref(i).intro),1)]),e.createElementVNode("input",{ref_key:"input",ref:H,type:"file",accept:".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","aria-label":e.unref(i).upload,class:"mr-binding-file",disabled:t.readonly,onChange:Q},null,40,Wt),e.unref(p)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",onClick:l[0]||(l[0]=(...n)=>e.unref(a).cancel&&e.unref(a).cancel(...n))},e.toDisplayString(e.unref(i).cancel),1)):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",disabled:t.readonly,onClick:l[1]||(l[1]=n=>H.value?.click())},[e.createVNode(I._sfc_main,{name:"upload",size:14}),e.createTextVNode(e.toDisplayString(e.unref(B)?e.unref(i).replace:e.unref(i).upload),1)],8,At))]),e.unref(m)?(e.openBlock(),e.createElementBlock("div",Ht,e.toDisplayString(e.unref(m)),1)):e.createCommentVNode("",!0),e.unref(p)?(e.openBlock(),e.createElementBlock("div",qt,[l[26]||(l[26]=e.createElementVNode("span",{class:"mr-binding-loader"},null,-1)),e.createTextVNode(e.toDisplayString(e.unref(i).loading),1)])):e.unref(B)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createElementVNode("div",jt,[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(i).sheet),1),e.createElementVNode("select",{value:e.unref(C).sheet,"aria-label":e.unref(i).sheet,disabled:e.unref(w),onChange:l[3]||(l[3]=n=>e.unref(a).chooseSheet(G(n)))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(U),n=>(e.openBlock(),e.createElementBlock("option",{key:n.name,value:n.name},e.toDisplayString(n.name),9,Gt))),128))],40,Ut)]),e.createElementVNode("div",{class:"mr-binding-mode",role:"group","aria-label":e.unref(i).regionMode},[e.createElementVNode("button",{type:"button","aria-pressed":e.unref(k)==="table",disabled:e.unref(w),onClick:l[4]||(l[4]=n=>k.value="table")},e.toDisplayString(e.unref(i).tableMode),9,Qt),e.createElementVNode("button",{type:"button","aria-pressed":e.unref(k)==="regions",disabled:e.unref(w),onClick:l[5]||(l[5]=n=>k.value="regions")},[e.createVNode(I._sfc_main,{name:"grid",size:12}),e.createTextVNode(e.toDisplayString(e.unref(i).multiRegions),1)],8,Yt)],8,Xt),e.createElementVNode("span",Zt,e.toDisplayString(e.unref(P)?.range)+" · "+e.toDisplayString(e.unref(P)?.rowCount)+" × "+e.toDisplayString(e.unref(P)?.columnCount),1),e.createElementVNode("span",en,e.toDisplayString(e.unref(i).sourceOnly),1)]),e.createElementVNode("div",tn,[e.createElementVNode("div",nn,[e.createElementVNode("div",an,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(i).source),1),e.createElementVNode("span",null,e.toDisplayString(e.unref(k)==="regions"?e.unref(i).multiHint:e.unref(i).sourceHint),1)]),e.unref($)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"mr-binding-grid-scroll","aria-label":e.unref(i).source},[e.createElementVNode("table",on,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[l[28]||(l[28]=e.createElementVNode("th",{class:"mr-binding-corner","aria-label":"#"},"#",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref($).columns,n=>(e.openBlock(),e.createElementBlock("th",{key:n.column,scope:"col"},e.toDisplayString(n.name),1))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref($).rows,n=>(e.openBlock(),e.createElementBlock("tr",{key:n.row,"data-region":e.unref(a).regionAt(n.row),class:e.normalizeClass({"is-selected":e.unref(_)&&n.row>=e.unref(_).top&&n.row<=e.unref(_).bottom})},[e.createElementVNode("th",sn,[e.createElementVNode("button",{type:"button","data-source-row":n.row,"aria-label":`${e.unref(i).selectionLabel} ${n.row}`,"aria-pressed":!!e.unref(_)&&n.row>=e.unref(_).top&&n.row<=e.unref(_).bottom,disabled:e.unref(w),onPointerdown:b=>ne(b,n.row),onPointerenter:b=>N.value&&e.unref(a).chooseRow(n.row,!0),onKeydown:b=>de(b,n.row)},e.toDisplayString(n.row),41,un)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,b=>(e.openBlock(),e.createElementBlock("td",{key:b.column,rowspan:b.rowSpan,colspan:b.colSpan,title:`${b.address} · ${b.text}`,"data-source-cell":`${b.row}:${b.column}`,tabindex:e.unref(k)==="regions"?0:void 0,"aria-label":e.unref(k)==="regions"?`${e.unref(i).selectionCellLabel} ${b.address}`:void 0,"aria-selected":e.unref(k)==="regions"?e.unref(V).selected(b.row,b.column):void 0,class:e.normalizeClass({"is-continued":b.continued,"is-cell-selected":e.unref(k)==="regions"&&e.unref(V).selected(b.row,b.column)}),onPointerdown:L=>se(L,b.row,b.column),onPointerenter:L=>e.unref(k)==="regions"&&N.value&&e.unref(V).select(b.row,b.column,!0),onKeydown:L=>ae(L,b.row,b.column),style:e.normalizeStyle({textAlign:b.style?.align,fontWeight:b.style?.bold?"600":void 0})},[e.createElementVNode("span",null,e.toDisplayString(b.text),1)],46,cn))),128))],10,rn))),128))])])],8,ln)):e.createCommentVNode("",!0),e.unref($)?(e.openBlock(),e.createElementBlock("footer",dn,[e.createElementVNode("span",null,[e.createTextVNode(e.toDisplayString(e.unref(i).selected)+" ",1),e.createElementVNode("strong",null,e.toDisplayString(e.unref(k)==="regions"?e.unref(V).selection.value||"—":e.unref(_)?`${e.unref(_).top}–${e.unref(_).bottom}`:"—"),1)]),e.createElementVNode("div",gn,[e.createElementVNode("button",{type:"button","aria-label":e.unref(i).previousRows,disabled:e.unref($).top<=e.unref($).source.top,onClick:l[6]||(l[6]=n=>e.unref(a).moveWindow("row",-24))},[e.createVNode(I._sfc_main,{name:"chevron-left",size:13})],8,mn),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(i).rowStart),1),e.createElementVNode("input",{type:"number",min:e.unref($).source.top,max:e.unref($).source.bottom,value:e.unref(E),"aria-label":e.unref(i).rowStart,onChange:l[7]||(l[7]=n=>ue(n,"row"))},null,40,fn)]),e.createElementVNode("button",{type:"button","aria-label":e.unref(i).nextRows,disabled:e.unref($).bottom>=e.unref($).source.bottom,onClick:l[8]||(l[8]=n=>e.unref(a).moveWindow("row",24))},[e.createVNode(I._sfc_main,{name:"chevron-right",size:13})],8,vn)]),e.createElementVNode("div",bn,[e.createElementVNode("button",{type:"button","aria-label":e.unref(i).previousColumns,disabled:e.unref($).left<=e.unref($).source.left,onClick:l[9]||(l[9]=n=>e.unref(a).moveWindow("column",-12))},[e.createVNode(I._sfc_main,{name:"chevron-left",size:13})],8,pn),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(i).columnStart),1),e.createElementVNode("input",{type:"number",min:e.unref($).source.left,max:e.unref($).source.right,value:e.unref(D),"aria-label":e.unref(i).columnStart,onChange:l[10]||(l[10]=n=>ue(n,"column"))},null,40,yn)]),e.createElementVNode("button",{type:"button","aria-label":e.unref(i).nextColumns,disabled:e.unref($).right>=e.unref($).source.right,onClick:l[11]||(l[11]=n=>e.unref(a).moveWindow("column",12))},[e.createVNode(I._sfc_main,{name:"chevron-right",size:13})],8,hn)])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",kn,[e.unref(k)==="regions"?(e.openBlock(),e.createBlock(Mt,{key:0,controller:e.unref(V),datasets:t.datasets,disabled:e.unref(w),messages:e.unref(i)},null,8,["controller","datasets","disabled","messages"])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("fieldset",{disabled:e.unref(w),class:"mr-binding-table-editor"},[e.createElementVNode("section",Nn,[e.createElementVNode("h3",null,[l[29]||(l[29]=e.createElementVNode("b",null,"1",-1)),e.createTextVNode(e.toDisplayString(e.unref(i).regionLegend),1)]),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(j,n=>e.createElementVNode("div",{key:n,class:"mr-binding-region","data-role":n},[e.createElementVNode("div",null,[e.createElementVNode("strong",null,[e.createTextVNode(e.toDisplayString(Z.value[n]),1),n==="title"||n==="footer"?(e.openBlock(),e.createElementBlock("small",wn,e.toDisplayString(e.unref(i).optional),1)):e.createCommentVNode("",!0)]),e.createElementVNode("code",null,e.toDisplayString(e.unref(C).regions[n]||e.unref(i).unnamed),1)]),e.createElementVNode("button",{type:"button","aria-label":`${e.unref(i).selectRegion} · ${Z.value[n]}`,"data-binding-control":n,title:e.unref(_)?`${e.unref(i).selectRegion} · ${Z.value[n]}`:e.unref(i).emptySelection,disabled:!e.unref(_),onClick:b=>e.unref(a).markRegion(n)},[e.createVNode(I._sfc_main,{name:"arrow-right",size:13})],8,Bn),(n==="title"||n==="footer")&&e.unref(C).regions[n]?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button","aria-label":`${e.unref(i).clear} · ${Z.value[n]}`,onClick:b=>e.unref(a).clearRegion(n)},[e.createVNode(I._sfc_main,{name:"close",size:13})],8,Sn)):e.createCommentVNode("",!0)],8,Vn)),64)),e.unref(C).regions.footer?(e.openBlock(),e.createElementBlock("p",xn,e.toDisplayString(e.unref(i).footerHint),1)):e.createCommentVNode("",!0)]),e.createElementVNode("section",Dn,[e.createElementVNode("h3",null,[l[30]||(l[30]=e.createElementVNode("b",null,"2",-1)),e.createTextVNode(e.toDisplayString(e.unref(i).mapping),1),e.createElementVNode("span",null,e.toDisplayString(e.unref(W).mapped)+"/"+e.toDisplayString(e.unref(W).total),1)]),e.createElementVNode("label",$n,[e.createTextVNode(e.toDisplayString(e.unref(i).dataset),1),e.createElementVNode("select",{"data-binding-control":"dataset",value:e.unref(C).dataset,"aria-label":e.unref(i).dataset,onChange:l[12]||(l[12]=n=>e.unref(a).chooseDataset(G(n)))},[e.createElementVNode("option",Rn,e.toDisplayString(e.unref(i).chooseDataset),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.datasets,n=>(e.openBlock(),e.createElementBlock("option",{key:n.id,value:n.id},e.toDisplayString(n.label||n.id),9,In))),128))],40,Cn)]),t.datasets.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",_n,e.toDisplayString(e.unref(i).noContract),1)),e.unref(T)?(e.openBlock(),e.createElementBlock("label",Fn,[e.createTextVNode(e.toDisplayString(e.unref(i).rowKey),1),e.createElementVNode("select",{"data-binding-control":"rowKey",value:e.unref(C).rowKey,"aria-label":e.unref(i).rowKey,onChange:l[13]||(l[13]=n=>e.unref(a).setRowKey(G(n)))},[e.createElementVNode("option",Tn,e.toDisplayString(e.unref(i).chooseRowKey),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(O),n=>(e.openBlock(),e.createElementBlock("option",{key:n.field,value:n.field},e.toDisplayString(n.label||n.field)+" · "+e.toDisplayString(n.field),9,Kn))),128))],40,Mn)])):e.createCommentVNode("",!0),e.unref(T)?(e.openBlock(),e.createElementBlock("div",Ln,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(J),n=>(e.openBlock(),e.createElementBlock("label",{key:n.index,class:"mr-binding-map",tabindex:"-1"},[e.createElementVNode("span",null,e.toDisplayString(n.physical),1),e.createElementVNode("div",null,[e.createElementVNode("select",{"data-binding-control":`field-${n.index}`,"aria-label":`${e.unref(i).physical} ${n.physical} · ${e.unref(i).business}`,value:n.field,onChange:b=>e.unref(a).setMapping(n.index,G(b))},[e.createElementVNode("option",Pn,e.toDisplayString(e.unref(i).chooseField),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(T).fields,b=>(e.openBlock(),e.createElementBlock("option",{key:b.field,value:b.field},e.toDisplayString(b.label||b.field)+" · "+e.toDisplayString(b.field),9,Wn))),128))],40,zn),n.field?(e.openBlock(),e.createElementBlock("small",An,e.toDisplayString(ge(n.field)),1)):e.createCommentVNode("",!0)])]))),128))])):e.createCommentVNode("",!0),e.unref(T)&&te.value>1?(e.openBlock(),e.createElementBlock("div",Hn,[e.createElementVNode("button",{type:"button",disabled:e.unref(K)<=0,"aria-label":e.unref(i).previousColumns,onClick:l[14]||(l[14]=n=>K.value--)},[e.createVNode(I._sfc_main,{name:"chevron-left",size:13})],8,qn),e.createElementVNode("span",null,e.toDisplayString(e.unref(K)+1)+" / "+e.toDisplayString(te.value),1),e.createElementVNode("button",{type:"button",disabled:e.unref(K)+1>=te.value,"aria-label":e.unref(i).nextColumns,onClick:l[15]||(l[15]=n=>K.value++)},[e.createVNode(I._sfc_main,{name:"chevron-right",size:13})],8,On)])):e.createCommentVNode("",!0)])],8,En),[[e.vShow,e.unref(k)==="table"]]),e.createElementVNode("fieldset",{disabled:e.unref(w)},[e.createElementVNode("section",jn,[e.createElementVNode("h3",null,e.toDisplayString(e.unref(i).identity),1),e.createElementVNode("label",Un,[e.createTextVNode(e.toDisplayString(e.unref(i).templateId),1),e.createElementVNode("input",{value:t.lockId?d.identity?.id??e.unref(z).id:e.unref(z).id,autocomplete:"off",readonly:t.lockId,onInput:l[16]||(l[16]=n=>e.unref(a).setIdentity("id",G(n)))},null,40,Gn)]),e.createElementVNode("label",Xn,[e.createTextVNode(e.toDisplayString(e.unref(i).templateName),1),e.createElementVNode("input",{value:e.unref(z).name,autocomplete:"off",onInput:l[17]||(l[17]=n=>e.unref(a).setIdentity("name",G(n)))},null,40,Qn)])])],8,Jn)])]),e.unref(r)&&e.unref(W).issues.length?(e.openBlock(),e.createElementBlock("details",Yn,[e.createElementVNode("summary",null,e.toDisplayString(e.unref(i).issues)+" · "+e.toDisplayString(e.unref(W).issues.length)+" "+e.toDisplayString(e.unref(i).errors),1),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,n=>(e.openBlock(),e.createElementBlock("li",{key:`${n.issue.path}:${n.issue.message}`},[e.createElementVNode("button",{type:"button",class:"mr-binding-issue-link","aria-label":`${e.unref(i).locateIssue} · ${n.label}`,onClick:b=>e.unref(a).locateIssue(n.issue)},[e.createElementVNode("strong",null,e.toDisplayString(n.label),1),e.createElementVNode("span",null,e.toDisplayString(n.message),1),e.createVNode(I._sfc_main,{name:"arrow-right",size:12})],8,Zn)]))),128))]),v.value>1?(e.openBlock(),e.createElementBlock("div",ea,[e.createElementVNode("button",{type:"button",disabled:s.value===0,"aria-label":e.unref(i).previousIssues,onClick:l[18]||(l[18]=n=>s.value--)},[e.createVNode(I._sfc_main,{name:"chevron-left",size:12})],8,ta),e.createElementVNode("span",null,e.toDisplayString(s.value+1)+"/"+e.toDisplayString(v.value),1),e.createElementVNode("button",{type:"button",disabled:s.value+1>=v.value,"aria-label":e.unref(i).nextIssues,onClick:l[19]||(l[19]=n=>s.value++)},[e.createVNode(I._sfc_main,{name:"chevron-right",size:12})],8,na)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.unref(B).warnings.length?(e.openBlock(),e.createElementBlock("details",aa,[e.createElementVNode("summary",null,e.toDisplayString(e.unref(i).inspectWarning)+" · "+e.toDisplayString(e.unref(B).warnings.length),1),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(B).warnings,(n,b)=>(e.openBlock(),e.createElementBlock("li",{key:b},e.toDisplayString(n),1))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("footer",la,[e.createElementVNode("span",{class:e.normalizeClass({"is-ready":e.unref(W).ok}),role:"status",title:e.unref(a).guidance.value},e.toDisplayString(e.unref(a).guidance.value),11,oa),e.unref(a).pendingLocalChanges.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",disabled:e.unref(w),onClick:l[20]||(l[20]=(...n)=>e.unref(a).restoreDraft&&e.unref(a).restoreDraft(...n))},e.toDisplayString(e.unref(i).restoreDraft),9,ra)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",disabled:!e.unref(a).canCheck.value,onClick:l[21]||(l[21]=(...n)=>e.unref(a).check&&e.unref(a).check(...n))},e.toDisplayString(e.unref(i).check),9,ia),e.createElementVNode("button",{type:"button",class:"mr-binding-primary",disabled:e.unref(w)||!e.unref(W).ok,title:e.unref(a).guidance.value,onClick:l[22]||(l[22]=(...n)=>e.unref(a).apply&&e.unref(a).apply(...n))},e.toDisplayString(e.unref(i).apply),9,sa)])],64)):(e.openBlock(),e.createElementBlock("div",Ot,[l[27]||(l[27]=e.createElementVNode("svg",{viewBox:"0 0 80 80",fill:"none","aria-hidden":"true"},[e.createElementVNode("rect",{x:"15",y:"10",width:"50",height:"60",rx:"8",fill:"#eff6ff",stroke:"#bfdbfe"}),e.createElementVNode("path",{d:"M25 25h30M25 35h30M25 45h30M35 25v30M45 25v30M25 55h30",stroke:"#93c5fd","stroke-width":"1.5"})],-1)),e.createElementVNode("strong",null,e.toDisplayString(e.unref(i).noSource),1),e.createElementVNode("span",null,e.toDisplayString(e.unref(i).sourceOnly),1),e.createElementVNode("button",{type:"button",class:"mr-binding-primary",disabled:t.readonly,onClick:l[2]||(l[2]=n=>H.value?.click())},e.toDisplayString(e.unref(i).upload),9,Jt)]))],40,Lt))}});exports.default=ua;
@@ -0,0 +1,522 @@
1
+ import { ref as U, computed as M, watch as Q, defineComponent as X, getCurrentInstance as Z, openBlock as u, createElementBlock as d, unref as e, createElementVNode as n, toDisplayString as r, Fragment as Y, renderList as A, normalizeClass as W, createCommentVNode as f, createTextVNode as x, withDirectives as E, mergeProps as S, vModelDynamic as G, vModelText as H, vModelCheckbox as K, vModelSelect as ee, nextTick as ae } from "vue";
2
+ import { validateReportParamDefinitions as te } from "@agile-team/mach-report";
3
+ import { PARAM_EDITOR_MESSAGES as le } from "./designer.js";
4
+ import { _ as ne } from "./_plugin-vue_export-helper-8SL1F89S.js";
5
+ const re = ["text", "number", "date", "month", "year", "dateRange", "select"], ie = { text: "string", number: "string → number", date: "YYYY-MM-DD", month: "YYYY-MM", year: "YYYY", dateRange: "YYYY-MM-DD/YYYY-MM-DD", select: "option.value" };
6
+ function oe(a) {
7
+ if (/^(默认值|必填参数的默认值)/.test(a)) return ["defaultValue"];
8
+ if (a.includes("参数名")) return ["field"];
9
+ if (a.includes("选项")) return ["options"];
10
+ if (a.startsWith("最小边界")) return ["min", "max"];
11
+ if (a.startsWith("最小长度")) return ["minLength", "maxLength"];
12
+ const v = /^(minLength|maxLength|min|max) /.exec(a)?.[1];
13
+ return v ? [v] : ["type"];
14
+ }
15
+ function se(a) {
16
+ return JSON.parse(JSON.stringify(a));
17
+ }
18
+ function z(a) {
19
+ return {
20
+ field: a.field,
21
+ label: a.label ?? "",
22
+ type: a.type ?? "text",
23
+ required: a.required === !0,
24
+ placeholder: a.placeholder ?? "",
25
+ defaultEnabled: a.defaultValue !== void 0,
26
+ defaultValue: a.defaultValue ?? "",
27
+ min: a.min === void 0 ? "" : String(a.min),
28
+ max: a.max === void 0 ? "" : String(a.max),
29
+ minLength: a.minLength === void 0 ? "" : String(a.minLength),
30
+ maxLength: a.maxLength === void 0 ? "" : String(a.maxLength),
31
+ options: a.options ? a.options.map((v) => ({ ...v })) : []
32
+ };
33
+ }
34
+ function ue(a) {
35
+ const v = { field: a.field, type: a.type };
36
+ a.label && (v.label = a.label), a.placeholder && (v.placeholder = a.placeholder), a.required && (v.required = !0), a.defaultEnabled && (v.defaultValue = a.defaultValue);
37
+ for (const h of ["min", "max"])
38
+ a[h] !== "" && (v[h] = a.type === "number" ? Number(a[h]) : a[h]);
39
+ for (const h of ["minLength", "maxLength"]) a[h] !== "" && (v[h] = Number(a[h]));
40
+ return a.type === "select" && (v.options = a.options.map((h) => ({ ...h }))), v;
41
+ }
42
+ function de(a) {
43
+ const v = () => JSON.stringify(a.document.template.params ?? []), h = U(v()), c = U((a.document.template.params ?? []).map(z)), k = U(0), s = U(""), l = M(() => ({ ...le, ...a.messages })), R = M(() => c.value.map(ue)), g = U(JSON.stringify(c.value)), i = M(() => JSON.stringify(c.value) !== g.value), L = M(() => v() !== h.value), $ = M(() => te(R.value)), C = M(() => {
44
+ const m = /* @__PURE__ */ new Map();
45
+ for (const y of $.value) {
46
+ const _ = Number(y.path.split(".").at(-1)), T = m.get(_) ?? [];
47
+ T.push({ message: y.message, controls: oe(y.message) }), m.set(_, T);
48
+ }
49
+ return m;
50
+ }), j = M(() => C.value.keys().next().value), V = M(() => c.value[k.value]), O = M(() => $.value.filter((m) => m.path === `$.paramDefs.${k.value}`));
51
+ function q(m) {
52
+ return (C.value.get(k.value) ?? []).filter((y) => y.controls.includes(m)).map((y) => y.message);
53
+ }
54
+ const D = M(() => {
55
+ const m = JSON.parse(h.value).map((_) => _.field), y = R.value.map((_) => _.field);
56
+ return { added: y.filter((_) => _ && !m.includes(_)), removed: m.filter((_) => !y.includes(_)) };
57
+ });
58
+ function N() {
59
+ h.value = v(), c.value = (a.document.template.params ?? []).map(z), k.value = Math.min(k.value, Math.max(0, c.value.length - 1)), g.value = JSON.stringify(c.value), s.value = "";
60
+ }
61
+ Q(v, () => {
62
+ i.value || N();
63
+ });
64
+ function F() {
65
+ if (a.readonly) return;
66
+ let m = c.value.length + 1;
67
+ for (; c.value.some((y) => y.field === `param${m}`); ) m++;
68
+ c.value.push(z({ field: `param${m}`, type: "text" })), k.value = c.value.length - 1;
69
+ }
70
+ function B() {
71
+ a.readonly || !V.value || (c.value.splice(k.value, 1), k.value = Math.min(k.value, Math.max(0, c.value.length - 1)));
72
+ }
73
+ function I(m) {
74
+ const y = k.value + m;
75
+ if (a.readonly || y < 0 || y >= c.value.length) return;
76
+ const _ = c.value.splice(k.value, 1)[0];
77
+ c.value.splice(y, 0, _), k.value = y;
78
+ }
79
+ function J(m) {
80
+ a.readonly || !V.value || (V.value.type = m, V.value.min = "", V.value.max = "", V.value.minLength = "", V.value.maxLength = "");
81
+ }
82
+ function w() {
83
+ if (a.readonly || L.value || $.value.length) return !1;
84
+ try {
85
+ return a.accept(se(R.value)) ? (h.value = JSON.stringify(R.value), g.value = JSON.stringify(c.value), s.value = "", !0) : (s.value = l.value.paramApplyFailed, !1);
86
+ } catch (m) {
87
+ return s.value = m instanceof Error ? m.message : String(m), !1;
88
+ }
89
+ }
90
+ return { m: l, rows: c, selected: k, current: V, definitions: R, issues: $, issuesByRow: C, firstIssueIndex: j, controlIssues: q, currentIssues: O, changes: D, pending: i, conflicted: L, error: s, reset: N, add: F, remove: B, move: I, setType: J, apply: w };
91
+ }
92
+ const me = ["aria-label"], pe = { class: "mr-param-editor__directory" }, ce = ["aria-label"], ye = ["aria-pressed", "aria-label", "onClick"], ve = { class: "mr-param-editor__directory-title" }, be = {
93
+ key: 0,
94
+ class: "mr-param-editor__error-count",
95
+ "aria-hidden": "true"
96
+ }, fe = { key: 0 }, he = ["disabled"], ge = {
97
+ key: 0,
98
+ class: "mr-param-editor__validation",
99
+ role: "status"
100
+ }, _e = { class: "mr-param-editor__heading" }, ke = { class: "mr-param-editor__grid" }, xe = ["aria-label", "disabled"], Ve = ["id"], $e = ["aria-label", "disabled"], Ie = ["value", "aria-label", "disabled"], Me = ["value"], Re = ["id"], Le = ["aria-label", "disabled"], De = { class: "mr-param-editor__checks" }, Se = ["disabled"], Ce = ["disabled"], Ye = { class: "mr-param-editor__default-label" }, Ee = { class: "mr-param-editor__range" }, Oe = ["value", "aria-label", "disabled"], Ne = ["value", "aria-label", "disabled"], Ae = { key: 1 }, Ue = ["aria-label", "disabled"], Te = ["value"], Pe = ["value", "aria-label", "type", "min", "max", "step", "disabled"], je = ["id"], qe = ["value", "aria-label", "type", "min", "max", "step", "disabled", "onInput"], Je = ["id"], we = ["value", "aria-label", "disabled", "onInput"], Fe = ["id"], Be = {
101
+ key: 0,
102
+ class: "mr-param-editor__hint"
103
+ }, We = {
104
+ key: 1,
105
+ class: "mr-param-editor__options"
106
+ }, He = { class: "mr-param-editor__option-head" }, ze = ["onUpdate:modelValue", "aria-label", "disabled"], Ge = ["onUpdate:modelValue", "aria-label", "disabled"], Ke = ["aria-label", "disabled", "onClick"], Qe = ["id"], Xe = ["disabled"], Ze = { class: "mr-param-editor__row-actions" }, ea = ["disabled"], aa = ["disabled"], ta = ["disabled"], la = { class: "mr-param-editor__technical" }, na = {
107
+ key: 2,
108
+ class: "mr-param-editor__empty"
109
+ }, ra = ["disabled"], ia = {
110
+ key: 3,
111
+ class: "mr-param-editor__impact"
112
+ }, oa = { key: 0 }, sa = { key: 1 }, ua = {
113
+ key: 4,
114
+ class: "mr-param-editor__errors",
115
+ role: "alert"
116
+ }, da = ["disabled"], ma = ["disabled"], pa = /* @__PURE__ */ X({
117
+ __name: "ParamEditor",
118
+ props: {
119
+ document: {},
120
+ readonly: { type: Boolean },
121
+ messages: {},
122
+ accept: { type: Function }
123
+ },
124
+ emits: ["dirty"],
125
+ setup(a, { expose: v, emit: h }) {
126
+ const c = a, k = h, s = de(c), { m: l, rows: R, selected: g, current: i, changes: L, pending: $, conflicted: C, error: j, issues: V, issuesByRow: O } = s, q = U(), D = `mr-param-${Z()?.uid ?? 0}`;
127
+ Q($, (p) => k("dirty", p), { immediate: !0 });
128
+ function N(p) {
129
+ return { text: l.value.paramText, number: l.value.paramNumber, date: l.value.paramDate, month: l.value.paramMonth, year: l.value.paramYear, dateRange: l.value.paramDateRange, select: l.value.paramSelect }[p];
130
+ }
131
+ function F() {
132
+ i.value && !c.readonly && i.value.options.push({ value: "", label: "" });
133
+ }
134
+ function B(p) {
135
+ c.readonly || i.value?.options.splice(p, 1);
136
+ }
137
+ function I(p) {
138
+ const o = s.controlIssues(p).length > 0;
139
+ return { "aria-invalid": o ? "true" : void 0, "aria-describedby": o ? `${D}-${g.value}-${p}` : void 0 };
140
+ }
141
+ function J(p) {
142
+ return p === "year" ? "number" : p === "dateRange" ? "date" : ["date", "month", "number"].includes(p) ? p : "text";
143
+ }
144
+ function w(p) {
145
+ return p.target.value;
146
+ }
147
+ function m(p, o) {
148
+ i.value && !c.readonly && (i.value[p] = w(o));
149
+ }
150
+ function y(p) {
151
+ return i.value?.defaultValue.split("/")[p] ?? "";
152
+ }
153
+ function _(p, o) {
154
+ if (!i.value || c.readonly) return;
155
+ const t = [y(0), y(1)];
156
+ t[p] = w(o), i.value.defaultValue = t.some(Boolean) ? t.join("/") : "";
157
+ }
158
+ async function T() {
159
+ const p = s.firstIssueIndex.value;
160
+ if (p === void 0) return;
161
+ g.value = p, await ae();
162
+ const o = q.value?.querySelector('[aria-invalid="true"]');
163
+ o?.focus({ preventScroll: !0 }), o?.scrollIntoView?.({ block: "nearest" });
164
+ }
165
+ return v({ pending: $, reset: s.reset, apply: s.apply, locateIssue: T }), (p, o) => (u(), d("section", {
166
+ class: "mr-param-editor",
167
+ "aria-label": e(l).paramsTool
168
+ }, [
169
+ n("aside", pe, [
170
+ n("header", null, [
171
+ n("strong", null, r(e(l).paramsDirectory), 1),
172
+ n("span", null, r(e(R).length), 1)
173
+ ]),
174
+ n("nav", {
175
+ "aria-label": e(l).paramsDirectory
176
+ }, [
177
+ (u(!0), d(Y, null, A(e(R), (t, b) => (u(), d("button", {
178
+ key: b,
179
+ type: "button",
180
+ "aria-pressed": e(g) === b,
181
+ "aria-label": `${t.label || t.field || e(l).paramUnnamed}${e(O).get(b)?.length ? ` · ${e(l).paramIssueCount} ${e(O).get(b)?.length}` : ""}`,
182
+ class: W({ "has-errors": e(O).has(b) }),
183
+ onClick: (P) => g.value = b
184
+ }, [
185
+ n("span", ve, [
186
+ n("strong", null, r(t.label || t.field || e(l).paramUnnamed), 1),
187
+ e(O).has(b) ? (u(), d("span", be, r(e(O).get(b)?.length), 1)) : f("", !0)
188
+ ]),
189
+ n("small", null, [
190
+ x(r(t.field) + " · " + r(N(t.type)), 1),
191
+ t.required ? (u(), d("span", fe, " *")) : f("", !0)
192
+ ])
193
+ ], 10, ye))), 128))
194
+ ], 8, ce),
195
+ n("button", {
196
+ type: "button",
197
+ class: "mr-param-editor__add",
198
+ disabled: a.readonly,
199
+ onClick: o[0] || (o[0] = //@ts-ignore
200
+ (...t) => e(s).add && e(s).add(...t))
201
+ }, "+ " + r(e(l).paramAdd), 9, he),
202
+ n("p", null, r(e(l).paramsDescription), 1)
203
+ ]),
204
+ n("div", {
205
+ ref_key: "main",
206
+ ref: q,
207
+ class: "mr-param-editor__main"
208
+ }, [
209
+ e(V).length ? (u(), d("div", ge, [
210
+ n("span", null, [
211
+ x(r(e(l).paramIssueCount) + " ", 1),
212
+ n("strong", null, r(e(V).length), 1)
213
+ ]),
214
+ n("button", {
215
+ type: "button",
216
+ onClick: T
217
+ }, r(e(l).paramLocateFirst), 1)
218
+ ])) : f("", !0),
219
+ e(i) ? (u(), d(Y, { key: 1 }, [
220
+ n("header", _e, [
221
+ n("div", null, [
222
+ n("strong", null, r(e(i).label || e(i).field || e(l).paramUnnamed), 1),
223
+ n("small", null, r(N(e(i).type)), 1)
224
+ ]),
225
+ n("span", {
226
+ class: W({ "is-pending": e($) || e(V).length > 0 })
227
+ }, r(e(V).length ? e(l).paramInvalid : e($) ? e(l).paramPending : e(l).paramReady), 3)
228
+ ]),
229
+ n("div", ke, [
230
+ n("label", null, [
231
+ x(r(e(l).paramField), 1),
232
+ E(n("input", S({
233
+ "onUpdate:modelValue": o[1] || (o[1] = (t) => e(i).field = t),
234
+ "aria-label": e(l).paramField,
235
+ disabled: a.readonly,
236
+ autocomplete: "off"
237
+ }, I("field")), null, 16, xe), [
238
+ [G, e(i).field]
239
+ ]),
240
+ e(s).controlIssues("field").length ? (u(), d("small", {
241
+ key: 0,
242
+ id: `${D}-${e(g)}-field`,
243
+ class: "mr-param-editor__field-error"
244
+ }, r(e(s).controlIssues("field").join(";")), 9, Ve)) : f("", !0)
245
+ ]),
246
+ n("label", null, [
247
+ x(r(e(l).paramLabel), 1),
248
+ E(n("input", {
249
+ "onUpdate:modelValue": o[2] || (o[2] = (t) => e(i).label = t),
250
+ "aria-label": e(l).paramLabel,
251
+ disabled: a.readonly
252
+ }, null, 8, $e), [
253
+ [H, e(i).label]
254
+ ])
255
+ ]),
256
+ n("label", null, [
257
+ x(r(e(l).paramType), 1),
258
+ n("select", S({
259
+ value: e(i).type,
260
+ "aria-label": e(l).paramType,
261
+ disabled: a.readonly
262
+ }, I("type"), {
263
+ onChange: o[3] || (o[3] = (t) => e(s).setType(t.target.value))
264
+ }), [
265
+ (u(!0), d(Y, null, A(e(re), (t) => (u(), d("option", {
266
+ key: t,
267
+ value: t
268
+ }, r(N(t)), 9, Me))), 128))
269
+ ], 16, Ie),
270
+ e(s).controlIssues("type").length ? (u(), d("small", {
271
+ key: 0,
272
+ id: `${D}-${e(g)}-type`,
273
+ class: "mr-param-editor__field-error"
274
+ }, r(e(s).controlIssues("type").join(";")), 9, Re)) : f("", !0)
275
+ ]),
276
+ n("label", null, [
277
+ x(r(e(l).paramPlaceholder), 1),
278
+ E(n("input", {
279
+ "onUpdate:modelValue": o[4] || (o[4] = (t) => e(i).placeholder = t),
280
+ "aria-label": e(l).paramPlaceholder,
281
+ disabled: a.readonly
282
+ }, null, 8, Le), [
283
+ [H, e(i).placeholder]
284
+ ])
285
+ ]),
286
+ n("div", De, [
287
+ n("label", null, [
288
+ E(n("input", {
289
+ "onUpdate:modelValue": o[5] || (o[5] = (t) => e(i).required = t),
290
+ type: "checkbox",
291
+ disabled: a.readonly
292
+ }, null, 8, Se), [
293
+ [K, e(i).required]
294
+ ]),
295
+ x(r(e(l).paramRequired), 1)
296
+ ]),
297
+ n("label", null, [
298
+ E(n("input", {
299
+ "onUpdate:modelValue": o[6] || (o[6] = (t) => e(i).defaultEnabled = t),
300
+ type: "checkbox",
301
+ disabled: a.readonly
302
+ }, null, 8, Ce), [
303
+ [K, e(i).defaultEnabled]
304
+ ]),
305
+ x(r(e(l).paramDefaultEnabled), 1)
306
+ ])
307
+ ]),
308
+ e(i).defaultEnabled ? (u(), d("div", {
309
+ key: 0,
310
+ class: W(["mr-param-editor__default", { "is-range": e(i).type === "dateRange" }])
311
+ }, [
312
+ e(i).type === "dateRange" ? (u(), d(Y, { key: 0 }, [
313
+ n("span", Ye, r(e(l).paramDefault), 1),
314
+ n("div", Ee, [
315
+ n("label", null, [
316
+ x(r(e(l).paramRangeStart), 1),
317
+ n("input", S({
318
+ value: y(0),
319
+ type: "date",
320
+ "aria-label": e(l).paramRangeStart,
321
+ disabled: a.readonly
322
+ }, I("defaultValue"), {
323
+ onInput: o[7] || (o[7] = (t) => _(0, t))
324
+ }), null, 16, Oe)
325
+ ]),
326
+ o[17] || (o[17] = n("span", { "aria-hidden": "true" }, "—", -1)),
327
+ n("label", null, [
328
+ x(r(e(l).paramRangeEnd), 1),
329
+ n("input", S({
330
+ value: y(1),
331
+ type: "date",
332
+ "aria-label": e(l).paramRangeEnd,
333
+ disabled: a.readonly
334
+ }, I("defaultValue"), {
335
+ onInput: o[8] || (o[8] = (t) => _(1, t))
336
+ }), null, 16, Ne)
337
+ ])
338
+ ])
339
+ ], 64)) : (u(), d("label", Ae, [
340
+ x(r(e(l).paramDefault), 1),
341
+ e(i).type === "select" ? E((u(), d("select", S({
342
+ key: 0,
343
+ "onUpdate:modelValue": o[9] || (o[9] = (t) => e(i).defaultValue = t),
344
+ "aria-label": e(l).paramDefault,
345
+ disabled: a.readonly
346
+ }, I("defaultValue")), [
347
+ o[18] || (o[18] = n("option", { value: "" }, null, -1)),
348
+ (u(!0), d(Y, null, A(e(i).options, (t, b) => (u(), d("option", {
349
+ key: b,
350
+ value: t.value
351
+ }, r(t.label || t.value), 9, Te))), 128))
352
+ ], 16, Ue)), [
353
+ [ee, e(i).defaultValue]
354
+ ]) : (u(), d("input", S({
355
+ key: 1,
356
+ value: e(i).defaultValue,
357
+ "aria-label": e(l).paramDefault,
358
+ type: J(e(i).type),
359
+ min: e(i).type === "year" ? 1 : void 0,
360
+ max: e(i).type === "year" ? 9999 : void 0,
361
+ step: e(i).type === "year" ? 1 : "any",
362
+ disabled: a.readonly
363
+ }, I("defaultValue"), {
364
+ onInput: o[10] || (o[10] = (t) => m("defaultValue", t))
365
+ }), null, 16, Pe))
366
+ ])),
367
+ e(s).controlIssues("defaultValue").length ? (u(), d("small", {
368
+ key: 2,
369
+ id: `${D}-${e(g)}-defaultValue`,
370
+ class: "mr-param-editor__field-error mr-param-editor__errors",
371
+ role: "alert"
372
+ }, r(e(s).controlIssues("defaultValue").join(";")), 9, je)) : f("", !0)
373
+ ], 2)) : f("", !0),
374
+ ["number", "date", "month", "year", "dateRange"].includes(e(i).type) ? (u(), d(Y, { key: 1 }, A(["min", "max"], (t) => n("label", { key: t }, [
375
+ x(r(t === "min" ? e(l).paramMinimum : e(l).paramMaximum), 1),
376
+ n("input", S({
377
+ value: e(i)[t],
378
+ "aria-label": t === "min" ? e(l).paramMinimum : e(l).paramMaximum,
379
+ type: J(e(i).type),
380
+ min: e(i).type === "year" ? 1 : void 0,
381
+ max: e(i).type === "year" ? 9999 : void 0,
382
+ step: e(i).type === "year" ? 1 : "any",
383
+ disabled: a.readonly
384
+ }, { ref_for: !0 }, I(t), {
385
+ onInput: (b) => m(t, b)
386
+ }), null, 16, qe),
387
+ e(s).controlIssues(t).length ? (u(), d("small", {
388
+ key: 0,
389
+ id: `${D}-${e(g)}-${t}`,
390
+ class: "mr-param-editor__field-error"
391
+ }, r(e(s).controlIssues(t).join(";")), 9, Je)) : f("", !0)
392
+ ])), 64)) : f("", !0),
393
+ e(i).type === "text" ? (u(), d(Y, { key: 2 }, A(["minLength", "maxLength"], (t) => n("label", { key: t }, [
394
+ x(r(t === "minLength" ? e(l).paramMinLength : e(l).paramMaxLength), 1),
395
+ n("input", S({
396
+ value: e(i)[t],
397
+ type: "number",
398
+ min: "0",
399
+ step: "1",
400
+ "aria-label": t === "minLength" ? e(l).paramMinLength : e(l).paramMaxLength,
401
+ disabled: a.readonly
402
+ }, { ref_for: !0 }, I(t), {
403
+ onInput: (b) => m(t, b)
404
+ }), null, 16, we),
405
+ e(s).controlIssues(t).length ? (u(), d("small", {
406
+ key: 0,
407
+ id: `${D}-${e(g)}-${t}`,
408
+ class: "mr-param-editor__field-error"
409
+ }, r(e(s).controlIssues(t).join(";")), 9, Fe)) : f("", !0)
410
+ ])), 64)) : f("", !0)
411
+ ]),
412
+ e(i).type === "dateRange" ? (u(), d("p", Be, r(e(l).paramRangeHint), 1)) : f("", !0),
413
+ e(i).type === "select" ? (u(), d("fieldset", We, [
414
+ n("legend", null, r(e(l).paramOptions), 1),
415
+ n("div", He, [
416
+ n("span", null, r(e(l).paramOptionValue), 1),
417
+ n("span", null, r(e(l).paramOptionLabel), 1)
418
+ ]),
419
+ (u(!0), d(Y, null, A(e(i).options, (t, b) => (u(), d("div", {
420
+ key: b,
421
+ class: "mr-param-editor__option"
422
+ }, [
423
+ E(n("input", S({
424
+ "onUpdate:modelValue": (P) => t.value = P,
425
+ "aria-label": `${e(l).paramOptionValue} ${b + 1}`,
426
+ disabled: a.readonly
427
+ }, { ref_for: !0 }, I("options")), null, 16, ze), [
428
+ [G, t.value]
429
+ ]),
430
+ E(n("input", {
431
+ "onUpdate:modelValue": (P) => t.label = P,
432
+ "aria-label": `${e(l).paramOptionLabel} ${b + 1}`,
433
+ disabled: a.readonly
434
+ }, null, 8, Ge), [
435
+ [H, t.label]
436
+ ]),
437
+ n("button", {
438
+ type: "button",
439
+ "aria-label": `${e(l).paramOptionRemove} ${b + 1}`,
440
+ disabled: a.readonly,
441
+ onClick: (P) => B(b)
442
+ }, "×", 8, Ke)
443
+ ]))), 128)),
444
+ e(s).controlIssues("options").length ? (u(), d("small", {
445
+ key: 0,
446
+ id: `${D}-${e(g)}-options`,
447
+ class: "mr-param-editor__field-error"
448
+ }, r(e(s).controlIssues("options").join(";")), 9, Qe)) : f("", !0),
449
+ n("button", {
450
+ type: "button",
451
+ disabled: a.readonly,
452
+ onClick: F
453
+ }, "+ " + r(e(l).paramOptionAdd), 9, Xe)
454
+ ])) : f("", !0),
455
+ n("div", Ze, [
456
+ n("button", {
457
+ type: "button",
458
+ disabled: a.readonly || e(g) === 0,
459
+ onClick: o[11] || (o[11] = (t) => e(s).move(-1))
460
+ }, "↑ " + r(e(l).paramMoveUp), 9, ea),
461
+ n("button", {
462
+ type: "button",
463
+ disabled: a.readonly || e(g) === e(R).length - 1,
464
+ onClick: o[12] || (o[12] = (t) => e(s).move(1))
465
+ }, "↓ " + r(e(l).paramMoveDown), 9, aa),
466
+ n("button", {
467
+ type: "button",
468
+ class: "is-danger",
469
+ disabled: a.readonly,
470
+ onClick: o[13] || (o[13] = //@ts-ignore
471
+ (...t) => e(s).remove && e(s).remove(...t))
472
+ }, r(e(l).paramRemove), 9, ta)
473
+ ]),
474
+ n("details", la, [
475
+ n("summary", null, r(e(l).paramWire), 1),
476
+ n("code", null, r(e(ie)[e(i).type]), 1)
477
+ ])
478
+ ], 64)) : (u(), d("div", na, [
479
+ n("strong", null, r(e(l).paramEmpty), 1),
480
+ n("p", null, r(e(l).paramEmptyHint), 1),
481
+ n("button", {
482
+ type: "button",
483
+ disabled: a.readonly,
484
+ onClick: o[14] || (o[14] = //@ts-ignore
485
+ (...t) => e(s).add && e(s).add(...t))
486
+ }, "+ " + r(e(l).paramAdd), 9, ra)
487
+ ])),
488
+ e(L).added.length || e(L).removed.length ? (u(), d("aside", ia, [
489
+ n("strong", null, r(e(l).paramChanges), 1),
490
+ e(L).added.length ? (u(), d("p", oa, [
491
+ x(r(e(l).paramAdded) + ":", 1),
492
+ n("code", null, r(e(L).added.join(", ")), 1)
493
+ ])) : f("", !0),
494
+ e(L).removed.length ? (u(), d("p", sa, [
495
+ x(r(e(l).paramRemoved) + ":", 1),
496
+ n("code", null, r(e(L).removed.join(", ")), 1)
497
+ ])) : f("", !0),
498
+ n("small", null, r(e(l).paramRenameHint), 1)
499
+ ])) : f("", !0),
500
+ e(C) || e(j) ? (u(), d("p", ua, r(e(C) ? e(l).paramConflict : e(j)), 1)) : f("", !0),
501
+ n("footer", null, [
502
+ n("button", {
503
+ type: "button",
504
+ disabled: !e($) && !e(C),
505
+ onClick: o[15] || (o[15] = //@ts-ignore
506
+ (...t) => e(s).reset && e(s).reset(...t))
507
+ }, r(e(l).paramRestore), 9, da),
508
+ n("button", {
509
+ type: "button",
510
+ class: "is-primary",
511
+ disabled: a.readonly || !e($) || e(C) || !!e(V).length,
512
+ onClick: o[16] || (o[16] = //@ts-ignore
513
+ (...t) => e(s).apply && e(s).apply(...t))
514
+ }, r(e(l).paramApply), 9, ma)
515
+ ])
516
+ ], 512)
517
+ ], 8, me));
518
+ }
519
+ }), fa = /* @__PURE__ */ ne(pa, [["__scopeId", "data-v-d8a0f18a"]]);
520
+ export {
521
+ fa as default
522
+ };