@agile-team/mach-report 2.20.0 → 2.21.0
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/README.md +6 -2
- package/dist/{ExcelBindingWizard-B7aeRg46.cjs → ExcelBindingWizard-B2xXBOJu.cjs} +1 -1
- package/dist/{ExcelBindingWizard-Chn6ZC2-.js → ExcelBindingWizard-CixTPQAL.js} +3 -3
- package/dist/{ParamEditor-BdFMa1CX.cjs → ParamEditor-DhHlNxai.cjs} +1 -1
- package/dist/{ParamEditor-o-7E7WZZ.js → ParamEditor-gKhvEsnr.js} +1 -1
- package/dist/{ReportBatchPanel-DVpmB7tG.cjs → ReportBatchPanel-BUdUfTdm.cjs} +1 -1
- package/dist/{ReportBatchPanel-CNJ4Useq.js → ReportBatchPanel-D-lyWKyf.js} +1 -1
- package/dist/ReportLabelStudio-BcjQt73a.cjs +1 -0
- package/dist/ReportLabelStudio-N2w6DdaZ.js +764 -0
- package/dist/{ReportPreview-CGcxwkAn.js → ReportPreview-BBJNlu2U.js} +8 -8
- package/dist/{ReportPreview-hlwvZ1wf.cjs → ReportPreview-nf4Dk1Jc.cjs} +2 -2
- package/dist/{ReportTemplateLibrary-DjjyZnZB.cjs → ReportTemplateLibrary-Cs9WKneQ.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-DyIJhJjX.js → ReportTemplateLibrary-WZl-AK-2.js} +1 -1
- package/dist/{RuleEditor-BeknHHOD.js → RuleEditor-DGpmjCko.js} +3 -3
- package/dist/RuleEditor-Dtcq-7LO.cjs +1 -0
- package/dist/{TemplateOutlinePanel-D6TXg1aV.cjs → TemplateOutlinePanel-CkCh506f.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-Bv8CxbXS.js → TemplateOutlinePanel-cxp95OT9.js} +1 -1
- package/dist/{TemplateReusePanel-CfousvPY.js → TemplateReusePanel-BZ8VTtrO.js} +2 -2
- package/dist/{TemplateReusePanel-wrSbd_mr.cjs → TemplateReusePanel-CwttuSta.cjs} +1 -1
- package/dist/{TemplateReviewPanel-BKFcSbTh.cjs → TemplateReviewPanel-C2YjiaEC.cjs} +1 -1
- package/dist/{TemplateReviewPanel-F2tqWNLO.js → TemplateReviewPanel-C9cTvsRs.js} +1 -1
- package/dist/artifact-integrity.json +90 -92
- package/dist/{assets-2eC3mOcV.js → assets-CxHunY_9.js} +2 -2
- package/dist/{assets-B0Hxn4l6.cjs → assets-vbjAGgk8.cjs} +1 -1
- package/dist/{auto-BlchZ1b8.js → auto-BkdGiNtr.js} +4 -4
- package/dist/{auto-B0EZFIK1.cjs → auto-Tq7ReIC1.cjs} +1 -1
- package/dist/{component-tree-CvW4lzpv.js → component-tree-1_QCiQJX.js} +1 -1
- package/dist/component-tree-BjZIp6w9.cjs +1 -0
- package/dist/{data-bar-PtjXhMgN.js → data-bar-8baGYEZ9.js} +1 -1
- package/dist/{data-bar-Ce38juRZ.cjs → data-bar-YltqGTaC.cjs} +1 -1
- package/dist/designer-CDqok4S5.cjs +2 -0
- package/dist/designer-CIDHt5xz.js +6869 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +25 -3
- package/dist/designer.d.ts +25 -3
- package/dist/designer.js +1 -1
- package/dist/{encoding-B--eZpp1.cjs → encoding-B79hW4zq.cjs} +1 -1
- package/dist/{encoding-mctOLocI.js → encoding-BSeUwrN7.js} +2 -2
- package/dist/{font-loader-DBBJ5KE9.cjs → font-loader-BB372_XN.cjs} +1 -1
- package/dist/{font-loader-DW8tIaNp.js → font-loader-Di0lQKFf.js} +1 -1
- package/dist/grid-geometry-D3SJgWFv.js +136 -0
- package/dist/grid-geometry-D8ReblRV.cjs +1 -0
- package/dist/index.cjs +6 -6
- package/dist/index.js +194 -195
- package/dist/json-snapshot-I5VI84Vp.cjs +2 -0
- package/dist/{json-snapshot-By4ZVVUt.js → json-snapshot-Kgn459Oj.js} +895 -879
- package/dist/{pdf-DqyxJ96U.cjs → pdf-CARdBcuw.cjs} +45 -45
- package/dist/{pdf-CKROKygt.js → pdf-DmlnL5eB.js} +13 -14
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BMsIIJDh.cjs → plugin-BaRUGORD.cjs} +1 -1
- package/dist/{plugin-Co1oKD7T.js → plugin-D4kAxfLG.js} +1 -1
- package/dist/{prefill-D7EswyTI.cjs → prefill-Bpyn58AZ.cjs} +1 -1
- package/dist/{prefill-B8H9qwE4.js → prefill-CJSazcVY.js} +2 -2
- package/dist/{prepared-CGVphji3.cjs → prepared-BiSz_9vN.cjs} +1 -1
- package/dist/{prepared-BE-4jfX5.js → prepared-BwjwEzFz.js} +1 -1
- package/dist/{protocol-Cr81vFSQ.js → protocol-Bs9-ohHN.js} +3 -3
- package/dist/{protocol-ByRVzzQG.cjs → protocol-C8VWF9An.cjs} +1 -1
- package/dist/record-bindings-Ct1HkPrc.cjs +1 -0
- package/dist/{record-bindings-DEJtmo3p.js → record-bindings-VZGS-Qd8.js} +1 -1
- package/dist/{region-binding-workflow-CBg0l_tj.js → region-binding-workflow-Cy4GIOUo.js} +2 -2
- package/dist/{region-binding-workflow-D05tOYn3.cjs → region-binding-workflow-JNowHd0A.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-K48VHUoW.cjs +3 -0
- package/dist/{rich-text-layout-Ct5WrY1g.js → rich-text-layout-wxBhnAS7.js} +1 -1
- package/dist/{runtime-CEMvybO7.js → runtime-BDf5x1i1.js} +5 -5
- package/dist/runtime-DsJt1PIf.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +1272 -1274
- package/dist/server.cjs +1 -1
- package/dist/server.js +8 -8
- package/dist/style.css +1 -1
- package/dist/{template-catalog-CmbWOJqy.js → template-catalog-DFwIS9aN.js} +3 -3
- package/dist/{template-catalog-Utu4GP09.cjs → template-catalog-D_2jdnkL.cjs} +1 -1
- package/dist/template-fragments-DZVUBhuB.cjs +1 -0
- package/dist/{template-fragments-DWgo9tlZ.js → template-fragments-Dng-AlHk.js} +11 -11
- package/dist/{template-registry-BIhIHOab.js → template-registry-DhBqoD7W.js} +120 -118
- package/dist/template-registry-DpLUSLwF.cjs +1 -0
- package/dist/{column-visual-BpgQVWwT.js → template-serialization-Cc3h-miv.js} +74 -65
- package/dist/{column-visual-CtYxnBCP.cjs → template-serialization-D1R5oAqh.cjs} +1 -1
- package/dist/{textwrap-BEIg2w8y.js → textwrap-CkGjRFT3.js} +1 -1
- package/dist/textwrap-OTOUMr4f.cjs +4 -0
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +4 -4
- package/dist/{workbook-session-B94EwVa_.cjs → workbook-session-NYv01LHe.cjs} +1 -1
- package/dist/{workbook-session-BoScoOg-.js → workbook-session-oinxX3qo.js} +2 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.js +204 -205
- package/package.json +1 -1
- package/dist/ReportLabelStudio-Drsm9sAS.cjs +0 -1
- package/dist/ReportLabelStudio-r8VFnhGQ.js +0 -589
- package/dist/RuleEditor-BVuRn_OQ.cjs +0 -1
- package/dist/component-tree-6TV7W6Yj.cjs +0 -1
- package/dist/designer-B52ddmHO.js +0 -6676
- package/dist/designer-Dtsw_rh7.cjs +0 -2
- package/dist/grid-geometry-BNptEcMm.js +0 -65
- package/dist/grid-geometry-CZ_cYB6O.cjs +0 -1
- package/dist/json-snapshot-jiXff4lc.cjs +0 -2
- package/dist/record-bindings-ehjnCDHt.cjs +0 -1
- package/dist/rich-text-layout-ALlMoYOG.cjs +0 -3
- package/dist/runtime-CDA6d263.cjs +0 -1
- package/dist/style-67OqfNed.js +0 -73
- package/dist/style-C22Pbv3T.cjs +0 -1
- package/dist/template-fragments-C_zSHJAa.cjs +0 -1
- package/dist/template-registry-DzWswQI5.cjs +0 -1
- package/dist/textwrap-BI-yJ6Wt.cjs +0 -4
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),de=require("@agile-team/mach-report/vue"),te=require("./designer-Dtsw_rh7.cjs"),H=require("./_plugin-vue_export-helper-BLmdZLlg.cjs"),g=require("@agile-team/mach-report"),Ce=require("@agile-team/mach-report/codes"),Z=[{id:"material",widthMm:80,heightMm:55,faces:1},{id:"paired",widthMm:80,heightMm:55,faces:2},{id:"warehouse",widthMm:100,heightMm:60,faces:1}];function ce(t,i){return i??t.fields.find(r=>r.semanticRole==="identifier"&&r.field!==t.rowKey)?.field??t.rowKey??t.fields[0]?.field}function W(t,i,r){const s=t.fields.filter(l=>l.field!==i&&l.field!==t.rowKey);if(r===void 0)return s.map((l,d)=>({field:l,index:d,priority:Me(l)})).sort((l,d)=>l.priority-d.priority||l.index-d.index).slice(0,5).map(l=>l.field);const c=new Map(s.map(l=>[l.field,l])),n=[...new Set(r)];if(n.length>5)throw new Error("成品标签最多显示 5 个字段,请先精简显示字段");return n.map(l=>{const d=c.get(l);if(!d)throw new Error(`标签显示字段未在业务契约中声明:${l}`);return d})}function Me(t){return/^(?:name|title|label|category)$/i.test(t.field)||/名称|品名|品类|类别/.test(t.label??"")?0:t.semanticRole==="dimension"?1:t.semanticRole==="measure"&&t.unit?2:t.semanticRole==="identifier"?3:t.semanticRole==="date"?4:5}function _e(t="paired"){return Z.find(i=>i.id===t)??Z[1]}const ne="#173450",X="#586c82";function k(t,i,r,s,c=4,n=7){return{kind:"text",text:t,leftMm:i,topMm:r,widthMm:s,heightMm:c,style:{fontSize:n,lineHeight:1.1,color:ne,verticalAlign:"middle"}}}function le(t,i){return{kind:"line",leftMm:4,topMm:t,widthMm:i-8,heightMm:.2,style:{lineColor:"#c9d7e5",lineWidthPt:.55}}}function fe(t,i,r){const s=[];let c=4;if(r?.logoData){if(!/^data:image\/(?:png|jpeg);base64,/i.test(r.logoData))throw new Error("标签Logo须使用PNG或JPEG图片数据");s.push({kind:"image",leftMm:4,topMm:3,widthMm:12,heightMm:7,imageData:r.logoData,meta:{labelBrandLogo:!0}}),c=19}return s.push({...k(r?.name?.trim()||t,c,3,i-c-4,5,9),style:{fontSize:9,color:"#205582"}}),r?.tagline?.trim()&&s.push({...k(r.tagline.trim(),c,8,i-c-4,3,5.5),style:{fontSize:5.5,color:X}}),s.push(le(12,i)),s}function me(t,i,r,s,c=4.7){return t.flatMap((n,l)=>{const d=i+l*c;return[{...k(n.label??n.field,4,d,r,4,6),style:{fontSize:6,color:X}},{...k("",4+r,d,s,4,7),binding:{field:n.field,...n.format?{format:n.format}:{}}}]})}function Te(t,i){return t?[{...k("",4,14,i,7,14),binding:{field:t},style:{fontSize:14,color:ne}}]:[]}function xe(t,i,r,s){const c=W(t,r,s.fields),n=[...fe(i,80,s.brand),...Te(r,71),...me(c,23,21,27)];r&&n.push({kind:"qrcode",leftMm:55,topMm:23,widthMm:20,heightMm:20,binding:{field:r},code:{quietZoneModules:4,errorCorrection:"M"}}),n.push(le(48,80));const l=t.fields.find(d=>d.field===r)?.label??i;return n.push({...k(l,4,49,71,3,5.8),style:{fontSize:5.8,color:X}}),n}function ie(t,i,r,s,c=80){const n=fe(i,c,s.brand);r&&(n.push({...k("",4,14,c-8,8,16),binding:{field:r},style:{fontSize:16,align:"center",color:ne}}),n.push({kind:"qrcode",leftMm:(c-20)/2,topMm:23,widthMm:20,heightMm:20,binding:{field:r},code:{quietZoneModules:4,errorCorrection:"M"}})),n.push(le(44,c));const l=W(t,r,s.fields);return c===100?l.forEach((d,v)=>{const b=v%2===0?4:52,p=46+Math.floor(v/2)*4.3;n.push({...k(d.label??d.field,b,p,19,3.7,5.8),style:{fontSize:5.8,color:X}}),n.push({...k("",b+19,p,25,3.7,6.5),binding:{field:d.field,...d.format?{format:d.format}:{}}})}):n.push(...me(l.slice(0,1),46,24,c-32,5)),n}function se(t,i,r,s={}){const c=ce(t,r),n=_e(s.preset),l=Object.fromEntries(["name","tagline"].flatMap(p=>{const V=s.brand?.[p];return typeof V=="string"?[[p,V]]:[]})),d={preset:n.id,brand:l,fields:W(t,c,s.fields).map(p=>p.field)},v=n.id==="warehouse"?ie(t,i,c,s,n.widthMm):xe(t,i,c,s),b=[{widthMm:n.widthMm,heightMm:n.heightMm,meta:{title:`${i} · 1`,labelStudio:d},components:v}];return n.faces===2&&b.push({widthMm:n.widthMm,heightMm:n.heightMm,meta:{title:`${i} · 2`,labelStudio:d},components:ie(t,i,c,s)}),g.defineReportTemplate({id:"record-label",name:i,template:g.createLabelTemplate({dataset:"records",rowKey:t.rowKey,pages:b})})}function T(t){const i=t.template.pages[0]?.meta?.labelStudio;if(!i||typeof i!="object")return;const r=i,s=Z.find(d=>d.id===r.preset);if(!s)return;const c=Array.isArray(r.fields)?r.fields.filter(d=>typeof d=="string"):void 0;if(c&&c.length>5)return;const n=r.brand&&typeof r.brand=="object"?r.brand:{},l={};for(const d of["name","tagline","logoData"])typeof n[d]=="string"&&(l[d]=n[d]);return{preset:s.id,fields:c,brand:l}}function ue(t,i,r){const s=new Set(t.fields.filter(n=>n.field!==i&&n.field!==t.rowKey).map(n=>n.field)),c=r?.filter(n=>s.has(n));return W(t,i,c).map(n=>n.field)}function Be(t,i){const r=e.computed(()=>({...te.LABEL_STUDIO_MESSAGES,...t.messages})),s=e.computed(()=>t.title??r.value.title),c={preset:t.preset,brand:t.brand,fields:t.fields},n=e.shallowRef(t.modelValue?g.parseReportTemplate(t.modelValue):se(t.schema,s.value,t.identityField,c));let l=g.parseReportTemplate(n.value);e.onMounted(()=>{t.modelValue||i(g.parseReportTemplate(n.value))});const d=e.ref("preview"),v=e.ref("all"),b=e.ref(1),p=e.ref(!1),V=e.ref(!1),m=e.ref(),w=te.useTemplateDiscard(()=>t.beforeDiscard),N=e.computed(()=>V.value||w.pending.value||m.value?.saving===!0||m.value?.blocked===!0),E=e.ref(""),K=e.computed(()=>ce(t.schema,t.identityField)),x=e.ref(T(n.value)?.preset??(t.modelValue?void 0:t.preset??"paired")),R=e.ref(T(n.value)?.brand?.name??t.brand?.name??""),L=e.ref(T(n.value)?.brand?.tagline??t.brand?.tagline??""),h=e.ref(ue(t.schema,K.value,T(n.value)?.fields??t.fields)),O=e.ref(""),J=e.computed(()=>t.schema.fields.filter(a=>a.field!==K.value&&a.field!==t.schema.rowKey)),F=e.computed(()=>h.value.map(a=>({field:a,label:t.schema.fields.find(f=>f.field===a)?.label??a}))),Y=e.computed(()=>{const a=O.value.trim().toLocaleLowerCase();return J.value.filter(f=>`${f.label??""} ${f.field}`.toLocaleLowerCase().includes(a)).slice(0,30)}),$=e.computed(()=>{const a=n.value.template.pages[0]?.components.find(f=>f.kind==="image"&&f.meta?.labelBrandLogo);return a?.kind==="image"?a.imageData:t.brand?.logoData}),A=e.computed(()=>({preset:x.value,fields:h.value,brand:{...t.brand,...$.value?{logoData:$.value}:{},name:R.value,tagline:L.value}}));let C=JSON.stringify(T(n.value));const U=e.computed(()=>!T(n.value)),B=()=>JSON.stringify({preset:x.value,fields:h.value,name:R.value,tagline:L.value}),z=e.ref(B()),q=e.computed(()=>B()!==z.value),I=e.computed(()=>q.value||m.value?.pendingLocalChanges===!0);function j(){const a=T(n.value);x.value=a?.preset,h.value=ue(t.schema,K.value,a?.fields??t.fields),R.value=a?.brand?.name??t.brand?.name??"",L.value=a?.brand?.tagline??t.brand?.tagline??"",C=JSON.stringify(a),z.value=B()}function G(a){const f=T(a),y=JSON.stringify(f);y!==C&&(C=y,j())}let S=!1;e.onScopeDispose(()=>{S=!0});const Q={assetRenderers:Ce.createCodeAssetRenderers()};de.provideMachReportConfig({get defaults(){return{assets:Q,...t.preview}}}),e.watch(()=>t.modelValue,a=>{a&&g.serializeReportTemplate(a)!==g.serializeReportTemplate(n.value)&&(n.value=g.parseReportTemplate(a),l=g.parseReportTemplate(a),G(a))}),e.watch(()=>t.rows,()=>{v.value="all",b.value=1});function D(a){E.value="",n.value=a,G(a),i(a)}function P(a,f){f&&h.value.length<5&&!h.value.includes(a)?h.value=[...h.value,a]:f||(h.value=h.value.filter(y=>y!==a))}function u(){if(N.value||S)return!1;if(!x.value)return E.value=r.value.choosePreset,!1;if(m.value?.canApply===!1)return E.value=m.value.saveReason||r.value.applyFirst,!1;try{const a=se(t.schema,s.value,t.identityField,A.value),f=n.value.template.repeat;if(f?.copies!==void 0&&a.template.repeat&&(a.template.repeat.copies=f.copies),m.value?.applyTemplate){if(!m.value.applyTemplate(a.template))return E.value=r.value.saveFailed,!1}else D({...n.value,template:a.template});return z.value=B(),!0}catch(a){return E.value=a instanceof Error?a.message:r.value.saveFailed,!1}}const o=e.computed(()=>v.value==="all"?t.rows:Number.isSafeInteger(b.value)&&t.rows[b.value-1]?[t.rows[b.value-1]]:[]),M=e.computed(()=>n.value.template.repeat?.dataset??"records"),pe=e.computed(()=>({[M.value]:o.value})),ge=e.computed(()=>({[M.value]:o.value.slice(0,3)})),ve=e.computed(()=>({[M.value]:t.schema})),be=e.computed(()=>[{id:M.value,label:s.value,rowKey:t.schema.rowKey,fields:t.schema.fields}]),he=e.computed(()=>n.value.template.pages[0]),ae=e.computed(()=>n.value.template.pages.length),ye=e.computed(()=>{const a=n.value.template.repeat?.copies??1;return typeof a=="number"?a:void 0}),Ve=e.computed(()=>{const a=n.value.template.repeat?.copies;return typeof a=="object"?a.field:void 0}),re=e.computed(()=>{const a=Ve.value;if(!a)return;let f=0;for(const y of o.value){const _=Object.getOwnPropertyDescriptor(y,a)?.value;if(typeof _!="number"||!Number.isSafeInteger(_)||_<1||_>1e3)return;f+=_}return f}),Ne=e.computed(()=>{const a=ye.value;return a!==void 0?Number.isSafeInteger(a)&&a>=1&&a<=1e3?o.value.length*a*ae.value:void 0:re.value===void 0?void 0:re.value*ae.value}),Ee=e.computed(()=>{const a=g.createReportSource({labels:g.defineLabelReport({template:n.value.template,rows:o.value,dataSchema:t.schema})}),f=p.value;return async y=>{const _=await a(y);return f?g.imposeLabelSheets(_,{paper:"a4",columns:2,rows:4,marginMm:12,gapMm:4,signal:y.signal}):_}}),we=async(a,f)=>{const y=t.save?await t.save(a,f):g.parseReportTemplate(a);if(S||f.signal.aborted)throw new DOMException("标签模板保存已取消","AbortError");return l=g.parseReportTemplate(y),D(y),y};async function oe(){if(!(N.value||S)&&!(q.value&&!u())){V.value=!0;try{if(m.value){if(m.value.canApply===!1){E.value=m.value.saveReason||r.value.applyFirst;return}if(m.value.pendingLocalChanges&&await m.value.save(),m.value.pendingLocalChanges){E.value=r.value.saveFailed;return}}if(!S)return E.value="",g.parseReportTemplate(n.value)}finally{V.value=!1}}}async function Se(a){a!==d.value&&await oe()&&(d.value=a)}let ee=!1;const De=a=>ee||w.request(a);async function ke(){if(N.value)return!1;const a=m.value?.pendingLocalChanges===!0;if(!a&&!q.value)return!0;if(!(a&&m.value?await m.value.guardChanges():await w.request({reason:"replace",document:g.parseReportTemplate(n.value),pendingLocalChanges:!0}))||S)return!1;if(a&&m.value){ee=!0;try{await m.value.reset()}finally{ee=!1}D(g.parseReportTemplate(l))}return j(),!0}return{m:r,notice:E,title:s,document:n,mode:d,record:v,recordIndex:b,sheet:p,busy:N,editor:m,rows:o,datasets:pe,designDatasets:ge,schemas:ve,bindings:be,paper:he,labelCount:Ne,fetcher:Ee,update:D,save:we,navigate:Se,prepare:oe,guardChanges:ke,preset:x,presets:Z,brandName:R,brandTagline:L,fields:h,fieldQuery:O,selectedFields:F,availableFields:Y,fieldCount:e.computed(()=>J.value.length),configurationDirty:q,pendingLocalChanges:I,custom:U,toggleField:P,applyConfiguration:u,restoreConfiguration:j,beforeDiscard:De,confirmation:w.confirmation,decideDiscard:w.decide}}const Re=["aria-label"],Le={class:"mr-label-context"},Fe={class:"mr-label-identity"},$e={class:"mr-label-spec"},ze=["disabled"],qe=["aria-label"],Pe=["aria-pressed","onClick"],Ke={class:"mr-label-fields"},Oe={key:0,class:"mr-label-selected-fields"},Ae=["aria-label","onClick"],Ue={class:"mr-label-field-search"},Ie=["aria-label","placeholder"],je={class:"mr-label-field-options"},He=["checked","disabled","onChange"],Je={key:0},Ge={key:1},Qe={class:"mr-label-brand"},Ze=["placeholder"],We=["disabled"],Xe={key:1,class:"mr-label-reflow-hint"},Ye={class:"mr-label-reflow-hint"},et={class:"mr-label-record"},tt=["disabled"],nt={value:"all"},lt={value:"single"},at={key:0,class:"mr-label-record-index"},rt=["max","aria-label","disabled"],ot={class:"mr-label-count"},it={class:"mr-label-help"},st={class:"mr-label-main"},ut={class:"mr-label-bar"},dt=["aria-label"],ct=["aria-pressed","disabled"],ft=["aria-pressed","disabled"],mt={key:0,class:"mr-label-notice",role:"status"},pt=["aria-label"],gt={class:"mr-label-imposition"},vt={class:"mr-label-editor"},bt=e.defineComponent({__name:"ReportLabelStudio",props:{showSave:{type:Boolean,default:!0},rows:{},schema:{},title:{},identityField:{},modelValue:{},preview:{},save:{},beforeDiscard:{},messages:{},preset:{},brand:{},fields:{}},emits:["update:modelValue"],setup(t,{expose:i,emit:r}){const s=t,c=r,n=Be(s,P=>c("update:modelValue",P)),{m:l,notice:d,title:v,document:b,mode:p,record:V,recordIndex:m,sheet:w,busy:N,editor:E,rows:K,designDatasets:x,schemas:R,bindings:L,paper:h,labelCount:O,fetcher:J,preset:F,presets:Y,brandName:$,brandTagline:A,fields:C,fieldQuery:U,selectedFields:B,availableFields:z,fieldCount:q,configurationDirty:I,pendingLocalChanges:j,custom:G,confirmation:S}=n,Q=e.ref();let D=null;return e.watch(S,async P=>{P?(D=window.document.activeElement,await e.nextTick(),Q.value?.focus()):D?.isConnected&&(D.focus(),D=null)}),i({guardChanges:n.guardChanges,prepare:n.prepare,get busy(){return N.value},get pendingLocalChanges(){return j.value}}),(P,u)=>(e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["mr-label-studio",{"is-design":e.unref(p)==="design"}]),"aria-label":e.unref(v)},[e.createElementVNode("aside",Le,[e.createElementVNode("div",Fe,[e.createVNode(H._sfc_main,{name:"file",size:18}),e.createElementVNode("strong",null,e.toDisplayString(e.unref(v)),1),e.createElementVNode("small",null,e.toDisplayString(e.unref(G)?e.unref(l).customTemplate:e.unref(l).readyTemplate),1)]),e.createElementVNode("div",$e,[e.createElementVNode("strong",null,[e.createTextVNode(e.toDisplayString(e.unref(h)?.widthMm)+" ",1),u[13]||(u[13]=e.createElementVNode("i",null,"×",-1)),e.createTextVNode(" "+e.toDisplayString(e.unref(h)?.heightMm),1)]),e.createElementVNode("span",null,"mm · "+e.toDisplayString(e.unref(b).template.pages.length)+" "+e.toDisplayString(e.unref(l).faces),1)]),e.createElementVNode("fieldset",{class:"mr-label-quick",disabled:e.unref(N)},[e.createElementVNode("legend",null,e.toDisplayString(e.unref(l).layout),1),e.createElementVNode("div",{class:"mr-label-presets","aria-label":e.unref(l).layout},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Y),o=>(e.openBlock(),e.createElementBlock("button",{key:o.id,type:"button","aria-pressed":e.unref(F)===o.id,onClick:M=>F.value=o.id},[e.createElementVNode("span",{class:e.normalizeClass(["mr-label-preset-art",`is-${o.id}`]),"aria-hidden":"true"},[...u[14]||(u[14]=[e.createElementVNode("i",null,null,-1),e.createElementVNode("i",null,null,-1),e.createElementVNode("i",null,null,-1)])],2),e.createElementVNode("span",null,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(l)[`${o.id}Preset`]),1),e.createElementVNode("small",null,e.toDisplayString(o.widthMm)+" × "+e.toDisplayString(o.heightMm)+" · "+e.toDisplayString(o.faces)+" "+e.toDisplayString(e.unref(l).faces),1)])],8,Pe))),128))],8,qe),e.createElementVNode("details",Ke,[e.createElementVNode("summary",null,[e.createTextVNode(e.toDisplayString(e.unref(l).fields)+" ",1),e.createElementVNode("span",null,e.toDisplayString(e.unref(C).length)+" / 5",1)]),e.unref(B).length?(e.openBlock(),e.createElementBlock("div",Oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(B),o=>(e.openBlock(),e.createElementBlock("button",{key:o.field,type:"button","aria-label":`${e.unref(l).removeField} ${o.label}`,onClick:M=>e.unref(n).toggleField(o.field,!1)},[e.createTextVNode(e.toDisplayString(o.label)+" ",1),u[15]||(u[15]=e.createElementVNode("span",{"aria-hidden":"true"},"×",-1))],8,Ae))),128))])):e.createCommentVNode("",!0),e.createElementVNode("label",Ue,[e.createVNode(H._sfc_main,{name:"search",size:13}),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[0]||(u[0]=o=>e.isRef(U)?U.value=o:null),type:"search","aria-label":e.unref(l).findField,placeholder:e.unref(l).findField},null,8,Ie),[[e.vModelText,e.unref(U)]])]),e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(z),o=>(e.openBlock(),e.createElementBlock("label",{key:o.field},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(C).includes(o.field),disabled:!e.unref(C).includes(o.field)&&e.unref(C).length>=5,onChange:M=>e.unref(n).toggleField(o.field,M.target.checked)},null,40,He),e.createElementVNode("span",null,e.toDisplayString(o.label??o.field),1)]))),128)),e.unref(z).length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",Je,e.toDisplayString(e.unref(l).noFields),1))]),e.createElementVNode("small",null,e.toDisplayString(e.unref(l).fieldLimit),1),e.unref(q)>30?(e.openBlock(),e.createElementBlock("small",Ge,e.toDisplayString(e.unref(l).fieldSearchHint),1)):e.createCommentVNode("",!0)]),e.createElementVNode("details",Qe,[e.createElementVNode("summary",null,e.toDisplayString(e.unref(l).brand),1),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(l).brandName),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[1]||(u[1]=o=>e.isRef($)?$.value=o:null),maxlength:"80",placeholder:e.unref(v)},null,8,Ze),[[e.vModelText,e.unref($)]])]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(l).brandTagline),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[2]||(u[2]=o=>e.isRef(A)?A.value=o:null),maxlength:"120"},null,512),[[e.vModelText,e.unref(A)]])])]),e.createElementVNode("button",{class:"mr-label-apply",type:"button",disabled:!e.unref(I)||!e.unref(F),onClick:u[3]||(u[3]=(...o)=>e.unref(n).applyConfiguration&&e.unref(n).applyConfiguration(...o))},[e.createVNode(H._sfc_main,{name:"arrow-right",size:13}),e.createTextVNode(e.toDisplayString(e.unref(l).applyLayout),1)],8,We),e.unref(I)?(e.openBlock(),e.createElementBlock("button",{key:0,class:"mr-label-reset-configuration",type:"button",onClick:u[4]||(u[4]=(...o)=>e.unref(n).restoreConfiguration&&e.unref(n).restoreConfiguration(...o))},e.toDisplayString(e.unref(l).restoreConfiguration),1)):e.createCommentVNode("",!0),e.unref(I)&&!e.unref(F)?(e.openBlock(),e.createElementBlock("p",Xe,e.toDisplayString(e.unref(l).choosePreset),1)):e.createCommentVNode("",!0),e.createElementVNode("p",Ye,e.toDisplayString(e.unref(l).reflowHint),1)],8,ze),e.createElementVNode("label",et,[e.createTextVNode(e.toDisplayString(e.unref(l).records),1),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":u[5]||(u[5]=o=>e.isRef(V)?V.value=o:null),disabled:e.unref(N)||!s.rows.length},[e.createElementVNode("option",nt,e.toDisplayString(e.unref(l).all)+" · "+e.toDisplayString(s.rows.length),1),e.createElementVNode("option",lt,e.toDisplayString(e.unref(l).single),1)],8,tt),[[e.vModelSelect,e.unref(V)]])]),e.unref(V)==="single"?(e.openBlock(),e.createElementBlock("label",at,[e.createTextVNode(e.toDisplayString(e.unref(l).record),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[6]||(u[6]=o=>e.isRef(m)?m.value=o:null),type:"number",min:"1",max:s.rows.length,"aria-label":e.unref(l).record,disabled:e.unref(N)},null,8,rt),[[e.vModelText,e.unref(m),void 0,{number:!0}]]),e.createTextVNode(" / "+e.toDisplayString(s.rows.length),1)])):e.createCommentVNode("",!0),e.createElementVNode("p",ot,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(K).length),1),e.createTextVNode(" "+e.toDisplayString(e.unref(l).count)+" ",1),u[16]||(u[16]=e.createElementVNode("span",null,"→",-1)),u[17]||(u[17]=e.createTextVNode()),e.unref(O)!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("strong",null,e.toDisplayString(e.unref(O)),1),e.createTextVNode(" "+e.toDisplayString(e.unref(l).labels),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(e.unref(l).invalidCopies),1)],64))]),e.createElementVNode("details",it,[e.createElementVNode("summary",null,e.toDisplayString(e.unref(l).guide),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(l).help),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(l).printHint),1)])]),e.createElementVNode("div",st,[e.createElementVNode("header",ut,[e.createElementVNode("nav",{"aria-label":e.unref(v)},[e.createElementVNode("button",{type:"button","aria-pressed":e.unref(p)==="preview",disabled:e.unref(N),onClick:u[7]||(u[7]=o=>e.unref(n).navigate("preview"))},[e.createVNode(H._sfc_main,{name:"file",size:14}),e.createTextVNode(e.toDisplayString(e.unref(l).preview),1)],8,ct),e.createElementVNode("button",{type:"button","aria-pressed":e.unref(p)==="design",disabled:e.unref(N),onClick:u[8]||(u[8]=o=>e.unref(n).navigate("design"))},[e.createVNode(H._sfc_main,{name:"settings",size:14}),e.createTextVNode(e.toDisplayString(e.unref(l).design),1)],8,ft)],8,dt),e.createElementVNode("span",null,e.toDisplayString(e.unref(p)==="design"?e.unref(l).designHint:e.unref(l).flow),1)]),e.unref(d)?(e.openBlock(),e.createElementBlock("p",mt,e.toDisplayString(e.unref(d)),1)):e.createCommentVNode("",!0),e.unref(S)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"mr-label-confirm",role:"alertdialog","aria-label":e.unref(l).discardTitle,onKeydown:u[11]||(u[11]=e.withKeys(e.withModifiers(o=>e.unref(n).decideDiscard(!1),["prevent","stop"]),["esc"]))},[e.createElementVNode("div",null,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(l).discardTitle),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(l).discardDescription),1)]),e.createElementVNode("button",{ref_key:"keepEditingButton",ref:Q,type:"button",onClick:u[9]||(u[9]=o=>e.unref(n).decideDiscard(!1))},e.toDisplayString(e.unref(l).keepEditing),513),e.createElementVNode("button",{type:"button",onClick:u[10]||(u[10]=o=>e.unref(n).decideDiscard(!0))},e.toDisplayString(e.unref(l).discard),1)],40,pt)):e.createCommentVNode("",!0),e.unref(p)==="preview"?(e.openBlock(),e.createBlock(e.unref(de.ReportPreview),{key:2,"report-id":"labels",fetcher:e.unref(J),"show-params":!1,height:"100%",toolbar:{exportFormats:["pdf","png","html"],editing:!1,excelImport:!1},messages:{title:e.unref(v),empty:e.unref(l).empty}},{settings:e.withCtx(()=>[e.createElementVNode("label",gt,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[12]||(u[12]=o=>e.isRef(w)?w.value=o:null),type:"checkbox"},null,512),[[e.vModelCheckbox,e.unref(w)]]),e.createTextVNode(e.toDisplayString(e.unref(l).sheet),1),e.createElementVNode("small",null,e.toDisplayString(e.unref(l).sheetHint),1)])]),_:1},8,["fetcher","messages"])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",vt,[e.createVNode(te.ReportTemplateEditor,{ref_key:"editor",ref:E,"model-value":e.unref(b),mode:"design","show-mode-switch":!1,"show-save":t.showSave,capabilities:{params:!1},datasets:e.unref(x),"data-schemas":e.unref(R),"binding-datasets":e.unref(L),save:e.unref(n).save,"before-discard":e.unref(n).beforeDiscard,preview:t.preview,"onUpdate:modelValue":e.unref(n).update},null,8,["model-value","show-save","datasets","data-schemas","binding-datasets","save","before-discard","preview","onUpdate:modelValue"])],512),[[e.vShow,e.unref(p)==="design"]])])],10,Re))}});exports.default=bt;
|
|
@@ -1,589 +0,0 @@
|
|
|
1
|
-
import { computed as p, shallowRef as Ue, onMounted as Ie, ref as k, onScopeDispose as qe, watch as ve, defineComponent as je, nextTick as He, openBlock as b, createElementBlock as y, unref as e, normalizeClass as Me, createElementVNode as i, createVNode as Q, toDisplayString as o, createTextVNode as w, Fragment as ae, renderList as pe, createCommentVNode as V, withDirectives as O, isRef as Z, vModelText as re, vModelSelect as Je, withKeys as Ge, withModifiers as Qe, createBlock as Ze, withCtx as We, vModelCheckbox as Xe, vShow as Ye } from "vue";
|
|
2
|
-
import { provideMachReportConfig as et, ReportPreview as tt } from "@agile-team/mach-report/vue";
|
|
3
|
-
import { L as lt, c as at, d as nt } from "./designer-B52ddmHO.js";
|
|
4
|
-
import { a as ne } from "./_plugin-vue_export-helper-8SL1F89S.js";
|
|
5
|
-
import { defineReportTemplate as it, createLabelTemplate as st, parseReportTemplate as x, serializeReportTemplate as Ce, createReportSource as ot, defineLabelReport as rt, imposeLabelSheets as dt } from "@agile-team/mach-report";
|
|
6
|
-
import { createCodeAssetRenderers as ut } from "@agile-team/mach-report/codes";
|
|
7
|
-
const de = [
|
|
8
|
-
{ id: "material", widthMm: 80, heightMm: 55, faces: 1 },
|
|
9
|
-
{ id: "paired", widthMm: 80, heightMm: 55, faces: 2 },
|
|
10
|
-
{ id: "warehouse", widthMm: 100, heightMm: 60, faces: 1 }
|
|
11
|
-
];
|
|
12
|
-
function Le(t, d) {
|
|
13
|
-
return d ?? t.fields.find((s) => s.semanticRole === "identifier" && s.field !== t.rowKey)?.field ?? t.rowKey ?? t.fields[0]?.field;
|
|
14
|
-
}
|
|
15
|
-
function ue(t, d, s) {
|
|
16
|
-
const u = t.fields.filter((a) => a.field !== d && a.field !== t.rowKey);
|
|
17
|
-
if (s === void 0)
|
|
18
|
-
return u.map((a, f) => ({ field: a, index: f, priority: ct(a) })).sort((a, f) => a.priority - f.priority || a.index - f.index).slice(0, 5).map((a) => a.field);
|
|
19
|
-
const m = new Map(u.map((a) => [a.field, a])), l = [...new Set(s)];
|
|
20
|
-
if (l.length > 5) throw new Error("成品标签最多显示 5 个字段,请先精简显示字段");
|
|
21
|
-
return l.map((a) => {
|
|
22
|
-
const f = m.get(a);
|
|
23
|
-
if (!f) throw new Error(`标签显示字段未在业务契约中声明:${a}`);
|
|
24
|
-
return f;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function ct(t) {
|
|
28
|
-
return /^(?:name|title|label|category)$/i.test(t.field) || /名称|品名|品类|类别/.test(t.label ?? "") ? 0 : t.semanticRole === "dimension" ? 1 : t.semanticRole === "measure" && t.unit ? 2 : t.semanticRole === "identifier" ? 3 : t.semanticRole === "date" ? 4 : 5;
|
|
29
|
-
}
|
|
30
|
-
function ft(t = "paired") {
|
|
31
|
-
return de.find((d) => d.id === t) ?? de[1];
|
|
32
|
-
}
|
|
33
|
-
const ge = "#173450", ce = "#586c82";
|
|
34
|
-
function $(t, d, s, u, m = 4, l = 7) {
|
|
35
|
-
return {
|
|
36
|
-
kind: "text",
|
|
37
|
-
text: t,
|
|
38
|
-
leftMm: d,
|
|
39
|
-
topMm: s,
|
|
40
|
-
widthMm: u,
|
|
41
|
-
heightMm: m,
|
|
42
|
-
style: { fontSize: l, lineHeight: 1.1, color: ge, verticalAlign: "middle" }
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function be(t, d) {
|
|
46
|
-
return {
|
|
47
|
-
kind: "line",
|
|
48
|
-
leftMm: 4,
|
|
49
|
-
topMm: t,
|
|
50
|
-
widthMm: d - 8,
|
|
51
|
-
heightMm: 0.2,
|
|
52
|
-
style: { lineColor: "#c9d7e5", lineWidthPt: 0.55 }
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function De(t, d, s) {
|
|
56
|
-
const u = [];
|
|
57
|
-
let m = 4;
|
|
58
|
-
if (s?.logoData) {
|
|
59
|
-
if (!/^data:image\/(?:png|jpeg);base64,/i.test(s.logoData))
|
|
60
|
-
throw new Error("标签Logo须使用PNG或JPEG图片数据");
|
|
61
|
-
u.push({ kind: "image", leftMm: 4, topMm: 3, widthMm: 12, heightMm: 7, imageData: s.logoData, meta: { labelBrandLogo: !0 } }), m = 19;
|
|
62
|
-
}
|
|
63
|
-
return u.push({ ...$(s?.name?.trim() || t, m, 3, d - m - 4, 5, 9), style: { fontSize: 9, color: "#205582" } }), s?.tagline?.trim() && u.push({ ...$(s.tagline.trim(), m, 8, d - m - 4, 3, 5.5), style: { fontSize: 5.5, color: ce } }), u.push(be(12, d)), u;
|
|
64
|
-
}
|
|
65
|
-
function Fe(t, d, s, u, m = 4.7) {
|
|
66
|
-
return t.flatMap((l, a) => {
|
|
67
|
-
const f = d + a * m;
|
|
68
|
-
return [
|
|
69
|
-
{ ...$(l.label ?? l.field, 4, f, s, 4, 6), style: { fontSize: 6, color: ce } },
|
|
70
|
-
{ ...$("", 4 + s, f, u, 4, 7), binding: { field: l.field, ...l.format ? { format: l.format } : {} } }
|
|
71
|
-
];
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function mt(t, d) {
|
|
75
|
-
return t ? [{ ...$("", 4, 14, d, 7, 14), binding: { field: t }, style: { fontSize: 14, color: ge } }] : [];
|
|
76
|
-
}
|
|
77
|
-
function pt(t, d, s, u) {
|
|
78
|
-
const m = ue(t, s, u.fields), l = [
|
|
79
|
-
...De(d, 80, u.brand),
|
|
80
|
-
...mt(s, 71),
|
|
81
|
-
...Fe(m, 23, 21, 27)
|
|
82
|
-
];
|
|
83
|
-
s && l.push({ kind: "qrcode", leftMm: 55, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: s }, code: { quietZoneModules: 4, errorCorrection: "M" } }), l.push(be(48, 80));
|
|
84
|
-
const a = t.fields.find((f) => f.field === s)?.label ?? d;
|
|
85
|
-
return l.push({ ...$(a, 4, 49, 71, 3, 5.8), style: { fontSize: 5.8, color: ce } }), l;
|
|
86
|
-
}
|
|
87
|
-
function _e(t, d, s, u, m = 80) {
|
|
88
|
-
const l = De(d, m, u.brand);
|
|
89
|
-
s && (l.push({ ...$("", 4, 14, m - 8, 8, 16), binding: { field: s }, style: { fontSize: 16, align: "center", color: ge } }), l.push({ kind: "qrcode", leftMm: (m - 20) / 2, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: s }, code: { quietZoneModules: 4, errorCorrection: "M" } })), l.push(be(44, m));
|
|
90
|
-
const a = ue(t, s, u.fields);
|
|
91
|
-
return m === 100 ? a.forEach((f, M) => {
|
|
92
|
-
const C = M % 2 === 0 ? 4 : 52, h = 46 + Math.floor(M / 2) * 4.3;
|
|
93
|
-
l.push({ ...$(f.label ?? f.field, C, h, 19, 3.7, 5.8), style: { fontSize: 5.8, color: ce } }), l.push({ ...$("", C + 19, h, 25, 3.7, 6.5), binding: { field: f.field, ...f.format ? { format: f.format } : {} } });
|
|
94
|
-
}) : l.push(...Fe(a.slice(0, 1), 46, 24, m - 32, 5)), l;
|
|
95
|
-
}
|
|
96
|
-
function ke(t, d, s, u = {}) {
|
|
97
|
-
const m = Le(t, s), l = ft(u.preset), a = Object.fromEntries(["name", "tagline"].flatMap((h) => {
|
|
98
|
-
const L = u.brand?.[h];
|
|
99
|
-
return typeof L == "string" ? [[h, L]] : [];
|
|
100
|
-
})), f = { preset: l.id, brand: a, fields: ue(t, m, u.fields).map((h) => h.field) }, M = l.id === "warehouse" ? _e(t, d, m, u, l.widthMm) : pt(t, d, m, u), C = [{ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${d} · 1`, labelStudio: f }, components: M }];
|
|
101
|
-
return l.faces === 2 && C.push({ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${d} · 2`, labelStudio: f }, components: _e(t, d, m, u) }), it({ id: "record-label", name: d, template: st({ dataset: "records", rowKey: t.rowKey, pages: C }) });
|
|
102
|
-
}
|
|
103
|
-
function K(t) {
|
|
104
|
-
const d = t.template.pages[0]?.meta?.labelStudio;
|
|
105
|
-
if (!d || typeof d != "object") return;
|
|
106
|
-
const s = d, u = de.find((f) => f.id === s.preset);
|
|
107
|
-
if (!u) return;
|
|
108
|
-
const m = Array.isArray(s.fields) ? s.fields.filter((f) => typeof f == "string") : void 0;
|
|
109
|
-
if (m && m.length > 5) return;
|
|
110
|
-
const l = s.brand && typeof s.brand == "object" ? s.brand : {}, a = {};
|
|
111
|
-
for (const f of ["name", "tagline", "logoData"])
|
|
112
|
-
typeof l[f] == "string" && (a[f] = l[f]);
|
|
113
|
-
return { preset: u.id, fields: m, brand: a };
|
|
114
|
-
}
|
|
115
|
-
function Se(t, d, s) {
|
|
116
|
-
const u = new Set(t.fields.filter((l) => l.field !== d && l.field !== t.rowKey).map((l) => l.field)), m = s?.filter((l) => u.has(l));
|
|
117
|
-
return ue(t, d, m).map((l) => l.field);
|
|
118
|
-
}
|
|
119
|
-
function vt(t, d) {
|
|
120
|
-
const s = p(() => ({ ...lt, ...t.messages })), u = p(() => t.title ?? s.value.title), m = { preset: t.preset, brand: t.brand, fields: t.fields }, l = Ue(t.modelValue ? x(t.modelValue) : ke(t.schema, u.value, t.identityField, m));
|
|
121
|
-
let a = x(l.value);
|
|
122
|
-
Ie(() => {
|
|
123
|
-
t.modelValue || d(x(l.value));
|
|
124
|
-
});
|
|
125
|
-
const f = k("preview"), M = k("all"), C = k(1), h = k(!1), L = k(!1), g = k(), E = at(() => t.beforeDiscard), D = p(() => L.value || E.pending.value || g.value?.saving === !0 || g.value?.blocked === !0), F = k(""), W = p(() => Le(t.schema, t.identityField)), P = k(K(l.value)?.preset ?? (t.modelValue ? void 0 : t.preset ?? "paired")), U = k(K(l.value)?.brand?.name ?? t.brand?.name ?? ""), I = k(K(l.value)?.brand?.tagline ?? t.brand?.tagline ?? ""), _ = k(Se(t.schema, W.value, K(l.value)?.fields ?? t.fields)), X = k(""), ie = p(() => t.schema.fields.filter((n) => n.field !== W.value && n.field !== t.schema.rowKey)), q = p(() => _.value.map((n) => ({ field: n, label: t.schema.fields.find((v) => v.field === n)?.label ?? n }))), fe = p(() => {
|
|
126
|
-
const n = X.value.trim().toLocaleLowerCase();
|
|
127
|
-
return ie.value.filter((v) => `${v.label ?? ""} ${v.field}`.toLocaleLowerCase().includes(n)).slice(0, 30);
|
|
128
|
-
}), j = p(() => {
|
|
129
|
-
const n = l.value.template.pages[0]?.components.find((v) => v.kind === "image" && v.meta?.labelBrandLogo);
|
|
130
|
-
return n?.kind === "image" ? n.imageData : t.brand?.logoData;
|
|
131
|
-
}), Y = p(() => ({
|
|
132
|
-
preset: P.value,
|
|
133
|
-
fields: _.value,
|
|
134
|
-
brand: { ...t.brand, ...j.value ? { logoData: j.value } : {}, name: U.value, tagline: I.value }
|
|
135
|
-
}));
|
|
136
|
-
let N = JSON.stringify(K(l.value));
|
|
137
|
-
const ee = p(() => !K(l.value)), A = () => JSON.stringify({ preset: P.value, fields: _.value, name: U.value, tagline: I.value }), H = k(A()), J = p(() => A() !== H.value), te = p(() => J.value || g.value?.pendingLocalChanges === !0);
|
|
138
|
-
function le() {
|
|
139
|
-
const n = K(l.value);
|
|
140
|
-
P.value = n?.preset, _.value = Se(t.schema, W.value, n?.fields ?? t.fields), U.value = n?.brand?.name ?? t.brand?.name ?? "", I.value = n?.brand?.tagline ?? t.brand?.tagline ?? "", N = JSON.stringify(n), H.value = A();
|
|
141
|
-
}
|
|
142
|
-
function se(n) {
|
|
143
|
-
const v = K(n), S = JSON.stringify(v);
|
|
144
|
-
S !== N && (N = S, le());
|
|
145
|
-
}
|
|
146
|
-
let R = !1;
|
|
147
|
-
qe(() => {
|
|
148
|
-
R = !0;
|
|
149
|
-
});
|
|
150
|
-
const oe = { assetRenderers: ut() };
|
|
151
|
-
et({ get defaults() {
|
|
152
|
-
return { assets: oe, ...t.preview };
|
|
153
|
-
} }), ve(() => t.modelValue, (n) => {
|
|
154
|
-
n && Ce(n) !== Ce(l.value) && (l.value = x(n), a = x(n), se(n));
|
|
155
|
-
}), ve(() => t.rows, () => {
|
|
156
|
-
M.value = "all", C.value = 1;
|
|
157
|
-
});
|
|
158
|
-
function T(n) {
|
|
159
|
-
F.value = "", l.value = n, se(n), d(n);
|
|
160
|
-
}
|
|
161
|
-
function G(n, v) {
|
|
162
|
-
v && _.value.length < 5 && !_.value.includes(n) ? _.value = [..._.value, n] : v || (_.value = _.value.filter((S) => S !== n));
|
|
163
|
-
}
|
|
164
|
-
function c() {
|
|
165
|
-
if (D.value || R) return !1;
|
|
166
|
-
if (!P.value)
|
|
167
|
-
return F.value = s.value.choosePreset, !1;
|
|
168
|
-
if (g.value?.canApply === !1)
|
|
169
|
-
return F.value = g.value.saveReason || s.value.applyFirst, !1;
|
|
170
|
-
try {
|
|
171
|
-
const n = ke(t.schema, u.value, t.identityField, Y.value), v = l.value.template.repeat;
|
|
172
|
-
if (v?.copies !== void 0 && n.template.repeat && (n.template.repeat.copies = v.copies), g.value?.applyTemplate) {
|
|
173
|
-
if (!g.value.applyTemplate(n.template))
|
|
174
|
-
return F.value = s.value.saveFailed, !1;
|
|
175
|
-
} else
|
|
176
|
-
T({ ...l.value, template: n.template });
|
|
177
|
-
return H.value = A(), !0;
|
|
178
|
-
} catch (n) {
|
|
179
|
-
return F.value = n instanceof Error ? n.message : s.value.saveFailed, !1;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
const r = p(() => M.value === "all" ? t.rows : Number.isSafeInteger(C.value) && t.rows[C.value - 1] ? [t.rows[C.value - 1]] : []), z = p(() => l.value.template.repeat?.dataset ?? "records"), xe = p(() => ({ [z.value]: r.value })), Ee = p(() => ({ [z.value]: r.value.slice(0, 3) })), Re = p(() => ({ [z.value]: t.schema })), Te = p(() => [{ id: z.value, label: u.value, rowKey: t.schema.rowKey, fields: t.schema.fields }]), Ve = p(() => l.value.template.pages[0]), he = p(() => l.value.template.pages.length), $e = p(() => {
|
|
183
|
-
const n = l.value.template.repeat?.copies ?? 1;
|
|
184
|
-
return typeof n == "number" ? n : void 0;
|
|
185
|
-
}), Ne = p(() => {
|
|
186
|
-
const n = l.value.template.repeat?.copies;
|
|
187
|
-
return typeof n == "object" ? n.field : void 0;
|
|
188
|
-
}), ye = p(() => {
|
|
189
|
-
const n = Ne.value;
|
|
190
|
-
if (!n) return;
|
|
191
|
-
let v = 0;
|
|
192
|
-
for (const S of r.value) {
|
|
193
|
-
const B = Object.getOwnPropertyDescriptor(S, n)?.value;
|
|
194
|
-
if (typeof B != "number" || !Number.isSafeInteger(B) || B < 1 || B > 1e3) return;
|
|
195
|
-
v += B;
|
|
196
|
-
}
|
|
197
|
-
return v;
|
|
198
|
-
}), ze = p(() => {
|
|
199
|
-
const n = $e.value;
|
|
200
|
-
return n !== void 0 ? Number.isSafeInteger(n) && n >= 1 && n <= 1e3 ? r.value.length * n * he.value : void 0 : ye.value === void 0 ? void 0 : ye.value * he.value;
|
|
201
|
-
}), Be = p(() => {
|
|
202
|
-
const n = ot({ labels: rt({ template: l.value.template, rows: r.value, dataSchema: t.schema }) }), v = h.value;
|
|
203
|
-
return async (S) => {
|
|
204
|
-
const B = await n(S);
|
|
205
|
-
return v ? dt(B, { paper: "a4", columns: 2, rows: 4, marginMm: 12, gapMm: 4, signal: S.signal }) : B;
|
|
206
|
-
};
|
|
207
|
-
}), Ke = async (n, v) => {
|
|
208
|
-
const S = t.save ? await t.save(n, v) : x(n);
|
|
209
|
-
if (R || v.signal.aborted) throw new DOMException("标签模板保存已取消", "AbortError");
|
|
210
|
-
return a = x(S), T(S), S;
|
|
211
|
-
};
|
|
212
|
-
async function we() {
|
|
213
|
-
if (!(D.value || R) && !(J.value && !c())) {
|
|
214
|
-
L.value = !0;
|
|
215
|
-
try {
|
|
216
|
-
if (g.value) {
|
|
217
|
-
if (g.value.canApply === !1) {
|
|
218
|
-
F.value = g.value.saveReason || s.value.applyFirst;
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
if (g.value.pendingLocalChanges && await g.value.save(), g.value.pendingLocalChanges) {
|
|
222
|
-
F.value = s.value.saveFailed;
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (!R)
|
|
227
|
-
return F.value = "", x(l.value);
|
|
228
|
-
} finally {
|
|
229
|
-
L.value = !1;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
async function Pe(n) {
|
|
234
|
-
n !== f.value && await we() && (f.value = n);
|
|
235
|
-
}
|
|
236
|
-
let me = !1;
|
|
237
|
-
const Ae = (n) => me || E.request(n);
|
|
238
|
-
async function Oe() {
|
|
239
|
-
if (D.value) return !1;
|
|
240
|
-
const n = g.value?.pendingLocalChanges === !0;
|
|
241
|
-
if (!n && !J.value) return !0;
|
|
242
|
-
if (!(n && g.value ? await g.value.guardChanges() : await E.request({ reason: "replace", document: x(l.value), pendingLocalChanges: !0 })) || R) return !1;
|
|
243
|
-
if (n && g.value) {
|
|
244
|
-
me = !0;
|
|
245
|
-
try {
|
|
246
|
-
await g.value.reset();
|
|
247
|
-
} finally {
|
|
248
|
-
me = !1;
|
|
249
|
-
}
|
|
250
|
-
T(x(a));
|
|
251
|
-
}
|
|
252
|
-
return le(), !0;
|
|
253
|
-
}
|
|
254
|
-
return { m: s, notice: F, title: u, document: l, mode: f, record: M, recordIndex: C, sheet: h, busy: D, editor: g, rows: r, datasets: xe, designDatasets: Ee, schemas: Re, bindings: Te, paper: Ve, labelCount: ze, fetcher: Be, update: T, save: Ke, navigate: Pe, prepare: we, guardChanges: Oe, preset: P, presets: de, brandName: U, brandTagline: I, fields: _, fieldQuery: X, selectedFields: q, availableFields: fe, fieldCount: p(() => ie.value.length), configurationDirty: J, pendingLocalChanges: te, custom: ee, toggleField: G, applyConfiguration: c, restoreConfiguration: le, beforeDiscard: Ae, confirmation: E.confirmation, decideDiscard: E.decide };
|
|
255
|
-
}
|
|
256
|
-
const gt = ["aria-label"], bt = { class: "mr-label-context" }, ht = { class: "mr-label-identity" }, yt = { class: "mr-label-spec" }, wt = ["disabled"], Mt = ["aria-label"], Ct = ["aria-pressed", "onClick"], _t = { class: "mr-label-fields" }, kt = {
|
|
257
|
-
key: 0,
|
|
258
|
-
class: "mr-label-selected-fields"
|
|
259
|
-
}, St = ["aria-label", "onClick"], Lt = { class: "mr-label-field-search" }, Dt = ["aria-label", "placeholder"], Ft = { class: "mr-label-field-options" }, xt = ["checked", "disabled", "onChange"], Et = { key: 0 }, Rt = { key: 1 }, Tt = { class: "mr-label-brand" }, Vt = ["placeholder"], $t = ["disabled"], Nt = {
|
|
260
|
-
key: 1,
|
|
261
|
-
class: "mr-label-reflow-hint"
|
|
262
|
-
}, zt = { class: "mr-label-reflow-hint" }, Bt = { class: "mr-label-record" }, Kt = ["disabled"], Pt = { value: "all" }, At = { value: "single" }, Ot = {
|
|
263
|
-
key: 0,
|
|
264
|
-
class: "mr-label-record-index"
|
|
265
|
-
}, Ut = ["max", "aria-label", "disabled"], It = { class: "mr-label-count" }, qt = { class: "mr-label-help" }, jt = { class: "mr-label-main" }, Ht = { class: "mr-label-bar" }, Jt = ["aria-label"], Gt = ["aria-pressed", "disabled"], Qt = ["aria-pressed", "disabled"], Zt = {
|
|
266
|
-
key: 0,
|
|
267
|
-
class: "mr-label-notice",
|
|
268
|
-
role: "status"
|
|
269
|
-
}, Wt = ["aria-label"], Xt = { class: "mr-label-imposition" }, Yt = { class: "mr-label-editor" }, sl = /* @__PURE__ */ je({
|
|
270
|
-
__name: "ReportLabelStudio",
|
|
271
|
-
props: {
|
|
272
|
-
showSave: { type: Boolean, default: !0 },
|
|
273
|
-
rows: {},
|
|
274
|
-
schema: {},
|
|
275
|
-
title: {},
|
|
276
|
-
identityField: {},
|
|
277
|
-
modelValue: {},
|
|
278
|
-
preview: {},
|
|
279
|
-
save: {},
|
|
280
|
-
beforeDiscard: {},
|
|
281
|
-
messages: {},
|
|
282
|
-
preset: {},
|
|
283
|
-
brand: {},
|
|
284
|
-
fields: {}
|
|
285
|
-
},
|
|
286
|
-
emits: ["update:modelValue"],
|
|
287
|
-
setup(t, { expose: d, emit: s }) {
|
|
288
|
-
const u = t, m = s, l = vt(u, (G) => m("update:modelValue", G)), { m: a, notice: f, title: M, document: C, mode: h, record: L, recordIndex: g, sheet: E, busy: D, editor: F, rows: W, designDatasets: P, schemas: U, bindings: I, paper: _, labelCount: X, fetcher: ie, preset: q, presets: fe, brandName: j, brandTagline: Y, fields: N, fieldQuery: ee, selectedFields: A, availableFields: H, fieldCount: J, configurationDirty: te, pendingLocalChanges: le, custom: se, confirmation: R } = l, oe = k();
|
|
289
|
-
let T = null;
|
|
290
|
-
return ve(R, async (G) => {
|
|
291
|
-
G ? (T = window.document.activeElement, await He(), oe.value?.focus()) : T?.isConnected && (T.focus(), T = null);
|
|
292
|
-
}), d({ guardChanges: l.guardChanges, prepare: l.prepare, get busy() {
|
|
293
|
-
return D.value;
|
|
294
|
-
}, get pendingLocalChanges() {
|
|
295
|
-
return le.value;
|
|
296
|
-
} }), (G, c) => (b(), y("section", {
|
|
297
|
-
class: Me(["mr-label-studio", { "is-design": e(h) === "design" }]),
|
|
298
|
-
"aria-label": e(M)
|
|
299
|
-
}, [
|
|
300
|
-
i("aside", bt, [
|
|
301
|
-
i("div", ht, [
|
|
302
|
-
Q(ne, {
|
|
303
|
-
name: "file",
|
|
304
|
-
size: 18
|
|
305
|
-
}),
|
|
306
|
-
i("strong", null, o(e(M)), 1),
|
|
307
|
-
i("small", null, o(e(se) ? e(a).customTemplate : e(a).readyTemplate), 1)
|
|
308
|
-
]),
|
|
309
|
-
i("div", yt, [
|
|
310
|
-
i("strong", null, [
|
|
311
|
-
w(o(e(_)?.widthMm) + " ", 1),
|
|
312
|
-
c[13] || (c[13] = i("i", null, "×", -1)),
|
|
313
|
-
w(" " + o(e(_)?.heightMm), 1)
|
|
314
|
-
]),
|
|
315
|
-
i("span", null, "mm · " + o(e(C).template.pages.length) + " " + o(e(a).faces), 1)
|
|
316
|
-
]),
|
|
317
|
-
i("fieldset", {
|
|
318
|
-
class: "mr-label-quick",
|
|
319
|
-
disabled: e(D)
|
|
320
|
-
}, [
|
|
321
|
-
i("legend", null, o(e(a).layout), 1),
|
|
322
|
-
i("div", {
|
|
323
|
-
class: "mr-label-presets",
|
|
324
|
-
"aria-label": e(a).layout
|
|
325
|
-
}, [
|
|
326
|
-
(b(!0), y(ae, null, pe(e(fe), (r) => (b(), y("button", {
|
|
327
|
-
key: r.id,
|
|
328
|
-
type: "button",
|
|
329
|
-
"aria-pressed": e(q) === r.id,
|
|
330
|
-
onClick: (z) => q.value = r.id
|
|
331
|
-
}, [
|
|
332
|
-
i("span", {
|
|
333
|
-
class: Me(["mr-label-preset-art", `is-${r.id}`]),
|
|
334
|
-
"aria-hidden": "true"
|
|
335
|
-
}, [...c[14] || (c[14] = [
|
|
336
|
-
i("i", null, null, -1),
|
|
337
|
-
i("i", null, null, -1),
|
|
338
|
-
i("i", null, null, -1)
|
|
339
|
-
])], 2),
|
|
340
|
-
i("span", null, [
|
|
341
|
-
i("strong", null, o(e(a)[`${r.id}Preset`]), 1),
|
|
342
|
-
i("small", null, o(r.widthMm) + " × " + o(r.heightMm) + " · " + o(r.faces) + " " + o(e(a).faces), 1)
|
|
343
|
-
])
|
|
344
|
-
], 8, Ct))), 128))
|
|
345
|
-
], 8, Mt),
|
|
346
|
-
i("details", _t, [
|
|
347
|
-
i("summary", null, [
|
|
348
|
-
w(o(e(a).fields) + " ", 1),
|
|
349
|
-
i("span", null, o(e(N).length) + " / 5", 1)
|
|
350
|
-
]),
|
|
351
|
-
e(A).length ? (b(), y("div", kt, [
|
|
352
|
-
(b(!0), y(ae, null, pe(e(A), (r) => (b(), y("button", {
|
|
353
|
-
key: r.field,
|
|
354
|
-
type: "button",
|
|
355
|
-
"aria-label": `${e(a).removeField} ${r.label}`,
|
|
356
|
-
onClick: (z) => e(l).toggleField(r.field, !1)
|
|
357
|
-
}, [
|
|
358
|
-
w(o(r.label) + " ", 1),
|
|
359
|
-
c[15] || (c[15] = i("span", { "aria-hidden": "true" }, "×", -1))
|
|
360
|
-
], 8, St))), 128))
|
|
361
|
-
])) : V("", !0),
|
|
362
|
-
i("label", Lt, [
|
|
363
|
-
Q(ne, {
|
|
364
|
-
name: "search",
|
|
365
|
-
size: 13
|
|
366
|
-
}),
|
|
367
|
-
O(i("input", {
|
|
368
|
-
"onUpdate:modelValue": c[0] || (c[0] = (r) => Z(ee) ? ee.value = r : null),
|
|
369
|
-
type: "search",
|
|
370
|
-
"aria-label": e(a).findField,
|
|
371
|
-
placeholder: e(a).findField
|
|
372
|
-
}, null, 8, Dt), [
|
|
373
|
-
[re, e(ee)]
|
|
374
|
-
])
|
|
375
|
-
]),
|
|
376
|
-
i("div", Ft, [
|
|
377
|
-
(b(!0), y(ae, null, pe(e(H), (r) => (b(), y("label", {
|
|
378
|
-
key: r.field
|
|
379
|
-
}, [
|
|
380
|
-
i("input", {
|
|
381
|
-
type: "checkbox",
|
|
382
|
-
checked: e(N).includes(r.field),
|
|
383
|
-
disabled: !e(N).includes(r.field) && e(N).length >= 5,
|
|
384
|
-
onChange: (z) => e(l).toggleField(r.field, z.target.checked)
|
|
385
|
-
}, null, 40, xt),
|
|
386
|
-
i("span", null, o(r.label ?? r.field), 1)
|
|
387
|
-
]))), 128)),
|
|
388
|
-
e(H).length ? V("", !0) : (b(), y("p", Et, o(e(a).noFields), 1))
|
|
389
|
-
]),
|
|
390
|
-
i("small", null, o(e(a).fieldLimit), 1),
|
|
391
|
-
e(J) > 30 ? (b(), y("small", Rt, o(e(a).fieldSearchHint), 1)) : V("", !0)
|
|
392
|
-
]),
|
|
393
|
-
i("details", Tt, [
|
|
394
|
-
i("summary", null, o(e(a).brand), 1),
|
|
395
|
-
i("label", null, [
|
|
396
|
-
w(o(e(a).brandName), 1),
|
|
397
|
-
O(i("input", {
|
|
398
|
-
"onUpdate:modelValue": c[1] || (c[1] = (r) => Z(j) ? j.value = r : null),
|
|
399
|
-
maxlength: "80",
|
|
400
|
-
placeholder: e(M)
|
|
401
|
-
}, null, 8, Vt), [
|
|
402
|
-
[re, e(j)]
|
|
403
|
-
])
|
|
404
|
-
]),
|
|
405
|
-
i("label", null, [
|
|
406
|
-
w(o(e(a).brandTagline), 1),
|
|
407
|
-
O(i("input", {
|
|
408
|
-
"onUpdate:modelValue": c[2] || (c[2] = (r) => Z(Y) ? Y.value = r : null),
|
|
409
|
-
maxlength: "120"
|
|
410
|
-
}, null, 512), [
|
|
411
|
-
[re, e(Y)]
|
|
412
|
-
])
|
|
413
|
-
])
|
|
414
|
-
]),
|
|
415
|
-
i("button", {
|
|
416
|
-
class: "mr-label-apply",
|
|
417
|
-
type: "button",
|
|
418
|
-
disabled: !e(te) || !e(q),
|
|
419
|
-
onClick: c[3] || (c[3] = //@ts-ignore
|
|
420
|
-
(...r) => e(l).applyConfiguration && e(l).applyConfiguration(...r))
|
|
421
|
-
}, [
|
|
422
|
-
Q(ne, {
|
|
423
|
-
name: "arrow-right",
|
|
424
|
-
size: 13
|
|
425
|
-
}),
|
|
426
|
-
w(o(e(a).applyLayout), 1)
|
|
427
|
-
], 8, $t),
|
|
428
|
-
e(te) ? (b(), y("button", {
|
|
429
|
-
key: 0,
|
|
430
|
-
class: "mr-label-reset-configuration",
|
|
431
|
-
type: "button",
|
|
432
|
-
onClick: c[4] || (c[4] = //@ts-ignore
|
|
433
|
-
(...r) => e(l).restoreConfiguration && e(l).restoreConfiguration(...r))
|
|
434
|
-
}, o(e(a).restoreConfiguration), 1)) : V("", !0),
|
|
435
|
-
e(te) && !e(q) ? (b(), y("p", Nt, o(e(a).choosePreset), 1)) : V("", !0),
|
|
436
|
-
i("p", zt, o(e(a).reflowHint), 1)
|
|
437
|
-
], 8, wt),
|
|
438
|
-
i("label", Bt, [
|
|
439
|
-
w(o(e(a).records), 1),
|
|
440
|
-
O(i("select", {
|
|
441
|
-
"onUpdate:modelValue": c[5] || (c[5] = (r) => Z(L) ? L.value = r : null),
|
|
442
|
-
disabled: e(D) || !u.rows.length
|
|
443
|
-
}, [
|
|
444
|
-
i("option", Pt, o(e(a).all) + " · " + o(u.rows.length), 1),
|
|
445
|
-
i("option", At, o(e(a).single), 1)
|
|
446
|
-
], 8, Kt), [
|
|
447
|
-
[Je, e(L)]
|
|
448
|
-
])
|
|
449
|
-
]),
|
|
450
|
-
e(L) === "single" ? (b(), y("label", Ot, [
|
|
451
|
-
w(o(e(a).record), 1),
|
|
452
|
-
O(i("input", {
|
|
453
|
-
"onUpdate:modelValue": c[6] || (c[6] = (r) => Z(g) ? g.value = r : null),
|
|
454
|
-
type: "number",
|
|
455
|
-
min: "1",
|
|
456
|
-
max: u.rows.length,
|
|
457
|
-
"aria-label": e(a).record,
|
|
458
|
-
disabled: e(D)
|
|
459
|
-
}, null, 8, Ut), [
|
|
460
|
-
[
|
|
461
|
-
re,
|
|
462
|
-
e(g),
|
|
463
|
-
void 0,
|
|
464
|
-
{ number: !0 }
|
|
465
|
-
]
|
|
466
|
-
]),
|
|
467
|
-
w(" / " + o(u.rows.length), 1)
|
|
468
|
-
])) : V("", !0),
|
|
469
|
-
i("p", It, [
|
|
470
|
-
i("strong", null, o(e(W).length), 1),
|
|
471
|
-
w(" " + o(e(a).count) + " ", 1),
|
|
472
|
-
c[16] || (c[16] = i("span", null, "→", -1)),
|
|
473
|
-
c[17] || (c[17] = w()),
|
|
474
|
-
e(X) !== void 0 ? (b(), y(ae, { key: 0 }, [
|
|
475
|
-
i("strong", null, o(e(X)), 1),
|
|
476
|
-
w(" " + o(e(a).labels), 1)
|
|
477
|
-
], 64)) : (b(), y(ae, { key: 1 }, [
|
|
478
|
-
w(o(e(a).invalidCopies), 1)
|
|
479
|
-
], 64))
|
|
480
|
-
]),
|
|
481
|
-
i("details", qt, [
|
|
482
|
-
i("summary", null, o(e(a).guide), 1),
|
|
483
|
-
i("p", null, o(e(a).help), 1),
|
|
484
|
-
i("p", null, o(e(a).printHint), 1)
|
|
485
|
-
])
|
|
486
|
-
]),
|
|
487
|
-
i("div", jt, [
|
|
488
|
-
i("header", Ht, [
|
|
489
|
-
i("nav", { "aria-label": e(M) }, [
|
|
490
|
-
i("button", {
|
|
491
|
-
type: "button",
|
|
492
|
-
"aria-pressed": e(h) === "preview",
|
|
493
|
-
disabled: e(D),
|
|
494
|
-
onClick: c[7] || (c[7] = (r) => e(l).navigate("preview"))
|
|
495
|
-
}, [
|
|
496
|
-
Q(ne, {
|
|
497
|
-
name: "file",
|
|
498
|
-
size: 14
|
|
499
|
-
}),
|
|
500
|
-
w(o(e(a).preview), 1)
|
|
501
|
-
], 8, Gt),
|
|
502
|
-
i("button", {
|
|
503
|
-
type: "button",
|
|
504
|
-
"aria-pressed": e(h) === "design",
|
|
505
|
-
disabled: e(D),
|
|
506
|
-
onClick: c[8] || (c[8] = (r) => e(l).navigate("design"))
|
|
507
|
-
}, [
|
|
508
|
-
Q(ne, {
|
|
509
|
-
name: "settings",
|
|
510
|
-
size: 14
|
|
511
|
-
}),
|
|
512
|
-
w(o(e(a).design), 1)
|
|
513
|
-
], 8, Qt)
|
|
514
|
-
], 8, Jt),
|
|
515
|
-
i("span", null, o(e(h) === "design" ? e(a).designHint : e(a).flow), 1)
|
|
516
|
-
]),
|
|
517
|
-
e(f) ? (b(), y("p", Zt, o(e(f)), 1)) : V("", !0),
|
|
518
|
-
e(R) ? (b(), y("div", {
|
|
519
|
-
key: 1,
|
|
520
|
-
class: "mr-label-confirm",
|
|
521
|
-
role: "alertdialog",
|
|
522
|
-
"aria-label": e(a).discardTitle,
|
|
523
|
-
onKeydown: c[11] || (c[11] = Ge(Qe((r) => e(l).decideDiscard(!1), ["prevent", "stop"]), ["esc"]))
|
|
524
|
-
}, [
|
|
525
|
-
i("div", null, [
|
|
526
|
-
i("strong", null, o(e(a).discardTitle), 1),
|
|
527
|
-
i("p", null, o(e(a).discardDescription), 1)
|
|
528
|
-
]),
|
|
529
|
-
i("button", {
|
|
530
|
-
ref_key: "keepEditingButton",
|
|
531
|
-
ref: oe,
|
|
532
|
-
type: "button",
|
|
533
|
-
onClick: c[9] || (c[9] = (r) => e(l).decideDiscard(!1))
|
|
534
|
-
}, o(e(a).keepEditing), 513),
|
|
535
|
-
i("button", {
|
|
536
|
-
type: "button",
|
|
537
|
-
onClick: c[10] || (c[10] = (r) => e(l).decideDiscard(!0))
|
|
538
|
-
}, o(e(a).discard), 1)
|
|
539
|
-
], 40, Wt)) : V("", !0),
|
|
540
|
-
e(h) === "preview" ? (b(), Ze(e(tt), {
|
|
541
|
-
key: 2,
|
|
542
|
-
"report-id": "labels",
|
|
543
|
-
fetcher: e(ie),
|
|
544
|
-
"show-params": !1,
|
|
545
|
-
height: "100%",
|
|
546
|
-
toolbar: { exportFormats: ["pdf", "png", "html"], editing: !1, excelImport: !1 },
|
|
547
|
-
messages: { title: e(M), empty: e(a).empty }
|
|
548
|
-
}, {
|
|
549
|
-
settings: We(() => [
|
|
550
|
-
i("label", Xt, [
|
|
551
|
-
O(i("input", {
|
|
552
|
-
"onUpdate:modelValue": c[12] || (c[12] = (r) => Z(E) ? E.value = r : null),
|
|
553
|
-
type: "checkbox"
|
|
554
|
-
}, null, 512), [
|
|
555
|
-
[Xe, e(E)]
|
|
556
|
-
]),
|
|
557
|
-
w(o(e(a).sheet), 1),
|
|
558
|
-
i("small", null, o(e(a).sheetHint), 1)
|
|
559
|
-
])
|
|
560
|
-
]),
|
|
561
|
-
_: 1
|
|
562
|
-
}, 8, ["fetcher", "messages"])) : V("", !0),
|
|
563
|
-
O(i("div", Yt, [
|
|
564
|
-
Q(nt, {
|
|
565
|
-
ref_key: "editor",
|
|
566
|
-
ref: F,
|
|
567
|
-
"model-value": e(C),
|
|
568
|
-
mode: "design",
|
|
569
|
-
"show-mode-switch": !1,
|
|
570
|
-
"show-save": t.showSave,
|
|
571
|
-
capabilities: { params: !1 },
|
|
572
|
-
datasets: e(P),
|
|
573
|
-
"data-schemas": e(U),
|
|
574
|
-
"binding-datasets": e(I),
|
|
575
|
-
save: e(l).save,
|
|
576
|
-
"before-discard": e(l).beforeDiscard,
|
|
577
|
-
preview: t.preview,
|
|
578
|
-
"onUpdate:modelValue": e(l).update
|
|
579
|
-
}, null, 8, ["model-value", "show-save", "datasets", "data-schemas", "binding-datasets", "save", "before-discard", "preview", "onUpdate:modelValue"])
|
|
580
|
-
], 512), [
|
|
581
|
-
[Ye, e(h) === "design"]
|
|
582
|
-
])
|
|
583
|
-
])
|
|
584
|
-
], 10, gt));
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
export {
|
|
588
|
-
sl as default
|
|
589
|
-
};
|