@agile-team/mach-report 2.14.0 → 2.16.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 +26 -16
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-CP6h2x1f.cjs} +1 -1
- package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-HhB3hAJE.js} +3 -3
- package/dist/ParamEditor-CUQLgoxa.cjs +1 -0
- package/dist/ParamEditor-OKesP_nO.js +594 -0
- package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-cZCAMAwH.cjs} +1 -1
- package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-ruxcbfY6.js} +39 -39
- package/dist/ReportPreview-BcDKCLiK.js +4834 -0
- package/dist/ReportPreview-Bk9nLfO9.cjs +6 -0
- package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-BDlNT8JN.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-DcwrH-63.js} +1 -1
- package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-BX5S8RSF.cjs} +1 -1
- package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-CGl9XY2s.js} +5 -5
- package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-CGrT5DFN.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-SXCjaPKR.js} +2 -2
- package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-6Z3wRFz8.cjs} +1 -1
- package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-lHLOS9Wn.js} +2 -2
- package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-CJ9PLc48.js} +2 -2
- package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dpk7sLcF.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +5 -1
- package/dist/analytics.d.ts +5 -1
- package/dist/analytics.js +154 -60
- package/dist/artifact-integrity.json +143 -0
- package/dist/assets-CqIbfbTr.js +126 -0
- package/dist/assets-e4YSke8n.cjs +1 -0
- package/dist/auto-YR7a4BtF.js +240 -0
- package/dist/auto-uVBjX1j5.cjs +1 -0
- package/dist/batch-WzDIXJAt.js +220 -0
- package/dist/batch-z6Aw5GEY.cjs +1 -0
- package/dist/capabilities-DDwXr_cA.js +103 -0
- package/dist/capabilities-DNLyZdNw.cjs +1 -0
- package/dist/codes.d.cts +4 -0
- package/dist/codes.d.ts +4 -0
- package/dist/component-tree-Ca6YYfHq.js +61 -0
- package/dist/component-tree-DkGLEfZC.cjs +1 -0
- package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
- package/dist/config-Dg_o8e7m.cjs +1 -0
- package/dist/config-XQ4qrQ7Q.js +844 -0
- package/dist/designer-BfQSahxq.js +5163 -0
- package/dist/designer-CPPdeM5_.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +197 -16
- package/dist/designer.d.ts +197 -16
- package/dist/designer.js +1 -1
- package/dist/diagnostic-notification-B9K9We3h.cjs +1 -0
- package/dist/diagnostic-notification-qGAYZdkB.js +7 -0
- package/dist/drill-CsdjgkRM.cjs +1 -0
- package/dist/drill-DIGsZfyB.js +145 -0
- package/dist/encoding-BOGq4qYL.js +21 -0
- package/dist/encoding-BYF9ZTl9.cjs +1 -0
- package/dist/{font-loader-DHto6Lra.js → font-loader-CzI1GuBc.js} +1 -1
- package/dist/{font-loader-vhCT8znW.cjs → font-loader-EKLzOJxf.cjs} +1 -1
- package/dist/index.cjs +8 -9
- package/dist/index.d.cts +84 -4
- package/dist/index.d.ts +84 -4
- package/dist/index.js +829 -833
- package/dist/json-snapshot-D6ioHth9.js +1702 -0
- package/dist/json-snapshot-DknkjvxP.cjs +2 -0
- package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
- package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
- package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
- package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
- package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
- package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
- package/dist/licenses/_types_node-14.18.63.txt +22 -0
- package/dist/licenses/_types_pako-2.0.3.txt +22 -0
- package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
- package/dist/licenses/archiver-5.3.2.txt +23 -0
- package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
- package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
- package/dist/licenses/async-3.2.6.txt +20 -0
- package/dist/licenses/balanced-match-1.0.2.txt +22 -0
- package/dist/licenses/base64-js-1.5.1.txt +22 -0
- package/dist/licenses/big-integer-1.6.52.txt +25 -0
- package/dist/licenses/binary-0.3.0.txt +178 -0
- package/dist/licenses/bl-4.1.0.txt +14 -0
- package/dist/licenses/bluebird-3.4.7.txt +22 -0
- package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
- package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
- package/dist/licenses/buffer-5.7.1.txt +22 -0
- package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
- package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
- package/dist/licenses/buffers-0.1.1.txt +140 -0
- package/dist/licenses/chainsaw-0.1.0.txt +184 -0
- package/dist/licenses/compress-commons-4.1.2.txt +23 -0
- package/dist/licenses/concat-map-0.0.1.txt +19 -0
- package/dist/licenses/core-util-is-1.0.3.txt +20 -0
- package/dist/licenses/crc-32-1.2.2.txt +202 -0
- package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
- package/dist/licenses/dayjs-1.11.23.txt +22 -0
- package/dist/licenses/duplexer2-0.1.4.txt +27 -0
- package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
- package/dist/licenses/exceljs-4.4.0.txt +23 -0
- package/dist/licenses/fast-csv-4.3.6.txt +22 -0
- package/dist/licenses/fast-png-6.4.0.txt +22 -0
- package/dist/licenses/fs-constants-1.0.0.txt +22 -0
- package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
- package/dist/licenses/fstream-1.0.12.txt +16 -0
- package/dist/licenses/glob-7.2.3.txt +22 -0
- package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
- package/dist/licenses/ieee754-1.2.1.txt +12 -0
- package/dist/licenses/immediate-3.0.6.txt +21 -0
- package/dist/licenses/inflight-1.0.6.txt +16 -0
- package/dist/licenses/inherits-2.0.4.txt +17 -0
- package/dist/licenses/iobuffer-5.4.0.txt +23 -0
- package/dist/licenses/isarray-1.0.0.txt +61 -0
- package/dist/licenses/jszip-3.10.2.txt +652 -0
- package/dist/licenses/lazystream-1.0.1.txt +24 -0
- package/dist/licenses/lie-3.3.0.txt +8 -0
- package/dist/licenses/listenercount-1.0.1.txt +6 -0
- package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
- package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
- package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
- package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
- package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
- package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
- package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
- package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
- package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
- package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
- package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
- package/dist/licenses/lodash.union-4.6.0.txt +48 -0
- package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
- package/dist/licenses/minimatch-3.1.5.txt +16 -0
- package/dist/licenses/minimatch-5.1.9.txt +16 -0
- package/dist/licenses/minimist-1.2.8.txt +19 -0
- package/dist/licenses/mkdirp-0.5.6.txt +22 -0
- package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
- package/dist/licenses/normalize-path-3.0.0.txt +22 -0
- package/dist/licenses/once-1.4.0.txt +16 -0
- package/dist/licenses/pako-1.0.11.txt +22 -0
- package/dist/licenses/pako-2.2.0.txt +22 -0
- package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
- package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
- package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
- package/dist/licenses/readable-stream-2.3.8.txt +48 -0
- package/dist/licenses/readable-stream-3.6.2.txt +48 -0
- package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
- package/dist/licenses/rimraf-2.7.1.txt +16 -0
- package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
- package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
- package/dist/licenses/saxes-5.0.1.txt +397 -0
- package/dist/licenses/setimmediate-1.0.5.txt +21 -0
- package/dist/licenses/string_decoder-1.1.1.txt +49 -0
- package/dist/licenses/string_decoder-1.3.0.txt +49 -0
- package/dist/licenses/tar-stream-2.2.0.txt +22 -0
- package/dist/licenses/tmp-0.2.7.txt +22 -0
- package/dist/licenses/traverse-0.3.9.txt +25 -0
- package/dist/licenses/tslib-1.14.1.txt +13 -0
- package/dist/licenses/unzipper-0.10.14.txt +26 -0
- package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
- package/dist/licenses/uuid-11.1.1.txt +10 -0
- package/dist/licenses/wrappy-1.0.2.txt +16 -0
- package/dist/licenses/xmlchars-2.2.0.txt +19 -0
- package/dist/licenses/zip-stream-4.1.1.txt +23 -0
- package/dist/matrix-CGRGkn5s.js +112 -0
- package/dist/matrix-gEO7ZM_u.cjs +1 -0
- package/dist/media-B7vnpD8k.cjs +1 -0
- package/dist/media-Y90dHK9z.js +70 -0
- package/dist/param-validation-C3HlcLLO.cjs +1 -0
- package/dist/param-validation-Do7Eg8Zv.js +181 -0
- package/dist/{pdf-AyJGb22z.cjs → pdf-ByVCb1i6.cjs} +49 -49
- package/dist/{pdf-8UPQebOE.js → pdf-DJ5S6ukC.js} +4924 -4872
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +20 -3
- package/dist/pdf.d.ts +20 -3
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BGKf-Tqg.js → plugin-C2j5_mhx.js} +2 -2
- package/dist/{plugin-CktLH_Iy.cjs → plugin-Dr39GBRG.cjs} +1 -1
- package/dist/prepared-DdrjLC7L.cjs +1 -0
- package/dist/prepared-DqtpvRTn.js +87 -0
- package/dist/progress-B0ctFpKf.cjs +1 -0
- package/dist/progress-BXzlVbIp.js +29 -0
- package/dist/progress-DJBd9Rb9.cjs +1 -0
- package/dist/progress-Hc2vxoCs.js +52 -0
- package/dist/protocol-BzwMP4Vw.cjs +1 -0
- package/dist/protocol-kt4Iy6-3.js +90 -0
- package/dist/record-bindings-CZWBJ1fU.js +195 -0
- package/dist/record-bindings-DUX1VMlR.cjs +1 -0
- package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-CWNvIjkV.js} +1 -1
- package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-CqSMxQ4p.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -0
- package/dist/report-encoding-worker.d.ts +1 -0
- package/dist/report-encoding-worker.js +2 -0
- package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
- package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
- package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
- package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
- package/dist/runtime-BjKBI530.js +168 -0
- package/dist/runtime-CBFEPKEs.cjs +1 -0
- package/dist/sbom.cdx.json +3982 -0
- package/dist/server/node.d.cts +106 -2
- package/dist/server/node.d.ts +106 -2
- package/dist/server-node.cjs +5 -1
- package/dist/server-node.js +4634 -539
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +780 -5
- package/dist/server.d.ts +780 -5
- package/dist/server.js +773 -691
- package/dist/sha256-BshdOkCC.cjs +1 -0
- package/dist/sha256-DTG-Gq8i.js +157 -0
- package/dist/style-67OqfNed.js +73 -0
- package/dist/style-C22Pbv3T.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-C2SpvsMU.js +58 -0
- package/dist/template-bindings-CEtWyiLX.cjs +1 -0
- package/dist/template-catalog-BtR2JmCL.js +414 -0
- package/dist/template-catalog-C2NLdrwB.cjs +1 -0
- package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-BVsbxs4a.cjs} +1 -1
- package/dist/{template-fragments-CLkGo6To.js → template-fragments-By0aZC1D.js} +21 -21
- package/dist/{template-outline-B3xVkzSv.cjs → template-outline-BwRV_eRo.cjs} +1 -1
- package/dist/{template-outline-CFenM1PV.js → template-outline-cnWfT_LK.js} +3 -3
- package/dist/template-registry-C62vpv4a.cjs +1 -0
- package/dist/template-registry-Cw3vRTX2.js +801 -0
- package/dist/textwrap-BEIg2w8y.js +110 -0
- package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
- package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
- package/dist/vue/async.d.cts +189 -14
- package/dist/vue/async.d.ts +189 -14
- package/dist/vue/index.d.cts +246 -22
- package/dist/vue/index.d.ts +246 -22
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +80 -78
- package/dist/{workbook-session-BfK1yHOO.js → workbook-session-BeSO8PFB.js} +5460 -5295
- package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Cbts-22R.cjs} +19 -19
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +104 -2
- package/dist/worker.d.ts +104 -2
- package/dist/worker.js +12 -156
- package/dist/xlsx-node.cjs +35 -35
- package/dist/xlsx-node.js +2138 -2137
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +24 -10
- package/dist/xlsx.d.ts +24 -10
- package/dist/xlsx.js +303 -277
- package/package.json +7 -4
- package/dist/ParamEditor-CflQV3eQ.js +0 -526
- package/dist/ParamEditor-vIDzvpPV.cjs +0 -1
- package/dist/ReportPreview-CvbqLUzM.cjs +0 -6
- package/dist/ReportPreview-D_ywJ_-H.js +0 -4533
- package/dist/assets-C2U-e-Sz.cjs +0 -4
- package/dist/assets-Q0wUwNrV.js +0 -217
- package/dist/batch-DzaTNLWI.js +0 -371
- package/dist/batch-xMkqYiTr.cjs +0 -1
- package/dist/capabilities-CK_7hizc.js +0 -63
- package/dist/capabilities-CsZ-pNHR.cjs +0 -1
- package/dist/config-0UIohTS7.cjs +0 -1
- package/dist/config-Dt9NtCPl.js +0 -566
- package/dist/data-explanation-BktvER5B.cjs +0 -1
- package/dist/data-explanation-C_J6jYNi.js +0 -16
- package/dist/defaults-DXhiM1ZD.js +0 -10
- package/dist/defaults-xhmcLLrf.cjs +0 -1
- package/dist/designer-Ci1LizA9.js +0 -5020
- package/dist/designer-rtmVIIdN.cjs +0 -2
- package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
- package/dist/grid-strokes-DyyG1q_o.js +0 -53
- package/dist/json-snapshot-BeFT3Tso.js +0 -1952
- package/dist/json-snapshot-D1NTP2oI.cjs +0 -2
- package/dist/matrix-DVyWiYsd.cjs +0 -1
- package/dist/matrix-yZsGnldA.js +0 -227
- package/dist/page-window-index-CIuT4BAv.js +0 -43
- package/dist/page-window-index-DEjnM6IB.cjs +0 -1
- package/dist/param-validation-BlHHXs6u.js +0 -153
- package/dist/param-validation-DCK039V1.cjs +0 -1
- package/dist/progress-7OSZbFok.js +0 -39
- package/dist/progress-BnLiS5eH.cjs +0 -1
- package/dist/render-plan-7xpGrCEl.cjs +0 -1
- package/dist/render-plan-Ck6koX9L.js +0 -13
- package/dist/style-CQ1PK8ZB.js +0 -67
- package/dist/style-UgIJSA1F.cjs +0 -1
- package/dist/task-events-DQ276fn2.cjs +0 -1
- package/dist/task-events-Dpsvf_t2.js +0 -47
- package/dist/template-bindings-BJR4k7qZ.cjs +0 -1
- package/dist/template-bindings-Daui7hLF.js +0 -252
- package/dist/template-registry-COXDEJEM.js +0 -570
- package/dist/template-registry-D3SjENi6.cjs +0 -1
- package/dist/validate-BJ5HIWY8.cjs +0 -1
- package/dist/validate-CkQBWCeg.js +0 -163
|
@@ -1,4533 +0,0 @@
|
|
|
1
|
-
import { computed as D, unref as c, ref as G, onScopeDispose as Ue, watch as de, getCurrentScope as qa, shallowRef as fe, nextTick as We, onMounted as St, onBeforeUnmount as Ka, defineComponent as we, openBlock as x, createElementBlock as P, createElementVNode as h, createVNode as ee, createTextVNode as ie, toDisplayString as y, Fragment as he, renderList as be, createCommentVNode as q, withModifiers as pt, withDirectives as Rt, withKeys as Ba, vModelText as Mt, createBlock as Se, normalizeClass as $e, renderSlot as ht, getCurrentInstance as rn, onUnmounted as ln, createStaticVNode as ja, isRef as Un, inject as Fn, provide as Ha, watchEffect as Wa, normalizeStyle as je, createSlots as Ua, withCtx as Gt } from "vue";
|
|
2
|
-
import { renderPage as Vn, renderPlanToImages as Va, calculateReportSelection as Ja, ReportCalculationError as Ga, inspectOutputCapabilities as Ya, createReportCellResolver as Ct, getReportEditSession as un, ReportCellEditError as Ae, reportCellEditKey as Ge, summarizeReportCellEdits as zn, createReportCellEditBatch as tn, parseReportCellFieldInput as Za, applyReportEditResult as Xa, applyReportCellEditBatch as Qa, getReportCellContext as at, validateReportCellFieldDefinition as _a, parseReportClipboard as eo, formatReportClipboard as to, resolvePlanAssets as no, paginateTemplate as ao, validateRenderPlan as oo, renderPlanToCanvas as so } from "@agile-team/mach-report";
|
|
3
|
-
import { c as Jn } from "./page-window-index-CIuT4BAv.js";
|
|
4
|
-
import { f as Gn, a as ye, w as He, n as Ln } from "./progress-7OSZbFok.js";
|
|
5
|
-
import { b as ro, s as Yn, p as lo, M as st, u as io, g as uo, r as co, i as fo, t as mo, R as go, n as vo, h as po } from "./config-Dt9NtCPl.js";
|
|
6
|
-
import { i as ho, a as bo } from "./render-plan-Ck6koX9L.js";
|
|
7
|
-
import { a as ae, _ as xe } from "./_plugin-vue_export-helper-8SL1F89S.js";
|
|
8
|
-
import { r as cn } from "./grid-geometry-BNptEcMm.js";
|
|
9
|
-
import { b as yo, c as wo, M as xo } from "./injection-keys-e85udZCp.js";
|
|
10
|
-
function Zn(e) {
|
|
11
|
-
return e == null ? [] : Array.isArray(e) ? e.map(String).filter((t) => t !== "") : String(e).split(",").map((t) => t.trim()).filter((t) => t !== "");
|
|
12
|
-
}
|
|
13
|
-
function cu(e) {
|
|
14
|
-
return Zn(e).join(",");
|
|
15
|
-
}
|
|
16
|
-
class Yt extends Error {
|
|
17
|
-
constructor(t) {
|
|
18
|
-
super(t), this.name = "PlanLoadError";
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function du(e = {}) {
|
|
22
|
-
const { baseUrl: t = "", headers: n, credentials: o, timeoutMs: s = 3e4 } = e, a = t.replace(/\/+$/, "");
|
|
23
|
-
return async ({ url: r, method: l, params: i, signal: m }) => {
|
|
24
|
-
let v = `${a}${r}`;
|
|
25
|
-
if (i && Object.keys(i).length > 0) {
|
|
26
|
-
const f = v.indexOf("#"), R = f >= 0 ? v.slice(f) : "", p = f >= 0 ? v.slice(0, f) : v, S = p.indexOf("?"), z = S >= 0 ? p.slice(0, S) : p, F = new URLSearchParams(S >= 0 ? p.slice(S + 1) : "");
|
|
27
|
-
for (const [B, V] of Object.entries(i)) F.set(B, V);
|
|
28
|
-
v = `${z}?${F}${R}`;
|
|
29
|
-
}
|
|
30
|
-
const d = (f, R) => {
|
|
31
|
-
const p = new Yt(f);
|
|
32
|
-
return Object.defineProperty(p, "cause", { value: R, configurable: !0, writable: !0 }), p;
|
|
33
|
-
};
|
|
34
|
-
if (m?.aborted)
|
|
35
|
-
throw d(`请求已取消: ${r}`, m.reason);
|
|
36
|
-
const g = new AbortController();
|
|
37
|
-
let I;
|
|
38
|
-
const k = () => {
|
|
39
|
-
g.signal.aborted || (I = "external", g.abort(m?.reason));
|
|
40
|
-
};
|
|
41
|
-
m?.addEventListener("abort", k, { once: !0 });
|
|
42
|
-
const b = setTimeout(() => {
|
|
43
|
-
g.signal.aborted || (I = "timeout", g.abort());
|
|
44
|
-
}, s);
|
|
45
|
-
try {
|
|
46
|
-
const f = await fetch(v, {
|
|
47
|
-
method: l.toUpperCase(),
|
|
48
|
-
headers: { Accept: "application/json", ...n },
|
|
49
|
-
credentials: o,
|
|
50
|
-
signal: g.signal
|
|
51
|
-
});
|
|
52
|
-
if (!f.ok)
|
|
53
|
-
throw new Yt(`HTTP ${f.status} ${r}`);
|
|
54
|
-
return await f.json();
|
|
55
|
-
} catch (f) {
|
|
56
|
-
throw I === "timeout" ? d(`请求超时(${s}ms): ${r}`, f) : I === "external" ? d(`请求已取消: ${r}`, f) : f instanceof Yt ? f : d(`请求失败(${r}): ${f instanceof Error ? f.message : String(f)}`, f);
|
|
57
|
-
} finally {
|
|
58
|
-
clearTimeout(b), m?.removeEventListener("abort", k);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function ko(e, t, n = {}) {
|
|
63
|
-
const o = n.pxPerMm ?? 3.7795275590551185, s = D(() => Math.max(0, c(n.gapPx) ?? 18)), a = G(0), r = G(800), l = D(() => {
|
|
64
|
-
const p = e.value?.pages ?? [];
|
|
65
|
-
return Jn(p.map((S) => S.pageHeightMm * o), s.value);
|
|
66
|
-
}), i = D(() => {
|
|
67
|
-
let p = 0;
|
|
68
|
-
for (const S of e.value?.pages ?? []) p = Math.max(p, S.pageWidthMm * o);
|
|
69
|
-
return { w: p, h: l.value.totalHeightPx };
|
|
70
|
-
}), m = D(() => l.value.window(
|
|
71
|
-
r.value / t.value,
|
|
72
|
-
a.value / t.value,
|
|
73
|
-
c(n.overscan) ?? 1
|
|
74
|
-
)), v = D(() => {
|
|
75
|
-
const p = e.value;
|
|
76
|
-
if (!p) return [];
|
|
77
|
-
const { start: S, end: z } = m.value;
|
|
78
|
-
return p.pages.slice(S, z + 1).map((F, B) => ({ page: F, index: S + B }));
|
|
79
|
-
});
|
|
80
|
-
let d = 0, g = !1, I;
|
|
81
|
-
function k(p) {
|
|
82
|
-
p && (a.value = p.scrollTop, r.value = p.clientHeight || 800);
|
|
83
|
-
}
|
|
84
|
-
function b(p, S) {
|
|
85
|
-
p.scrollTop = l.value.offsetAt(S) * t.value, I = { top: p.scrollTop, index: S, zoom: t.value, geometry: l.value }, k(p);
|
|
86
|
-
}
|
|
87
|
-
function f(p, S) {
|
|
88
|
-
return (z) => {
|
|
89
|
-
d || g || (d = requestAnimationFrame(() => {
|
|
90
|
-
if (d = 0, g || (k(z), S.value <= 0)) return;
|
|
91
|
-
if (I && I.top === z.scrollTop && I.zoom === t.value && I.geometry === l.value) {
|
|
92
|
-
p.value = Math.min(S.value, I.index + 1);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
I = void 0;
|
|
96
|
-
const F = Math.max(0, z.scrollTop + 32) / t.value;
|
|
97
|
-
p.value = Math.min(S.value, l.value.pageAt(F) + 1);
|
|
98
|
-
}));
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function R() {
|
|
102
|
-
g = !0, d && cancelAnimationFrame(d), d = 0;
|
|
103
|
-
}
|
|
104
|
-
return Ue(R), {
|
|
105
|
-
contentSize: i,
|
|
106
|
-
windowRange: m,
|
|
107
|
-
visiblePages: v,
|
|
108
|
-
makeScrollHandler: f,
|
|
109
|
-
refreshViewport: k,
|
|
110
|
-
scrollToPage: b,
|
|
111
|
-
pageOffsetPx: (p) => l.value.offsetAt(p),
|
|
112
|
-
destroy: R
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
const Nn = 96 / 25.4;
|
|
116
|
-
function $o(e) {
|
|
117
|
-
const t = /* @__PURE__ */ new WeakMap(), n = G(0);
|
|
118
|
-
let o, s = 0, a = 0, r = !1;
|
|
119
|
-
function l() {
|
|
120
|
-
s++, a && cancelAnimationFrame(a), a = 0;
|
|
121
|
-
}
|
|
122
|
-
function i(b, f, R, p) {
|
|
123
|
-
return !r && f === s && e.plan.value === R && e.root.value === p && p.contains(b.holder) && Number(b.holder.dataset.page) === b.index + 1;
|
|
124
|
-
}
|
|
125
|
-
function m(b) {
|
|
126
|
-
const { holder: f, page: R } = b;
|
|
127
|
-
t.delete(f), f.style.width = `${R.pageWidthMm * Nn}px`, f.style.height = `${R.pageHeightMm * Nn}px`, f.setAttribute("aria-busy", "true");
|
|
128
|
-
const p = f.ownerDocument.createElement("div");
|
|
129
|
-
p.className = "mrp-page-loading";
|
|
130
|
-
const S = f.ownerDocument.createElement("span");
|
|
131
|
-
S.textContent = e.loading(), S.style.transform = `scale(${1 / Math.max(1e-4, e.zoom())})`, p.append(S), f.replaceChildren(p);
|
|
132
|
-
}
|
|
133
|
-
function v(b) {
|
|
134
|
-
const f = t.get(b.holder);
|
|
135
|
-
return !f || f.page !== b.page || f.element.parentElement !== b.holder ? !1 : (f.query !== e.query() && (e.clear(f.element), e.highlight(f.element), f.query = e.query()), !0);
|
|
136
|
-
}
|
|
137
|
-
function d(b, f, R, p) {
|
|
138
|
-
if (i(b, f, R, p))
|
|
139
|
-
try {
|
|
140
|
-
const S = Vn(b.page, 96, {}, b.holder.ownerDocument);
|
|
141
|
-
if (e.highlight(S), !i(b, f, R, p)) return;
|
|
142
|
-
b.holder.replaceChildren(S), b.holder.removeAttribute("aria-busy"), t.set(b.holder, { page: b.page, element: S, query: e.query() }), e.mounted(b.holder), e.ready();
|
|
143
|
-
} catch (S) {
|
|
144
|
-
if (!i(b, f, R, p)) return;
|
|
145
|
-
b.holder.removeAttribute("aria-busy");
|
|
146
|
-
const z = b.holder.ownerDocument.createElement("div");
|
|
147
|
-
z.className = "mrp-page-render-error", z.setAttribute("role", "alert"), z.textContent = S instanceof Error ? S.message : String(S), b.holder.replaceChildren(z), e.error(S);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function g(b, f, R, p) {
|
|
151
|
-
b.length && (a = requestAnimationFrame(() => {
|
|
152
|
-
if (f !== s || r) return;
|
|
153
|
-
a = 0;
|
|
154
|
-
const S = b.shift();
|
|
155
|
-
S && d(S, f, R, p), f === s && e.plan.value === R && e.root.value === p && g(b, f, R, p);
|
|
156
|
-
}));
|
|
157
|
-
}
|
|
158
|
-
function I() {
|
|
159
|
-
l();
|
|
160
|
-
const b = e.plan.value, f = e.root.value;
|
|
161
|
-
if (r || !b || !f) {
|
|
162
|
-
o = void 0;
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const R = s, p = o?.plan === b ? o.index : e.priority();
|
|
166
|
-
o = void 0;
|
|
167
|
-
const S = [];
|
|
168
|
-
f.querySelectorAll(".mrp-page-holder").forEach((B) => {
|
|
169
|
-
const V = Number(B.dataset.page) - 1, _ = b.pages[V];
|
|
170
|
-
if (!_) return;
|
|
171
|
-
const Z = { holder: B, page: _, index: V };
|
|
172
|
-
v(Z) || (m(Z), S.push(Z));
|
|
173
|
-
});
|
|
174
|
-
const z = S.findIndex((B) => B.index === p), F = z < 0 ? void 0 : S.splice(z, 1)[0];
|
|
175
|
-
F && d(F, R, b, f), e.ready(), g(S, R, b, f);
|
|
176
|
-
}
|
|
177
|
-
function k(b) {
|
|
178
|
-
r || !e.plan.value || (o = { plan: e.plan.value, index: b }, n.value++);
|
|
179
|
-
}
|
|
180
|
-
return de([e.plan, e.root, e.pages, e.priority, e.focusToken, e.query, e.zoom, e.loading, n], I, { flush: "post", immediate: !0 }), Ue(() => {
|
|
181
|
-
r = !0, o = void 0, l();
|
|
182
|
-
}), { prioritize: k, cancel: l };
|
|
183
|
-
}
|
|
184
|
-
function Co(e) {
|
|
185
|
-
const t = G(1), n = G("fit");
|
|
186
|
-
let o = 0;
|
|
187
|
-
function s() {
|
|
188
|
-
o && cancelAnimationFrame(o), o = 0;
|
|
189
|
-
}
|
|
190
|
-
function a() {
|
|
191
|
-
s(), o = requestAnimationFrame(() => {
|
|
192
|
-
if (o = 0, n.value !== "fit") return;
|
|
193
|
-
const l = e();
|
|
194
|
-
!l?.viewport || l.viewport.clientWidth <= 48 || !Number.isFinite(l.pageWidthPx) || (t.value = Math.min(1, (l.viewport.clientWidth - 48) / Math.max(1, l.pageWidthPx)));
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
function r(l) {
|
|
198
|
-
if (l === "fit")
|
|
199
|
-
n.value = "fit", a();
|
|
200
|
-
else {
|
|
201
|
-
if (!Number.isFinite(l)) return;
|
|
202
|
-
s(), n.value = "raw", t.value = Math.min(3, Math.max(0.3, l / 100));
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return qa() && Ue(s), { zoom: t, zoomMode: n, applyFitZoom: a, setZoom: r };
|
|
206
|
-
}
|
|
207
|
-
let Eo = 0;
|
|
208
|
-
function qn(e, t) {
|
|
209
|
-
const n = new AbortController();
|
|
210
|
-
let o = { taskId: `mr-output-${Date.now().toString(36)}-${++Eo}`, kind: e, stage: e === "print" ? "print" : "encode", status: "running", cancellable: !0 };
|
|
211
|
-
function s() {
|
|
212
|
-
try {
|
|
213
|
-
t?.(Object.freeze({ ...o }));
|
|
214
|
-
} catch {
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return {
|
|
218
|
-
controller: n,
|
|
219
|
-
get task() {
|
|
220
|
-
return o;
|
|
221
|
-
},
|
|
222
|
-
start: s,
|
|
223
|
-
update(a, r, l) {
|
|
224
|
-
n.signal.aborted || o.status !== "running" || (o = { ...o, stage: a, completed: r, total: l }, s());
|
|
225
|
-
},
|
|
226
|
-
finish(a = "completed") {
|
|
227
|
-
o.status === "running" && (o = { ...o, status: a, cancellable: !1 }, s(), a === "cancelled" && n.abort());
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
class Pe extends Error {
|
|
232
|
-
constructor(t, n = "") {
|
|
233
|
-
super(`Print preparation failed: ${t} ${n}`), this.kind = t, this.resource = n, this.code = "print-resource", this.name = "ReportPrintResourceError";
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
function Xn(e, t) {
|
|
237
|
-
const n = { ...ro, ...t };
|
|
238
|
-
return e instanceof Pe ? e.kind === "timeout" ? n.printPrepareTimeout : e.kind === "image" ? n.printImageFailed.replace("{index}", String(e.resource)) : e.kind === "font" ? n.printFontFailed.replace("{family}", String(e.resource)) : n.printPrepareFailed : n.printPrepareFailed;
|
|
239
|
-
}
|
|
240
|
-
function Io(e, t) {
|
|
241
|
-
let n;
|
|
242
|
-
try {
|
|
243
|
-
n = new URL(e, t);
|
|
244
|
-
} catch {
|
|
245
|
-
throw new Pe("config");
|
|
246
|
-
}
|
|
247
|
-
if (!["http:", "https:"].includes(n.protocol) || e.length > 16384) throw new Pe("config");
|
|
248
|
-
return n.href;
|
|
249
|
-
}
|
|
250
|
-
async function Po(e, t, n, o) {
|
|
251
|
-
const s = t.fonts ?? [];
|
|
252
|
-
if (s.length > 8) throw new Pe("config");
|
|
253
|
-
for (const a of s) {
|
|
254
|
-
if (ye(n), typeof a.family != "string" || !a.family.trim() || a.family.length > 256 || typeof a.source != "string") throw new Pe("config");
|
|
255
|
-
const r = e.defaultView?.FontFace;
|
|
256
|
-
if (!r || !e.fonts) throw new Pe("font", a.family);
|
|
257
|
-
try {
|
|
258
|
-
const { loadFontWithCache: l } = await import("./font-loader-DHto6Lra.js"), i = await l(Io(a.source, o), { signal: n });
|
|
259
|
-
if (!i) throw new Pe("font", a.family);
|
|
260
|
-
const m = new r(a.family, i, { weight: a.weight, style: a.style });
|
|
261
|
-
await He(m.load(), n), e.fonts.add(m);
|
|
262
|
-
} catch (l) {
|
|
263
|
-
throw ye(n), l instanceof Pe ? l : new Pe("font", a.family);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
e.documentElement.getBoundingClientRect(), e.fonts && await He(e.fonts.ready, n);
|
|
267
|
-
}
|
|
268
|
-
async function So(e, t, n) {
|
|
269
|
-
ye(n);
|
|
270
|
-
try {
|
|
271
|
-
if (typeof e.decode == "function" ? await He(e.decode(), n) : e.complete || await new Promise((o, s) => {
|
|
272
|
-
const a = () => {
|
|
273
|
-
e.removeEventListener("load", r), e.removeEventListener("error", l), n.removeEventListener("abort", i);
|
|
274
|
-
}, r = () => {
|
|
275
|
-
a(), o();
|
|
276
|
-
}, l = () => {
|
|
277
|
-
a(), s(new Pe("image", t));
|
|
278
|
-
}, i = () => {
|
|
279
|
-
a(), s(n.reason);
|
|
280
|
-
};
|
|
281
|
-
e.addEventListener("load", r, { once: !0 }), e.addEventListener("error", l, { once: !0 }), n.addEventListener("abort", i, { once: !0 }), n.aborted ? i() : e.complete && r();
|
|
282
|
-
}), ye(n), e.naturalWidth <= 0 || e.naturalHeight <= 0) throw new Pe("image", t);
|
|
283
|
-
} catch {
|
|
284
|
-
throw ye(n), new Pe("image", t);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
async function Qn(e, t = {}, n, o = document.baseURI) {
|
|
288
|
-
const s = t.resourceTimeoutMs ?? 15e3;
|
|
289
|
-
if (!Number.isSafeInteger(s) || s < 1 || s > 12e4) throw new Pe("config");
|
|
290
|
-
const a = new AbortController(), r = Gn(n, a), l = setTimeout(() => a.abort(new Pe("timeout")), s);
|
|
291
|
-
try {
|
|
292
|
-
ye(a.signal), await Po(e, t, a.signal, o);
|
|
293
|
-
const i = e.querySelectorAll("img");
|
|
294
|
-
let m = 0;
|
|
295
|
-
const v = async () => {
|
|
296
|
-
for (; m < i.length; ) {
|
|
297
|
-
const d = m++;
|
|
298
|
-
await So(i[d], d + 1, a.signal);
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
await Promise.all(Array.from({ length: Math.min(i.length, 4) }, v)), ye(a.signal);
|
|
302
|
-
} finally {
|
|
303
|
-
clearTimeout(l), r(), a.abort();
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
const ot = 8;
|
|
307
|
-
function vt() {
|
|
308
|
-
return new Promise((e) => setTimeout(e, 0));
|
|
309
|
-
}
|
|
310
|
-
function kt(e) {
|
|
311
|
-
return `p${e.pageWidthMm}x${e.pageHeightMm}`.replace(/[.+]/g, "_");
|
|
312
|
-
}
|
|
313
|
-
function Et(e) {
|
|
314
|
-
const t = /* @__PURE__ */ new Map();
|
|
315
|
-
return e.pages.forEach((s) => {
|
|
316
|
-
t.has(kt(s)) || t.set(kt(s), s);
|
|
317
|
-
}), `<!doctype html><html><head><meta charset="utf-8"><style>${`.mr-page{margin:0 auto;page-break-after:always;}
|
|
318
|
-
.mr-page tr{break-inside:avoid;page-break-inside:avoid;}
|
|
319
|
-
.mr-comp{break-inside:avoid;page-break-inside:avoid;}
|
|
320
|
-
${[...t.values()].map(
|
|
321
|
-
(s) => `@page ${kt(s)}{size:${s.pageWidthMm}mm ${s.pageHeightMm}mm;margin:0;}`
|
|
322
|
-
).join(`
|
|
323
|
-
`)}
|
|
324
|
-
body{margin:0;background:#fff;}`}</style></head><body>`;
|
|
325
|
-
}
|
|
326
|
-
function It(e, t) {
|
|
327
|
-
const n = Vn(e, 96, {}, document);
|
|
328
|
-
n.style.page = kt(e);
|
|
329
|
-
const o = lo(t);
|
|
330
|
-
if (o.x || o.y) {
|
|
331
|
-
const s = document.createElement("div");
|
|
332
|
-
for (s.style.cssText = `position:absolute;inset:0;transform:translate(${o.x}mm,${o.y}mm);transform-origin:top left`; n.firstChild; ) s.appendChild(n.firstChild);
|
|
333
|
-
n.appendChild(s);
|
|
334
|
-
}
|
|
335
|
-
return n.outerHTML;
|
|
336
|
-
}
|
|
337
|
-
function Ro(e, t) {
|
|
338
|
-
return { head: Et(e), pageChunks: e.pages.map((n) => It(n, t)) };
|
|
339
|
-
}
|
|
340
|
-
async function Mo(e, t = {}) {
|
|
341
|
-
const n = {
|
|
342
|
-
schemaVersion: "mach-report-batch-print",
|
|
343
|
-
pages: e.flatMap((l) => l.pages)
|
|
344
|
-
};
|
|
345
|
-
if (n.pages.length === 0) return;
|
|
346
|
-
const o = Yn(t.printOptions), s = Et(n), a = document.createElement("iframe");
|
|
347
|
-
a.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(a);
|
|
348
|
-
let r = !1;
|
|
349
|
-
try {
|
|
350
|
-
const l = a.contentDocument;
|
|
351
|
-
l.open(), l.write(s);
|
|
352
|
-
for (let i = 0; i < n.pages.length; i++)
|
|
353
|
-
ye(t.signal), l.write(It(n.pages[i], o)), i % ot === ot - 1 && (Ln(t, i + 1, n.pages.length), await vt());
|
|
354
|
-
l.write("</body></html>"), l.close(), await vt(), await Qn(l, o, t.signal), Ln(t, n.pages.length, n.pages.length), r = !0, a.contentWindow?.focus(), a.contentWindow?.print();
|
|
355
|
-
} catch (l) {
|
|
356
|
-
if (t.signal?.aborted) throw l;
|
|
357
|
-
t.onError?.(Xn(l, t.messages));
|
|
358
|
-
} finally {
|
|
359
|
-
r ? setTimeout(() => a.remove(), 6e4) : a.remove();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function _n(e) {
|
|
363
|
-
return `<!doctype html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="utf-8"><!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View><w:Zoom>100</w:Zoom></w:WordDocument></xml><![endif]-->${e.replace(/^<!doctype html><html><head>/, "")}`;
|
|
364
|
-
}
|
|
365
|
-
function fu(e) {
|
|
366
|
-
const { head: t, pageChunks: n } = Ro(e);
|
|
367
|
-
return {
|
|
368
|
-
html: `${_n(t)}${n.join("")}</body></html>`,
|
|
369
|
-
filename: "mach-report.doc"
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
function To(e, t) {
|
|
373
|
-
let n = null, o = !1, s = !1, a = 0, r = 0;
|
|
374
|
-
const l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
|
|
375
|
-
let m = null;
|
|
376
|
-
const v = /* @__PURE__ */ new Map();
|
|
377
|
-
let d = null, g = null, I = null, k = null, b = null;
|
|
378
|
-
function f($, T) {
|
|
379
|
-
return !s && e.value === $ && a === T;
|
|
380
|
-
}
|
|
381
|
-
function R() {
|
|
382
|
-
if (s) return;
|
|
383
|
-
const $ = [...i.values()].reverse().find((T) => f(T.plan, T.epoch))?.format ?? null;
|
|
384
|
-
$ !== d && (d = $, t.onBusy?.($));
|
|
385
|
-
}
|
|
386
|
-
function p($, T, H) {
|
|
387
|
-
const j = {};
|
|
388
|
-
return i.set(j, { plan: $, epoch: T, format: H, run: qn("export", t.onTask) }), i.get(j).run.start(), R(), j;
|
|
389
|
-
}
|
|
390
|
-
function S($) {
|
|
391
|
-
i.get($)?.run.finish(), i.delete($), R();
|
|
392
|
-
}
|
|
393
|
-
function z() {
|
|
394
|
-
for (const [$, T] of v)
|
|
395
|
-
f(T.plan, T.epoch) || ($.close(), v.delete($));
|
|
396
|
-
}
|
|
397
|
-
function F($ = !0) {
|
|
398
|
-
if ($) {
|
|
399
|
-
r++;
|
|
400
|
-
for (const T of l) T.close();
|
|
401
|
-
l.clear();
|
|
402
|
-
}
|
|
403
|
-
for (const T of i.values()) T.run.finish("cancelled");
|
|
404
|
-
m?.finish("cancelled"), a++, V(), R(), z();
|
|
405
|
-
}
|
|
406
|
-
const B = de(e, () => F(!1), { flush: "sync" });
|
|
407
|
-
function V() {
|
|
408
|
-
n?.remove(), n = null;
|
|
409
|
-
}
|
|
410
|
-
function _() {
|
|
411
|
-
F(), s = !0, a++, B(), V(), z(), i.clear(), t.onPrinting?.(!1);
|
|
412
|
-
}
|
|
413
|
-
function Z($, T) {
|
|
414
|
-
const H = URL.createObjectURL($);
|
|
415
|
-
setTimeout(() => URL.revokeObjectURL(H), 1e4);
|
|
416
|
-
const j = document.createElement("a");
|
|
417
|
-
j.href = H, j.download = T, j.click();
|
|
418
|
-
}
|
|
419
|
-
function ne($, T, H, j, Q) {
|
|
420
|
-
H.update("download"), f($, T) && !H.controller.signal.aborted && Z(j, Q);
|
|
421
|
-
}
|
|
422
|
-
async function ce($, T, H, j, Q) {
|
|
423
|
-
const se = $.contentDocument;
|
|
424
|
-
se.open(), se.write(Et(T));
|
|
425
|
-
for (let te = 0; te < T.pages.length; te++)
|
|
426
|
-
if (j.controller.signal.aborted || (se.write(It(T.pages[te], Q)), j.update("print", te + 1, T.pages.length), te % ot === ot - 1 && await vt(), $ !== n)) return !1;
|
|
427
|
-
return se.write("</body></html>"), se.close(), await vt(), await Qn(se, Q, j.controller.signal), !(!f(T, H) || $ !== n);
|
|
428
|
-
}
|
|
429
|
-
function Re() {
|
|
430
|
-
const $ = r, T = (j) => j && !s && $ === r, H = (j) => (!s && $ === r && t.onError(j instanceof Error ? j.message : "报表修改尚未完成", "export"), !1);
|
|
431
|
-
try {
|
|
432
|
-
const j = t.beforeOutput?.() ?? !0;
|
|
433
|
-
return typeof j == "boolean" ? T(j) : j.then(T, H);
|
|
434
|
-
} catch (j) {
|
|
435
|
-
return H(j);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
function ge($) {
|
|
439
|
-
const T = Re();
|
|
440
|
-
return typeof T == "boolean" ? T ? $() : Promise.resolve() : T.then((H) => H ? $() : void 0);
|
|
441
|
-
}
|
|
442
|
-
function C($, T, H, j, Q) {
|
|
443
|
-
j.finish(j.controller.signal.aborted ? "cancelled" : "failed"), Q === n && V(), f(T, H) && !j.controller.signal.aborted && t.onError(Xn($, t.getPrintMessages?.()), "print");
|
|
444
|
-
}
|
|
445
|
-
async function O() {
|
|
446
|
-
if (o) return;
|
|
447
|
-
const $ = e.value;
|
|
448
|
-
if (s || !$ || $.pages.length === 0) return;
|
|
449
|
-
const T = a;
|
|
450
|
-
o = !0;
|
|
451
|
-
const H = qn("print", t.onTask);
|
|
452
|
-
m = H, H.start(), t.onPrinting?.(!0), V(), n = document.createElement("iframe"), n.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(n);
|
|
453
|
-
const j = n;
|
|
454
|
-
try {
|
|
455
|
-
if (!f($, T) || H.controller.signal.aborted) {
|
|
456
|
-
V();
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
const Q = Yn(t.getPrintOptions?.());
|
|
460
|
-
if (!await ce(j, $, T, H, Q)) return;
|
|
461
|
-
j.contentWindow?.focus(), j.contentWindow?.print();
|
|
462
|
-
} catch (Q) {
|
|
463
|
-
C(Q, $, T, H, j);
|
|
464
|
-
} finally {
|
|
465
|
-
H.finish(), m === H && (m = null), o = !1, s || t.onPrinting?.(!1);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
function w($, T, H) {
|
|
469
|
-
return {
|
|
470
|
-
signal: H.controller.signal,
|
|
471
|
-
onDiagnostic: (j) => {
|
|
472
|
-
f($, T) && !H.controller.signal.aborted && t.onDiagnostic?.(j);
|
|
473
|
-
},
|
|
474
|
-
onProgress: (j, Q) => H.update("encode", j, Q)
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
function M($, T, H) {
|
|
478
|
-
if (g?.plan === $ && g.epoch === T) return g.promise;
|
|
479
|
-
const j = Promise.resolve().then(() => {
|
|
480
|
-
if (!f($, T)) throw new Error("报表已切换或卸载");
|
|
481
|
-
return He(t.getPdfExporter()($, (Q) => {
|
|
482
|
-
f($, T) && t.onWarning?.(Q);
|
|
483
|
-
}, H ? w($, T, H) : void 0), H?.controller.signal);
|
|
484
|
-
}).finally(() => {
|
|
485
|
-
g?.promise === j && (g = null);
|
|
486
|
-
});
|
|
487
|
-
return g = { plan: $, epoch: T, promise: j }, j;
|
|
488
|
-
}
|
|
489
|
-
async function A() {
|
|
490
|
-
const $ = e.value;
|
|
491
|
-
if (s || !$ || $.pages.length === 0) return;
|
|
492
|
-
const T = a;
|
|
493
|
-
if (I?.plan === $ && I.epoch === T) return I.promise;
|
|
494
|
-
const H = p($, T, "PDF"), j = (async () => {
|
|
495
|
-
try {
|
|
496
|
-
const Q = i.get(H).run, se = await M($, T, Q);
|
|
497
|
-
if (!f($, T)) return;
|
|
498
|
-
ne($, T, Q, new Blob([se], { type: "application/pdf" }), "mach-report.pdf");
|
|
499
|
-
} catch (Q) {
|
|
500
|
-
i.get(H)?.run.finish("failed"), f($, T) && t.onError(Q instanceof Error ? `PDF 导出失败: ${Q.message}` : "PDF 导出失败", "pdf");
|
|
501
|
-
} finally {
|
|
502
|
-
S(H), I?.token === H && (I = null);
|
|
503
|
-
}
|
|
504
|
-
})();
|
|
505
|
-
return I = { plan: $, epoch: T, promise: j, token: H }, j;
|
|
506
|
-
}
|
|
507
|
-
async function N() {
|
|
508
|
-
const $ = e.value;
|
|
509
|
-
if (s || !$ || $.pages.length === 0) return;
|
|
510
|
-
const T = a;
|
|
511
|
-
if (k?.plan === $ && k.epoch === T) return k.promise;
|
|
512
|
-
const H = { ...t.getXlsxOptions?.() }, j = p($, T, "Excel"), Q = (async () => {
|
|
513
|
-
try {
|
|
514
|
-
const { renderPlanToXlsx: se } = await import("@agile-team/mach-report/xlsx");
|
|
515
|
-
if (!f($, T)) return;
|
|
516
|
-
const te = i.get(j).run, { buffer: Me, warnings: Te } = await He(se($, { ...H, ...w($, T, te) }), te.controller.signal);
|
|
517
|
-
if (!f($, T) || (Te.length > 0 && t.onWarning?.(`Excel 导出有 ${Te.length} 条提示:${Te.slice(0, 2).join(";")}`), !f($, T))) return;
|
|
518
|
-
ne($, T, te, new Blob([Me], {
|
|
519
|
-
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
520
|
-
}), "mach-report.xlsx");
|
|
521
|
-
} catch (se) {
|
|
522
|
-
i.get(j)?.run.finish("failed"), f($, T) && t.onError(se instanceof Error ? `Excel 导出失败: ${se.message}` : "Excel 导出失败", "export");
|
|
523
|
-
} finally {
|
|
524
|
-
S(j), k?.token === j && (k = null);
|
|
525
|
-
}
|
|
526
|
-
})();
|
|
527
|
-
return k = { plan: $, epoch: T, promise: Q, token: j }, Q;
|
|
528
|
-
}
|
|
529
|
-
async function J() {
|
|
530
|
-
const $ = e.value;
|
|
531
|
-
if (s || !$ || $.pages.length === 0) return;
|
|
532
|
-
const T = a;
|
|
533
|
-
if (b?.plan === $ && b.epoch === T) return b.promise;
|
|
534
|
-
const H = p($, T, "图片"), j = (async () => {
|
|
535
|
-
try {
|
|
536
|
-
const Q = i.get(H).run, { blobs: se } = await He(Va($, {
|
|
537
|
-
...w($, T, Q),
|
|
538
|
-
dpr: Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1)
|
|
539
|
-
}), Q.controller.signal);
|
|
540
|
-
if (!f($, T)) return;
|
|
541
|
-
se.forEach((te, Me) => {
|
|
542
|
-
ne($, T, Q, te, se.length > 1 ? `mach-report-page-${Me + 1}.png` : "mach-report.png");
|
|
543
|
-
});
|
|
544
|
-
} catch (Q) {
|
|
545
|
-
i.get(H)?.run.finish("failed"), f($, T) && t.onError(
|
|
546
|
-
Q instanceof Error ? `图片导出失败: ${Q.message}` : "图片导出失败",
|
|
547
|
-
"export"
|
|
548
|
-
);
|
|
549
|
-
} finally {
|
|
550
|
-
S(H), b?.token === H && (b = null);
|
|
551
|
-
}
|
|
552
|
-
})();
|
|
553
|
-
return b = { plan: $, epoch: T, promise: j, token: H }, j;
|
|
554
|
-
}
|
|
555
|
-
async function W($) {
|
|
556
|
-
const T = e.value;
|
|
557
|
-
if (s || !T || !T.pages.length) return;
|
|
558
|
-
const H = a, j = p(T, H, $ === "word" ? "Word" : "HTML"), Q = i.get(j).run;
|
|
559
|
-
try {
|
|
560
|
-
const se = [];
|
|
561
|
-
for (const [Te, Ye] of T.pages.entries()) {
|
|
562
|
-
if (!f(T, H)) return;
|
|
563
|
-
se.push(It(Ye)), Q.update("encode", Te + 1, T.pages.length), Te % ot === ot - 1 && await vt();
|
|
564
|
-
}
|
|
565
|
-
if (!f(T, H)) return;
|
|
566
|
-
const te = Et(T), Me = `${$ === "word" ? _n(te) : te}${se.join("")}</body></html>`;
|
|
567
|
-
ne(T, H, Q, new Blob([Me], { type: $ === "word" ? "application/msword;charset=utf-8" : "text/html;charset=utf-8" }), $ === "word" ? "mach-report.doc" : "mach-report.html");
|
|
568
|
-
} catch (se) {
|
|
569
|
-
Q.finish("failed"), f(T, H) && t.onError(se instanceof Error ? `导出失败: ${se.message}` : "导出失败", "export");
|
|
570
|
-
} finally {
|
|
571
|
-
S(j);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
async function X() {
|
|
575
|
-
await W("word");
|
|
576
|
-
}
|
|
577
|
-
function Y() {
|
|
578
|
-
return ge(O);
|
|
579
|
-
}
|
|
580
|
-
function oe() {
|
|
581
|
-
return ge(J);
|
|
582
|
-
}
|
|
583
|
-
function K() {
|
|
584
|
-
return ge(X);
|
|
585
|
-
}
|
|
586
|
-
async function ke($) {
|
|
587
|
-
const T = e.value;
|
|
588
|
-
if (!(s || !T || T.pages.length === 0)) {
|
|
589
|
-
if ($ === "pdf") {
|
|
590
|
-
await A();
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
if ($ === "xlsx" || $ === "excel") {
|
|
594
|
-
await N();
|
|
595
|
-
return;
|
|
596
|
-
}
|
|
597
|
-
if ($ === "png" || $ === "image") {
|
|
598
|
-
await J();
|
|
599
|
-
return;
|
|
600
|
-
}
|
|
601
|
-
if ($ === "word" || $ === "doc") {
|
|
602
|
-
await X();
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
if ($ !== "html") {
|
|
606
|
-
t.onError(`不支持的导出格式:${$}`, "export");
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
await W("html");
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
function Ke($) {
|
|
613
|
-
return ge(() => ke($));
|
|
614
|
-
}
|
|
615
|
-
function Fe($) {
|
|
616
|
-
const T = e.value;
|
|
617
|
-
if (s || !T || !T.pages.length) {
|
|
618
|
-
$.close();
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
const H = a;
|
|
622
|
-
v.set($, { plan: T, epoch: H });
|
|
623
|
-
const j = p(T, H, "PDF");
|
|
624
|
-
M(T, H, i.get(j).run).then((Q) => {
|
|
625
|
-
if (!f(T, H) || $.closed) {
|
|
626
|
-
v.delete($) && $.close();
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
const se = URL.createObjectURL(new Blob([Q], { type: "application/pdf" }));
|
|
630
|
-
setTimeout(() => URL.revokeObjectURL(se), 6e4);
|
|
631
|
-
const te = $.document;
|
|
632
|
-
te.title = "PDF 预览", te.documentElement.style.height = "100%", te.body.style.cssText = "margin:0;height:100%;";
|
|
633
|
-
const Me = te.createElement("iframe");
|
|
634
|
-
Me.title = "PDF 预览", Me.style.cssText = "display:block;width:100%;height:100%;border:0;", Me.src = se, te.body.replaceChildren(Me), v.delete($);
|
|
635
|
-
}).catch((Q) => {
|
|
636
|
-
i.get(j)?.run.finish("failed"), $.close(), v.delete($), f(T, H) && t.onError(Q instanceof Error ? `PDF 预览失败: ${Q.message}` : "PDF 预览失败", "pdf");
|
|
637
|
-
}).finally(() => S(j));
|
|
638
|
-
}
|
|
639
|
-
function Ve() {
|
|
640
|
-
if (s || !e.value?.pages.length) return;
|
|
641
|
-
const $ = globalThis.window.open("", "_blank");
|
|
642
|
-
if (!$) {
|
|
643
|
-
t.onError("浏览器拦截了弹窗,请允许弹窗后重试", "pdf");
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
const T = Re();
|
|
647
|
-
if (typeof T == "boolean") {
|
|
648
|
-
T ? Fe($) : $.close();
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
l.add($), T.then((H) => {
|
|
652
|
-
const j = l.delete($);
|
|
653
|
-
if (!H || !j || $.closed) {
|
|
654
|
-
$.close();
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
Fe($);
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
return {
|
|
661
|
-
print: Y,
|
|
662
|
-
exportAs: Ke,
|
|
663
|
-
exportImages: oe,
|
|
664
|
-
exportWord: K,
|
|
665
|
-
openPdfWindow: Ve,
|
|
666
|
-
invalidatePending: F,
|
|
667
|
-
cancel: F,
|
|
668
|
-
releasePrintFrame: V,
|
|
669
|
-
dispose: _
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
const ea = "mrp-hit";
|
|
673
|
-
function Oo(e) {
|
|
674
|
-
e.querySelectorAll(`mark.${ea}`).forEach((n) => {
|
|
675
|
-
const o = n.parentNode;
|
|
676
|
-
if (o) {
|
|
677
|
-
for (; n.firstChild; ) o.insertBefore(n.firstChild, n);
|
|
678
|
-
n.remove(), o.normalize();
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
function Do(e, t) {
|
|
683
|
-
const n = t.trim();
|
|
684
|
-
if (!n) return 0;
|
|
685
|
-
const o = n.toLowerCase(), s = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, {
|
|
686
|
-
acceptNode(l) {
|
|
687
|
-
const i = l.parentElement;
|
|
688
|
-
return !i || i.closest("mark") || /^(SCRIPT|STYLE)$/.test(i.tagName) ? NodeFilter.FILTER_REJECT : (l.nodeValue ?? "").toLowerCase().includes(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
|
|
689
|
-
}
|
|
690
|
-
}), a = [];
|
|
691
|
-
for (let l = s.nextNode(); l; l = s.nextNode()) a.push(l);
|
|
692
|
-
let r = 0;
|
|
693
|
-
for (const l of a) {
|
|
694
|
-
const i = l.nodeValue ?? "", m = i.toLowerCase(), v = l.parentElement;
|
|
695
|
-
if (!v) continue;
|
|
696
|
-
const d = document.createDocumentFragment();
|
|
697
|
-
let g = 0, I = m.indexOf(o);
|
|
698
|
-
for (; I >= 0; ) {
|
|
699
|
-
I > g && d.appendChild(document.createTextNode(i.slice(g, I)));
|
|
700
|
-
const k = document.createElement("mark");
|
|
701
|
-
k.className = ea, k.textContent = i.slice(I, I + n.length), d.appendChild(k), r++, g = I + n.length, I = m.indexOf(o, g);
|
|
702
|
-
}
|
|
703
|
-
g < i.length && d.appendChild(document.createTextNode(i.slice(g))), v.replaceChild(d, l);
|
|
704
|
-
}
|
|
705
|
-
return r;
|
|
706
|
-
}
|
|
707
|
-
const Ao = /* @__PURE__ */ new Set(["line", "rect", "ellipse", "chart"]);
|
|
708
|
-
function* Fo(e) {
|
|
709
|
-
for (const t of e.cells ?? [])
|
|
710
|
-
for (const n of t ?? [])
|
|
711
|
-
yield n?.text ?? "", yield* n?.children ?? [];
|
|
712
|
-
}
|
|
713
|
-
function* zo(e) {
|
|
714
|
-
if (bo(e))
|
|
715
|
-
for (const t of e.richParagraphs)
|
|
716
|
-
for (const n of t.segments ?? [])
|
|
717
|
-
yield (n.kind === "field" ? n.field : n.text) ?? "";
|
|
718
|
-
else e.lines?.length ? yield* e.lines : yield e.text ?? "";
|
|
719
|
-
}
|
|
720
|
-
function* Lo(e) {
|
|
721
|
-
const t = [e.values()];
|
|
722
|
-
for (; t.length > 0; ) {
|
|
723
|
-
const n = t[t.length - 1].next();
|
|
724
|
-
if (n.done) {
|
|
725
|
-
t.pop();
|
|
726
|
-
continue;
|
|
727
|
-
}
|
|
728
|
-
const o = n.value;
|
|
729
|
-
if (typeof o == "string") {
|
|
730
|
-
yield o;
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
yield "", !ho(o) && (o.kind === "text" ? t.push(zo(o)) : o.grid ? t.push(Fo(o.grid)) : Ao.has(o.kind) || (yield o.fallbackText ?? ""));
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
function* No(e) {
|
|
737
|
-
for (let t = 0; t < e.pages.length; t++) {
|
|
738
|
-
for (const n of Lo(e.pages[t].components)) yield { text: n, pageIndex: t };
|
|
739
|
-
yield { text: "", pageIndex: t };
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
function qo(e, t) {
|
|
743
|
-
const n = e.toLowerCase();
|
|
744
|
-
let o = 0;
|
|
745
|
-
for (let s = n.indexOf(t); s >= 0; s = n.indexOf(t, s + t.length)) o++;
|
|
746
|
-
return o;
|
|
747
|
-
}
|
|
748
|
-
function Ko(e) {
|
|
749
|
-
const { plan: t, gotoPage: n, highlight: o, clearHighlights: s } = e, a = G(!1), r = G(""), l = G(0), i = G(0), m = G(!1);
|
|
750
|
-
let v = [];
|
|
751
|
-
const d = D(() => {
|
|
752
|
-
if (i.value === 0) return null;
|
|
753
|
-
const z = l.value;
|
|
754
|
-
let F = 0, B = v.length - 1;
|
|
755
|
-
for (; F < B; ) {
|
|
756
|
-
const _ = F + B >>> 1;
|
|
757
|
-
v[_].cumulative <= z ? F = _ + 1 : B = _;
|
|
758
|
-
}
|
|
759
|
-
const V = v[F];
|
|
760
|
-
return V ? { pageIndex: V.pageIndex, occurrence: z - (v[F - 1]?.cumulative ?? 0) } : null;
|
|
761
|
-
});
|
|
762
|
-
let g = null, I = null, k = 0;
|
|
763
|
-
function b() {
|
|
764
|
-
k++, g && clearTimeout(g), I && clearTimeout(I), g = I = null, m.value = !1;
|
|
765
|
-
}
|
|
766
|
-
function f(z) {
|
|
767
|
-
r.value = z, l.value = 0, i.value = 0, v = [], m.value = !1;
|
|
768
|
-
const F = z.trim().toLowerCase(), B = t.value;
|
|
769
|
-
if (!F || !B) return;
|
|
770
|
-
m.value = !0;
|
|
771
|
-
const V = k, _ = No(B), Z = [];
|
|
772
|
-
let ne = 0;
|
|
773
|
-
function ce() {
|
|
774
|
-
if (I = null, V !== k || B !== t.value) return;
|
|
775
|
-
const Re = performance.now();
|
|
776
|
-
let ge = 0;
|
|
777
|
-
for (; ge < 5e3 && performance.now() - Re < 4; ) {
|
|
778
|
-
const C = _.next();
|
|
779
|
-
if (C.done) {
|
|
780
|
-
v = Z, i.value = ne, m.value = !1, v[0] && n(v[0].pageIndex + 1);
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
const O = qo(C.value.text, F);
|
|
784
|
-
if (O > 0) {
|
|
785
|
-
ne += O;
|
|
786
|
-
const w = Z[Z.length - 1];
|
|
787
|
-
w?.pageIndex === C.value.pageIndex ? w.cumulative = ne : Z.push({ pageIndex: C.value.pageIndex, cumulative: ne });
|
|
788
|
-
}
|
|
789
|
-
ge++;
|
|
790
|
-
}
|
|
791
|
-
I = setTimeout(ce, 0);
|
|
792
|
-
}
|
|
793
|
-
ce();
|
|
794
|
-
}
|
|
795
|
-
function R(z) {
|
|
796
|
-
if (b(), r.value = z, l.value = i.value = 0, v = [], !z.trim()) {
|
|
797
|
-
f("");
|
|
798
|
-
return;
|
|
799
|
-
}
|
|
800
|
-
m.value = !0, g = setTimeout(() => {
|
|
801
|
-
g = null, f(z);
|
|
802
|
-
}, Math.max(0, c(e.debounceMs) ?? 200));
|
|
803
|
-
}
|
|
804
|
-
function p(z) {
|
|
805
|
-
const F = i.value;
|
|
806
|
-
if (F === 0 || m.value) return;
|
|
807
|
-
l.value = (l.value + z + F) % F;
|
|
808
|
-
const B = d.value;
|
|
809
|
-
B && n(B.pageIndex + 1);
|
|
810
|
-
}
|
|
811
|
-
function S() {
|
|
812
|
-
b(), r.value = "", l.value = i.value = 0, v = [];
|
|
813
|
-
}
|
|
814
|
-
return de(t, S, { flush: "sync" }), Ue(S), {
|
|
815
|
-
visible: a,
|
|
816
|
-
query: r,
|
|
817
|
-
matchIndex: l,
|
|
818
|
-
matchCount: i,
|
|
819
|
-
activeMatch: d,
|
|
820
|
-
searching: m,
|
|
821
|
-
toggle: () => {
|
|
822
|
-
a.value = !a.value;
|
|
823
|
-
},
|
|
824
|
-
onInput: R,
|
|
825
|
-
onNav: p,
|
|
826
|
-
apply: (z) => {
|
|
827
|
-
r.value.trim() && o(z, r.value.trim());
|
|
828
|
-
},
|
|
829
|
-
clear: (z) => {
|
|
830
|
-
s(z);
|
|
831
|
-
},
|
|
832
|
-
reset: S
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
function Bo(e, t) {
|
|
836
|
-
const n = D(() => {
|
|
837
|
-
if (e.value) return !0;
|
|
838
|
-
if (typeof location > "u") return !1;
|
|
839
|
-
try {
|
|
840
|
-
return new URLSearchParams(location.search).get("mrp-debug") === "1";
|
|
841
|
-
} catch {
|
|
842
|
-
return !1;
|
|
843
|
-
}
|
|
844
|
-
}), o = D(() => !n.value || !t.plan.value ? 0 : Math.round(JSON.stringify(t.plan.value).length / 1024)), s = D(() => !n.value || !t.plan.value ? null : {
|
|
845
|
-
pages: t.pageCount.value,
|
|
846
|
-
window: `${t.windowRange.value.start}-${t.windowRange.value.end}`,
|
|
847
|
-
zoom: `${Math.round(t.zoom.value * 100)}%`,
|
|
848
|
-
loadMs: `${t.loadMs.value}ms`,
|
|
849
|
-
planKB: o.value
|
|
850
|
-
});
|
|
851
|
-
return { enabled: n, debugStats: s };
|
|
852
|
-
}
|
|
853
|
-
function jo(e, t) {
|
|
854
|
-
const { thumbsRoot: n, visible: o, renderThumbCanvas: s } = t, a = G(0), r = G(800), l = D(() => (e.value?.pages ?? []).map(
|
|
855
|
-
(p) => Math.round(p.pageHeightMm / p.pageWidthMm * 116)
|
|
856
|
-
)), i = D(() => Jn(l.value.map((p) => p + 20), 8)), m = D(() => i.value.window(r.value, a.value, 1)), v = D(() => {
|
|
857
|
-
if (!o.value) return [];
|
|
858
|
-
const { start: p, end: S } = m.value;
|
|
859
|
-
return l.value.slice(p, S + 1).map((z, F) => ({ index: p + F, height: z }));
|
|
860
|
-
});
|
|
861
|
-
let d = 0, g = 0, I = !1;
|
|
862
|
-
function k() {
|
|
863
|
-
const p = n.value;
|
|
864
|
-
p && (a.value = p.scrollTop, r.value = p.clientHeight || 800);
|
|
865
|
-
}
|
|
866
|
-
function b() {
|
|
867
|
-
I || g || (g = requestAnimationFrame(() => {
|
|
868
|
-
g = 0, k();
|
|
869
|
-
}));
|
|
870
|
-
}
|
|
871
|
-
function f() {
|
|
872
|
-
if (v.value, d && cancelAnimationFrame(d), d = 0, I || !o.value || !e.value || !n.value) return;
|
|
873
|
-
k();
|
|
874
|
-
const p = v.value, S = e.value, z = n.value;
|
|
875
|
-
let F = 0;
|
|
876
|
-
function B() {
|
|
877
|
-
if (d = 0, !(I || !o.value || e.value !== S || n.value !== z)) {
|
|
878
|
-
for (let V = 0; F < p.length && V < 2; V++, F++) {
|
|
879
|
-
const _ = p[F].index, Z = z.querySelector(`[data-thumb="${_ + 1}"]`);
|
|
880
|
-
if (!Z || Z.childElementCount > 0) continue;
|
|
881
|
-
const ne = s(_);
|
|
882
|
-
ne && (ne.style.width = "100%", ne.style.height = "100%", ne.style.display = "block", Z.appendChild(ne));
|
|
883
|
-
}
|
|
884
|
-
F < p.length && (d = requestAnimationFrame(B));
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
d = requestAnimationFrame(B);
|
|
888
|
-
}
|
|
889
|
-
function R() {
|
|
890
|
-
I = !0, d && cancelAnimationFrame(d), g && cancelAnimationFrame(g), d = g = 0;
|
|
891
|
-
}
|
|
892
|
-
return Ue(R), { schedule: f, destroy: R, onScroll: b, windowRange: m, visibleThumbs: v };
|
|
893
|
-
}
|
|
894
|
-
function Ho() {
|
|
895
|
-
const e = fe(0);
|
|
896
|
-
return {
|
|
897
|
-
loadMs: e,
|
|
898
|
-
start() {
|
|
899
|
-
return typeof performance < "u" ? performance.now() : 0;
|
|
900
|
-
},
|
|
901
|
-
end(t) {
|
|
902
|
-
e.value = t ? Math.round(performance.now() - t) : 0;
|
|
903
|
-
}
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
function Wo(e) {
|
|
907
|
-
const t = G(null), n = G(null);
|
|
908
|
-
function o() {
|
|
909
|
-
t.value?.focus(), t.value?.select();
|
|
910
|
-
}
|
|
911
|
-
de(e.visible, (r) => {
|
|
912
|
-
r && We(o);
|
|
913
|
-
});
|
|
914
|
-
function s() {
|
|
915
|
-
e.close(), We(() => n.value?.focus());
|
|
916
|
-
}
|
|
917
|
-
function a(r) {
|
|
918
|
-
r.isComposing || r.keyCode === 229 || r.key !== "Enter" && r.key !== "Escape" || (r.preventDefault(), r.stopPropagation(), r.key === "Escape" ? s() : e.navigate(r.shiftKey ? -1 : 1));
|
|
919
|
-
}
|
|
920
|
-
return { input: t, toggle: n, focus: o, close: s, onKeydown: a };
|
|
921
|
-
}
|
|
922
|
-
function ta() {
|
|
923
|
-
const e = G(!1), t = G(null), n = G(null), o = G(null);
|
|
924
|
-
function s(l = !1) {
|
|
925
|
-
e.value = !1, l && We(() => n.value?.focus());
|
|
926
|
-
}
|
|
927
|
-
function a(l) {
|
|
928
|
-
l.target instanceof Node && !t.value?.contains(l.target) && s();
|
|
929
|
-
}
|
|
930
|
-
function r(l) {
|
|
931
|
-
l.key !== "Escape" || !e.value || l.isComposing || (l.preventDefault(), l.stopPropagation(), s(!0));
|
|
932
|
-
}
|
|
933
|
-
return de(e, (l) => {
|
|
934
|
-
l && We(() => (o.value?.querySelector("input") ?? o.value?.querySelector("button:not(:disabled)"))?.focus());
|
|
935
|
-
}), St(() => {
|
|
936
|
-
document.addEventListener("pointerdown", a), document.addEventListener("focusin", a);
|
|
937
|
-
}), Ka(() => {
|
|
938
|
-
document.removeEventListener("pointerdown", a), document.removeEventListener("focusin", a);
|
|
939
|
-
}), { opened: e, root: t, trigger: n, panel: o, close: s, onKeydown: r };
|
|
940
|
-
}
|
|
941
|
-
const Uo = ["disabled", "aria-expanded"], Vo = ["aria-label"], Jo = ["aria-label", "disabled", "onClick"], Go = { "aria-hidden": "true" }, Yo = /* @__PURE__ */ we({
|
|
942
|
-
__name: "ReportExportMenu",
|
|
943
|
-
props: {
|
|
944
|
-
messages: {},
|
|
945
|
-
formats: {},
|
|
946
|
-
busy: { type: Boolean }
|
|
947
|
-
},
|
|
948
|
-
emits: ["export"],
|
|
949
|
-
setup(e, { emit: t }) {
|
|
950
|
-
const n = e, o = t, { opened: s, root: a, trigger: r, panel: l, close: i, onKeydown: m } = ta(), v = D(() => [
|
|
951
|
-
{ format: "xlsx", label: n.messages.exportExcel, extension: ".xlsx" },
|
|
952
|
-
{ format: "pdf", label: n.messages.exportPdf, extension: ".pdf" },
|
|
953
|
-
{ format: "png", label: n.messages.exportImage, extension: ".png" },
|
|
954
|
-
{ format: "word", label: n.messages.exportWord, extension: ".doc" },
|
|
955
|
-
{ format: "html", label: n.messages.exportHtml, extension: ".html" }
|
|
956
|
-
].filter((k) => !n.formats || n.formats.includes(k.format)));
|
|
957
|
-
de(() => n.busy, (k) => {
|
|
958
|
-
k && i();
|
|
959
|
-
});
|
|
960
|
-
function d(k) {
|
|
961
|
-
n.busy || (o("export", k), i(!0));
|
|
962
|
-
}
|
|
963
|
-
function g(k) {
|
|
964
|
-
k.key !== "ArrowDown" && k.key !== "ArrowUp" || (k.preventDefault(), s.value = !0, k.key === "ArrowUp" && We(() => l.value?.querySelector("button:last-child")?.focus()));
|
|
965
|
-
}
|
|
966
|
-
function I(k) {
|
|
967
|
-
if (k.key === "Tab") {
|
|
968
|
-
i();
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(k.key)) return;
|
|
972
|
-
k.preventDefault(), k.stopPropagation();
|
|
973
|
-
const f = [...l.value?.querySelectorAll("button:not(:disabled)") ?? []], R = f.indexOf(document.activeElement), p = k.key === "Home" ? 0 : k.key === "End" ? f.length - 1 : (R + (k.key === "ArrowDown" ? 1 : -1) + f.length) % f.length;
|
|
974
|
-
f[p]?.focus();
|
|
975
|
-
}
|
|
976
|
-
return (k, b) => v.value.length ? (x(), P("div", {
|
|
977
|
-
key: 0,
|
|
978
|
-
ref_key: "root",
|
|
979
|
-
ref: a,
|
|
980
|
-
class: "mrp-export-menu",
|
|
981
|
-
onKeydown: b[1] || (b[1] = //@ts-ignore
|
|
982
|
-
(...f) => c(m) && c(m)(...f))
|
|
983
|
-
}, [
|
|
984
|
-
h("button", {
|
|
985
|
-
ref_key: "trigger",
|
|
986
|
-
ref: r,
|
|
987
|
-
type: "button",
|
|
988
|
-
class: "mrp-nav mrp-export-trigger",
|
|
989
|
-
disabled: e.busy,
|
|
990
|
-
"aria-haspopup": "menu",
|
|
991
|
-
"aria-expanded": c(s),
|
|
992
|
-
onClick: b[0] || (b[0] = (f) => s.value = !c(s)),
|
|
993
|
-
onKeydown: g
|
|
994
|
-
}, [
|
|
995
|
-
ee(ae, { name: "download" }),
|
|
996
|
-
ie(y(e.messages.exportMenu ?? "导出"), 1),
|
|
997
|
-
ee(ae, {
|
|
998
|
-
name: "chevron-down",
|
|
999
|
-
size: 12
|
|
1000
|
-
})
|
|
1001
|
-
], 40, Uo),
|
|
1002
|
-
c(s) ? (x(), P("div", {
|
|
1003
|
-
key: 0,
|
|
1004
|
-
ref_key: "panel",
|
|
1005
|
-
ref: l,
|
|
1006
|
-
class: "mrp-export-panel",
|
|
1007
|
-
role: "menu",
|
|
1008
|
-
"aria-label": e.messages.exportMenu ?? "导出",
|
|
1009
|
-
onKeydown: I
|
|
1010
|
-
}, [
|
|
1011
|
-
h("p", null, y(e.messages.exportMenuDescription ?? "选择文件格式"), 1),
|
|
1012
|
-
(x(!0), P(he, null, be(v.value, (f) => (x(), P("button", {
|
|
1013
|
-
key: f.format,
|
|
1014
|
-
type: "button",
|
|
1015
|
-
role: "menuitem",
|
|
1016
|
-
tabindex: "-1",
|
|
1017
|
-
"aria-label": f.label,
|
|
1018
|
-
disabled: e.busy,
|
|
1019
|
-
onClick: (R) => d(f.format)
|
|
1020
|
-
}, [
|
|
1021
|
-
ee(ae, { name: "file" }),
|
|
1022
|
-
h("span", null, y(f.label), 1),
|
|
1023
|
-
h("small", Go, y(f.extension), 1)
|
|
1024
|
-
], 8, Jo))), 128))
|
|
1025
|
-
], 40, Vo)) : q("", !0)
|
|
1026
|
-
], 544)) : q("", !0);
|
|
1027
|
-
}
|
|
1028
|
-
}), Zo = /* @__PURE__ */ xe(Yo, [["__scopeId", "data-v-83a57a3c"]]), Xo = ["aria-label"], Qo = {
|
|
1029
|
-
class: "mrp-pageinfo",
|
|
1030
|
-
"aria-live": "polite"
|
|
1031
|
-
}, _o = { class: "mrp-page-buttons" }, es = ["aria-label", "title", "disabled"], ts = ["aria-label", "title", "disabled"], ns = ["aria-label", "title", "aria-invalid", "disabled"], as = ["aria-label", "disabled"], os = {
|
|
1032
|
-
key: 1,
|
|
1033
|
-
class: "mrp-page-error",
|
|
1034
|
-
role: "alert"
|
|
1035
|
-
}, ss = /* @__PURE__ */ we({
|
|
1036
|
-
__name: "ReportPagination",
|
|
1037
|
-
props: {
|
|
1038
|
-
pageCount: {},
|
|
1039
|
-
currentPage: {},
|
|
1040
|
-
messages: {},
|
|
1041
|
-
busy: { type: Boolean }
|
|
1042
|
-
},
|
|
1043
|
-
emits: ["goto"],
|
|
1044
|
-
setup(e, { emit: t }) {
|
|
1045
|
-
const n = e, o = t, s = G(String(n.currentPage)), a = G(!1), r = D(() => n.messages.pageInfo.replace("{cur}", String(n.currentPage)).replace("{total}", String(n.pageCount)));
|
|
1046
|
-
de(() => [n.currentPage, n.pageCount], () => {
|
|
1047
|
-
s.value = String(n.currentPage), a.value = !1;
|
|
1048
|
-
});
|
|
1049
|
-
function l() {
|
|
1050
|
-
if (n.busy) return;
|
|
1051
|
-
const i = s.value.trim(), m = Number(i);
|
|
1052
|
-
a.value = !/^\d+$/.test(i) || !Number.isSafeInteger(m) || m < 1 || m > n.pageCount, !a.value && m !== n.currentPage && o("goto", m);
|
|
1053
|
-
}
|
|
1054
|
-
return (i, m) => e.pageCount > 0 ? (x(), P("nav", {
|
|
1055
|
-
key: 0,
|
|
1056
|
-
class: "mrp-pagination",
|
|
1057
|
-
role: "navigation",
|
|
1058
|
-
"aria-label": e.messages.pagination ?? "报表分页"
|
|
1059
|
-
}, [
|
|
1060
|
-
h("span", Qo, y(r.value), 1),
|
|
1061
|
-
h("div", _o, [
|
|
1062
|
-
h("button", {
|
|
1063
|
-
class: "mrp-nav",
|
|
1064
|
-
type: "button",
|
|
1065
|
-
"aria-label": e.messages.prevPage,
|
|
1066
|
-
title: e.messages.prevPage,
|
|
1067
|
-
disabled: e.busy || e.currentPage <= 1,
|
|
1068
|
-
onClick: m[0] || (m[0] = (v) => o("goto", e.currentPage - 1))
|
|
1069
|
-
}, [
|
|
1070
|
-
ee(ae, { name: "chevron-left" })
|
|
1071
|
-
], 8, es),
|
|
1072
|
-
h("button", {
|
|
1073
|
-
class: "mrp-nav",
|
|
1074
|
-
type: "button",
|
|
1075
|
-
"aria-label": e.messages.nextPage,
|
|
1076
|
-
title: e.messages.nextPage,
|
|
1077
|
-
disabled: e.busy || e.currentPage >= e.pageCount,
|
|
1078
|
-
onClick: m[1] || (m[1] = (v) => o("goto", e.currentPage + 1))
|
|
1079
|
-
}, [
|
|
1080
|
-
ee(ae, { name: "chevron-right" })
|
|
1081
|
-
], 8, ts)
|
|
1082
|
-
]),
|
|
1083
|
-
e.pageCount > 1 ? (x(), P("form", {
|
|
1084
|
-
key: 0,
|
|
1085
|
-
class: "mrp-page-jump",
|
|
1086
|
-
onSubmit: pt(l, ["prevent"])
|
|
1087
|
-
}, [
|
|
1088
|
-
h("label", null, [
|
|
1089
|
-
h("span", null, y(e.messages.pageJump ?? "跳至页"), 1),
|
|
1090
|
-
Rt(h("input", {
|
|
1091
|
-
"onUpdate:modelValue": m[2] || (m[2] = (v) => s.value = v),
|
|
1092
|
-
type: "text",
|
|
1093
|
-
inputmode: "numeric",
|
|
1094
|
-
autocomplete: "off",
|
|
1095
|
-
"aria-label": e.messages.pageJump ?? "跳至页",
|
|
1096
|
-
title: e.messages.pageJumpHint ?? "Enter 跳转",
|
|
1097
|
-
"aria-invalid": a.value,
|
|
1098
|
-
disabled: e.busy,
|
|
1099
|
-
onInput: m[3] || (m[3] = (v) => a.value = !1),
|
|
1100
|
-
onKeydown: m[4] || (m[4] = Ba((v) => {
|
|
1101
|
-
s.value = String(e.currentPage), a.value = !1;
|
|
1102
|
-
}, ["esc"]))
|
|
1103
|
-
}, null, 40, ns), [
|
|
1104
|
-
[Mt, s.value]
|
|
1105
|
-
])
|
|
1106
|
-
]),
|
|
1107
|
-
h("button", {
|
|
1108
|
-
class: "mrp-nav",
|
|
1109
|
-
type: "submit",
|
|
1110
|
-
"aria-label": e.messages.pageJump ?? "跳至页",
|
|
1111
|
-
disabled: e.busy
|
|
1112
|
-
}, [
|
|
1113
|
-
ee(ae, {
|
|
1114
|
-
name: "arrow-right",
|
|
1115
|
-
size: 14
|
|
1116
|
-
})
|
|
1117
|
-
], 8, as)
|
|
1118
|
-
], 32)) : q("", !0),
|
|
1119
|
-
a.value ? (x(), P("span", os, y(e.messages.pageJumpInvalid ?? "请输入有效页码"), 1)) : q("", !0)
|
|
1120
|
-
], 8, Xo)) : q("", !0);
|
|
1121
|
-
}
|
|
1122
|
-
}), na = /* @__PURE__ */ xe(ss, [["__scopeId", "data-v-0db4fbd3"]]), rs = ["aria-label"], ls = { class: "mrp-title" }, is = ["aria-label"], us = ["aria-label", "aria-pressed"], cs = ["aria-pressed"], ds = ["aria-pressed"], fs = ["aria-label"], ms = ["aria-pressed"], gs = ["aria-pressed", "onClick"], vs = ["aria-label"], ps = ["disabled"], hs = ["disabled"], bs = ["disabled"], ys = ["aria-label", "aria-expanded"], ws = ["aria-label"], xs = ["placeholder", "aria-label", "value"], ks = ["aria-label"], $s = {
|
|
1123
|
-
key: 1,
|
|
1124
|
-
class: "mrp-search-count",
|
|
1125
|
-
role: "status",
|
|
1126
|
-
"aria-live": "polite"
|
|
1127
|
-
}, Cs = ["disabled", "aria-label"], Es = ["disabled", "aria-label"], Is = ["aria-label"], Ps = {
|
|
1128
|
-
class: "mrp-search-hint",
|
|
1129
|
-
role: "status"
|
|
1130
|
-
}, Ss = /* @__PURE__ */ we({
|
|
1131
|
-
__name: "ReportToolbar",
|
|
1132
|
-
props: {
|
|
1133
|
-
pageCount: {},
|
|
1134
|
-
currentPage: {},
|
|
1135
|
-
zoomMode: {},
|
|
1136
|
-
zoom: {},
|
|
1137
|
-
showExport: { type: Boolean },
|
|
1138
|
-
showPrint: { type: Boolean },
|
|
1139
|
-
showPdfWindow: { type: Boolean },
|
|
1140
|
-
messages: {},
|
|
1141
|
-
search: {},
|
|
1142
|
-
thumbsVisible: { type: Boolean },
|
|
1143
|
-
showImport: { type: Boolean },
|
|
1144
|
-
showSearch: { type: Boolean, default: !0 },
|
|
1145
|
-
showThumbnails: { type: Boolean, default: !0 },
|
|
1146
|
-
showZoom: { type: Boolean, default: !0 },
|
|
1147
|
-
exportFormats: { default: void 0 },
|
|
1148
|
-
showSettings: { type: Boolean },
|
|
1149
|
-
settingsOpen: { type: Boolean },
|
|
1150
|
-
busy: { type: Boolean },
|
|
1151
|
-
showPagination: { type: Boolean }
|
|
1152
|
-
},
|
|
1153
|
-
emits: ["goto", "zoom", "export", "print", "pdf-window", "search-input", "search-nav", "search-toggle", "thumbs-toggle", "import-excel", "settings-toggle"],
|
|
1154
|
-
setup(e, { expose: t, emit: n }) {
|
|
1155
|
-
const o = e, s = n, a = Wo({
|
|
1156
|
-
visible: () => o.search.visible,
|
|
1157
|
-
navigate: (v) => {
|
|
1158
|
-
!o.search.searching && o.search.matchCount > 0 && s("search-nav", v);
|
|
1159
|
-
},
|
|
1160
|
-
close: () => {
|
|
1161
|
-
o.search.visible && s("search-toggle");
|
|
1162
|
-
}
|
|
1163
|
-
}), { input: r, toggle: l } = a;
|
|
1164
|
-
t({ focusSearch: a.focus });
|
|
1165
|
-
function i() {
|
|
1166
|
-
const v = o.search.matchCount > 0 ? o.search.matchIndex + 1 : 0;
|
|
1167
|
-
return o.messages.matchInfo.replace("{cur}", String(v)).replace("{total}", String(o.search.matchCount));
|
|
1168
|
-
}
|
|
1169
|
-
function m() {
|
|
1170
|
-
s("search-input", ""), a.focus();
|
|
1171
|
-
}
|
|
1172
|
-
return (v, d) => (x(), P("div", {
|
|
1173
|
-
class: "mrp-toolbar",
|
|
1174
|
-
role: "toolbar",
|
|
1175
|
-
"aria-label": e.messages.title
|
|
1176
|
-
}, [
|
|
1177
|
-
h("span", ls, [
|
|
1178
|
-
ee(ae, { name: "file" }),
|
|
1179
|
-
ie(y(e.messages.title), 1)
|
|
1180
|
-
]),
|
|
1181
|
-
e.showPagination ? (x(), Se(na, {
|
|
1182
|
-
key: 0,
|
|
1183
|
-
"page-count": e.pageCount,
|
|
1184
|
-
"current-page": e.currentPage,
|
|
1185
|
-
messages: e.messages,
|
|
1186
|
-
busy: e.busy,
|
|
1187
|
-
onGoto: d[0] || (d[0] = (g) => s("goto", g))
|
|
1188
|
-
}, null, 8, ["page-count", "current-page", "messages", "busy"])) : q("", !0),
|
|
1189
|
-
d[15] || (d[15] = h("span", { class: "mrp-spacer" }, null, -1)),
|
|
1190
|
-
e.showSearch !== !1 ? (x(), P("div", {
|
|
1191
|
-
key: 1,
|
|
1192
|
-
class: "mrp-read-tools",
|
|
1193
|
-
role: "group",
|
|
1194
|
-
"aria-label": e.messages.search ?? "内容搜索"
|
|
1195
|
-
}, [
|
|
1196
|
-
h("button", {
|
|
1197
|
-
ref_key: "searchToggleRef",
|
|
1198
|
-
ref: l,
|
|
1199
|
-
class: $e(["mrp-nav mrp-search-toggle mrp-icon-button", { "mrp-active": e.search.visible }]),
|
|
1200
|
-
type: "button",
|
|
1201
|
-
title: "Ctrl+F",
|
|
1202
|
-
"aria-label": e.messages.search ?? e.messages.searchPlaceholder,
|
|
1203
|
-
"aria-pressed": e.search.visible,
|
|
1204
|
-
onClick: d[1] || (d[1] = (g) => s("search-toggle"))
|
|
1205
|
-
}, [
|
|
1206
|
-
ee(ae, { name: "search" })
|
|
1207
|
-
], 10, us),
|
|
1208
|
-
e.showThumbnails !== !1 ? (x(), P("button", {
|
|
1209
|
-
key: 0,
|
|
1210
|
-
class: $e(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
|
|
1211
|
-
type: "button",
|
|
1212
|
-
"aria-pressed": e.thumbsVisible,
|
|
1213
|
-
onClick: d[2] || (d[2] = (g) => s("thumbs-toggle"))
|
|
1214
|
-
}, [
|
|
1215
|
-
ee(ae, { name: "grid" }),
|
|
1216
|
-
ie(y(e.messages.thumbnails), 1)
|
|
1217
|
-
], 10, cs)) : q("", !0)
|
|
1218
|
-
], 8, is)) : e.showThumbnails !== !1 ? (x(), P("button", {
|
|
1219
|
-
key: 2,
|
|
1220
|
-
class: $e(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
|
|
1221
|
-
type: "button",
|
|
1222
|
-
"aria-pressed": e.thumbsVisible,
|
|
1223
|
-
onClick: d[3] || (d[3] = (g) => s("thumbs-toggle"))
|
|
1224
|
-
}, [
|
|
1225
|
-
ee(ae, { name: "grid" }),
|
|
1226
|
-
ie(y(e.messages.thumbnails), 1)
|
|
1227
|
-
], 10, ds)) : q("", !0),
|
|
1228
|
-
ht(v.$slots, "navigation", {}, void 0, !0),
|
|
1229
|
-
e.showZoom !== !1 ? (x(), P("div", {
|
|
1230
|
-
key: 3,
|
|
1231
|
-
class: "mrp-zoom-tools",
|
|
1232
|
-
role: "group",
|
|
1233
|
-
"aria-label": e.messages.zoom ?? "缩放工具"
|
|
1234
|
-
}, [
|
|
1235
|
-
h("button", {
|
|
1236
|
-
class: $e(["mrp-nav", { "mrp-active": e.zoomMode === "fit" }]),
|
|
1237
|
-
"aria-pressed": e.zoomMode === "fit",
|
|
1238
|
-
type: "button",
|
|
1239
|
-
onClick: d[4] || (d[4] = (g) => s("zoom", "fit"))
|
|
1240
|
-
}, [
|
|
1241
|
-
ee(ae, { name: "fit" }),
|
|
1242
|
-
ie(y(e.messages.fitWidth), 1)
|
|
1243
|
-
], 10, ms),
|
|
1244
|
-
(x(), P(he, null, be([100, 150], (g) => h("button", {
|
|
1245
|
-
key: g,
|
|
1246
|
-
class: $e(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === g }]),
|
|
1247
|
-
"aria-pressed": e.zoomMode === "raw" && Math.round(e.zoom * 100) === g,
|
|
1248
|
-
type: "button",
|
|
1249
|
-
onClick: (I) => s("zoom", g)
|
|
1250
|
-
}, y(g) + "%", 11, gs)), 64))
|
|
1251
|
-
], 8, fs)) : q("", !0),
|
|
1252
|
-
e.showImport || e.showExport || e.showPrint || e.showPdfWindow ? (x(), P("div", {
|
|
1253
|
-
key: 4,
|
|
1254
|
-
class: "mrp-output-tools",
|
|
1255
|
-
role: "group",
|
|
1256
|
-
"aria-label": e.messages.settingsExport ?? "导出与打印"
|
|
1257
|
-
}, [
|
|
1258
|
-
e.showImport ? (x(), P("button", {
|
|
1259
|
-
key: 0,
|
|
1260
|
-
class: "mrp-nav mrp-import-excel",
|
|
1261
|
-
type: "button",
|
|
1262
|
-
disabled: e.busy,
|
|
1263
|
-
onClick: d[5] || (d[5] = (g) => s("import-excel"))
|
|
1264
|
-
}, [
|
|
1265
|
-
ee(ae, { name: "upload" }),
|
|
1266
|
-
ie(y(e.messages.importExcel ?? "导入 Excel 模板"), 1)
|
|
1267
|
-
], 8, ps)) : q("", !0),
|
|
1268
|
-
e.showExport ? (x(), Se(Zo, {
|
|
1269
|
-
key: 1,
|
|
1270
|
-
messages: e.messages,
|
|
1271
|
-
formats: e.exportFormats,
|
|
1272
|
-
busy: e.busy,
|
|
1273
|
-
onExport: d[6] || (d[6] = (g) => s("export", g))
|
|
1274
|
-
}, null, 8, ["messages", "formats", "busy"])) : q("", !0),
|
|
1275
|
-
e.showPrint ? (x(), P("button", {
|
|
1276
|
-
key: 2,
|
|
1277
|
-
class: "mrp-nav",
|
|
1278
|
-
type: "button",
|
|
1279
|
-
disabled: e.busy,
|
|
1280
|
-
onClick: d[7] || (d[7] = (g) => s("print"))
|
|
1281
|
-
}, [
|
|
1282
|
-
ee(ae, { name: "print" }),
|
|
1283
|
-
ie(y(e.messages.print), 1)
|
|
1284
|
-
], 8, hs)) : q("", !0),
|
|
1285
|
-
e.showPdfWindow ? (x(), P("button", {
|
|
1286
|
-
key: 3,
|
|
1287
|
-
class: "mrp-nav",
|
|
1288
|
-
type: "button",
|
|
1289
|
-
disabled: e.busy,
|
|
1290
|
-
onClick: d[8] || (d[8] = (g) => s("pdf-window"))
|
|
1291
|
-
}, [
|
|
1292
|
-
ee(ae, { name: "external" }),
|
|
1293
|
-
ie(y(e.messages.pdfWindow), 1)
|
|
1294
|
-
], 8, bs)) : q("", !0)
|
|
1295
|
-
], 8, vs)) : q("", !0),
|
|
1296
|
-
e.showSettings ? (x(), P("button", {
|
|
1297
|
-
key: 5,
|
|
1298
|
-
class: $e(["mrp-nav mrp-settings-toggle", { "mrp-active": e.settingsOpen }]),
|
|
1299
|
-
type: "button",
|
|
1300
|
-
"aria-label": e.messages.settings ?? "设置",
|
|
1301
|
-
"aria-haspopup": "dialog",
|
|
1302
|
-
"aria-expanded": !!e.settingsOpen,
|
|
1303
|
-
onClick: d[9] || (d[9] = (g) => s("settings-toggle"))
|
|
1304
|
-
}, [
|
|
1305
|
-
ee(ae, { name: "settings" }),
|
|
1306
|
-
ie(y(e.messages.settings ?? "设置"), 1)
|
|
1307
|
-
], 10, ys)) : q("", !0),
|
|
1308
|
-
e.showSearch !== !1 && e.search.visible ? (x(), P("div", {
|
|
1309
|
-
key: 6,
|
|
1310
|
-
class: "mrp-search-panel",
|
|
1311
|
-
role: "search",
|
|
1312
|
-
"aria-label": e.messages.search ?? "内容搜索"
|
|
1313
|
-
}, [
|
|
1314
|
-
h("div", {
|
|
1315
|
-
class: $e(["mrp-search", { "mrp-search-no-results": e.search.query && !e.search.searching && !e.search.matchCount }])
|
|
1316
|
-
}, [
|
|
1317
|
-
ee(ae, { name: "search" }),
|
|
1318
|
-
h("input", {
|
|
1319
|
-
ref_key: "searchInputRef",
|
|
1320
|
-
ref: r,
|
|
1321
|
-
class: "mrp-search-input",
|
|
1322
|
-
type: "text",
|
|
1323
|
-
autocomplete: "off",
|
|
1324
|
-
spellcheck: "false",
|
|
1325
|
-
placeholder: e.messages.searchPlaceholder,
|
|
1326
|
-
"aria-label": e.messages.search ?? e.messages.searchPlaceholder,
|
|
1327
|
-
value: e.search.query,
|
|
1328
|
-
onInput: d[10] || (d[10] = (g) => s("search-input", g.target.value)),
|
|
1329
|
-
onKeydown: d[11] || (d[11] = //@ts-ignore
|
|
1330
|
-
(...g) => c(a).onKeydown && c(a).onKeydown(...g))
|
|
1331
|
-
}, null, 40, xs),
|
|
1332
|
-
e.search.query ? (x(), P("button", {
|
|
1333
|
-
key: 0,
|
|
1334
|
-
class: "mrp-nav mrp-search-clear mrp-icon-button",
|
|
1335
|
-
type: "button",
|
|
1336
|
-
"aria-label": e.messages.clearSearch ?? "清除搜索",
|
|
1337
|
-
onClick: m
|
|
1338
|
-
}, [
|
|
1339
|
-
ee(ae, {
|
|
1340
|
-
name: "close",
|
|
1341
|
-
size: 13
|
|
1342
|
-
})
|
|
1343
|
-
], 8, ks)) : q("", !0),
|
|
1344
|
-
e.search.query ? (x(), P("span", $s, y(e.search.searching ? e.messages.searching ?? "搜索中…" : i()), 1)) : q("", !0),
|
|
1345
|
-
h("button", {
|
|
1346
|
-
class: "mrp-nav mrp-icon-button",
|
|
1347
|
-
type: "button",
|
|
1348
|
-
disabled: e.search.matchCount === 0 || e.search.searching,
|
|
1349
|
-
"aria-label": e.messages.prevSearchMatch ?? "上一个匹配",
|
|
1350
|
-
onClick: d[12] || (d[12] = (g) => s("search-nav", -1))
|
|
1351
|
-
}, [
|
|
1352
|
-
ee(ae, {
|
|
1353
|
-
name: "chevron-up",
|
|
1354
|
-
size: 14
|
|
1355
|
-
})
|
|
1356
|
-
], 8, Cs),
|
|
1357
|
-
h("button", {
|
|
1358
|
-
class: "mrp-nav mrp-icon-button",
|
|
1359
|
-
type: "button",
|
|
1360
|
-
disabled: e.search.matchCount === 0 || e.search.searching,
|
|
1361
|
-
"aria-label": e.messages.nextSearchMatch ?? "下一个匹配",
|
|
1362
|
-
onClick: d[13] || (d[13] = (g) => s("search-nav", 1))
|
|
1363
|
-
}, [
|
|
1364
|
-
ee(ae, {
|
|
1365
|
-
name: "chevron-down",
|
|
1366
|
-
size: 14
|
|
1367
|
-
})
|
|
1368
|
-
], 8, Es),
|
|
1369
|
-
h("button", {
|
|
1370
|
-
class: "mrp-nav mrp-search-close mrp-icon-button",
|
|
1371
|
-
type: "button",
|
|
1372
|
-
"aria-label": e.messages.closeSearch ?? "关闭搜索",
|
|
1373
|
-
onClick: d[14] || (d[14] = //@ts-ignore
|
|
1374
|
-
(...g) => c(a).close && c(a).close(...g))
|
|
1375
|
-
}, [
|
|
1376
|
-
ee(ae, {
|
|
1377
|
-
name: "close",
|
|
1378
|
-
size: 14
|
|
1379
|
-
})
|
|
1380
|
-
], 8, Is)
|
|
1381
|
-
], 2),
|
|
1382
|
-
h("span", Ps, y(e.search.query && !e.search.searching && !e.search.matchCount ? e.messages.searchNoMatches ?? "没有匹配内容" : e.messages.searchHint ?? "Enter 下一个 · Shift+Enter 上一个"), 1)
|
|
1383
|
-
], 8, ws)) : q("", !0)
|
|
1384
|
-
], 8, rs));
|
|
1385
|
-
}
|
|
1386
|
-
}), Rs = /* @__PURE__ */ xe(Ss, [["__scopeId", "data-v-5f4b04d8"]]);
|
|
1387
|
-
function Ms(e) {
|
|
1388
|
-
const t = e.meta?.record;
|
|
1389
|
-
if (!(!t || typeof t != "object" || typeof t.dataset != "string") && [t.rowIndex, t.copyIndex, t.templatePageIndex].every((n) => Number.isSafeInteger(n) && Number(n) >= 0) && !(t.rowKey !== void 0 && typeof t.rowKey != "string" && typeof t.rowKey != "number"))
|
|
1390
|
-
return t;
|
|
1391
|
-
}
|
|
1392
|
-
function Ts(e) {
|
|
1393
|
-
const t = [], n = [];
|
|
1394
|
-
let o;
|
|
1395
|
-
for (const [s, a] of (e?.pages ?? []).entries()) {
|
|
1396
|
-
const r = Ms(a);
|
|
1397
|
-
if (!r) {
|
|
1398
|
-
n.push(-1), o = void 0;
|
|
1399
|
-
continue;
|
|
1400
|
-
}
|
|
1401
|
-
(!o || r.dataset !== o.dataset || r.rowIndex !== o.rowIndex || r.rowKey !== o.rowKey || r.copyIndex === 0 && r.templatePageIndex === 0) && t.push({ page: s + 1, ...r.rowKey === void 0 ? {} : { rowKey: r.rowKey } }), n.push(t.length - 1), o = r;
|
|
1402
|
-
}
|
|
1403
|
-
return { entries: t, pageRecords: n };
|
|
1404
|
-
}
|
|
1405
|
-
const Os = ["aria-label"], Ds = {
|
|
1406
|
-
key: 0,
|
|
1407
|
-
class: "mrp-record-arrows"
|
|
1408
|
-
}, As = ["aria-label", "title", "disabled"], Fs = ["aria-label", "title", "disabled"], zs = {
|
|
1409
|
-
class: "mrp-record-info",
|
|
1410
|
-
"aria-live": "polite"
|
|
1411
|
-
}, Ls = ["title"], Ns = ["title"], qs = /* @__PURE__ */ we({
|
|
1412
|
-
__name: "ReportRecordNavigation",
|
|
1413
|
-
props: {
|
|
1414
|
-
plan: {},
|
|
1415
|
-
currentPage: {},
|
|
1416
|
-
messages: {},
|
|
1417
|
-
busy: { type: Boolean }
|
|
1418
|
-
},
|
|
1419
|
-
emits: ["goto"],
|
|
1420
|
-
setup(e, { emit: t }) {
|
|
1421
|
-
const n = e, o = t, s = D(() => Ts(n.plan)), a = D(() => s.value.pageRecords[n.currentPage - 1] ?? -1), r = D(() => a.value >= 0 ? s.value.entries[a.value] : void 0), l = D(() => (n.messages.recordInfo ?? "记录 {cur} / {total}").replace("{cur}", String(a.value + 1)).replace("{total}", String(s.value.entries.length))), i = D(() => {
|
|
1422
|
-
const v = n.plan?.pages[n.currentPage - 1]?.meta?.title;
|
|
1423
|
-
return typeof v == "string" ? v : "";
|
|
1424
|
-
});
|
|
1425
|
-
function m(v) {
|
|
1426
|
-
const d = s.value.entries[a.value + v];
|
|
1427
|
-
!n.busy && a.value >= 0 && d && o("goto", d.page);
|
|
1428
|
-
}
|
|
1429
|
-
return (v, d) => r.value ? (x(), P("nav", {
|
|
1430
|
-
key: 0,
|
|
1431
|
-
class: "mrp-record-navigation",
|
|
1432
|
-
"aria-label": e.messages.recordNavigation ?? "标签记录"
|
|
1433
|
-
}, [
|
|
1434
|
-
s.value.entries.length > 1 ? (x(), P("div", Ds, [
|
|
1435
|
-
h("button", {
|
|
1436
|
-
type: "button",
|
|
1437
|
-
"aria-label": e.messages.prevRecord ?? "上一条记录",
|
|
1438
|
-
title: e.messages.prevRecord ?? "上一条记录",
|
|
1439
|
-
disabled: e.busy || a.value <= 0,
|
|
1440
|
-
onClick: d[0] || (d[0] = (g) => m(-1))
|
|
1441
|
-
}, [
|
|
1442
|
-
ee(ae, {
|
|
1443
|
-
name: "chevron-left",
|
|
1444
|
-
size: 13
|
|
1445
|
-
})
|
|
1446
|
-
], 8, As),
|
|
1447
|
-
h("button", {
|
|
1448
|
-
type: "button",
|
|
1449
|
-
"aria-label": e.messages.nextRecord ?? "下一条记录",
|
|
1450
|
-
title: e.messages.nextRecord ?? "下一条记录",
|
|
1451
|
-
disabled: e.busy || a.value >= s.value.entries.length - 1,
|
|
1452
|
-
onClick: d[1] || (d[1] = (g) => m(1))
|
|
1453
|
-
}, [
|
|
1454
|
-
ee(ae, {
|
|
1455
|
-
name: "chevron-right",
|
|
1456
|
-
size: 13
|
|
1457
|
-
})
|
|
1458
|
-
], 8, Fs)
|
|
1459
|
-
])) : q("", !0),
|
|
1460
|
-
h("span", zs, y(l.value), 1),
|
|
1461
|
-
r.value.rowKey !== void 0 ? (x(), P("code", {
|
|
1462
|
-
key: 1,
|
|
1463
|
-
title: String(r.value.rowKey)
|
|
1464
|
-
}, y(r.value.rowKey), 9, Ls)) : q("", !0),
|
|
1465
|
-
i.value ? (x(), P("span", {
|
|
1466
|
-
key: 2,
|
|
1467
|
-
class: "mrp-record-face",
|
|
1468
|
-
title: i.value
|
|
1469
|
-
}, y(i.value), 9, Ns)) : q("", !0)
|
|
1470
|
-
], 8, Os)) : q("", !0);
|
|
1471
|
-
}
|
|
1472
|
-
}), Ks = /* @__PURE__ */ xe(qs, [["__scopeId", "data-v-aa94fa14"]]), Bs = ["aria-label", "aria-busy"], js = { class: "mrp-calculation-heading" }, Hs = { class: "mrp-calculation-controls" }, Ws = ["aria-label", "value", "disabled"], Us = ["value"], Vs = { class: "mrp-calculation-precision" }, Js = ["aria-label", "value", "disabled"], Gs = {
|
|
1473
|
-
key: 0,
|
|
1474
|
-
class: "mrp-calculation-expression"
|
|
1475
|
-
}, Ys = ["aria-label", "value", "disabled"], Zs = { class: "mrp-calculation-actions" }, Xs = {
|
|
1476
|
-
key: 1,
|
|
1477
|
-
class: "mrp-calculation-diagnostic",
|
|
1478
|
-
role: "alert"
|
|
1479
|
-
}, Qs = {
|
|
1480
|
-
key: 2,
|
|
1481
|
-
class: "mrp-calculation-result",
|
|
1482
|
-
role: "status",
|
|
1483
|
-
"aria-live": "polite"
|
|
1484
|
-
}, _s = { key: 0 }, er = {
|
|
1485
|
-
key: 3,
|
|
1486
|
-
class: "mrp-calculation-empty"
|
|
1487
|
-
}, tr = { class: "mrp-calculation-local" }, nr = /* @__PURE__ */ we({
|
|
1488
|
-
__name: "ReportCalculationPanel",
|
|
1489
|
-
props: {
|
|
1490
|
-
state: {},
|
|
1491
|
-
messages: {}
|
|
1492
|
-
},
|
|
1493
|
-
setup(e) {
|
|
1494
|
-
const t = e, n = `mrp-calculation-expression-hint-${rn()?.uid ?? 0}`, o = D(() => [
|
|
1495
|
-
["sum", t.messages.calculationSum],
|
|
1496
|
-
["average", t.messages.calculationAverage],
|
|
1497
|
-
["min", t.messages.calculationMin],
|
|
1498
|
-
["max", t.messages.calculationMax],
|
|
1499
|
-
["count", t.messages.calculationCount],
|
|
1500
|
-
["median", t.messages.calculationMedian],
|
|
1501
|
-
["expression", t.messages.calculationCustom]
|
|
1502
|
-
]), s = D(() => {
|
|
1503
|
-
const a = t.state.error.value;
|
|
1504
|
-
if (!a) return "";
|
|
1505
|
-
const r = t.messages;
|
|
1506
|
-
return { selection: r.calculationErrorSelection, limit: r.calculationErrorLimit, expression: r.calculationErrorExpression, division: r.calculationErrorDivision, overflow: r.calculationErrorOverflow, precision: r.calculationErrorPrecision }[a];
|
|
1507
|
-
});
|
|
1508
|
-
return (a, r) => (x(), P("section", {
|
|
1509
|
-
class: "mrp-calculation",
|
|
1510
|
-
"aria-label": e.messages.calculationTitle,
|
|
1511
|
-
"aria-busy": e.state.busy.value
|
|
1512
|
-
}, [
|
|
1513
|
-
h("header", js, [
|
|
1514
|
-
r[5] || (r[5] = h("span", {
|
|
1515
|
-
class: "mrp-calculation-symbol",
|
|
1516
|
-
"aria-hidden": "true"
|
|
1517
|
-
}, "∑", -1)),
|
|
1518
|
-
h("div", null, [
|
|
1519
|
-
h("strong", null, y(e.messages.calculationTitle), 1),
|
|
1520
|
-
h("p", null, y(e.messages.calculationHint), 1)
|
|
1521
|
-
])
|
|
1522
|
-
]),
|
|
1523
|
-
h("div", Hs, [
|
|
1524
|
-
h("label", null, [
|
|
1525
|
-
h("span", null, y(e.messages.calculationFormula), 1),
|
|
1526
|
-
h("select", {
|
|
1527
|
-
"aria-label": e.messages.calculationFormula,
|
|
1528
|
-
value: e.state.operation.value,
|
|
1529
|
-
onChange: r[0] || (r[0] = (l) => e.state.setOperation(l.target.value)),
|
|
1530
|
-
disabled: e.state.busy.value
|
|
1531
|
-
}, [
|
|
1532
|
-
(x(!0), P(he, null, be(o.value, ([l, i]) => (x(), P("option", {
|
|
1533
|
-
key: l,
|
|
1534
|
-
value: l
|
|
1535
|
-
}, y(i), 9, Us))), 128))
|
|
1536
|
-
], 40, Ws)
|
|
1537
|
-
]),
|
|
1538
|
-
h("label", Vs, [
|
|
1539
|
-
h("span", null, y(e.messages.calculationPrecision), 1),
|
|
1540
|
-
h("input", {
|
|
1541
|
-
"aria-label": e.messages.calculationPrecision,
|
|
1542
|
-
value: e.state.precision.value,
|
|
1543
|
-
onChange: r[1] || (r[1] = (l) => e.state.setPrecision(Number(l.target.value))),
|
|
1544
|
-
type: "number",
|
|
1545
|
-
min: "0",
|
|
1546
|
-
max: "12",
|
|
1547
|
-
step: "1",
|
|
1548
|
-
disabled: e.state.busy.value
|
|
1549
|
-
}, null, 40, Js)
|
|
1550
|
-
])
|
|
1551
|
-
]),
|
|
1552
|
-
e.state.operation.value === "expression" ? (x(), P("label", Gs, [
|
|
1553
|
-
h("span", null, y(e.messages.calculationExpression), 1),
|
|
1554
|
-
h("input", {
|
|
1555
|
-
"aria-label": e.messages.calculationExpression,
|
|
1556
|
-
"aria-describedby": n,
|
|
1557
|
-
value: e.state.expression.value,
|
|
1558
|
-
onInput: r[2] || (r[2] = (l) => e.state.setExpression(l.target.value)),
|
|
1559
|
-
type: "text",
|
|
1560
|
-
maxlength: "256",
|
|
1561
|
-
spellcheck: "false",
|
|
1562
|
-
disabled: e.state.busy.value,
|
|
1563
|
-
placeholder: "SUM / COUNT"
|
|
1564
|
-
}, null, 40, Ys),
|
|
1565
|
-
h("small", { id: n }, y(e.messages.calculationExpressionHint), 1)
|
|
1566
|
-
])) : q("", !0),
|
|
1567
|
-
h("div", Zs, [
|
|
1568
|
-
e.state.busy.value ? (x(), P("button", {
|
|
1569
|
-
key: 0,
|
|
1570
|
-
type: "button",
|
|
1571
|
-
onClick: r[3] || (r[3] = (l) => e.state.cancel())
|
|
1572
|
-
}, y(e.messages.calculationCancel), 1)) : (x(), P("button", {
|
|
1573
|
-
key: 1,
|
|
1574
|
-
class: "mrp-calculation-run",
|
|
1575
|
-
type: "button",
|
|
1576
|
-
onClick: r[4] || (r[4] = (l) => e.state.run())
|
|
1577
|
-
}, y(e.messages.calculationRun), 1))
|
|
1578
|
-
]),
|
|
1579
|
-
s.value ? (x(), P("p", Xs, y(s.value), 1)) : e.state.result.value ? (x(), P("div", Qs, [
|
|
1580
|
-
h("span", null, y(e.messages.calculationResult), 1),
|
|
1581
|
-
h("output", null, y(e.state.result.value.formatted), 1),
|
|
1582
|
-
h("small", null, [
|
|
1583
|
-
h("span", null, y(e.messages.calculationIncluded) + " " + y(e.state.result.value.numericCells), 1),
|
|
1584
|
-
h("span", null, y(e.messages.calculationExcluded) + " " + y(e.state.result.value.excludedCells), 1)
|
|
1585
|
-
]),
|
|
1586
|
-
e.state.result.value.numericCells === 0 ? (x(), P("p", _s, y(e.messages.calculationEmpty), 1)) : q("", !0)
|
|
1587
|
-
])) : (x(), P("p", er, y(e.messages.calculationNoSelection), 1)),
|
|
1588
|
-
h("p", tr, y(e.messages.calculationLocal), 1)
|
|
1589
|
-
], 8, Bs));
|
|
1590
|
-
}
|
|
1591
|
-
}), ar = /* @__PURE__ */ xe(nr, [["__scopeId", "data-v-ee359251"]]);
|
|
1592
|
-
function or(e) {
|
|
1593
|
-
const t = G("sum"), n = G("SUM / COUNT"), o = G(2), s = G(!1), a = fe(null), r = G(null);
|
|
1594
|
-
let l = null, i = 0;
|
|
1595
|
-
function m() {
|
|
1596
|
-
i++, l?.abort(), l = null, s.value = !1;
|
|
1597
|
-
}
|
|
1598
|
-
function v() {
|
|
1599
|
-
m(), a.value = null, r.value = null;
|
|
1600
|
-
}
|
|
1601
|
-
async function d() {
|
|
1602
|
-
if (v(), !e.enabled()) return;
|
|
1603
|
-
const b = e.plan.value, f = e.selection.value;
|
|
1604
|
-
if (!b || !f) {
|
|
1605
|
-
r.value = "selection";
|
|
1606
|
-
return;
|
|
1607
|
-
}
|
|
1608
|
-
const R = ++i, p = new AbortController();
|
|
1609
|
-
l = p, s.value = !0;
|
|
1610
|
-
try {
|
|
1611
|
-
const S = await Ja(b, f, { operation: t.value, expression: n.value, precision: o.value, signal: p.signal });
|
|
1612
|
-
R === i && e.plan.value === b && e.selection.value === f && e.enabled() && (a.value = S);
|
|
1613
|
-
} catch (S) {
|
|
1614
|
-
R === i && !p.signal.aborted && (r.value = S instanceof Ga ? S.code : "expression");
|
|
1615
|
-
} finally {
|
|
1616
|
-
R === i && (s.value = !1, l = null);
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
de([e.plan, e.selection, () => e.enabled(), t, n, o], v, { flush: "sync" }), Ue(v);
|
|
1620
|
-
function g(b) {
|
|
1621
|
-
t.value = b;
|
|
1622
|
-
}
|
|
1623
|
-
function I(b) {
|
|
1624
|
-
n.value = b;
|
|
1625
|
-
}
|
|
1626
|
-
function k(b) {
|
|
1627
|
-
o.value = b;
|
|
1628
|
-
}
|
|
1629
|
-
return { operation: t, expression: n, precision: o, busy: s, result: a, error: r, run: d, cancel: m, clear: v, setOperation: g, setExpression: I, setPrecision: k };
|
|
1630
|
-
}
|
|
1631
|
-
const sr = ["aria-label"], rr = { class: "mrp-settings-header" }, lr = ["aria-label"], ir = ["aria-label"], ur = ["id", "aria-selected", "aria-controls", "tabindex", "onClick", "onKeydown"], cr = { class: "mrp-settings-content" }, dr = ["id", "aria-labelledby", "hidden"], fr = { key: 0 }, mr = { class: "mrp-settings-option" }, gr = ["checked", "disabled"], vr = { class: "mrp-settings-option" }, pr = ["value", "disabled"], hr = ["id", "aria-labelledby", "hidden"], br = { key: 0 }, yr = ["checked", "disabled", "onChange"], wr = {
|
|
1632
|
-
key: 0,
|
|
1633
|
-
class: "mrp-settings-note"
|
|
1634
|
-
}, xr = {
|
|
1635
|
-
key: 1,
|
|
1636
|
-
class: "mrp-settings-note"
|
|
1637
|
-
}, kr = ["id", "aria-labelledby", "hidden"], $r = { class: "mrp-settings-intro" }, Cr = { class: "mrp-settings-option mrp-settings-feature" }, Er = ["id"], Ir = ["aria-label", "aria-describedby", "checked", "disabled"], Pr = ["disabled"], Sr = /* @__PURE__ */ we({
|
|
1638
|
-
__name: "ReportSettings",
|
|
1639
|
-
props: {
|
|
1640
|
-
available: {},
|
|
1641
|
-
enabled: {},
|
|
1642
|
-
messages: {},
|
|
1643
|
-
persistedEditing: { type: Boolean },
|
|
1644
|
-
busy: { type: Boolean },
|
|
1645
|
-
interaction: {},
|
|
1646
|
-
section: {}
|
|
1647
|
-
},
|
|
1648
|
-
emits: ["change", "reset", "close", "interaction", "section"],
|
|
1649
|
-
setup(e, { emit: t }) {
|
|
1650
|
-
const n = e, o = t, s = G(null), a = D(() => n.section ?? "general"), r = "mrp-settings-" + rn()?.uid, l = D(() => [
|
|
1651
|
-
{ key: "general", label: n.messages.settingsGeneral ?? "常规" },
|
|
1652
|
-
{ key: "tools", label: n.messages.settingsTools ?? "工具" },
|
|
1653
|
-
{ key: "advanced", label: n.messages.settingsAdvanced ?? "高级" }
|
|
1654
|
-
]);
|
|
1655
|
-
function i(b, f) {
|
|
1656
|
-
const p = { ArrowRight: (f + 1) % 3, ArrowLeft: (f + 2) % 3, Home: 0, End: 2 }[b.key];
|
|
1657
|
-
p !== void 0 && (b.preventDefault(), o("section", l.value[p].key), s.value?.querySelector("#" + r + "-tab-" + l.value[p].key)?.focus());
|
|
1658
|
-
}
|
|
1659
|
-
const m = G(null);
|
|
1660
|
-
let v = null;
|
|
1661
|
-
const d = D(() => [
|
|
1662
|
-
{ label: n.messages.settingsDisplay, tools: [
|
|
1663
|
-
["search", n.messages.search],
|
|
1664
|
-
["thumbnails", n.messages.thumbnails],
|
|
1665
|
-
["zoom", n.messages.zoom]
|
|
1666
|
-
] },
|
|
1667
|
-
{ label: n.messages.settingsExport, tools: [
|
|
1668
|
-
["html", n.messages.exportHtml],
|
|
1669
|
-
["pdf", n.messages.exportPdf],
|
|
1670
|
-
["xlsx", n.messages.exportExcel],
|
|
1671
|
-
["png", n.messages.exportImage],
|
|
1672
|
-
["word", n.messages.exportWord],
|
|
1673
|
-
["print", n.messages.print],
|
|
1674
|
-
["pdfWindow", n.messages.pdfWindow]
|
|
1675
|
-
] },
|
|
1676
|
-
{ label: n.messages.settingsData, tools: [
|
|
1677
|
-
["editing", n.messages.editCell],
|
|
1678
|
-
["import", n.messages.importExcel]
|
|
1679
|
-
] }
|
|
1680
|
-
].map((b) => ({ ...b, tools: b.tools.map(([f, R]) => ({ key: f, label: R })) })));
|
|
1681
|
-
function g(b, f) {
|
|
1682
|
-
const R = b.target, p = R.checked;
|
|
1683
|
-
R.checked = n.enabled[f], o("change", f, p);
|
|
1684
|
-
}
|
|
1685
|
-
function I(b) {
|
|
1686
|
-
return !s.value || b.defaultPrevented ? !1 : b.target instanceof Node && s.value.contains(b.target) ? !0 : b.target instanceof Element && b.target.closest('[role="dialog"],dialog[open]') ? !1 : !Array.from(document.querySelectorAll('[aria-modal="true"],dialog[open]')).some((f) => f !== s.value && !s.value.contains(f));
|
|
1687
|
-
}
|
|
1688
|
-
function k(b) {
|
|
1689
|
-
if (!I(b)) return;
|
|
1690
|
-
if (b.key === "Escape") {
|
|
1691
|
-
b.preventDefault(), b.stopPropagation(), o("close");
|
|
1692
|
-
return;
|
|
1693
|
-
}
|
|
1694
|
-
if (b.key !== "Tab") return;
|
|
1695
|
-
const f = Array.from(s.value?.querySelectorAll("a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex='0']") ?? []).filter((z) => !z.closest("[hidden]") && z.tabIndex !== -1), R = f?.[0], p = f?.[f.length - 1];
|
|
1696
|
-
(!s.value?.contains(document.activeElement) || b.shiftKey && document.activeElement === R || !b.shiftKey && document.activeElement === p) && (b.preventDefault(), b.stopPropagation(), (b.shiftKey ? p : R)?.focus());
|
|
1697
|
-
}
|
|
1698
|
-
return St(() => {
|
|
1699
|
-
const b = s.value?.closest(".mach-report-preview")?.querySelector(".mrp-settings-toggle"), f = document.activeElement;
|
|
1700
|
-
v = f instanceof HTMLElement && f !== document.body && !s.value?.contains(f) ? f : b ?? null, m.value?.focus(), document.addEventListener("keydown", k);
|
|
1701
|
-
}), ln(() => {
|
|
1702
|
-
document.removeEventListener("keydown", k), v?.isConnected && v.focus();
|
|
1703
|
-
}), (b, f) => (x(), P("div", {
|
|
1704
|
-
class: "mrp-settings-backdrop",
|
|
1705
|
-
onClick: f[5] || (f[5] = pt((R) => b.$emit("close"), ["self"]))
|
|
1706
|
-
}, [
|
|
1707
|
-
h("section", {
|
|
1708
|
-
ref_key: "panel",
|
|
1709
|
-
ref: s,
|
|
1710
|
-
class: "mrp-settings-panel",
|
|
1711
|
-
role: "dialog",
|
|
1712
|
-
"aria-modal": "true",
|
|
1713
|
-
"aria-label": e.messages.settings
|
|
1714
|
-
}, [
|
|
1715
|
-
h("header", rr, [
|
|
1716
|
-
h("div", null, [
|
|
1717
|
-
f[6] || (f[6] = h("span", { class: "mrp-settings-eyebrow" }, "MACH REPORT", -1)),
|
|
1718
|
-
h("strong", null, y(e.messages.settings), 1),
|
|
1719
|
-
h("p", null, y(e.messages.settingsLocal), 1)
|
|
1720
|
-
]),
|
|
1721
|
-
h("button", {
|
|
1722
|
-
ref_key: "closeButton",
|
|
1723
|
-
ref: m,
|
|
1724
|
-
class: "mrp-settings-close",
|
|
1725
|
-
type: "button",
|
|
1726
|
-
"aria-label": e.messages.settingsClose,
|
|
1727
|
-
onClick: f[0] || (f[0] = (R) => b.$emit("close"))
|
|
1728
|
-
}, [...f[7] || (f[7] = [
|
|
1729
|
-
h("svg", {
|
|
1730
|
-
width: "16",
|
|
1731
|
-
height: "16",
|
|
1732
|
-
viewBox: "0 0 20 20",
|
|
1733
|
-
fill: "none",
|
|
1734
|
-
"aria-hidden": "true"
|
|
1735
|
-
}, [
|
|
1736
|
-
h("path", {
|
|
1737
|
-
d: "m5 5 10 10M15 5 5 15",
|
|
1738
|
-
stroke: "currentColor",
|
|
1739
|
-
"stroke-width": "1.6",
|
|
1740
|
-
"stroke-linecap": "round"
|
|
1741
|
-
})
|
|
1742
|
-
], -1)
|
|
1743
|
-
])], 8, lr)
|
|
1744
|
-
]),
|
|
1745
|
-
h("div", {
|
|
1746
|
-
class: "mrp-settings-tabs",
|
|
1747
|
-
role: "tablist",
|
|
1748
|
-
"aria-label": e.messages.settings
|
|
1749
|
-
}, [
|
|
1750
|
-
(x(!0), P(he, null, be(l.value, (R, p) => (x(), P("button", {
|
|
1751
|
-
id: r + "-tab-" + R.key,
|
|
1752
|
-
key: R.key,
|
|
1753
|
-
type: "button",
|
|
1754
|
-
role: "tab",
|
|
1755
|
-
"aria-selected": a.value === R.key,
|
|
1756
|
-
"aria-controls": r + "-panel-" + R.key,
|
|
1757
|
-
tabindex: a.value === R.key ? 0 : -1,
|
|
1758
|
-
onClick: (S) => b.$emit("section", R.key),
|
|
1759
|
-
onKeydown: (S) => i(S, p)
|
|
1760
|
-
}, y(R.label), 41, ur))), 128))
|
|
1761
|
-
], 8, ir),
|
|
1762
|
-
h("div", cr, [
|
|
1763
|
-
h("section", {
|
|
1764
|
-
id: r + "-panel-general",
|
|
1765
|
-
role: "tabpanel",
|
|
1766
|
-
"aria-labelledby": r + "-tab-general",
|
|
1767
|
-
hidden: a.value !== "general"
|
|
1768
|
-
}, [
|
|
1769
|
-
ht(b.$slots, "default", {}, void 0, !0),
|
|
1770
|
-
e.interaction ? (x(), P("fieldset", fr, [
|
|
1771
|
-
h("legend", null, y(e.messages.settingsPanes), 1),
|
|
1772
|
-
h("label", mr, [
|
|
1773
|
-
h("span", null, y(e.messages.freezeHeaders), 1),
|
|
1774
|
-
h("input", {
|
|
1775
|
-
type: "checkbox",
|
|
1776
|
-
checked: e.interaction.freezeHeaders,
|
|
1777
|
-
disabled: e.busy,
|
|
1778
|
-
onChange: f[1] || (f[1] = (R) => b.$emit("interaction", { freezeHeaders: R.target.checked }))
|
|
1779
|
-
}, null, 40, gr)
|
|
1780
|
-
]),
|
|
1781
|
-
h("label", vr, [
|
|
1782
|
-
h("span", null, y(e.messages.frozenColumns), 1),
|
|
1783
|
-
h("input", {
|
|
1784
|
-
class: "mrp-frozen-count",
|
|
1785
|
-
type: "number",
|
|
1786
|
-
min: "0",
|
|
1787
|
-
max: "20",
|
|
1788
|
-
value: e.interaction.frozenColumns ?? 0,
|
|
1789
|
-
disabled: e.busy,
|
|
1790
|
-
onChange: f[2] || (f[2] = (R) => b.$emit("interaction", { frozenColumns: Math.max(0, Math.min(20, Number(R.target.value) || 0)) }))
|
|
1791
|
-
}, null, 40, pr)
|
|
1792
|
-
])
|
|
1793
|
-
])) : q("", !0)
|
|
1794
|
-
], 8, dr),
|
|
1795
|
-
h("section", {
|
|
1796
|
-
id: r + "-panel-tools",
|
|
1797
|
-
role: "tabpanel",
|
|
1798
|
-
"aria-labelledby": r + "-tab-tools",
|
|
1799
|
-
hidden: a.value !== "tools"
|
|
1800
|
-
}, [
|
|
1801
|
-
(x(!0), P(he, null, be(d.value, (R) => (x(), P("fieldset", {
|
|
1802
|
-
key: R.label
|
|
1803
|
-
}, [
|
|
1804
|
-
h("legend", null, y(R.label), 1),
|
|
1805
|
-
(x(!0), P(he, null, be(R.tools, (p) => (x(), P("label", {
|
|
1806
|
-
key: p.key,
|
|
1807
|
-
class: $e(["mrp-settings-option", { "mrp-settings-unavailable": !e.available[p.key] }])
|
|
1808
|
-
}, [
|
|
1809
|
-
h("span", null, [
|
|
1810
|
-
ie(y(p.label), 1),
|
|
1811
|
-
e.available[p.key] ? q("", !0) : (x(), P("small", br, y(e.messages.settingsUnavailable), 1))
|
|
1812
|
-
]),
|
|
1813
|
-
h("input", {
|
|
1814
|
-
type: "checkbox",
|
|
1815
|
-
checked: e.enabled[p.key],
|
|
1816
|
-
disabled: e.busy || !e.available[p.key],
|
|
1817
|
-
onChange: (S) => g(S, p.key)
|
|
1818
|
-
}, null, 40, yr)
|
|
1819
|
-
], 2))), 128))
|
|
1820
|
-
]))), 128)),
|
|
1821
|
-
e.available.editing ? (x(), P("p", wr, y(e.persistedEditing ? e.messages.editingSaved : e.messages.editingLocal), 1)) : q("", !0),
|
|
1822
|
-
e.available.import ? (x(), P("p", xr, y(e.messages.importLocal), 1)) : q("", !0)
|
|
1823
|
-
], 8, hr),
|
|
1824
|
-
h("section", {
|
|
1825
|
-
id: r + "-panel-advanced",
|
|
1826
|
-
role: "tabpanel",
|
|
1827
|
-
"aria-labelledby": r + "-tab-advanced",
|
|
1828
|
-
hidden: a.value !== "advanced"
|
|
1829
|
-
}, [
|
|
1830
|
-
h("p", $r, y(e.messages.settingsAdvancedDescription), 1),
|
|
1831
|
-
h("label", Cr, [
|
|
1832
|
-
h("span", null, [
|
|
1833
|
-
ie(y(e.messages.settingsCalculations), 1),
|
|
1834
|
-
h("small", {
|
|
1835
|
-
id: r + "-calculation-description"
|
|
1836
|
-
}, y(e.messages.settingsCalculationsDescription), 9, Er)
|
|
1837
|
-
]),
|
|
1838
|
-
h("input", {
|
|
1839
|
-
type: "checkbox",
|
|
1840
|
-
"aria-label": e.messages.settingsCalculations,
|
|
1841
|
-
"aria-describedby": r + "-calculation-description",
|
|
1842
|
-
checked: e.interaction?.calculations === !0,
|
|
1843
|
-
disabled: e.busy,
|
|
1844
|
-
onChange: f[3] || (f[3] = (R) => b.$emit("interaction", { calculations: R.target.checked }))
|
|
1845
|
-
}, null, 40, Ir)
|
|
1846
|
-
]),
|
|
1847
|
-
e.interaction?.calculations ? ht(b.$slots, "advanced", {}, void 0, !0, 0) : q("", !0)
|
|
1848
|
-
], 8, kr)
|
|
1849
|
-
]),
|
|
1850
|
-
h("footer", null, [
|
|
1851
|
-
h("button", {
|
|
1852
|
-
type: "button",
|
|
1853
|
-
disabled: e.busy,
|
|
1854
|
-
onClick: f[4] || (f[4] = (R) => b.$emit("reset"))
|
|
1855
|
-
}, y(e.messages.settingsReset), 9, Pr),
|
|
1856
|
-
h("span", null, y(e.messages.settingsLocal), 1)
|
|
1857
|
-
])
|
|
1858
|
-
], 8, sr)
|
|
1859
|
-
]));
|
|
1860
|
-
}
|
|
1861
|
-
}), Rr = /* @__PURE__ */ xe(Sr, [["__scopeId", "data-v-36723612"]]), Mr = {
|
|
1862
|
-
class: "mrp-empty",
|
|
1863
|
-
role: "status"
|
|
1864
|
-
}, Tr = { key: 0 }, Or = /* @__PURE__ */ we({
|
|
1865
|
-
__name: "ReportEmpty",
|
|
1866
|
-
props: {
|
|
1867
|
-
title: {},
|
|
1868
|
-
description: {}
|
|
1869
|
-
},
|
|
1870
|
-
setup(e) {
|
|
1871
|
-
return (t, n) => (x(), P("div", Mr, [
|
|
1872
|
-
n[0] || (n[0] = ja('<svg class="mrp-empty-art" viewBox="0 0 160 112" fill="none" aria-hidden="true" data-v-3e16b87e><ellipse cx="80" cy="100" rx="54" ry="7" fill="currentColor" opacity=".05" data-v-3e16b87e></ellipse><rect x="34" y="15" width="92" height="78" rx="9" fill="currentColor" opacity=".10" data-v-3e16b87e></rect><rect x="42" y="9" width="76" height="78" rx="7" fill="var(--mrp-toolbar-bg, #fff)" stroke="currentColor" stroke-opacity=".2" stroke-width="1.5" data-v-3e16b87e></rect><path d="M55 27H105M55 42H105M55 57H85M55 72H76M71 27V72M89 27V57" stroke="currentColor" stroke-opacity=".4" stroke-width="1.5" stroke-linecap="round" data-v-3e16b87e></path><circle cx="112" cy="76" r="16" fill="var(--mrp-toolbar-bg, #fff)" stroke="currentColor" stroke-opacity=".35" stroke-width="2" data-v-3e16b87e></circle><path d="M124 88L137 101M106 76H118" stroke="currentColor" stroke-opacity=".45" stroke-width="3" stroke-linecap="round" data-v-3e16b87e></path><circle cx="27" cy="38" r="3" fill="currentColor" opacity=".12" data-v-3e16b87e></circle><circle cx="132" cy="24" r="2" fill="currentColor" opacity=".2" data-v-3e16b87e></circle></svg>', 1)),
|
|
1873
|
-
h("strong", null, y(e.title), 1),
|
|
1874
|
-
e.description ? (x(), P("p", Tr, y(e.description), 1)) : q("", !0)
|
|
1875
|
-
]));
|
|
1876
|
-
}
|
|
1877
|
-
}), Kn = /* @__PURE__ */ xe(Or, [["__scopeId", "data-v-3e16b87e"]]), Dr = ["aria-label"], Ar = /* @__PURE__ */ we({
|
|
1878
|
-
__name: "ReportDiscardDialog",
|
|
1879
|
-
props: {
|
|
1880
|
-
messages: {}
|
|
1881
|
-
},
|
|
1882
|
-
emits: ["answer"],
|
|
1883
|
-
setup(e, { emit: t }) {
|
|
1884
|
-
const n = t, o = G(null), s = G(null);
|
|
1885
|
-
let a = null;
|
|
1886
|
-
function r(l) {
|
|
1887
|
-
l.key === "Escape" && (l.preventDefault(), n("answer", !1)), l.key === "Tab" && (l.preventDefault(), document.activeElement === o.value ? s.value?.focus() : o.value?.focus());
|
|
1888
|
-
}
|
|
1889
|
-
return St(() => {
|
|
1890
|
-
a = document.activeElement instanceof HTMLElement ? document.activeElement : null, o.value?.focus();
|
|
1891
|
-
}), ln(() => {
|
|
1892
|
-
a?.isConnected && a.focus();
|
|
1893
|
-
}), (l, i) => (x(), P("div", {
|
|
1894
|
-
class: "mrp-discard-backdrop",
|
|
1895
|
-
onKeydown: r,
|
|
1896
|
-
onClick: i[2] || (i[2] = pt((m) => n("answer", !1), ["self"]))
|
|
1897
|
-
}, [
|
|
1898
|
-
h("section", {
|
|
1899
|
-
class: "mrp-discard-dialog",
|
|
1900
|
-
role: "alertdialog",
|
|
1901
|
-
"aria-modal": "true",
|
|
1902
|
-
"aria-label": e.messages.discardTitle
|
|
1903
|
-
}, [
|
|
1904
|
-
h("strong", null, y(e.messages.discardTitle), 1),
|
|
1905
|
-
h("p", null, y(e.messages.discardDescription), 1),
|
|
1906
|
-
h("footer", null, [
|
|
1907
|
-
h("button", {
|
|
1908
|
-
ref_key: "keep",
|
|
1909
|
-
ref: o,
|
|
1910
|
-
type: "button",
|
|
1911
|
-
onClick: i[0] || (i[0] = (m) => n("answer", !1))
|
|
1912
|
-
}, y(e.messages.discardKeep), 513),
|
|
1913
|
-
h("button", {
|
|
1914
|
-
ref_key: "discard",
|
|
1915
|
-
ref: s,
|
|
1916
|
-
type: "button",
|
|
1917
|
-
onClick: i[1] || (i[1] = (m) => n("answer", !0))
|
|
1918
|
-
}, y(e.messages.discardProceed), 513)
|
|
1919
|
-
])
|
|
1920
|
-
], 8, Dr)
|
|
1921
|
-
], 32));
|
|
1922
|
-
}
|
|
1923
|
-
}), Fr = /* @__PURE__ */ xe(Ar, [["__scopeId", "data-v-f7590294"]]), zr = {
|
|
1924
|
-
key: 0,
|
|
1925
|
-
class: "mrp-task-status",
|
|
1926
|
-
role: "status",
|
|
1927
|
-
"aria-live": "polite"
|
|
1928
|
-
}, Lr = { key: 0 }, Nr = ["value", "max", "aria-label"], qr = /* @__PURE__ */ we({
|
|
1929
|
-
__name: "ReportTaskStatus",
|
|
1930
|
-
props: {
|
|
1931
|
-
task: {},
|
|
1932
|
-
messages: {}
|
|
1933
|
-
},
|
|
1934
|
-
emits: ["cancel"],
|
|
1935
|
-
setup(e) {
|
|
1936
|
-
const t = e, n = D(() => ({ query: t.messages.taskQuery, validate: t.messages.taskValidate, layout: t.messages.taskLayout, assets: t.messages.taskAssets, import: t.messages.importing, encode: t.messages.taskEncode, download: t.messages.taskDownload, print: t.messages.taskPrint })), o = D(() => t.task?.total === void 0 ? "" : `${t.task.completed ?? 0} / ${t.task.total}`);
|
|
1937
|
-
return (s, a) => e.task && (e.task.status === "running" || e.task.status === "cancelled") ? (x(), P("div", zr, [
|
|
1938
|
-
h("span", null, [
|
|
1939
|
-
ie(y(e.task.status === "cancelled" ? e.messages.taskCancelled : n.value[e.task.stage]) + " ", 1),
|
|
1940
|
-
e.task.status === "running" ? (x(), P("small", Lr, y(o.value), 1)) : q("", !0)
|
|
1941
|
-
]),
|
|
1942
|
-
e.task.status === "running" && e.task.total !== void 0 ? (x(), P("progress", {
|
|
1943
|
-
key: 0,
|
|
1944
|
-
value: e.task.completed ?? 0,
|
|
1945
|
-
max: e.task.total,
|
|
1946
|
-
"aria-label": n.value[e.task.stage]
|
|
1947
|
-
}, null, 8, Nr)) : q("", !0),
|
|
1948
|
-
e.task.status === "running" && e.task.cancellable ? (x(), P("button", {
|
|
1949
|
-
key: 1,
|
|
1950
|
-
type: "button",
|
|
1951
|
-
onClick: a[0] || (a[0] = (r) => s.$emit("cancel"))
|
|
1952
|
-
}, y(e.messages.taskCancel), 1)) : q("", !0)
|
|
1953
|
-
])) : q("", !0);
|
|
1954
|
-
}
|
|
1955
|
-
}), Kr = /* @__PURE__ */ xe(qr, [["__scopeId", "data-v-657ac599"]]), Br = {
|
|
1956
|
-
key: 0,
|
|
1957
|
-
class: "mrp-diagnostics"
|
|
1958
|
-
}, jr = ["aria-label", "placeholder"], Hr = { key: 0 }, Wr = ["onClick"], Ur = { key: 0 }, Vr = /* @__PURE__ */ we({
|
|
1959
|
-
__name: "ReportDiagnostics",
|
|
1960
|
-
props: {
|
|
1961
|
-
entries: {},
|
|
1962
|
-
messages: {}
|
|
1963
|
-
},
|
|
1964
|
-
emits: ["locate"],
|
|
1965
|
-
setup(e) {
|
|
1966
|
-
const t = e, n = G(""), o = D(() => ({
|
|
1967
|
-
"unsupported-style": t.messages.diagnosticUnsupportedStyle,
|
|
1968
|
-
"missing-image": t.messages.diagnosticMissingImage,
|
|
1969
|
-
"unsupported-component": t.messages.diagnosticUnsupported,
|
|
1970
|
-
"unsupported-image-format": t.messages.diagnosticImageFormat,
|
|
1971
|
-
"rich-text-flattened": t.messages.diagnosticRichText,
|
|
1972
|
-
"nested-components-omitted": t.messages.diagnosticNested,
|
|
1973
|
-
"async-image-required": t.messages.diagnosticImageAsync,
|
|
1974
|
-
"image-decode-failed": t.messages.diagnosticImageDecode,
|
|
1975
|
-
"asset-render-failed": t.messages.diagnosticAssetFailed,
|
|
1976
|
-
"asset-budget-exceeded": t.messages.diagnosticAssetBudget
|
|
1977
|
-
})), s = D(() => {
|
|
1978
|
-
const l = n.value.trim().toLocaleLowerCase();
|
|
1979
|
-
return l ? t.entries.filter((i) => `${i.code} ${i.message} ${o.value[i.code] ?? ""} ${i.path ?? ""} ${r(i)} ${i.format ?? ""}`.toLocaleLowerCase().includes(l)) : t.entries;
|
|
1980
|
-
}), a = D(() => s.value.slice(0, 100));
|
|
1981
|
-
function r(l) {
|
|
1982
|
-
return l.pageIndex === void 0 ? l.path ?? "" : (t.messages.diagnosticsLocation ?? "").replace("{page}", String(l.pageIndex + 1)).replace("{component}", String((l.componentIndex ?? 0) + 1));
|
|
1983
|
-
}
|
|
1984
|
-
return (l, i) => e.entries.length ? (x(), P("details", Br, [
|
|
1985
|
-
h("summary", null, [
|
|
1986
|
-
ie(y(e.messages.diagnosticsTitle) + " ", 1),
|
|
1987
|
-
h("span", null, y(e.entries.length), 1)
|
|
1988
|
-
]),
|
|
1989
|
-
Rt(h("input", {
|
|
1990
|
-
"onUpdate:modelValue": i[0] || (i[0] = (m) => n.value = m),
|
|
1991
|
-
type: "search",
|
|
1992
|
-
"aria-label": e.messages.diagnosticsSearch,
|
|
1993
|
-
placeholder: e.messages.diagnosticsSearch
|
|
1994
|
-
}, null, 8, jr), [
|
|
1995
|
-
[Mt, n.value]
|
|
1996
|
-
]),
|
|
1997
|
-
h("ol", null, [
|
|
1998
|
-
(x(!0), P(he, null, be(a.value, (m, v) => (x(), P("li", { key: v }, [
|
|
1999
|
-
h("div", null, [
|
|
2000
|
-
h("b", null, y(m.format?.toUpperCase() ?? m.severity) + " · " + y(m.code), 1),
|
|
2001
|
-
h("p", null, y(o.value[m.code] ?? m.message), 1),
|
|
2002
|
-
o.value[m.code] ? (x(), P("details", Hr, [
|
|
2003
|
-
h("summary", null, y(e.messages.diagnosticsDetails), 1),
|
|
2004
|
-
ie(y(m.message), 1)
|
|
2005
|
-
])) : q("", !0),
|
|
2006
|
-
h("small", null, y(r(m)), 1)
|
|
2007
|
-
]),
|
|
2008
|
-
m.pageIndex !== void 0 ? (x(), P("button", {
|
|
2009
|
-
key: 0,
|
|
2010
|
-
type: "button",
|
|
2011
|
-
onClick: (d) => l.$emit("locate", m)
|
|
2012
|
-
}, y(e.messages.diagnosticsLocate), 9, Wr)) : q("", !0)
|
|
2013
|
-
]))), 128))
|
|
2014
|
-
]),
|
|
2015
|
-
s.value.length > a.value.length ? (x(), P("small", Ur, y((e.messages.diagnosticsMore ?? "").replace("{count}", String(s.value.length))), 1)) : q("", !0)
|
|
2016
|
-
])) : q("", !0);
|
|
2017
|
-
}
|
|
2018
|
-
}), Jr = /* @__PURE__ */ xe(Vr, [["__scopeId", "data-v-3b7804ce"]]), Gr = {
|
|
2019
|
-
key: 0,
|
|
2020
|
-
class: "mrp-data-explanation"
|
|
2021
|
-
}, Yr = { class: "mrp-data-content" }, Zr = ["aria-label", "placeholder"], Xr = { class: "mrp-data-state" }, Qr = ["disabled", "onClick"], _r = {
|
|
2022
|
-
key: 0,
|
|
2023
|
-
role: "status"
|
|
2024
|
-
}, el = { key: 1 }, tl = /* @__PURE__ */ we({
|
|
2025
|
-
__name: "ReportDataExplanation",
|
|
2026
|
-
props: {
|
|
2027
|
-
entries: {},
|
|
2028
|
-
messages: {},
|
|
2029
|
-
busy: { type: Boolean }
|
|
2030
|
-
},
|
|
2031
|
-
emits: ["locate"],
|
|
2032
|
-
setup(e, { emit: t }) {
|
|
2033
|
-
const n = e, o = t, s = G(""), a = D(() => ({ "missing-source": n.messages.dataMissingSource, "not-applicable": n.messages.dataNotApplicable, "not-calculable": n.messages.dataNotCalculable })), r = D(() => {
|
|
2034
|
-
const i = s.value.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
2035
|
-
return n.entries.filter((m) => i.every((v) => `${m.message} ${m.target?.datasetId} ${m.target?.rowKey ?? ""} ${m.target?.field} ${a.value[m.valueState] ?? ""}`.toLocaleLowerCase().includes(v)));
|
|
2036
|
-
}), l = D(() => r.value.slice(0, 100));
|
|
2037
|
-
return (i, m) => e.entries.length ? (x(), P("details", Gr, [
|
|
2038
|
-
h("summary", null, [
|
|
2039
|
-
ee(ae, {
|
|
2040
|
-
name: "file",
|
|
2041
|
-
size: 14
|
|
2042
|
-
}),
|
|
2043
|
-
h("span", null, y(e.messages.dataExplanation), 1),
|
|
2044
|
-
h("b", null, y(e.entries.length), 1),
|
|
2045
|
-
h("small", null, y(e.messages.dataExplanationHint), 1),
|
|
2046
|
-
ee(ae, {
|
|
2047
|
-
name: "chevron-down",
|
|
2048
|
-
size: 12
|
|
2049
|
-
})
|
|
2050
|
-
]),
|
|
2051
|
-
h("div", Yr, [
|
|
2052
|
-
h("label", null, [
|
|
2053
|
-
ee(ae, {
|
|
2054
|
-
name: "search",
|
|
2055
|
-
size: 15
|
|
2056
|
-
}),
|
|
2057
|
-
Rt(h("input", {
|
|
2058
|
-
"onUpdate:modelValue": m[0] || (m[0] = (v) => s.value = v),
|
|
2059
|
-
type: "search",
|
|
2060
|
-
"aria-label": e.messages.dataExplanationSearch,
|
|
2061
|
-
placeholder: e.messages.dataExplanationSearch
|
|
2062
|
-
}, null, 8, Zr), [
|
|
2063
|
-
[Mt, s.value]
|
|
2064
|
-
])
|
|
2065
|
-
]),
|
|
2066
|
-
h("ul", null, [
|
|
2067
|
-
(x(!0), P(he, null, be(l.value, (v, d) => (x(), P("li", { key: d }, [
|
|
2068
|
-
h("div", null, [
|
|
2069
|
-
h("span", Xr, y(a.value[v.valueState]), 1),
|
|
2070
|
-
h("code", null, [
|
|
2071
|
-
ie(y(v.target?.datasetId) + " · " + y(v.target?.field) + " ", 1),
|
|
2072
|
-
v.target?.rowKey !== void 0 ? (x(), P(he, { key: 0 }, [
|
|
2073
|
-
ie(" · " + y(v.target.rowKey), 1)
|
|
2074
|
-
], 64)) : q("", !0)
|
|
2075
|
-
]),
|
|
2076
|
-
h("p", null, y(v.message), 1)
|
|
2077
|
-
]),
|
|
2078
|
-
v.target ? (x(), P("button", {
|
|
2079
|
-
key: 0,
|
|
2080
|
-
type: "button",
|
|
2081
|
-
disabled: e.busy,
|
|
2082
|
-
onClick: (g) => o("locate", v.target)
|
|
2083
|
-
}, [
|
|
2084
|
-
ie(y(e.messages.diagnosticsLocate), 1),
|
|
2085
|
-
ee(ae, {
|
|
2086
|
-
name: "arrow-right",
|
|
2087
|
-
size: 13
|
|
2088
|
-
})
|
|
2089
|
-
], 8, Qr)) : q("", !0)
|
|
2090
|
-
]))), 128))
|
|
2091
|
-
]),
|
|
2092
|
-
r.value.length ? q("", !0) : (x(), P("p", _r, y(e.messages.dataExplanationEmpty), 1)),
|
|
2093
|
-
r.value.length > l.value.length ? (x(), P("small", el, y((e.messages.diagnosticsMore ?? "").replace("{count}", String(r.value.length))), 1)) : q("", !0)
|
|
2094
|
-
])
|
|
2095
|
-
])) : q("", !0);
|
|
2096
|
-
}
|
|
2097
|
-
}), nl = /* @__PURE__ */ xe(tl, [["__scopeId", "data-v-cb0adb4c"]]), al = { class: "mrp-print-settings" }, ol = ["value", "disabled"], sl = ["value", "disabled"], rl = ["disabled"], ll = /* @__PURE__ */ we({
|
|
2098
|
-
__name: "ReportPrintSettings",
|
|
2099
|
-
props: {
|
|
2100
|
-
value: {},
|
|
2101
|
-
messages: {},
|
|
2102
|
-
busy: { type: Boolean },
|
|
2103
|
-
canTest: { type: Boolean }
|
|
2104
|
-
},
|
|
2105
|
-
emits: ["change", "test"],
|
|
2106
|
-
setup(e, { emit: t }) {
|
|
2107
|
-
const n = e, o = t;
|
|
2108
|
-
function s(a, r) {
|
|
2109
|
-
const l = r.target, i = Number(l.value);
|
|
2110
|
-
if (!l.value.trim() || !Number.isFinite(i) || Math.abs(i) > 20) {
|
|
2111
|
-
l.value = String(n.value[a] ?? 0);
|
|
2112
|
-
return;
|
|
2113
|
-
}
|
|
2114
|
-
o("change", { ...n.value, [a]: i });
|
|
2115
|
-
}
|
|
2116
|
-
return (a, r) => (x(), P("details", al, [
|
|
2117
|
-
h("summary", null, y(e.messages.printCalibration), 1),
|
|
2118
|
-
h("p", null, y(e.messages.printCalibrationHint), 1),
|
|
2119
|
-
h("div", null, [
|
|
2120
|
-
h("label", null, [
|
|
2121
|
-
ie(y(e.messages.printOffsetX) + " ", 1),
|
|
2122
|
-
h("input", {
|
|
2123
|
-
type: "number",
|
|
2124
|
-
min: "-20",
|
|
2125
|
-
max: "20",
|
|
2126
|
-
step: ".1",
|
|
2127
|
-
value: e.value.offsetXmm ?? 0,
|
|
2128
|
-
disabled: e.busy,
|
|
2129
|
-
onChange: r[0] || (r[0] = (l) => s("offsetXmm", l))
|
|
2130
|
-
}, null, 40, ol)
|
|
2131
|
-
]),
|
|
2132
|
-
h("label", null, [
|
|
2133
|
-
ie(y(e.messages.printOffsetY) + " ", 1),
|
|
2134
|
-
h("input", {
|
|
2135
|
-
type: "number",
|
|
2136
|
-
min: "-20",
|
|
2137
|
-
max: "20",
|
|
2138
|
-
step: ".1",
|
|
2139
|
-
value: e.value.offsetYmm ?? 0,
|
|
2140
|
-
disabled: e.busy,
|
|
2141
|
-
onChange: r[1] || (r[1] = (l) => s("offsetYmm", l))
|
|
2142
|
-
}, null, 40, sl)
|
|
2143
|
-
])
|
|
2144
|
-
]),
|
|
2145
|
-
h("button", {
|
|
2146
|
-
type: "button",
|
|
2147
|
-
disabled: e.busy || !e.canTest,
|
|
2148
|
-
onClick: r[2] || (r[2] = (l) => o("test"))
|
|
2149
|
-
}, y(e.messages.printCalibrationTest), 9, rl)
|
|
2150
|
-
]));
|
|
2151
|
-
}
|
|
2152
|
-
}), il = /* @__PURE__ */ xe(ll, [["__scopeId", "data-v-35a0f5ec"]]);
|
|
2153
|
-
function ul(e, t) {
|
|
2154
|
-
if (![e, t].every((r) => Number.isFinite(r) && r >= 25 && r <= 600)) throw new RangeError("Calibration paper must be between 25 and 600 mm");
|
|
2155
|
-
const n = [], o = Math.min(10, e / 5), s = Math.min(10, t / 5), a = Math.min(50, e - o * 2, t - s * 2);
|
|
2156
|
-
n.push({ kind: "rect", leftMm: o, topMm: s, widthMm: a, heightMm: a, style: { borderColor: "#255c8c", lineWidthPt: 0.5 } });
|
|
2157
|
-
for (let r = 0; r <= a; r += 5)
|
|
2158
|
-
n.push({ kind: "line", leftMm: o + r, topMm: s, widthMm: 0, heightMm: r % 10 ? 2 : 3, style: { lineColor: "#255c8c", lineWidthPt: 0.5 } }), n.push({ kind: "line", leftMm: o, topMm: s + r, widthMm: r % 10 ? 2 : 3, heightMm: 0, style: { lineColor: "#255c8c", lineWidthPt: 0.5 } });
|
|
2159
|
-
return n.push({ kind: "text", text: `${a} x ${a} mm`, leftMm: o + 4, topMm: s + a / 2 - 2, widthMm: a - 8, heightMm: 4, style: { fontSize: 7, align: "center", color: "#255c8c" } }), { schemaVersion: "print-calibration", pages: [{ pageWidthMm: e, pageHeightMm: t, components: n }] };
|
|
2160
|
-
}
|
|
2161
|
-
const Bn = /* @__PURE__ */ new Map(), nt = /* @__PURE__ */ new Map(), cl = 15e3;
|
|
2162
|
-
function nn(e, t) {
|
|
2163
|
-
return Object.assign(new Error(e), { cause: t });
|
|
2164
|
-
}
|
|
2165
|
-
function gt(e, t) {
|
|
2166
|
-
return `PDF 字体 ${JSON.stringify(e)}:${t}。请部署支持报表文字的字体文件,并将 pdfFontUrl 配置为可访问的字体 URL;西文报表可设为空串`;
|
|
2167
|
-
}
|
|
2168
|
-
function Pt(e) {
|
|
2169
|
-
if (e?.reason instanceof Error && e.reason.name === "AbortError") return e.reason;
|
|
2170
|
-
const t = nn("PDF 字体检查已取消", e?.reason);
|
|
2171
|
-
return t.name = "AbortError", t;
|
|
2172
|
-
}
|
|
2173
|
-
async function dl(e, t) {
|
|
2174
|
-
let n = !1;
|
|
2175
|
-
const o = setTimeout(() => {
|
|
2176
|
-
n = !0, t.abort();
|
|
2177
|
-
}, cl);
|
|
2178
|
-
try {
|
|
2179
|
-
const s = await fetch(e, { method: "HEAD", signal: t.signal });
|
|
2180
|
-
if (t.signal.aborted) throw Pt(t.signal);
|
|
2181
|
-
if (s.status === 405 || s.status === 501 || s.type === "opaque")
|
|
2182
|
-
return {
|
|
2183
|
-
status: "unverified",
|
|
2184
|
-
fontUrl: e,
|
|
2185
|
-
message: `PDF 字体 ${JSON.stringify(e)} 无法通过 HEAD 检查验证;仍可尝试导出,届时会加载并校验字体`
|
|
2186
|
-
};
|
|
2187
|
-
if (!s.ok) {
|
|
2188
|
-
const r = new Error(`字体请求返回 HTTP ${s.status}`);
|
|
2189
|
-
return { status: "error", fontUrl: e, message: gt(e, r.message), cause: r };
|
|
2190
|
-
}
|
|
2191
|
-
const a = s.headers.get("content-type") ?? "";
|
|
2192
|
-
if (/text\/html|application\/xhtml\+xml/i.test(a)) {
|
|
2193
|
-
const r = new Error("字体 URL 返回 HTML 页面(可能是 SPA 路由回退),不是字体文件");
|
|
2194
|
-
return { status: "error", fontUrl: e, message: gt(e, r.message), cause: r };
|
|
2195
|
-
}
|
|
2196
|
-
if (/^text\//i.test(a) || /(?:\/|\+)json(?:\s*;|$)/i.test(a)) {
|
|
2197
|
-
const r = new Error(`字体 URL 返回 ${a} 文本响应,不是字体文件`);
|
|
2198
|
-
return { status: "error", fontUrl: e, message: gt(e, r.message), cause: r };
|
|
2199
|
-
}
|
|
2200
|
-
return {
|
|
2201
|
-
status: "available",
|
|
2202
|
-
fontUrl: e,
|
|
2203
|
-
message: "PDF 字体资源可达;文字覆盖范围将在实际导出时校验"
|
|
2204
|
-
};
|
|
2205
|
-
} catch (s) {
|
|
2206
|
-
if (t.signal.aborted && !n) throw Pt(t.signal);
|
|
2207
|
-
return {
|
|
2208
|
-
status: "error",
|
|
2209
|
-
fontUrl: e,
|
|
2210
|
-
message: gt(e, n ? "字体检查超时,请检查网络或字体服务" : "字体检查失败,请检查网络、字体服务或跨域访问配置"),
|
|
2211
|
-
cause: s
|
|
2212
|
-
};
|
|
2213
|
-
} finally {
|
|
2214
|
-
clearTimeout(o);
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
function fl(e, t) {
|
|
2218
|
-
if (t?.aborted) return Promise.reject(Pt(t));
|
|
2219
|
-
if (!e)
|
|
2220
|
-
return Promise.resolve({ status: "disabled", fontUrl: e, message: "已停用自定义 PDF 字体;内置字体用于西文,其他文字会在导出时校验" });
|
|
2221
|
-
const n = Bn.get(e);
|
|
2222
|
-
if (n) return Promise.resolve(n);
|
|
2223
|
-
let o = nt.get(e);
|
|
2224
|
-
if (!o) {
|
|
2225
|
-
const a = new AbortController();
|
|
2226
|
-
o = { controller: a, promise: dl(e, a), subscribers: 0 };
|
|
2227
|
-
const r = o;
|
|
2228
|
-
nt.set(e, r), r.promise = r.promise.then((l) => (!a.signal.aborted && l.status === "available" && Bn.set(e, l), l)).finally(() => {
|
|
2229
|
-
nt.get(e) === r && nt.delete(e);
|
|
2230
|
-
});
|
|
2231
|
-
}
|
|
2232
|
-
const s = o;
|
|
2233
|
-
return s.subscribers++, new Promise((a, r) => {
|
|
2234
|
-
let l = !1;
|
|
2235
|
-
const i = () => l ? !1 : (l = !0, s.subscribers--, t?.removeEventListener("abort", m), !0), m = () => {
|
|
2236
|
-
i() && (s.subscribers === 0 && (nt.get(e) === s && nt.delete(e), s.controller.abort()), r(Pt(t)));
|
|
2237
|
-
};
|
|
2238
|
-
t?.addEventListener("abort", m, { once: !0 }), s.promise.then(
|
|
2239
|
-
(v) => {
|
|
2240
|
-
i() && a(v);
|
|
2241
|
-
},
|
|
2242
|
-
(v) => {
|
|
2243
|
-
i() && r(v);
|
|
2244
|
-
}
|
|
2245
|
-
), t?.aborted && m();
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
|
-
function ml(e = { fontUrl: "/simhei.ttf" }) {
|
|
2249
|
-
let t = null;
|
|
2250
|
-
const n = async (o, s, a = {}) => {
|
|
2251
|
-
ye(a.signal), t || (t = await import("@agile-team/mach-report/pdf")), ye(a.signal);
|
|
2252
|
-
let r = null;
|
|
2253
|
-
if (e.fontUrl)
|
|
2254
|
-
try {
|
|
2255
|
-
if (r = await He(t.loadFontWithCache(e.fontUrl, { strict: !0, signal: a.signal }), a.signal), !r?.byteLength) throw new Error("字体文件为空或加载失败");
|
|
2256
|
-
} catch (g) {
|
|
2257
|
-
const I = g instanceof Error ? g.message : String(g);
|
|
2258
|
-
throw nn(gt(e.fontUrl, I), g);
|
|
2259
|
-
}
|
|
2260
|
-
let l;
|
|
2261
|
-
try {
|
|
2262
|
-
ye(a.signal), l = await t.renderPlanToPdf(o, { ...a, ...r ? { customFontBytes: r } : {} });
|
|
2263
|
-
} catch (g) {
|
|
2264
|
-
if (!r) throw g;
|
|
2265
|
-
const I = g instanceof Error ? g.message : String(g);
|
|
2266
|
-
throw nn(`PDF 生成失败:${I}。当前字体 URL 为 ${JSON.stringify(e.fontUrl)};请确认该文件是有效字体,或重新配置 pdfFontUrl`, g);
|
|
2267
|
-
}
|
|
2268
|
-
ye(a.signal), l.diagnostics?.forEach((g) => {
|
|
2269
|
-
try {
|
|
2270
|
-
a.onDiagnostic?.(g);
|
|
2271
|
-
} catch {
|
|
2272
|
-
}
|
|
2273
|
-
});
|
|
2274
|
-
const { bytes: i, unsupportedTextCount: m, pageErrors: v, fidelityWarnings: d } = l;
|
|
2275
|
-
if (m > 0)
|
|
2276
|
-
throw new Error(`PDF 中有 ${m} 行文字无法编码;请部署支持所用文字的字体并配置 pdfFontUrl`);
|
|
2277
|
-
if (v.length > 0)
|
|
2278
|
-
throw new Error(`PDF 有 ${v.length} 页渲染失败:${v[0]}`);
|
|
2279
|
-
return d.length > 0 && s?.(`PDF 有 ${d.length} 处版式降级:${d.slice(0, 2).join(";")}`), i;
|
|
2280
|
-
};
|
|
2281
|
-
return n.checkFont = (o) => fl(e.fontUrl, o), n;
|
|
2282
|
-
}
|
|
2283
|
-
function gl(e) {
|
|
2284
|
-
const t = fe(Object.freeze({ status: "unchecked", fontUrl: "" }));
|
|
2285
|
-
let n = null, o = null, s = 0, a = null;
|
|
2286
|
-
function r() {
|
|
2287
|
-
if (e.injectedExporter) return e.injectedExporter;
|
|
2288
|
-
const v = e.fontUrl();
|
|
2289
|
-
return (!o || n !== v) && (n = v, o = ml({ fontUrl: v })), o;
|
|
2290
|
-
}
|
|
2291
|
-
function l() {
|
|
2292
|
-
s++, a?.abort(), a = null;
|
|
2293
|
-
}
|
|
2294
|
-
async function i() {
|
|
2295
|
-
if (e.destroyed()) throw new st("config", "报表预览已卸载");
|
|
2296
|
-
l();
|
|
2297
|
-
const v = s, d = new AbortController();
|
|
2298
|
-
a = d;
|
|
2299
|
-
const g = e.fontUrl();
|
|
2300
|
-
t.value = Object.freeze({ status: "checking", fontUrl: g });
|
|
2301
|
-
try {
|
|
2302
|
-
const I = r(), k = I.checkFont ? await I.checkFont(d.signal) : { status: "unverified", fontUrl: "", message: "自定义 PDF 导出器未提供字体预检查;字体由宿主确认" };
|
|
2303
|
-
return !e.destroyed() && v === s && !d.signal.aborted && (t.value = Object.freeze({ ...k })), k;
|
|
2304
|
-
} catch (I) {
|
|
2305
|
-
if (d.signal.aborted) throw I;
|
|
2306
|
-
const k = { status: "error", fontUrl: g, message: I instanceof Error ? I.message : "PDF 字体检查失败", cause: I };
|
|
2307
|
-
return !e.destroyed() && v === s && (t.value = Object.freeze(k)), k;
|
|
2308
|
-
} finally {
|
|
2309
|
-
a === d && (a = null);
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
function m() {
|
|
2313
|
-
i().catch(() => {
|
|
2314
|
-
});
|
|
2315
|
-
}
|
|
2316
|
-
return de([e.plan, D(e.fontUrl), D(e.enabled)], () => {
|
|
2317
|
-
const v = t.value.fontUrl === e.fontUrl();
|
|
2318
|
-
v && t.value.status === "available" || (l(), (!v || t.value.status === "checking") && (t.value = Object.freeze({ status: "unchecked", fontUrl: e.fontUrl() })), !e.destroyed() && e.plan.value?.pages.length && e.enabled() && m());
|
|
2319
|
-
}, { immediate: !0 }), { pdfFont: t, getPdfExporter: r, checkPdfFont: i, retryPdfFont: m, cancelFontCheck: l };
|
|
2320
|
-
}
|
|
2321
|
-
function vl(e) {
|
|
2322
|
-
const t = fe(null), n = fe(!1);
|
|
2323
|
-
let o = 0, s = null;
|
|
2324
|
-
function a(i) {
|
|
2325
|
-
const m = s;
|
|
2326
|
-
s = null, t.value = null, n.value = !1, m?.(i);
|
|
2327
|
-
}
|
|
2328
|
-
function r() {
|
|
2329
|
-
o++, a(!1);
|
|
2330
|
-
}
|
|
2331
|
-
async function l(i) {
|
|
2332
|
-
if (r(), !e.enabled() || !e.pending()) return !0;
|
|
2333
|
-
const m = o, v = [...e.snapshot?.() ?? []];
|
|
2334
|
-
n.value = !0;
|
|
2335
|
-
const d = Object.freeze({ reason: i, reportIds: Object.freeze([...e.reportIds()]), pendingLocalChanges: !0 });
|
|
2336
|
-
try {
|
|
2337
|
-
const g = e.hook(), I = await new Promise((b) => {
|
|
2338
|
-
if (s = b, !g) {
|
|
2339
|
-
t.value = d;
|
|
2340
|
-
return;
|
|
2341
|
-
}
|
|
2342
|
-
Promise.resolve().then(() => g(d)).then((f) => {
|
|
2343
|
-
m === o && a(f === !0);
|
|
2344
|
-
}, (f) => {
|
|
2345
|
-
if (m === o) {
|
|
2346
|
-
try {
|
|
2347
|
-
e.error(f);
|
|
2348
|
-
} catch {
|
|
2349
|
-
}
|
|
2350
|
-
a(!1);
|
|
2351
|
-
}
|
|
2352
|
-
});
|
|
2353
|
-
}), k = e.snapshot?.() ?? [];
|
|
2354
|
-
return m === o && I === !0 && k.length === v.length && v.every((b, f) => Object.is(b, k[f]));
|
|
2355
|
-
} catch (g) {
|
|
2356
|
-
if (m === o) {
|
|
2357
|
-
try {
|
|
2358
|
-
e.error(g);
|
|
2359
|
-
} catch {
|
|
2360
|
-
}
|
|
2361
|
-
a(!1);
|
|
2362
|
-
}
|
|
2363
|
-
return !1;
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
return { request: t, pending: n, check: l, settle: a, cancel: r };
|
|
2367
|
-
}
|
|
2368
|
-
let pl = 0;
|
|
2369
|
-
function hl(e) {
|
|
2370
|
-
const t = fe(null), n = /* @__PURE__ */ new Set();
|
|
2371
|
-
let o = null;
|
|
2372
|
-
function s(i) {
|
|
2373
|
-
t.value = Object.freeze(i);
|
|
2374
|
-
try {
|
|
2375
|
-
e(t.value);
|
|
2376
|
-
} catch {
|
|
2377
|
-
}
|
|
2378
|
-
}
|
|
2379
|
-
function a(i, m, v) {
|
|
2380
|
-
const d = `mr-task-${Date.now().toString(36)}-${++pl}`;
|
|
2381
|
-
n.add(d), o = v, s({ taskId: d, kind: i, stage: m, status: "running", cancellable: !0 });
|
|
2382
|
-
function g(k, b, f) {
|
|
2383
|
-
t.value?.taskId !== d || t.value.status !== "running" || s({ ...t.value, stage: k, completed: b, total: f });
|
|
2384
|
-
}
|
|
2385
|
-
function I(k = "completed") {
|
|
2386
|
-
t.value?.taskId !== d || t.value.status !== "running" || (o = null, s({ ...t.value, status: k, cancellable: !1 }));
|
|
2387
|
-
}
|
|
2388
|
-
return { taskId: d, update: g, finish: I };
|
|
2389
|
-
}
|
|
2390
|
-
function r() {
|
|
2391
|
-
if (t.value?.status !== "running") return;
|
|
2392
|
-
const i = o;
|
|
2393
|
-
o = null, s({ ...t.value, status: "cancelled", cancellable: !1 }), i?.();
|
|
2394
|
-
}
|
|
2395
|
-
function l(i, m) {
|
|
2396
|
-
t.value?.taskId !== i.taskId && (i.status !== "running" || n.has(i.taskId)) || (n.add(i.taskId), n.size > 100 && n.delete(n.values().next().value), o = i.status === "running" ? m : null, s({ ...i }));
|
|
2397
|
-
}
|
|
2398
|
-
return { state: t, start: a, cancel: r, receive: l };
|
|
2399
|
-
}
|
|
2400
|
-
function bl(e) {
|
|
2401
|
-
const t = fe(Object.freeze([])), n = /* @__PURE__ */ new Set();
|
|
2402
|
-
let o = 0;
|
|
2403
|
-
function s() {
|
|
2404
|
-
o++, t.value = Object.freeze([]), n.clear();
|
|
2405
|
-
}
|
|
2406
|
-
function a(i) {
|
|
2407
|
-
const m = o, v = [];
|
|
2408
|
-
for (const d of i) {
|
|
2409
|
-
const g = JSON.stringify([d.code, d.format, d.pageIndex, d.componentIndex, d.componentPath, d.path, d.message, d.valueState, d.target]);
|
|
2410
|
-
if (n.has(g)) continue;
|
|
2411
|
-
n.add(g);
|
|
2412
|
-
const I = Object.freeze({ ...d, ...d.target ? { target: Object.freeze({ ...d.target }) } : {}, ...d.componentPath ? { componentPath: Object.freeze([...d.componentPath]) } : {} });
|
|
2413
|
-
v.push(I);
|
|
2414
|
-
}
|
|
2415
|
-
v.length && (t.value = Object.freeze([...t.value, ...v]));
|
|
2416
|
-
for (const d of v) {
|
|
2417
|
-
if (m !== o) break;
|
|
2418
|
-
try {
|
|
2419
|
-
e(d);
|
|
2420
|
-
} catch {
|
|
2421
|
-
}
|
|
2422
|
-
}
|
|
2423
|
-
}
|
|
2424
|
-
function r(i) {
|
|
2425
|
-
a([i]);
|
|
2426
|
-
}
|
|
2427
|
-
function l(i, m) {
|
|
2428
|
-
const v = Ya(i, m);
|
|
2429
|
-
return a(v), v;
|
|
2430
|
-
}
|
|
2431
|
-
return { entries: t, reset: s, add: r, addMany: a, inspect: l };
|
|
2432
|
-
}
|
|
2433
|
-
const yl = { class: "mrp-edit-bar" }, wl = ["disabled"], xl = ["disabled"], kl = { class: "mrp-changes" }, $l = ["aria-label"], Cl = { key: 0 }, El = { key: 1 }, Il = ["onClick"], Pl = ["title"], Sl = ["title"], Rl = ["disabled"], Ml = {
|
|
2434
|
-
key: 0,
|
|
2435
|
-
role: "status"
|
|
2436
|
-
}, Tl = {
|
|
2437
|
-
key: 1,
|
|
2438
|
-
role: "status"
|
|
2439
|
-
}, Ol = {
|
|
2440
|
-
key: 2,
|
|
2441
|
-
class: "mrp-conflicts",
|
|
2442
|
-
open: ""
|
|
2443
|
-
}, Dl = /* @__PURE__ */ we({
|
|
2444
|
-
__name: "ReportEditBar",
|
|
2445
|
-
props: {
|
|
2446
|
-
differences: {},
|
|
2447
|
-
conflicts: {},
|
|
2448
|
-
messages: {},
|
|
2449
|
-
saving: { type: Boolean },
|
|
2450
|
-
canUndo: { type: Boolean },
|
|
2451
|
-
canRedo: { type: Boolean },
|
|
2452
|
-
busy: { type: Boolean },
|
|
2453
|
-
persisted: { type: Boolean }
|
|
2454
|
-
},
|
|
2455
|
-
emits: ["undo", "redo", "restore", "locate"],
|
|
2456
|
-
setup(e) {
|
|
2457
|
-
function t(n) {
|
|
2458
|
-
return n.source ? `${n.source.rowKey} · ${n.source.field}` : `${n.address.pageIndex + 1} / ${n.address.rowIndex + 1}:${n.address.columnIndex + 1}`;
|
|
2459
|
-
}
|
|
2460
|
-
return (n, o) => (x(), P("div", yl, [
|
|
2461
|
-
h("button", {
|
|
2462
|
-
type: "button",
|
|
2463
|
-
disabled: e.busy || e.saving || !e.canUndo,
|
|
2464
|
-
onClick: o[0] || (o[0] = (s) => n.$emit("undo"))
|
|
2465
|
-
}, y(e.messages.undo), 9, wl),
|
|
2466
|
-
h("button", {
|
|
2467
|
-
type: "button",
|
|
2468
|
-
disabled: e.busy || e.saving || !e.canRedo,
|
|
2469
|
-
onClick: o[1] || (o[1] = (s) => n.$emit("redo"))
|
|
2470
|
-
}, y(e.messages.redo), 9, xl),
|
|
2471
|
-
h("details", kl, [
|
|
2472
|
-
h("summary", null, y(e.messages.changes) + " · " + y(e.messages.changesCount?.replace("{count}", String(e.differences.length))), 1),
|
|
2473
|
-
h("section", {
|
|
2474
|
-
"aria-label": e.messages.changes
|
|
2475
|
-
}, [
|
|
2476
|
-
e.differences.length ? (x(), P("ol", El, [
|
|
2477
|
-
(x(!0), P(he, null, be(e.differences, (s, a) => (x(), P("li", { key: a }, [
|
|
2478
|
-
h("button", {
|
|
2479
|
-
type: "button",
|
|
2480
|
-
onClick: (r) => n.$emit("locate", s)
|
|
2481
|
-
}, y(t(s)), 9, Il),
|
|
2482
|
-
h("span", null, [
|
|
2483
|
-
h("s", {
|
|
2484
|
-
title: e.messages.changesBefore
|
|
2485
|
-
}, y(s.previousText || "∅"), 9, Pl),
|
|
2486
|
-
o[3] || (o[3] = ie(" → ", -1)),
|
|
2487
|
-
h("strong", {
|
|
2488
|
-
title: e.messages.changesAfter
|
|
2489
|
-
}, y(s.text || "∅"), 9, Sl)
|
|
2490
|
-
])
|
|
2491
|
-
]))), 128))
|
|
2492
|
-
])) : (x(), P("p", Cl, y(e.messages.changesEmpty), 1))
|
|
2493
|
-
], 8, $l)
|
|
2494
|
-
]),
|
|
2495
|
-
h("button", {
|
|
2496
|
-
type: "button",
|
|
2497
|
-
disabled: e.busy || e.saving || !e.differences.length,
|
|
2498
|
-
onClick: o[2] || (o[2] = (s) => n.$emit("restore"))
|
|
2499
|
-
}, y(e.messages.restoreChanges), 9, Rl),
|
|
2500
|
-
e.saving ? (x(), P("span", Ml, y(e.messages.saving), 1)) : e.differences.length && !e.conflicts.length ? (x(), P("span", Tl, y(e.persisted ? e.messages.editSaved : e.messages.editingLocal), 1)) : q("", !0),
|
|
2501
|
-
e.conflicts.length ? (x(), P("details", Ol, [
|
|
2502
|
-
h("summary", null, y(e.messages.conflicts) + " · " + y(e.conflicts.length), 1),
|
|
2503
|
-
h("ul", null, [
|
|
2504
|
-
(x(!0), P(he, null, be(e.conflicts, (s, a) => (x(), P("li", { key: a }, y(s.message), 1))), 128))
|
|
2505
|
-
])
|
|
2506
|
-
])) : q("", !0)
|
|
2507
|
-
]));
|
|
2508
|
-
}
|
|
2509
|
-
}), Al = /* @__PURE__ */ xe(Dl, [["__scopeId", "data-v-df1c7b86"]]);
|
|
2510
|
-
function Fl(e) {
|
|
2511
|
-
const t = e.table?.columnKeys ?? [], n = t.map(() => []);
|
|
2512
|
-
if (!e.grid) return t;
|
|
2513
|
-
for (const { ci: o, cell: s } of cn(e.grid, e.widthMm, e.heightMm).cells) {
|
|
2514
|
-
const a = (s.text ?? s.rawText ?? "").trim();
|
|
2515
|
-
if (a)
|
|
2516
|
-
for (let r = o; r < Math.min(t.length, o + (s.colSpan ?? 1)); r++)
|
|
2517
|
-
n[r].includes(a) || n[r].push(a);
|
|
2518
|
-
}
|
|
2519
|
-
return t.map((o, s) => n[s].join(" / ") || o);
|
|
2520
|
-
}
|
|
2521
|
-
function zl(e, t = []) {
|
|
2522
|
-
const n = /* @__PURE__ */ new Set(), o = [];
|
|
2523
|
-
for (const [s, a] of (e?.pages ?? []).entries())
|
|
2524
|
-
for (const r of a.components) {
|
|
2525
|
-
const l = r.table;
|
|
2526
|
-
if (!l || l.role !== "header" || n.has(l.id)) continue;
|
|
2527
|
-
n.add(l.id);
|
|
2528
|
-
const i = Fl(r), m = t.filter((I) => I.pageIndex <= s), v = m[m.length - 1]?.label, d = l.source?.datasetId, g = [...new Set([v, l.title, d].filter(Boolean))].join(" · ") || l.id;
|
|
2529
|
-
l.columnKeys.forEach((I, k) => {
|
|
2530
|
-
I && o.push({ key: JSON.stringify([l.id, k]), field: I, label: i[k], group: g, pageIndex: s, tableId: l.id, ...d ? { datasetId: d } : {} });
|
|
2531
|
-
});
|
|
2532
|
-
}
|
|
2533
|
-
return o;
|
|
2534
|
-
}
|
|
2535
|
-
function Ll(e, t) {
|
|
2536
|
-
const n = t.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean);
|
|
2537
|
-
return e.filter((o) => {
|
|
2538
|
-
const s = `${o.label} ${o.field} ${o.group}`.toLocaleLowerCase();
|
|
2539
|
-
return n.every((a) => s.includes(a));
|
|
2540
|
-
});
|
|
2541
|
-
}
|
|
2542
|
-
function Nl(e) {
|
|
2543
|
-
const t = ta(), n = G(""), o = G(0), s = `mrp-column-list-${rn()?.uid ?? 0}`, a = D(() => zl(e.plan(), e.sections())), r = D(() => Ll(a.value, n.value)), l = D(() => r.value.slice(0, 100)), i = D(() => [...new Set(l.value.map((k) => k.group))].map((k) => ({ label: k, items: l.value.filter((b) => b.group === k) })));
|
|
2544
|
-
de(n, () => {
|
|
2545
|
-
o.value = 0;
|
|
2546
|
-
}), de(e.busy, (k) => {
|
|
2547
|
-
k && t.close();
|
|
2548
|
-
}), de(a, () => {
|
|
2549
|
-
o.value = 0;
|
|
2550
|
-
});
|
|
2551
|
-
function m(k) {
|
|
2552
|
-
e.busy() || (e.locate(k), t.close(!0));
|
|
2553
|
-
}
|
|
2554
|
-
function v() {
|
|
2555
|
-
if (e.busy()) return;
|
|
2556
|
-
const k = l.value[o.value];
|
|
2557
|
-
k ? m(k) : n.value.trim() && (e.locateField(n.value.trim()), t.close(!0));
|
|
2558
|
-
}
|
|
2559
|
-
function d() {
|
|
2560
|
-
n.value = "", t.panel.value?.querySelector("input")?.focus();
|
|
2561
|
-
}
|
|
2562
|
-
function g(k) {
|
|
2563
|
-
if (!(k.isComposing || k.keyCode === 229 || !["ArrowDown", "ArrowUp", "Enter"].includes(k.key))) {
|
|
2564
|
-
if (k.preventDefault(), k.stopPropagation(), k.key === "Enter") {
|
|
2565
|
-
v();
|
|
2566
|
-
return;
|
|
2567
|
-
}
|
|
2568
|
-
l.value.length && (o.value = (o.value + (k.key === "ArrowDown" ? 1 : -1) + l.value.length) % l.value.length, We(() => t.panel.value?.querySelector(`[id="${s}-${o.value}"]`)?.scrollIntoView?.({ block: "nearest" })));
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
function I(k) {
|
|
2572
|
-
return l.value.findIndex((b) => b.key === k);
|
|
2573
|
-
}
|
|
2574
|
-
return { ...t, field: n, active: o, listId: s, directory: a, matches: r, candidates: l, groups: i, choose: m, submit: v, clear: d, onSearchKeydown: g, candidateIndex: I };
|
|
2575
|
-
}
|
|
2576
|
-
const ql = ["aria-label"], Kl = {
|
|
2577
|
-
key: 0,
|
|
2578
|
-
class: "mrp-section-tabs"
|
|
2579
|
-
}, Bl = ["aria-current", "disabled", "onClick"], jl = ["aria-expanded", "disabled"], Hl = {
|
|
2580
|
-
key: 0,
|
|
2581
|
-
class: "mrp-column-count"
|
|
2582
|
-
}, Wl = ["aria-label"], Ul = { class: "mrp-column-heading" }, Vl = ["aria-label"], Jl = ["aria-label", "placeholder", "aria-controls", "aria-activedescendant", "disabled"], Gl = ["aria-label"], Yl = ["id", "aria-label"], Zl = {
|
|
2583
|
-
key: 0,
|
|
2584
|
-
class: "mrp-column-empty",
|
|
2585
|
-
role: "status"
|
|
2586
|
-
}, Xl = ["aria-label"], Ql = ["id", "aria-selected", "disabled", "onPointermove", "onClick"], _l = ["title"], ei = {
|
|
2587
|
-
class: "mrp-column-help",
|
|
2588
|
-
role: "status"
|
|
2589
|
-
}, ti = /* @__PURE__ */ we({
|
|
2590
|
-
__name: "ReportNavigation",
|
|
2591
|
-
props: {
|
|
2592
|
-
sections: {},
|
|
2593
|
-
currentPage: {},
|
|
2594
|
-
messages: {},
|
|
2595
|
-
busy: { type: Boolean },
|
|
2596
|
-
plan: {},
|
|
2597
|
-
compact: { type: Boolean }
|
|
2598
|
-
},
|
|
2599
|
-
emits: ["goto", "locate", "locate-target"],
|
|
2600
|
-
setup(e, { emit: t }) {
|
|
2601
|
-
const n = e, o = t, s = Nl({ plan: () => n.plan, sections: () => n.sections, busy: () => n.busy, locate: (z) => o("locate-target", z), locateField: (z) => o("locate", z) }), { root: a, trigger: r, panel: l, opened: i, field: m, active: v, directory: d, matches: g, candidates: I, groups: k, listId: b } = s, f = D(() => d.value.length > 0 || !n.plan || n.plan.pages.some((z) => z.components.some((F) => F.table?.columnKeys.length))), R = D(() => ({ columnDirectory: "字段目录", columnSearch: "搜索列名或字段", columnNoMatches: "未找到匹配字段", columnResults: "匹配字段", ...n.messages })), p = D(() => (n.messages.columnResultsMore ?? "{count} 个匹配字段,显示前 {limit} 个;继续输入可缩小范围").replace("{count}", String(g.value.length)).replace("{limit}", String(I.value.length)));
|
|
2602
|
-
function S(z) {
|
|
2603
|
-
const F = n.sections[z];
|
|
2604
|
-
return !!F && n.currentPage >= F.pageIndex + 1 && (!n.sections[z + 1] || n.currentPage <= n.sections[z + 1].pageIndex);
|
|
2605
|
-
}
|
|
2606
|
-
return (z, F) => e.sections.length > 1 || f.value ? (x(), P("nav", {
|
|
2607
|
-
key: 0,
|
|
2608
|
-
class: $e(["mrp-section-nav", { "mrp-compact": e.compact }]),
|
|
2609
|
-
"aria-label": e.messages.sections ?? "工作表与章节"
|
|
2610
|
-
}, [
|
|
2611
|
-
e.sections.length > 1 ? (x(), P("div", Kl, [
|
|
2612
|
-
(x(!0), P(he, null, be(e.sections, (B, V) => (x(), P("button", {
|
|
2613
|
-
key: V,
|
|
2614
|
-
type: "button",
|
|
2615
|
-
class: $e({ active: S(V) }),
|
|
2616
|
-
"aria-current": S(V) ? "page" : void 0,
|
|
2617
|
-
disabled: e.busy,
|
|
2618
|
-
onClick: (_) => o("goto", B.pageIndex + 1)
|
|
2619
|
-
}, y(B.label), 11, Bl))), 128))
|
|
2620
|
-
])) : q("", !0),
|
|
2621
|
-
f.value ? (x(), P("div", {
|
|
2622
|
-
key: 1,
|
|
2623
|
-
ref_key: "root",
|
|
2624
|
-
ref: a,
|
|
2625
|
-
class: "mrp-column-locator",
|
|
2626
|
-
onKeydown: F[7] || (F[7] = //@ts-ignore
|
|
2627
|
-
(...B) => c(s).onKeydown && c(s).onKeydown(...B))
|
|
2628
|
-
}, [
|
|
2629
|
-
h("button", {
|
|
2630
|
-
ref_key: "trigger",
|
|
2631
|
-
ref: r,
|
|
2632
|
-
type: "button",
|
|
2633
|
-
class: $e(["mrp-directory-trigger", { active: c(i) }]),
|
|
2634
|
-
"aria-expanded": c(i),
|
|
2635
|
-
"aria-haspopup": "dialog",
|
|
2636
|
-
disabled: e.busy,
|
|
2637
|
-
onClick: F[0] || (F[0] = (B) => i.value = !c(i))
|
|
2638
|
-
}, [
|
|
2639
|
-
ee(ae, { name: "columns" }),
|
|
2640
|
-
h("span", null, y(R.value.columnDirectory), 1),
|
|
2641
|
-
c(d).length ? (x(), P("span", Hl, y(c(d).length), 1)) : q("", !0),
|
|
2642
|
-
ee(ae, {
|
|
2643
|
-
name: "chevron-down",
|
|
2644
|
-
size: 12
|
|
2645
|
-
})
|
|
2646
|
-
], 10, jl),
|
|
2647
|
-
c(i) ? (x(), P("div", {
|
|
2648
|
-
key: 0,
|
|
2649
|
-
ref_key: "panel",
|
|
2650
|
-
ref: l,
|
|
2651
|
-
class: "mrp-column-directory",
|
|
2652
|
-
role: "dialog",
|
|
2653
|
-
"aria-label": R.value.columnDirectory
|
|
2654
|
-
}, [
|
|
2655
|
-
h("div", Ul, [
|
|
2656
|
-
h("span", null, [
|
|
2657
|
-
ee(ae, { name: "columns" }),
|
|
2658
|
-
ie(y(R.value.columnDirectory), 1)
|
|
2659
|
-
]),
|
|
2660
|
-
h("button", {
|
|
2661
|
-
type: "button",
|
|
2662
|
-
class: "mrp-column-close",
|
|
2663
|
-
"aria-label": e.messages.closeColumnDirectory ?? "关闭字段目录",
|
|
2664
|
-
onClick: F[1] || (F[1] = (B) => c(s).close(!0))
|
|
2665
|
-
}, [
|
|
2666
|
-
ee(ae, {
|
|
2667
|
-
name: "close",
|
|
2668
|
-
size: 15
|
|
2669
|
-
})
|
|
2670
|
-
], 8, Vl)
|
|
2671
|
-
]),
|
|
2672
|
-
h("form", {
|
|
2673
|
-
class: "mrp-column-search",
|
|
2674
|
-
onSubmit: F[5] || (F[5] = pt(
|
|
2675
|
-
//@ts-ignore
|
|
2676
|
-
(...B) => c(s).submit && c(s).submit(...B),
|
|
2677
|
-
["prevent"]
|
|
2678
|
-
))
|
|
2679
|
-
}, [
|
|
2680
|
-
ee(ae, { name: "search" }),
|
|
2681
|
-
Rt(h("input", {
|
|
2682
|
-
"onUpdate:modelValue": F[2] || (F[2] = (B) => Un(m) ? m.value = B : null),
|
|
2683
|
-
type: "search",
|
|
2684
|
-
autocomplete: "off",
|
|
2685
|
-
spellcheck: "false",
|
|
2686
|
-
role: "combobox",
|
|
2687
|
-
"aria-label": R.value.columnSearch,
|
|
2688
|
-
placeholder: R.value.columnSearch,
|
|
2689
|
-
"aria-autocomplete": "list",
|
|
2690
|
-
"aria-expanded": "true",
|
|
2691
|
-
"aria-controls": c(b),
|
|
2692
|
-
"aria-activedescendant": c(I).length ? `${c(b)}-${c(v)}` : void 0,
|
|
2693
|
-
disabled: e.busy,
|
|
2694
|
-
onKeydown: F[3] || (F[3] = //@ts-ignore
|
|
2695
|
-
(...B) => c(s).onSearchKeydown && c(s).onSearchKeydown(...B))
|
|
2696
|
-
}, null, 40, Jl), [
|
|
2697
|
-
[Mt, c(m)]
|
|
2698
|
-
]),
|
|
2699
|
-
c(m) ? (x(), P("button", {
|
|
2700
|
-
key: 0,
|
|
2701
|
-
class: "mrp-column-clear",
|
|
2702
|
-
type: "button",
|
|
2703
|
-
"aria-label": e.messages.clearSearch ?? "清除搜索",
|
|
2704
|
-
onClick: F[4] || (F[4] = //@ts-ignore
|
|
2705
|
-
(...B) => c(s).clear && c(s).clear(...B))
|
|
2706
|
-
}, [
|
|
2707
|
-
ee(ae, {
|
|
2708
|
-
name: "close",
|
|
2709
|
-
size: 13
|
|
2710
|
-
})
|
|
2711
|
-
], 8, Gl)) : q("", !0)
|
|
2712
|
-
], 32),
|
|
2713
|
-
h("div", {
|
|
2714
|
-
id: c(b),
|
|
2715
|
-
class: "mrp-column-results",
|
|
2716
|
-
role: "listbox",
|
|
2717
|
-
"aria-label": R.value.columnResults
|
|
2718
|
-
}, [
|
|
2719
|
-
c(I).length ? q("", !0) : (x(), P("p", Zl, [
|
|
2720
|
-
ee(ae, {
|
|
2721
|
-
name: "search",
|
|
2722
|
-
size: 22
|
|
2723
|
-
}),
|
|
2724
|
-
ie(y(R.value.columnNoMatches), 1)
|
|
2725
|
-
])),
|
|
2726
|
-
(x(!0), P(he, null, be(c(k), (B) => (x(), P("section", {
|
|
2727
|
-
key: B.label,
|
|
2728
|
-
role: "group",
|
|
2729
|
-
"aria-label": B.label
|
|
2730
|
-
}, [
|
|
2731
|
-
h("strong", null, y(B.label), 1),
|
|
2732
|
-
(x(!0), P(he, null, be(B.items, (V) => (x(), P("button", {
|
|
2733
|
-
id: `${c(b)}-${c(s).candidateIndex(V.key)}`,
|
|
2734
|
-
key: V.key,
|
|
2735
|
-
type: "button",
|
|
2736
|
-
role: "option",
|
|
2737
|
-
tabindex: "-1",
|
|
2738
|
-
class: $e({ "mrp-column-active": c(s).candidateIndex(V.key) === c(v) }),
|
|
2739
|
-
"aria-selected": c(s).candidateIndex(V.key) === c(v),
|
|
2740
|
-
disabled: e.busy,
|
|
2741
|
-
onPointermove: (_) => v.value = c(s).candidateIndex(V.key),
|
|
2742
|
-
onMousedown: F[6] || (F[6] = pt(() => {
|
|
2743
|
-
}, ["prevent"])),
|
|
2744
|
-
onClick: (_) => c(s).choose(V)
|
|
2745
|
-
}, [
|
|
2746
|
-
h("span", null, [
|
|
2747
|
-
ie(y(V.label), 1),
|
|
2748
|
-
h("code", {
|
|
2749
|
-
title: V.field
|
|
2750
|
-
}, y(V.field), 9, _l)
|
|
2751
|
-
]),
|
|
2752
|
-
ee(ae, {
|
|
2753
|
-
name: "arrow-right",
|
|
2754
|
-
size: 14
|
|
2755
|
-
})
|
|
2756
|
-
], 42, Ql))), 128))
|
|
2757
|
-
], 8, Xl))), 128))
|
|
2758
|
-
], 8, Yl),
|
|
2759
|
-
h("p", ei, y(c(g).length > c(I).length ? p.value : e.messages.columnSearchShortcut ?? "↑ ↓ 选择 · Enter 定位"), 1)
|
|
2760
|
-
], 8, Wl)) : q("", !0)
|
|
2761
|
-
], 544)) : q("", !0)
|
|
2762
|
-
], 10, ql)) : q("", !0);
|
|
2763
|
-
}
|
|
2764
|
-
}), jn = /* @__PURE__ */ xe(ti, [["__scopeId", "data-v-b772ba8c"]]), ni = { class: "mrp-import-summary" }, ai = { key: 0 }, oi = { key: 0 }, si = /* @__PURE__ */ we({
|
|
2765
|
-
__name: "ReportImportSummary",
|
|
2766
|
-
props: {
|
|
2767
|
-
result: {},
|
|
2768
|
-
messages: {}
|
|
2769
|
-
},
|
|
2770
|
-
setup(e) {
|
|
2771
|
-
return (t, n) => (x(), P("details", ni, [
|
|
2772
|
-
h("summary", null, [
|
|
2773
|
-
ie(y(e.messages.importSummary) + " · " + y(e.messages.importPreserved?.replace("{sheets}", String(e.result.sheets.length))) + " ", 1),
|
|
2774
|
-
e.result.warnings.length ? (x(), P("span", ai, " · " + y(e.result.warnings.length) + " " + y(e.messages.importWarnings), 1)) : q("", !0)
|
|
2775
|
-
]),
|
|
2776
|
-
h("p", null, y(e.messages.importReadOnly), 1),
|
|
2777
|
-
h("ul", null, [
|
|
2778
|
-
(x(!0), P(he, null, be(e.result.sheets, (o) => (x(), P("li", {
|
|
2779
|
-
key: o.index
|
|
2780
|
-
}, y(o.name) + " · " + y(o.range) + " · " + y(o.rowCount) + " × " + y(o.columnCount), 1))), 128))
|
|
2781
|
-
]),
|
|
2782
|
-
e.result.warnings.length ? (x(), P("ul", oi, [
|
|
2783
|
-
(x(!0), P(he, null, be(e.result.warnings, (o, s) => (x(), P("li", { key: s }, y(o), 1))), 128))
|
|
2784
|
-
])) : q("", !0)
|
|
2785
|
-
]));
|
|
2786
|
-
}
|
|
2787
|
-
}), ri = /* @__PURE__ */ xe(si, [["__scopeId", "data-v-54f275e8"]]);
|
|
2788
|
-
function Oe(e) {
|
|
2789
|
-
return JSON.parse(JSON.stringify(e));
|
|
2790
|
-
}
|
|
2791
|
-
function aa(e, t) {
|
|
2792
|
-
const n = t.fields;
|
|
2793
|
-
if (typeof n == "function") return n(e);
|
|
2794
|
-
const o = e.source?.field ?? e.table?.columnKey;
|
|
2795
|
-
return o === void 0 || !n || !Object.prototype.hasOwnProperty.call(n, o) ? void 0 : n[o];
|
|
2796
|
-
}
|
|
2797
|
-
function Tt(e, t) {
|
|
2798
|
-
if (e.requiresRecalculation && (!t || !un(e))) throw new Ae("recalculation");
|
|
2799
|
-
}
|
|
2800
|
-
async function li(e, t, n, o) {
|
|
2801
|
-
const s = t.edits.every((l) => !!l.source);
|
|
2802
|
-
Tt(e, s);
|
|
2803
|
-
const a = un(e);
|
|
2804
|
-
if (a && s) return a.prepareHistory(e, t.edits, t.value, n, { signal: o });
|
|
2805
|
-
const r = rt(e);
|
|
2806
|
-
return t.edits.map((l) => {
|
|
2807
|
-
const i = r(l);
|
|
2808
|
-
if (!i) throw new Ae("missing");
|
|
2809
|
-
return { address: i, value: l[t.value] };
|
|
2810
|
-
});
|
|
2811
|
-
}
|
|
2812
|
-
function ii(e, t, n) {
|
|
2813
|
-
const o = t.edits.every((s) => !!s.source);
|
|
2814
|
-
return Tt(e, o), o ? un(e)?.prepare(e, t, { signal: n }) : void 0;
|
|
2815
|
-
}
|
|
2816
|
-
function ui(e, t) {
|
|
2817
|
-
const n = /* @__PURE__ */ new Map();
|
|
2818
|
-
return e.pages.forEach((o, s) => o.components.forEach((a, r) => {
|
|
2819
|
-
if (a.grid)
|
|
2820
|
-
for (const l of cn(a.grid, a.widthMm, a.heightMm).cells) {
|
|
2821
|
-
const i = t({ pageIndex: s, componentIndex: r, rowIndex: l.ri, columnIndex: l.ci });
|
|
2822
|
-
if (!i?.source) continue;
|
|
2823
|
-
const m = Ge(i), v = n.get(m) ?? [];
|
|
2824
|
-
v.push(i), n.set(m, v);
|
|
2825
|
-
}
|
|
2826
|
-
})), n;
|
|
2827
|
-
}
|
|
2828
|
-
function rt(e) {
|
|
2829
|
-
const t = Ct(e), n = ui(e, t);
|
|
2830
|
-
function o(a) {
|
|
2831
|
-
if (a.source) return n.get(Ge(a)) ?? [];
|
|
2832
|
-
const r = t(a.address);
|
|
2833
|
-
return r ? !a.table || Ge(r) === Ge(a) ? [r] : [] : [];
|
|
2834
|
-
}
|
|
2835
|
-
const s = (a) => {
|
|
2836
|
-
const r = o(a), l = r.find((i) => i.table?.id === a.table?.id) ?? r[0];
|
|
2837
|
-
return l ? { ...l.address } : null;
|
|
2838
|
-
};
|
|
2839
|
-
return s.all = (a) => o(a).map((r) => ({ ...r.address })), s;
|
|
2840
|
-
}
|
|
2841
|
-
class ci extends Error {
|
|
2842
|
-
constructor(t) {
|
|
2843
|
-
super(t.map((n) => n.message).join(";")), this.conflicts = t, this.name = "ReportEditConflictError";
|
|
2844
|
-
}
|
|
2845
|
-
}
|
|
2846
|
-
function di() {
|
|
2847
|
-
return globalThis.crypto?.randomUUID?.() ?? `mr-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
2848
|
-
}
|
|
2849
|
-
function fi(e, t, n, o) {
|
|
2850
|
-
return Array.isArray(t) ? { batch: tn(e, t, n) } : li(e, t, n, o).then((s) => Array.isArray(s) ? { batch: tn(e, s, n) } : s);
|
|
2851
|
-
}
|
|
2852
|
-
function mi(e) {
|
|
2853
|
-
const t = fe([]), n = fe([]), o = fe([]), s = fe([]), a = fe(!1), r = fe(null), l = fe([]), i = D(() => l.value.length > 0), m = D(() => {
|
|
2854
|
-
const w = zn(t.value), M = e.plan.value;
|
|
2855
|
-
if (!M || !w.length) return w;
|
|
2856
|
-
const A = rt(M);
|
|
2857
|
-
return w.map((N) => {
|
|
2858
|
-
const J = A(N);
|
|
2859
|
-
return J ? { ...N, address: J } : N;
|
|
2860
|
-
});
|
|
2861
|
-
}), v = D(() => !!e.options.value && !a.value && !e.blocked() && n.value.length > 0), d = D(() => !!e.options.value && !a.value && !e.blocked() && o.value.length > 0);
|
|
2862
|
-
let g = null, I = null, k = 0, b = null;
|
|
2863
|
-
function f() {
|
|
2864
|
-
g?.abort(), g = null, a.value = !1, I = null;
|
|
2865
|
-
}
|
|
2866
|
-
function R() {
|
|
2867
|
-
k++, f(), b = null, t.value = [], n.value = [], o.value = [], s.value = [], l.value = [], r.value = null;
|
|
2868
|
-
}
|
|
2869
|
-
function p() {
|
|
2870
|
-
const w = e.options.value;
|
|
2871
|
-
return w ? typeof w == "object" ? w : {} : null;
|
|
2872
|
-
}
|
|
2873
|
-
function S(w, M, A, N) {
|
|
2874
|
-
if (!e.options.value || e.blocked()) throw new Ae("readonly");
|
|
2875
|
-
Tt(w, M.edits.every((X) => !!X.source));
|
|
2876
|
-
const J = Ct(w), W = new Map(N?.map((X) => [Ge(X), X]));
|
|
2877
|
-
for (const X of M.edits) {
|
|
2878
|
-
const Y = N ? W.get(Ge(X)) : J(X.address);
|
|
2879
|
-
if (!Y?.editable || A.canEdit?.(Y) === !1) throw new Ae("readonly");
|
|
2880
|
-
if (A.requireSource && !Y.source) throw new Ae("missing");
|
|
2881
|
-
const oe = aa(Y, A);
|
|
2882
|
-
oe && Za(Y, X.value, oe);
|
|
2883
|
-
}
|
|
2884
|
-
}
|
|
2885
|
-
async function z(w, M, A) {
|
|
2886
|
-
if (M.saveBatch) return M.saveBatch(Oe(w), A);
|
|
2887
|
-
if (M.save && w.edits.length > 1) throw new Ae("atomic");
|
|
2888
|
-
if (w.edits[0]) return M.save?.(Oe(w.edits[0]), A);
|
|
2889
|
-
}
|
|
2890
|
-
async function F(w, M, A) {
|
|
2891
|
-
for (const N of w.edits) {
|
|
2892
|
-
const J = await M.validate?.(Oe(N), A);
|
|
2893
|
-
if (J) throw new Error(J);
|
|
2894
|
-
if (A.signal.aborted) return;
|
|
2895
|
-
}
|
|
2896
|
-
}
|
|
2897
|
-
function B(w, M, A, N, J, W) {
|
|
2898
|
-
if (e.plan.value = W ? W.commit(A) : Xa(Qa(w, M), M, A), t.value = [...t.value, ...M.edits], J) {
|
|
2899
|
-
const Y = new Set(M.edits.map(Ge));
|
|
2900
|
-
l.value = l.value.filter((oe) => !Y.has(Ge(oe)));
|
|
2901
|
-
} else l.value = zn([...l.value, ...M.edits]);
|
|
2902
|
-
N === "edit" && (n.value = [...n.value, M.edits], o.value = []), s.value = [], b = null;
|
|
2903
|
-
const X = k;
|
|
2904
|
-
for (const Y of M.edits) {
|
|
2905
|
-
if (k !== X) break;
|
|
2906
|
-
e.onChange(Oe(Y));
|
|
2907
|
-
}
|
|
2908
|
-
}
|
|
2909
|
-
function V(w, M, A) {
|
|
2910
|
-
const N = JSON.stringify([A, M.edits]);
|
|
2911
|
-
b?.plan === w && b.signature === N ? M.requestId = b.requestId : b = { plan: w, signature: N, requestId: M.requestId };
|
|
2912
|
-
}
|
|
2913
|
-
function _(w) {
|
|
2914
|
-
r.value = e.errorMessage?.(w) ?? (w instanceof Error ? w.message : "Cell edit failed"), e.onError(r.value, w);
|
|
2915
|
-
}
|
|
2916
|
-
async function Z(w, M) {
|
|
2917
|
-
const A = e.plan.value, N = p();
|
|
2918
|
-
if (!A || !N || e.blocked()) return !1;
|
|
2919
|
-
const J = new AbortController(), W = k;
|
|
2920
|
-
g = J, a.value = !0, r.value = null;
|
|
2921
|
-
const X = () => g === J && !J.signal.aborted && e.plan.value === A && e.options.value !== !1;
|
|
2922
|
-
try {
|
|
2923
|
-
const Y = fi(A, w, di(), J.signal), oe = Y instanceof Promise ? await Y : Y;
|
|
2924
|
-
if (!X()) return !1;
|
|
2925
|
-
const { batch: K, contexts: ke } = oe;
|
|
2926
|
-
if (S(A, K, N, ke), K.edits = K.edits.filter(($) => !Object.is($.previousValue, $.value)), !K.edits.length) return !0;
|
|
2927
|
-
V(A, K, M), S(A, K, N, ke);
|
|
2928
|
-
const Ke = { signal: J.signal, requestId: K.requestId, action: M };
|
|
2929
|
-
if (await F(K, N, Ke), !X()) return !1;
|
|
2930
|
-
S(A, K, N, ke);
|
|
2931
|
-
const Fe = oe.prepared ? void 0 : ii(A, K, J.signal);
|
|
2932
|
-
if (Fe && (oe.prepared = await Fe), !X()) return !1;
|
|
2933
|
-
S(A, K, N, ke);
|
|
2934
|
-
const Ve = await z(K, N, Ke);
|
|
2935
|
-
if (!X()) return !1;
|
|
2936
|
-
if (Ve?.conflicts?.length)
|
|
2937
|
-
throw s.value = Oe(Ve.conflicts), new ci(Ve.conflicts);
|
|
2938
|
-
return S(A, K, N, ke), B(A, K, Ve, M, !!(N.save || N.saveBatch), oe.prepared), W === k;
|
|
2939
|
-
} catch (Y) {
|
|
2940
|
-
return X() && _(Y), !1;
|
|
2941
|
-
} finally {
|
|
2942
|
-
g === J && (g = null, a.value = !1);
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
2945
|
-
async function ne(w, M = "edit") {
|
|
2946
|
-
if (I) return I;
|
|
2947
|
-
const A = Z(w, M);
|
|
2948
|
-
I = A;
|
|
2949
|
-
const N = await A;
|
|
2950
|
-
return I === A && (I = null), N;
|
|
2951
|
-
}
|
|
2952
|
-
async function ce() {
|
|
2953
|
-
const w = k, M = n.value[n.value.length - 1];
|
|
2954
|
-
return !M || a.value || !await ne({ edits: M, value: "previousValue" }, "undo") || w !== k ? !1 : (n.value = n.value.slice(0, -1), o.value = [...o.value, M], !0);
|
|
2955
|
-
}
|
|
2956
|
-
async function Re() {
|
|
2957
|
-
const w = k, M = o.value[o.value.length - 1];
|
|
2958
|
-
return !M || a.value || !await ne({ edits: M, value: "value" }, "redo") || w !== k ? !1 : (o.value = o.value.slice(0, -1), n.value = [...n.value, M], !0);
|
|
2959
|
-
}
|
|
2960
|
-
async function ge() {
|
|
2961
|
-
const w = k;
|
|
2962
|
-
return !m.value.length || a.value || !await ne({ edits: m.value, value: "previousValue" }, "restore") || w !== k ? !1 : (n.value = [], o.value = [], !0);
|
|
2963
|
-
}
|
|
2964
|
-
function C() {
|
|
2965
|
-
if (!I) return !a.value;
|
|
2966
|
-
const w = k;
|
|
2967
|
-
return I.then((M) => M && w === k && !a.value);
|
|
2968
|
-
}
|
|
2969
|
-
function O(w) {
|
|
2970
|
-
return e.plan.value ? rt(e.plan.value)(w) : null;
|
|
2971
|
-
}
|
|
2972
|
-
return { settle: C, resolveAddress: O, changes: t, differences: m, localDifferences: l, hasLocalDrafts: i, lastError: r, conflicts: s, saving: a, canUndo: v, canRedo: d, apply: ne, undo: ce, redo: Re, restore: ge, cancel: f, reset: R };
|
|
2973
|
-
}
|
|
2974
|
-
let gi = 0;
|
|
2975
|
-
const vi = "position:absolute;inset:0;width:100%;height:100%;min-height:20px;box-sizing:border-box;z-index:10;resize:none;margin:0;padding:2px 4px;border:2px solid var(--mrp-btn-active-bg,#2563eb);outline:none;background:var(--mrp-toolbar-bg,#fff);color:var(--mrp-toolbar-fg,#111);font:inherit;line-height:1.25;white-space:pre-wrap;";
|
|
2976
|
-
function pi(e) {
|
|
2977
|
-
return e.type === "boolean" ? [{ value: !0, label: e.trueLabel ?? "是" }, { value: !1, label: e.falseLabel ?? "否" }] : e.type === "enum" ? e.options.map((t) => ({ value: t.value, label: t.label ?? String(t.value) })) : [];
|
|
2978
|
-
}
|
|
2979
|
-
function hi(e, t, n) {
|
|
2980
|
-
const o = e.createElement("select"), s = [{ value: null, label: "—" }, ...pi(t)];
|
|
2981
|
-
if (s.forEach((a, r) => {
|
|
2982
|
-
const l = e.createElement("option");
|
|
2983
|
-
l.value = String(r), l.textContent = a.label, (Object.is(n.value, a.value) || n.value === "" && a.value === null) && (l.selected = !0), o.append(l);
|
|
2984
|
-
}), !s.some((a) => Object.is(n.value, a.value) || n.value === "" && a.value === null)) {
|
|
2985
|
-
const a = e.createElement("option");
|
|
2986
|
-
a.value = "unknown", a.textContent = n.cell.text ?? String(n.value), a.selected = !0, o.append(a);
|
|
2987
|
-
}
|
|
2988
|
-
return { input: o, value: () => o.value === "unknown" ? n.value : s[Number(o.value)]?.value ?? null };
|
|
2989
|
-
}
|
|
2990
|
-
function bi(e, t, n) {
|
|
2991
|
-
const o = t?.type === "number" || t?.type === "date" ? e.createElement("input") : e.createElement("textarea");
|
|
2992
|
-
return o.value = n.value == null ? "" : String(n.value), o instanceof HTMLInputElement && (o.type = t?.type === "date" ? "date" : "text", t?.type === "number" && (o.inputMode = "decimal"), t?.type === "date" && (t.min && (o.min = t.min), t.max && (o.max = t.max))), { input: o, value: () => t?.type === "date" && o instanceof HTMLInputElement && o.validity.badInput ? "invalid-date" : o.value };
|
|
2993
|
-
}
|
|
2994
|
-
function yi(e) {
|
|
2995
|
-
if (!e) return "";
|
|
2996
|
-
const t = [e.hint, e.unit];
|
|
2997
|
-
return (e.type === "number" || e.type === "date") && (e.min !== void 0 && t.push(`≥ ${e.min}`), e.max !== void 0 && t.push(`≤ ${e.max}`)), e.type === "number" && e.precision !== void 0 && t.push(`最多 ${e.precision} 位小数`), e.type === "text" && e.maxLength !== void 0 && t.push(`最多 ${e.maxLength} 字符`), t.filter(Boolean).join(" · ");
|
|
2998
|
-
}
|
|
2999
|
-
function wi(e, t, n, o) {
|
|
3000
|
-
const s = e.ownerDocument, a = o?.type === "boolean" || o?.type === "enum" ? hi(s, o, n) : bi(s, o, n), r = a.input, l = s.createElement("span");
|
|
3001
|
-
l.className = "mrp-cell-editor-host", l.style.cssText = "position:absolute;inset:0;z-index:10;", r.className = "mrp-cell-editor", r.style.cssText = vi, r.setAttribute("aria-label", o?.label ?? t), o?.required && r.setAttribute("aria-required", "true");
|
|
3002
|
-
const i = s.createElement("span");
|
|
3003
|
-
i.id = `mrp-cell-hint-${++gi}`, i.className = "mrp-cell-editor-hint", i.style.cssText = "position:absolute;top:100%;left:0;min-width:100%;width:max-content;max-width:320px;box-sizing:border-box;padding:4px 8px;white-space:normal;border:1px solid var(--mrp-toolbar-border,#ddd);background:var(--mrp-toolbar-bg,#fff);color:var(--mrp-toolbar-fg,#111);font-size:12px;line-height:1.4;box-shadow:0 3px 10px #0002;z-index:11;";
|
|
3004
|
-
const m = yi(o);
|
|
3005
|
-
return i.textContent = m, i.hidden = !m, r.setAttribute("aria-describedby", i.id), l.append(r, i), e.append(l), {
|
|
3006
|
-
input: r,
|
|
3007
|
-
root: l,
|
|
3008
|
-
initialInput: r.value,
|
|
3009
|
-
value: a.value,
|
|
3010
|
-
focus: () => {
|
|
3011
|
-
r.focus(), (r instanceof HTMLTextAreaElement || r instanceof HTMLInputElement && r.type !== "date") && r.select();
|
|
3012
|
-
},
|
|
3013
|
-
feedback: (v) => {
|
|
3014
|
-
i.textContent = v ?? m, i.hidden = !i.textContent, r.setAttribute("aria-invalid", v ? "true" : "false");
|
|
3015
|
-
}
|
|
3016
|
-
};
|
|
3017
|
-
}
|
|
3018
|
-
function an(e) {
|
|
3019
|
-
const t = e.closest(".mrp-page-holder"), n = e.closest("[data-mr-component-index]");
|
|
3020
|
-
if (!t || !n) return null;
|
|
3021
|
-
const o = {
|
|
3022
|
-
pageIndex: Number(t.dataset.page) - 1,
|
|
3023
|
-
componentIndex: Number(n.dataset.mrComponentIndex),
|
|
3024
|
-
rowIndex: Number(e.dataset.mrRowIndex),
|
|
3025
|
-
columnIndex: Number(e.dataset.mrColumnIndex)
|
|
3026
|
-
};
|
|
3027
|
-
return Object.values(o).every((s) => Number.isInteger(s) && s >= 0) ? o : null;
|
|
3028
|
-
}
|
|
3029
|
-
function xi(e) {
|
|
3030
|
-
const t = fe(null), n = mi(e), { saving: o, changes: s } = n, a = fe(!1), r = D(() => a.value || n.hasLocalDrafts.value);
|
|
3031
|
-
let l = null;
|
|
3032
|
-
function i() {
|
|
3033
|
-
const p = t.value;
|
|
3034
|
-
t.value = null, a.value = !1, n.cancel(), l = null, p?.editor.root.remove();
|
|
3035
|
-
}
|
|
3036
|
-
function m() {
|
|
3037
|
-
i(), n.reset();
|
|
3038
|
-
}
|
|
3039
|
-
function v(p) {
|
|
3040
|
-
return t.value === p && e.plan.value === p.plan;
|
|
3041
|
-
}
|
|
3042
|
-
async function d(p) {
|
|
3043
|
-
return await n.apply([{ address: p.address, value: p.editor.value() }]) ? (t.value = null, a.value = !1, p.editor.root.remove(), !0) : (t.value === p && (p.editor.input.disabled = !1, p.editor.feedback(n.lastError.value ?? void 0), p.editor.input.focus()), !1);
|
|
3044
|
-
}
|
|
3045
|
-
async function g() {
|
|
3046
|
-
if (l) return l;
|
|
3047
|
-
const p = t.value;
|
|
3048
|
-
if (!p) return n.settle();
|
|
3049
|
-
if (!v(p))
|
|
3050
|
-
return i(), !1;
|
|
3051
|
-
a.value = p.editor.input.value !== p.editor.initialInput, p.editor.input.disabled = !0;
|
|
3052
|
-
const S = d(p);
|
|
3053
|
-
l = S;
|
|
3054
|
-
const z = await S;
|
|
3055
|
-
return l === S && (l = null), z;
|
|
3056
|
-
}
|
|
3057
|
-
function I() {
|
|
3058
|
-
return t.value || l ? g() : n.settle();
|
|
3059
|
-
}
|
|
3060
|
-
function k(p) {
|
|
3061
|
-
if (p.stopPropagation(), !p.isComposing && (p.key === "Escape" && (p.preventDefault(), i()), p.key === "Enter" && !p.shiftKey || p.key === "Tab")) {
|
|
3062
|
-
p.preventDefault();
|
|
3063
|
-
const S = t.value, z = S && at(S.plan, S.address), F = S && z ? tn(S.plan, [{ address: S.address, value: z.value }], "navigation").edits[0] : void 0;
|
|
3064
|
-
g().then((B) => {
|
|
3065
|
-
if (!B || !S || !e.plan.value) return;
|
|
3066
|
-
const V = e.plan.value === S.plan ? S.address : F && rt(e.plan.value)(F);
|
|
3067
|
-
V && e.onNavigate?.(V, p.key, p.shiftKey);
|
|
3068
|
-
});
|
|
3069
|
-
}
|
|
3070
|
-
}
|
|
3071
|
-
function b(p) {
|
|
3072
|
-
e.onError(e.errorMessage?.(p) ?? (p instanceof Error ? p.message : "无法编辑单元格"), p);
|
|
3073
|
-
}
|
|
3074
|
-
async function f(p) {
|
|
3075
|
-
if (!e.options.value || e.blocked() || !await g() || !p.isConnected) return;
|
|
3076
|
-
const S = e.plan.value, z = an(p);
|
|
3077
|
-
if (!S || !z || !e.options.value || e.blocked()) return;
|
|
3078
|
-
const F = typeof e.options.value == "object" ? e.options.value : {};
|
|
3079
|
-
try {
|
|
3080
|
-
const B = at(S, z);
|
|
3081
|
-
if (!B?.editable || F.canEdit?.(B) === !1) return;
|
|
3082
|
-
if (Tt(S, !!B.source), F.requireSource && !B.source) throw new Ae("missing");
|
|
3083
|
-
const V = aa(B, F);
|
|
3084
|
-
V && _a(B, V);
|
|
3085
|
-
const _ = wi(p, e.label(), B, V), Z = _.input;
|
|
3086
|
-
t.value = { plan: S, address: z, editor: _ }, a.value = !1, Z.addEventListener("keydown", (ne) => k(ne)), Z.addEventListener("input", () => {
|
|
3087
|
-
a.value = Z.value !== _.initialInput, _.feedback();
|
|
3088
|
-
}), Z.addEventListener("change", () => {
|
|
3089
|
-
a.value = Z.value !== _.initialInput;
|
|
3090
|
-
}), Z.addEventListener("blur", () => {
|
|
3091
|
-
!o.value && !e.suspendBlur?.() && g();
|
|
3092
|
-
}), _.focus();
|
|
3093
|
-
} catch (B) {
|
|
3094
|
-
b(B);
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
async function R(p) {
|
|
3098
|
-
const S = p.target;
|
|
3099
|
-
if (!(S instanceof Element) || S.closest(".mrp-cell-editor")) return;
|
|
3100
|
-
const z = S.closest("td[data-mr-row-index]");
|
|
3101
|
-
z && await f(z);
|
|
3102
|
-
}
|
|
3103
|
-
return de(e.options, (p, S) => {
|
|
3104
|
-
(!p || p !== S) && i();
|
|
3105
|
-
}, { flush: "sync" }), de(e.plan, () => {
|
|
3106
|
-
t.value && e.plan.value !== t.value.plan && (t.value.editor.root.remove(), t.value = null, a.value = !1);
|
|
3107
|
-
}, { flush: "sync" }), Ue(m), {
|
|
3108
|
-
...n,
|
|
3109
|
-
active: t,
|
|
3110
|
-
saving: o,
|
|
3111
|
-
changes: s,
|
|
3112
|
-
pendingLocalChanges: r,
|
|
3113
|
-
cancel: i,
|
|
3114
|
-
reset: m,
|
|
3115
|
-
commit: g,
|
|
3116
|
-
settle: I,
|
|
3117
|
-
onDoubleClick: R,
|
|
3118
|
-
editCell: f,
|
|
3119
|
-
getChanges: () => Oe(s.value)
|
|
3120
|
-
};
|
|
3121
|
-
}
|
|
3122
|
-
const on = ["html", "pdf", "xlsx", "png", "word"], Hn = ["search", "thumbnails", "zoom", ...on, "print", "pdfWindow", "editing", "import"];
|
|
3123
|
-
function mu(e) {
|
|
3124
|
-
return {
|
|
3125
|
-
load: (t) => JSON.parse(e.getItem(t) ?? "null"),
|
|
3126
|
-
save: (t, n) => e.setItem(t, JSON.stringify(n)),
|
|
3127
|
-
remove: (t) => e.removeItem(t)
|
|
3128
|
-
};
|
|
3129
|
-
}
|
|
3130
|
-
function ki(e, t, n, o) {
|
|
3131
|
-
const s = G({});
|
|
3132
|
-
let a = 0, r = 0, l = Promise.resolve();
|
|
3133
|
-
const i = D(() => Object.fromEntries(Hn.map((g) => [
|
|
3134
|
-
g,
|
|
3135
|
-
e.value[g] && (s.value[g] ?? t.value[g] ?? !0)
|
|
3136
|
-
])));
|
|
3137
|
-
function m(g, I) {
|
|
3138
|
-
e.value[g] && (r++, s.value = { ...s.value, [g]: I }, v());
|
|
3139
|
-
}
|
|
3140
|
-
function v() {
|
|
3141
|
-
const g = n?.value;
|
|
3142
|
-
if (!g) return;
|
|
3143
|
-
const I = { ...s.value };
|
|
3144
|
-
l = l.then(() => g.adapter.save(g.key, I)).catch((k) => {
|
|
3145
|
-
o?.(k);
|
|
3146
|
-
});
|
|
3147
|
-
}
|
|
3148
|
-
function d() {
|
|
3149
|
-
r++, s.value = {}, v();
|
|
3150
|
-
}
|
|
3151
|
-
return n && de(n, async (g) => {
|
|
3152
|
-
const I = ++a, k = r;
|
|
3153
|
-
if (s.value = {}, !!g)
|
|
3154
|
-
try {
|
|
3155
|
-
const b = await g.adapter.load(g.key);
|
|
3156
|
-
if (I !== a || k !== r || !b || typeof b != "object") return;
|
|
3157
|
-
s.value = Object.fromEntries(Hn.flatMap((f) => typeof b[f] == "boolean" ? [[f, b[f]]] : []));
|
|
3158
|
-
} catch (b) {
|
|
3159
|
-
I === a && o?.(b);
|
|
3160
|
-
}
|
|
3161
|
-
}, { immediate: !0 }), Ue(() => {
|
|
3162
|
-
a++;
|
|
3163
|
-
}), { enabled: i, setEnabled: m, reset: d };
|
|
3164
|
-
}
|
|
3165
|
-
function $i(e, t, n) {
|
|
3166
|
-
const o = G({}), s = io(), a = D(() => uo(s.value, e.preset)), r = D(() => ({
|
|
3167
|
-
...a.value.messages,
|
|
3168
|
-
...e.messages
|
|
3169
|
-
})), l = D(() => e.showExport ?? a.value.showExport), i = D(() => e.showPrint ?? a.value.showPrint), m = D(() => e.showPdfWindow ?? a.value.showPdfWindow), v = D(() => e.showSettings ?? a.value.showSettings), d = D(() => e.guardChanges ?? a.value.guardChanges), g = D(() => ({ ...a.value.output, ...e.output })), I = D(() => ({ ...a.value.toolbar, ...e.toolbar })), k = D(() => ({ ...a.value.interaction, ...e.interaction, ...o.value })), b = D(() => e.preferences ?? a.value.preferences), f = D(() => e.assets ?? a.value.assets), R = D(() => e.gapPx ?? (t.value ? 0 : a.value.gapPx)), p = D(() => e.showParams ?? a.value.showParams), S = D(() => e.editable ?? a.value.editable), z = D(() => e.excelImport ?? a.value.excelImport), F = D(() => ({
|
|
3170
|
-
search: I.value.search !== !1,
|
|
3171
|
-
thumbnails: I.value.thumbnails !== !1,
|
|
3172
|
-
zoom: I.value.zoom !== !1,
|
|
3173
|
-
...Object.fromEntries(on.map((ge) => [
|
|
3174
|
-
ge,
|
|
3175
|
-
l.value && (I.value.exportFormats?.includes(ge) ?? !0)
|
|
3176
|
-
])),
|
|
3177
|
-
print: i.value,
|
|
3178
|
-
pdfWindow: m.value,
|
|
3179
|
-
editing: !!S.value,
|
|
3180
|
-
import: !!z.value
|
|
3181
|
-
})), B = ki(F, D(() => ({
|
|
3182
|
-
editing: I.value.editing,
|
|
3183
|
-
import: I.value.excelImport
|
|
3184
|
-
})), b, () => n(r.value.preferencesError ?? "Preferences storage unavailable")), V = B.enabled, _ = D(() => on.filter((ge) => V.value[ge])), Z = D(() => V.value.editing ? S.value : !1), ne = D(() => V.value.import ? z.value : !1), ce = D(() => typeof S.value == "object" && (typeof S.value.save == "function" || typeof S.value.saveBatch == "function")), Re = D(() => typeof e.emptyState == "object" ? e.emptyState : {});
|
|
3185
|
-
return { resolved: a, resolvedMessages: r, effectiveShowExport: l, effectiveShowPrint: i, effectiveShowPdfWindow: m, effectiveShowSettings: v, effectiveGuardChanges: d, effectiveOutput: g, effectiveInteraction: k, effectiveAssets: f, effectiveGapPx: R, effectiveShowParams: p, availableTools: F, tools: B, toolState: V, visibleExportFormats: _, effectiveEditable: Z, effectiveExcelImport: ne, persistedEditing: ce, emptyStateContent: Re, sessionInteraction: o };
|
|
3186
|
-
}
|
|
3187
|
-
function Ci(e, t, n, o) {
|
|
3188
|
-
const s = o ?? (e.indexOf(t) === e.lastIndexOf(t) ? e.indexOf(t) : -1), a = s >= 0 && e[s] === t ? s : -1, r = JSON.stringify([a, t]);
|
|
3189
|
-
return n.map((l) => ({
|
|
3190
|
-
...l,
|
|
3191
|
-
...l.target ? {
|
|
3192
|
-
target: {
|
|
3193
|
-
...l.target,
|
|
3194
|
-
reportScope: r,
|
|
3195
|
-
...l.target.tableId ? { tableId: JSON.stringify([a, t, l.target.tableId]) } : {}
|
|
3196
|
-
}
|
|
3197
|
-
} : {}
|
|
3198
|
-
}));
|
|
3199
|
-
}
|
|
3200
|
-
function oa(e) {
|
|
3201
|
-
return e.table.role === "header" ? -Math.max(1, e.grid?.cells.length ?? 1) : e.table.rowIndex;
|
|
3202
|
-
}
|
|
3203
|
-
function qe(e, t, n = t) {
|
|
3204
|
-
const o = e.pages[t.pageIndex]?.components[t.componentIndex], s = o?.table, a = e.pages[n.pageIndex]?.components[n.componentIndex]?.table;
|
|
3205
|
-
return s && a && s.id === a.id ? {
|
|
3206
|
-
grid: s.id,
|
|
3207
|
-
row: oa(o) + t.rowIndex,
|
|
3208
|
-
column: a.columnKeys.indexOf(s.columnKeys[t.columnIndex] ?? "")
|
|
3209
|
-
} : { grid: `${t.pageIndex}:${t.componentIndex}`, row: t.rowIndex, column: t.columnIndex };
|
|
3210
|
-
}
|
|
3211
|
-
function Wn(e, t) {
|
|
3212
|
-
const n = e.pages[t.pageIndex]?.components[t.componentIndex]?.table;
|
|
3213
|
-
if (!n) return (s, a) => ({ ...t, rowIndex: s, columnIndex: a });
|
|
3214
|
-
const o = /* @__PURE__ */ new Map();
|
|
3215
|
-
return e.pages.forEach((s, a) => s.components.forEach((r, l) => {
|
|
3216
|
-
r.table?.id !== n.id || !r.grid || r.grid.cells.forEach((i, m) => {
|
|
3217
|
-
const v = oa(r) + m;
|
|
3218
|
-
o.set(v, [...o.get(v) ?? [], { address: { pageIndex: a, componentIndex: l, rowIndex: m, columnIndex: 0 }, keys: r.table.columnKeys }]);
|
|
3219
|
-
});
|
|
3220
|
-
})), (s, a) => {
|
|
3221
|
-
const r = n.columnKeys[a];
|
|
3222
|
-
if (r === void 0) return null;
|
|
3223
|
-
const l = o.get(s)?.find((i) => i.keys.includes(r));
|
|
3224
|
-
return l ? { ...l.address, columnIndex: l.keys.indexOf(r) } : null;
|
|
3225
|
-
};
|
|
3226
|
-
}
|
|
3227
|
-
function Ei(e, t) {
|
|
3228
|
-
const n = [...e.ownerDocument.querySelectorAll("a[href],button,input,textarea,select,[tabindex]:not([tabindex='-1'])")].filter((a) => a.tabIndex >= 0 && !a.matches(":disabled,[hidden],input[type='hidden']") && !a.closest("[inert],[aria-hidden='true']") && a.getClientRects().length > 0).map((a, r) => ({ element: a, order: r })).sort((a, r) => (a.element.tabIndex || 1 / 0) - (r.element.tabIndex || 1 / 0) || a.order - r.order), o = n.findIndex(({ element: a }) => a === e);
|
|
3229
|
-
if (o < 0) return !1;
|
|
3230
|
-
const s = n[o + (t ? -1 : 1)]?.element;
|
|
3231
|
-
return s ? (s.focus(), e.ownerDocument.activeElement === s) : !1;
|
|
3232
|
-
}
|
|
3233
|
-
function Ii(e, t) {
|
|
3234
|
-
const n = e?.source;
|
|
3235
|
-
return !Pi(e, t.field) || t.tableId !== void 0 && e?.table?.id !== t.tableId || t.datasetId !== void 0 && (n?.datasetId ?? e?.component.table?.source?.datasetId) !== t.datasetId ? !1 : t.rowKey === void 0 || n?.rowKey === t.rowKey;
|
|
3236
|
-
}
|
|
3237
|
-
function Pi(e, t) {
|
|
3238
|
-
if ((e?.source?.field ?? e?.table?.columnKey) === t) return !0;
|
|
3239
|
-
if (!e || e.table?.role !== "header") return !1;
|
|
3240
|
-
const n = e.address.columnIndex;
|
|
3241
|
-
return e.component.table?.columnKeys.slice(n, n + (e.cell.colSpan ?? 1)).includes(t) ?? !1;
|
|
3242
|
-
}
|
|
3243
|
-
function Si(e, t) {
|
|
3244
|
-
return e.pageIndex === t.pageIndex && e.componentIndex === t.componentIndex;
|
|
3245
|
-
}
|
|
3246
|
-
function Ri(e, t) {
|
|
3247
|
-
return Si(e, t) && e.rowIndex === t.rowIndex && e.columnIndex === t.columnIndex;
|
|
3248
|
-
}
|
|
3249
|
-
function Zt(e) {
|
|
3250
|
-
return `[data-page="${e.pageIndex + 1}"] [data-mr-component-index="${e.componentIndex}"] td[data-mr-row-index="${e.rowIndex}"][data-mr-column-index="${e.columnIndex}"]`;
|
|
3251
|
-
}
|
|
3252
|
-
function sn(e) {
|
|
3253
|
-
return `${e.pageIndex}:${e.componentIndex}:${e.rowIndex}:${e.columnIndex}`;
|
|
3254
|
-
}
|
|
3255
|
-
function Mi(e, t) {
|
|
3256
|
-
const n = qe(e, t.anchor), o = qe(e, t.focus, t.anchor);
|
|
3257
|
-
return { grid: n.grid, minRow: Math.min(n.row, o.row), maxRow: Math.max(n.row, o.row), minColumn: Math.min(n.column, o.column), maxColumn: Math.max(n.column, o.column), focusKey: sn(t.focus), origin: e.pages[t.anchor.pageIndex]?.components[t.anchor.componentIndex]?.table };
|
|
3258
|
-
}
|
|
3259
|
-
function Ti(e, t, n) {
|
|
3260
|
-
const o = t?.table;
|
|
3261
|
-
if (!o || !n.origin || o.id !== n.origin.id) return { grid: `${e.pageIndex}:${e.componentIndex}`, rowOffset: 0, missingColumn: -1 };
|
|
3262
|
-
const s = /* @__PURE__ */ new Map();
|
|
3263
|
-
return n.origin.columnKeys.forEach((a, r) => {
|
|
3264
|
-
s.has(a) || s.set(a, r);
|
|
3265
|
-
}), { grid: o.id, rowOffset: o.role === "header" ? -Math.max(1, t.grid?.cells.length ?? 1) : o.rowIndex, columns: o.columnKeys.map((a) => s.get(a) ?? -1), missingColumn: s.get("") ?? -1 };
|
|
3266
|
-
}
|
|
3267
|
-
function Oi(e, t, n) {
|
|
3268
|
-
if (!n || !t || t.grid !== n.grid) return !1;
|
|
3269
|
-
const o = t.rowOffset + e.row, s = t.columns ? t.columns[e.column] ?? t.missingColumn : e.column;
|
|
3270
|
-
return o >= n.minRow && o <= n.maxRow && s >= n.minColumn && s <= n.maxColumn;
|
|
3271
|
-
}
|
|
3272
|
-
function $t(e, t, n) {
|
|
3273
|
-
e.getAttribute(t) !== n && e.setAttribute(t, n);
|
|
3274
|
-
}
|
|
3275
|
-
function Xt(e, t, n) {
|
|
3276
|
-
e.classList.contains(t) !== n && e.classList.toggle(t, n);
|
|
3277
|
-
}
|
|
3278
|
-
function Di(e, t, n, o, s, a) {
|
|
3279
|
-
t.role !== n && ($t(e, "role", n), t.role = n), t.selected !== o && (Xt(e, "mrp-cell-selected", o), $t(e, "aria-selected", String(o)), t.selected = o), t.focused !== s && (Xt(e, "mrp-cell-focus", s), $t(e, "tabindex", s ? "0" : "-1"), t.focused = s), t.modified !== a && (Xt(e, "mrp-cell-modified", a), t.modified = a);
|
|
3280
|
-
}
|
|
3281
|
-
function Ai(e) {
|
|
3282
|
-
const t = () => e.editable?.() ?? e.enabled(), n = fe(null), o = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap();
|
|
3283
|
-
let a = null, r = null, l = /* @__PURE__ */ new Set();
|
|
3284
|
-
function i(C, O) {
|
|
3285
|
-
const w = at(C, O);
|
|
3286
|
-
return !w || C.requiresRecalculation && !w.source ? null : { address: w.address, source: w.source, table: w.table, value: w.value, previousValue: w.value, text: w.cell.text ?? "", previousText: w.cell.text ?? "" };
|
|
3287
|
-
}
|
|
3288
|
-
de(e.plan, (C, O) => {
|
|
3289
|
-
const w = n.value;
|
|
3290
|
-
if (!w) return;
|
|
3291
|
-
if (!C || !O) {
|
|
3292
|
-
n.value = null;
|
|
3293
|
-
return;
|
|
3294
|
-
}
|
|
3295
|
-
const M = i(O, w.anchor), A = i(O, w.focus), N = rt(C), J = M && N(M), W = A && N(A);
|
|
3296
|
-
n.value = J && W ? { anchor: J, focus: W } : null;
|
|
3297
|
-
}, { flush: "sync" });
|
|
3298
|
-
function m(C = e.root.value ?? void 0) {
|
|
3299
|
-
if (!C) return;
|
|
3300
|
-
const O = n.value, w = e.plan.value, M = e.differences();
|
|
3301
|
-
if (M !== a || w !== r) {
|
|
3302
|
-
a = M, r = w;
|
|
3303
|
-
const N = w && M.length ? rt(w) : null;
|
|
3304
|
-
l = new Set(M.flatMap((J) => N ? N.all(J).map(sn) : []));
|
|
3305
|
-
}
|
|
3306
|
-
const A = O && w ? Mi(w, O) : null;
|
|
3307
|
-
C instanceof HTMLTableElement && g(C, w, A);
|
|
3308
|
-
for (const N of C.querySelectorAll("table")) g(N, w, A);
|
|
3309
|
-
}
|
|
3310
|
-
function v(C) {
|
|
3311
|
-
const O = o.get(C);
|
|
3312
|
-
if (O) return O;
|
|
3313
|
-
const w = C.closest("[data-mr-component-index]"), M = w?.closest(".mrp-page-holder"), A = { pageIndex: Number(M?.dataset.page) - 1, componentIndex: Number(w?.dataset.mrComponentIndex) };
|
|
3314
|
-
return Object.values(A).every((N) => Number.isInteger(N) && N >= 0) ? (o.set(C, A), A) : null;
|
|
3315
|
-
}
|
|
3316
|
-
function d(C, O) {
|
|
3317
|
-
const w = s.get(C);
|
|
3318
|
-
if (w) return w;
|
|
3319
|
-
const M = Number(C.dataset.mrRowIndex), A = Number(C.dataset.mrColumnIndex);
|
|
3320
|
-
if (![M, A].every((J) => Number.isInteger(J) && J >= 0)) return null;
|
|
3321
|
-
const N = { row: M, column: A, key: sn({ ...O, rowIndex: M, columnIndex: A }) };
|
|
3322
|
-
return s.set(C, N), N;
|
|
3323
|
-
}
|
|
3324
|
-
function g(C, O, w) {
|
|
3325
|
-
const M = v(C);
|
|
3326
|
-
if (!M) return;
|
|
3327
|
-
const A = O?.pages[M.pageIndex]?.components[M.componentIndex], N = A?.table?.role === "header" ? "columnheader" : "gridcell", J = w ? Ti(M, A, w) : null;
|
|
3328
|
-
$t(C, "role", "grid");
|
|
3329
|
-
for (const W of C.rows) for (const X of W.cells) {
|
|
3330
|
-
const Y = d(X, M);
|
|
3331
|
-
Y && Di(X, Y, N, Oi(Y, J, w), w?.focusKey === Y.key, l.size > 0 && l.has(Y.key));
|
|
3332
|
-
}
|
|
3333
|
-
}
|
|
3334
|
-
async function I(C, O = !1) {
|
|
3335
|
-
if (!e.plan.value || !at(e.plan.value, C)) return !1;
|
|
3336
|
-
const w = n.value, M = O && w && qe(e.plan.value, w.anchor).grid === qe(e.plan.value, C, w.anchor).grid;
|
|
3337
|
-
n.value = { anchor: M ? w.anchor : { ...C }, focus: { ...C } }, e.root.value?.querySelector(Zt(C)) || e.gotoPage(C.pageIndex + 1), await We(), m();
|
|
3338
|
-
const A = e.root.value?.querySelector(Zt(C));
|
|
3339
|
-
return A?.focus({ preventScroll: !0 }), A?.scrollIntoView?.({ block: "nearest", inline: "nearest" }), !!A;
|
|
3340
|
-
}
|
|
3341
|
-
function k(C) {
|
|
3342
|
-
const O = C.target;
|
|
3343
|
-
if (!(O instanceof Element) || O.closest("textarea,input,button,select")) return;
|
|
3344
|
-
const w = O.closest("td[data-mr-row-index]"), M = w && an(w);
|
|
3345
|
-
if (!M || e.busy() || !e.plan.value || !at(e.plan.value, M)) return;
|
|
3346
|
-
const A = n.value, N = C.shiftKey && A && qe(e.plan.value, A.anchor).grid === qe(e.plan.value, M, A.anchor).grid;
|
|
3347
|
-
n.value = { anchor: N ? A.anchor : { ...M }, focus: { ...M } }, m(), w.focus({ preventScroll: !0 });
|
|
3348
|
-
}
|
|
3349
|
-
function b(C) {
|
|
3350
|
-
const O = e.plan.value?.pages[C.pageIndex]?.components[C.componentIndex];
|
|
3351
|
-
return O?.grid ? cn(O.grid, O.widthMm, O.heightMm).cells.map((w) => ({ ...C, rowIndex: w.ri, columnIndex: w.ci })) : [];
|
|
3352
|
-
}
|
|
3353
|
-
function f(C, O, w) {
|
|
3354
|
-
const M = b(C), A = w ? -1 : 1;
|
|
3355
|
-
if (O === "Tab") return M[M.findIndex((W) => Ri(W, C)) + A];
|
|
3356
|
-
const N = O === "ArrowUp" || O === "ArrowDown" || O === "Enter", J = O === "ArrowUp" || O === "ArrowLeft" ? -1 : A;
|
|
3357
|
-
return M.filter((W) => N ? W.columnIndex === C.columnIndex && (W.rowIndex - C.rowIndex) * J > 0 : W.rowIndex === C.rowIndex && (W.columnIndex - C.columnIndex) * J > 0).sort((W, X) => N ? (W.rowIndex - X.rowIndex) * J : (W.columnIndex - X.columnIndex) * J)[0];
|
|
3358
|
-
}
|
|
3359
|
-
function R(C, O, w) {
|
|
3360
|
-
if (O === "ArrowLeft" || O === "ArrowRight") return;
|
|
3361
|
-
const M = e.plan.value;
|
|
3362
|
-
if (!M.pages[C.pageIndex]?.components[C.componentIndex]?.table) return;
|
|
3363
|
-
const N = O === "ArrowUp" || w ? -1 : 1;
|
|
3364
|
-
for (let J = C.pageIndex; J >= 0 && J < M.pages.length; J += N) {
|
|
3365
|
-
const W = M.pages[J].components, X = J === C.pageIndex ? C.componentIndex + N : N === 1 ? 0 : W.length - 1;
|
|
3366
|
-
for (let Y = X; Y >= 0 && Y < W.length; Y += N) {
|
|
3367
|
-
const oe = p(C, { ...C, pageIndex: J, componentIndex: Y }, O, N);
|
|
3368
|
-
if (oe) return oe;
|
|
3369
|
-
}
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
function p(C, O, w, M) {
|
|
3373
|
-
const A = e.plan.value, N = A.pages[C.pageIndex].components[C.componentIndex].table, J = A.pages[O.pageIndex].components[O.componentIndex]?.table;
|
|
3374
|
-
if (J?.id !== N.id || J.role === "header" && N.role !== "header" && (M > 0 || N.rowIndex + C.rowIndex > 0)) return;
|
|
3375
|
-
const W = b(O), X = w === "Tab" ? W : W.filter((Y) => Y.columnIndex === C.columnIndex);
|
|
3376
|
-
return M === 1 ? X[0] : X[X.length - 1];
|
|
3377
|
-
}
|
|
3378
|
-
function S(C, O, w = !1, M = !1, A = !1) {
|
|
3379
|
-
const N = f(C, O, w) ?? R(C, O, w);
|
|
3380
|
-
return N ? (I(N, M), !0) : ((O !== "Tab" || !A) && I(C), !1);
|
|
3381
|
-
}
|
|
3382
|
-
function z(C) {
|
|
3383
|
-
const O = n.value;
|
|
3384
|
-
if (e.busy() || C.target instanceof Element && C.target.closest("textarea,input,select,button,a[href],[contenteditable]")) return !1;
|
|
3385
|
-
if (!O) return V(C);
|
|
3386
|
-
const w = C.key;
|
|
3387
|
-
if (F(C) || B(C, O.focus)) return !0;
|
|
3388
|
-
if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Enter"].includes(w)) return !1;
|
|
3389
|
-
const M = S(O.focus, w, w === "Tab" && C.shiftKey, C.shiftKey && w !== "Tab", !0);
|
|
3390
|
-
if (w === "Tab" && !M) {
|
|
3391
|
-
const A = e.root.value?.ownerDocument.activeElement;
|
|
3392
|
-
if (!(A instanceof HTMLElement) || !Ei(A, C.shiftKey)) return !1;
|
|
3393
|
-
}
|
|
3394
|
-
return C.preventDefault(), !0;
|
|
3395
|
-
}
|
|
3396
|
-
function F(C) {
|
|
3397
|
-
if (!t() || !(C.ctrlKey || C.metaKey)) return !1;
|
|
3398
|
-
const O = C.key.toLowerCase();
|
|
3399
|
-
return O !== "z" && O !== "y" ? !1 : (C.preventDefault(), O === "y" || C.shiftKey ? e.redo() : e.undo(), !0);
|
|
3400
|
-
}
|
|
3401
|
-
function B(C, O) {
|
|
3402
|
-
if (!t() || !e.plan.value || C.key !== "F2" && !(C.key === "Enter" && at(e.plan.value, O)?.editable)) return !1;
|
|
3403
|
-
const w = e.root.value?.querySelector(Zt(O));
|
|
3404
|
-
return w && (C.preventDefault(), e.edit(w)), !0;
|
|
3405
|
-
}
|
|
3406
|
-
function V(C) {
|
|
3407
|
-
if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft", "Enter"].includes(C.key)) return !1;
|
|
3408
|
-
const O = e.root.value?.querySelector("td[data-mr-row-index]"), w = O && an(O);
|
|
3409
|
-
return w ? (C.preventDefault(), I(w), !0) : !1;
|
|
3410
|
-
}
|
|
3411
|
-
function _() {
|
|
3412
|
-
const C = n.value, O = e.plan.value;
|
|
3413
|
-
if (!C || !O) return "";
|
|
3414
|
-
const w = [], M = qe(O, C.anchor), A = qe(O, C.focus, C.anchor), N = Wn(O, C.anchor), J = Ct(O), W = Math.min(M.column, A.column), X = Math.max(M.column, A.column);
|
|
3415
|
-
if ((Math.abs(M.row - A.row) + 1) * (X - W + 1) > 1e4)
|
|
3416
|
-
return e.error(new Ae("limit")), "";
|
|
3417
|
-
for (let Y = Math.min(M.row, A.row); Y <= Math.max(M.row, A.row); Y++) {
|
|
3418
|
-
const oe = [];
|
|
3419
|
-
for (let K = W; K <= X; K++) {
|
|
3420
|
-
const ke = N(Y, K);
|
|
3421
|
-
oe.push(ke ? J(ke)?.cell.text ?? "" : "");
|
|
3422
|
-
}
|
|
3423
|
-
w.push(oe);
|
|
3424
|
-
}
|
|
3425
|
-
return to(w);
|
|
3426
|
-
}
|
|
3427
|
-
function Z(C) {
|
|
3428
|
-
!n.value || C.target instanceof Element && C.target.closest("textarea,input,select") || (C.clipboardData?.setData("text/plain", _()), C.preventDefault());
|
|
3429
|
-
}
|
|
3430
|
-
async function ne(C) {
|
|
3431
|
-
const O = n.value;
|
|
3432
|
-
if (!O || !t() || e.busy()) return !1;
|
|
3433
|
-
try {
|
|
3434
|
-
let w;
|
|
3435
|
-
try {
|
|
3436
|
-
w = eo(C);
|
|
3437
|
-
} catch (X) {
|
|
3438
|
-
throw new Ae(X instanceof Error && X.message.includes("limit") ? "limit" : "clipboard");
|
|
3439
|
-
}
|
|
3440
|
-
const M = e.plan.value, A = qe(M, O.anchor), N = qe(M, O.focus, O.anchor), J = Wn(M, O.anchor), W = w.flatMap((X, Y) => X.map((oe, K) => {
|
|
3441
|
-
const ke = J(Math.min(A.row, N.row) + Y, Math.min(A.column, N.column) + K);
|
|
3442
|
-
if (!ke) throw new Ae("missing");
|
|
3443
|
-
return { address: ke, value: oe };
|
|
3444
|
-
}));
|
|
3445
|
-
return await e.apply(W);
|
|
3446
|
-
} catch (w) {
|
|
3447
|
-
return e.error(w), !1;
|
|
3448
|
-
}
|
|
3449
|
-
}
|
|
3450
|
-
function ce(C) {
|
|
3451
|
-
if (!n.value || !t() || C.target instanceof Element && C.target.closest("textarea,input,select,button,a[href],[contenteditable]") || !C.clipboardData?.types.includes("text/plain")) return;
|
|
3452
|
-
const O = C.clipboardData?.getData("text/plain");
|
|
3453
|
-
O && (C.preventDefault(), ne(O));
|
|
3454
|
-
}
|
|
3455
|
-
async function Re(C) {
|
|
3456
|
-
const O = e.plan.value;
|
|
3457
|
-
if (!O) return !1;
|
|
3458
|
-
const w = Ct(O);
|
|
3459
|
-
for (let M = 0; M < O.pages.length; M++) {
|
|
3460
|
-
const A = O.pages[M];
|
|
3461
|
-
if (!(C.reportScope !== void 0 && A.meta?.reportScope !== C.reportScope))
|
|
3462
|
-
for (let N = 0; N < A.components.length; N++)
|
|
3463
|
-
for (const J of b({ pageIndex: M, componentIndex: N, rowIndex: 0, columnIndex: 0 })) {
|
|
3464
|
-
const W = w(J);
|
|
3465
|
-
if (Ii(W, C))
|
|
3466
|
-
return I(J);
|
|
3467
|
-
}
|
|
3468
|
-
}
|
|
3469
|
-
return !1;
|
|
3470
|
-
}
|
|
3471
|
-
function ge() {
|
|
3472
|
-
n.value = null, m();
|
|
3473
|
-
}
|
|
3474
|
-
return { selection: n, refresh: m, reset: ge, focusCell: I, focusField: Re, navigate: S, onClick: k, onKeydown: z, onCopy: Z, onPaste: ce, copySelection: _, pasteSelection: ne };
|
|
3475
|
-
}
|
|
3476
|
-
function Fi(e) {
|
|
3477
|
-
let t = 0, n = !1;
|
|
3478
|
-
function o() {
|
|
3479
|
-
const a = e.viewport.value, r = e.root.value, l = e.plan.value;
|
|
3480
|
-
if (!a || !r || !l) return;
|
|
3481
|
-
const i = e.options(), m = Math.max(0, Math.min(20, Math.floor(i.frozenColumns ?? 0)));
|
|
3482
|
-
if (!i.freezeHeaders && m === 0 && !n) return;
|
|
3483
|
-
const v = e.zoom.value || 1, d = a.getBoundingClientRect();
|
|
3484
|
-
r.querySelectorAll("[data-mr-component-index]").forEach((g) => {
|
|
3485
|
-
const I = g.closest("[data-page]"), k = Number(I?.dataset.page) - 1, b = l.pages[k]?.components[Number(g.dataset.mrComponentIndex)];
|
|
3486
|
-
if (!b?.grid || !I) return;
|
|
3487
|
-
g.style.transform = "", g.style.zIndex = "";
|
|
3488
|
-
const f = g.getBoundingClientRect(), R = I.getBoundingClientRect().bottom, p = Math.max(0, (d.left - f.left) / v), S = i.freezeHeaders ? Math.max(0, Math.min((d.top - f.top) / v, (R - f.bottom) / v)) : 0;
|
|
3489
|
-
p > 0 && m > 0 && (g.style.zIndex = "1"), b.table?.role === "header" && S > 0 && (g.style.transform = `translateY(${S}px)`, g.style.zIndex = "5"), g.querySelectorAll(".mrp-cell-frozen").forEach((F) => {
|
|
3490
|
-
F.style.transform = "", F.style.zIndex = "", F.classList.remove("mrp-cell-frozen");
|
|
3491
|
-
});
|
|
3492
|
-
const z = Array.from({ length: m }, (F, B) => `td[data-mr-column-index="${B}"]`);
|
|
3493
|
-
!b.table && i.freezeHeaders && z.push('td[data-mr-row-index="0"]'), z.length && g.querySelectorAll(z.join(",")).forEach((F) => {
|
|
3494
|
-
const B = Number(F.dataset.mrColumnIndex) < m, V = !b.table && Number(F.dataset.mrRowIndex) === 0 && !!i.freezeHeaders, _ = B ? p : 0, Z = V ? S : 0;
|
|
3495
|
-
F.style.transform = _ || Z ? `translate(${_}px, ${Z}px)` : "", F.classList.toggle("mrp-cell-frozen", !!(_ || Z)), F.style.zIndex = _ || Z ? V ? "7" : "6" : "";
|
|
3496
|
-
});
|
|
3497
|
-
}), n = !!i.freezeHeaders || m > 0;
|
|
3498
|
-
}
|
|
3499
|
-
function s() {
|
|
3500
|
-
t || (t = requestAnimationFrame(() => {
|
|
3501
|
-
t = 0, o();
|
|
3502
|
-
}));
|
|
3503
|
-
}
|
|
3504
|
-
return Ue(() => {
|
|
3505
|
-
t && cancelAnimationFrame(t);
|
|
3506
|
-
}), { refresh: o, schedule: s };
|
|
3507
|
-
}
|
|
3508
|
-
async function sa(e, t, n, o) {
|
|
3509
|
-
if (!t?.assetRenderers || !Object.keys(t.assetRenderers).length) return e;
|
|
3510
|
-
try {
|
|
3511
|
-
return (await no(e, { ...t, signal: n, format: "dom", onDiagnostic: (a) => {
|
|
3512
|
-
n.aborted || (t.onDiagnostic?.(a), o(a.message));
|
|
3513
|
-
} })).plan;
|
|
3514
|
-
} catch (s) {
|
|
3515
|
-
throw n.aborted ? s : new st("render", s instanceof Error ? s.message : "Report asset preparation failed", s);
|
|
3516
|
-
}
|
|
3517
|
-
}
|
|
3518
|
-
function ra(e, t) {
|
|
3519
|
-
const n = oo(e);
|
|
3520
|
-
if (!n.ok) throw new st("validate", `渲染计划校验失败(${n.errors.length} 处): ${n.errors.slice(0, 3).map((o) => `${o.path}: ${o.message}`).join("; ")}`);
|
|
3521
|
-
n.warnings.forEach((o) => t(`${o.path}: ${o.message}`));
|
|
3522
|
-
}
|
|
3523
|
-
async function zi(e, t, n, o) {
|
|
3524
|
-
const s = await He(e(t), t.signal);
|
|
3525
|
-
return ye(t.signal), o("validate"), ra(s, t.onWarning ?? (() => {
|
|
3526
|
-
})), ye(t.signal), o("assets"), sa(s, n, t.signal, t.onWarning ?? (() => {
|
|
3527
|
-
}));
|
|
3528
|
-
}
|
|
3529
|
-
async function Li(e, t, n, o, s, a) {
|
|
3530
|
-
const { importExcelTemplate: r } = await import("@agile-team/mach-report/xlsx");
|
|
3531
|
-
ye(o);
|
|
3532
|
-
const l = await He(r(e, { ...t, signal: o }), o);
|
|
3533
|
-
a("layout");
|
|
3534
|
-
const i = ao(Oe(l.template), {}).plan;
|
|
3535
|
-
ra(i, s), ye(o), a("assets");
|
|
3536
|
-
const m = await sa(i, n, o, s);
|
|
3537
|
-
return { result: l, plan: m };
|
|
3538
|
-
}
|
|
3539
|
-
const Ni = {
|
|
3540
|
-
key: 7,
|
|
3541
|
-
class: "mrp-edit-hint",
|
|
3542
|
-
role: "status"
|
|
3543
|
-
}, qi = {
|
|
3544
|
-
key: 9,
|
|
3545
|
-
class: "mrp-export-notice mrp-export-warning",
|
|
3546
|
-
role: "status"
|
|
3547
|
-
}, Ki = { class: "mrp-main" }, Bi = {
|
|
3548
|
-
key: 0,
|
|
3549
|
-
class: "mrp-state"
|
|
3550
|
-
}, ji = {
|
|
3551
|
-
key: 1,
|
|
3552
|
-
class: "mrp-state mrp-error"
|
|
3553
|
-
}, Hi = ["data-page"], Wi = ["aria-label", "aria-current", "onClick"], Ui = ["data-thumb"], Vi = { class: "mrp-thumb-no" }, Ji = {
|
|
3554
|
-
key: 10,
|
|
3555
|
-
class: "mrp-footer"
|
|
3556
|
-
}, Gi = { class: "mrp-footer-context" }, Yi = ["aria-label"], Zi = { key: 0 }, Xi = { class: "mrp-overlay" }, Qi = {
|
|
3557
|
-
key: 11,
|
|
3558
|
-
class: "mrp-debug",
|
|
3559
|
-
"aria-hidden": "true"
|
|
3560
|
-
}, Qt = 96 / 25.4, _t = "mach-report:ui", en = "mach-report:ui:wide", _i = /* @__PURE__ */ we({
|
|
3561
|
-
__name: "ReportPreview",
|
|
3562
|
-
props: {
|
|
3563
|
-
reportId: {
|
|
3564
|
-
type: [String, Array],
|
|
3565
|
-
default: null
|
|
3566
|
-
},
|
|
3567
|
-
params: {
|
|
3568
|
-
type: Object,
|
|
3569
|
-
default: () => ({})
|
|
3570
|
-
},
|
|
3571
|
-
height: { type: String, default: "100vh" },
|
|
3572
|
-
autoLoad: { type: Boolean, default: !0 },
|
|
3573
|
-
/** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
|
|
3574
|
-
showExport: { type: Boolean, default: void 0 },
|
|
3575
|
-
showPrint: { type: Boolean, default: void 0 },
|
|
3576
|
-
showPdfWindow: { type: Boolean, default: void 0 },
|
|
3577
|
-
showSettings: { type: Boolean, default: void 0 },
|
|
3578
|
-
toolbar: { type: Object, default: void 0 },
|
|
3579
|
-
interaction: { type: Object, default: void 0 },
|
|
3580
|
-
preferences: { type: Object, default: void 0 },
|
|
3581
|
-
guardChanges: { type: Boolean, default: void 0 },
|
|
3582
|
-
beforeDiscard: { type: Function, default: void 0 },
|
|
3583
|
-
output: { type: Object, default: void 0 },
|
|
3584
|
-
assets: { type: Object, default: void 0 },
|
|
3585
|
-
printOptions: { type: Object, default: void 0 },
|
|
3586
|
-
/** 保留表头的零行业务结果;不改变计划和导出内容。 */
|
|
3587
|
-
emptyState: { type: [Boolean, Object], default: !1 },
|
|
3588
|
-
/** 页间距(px);不传走配置中心 */
|
|
3589
|
-
gapPx: { type: Number, default: void 0 },
|
|
3590
|
-
/** 工具栏/状态文案覆写(不传走配置中心 messages) */
|
|
3591
|
-
messages: { type: Object, default: void 0 },
|
|
3592
|
-
/** 启用的 preset 名(不传用配置中心 defaultPreset) */
|
|
3593
|
-
preset: { type: String, default: void 0 },
|
|
3594
|
-
/** 调试面板(也可用 URL ?mrp-debug=1 开启) */
|
|
3595
|
-
debug: { type: Boolean, default: !1 },
|
|
3596
|
-
/** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
|
|
3597
|
-
paramDefs: {
|
|
3598
|
-
type: Array,
|
|
3599
|
-
default: void 0
|
|
3600
|
-
},
|
|
3601
|
-
/** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
|
|
3602
|
-
showParams: { type: Boolean, default: void 0 },
|
|
3603
|
-
editable: { type: [Boolean, Object], default: void 0 },
|
|
3604
|
-
excelImport: { type: [Boolean, Object], default: void 0 },
|
|
3605
|
-
fetcher: {
|
|
3606
|
-
type: Function,
|
|
3607
|
-
default: null
|
|
3608
|
-
}
|
|
3609
|
-
},
|
|
3610
|
-
emits: ["loaded", "task", "diagnostic", "error", "warning", "cell-edit", "template-import", "preferences-change"],
|
|
3611
|
-
setup(e, { expose: t, emit: n }) {
|
|
3612
|
-
const o = e, s = n, a = fe(null), r = G(!1), l = G(""), i = fe(null), m = G(null), v = G(!1), d = G(null), g = G(1), I = G(null), k = G(null), b = G(null), f = G(!1), R = G(!1), p = G(!1), S = G("general"), z = fe(null), F = G(null), B = G(null), V = Ho();
|
|
3613
|
-
let _ = null, Z = !1;
|
|
3614
|
-
const ne = hl((u) => s("task", u)), ce = bl((u) => s("diagnostic", u)), Re = D(() => ce.entries.value.filter((u) => u.valueState && u.target)), ge = D(() => ce.entries.value.filter((u) => !u.valueState)), C = fe(null), O = D(() => !!a.value?.pages.length && a.value.pages.every((u) => u.layout === "wide"));
|
|
3615
|
-
let w = _t;
|
|
3616
|
-
const M = Fn(yo, null), A = Fn(wo, null), N = D(() => Zn(o.reportId)), J = D(() => o.fetcher ?? M), W = D(() => a.value?.pages.length ?? 0), X = D(() => Object.freeze({
|
|
3617
|
-
loading: r.value,
|
|
3618
|
-
hasPlan: W.value > 0,
|
|
3619
|
-
pageCount: W.value,
|
|
3620
|
-
currentPage: g.value,
|
|
3621
|
-
exporting: m.value,
|
|
3622
|
-
printing: v.value,
|
|
3623
|
-
canExport: !r.value && !R.value && !U.saving.value && W.value > 0 && m.value === null,
|
|
3624
|
-
canPrint: !r.value && !R.value && !U.saving.value && W.value > 0 && !v.value,
|
|
3625
|
-
error: i.value,
|
|
3626
|
-
pdfFont: mn.value,
|
|
3627
|
-
editing: U.active.value !== null,
|
|
3628
|
-
saving: U.saving.value,
|
|
3629
|
-
importing: R.value,
|
|
3630
|
-
dirty: U.differences.value.length > 0,
|
|
3631
|
-
pendingLocalChanges: U.pendingLocalChanges.value,
|
|
3632
|
-
task: ne.state.value,
|
|
3633
|
-
diagnostics: ce.entries.value,
|
|
3634
|
-
reportIds: C.value?.reportIds ?? [],
|
|
3635
|
-
params: C.value?.params ?? {},
|
|
3636
|
-
canUndo: U.canUndo.value,
|
|
3637
|
-
canRedo: U.canRedo.value,
|
|
3638
|
-
changeCount: U.differences.value.length,
|
|
3639
|
-
selection: le.selection.value ? Oe(le.selection.value) : null
|
|
3640
|
-
}));
|
|
3641
|
-
function Y(u, E, L) {
|
|
3642
|
-
i.value = Object.freeze({ message: u, code: E, cause: L }), s("error", u, { code: E, cause: L });
|
|
3643
|
-
}
|
|
3644
|
-
const {
|
|
3645
|
-
resolved: oe,
|
|
3646
|
-
resolvedMessages: K,
|
|
3647
|
-
effectiveShowExport: ke,
|
|
3648
|
-
effectiveShowSettings: Ke,
|
|
3649
|
-
effectiveGuardChanges: Fe,
|
|
3650
|
-
effectiveOutput: Ve,
|
|
3651
|
-
effectiveInteraction: $,
|
|
3652
|
-
effectiveAssets: T,
|
|
3653
|
-
effectiveGapPx: H,
|
|
3654
|
-
effectiveShowParams: j,
|
|
3655
|
-
availableTools: Q,
|
|
3656
|
-
tools: se,
|
|
3657
|
-
toolState: te,
|
|
3658
|
-
visibleExportFormats: Me,
|
|
3659
|
-
effectiveEditable: Te,
|
|
3660
|
-
effectiveExcelImport: Ye,
|
|
3661
|
-
persistedEditing: dn,
|
|
3662
|
-
emptyStateContent: Ot,
|
|
3663
|
-
sessionInteraction: Dt
|
|
3664
|
-
} = $i(o, O, (u) => s("warning", u)), bt = G(), At = D(() => ({ ...oe.value.printOptions, ...o.printOptions, calibration: bt.value ?? { ...oe.value.printOptions?.calibration, ...o.printOptions?.calibration } }));
|
|
3665
|
-
de([() => o.printOptions, () => oe.value.printOptions], () => {
|
|
3666
|
-
bt.value = void 0;
|
|
3667
|
-
});
|
|
3668
|
-
let lt;
|
|
3669
|
-
const fn = D(() => te.value.pdf || te.value.pdfWindow), Ft = D(() => $.value.calculations === !0), zt = D(() => co(K.value)), { pdfFont: mn, getPdfExporter: la, checkPdfFont: ia, retryPdfFont: gn, cancelFontCheck: ua } = gl({
|
|
3670
|
-
plan: a,
|
|
3671
|
-
fontUrl: () => oe.value.pdfFontUrl,
|
|
3672
|
-
enabled: () => fn.value,
|
|
3673
|
-
injectedExporter: A,
|
|
3674
|
-
destroyed: () => Z
|
|
3675
|
-
});
|
|
3676
|
-
async function ca(u, E) {
|
|
3677
|
-
u === "editing" && !E && !await U.settle() || (se.setEnabled(u, E), s("preferences-change", Object.freeze({ ...te.value })));
|
|
3678
|
-
}
|
|
3679
|
-
async function da() {
|
|
3680
|
-
await U.settle() && (se.reset(), Dt.value = {}, bt.value = void 0, s("preferences-change", Object.freeze({ ...te.value })));
|
|
3681
|
-
}
|
|
3682
|
-
async function vn(u = "general") {
|
|
3683
|
-
if (p.value) {
|
|
3684
|
-
p.value = !1;
|
|
3685
|
-
return;
|
|
3686
|
-
}
|
|
3687
|
-
const E = U.settle();
|
|
3688
|
-
!(typeof E == "boolean" ? E : await E) || Z || !Ke.value || (S.value = u, p.value = !0);
|
|
3689
|
-
}
|
|
3690
|
-
function pn(u) {
|
|
3691
|
-
return u instanceof Ae ? {
|
|
3692
|
-
number: K.value.editInvalidNumber,
|
|
3693
|
-
boolean: K.value.editInvalidBoolean,
|
|
3694
|
-
conflict: K.value.editConflict,
|
|
3695
|
-
atomic: K.value.editAtomicRequired,
|
|
3696
|
-
limit: K.value.clipboardLimit,
|
|
3697
|
-
readonly: K.value.editReadOnly,
|
|
3698
|
-
missing: K.value.editMissing,
|
|
3699
|
-
recalculation: K.value.editRecalculationUnavailable,
|
|
3700
|
-
duplicate: K.value.editDuplicate,
|
|
3701
|
-
clipboard: K.value.clipboardInvalid
|
|
3702
|
-
}[u.code] ?? u.message : u instanceof Error ? u.message : "单元格保存失败";
|
|
3703
|
-
}
|
|
3704
|
-
const U = xi({
|
|
3705
|
-
plan: a,
|
|
3706
|
-
options: Te,
|
|
3707
|
-
blocked: () => r.value || R.value || m.value !== null || v.value || ze.pending.value,
|
|
3708
|
-
label: () => K.value.editCell ?? "编辑单元格",
|
|
3709
|
-
errorMessage: pn,
|
|
3710
|
-
suspendBlur: () => ze.request.value !== null,
|
|
3711
|
-
onChange: (u) => {
|
|
3712
|
-
i.value = null, d.value = null, s("cell-edit", u);
|
|
3713
|
-
},
|
|
3714
|
-
onError: (u, E) => {
|
|
3715
|
-
d.value = { kind: "error", message: u }, Y(u, "edit", E);
|
|
3716
|
-
},
|
|
3717
|
-
onNavigate: (u, E, L) => le.navigate(u, E, L)
|
|
3718
|
-
}), le = Ai({
|
|
3719
|
-
plan: a,
|
|
3720
|
-
root: I,
|
|
3721
|
-
enabled: () => !!Te.value || Ft.value,
|
|
3722
|
-
editable: () => !!Te.value,
|
|
3723
|
-
busy: () => r.value || R.value || U.saving.value || !!m.value || v.value || ze.pending.value,
|
|
3724
|
-
differences: () => U.differences.value,
|
|
3725
|
-
gotoPage: Ee,
|
|
3726
|
-
edit: U.editCell,
|
|
3727
|
-
apply: U.apply,
|
|
3728
|
-
undo: U.undo,
|
|
3729
|
-
redo: U.redo,
|
|
3730
|
-
error: (u) => {
|
|
3731
|
-
const E = pn(u);
|
|
3732
|
-
d.value = { kind: "error", message: E }, Y(E, "edit", u);
|
|
3733
|
-
}
|
|
3734
|
-
}), Lt = or({ plan: a, selection: le.selection, enabled: () => Ft.value });
|
|
3735
|
-
function fa() {
|
|
3736
|
-
vn("advanced");
|
|
3737
|
-
}
|
|
3738
|
-
const ze = vl({
|
|
3739
|
-
pending: () => U.pendingLocalChanges.value,
|
|
3740
|
-
reportIds: () => C.value?.reportIds ?? N.value,
|
|
3741
|
-
hook: () => o.beforeDiscard ?? oe.value.beforeDiscard,
|
|
3742
|
-
enabled: () => Fe.value,
|
|
3743
|
-
snapshot: () => [a.value, U.active.value?.editor.input.value],
|
|
3744
|
-
error: (u) => Y(u instanceof Error ? u.message : "修改保护回调失败", "config", u)
|
|
3745
|
-
});
|
|
3746
|
-
async function ma(u = "leave") {
|
|
3747
|
-
return ze.check(u);
|
|
3748
|
-
}
|
|
3749
|
-
function hn(u) {
|
|
3750
|
-
!Fe.value || !U.pendingLocalChanges.value || (u.preventDefault(), u.returnValue = "");
|
|
3751
|
-
}
|
|
3752
|
-
function bn() {
|
|
3753
|
-
ne.cancel();
|
|
3754
|
-
}
|
|
3755
|
-
function ga(u) {
|
|
3756
|
-
const E = U.resolveAddress(u);
|
|
3757
|
-
E && le.focusCell(E);
|
|
3758
|
-
}
|
|
3759
|
-
async function yn(u) {
|
|
3760
|
-
await le.focusField(u) || (d.value = { kind: "warning", message: K.value.locateFieldMissing ?? "Field not found" });
|
|
3761
|
-
}
|
|
3762
|
-
function va(u) {
|
|
3763
|
-
if (u.pageIndex === void 0) return;
|
|
3764
|
-
Ee(u.pageIndex + 1);
|
|
3765
|
-
const E = u.componentPath;
|
|
3766
|
-
u.componentIndex !== void 0 && E && E.length === 2 && le.focusCell({ pageIndex: u.pageIndex, componentIndex: u.componentIndex, rowIndex: E[0], columnIndex: E[1] });
|
|
3767
|
-
}
|
|
3768
|
-
function Nt(u) {
|
|
3769
|
-
const E = a.value;
|
|
3770
|
-
if (!E) return !1;
|
|
3771
|
-
const L = { excel: "xlsx", image: "png", doc: "word" }[u] ?? u, me = L === "pdf" ? "pdf" : L === "xlsx" ? "xlsx" : L === "png" ? "canvas" : "dom", re = ce.inspect(E, me);
|
|
3772
|
-
return a.value !== E ? !1 : re.length && Ve.value.fidelity === "strict" ? (d.value = { kind: "error", message: K.value.diagnosticsStrict ?? "输出存在已知降级" }, Y(d.value.message, "export", { diagnostics: re }), !1) : !0;
|
|
3773
|
-
}
|
|
3774
|
-
function pa(u) {
|
|
3775
|
-
return a.value ? ce.inspect(a.value, u) : [];
|
|
3776
|
-
}
|
|
3777
|
-
const yt = D(() => {
|
|
3778
|
-
if (z.value) return z.value.sheets.map((E) => ({ label: E.name, pageIndex: E.pageStart }));
|
|
3779
|
-
const u = /* @__PURE__ */ new Set();
|
|
3780
|
-
return a.value?.pages.flatMap((E, L) => E.components.flatMap((me) => {
|
|
3781
|
-
const re = me.table;
|
|
3782
|
-
return !re?.title || u.has(re.id) ? [] : (u.add(re.id), [{ label: re.title, pageIndex: L }]);
|
|
3783
|
-
})) ?? [];
|
|
3784
|
-
});
|
|
3785
|
-
async function wn(u) {
|
|
3786
|
-
u && !await le.focusField({ field: u }) && (d.value = { kind: "warning", message: K.value.locateFieldMissing ?? "Field not found" });
|
|
3787
|
-
}
|
|
3788
|
-
async function ha(u) {
|
|
3789
|
-
await le.focusField(u) || (d.value = { kind: "warning", message: K.value.locateFieldMissing ?? "Field not found" });
|
|
3790
|
-
}
|
|
3791
|
-
const qt = D(() => {
|
|
3792
|
-
try {
|
|
3793
|
-
return { defs: o.paramDefs ?? J.value?.getParamDefs?.(N.value) ?? [], error: null };
|
|
3794
|
-
} catch (u) {
|
|
3795
|
-
return { defs: [], error: new st("config", u instanceof Error ? u.message : "查询参数配置无效", u) };
|
|
3796
|
-
}
|
|
3797
|
-
}), Kt = D(() => qt.value.defs), it = fo({ defs: Kt, reportIds: N, params: () => o.params, messages: () => K.value }), { values: ut, attempted: wt, pendingRequired: xn } = it, kn = G(null);
|
|
3798
|
-
function ba() {
|
|
3799
|
-
wt.value = !0, it.validation.value.ok || We(() => kn.value?.focusInvalid()), Xe();
|
|
3800
|
-
}
|
|
3801
|
-
function ya() {
|
|
3802
|
-
it.reset(), l.value = "", i.value = null;
|
|
3803
|
-
}
|
|
3804
|
-
const wa = D(() => ({
|
|
3805
|
-
height: o.height,
|
|
3806
|
-
"--mrp-page-gap": `${Math.max(0, H.value)}px`,
|
|
3807
|
-
...mo(oe.value.theme)
|
|
3808
|
-
})), { zoom: Ce, zoomMode: ct, applyFitZoom: $n, setZoom: dt } = Co(() => ({
|
|
3809
|
-
viewport: k.value,
|
|
3810
|
-
pageWidthPx: Bt.contentSize.value.w || 210 * Qt
|
|
3811
|
-
})), Bt = ko(a, Ce, {
|
|
3812
|
-
pxPerMm: Qt,
|
|
3813
|
-
gapPx: H,
|
|
3814
|
-
overscan: D(() => oe.value.preview.overscanPages)
|
|
3815
|
-
}), { contentSize: jt, windowRange: ft, visiblePages: Cn, makeScrollHandler: xa, refreshViewport: En } = Bt, ka = xa(g, W), Ht = Fi({ root: I, viewport: k, plan: a, zoom: Ce, options: () => $.value });
|
|
3816
|
-
de([$, Ce], () => Ht.schedule(), { flush: "post" });
|
|
3817
|
-
function Wt(u) {
|
|
3818
|
-
dt(u * 100);
|
|
3819
|
-
}
|
|
3820
|
-
function Ze() {
|
|
3821
|
-
lt?.abort(), R.value = !1, U.reset(), le.reset(), z.value = null, Pn(), a.value = null, C.value = null, ce.reset(), g.value = 1, ue.reset();
|
|
3822
|
-
}
|
|
3823
|
-
let ve = 0, pe = null;
|
|
3824
|
-
function xt(u, E) {
|
|
3825
|
-
return u === ve && !E.signal.aborted && !Z;
|
|
3826
|
-
}
|
|
3827
|
-
function In() {
|
|
3828
|
-
k.value && (k.value.scrollTop = 0, k.value.scrollLeft = 0);
|
|
3829
|
-
}
|
|
3830
|
-
function $a(u, E) {
|
|
3831
|
-
for (const L of u) {
|
|
3832
|
-
if (E !== ve) return !1;
|
|
3833
|
-
s("warning", L);
|
|
3834
|
-
}
|
|
3835
|
-
return E === ve;
|
|
3836
|
-
}
|
|
3837
|
-
function Ca() {
|
|
3838
|
-
if (qt.value.error) {
|
|
3839
|
-
const E = qt.value.error;
|
|
3840
|
-
return Ze(), l.value = E.message, Y(E.message, E.code, E.cause), null;
|
|
3841
|
-
}
|
|
3842
|
-
const u = it.query();
|
|
3843
|
-
return u.params ? u.params : (Ze(), l.value = u.quiet ? "" : u.error.message, u.quiet || (wt.value = !0, Y(u.error.message, u.error.code, u.error.cause)), null);
|
|
3844
|
-
}
|
|
3845
|
-
async function Xe() {
|
|
3846
|
-
if (Z || Fe.value && U.pendingLocalChanges.value && !await ze.check("reload") || Z) return;
|
|
3847
|
-
const u = ++ve;
|
|
3848
|
-
R.value = !1, pe?.abort(), pe = null;
|
|
3849
|
-
const E = J.value;
|
|
3850
|
-
if (r.value = !1, i.value = null, N.value.length === 0) {
|
|
3851
|
-
l.value = "缺少报表 ID", Ze(), Y(l.value, "param");
|
|
3852
|
-
return;
|
|
3853
|
-
}
|
|
3854
|
-
if (!E) {
|
|
3855
|
-
l.value = "未提供渲染数据源 fetcher", Ze(), Y(l.value, "config");
|
|
3856
|
-
return;
|
|
3857
|
-
}
|
|
3858
|
-
const L = Ca();
|
|
3859
|
-
if (!L) return;
|
|
3860
|
-
r.value = !0, l.value = "", d.value = null, Ze();
|
|
3861
|
-
const me = V.start(), re = new AbortController();
|
|
3862
|
-
pe = re;
|
|
3863
|
-
const Ne = ne.start("query", "query", () => {
|
|
3864
|
-
pe === re && (re.abort(), ve++, pe = null, r.value = !1);
|
|
3865
|
-
}), mt = [...N.value], De = Object.freeze({ ...L }), Be = /* @__PURE__ */ new Set();
|
|
3866
|
-
function et(Ie) {
|
|
3867
|
-
u !== ve || re.signal.aborted || Be.has(Ie) || (Be.add(Ie), oe.value.logger.warn("[mach-report] 报表告警:", Ie), ce.add({ code: "layout", severity: "warning", message: Ie }), s("warning", Ie));
|
|
3868
|
-
}
|
|
3869
|
-
try {
|
|
3870
|
-
const Ie = await zi(E, {
|
|
3871
|
-
reportIds: mt,
|
|
3872
|
-
params: L,
|
|
3873
|
-
taskId: Ne.taskId,
|
|
3874
|
-
onEvent: (Je) => {
|
|
3875
|
-
u === ve && !re.signal.aborted && Ne.update(Je.stage, Je.completed, Je.total);
|
|
3876
|
-
},
|
|
3877
|
-
onQueryResult: (Je, La, Na) => {
|
|
3878
|
-
u === ve && !re.signal.aborted && ce.addMany(Ci(mt, Je, La.diagnostics ?? [], Na));
|
|
3879
|
-
},
|
|
3880
|
-
signal: re.signal,
|
|
3881
|
-
onWarning: et
|
|
3882
|
-
}, T.value, Ne.update);
|
|
3883
|
-
if (!xt(u, re) || (a.value = Ie, C.value = Object.freeze({ reportIds: Object.freeze(mt), params: De }), ce.inspect(Ie, "dom"), !xt(u, re))) return;
|
|
3884
|
-
Ne.finish(), g.value = 1, V.end(me), In();
|
|
3885
|
-
const tt = O.value ? en : _t;
|
|
3886
|
-
tt !== w && (w = tt, Jt()), ct.value === "fit" && $n(), s("loaded", Ie.pages.length);
|
|
3887
|
-
} catch (Ie) {
|
|
3888
|
-
if (u !== ve) return;
|
|
3889
|
-
if (re.signal.aborted) {
|
|
3890
|
-
Ne.finish("cancelled");
|
|
3891
|
-
return;
|
|
3892
|
-
}
|
|
3893
|
-
Ne.finish("failed");
|
|
3894
|
-
const tt = vo(Ie);
|
|
3895
|
-
l.value = tt.message;
|
|
3896
|
-
const Je = po(tt);
|
|
3897
|
-
Y(tt.message, Je.code, Je.cause);
|
|
3898
|
-
} finally {
|
|
3899
|
-
u === ve && (r.value = !1), pe === re && (pe = null);
|
|
3900
|
-
}
|
|
3901
|
-
}
|
|
3902
|
-
function Ee(u) {
|
|
3903
|
-
if (Z || W.value <= 0) return;
|
|
3904
|
-
const E = Math.max(1, Math.min(W.value, u));
|
|
3905
|
-
g.value = E;
|
|
3906
|
-
const L = k.value;
|
|
3907
|
-
L && (Bt.scrollToPage(L, E - 1), Fa.prioritize(E - 1));
|
|
3908
|
-
}
|
|
3909
|
-
const Qe = To(a, {
|
|
3910
|
-
getPdfExporter: la,
|
|
3911
|
-
beforeOutput: () => U.settle(),
|
|
3912
|
-
onTask: (u) => ne.receive(u, () => Qe.cancel()),
|
|
3913
|
-
onDiagnostic: ce.add,
|
|
3914
|
-
getXlsxOptions: () => oe.value.xlsx,
|
|
3915
|
-
getPrintOptions: () => At.value,
|
|
3916
|
-
getPrintMessages: () => K.value,
|
|
3917
|
-
onError: (u, E) => {
|
|
3918
|
-
d.value = { kind: "error", message: u }, Y(u, E ?? "print");
|
|
3919
|
-
},
|
|
3920
|
-
onWarning: (u) => {
|
|
3921
|
-
d.value = { kind: "warning", message: u }, ce.add({ code: "output", severity: "warning", message: u }), s("warning", u);
|
|
3922
|
-
},
|
|
3923
|
-
onBusy: (u) => {
|
|
3924
|
-
m.value = u, u ? d.value = {
|
|
3925
|
-
kind: "progress",
|
|
3926
|
-
message: K.value.exporting.replace("{format}", u)
|
|
3927
|
-
} : d.value?.kind === "progress" && (d.value = null);
|
|
3928
|
-
},
|
|
3929
|
-
onPrinting: (u) => {
|
|
3930
|
-
v.value = u;
|
|
3931
|
-
}
|
|
3932
|
-
}), { releasePrintFrame: Pn, dispose: Ea } = Qe, Sn = D(() => {
|
|
3933
|
-
const u = a.value?.pages[0];
|
|
3934
|
-
return !!u && !O.value && [u.pageWidthMm, u.pageHeightMm].every((E) => E >= 25 && E <= 600);
|
|
3935
|
-
});
|
|
3936
|
-
async function Ia() {
|
|
3937
|
-
if (!Sn.value || v.value || r.value || R.value) return;
|
|
3938
|
-
const u = a.value.pages[0];
|
|
3939
|
-
v.value = !0;
|
|
3940
|
-
const E = new AbortController();
|
|
3941
|
-
lt = E;
|
|
3942
|
-
try {
|
|
3943
|
-
await Mo([ul(u.pageWidthMm, u.pageHeightMm)], { printOptions: At.value, signal: E.signal, messages: K.value, onError: (L) => {
|
|
3944
|
-
d.value = { kind: "error", message: L };
|
|
3945
|
-
} });
|
|
3946
|
-
} catch {
|
|
3947
|
-
} finally {
|
|
3948
|
-
lt === E && (v.value = !1, lt = void 0);
|
|
3949
|
-
}
|
|
3950
|
-
}
|
|
3951
|
-
async function Rn() {
|
|
3952
|
-
if (r.value || R.value) return;
|
|
3953
|
-
const u = U.settle();
|
|
3954
|
-
(typeof u == "boolean" ? u : await u) && (i.value = null, Nt("html") && await Qe.print());
|
|
3955
|
-
}
|
|
3956
|
-
async function Mn(u) {
|
|
3957
|
-
if (r.value || R.value) return;
|
|
3958
|
-
const E = U.settle();
|
|
3959
|
-
(typeof E == "boolean" ? E : await E) && (i.value = null, Nt(u) && await Qe.exportAs(u));
|
|
3960
|
-
}
|
|
3961
|
-
function Tn() {
|
|
3962
|
-
if (r.value || R.value || U.active.value || U.saving.value) {
|
|
3963
|
-
d.value = { kind: "warning", message: K.value.editingHint ?? "请先确认单元格修改" };
|
|
3964
|
-
return;
|
|
3965
|
-
}
|
|
3966
|
-
i.value = null, Nt("pdf") && Qe.openPdfWindow();
|
|
3967
|
-
}
|
|
3968
|
-
async function Pa(u, E = {}) {
|
|
3969
|
-
Z || (ut.value = { ...ut.value, ...u }, E.reload !== !1 && (wt.value = !0, await Xe()));
|
|
3970
|
-
}
|
|
3971
|
-
const On = {
|
|
3972
|
-
reload: Xe,
|
|
3973
|
-
print: Rn,
|
|
3974
|
-
exportAs: Mn,
|
|
3975
|
-
openPdfWindow: Tn,
|
|
3976
|
-
gotoPage: Ee,
|
|
3977
|
-
setParams: Pa,
|
|
3978
|
-
checkPdfFont: ia,
|
|
3979
|
-
importExcel: Dn,
|
|
3980
|
-
getPlan: Sa,
|
|
3981
|
-
cancelTask: bn,
|
|
3982
|
-
confirmDiscard: ma,
|
|
3983
|
-
getOutputDiagnostics: pa,
|
|
3984
|
-
getChanges: U.getChanges,
|
|
3985
|
-
undo: U.undo,
|
|
3986
|
-
redo: U.redo,
|
|
3987
|
-
restoreChanges: U.restore,
|
|
3988
|
-
getDifferences: () => Oe(U.differences.value),
|
|
3989
|
-
getSelection: () => le.selection.value ? Oe(le.selection.value) : null,
|
|
3990
|
-
focusCell: le.focusCell,
|
|
3991
|
-
focusField: le.focusField,
|
|
3992
|
-
copySelection: le.copySelection,
|
|
3993
|
-
pasteSelection: le.pasteSelection,
|
|
3994
|
-
get state() {
|
|
3995
|
-
return X.value;
|
|
3996
|
-
}
|
|
3997
|
-
};
|
|
3998
|
-
Ha(xo, On);
|
|
3999
|
-
function Sa() {
|
|
4000
|
-
return a.value ? Oe(a.value) : null;
|
|
4001
|
-
}
|
|
4002
|
-
function Ra(u) {
|
|
4003
|
-
const E = typeof Ye.value == "object" ? Ye.value : {};
|
|
4004
|
-
return { ...E, ...u, limits: { ...E.limits, ...u?.limits } };
|
|
4005
|
-
}
|
|
4006
|
-
function Ma(u, E) {
|
|
4007
|
-
U.reset(), le.reset(), Pn(), ue.reset(), a.value = u, C.value = null, ce.reset(), z.value = { sheets: Oe(E.sheets), warnings: [...E.warnings] }, g.value = 1, l.value = "", d.value = E.warnings.length ? { kind: "warning", message: E.warnings.join(";") } : null, In(), w = O.value ? en : _t, Jt(), ce.addMany(E.warnings.map((L) => ({ code: "excel-import", severity: "warning", message: L }))), a.value === u && ce.inspect(u, "dom");
|
|
4008
|
-
}
|
|
4009
|
-
async function Dn(u, E) {
|
|
4010
|
-
if (Z) throw new st("config", "报表预览已卸载");
|
|
4011
|
-
if (Fe.value && U.pendingLocalChanges.value && !await ze.check("import") || Z) return null;
|
|
4012
|
-
const L = ++ve;
|
|
4013
|
-
pe?.abort(), pe = null, r.value = !1, U.cancel(), Qe.invalidatePending(), R.value = !0;
|
|
4014
|
-
const me = new AbortController();
|
|
4015
|
-
pe = me, i.value = null, d.value = { kind: "progress", message: K.value.importing ?? "正在导入 Excel…" };
|
|
4016
|
-
const re = ne.start("import", "import", () => {
|
|
4017
|
-
pe === me && (me.abort(), ve++, pe = null, R.value = !1, d.value = null);
|
|
4018
|
-
}), Ne = Ra(E), mt = Gn(Ne.signal, me);
|
|
4019
|
-
try {
|
|
4020
|
-
const { result: De, plan: Be } = await Li(u, {
|
|
4021
|
-
...Ne,
|
|
4022
|
-
onProgress: (et, Ie) => {
|
|
4023
|
-
re.update("import", et, Ie), Ne.onProgress?.(et, Ie);
|
|
4024
|
-
}
|
|
4025
|
-
}, T.value, me.signal, (et) => {
|
|
4026
|
-
L === ve && s("warning", et);
|
|
4027
|
-
}, re.update);
|
|
4028
|
-
return !xt(L, me) || !$a(De.warnings, L) || (Ma(Be, De), !xt(L, me)) ? null : (re.finish(), s("template-import", De), L === ve && s("loaded", Be.pages.length), De);
|
|
4029
|
-
} catch (De) {
|
|
4030
|
-
if (L !== ve) return null;
|
|
4031
|
-
if (me.signal.aborted)
|
|
4032
|
-
return re.finish("cancelled"), null;
|
|
4033
|
-
re.finish("failed");
|
|
4034
|
-
const Be = new st("import", De instanceof Error ? De.message : "Excel 模板导入失败", De);
|
|
4035
|
-
throw d.value = { kind: "error", message: Be.message }, Y(Be.message, "import", De), Be;
|
|
4036
|
-
} finally {
|
|
4037
|
-
mt(), L === ve && (R.value = !1), pe === me && (pe = null);
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
function Ta(u) {
|
|
4041
|
-
const E = u.target, L = E.files?.[0];
|
|
4042
|
-
E.value = "", L && Dn(L).catch(() => {
|
|
4043
|
-
});
|
|
4044
|
-
}
|
|
4045
|
-
const ue = Ko({
|
|
4046
|
-
plan: a,
|
|
4047
|
-
gotoPage: Ee,
|
|
4048
|
-
debounceMs: D(() => oe.value.preview.searchDebounceMs),
|
|
4049
|
-
highlight: Do,
|
|
4050
|
-
clearHighlights: Oo
|
|
4051
|
-
});
|
|
4052
|
-
de(() => te.value.search, (u) => {
|
|
4053
|
-
u || (ue.reset(), ue.visible.value = !1);
|
|
4054
|
-
});
|
|
4055
|
-
function Oa(u) {
|
|
4056
|
-
!u.ctrlKey || !te.value.zoom || (u.preventDefault(), Wt(Ce.value * (u.deltaY < 0 ? 1.1 : 1 / 1.1)));
|
|
4057
|
-
}
|
|
4058
|
-
function Da(u) {
|
|
4059
|
-
if (!le.onKeydown(u) && !(u.target instanceof Element && u.target.closest("input,textarea,select,[contenteditable='true']"))) {
|
|
4060
|
-
if (te.value.search && (u.ctrlKey || u.metaKey) && u.key.toLowerCase() === "f") {
|
|
4061
|
-
u.preventDefault(), ue.visible.value || ue.toggle(), We(() => B.value?.focusSearch());
|
|
4062
|
-
return;
|
|
4063
|
-
}
|
|
4064
|
-
switch (u.key) {
|
|
4065
|
-
case "PageDown":
|
|
4066
|
-
u.preventDefault(), Ee(g.value + 1);
|
|
4067
|
-
break;
|
|
4068
|
-
case "PageUp":
|
|
4069
|
-
u.preventDefault(), Ee(g.value - 1);
|
|
4070
|
-
break;
|
|
4071
|
-
case "Home":
|
|
4072
|
-
u.preventDefault(), Ee(1);
|
|
4073
|
-
break;
|
|
4074
|
-
case "End":
|
|
4075
|
-
u.preventDefault(), Ee(W.value);
|
|
4076
|
-
break;
|
|
4077
|
-
case "+":
|
|
4078
|
-
case "=":
|
|
4079
|
-
u.preventDefault(), te.value.zoom && Wt(Ce.value * 1.1);
|
|
4080
|
-
break;
|
|
4081
|
-
case "-":
|
|
4082
|
-
u.preventDefault(), te.value.zoom && Wt(Ce.value / 1.1);
|
|
4083
|
-
break;
|
|
4084
|
-
}
|
|
4085
|
-
}
|
|
4086
|
-
}
|
|
4087
|
-
function Aa() {
|
|
4088
|
-
try {
|
|
4089
|
-
localStorage.setItem(
|
|
4090
|
-
w,
|
|
4091
|
-
JSON.stringify({ zoomMode: ct.value === "fit" ? "fit" : Math.round(Ce.value * 100) })
|
|
4092
|
-
);
|
|
4093
|
-
} catch {
|
|
4094
|
-
}
|
|
4095
|
-
}
|
|
4096
|
-
de([ct, Ce], Aa);
|
|
4097
|
-
let Ut = "";
|
|
4098
|
-
function An(u = !1) {
|
|
4099
|
-
const E = ue.activeMatch.value;
|
|
4100
|
-
if (!O.value || !E) return;
|
|
4101
|
-
const L = `${ue.query.value}:${ue.matchIndex.value}:${E.pageIndex}`;
|
|
4102
|
-
if (!u && L === Ut) return;
|
|
4103
|
-
const re = I.value?.querySelector(`[data-page="${E.pageIndex + 1}"]`)?.querySelectorAll("mark.mrp-hit")[E.occurrence];
|
|
4104
|
-
re && (re.scrollIntoView?.({ block: "nearest", inline: "nearest" }), Ut = L);
|
|
4105
|
-
}
|
|
4106
|
-
const Fa = $o({
|
|
4107
|
-
plan: a,
|
|
4108
|
-
root: I,
|
|
4109
|
-
pages: () => Cn.value,
|
|
4110
|
-
priority: () => ue.activeMatch.value?.pageIndex ?? g.value - 1,
|
|
4111
|
-
focusToken: () => ue.activeMatch.value,
|
|
4112
|
-
query: () => ue.query.value,
|
|
4113
|
-
zoom: () => Ce.value,
|
|
4114
|
-
loading: () => K.value.loading,
|
|
4115
|
-
clear: ue.clear,
|
|
4116
|
-
highlight: ue.apply,
|
|
4117
|
-
mounted: (u) => {
|
|
4118
|
-
le.refresh(u), Ht.schedule();
|
|
4119
|
-
},
|
|
4120
|
-
ready: () => {
|
|
4121
|
-
ue.activeMatch.value || (Ut = ""), An();
|
|
4122
|
-
},
|
|
4123
|
-
error: (u) => {
|
|
4124
|
-
l.value = u instanceof Error ? u.message : String(u), Y(l.value, "render", u);
|
|
4125
|
-
}
|
|
4126
|
-
});
|
|
4127
|
-
de(() => le.selection.value, () => {
|
|
4128
|
-
le.refresh();
|
|
4129
|
-
}, { flush: "post" }), de(() => ue.query.value, (u) => {
|
|
4130
|
-
u || I.value?.querySelectorAll(".mrp-page-holder").forEach((E) => {
|
|
4131
|
-
ue.clear(E);
|
|
4132
|
-
});
|
|
4133
|
-
});
|
|
4134
|
-
const Le = jo(a, {
|
|
4135
|
-
thumbsRoot: b,
|
|
4136
|
-
visible: f,
|
|
4137
|
-
renderThumbCanvas: (u) => {
|
|
4138
|
-
try {
|
|
4139
|
-
const E = a.value.pages[u], L = Math.min(0.2, 116 / Math.max(1, E.pageWidthMm * Qt)), { canvases: me } = so(a.value, { start: u, end: u, dpr: L });
|
|
4140
|
-
return me[0] ?? null;
|
|
4141
|
-
} catch {
|
|
4142
|
-
return null;
|
|
4143
|
-
}
|
|
4144
|
-
}
|
|
4145
|
-
});
|
|
4146
|
-
Wa(() => {
|
|
4147
|
-
Le.schedule();
|
|
4148
|
-
}, { flush: "post" });
|
|
4149
|
-
const za = D(() => o.debug), { debugStats: _e } = Bo(za, {
|
|
4150
|
-
plan: a,
|
|
4151
|
-
pageCount: W,
|
|
4152
|
-
windowRange: ft,
|
|
4153
|
-
zoom: Ce,
|
|
4154
|
-
loadMs: V.loadMs
|
|
4155
|
-
});
|
|
4156
|
-
function Vt() {
|
|
4157
|
-
En(k.value), Le.schedule(), ct.value === "fit" && $n(), An(!0);
|
|
4158
|
-
}
|
|
4159
|
-
function Jt() {
|
|
4160
|
-
dt(w === en ? 100 : "fit");
|
|
4161
|
-
try {
|
|
4162
|
-
const u = JSON.parse(localStorage.getItem(w) ?? "{}");
|
|
4163
|
-
u.zoomMode === "fit" ? dt("fit") : typeof u.zoomMode == "number" && dt(u.zoomMode);
|
|
4164
|
-
} catch {
|
|
4165
|
-
}
|
|
4166
|
-
}
|
|
4167
|
-
return St(() => {
|
|
4168
|
-
window.addEventListener("resize", Vt), window.addEventListener("beforeunload", hn), typeof ResizeObserver < "u" && k.value && (_ = new ResizeObserver(Vt), _.observe(k.value)), En(k.value), Jt(), o.autoLoad && Xe();
|
|
4169
|
-
}), ln(() => {
|
|
4170
|
-
Z = !0, lt?.abort(), ze.cancel(), ne.cancel(), U.reset(), R.value = !1, ua(), ve++, pe?.abort(), pe = null, window.removeEventListener("resize", Vt), window.removeEventListener("beforeunload", hn), _?.disconnect(), _ = null, Le.destroy(), ue.reset(), Ea();
|
|
4171
|
-
}), de(
|
|
4172
|
-
() => [JSON.stringify(N.value), JSON.stringify(o.params), J.value],
|
|
4173
|
-
async () => {
|
|
4174
|
-
if (o.autoLoad) {
|
|
4175
|
-
Xe();
|
|
4176
|
-
return;
|
|
4177
|
-
}
|
|
4178
|
-
!await ze.check("replace") || Z || (ve++, pe?.abort(), pe = null, r.value = !1, l.value = "", i.value = null, d.value = null, Ze());
|
|
4179
|
-
}
|
|
4180
|
-
), t({ ...On, state: X }), (u, E) => (x(), P("div", {
|
|
4181
|
-
class: $e(["mach-report-preview", { "mrp-wide-report": O.value }]),
|
|
4182
|
-
style: je(wa.value)
|
|
4183
|
-
}, [
|
|
4184
|
-
c(j) && Kt.value.length > 0 ? (x(), Se(go, {
|
|
4185
|
-
key: 0,
|
|
4186
|
-
ref_key: "paramPanelRef",
|
|
4187
|
-
ref: kn,
|
|
4188
|
-
defs: Kt.value,
|
|
4189
|
-
modelValue: c(ut),
|
|
4190
|
-
"onUpdate:modelValue": E[0] || (E[0] = (L) => Un(ut) ? ut.value = L : null),
|
|
4191
|
-
messages: c(K),
|
|
4192
|
-
attempted: c(wt),
|
|
4193
|
-
issues: c(it).validation.value.issues,
|
|
4194
|
-
onQuery: ba,
|
|
4195
|
-
onReset: ya
|
|
4196
|
-
}, null, 8, ["defs", "modelValue", "messages", "attempted", "issues"])) : q("", !0),
|
|
4197
|
-
ee(Rs, {
|
|
4198
|
-
ref_key: "toolbarRef",
|
|
4199
|
-
ref: B,
|
|
4200
|
-
"page-count": W.value,
|
|
4201
|
-
"current-page": g.value,
|
|
4202
|
-
"zoom-mode": c(ct),
|
|
4203
|
-
zoom: c(Ce),
|
|
4204
|
-
"show-export": c(ke),
|
|
4205
|
-
"show-print": c(te).print,
|
|
4206
|
-
"show-pdf-window": c(te).pdfWindow,
|
|
4207
|
-
"show-search": c(te).search,
|
|
4208
|
-
"show-thumbnails": c(te).thumbnails,
|
|
4209
|
-
"show-zoom": c(te).zoom,
|
|
4210
|
-
"export-formats": c(Me),
|
|
4211
|
-
"show-settings": c(Ke),
|
|
4212
|
-
"settings-open": p.value,
|
|
4213
|
-
messages: c(K),
|
|
4214
|
-
search: { visible: c(ue).visible.value, query: c(ue).query.value, matchIndex: c(ue).matchIndex.value, matchCount: c(ue).matchCount.value, searching: c(ue).searching.value },
|
|
4215
|
-
"thumbs-visible": f.value,
|
|
4216
|
-
"show-import": !!c(Ye),
|
|
4217
|
-
busy: r.value || R.value || c(U).saving.value,
|
|
4218
|
-
onGoto: Ee,
|
|
4219
|
-
onZoom: c(dt),
|
|
4220
|
-
onExport: E[1] || (E[1] = (L) => Mn(L)),
|
|
4221
|
-
onPrint: Rn,
|
|
4222
|
-
onPdfWindow: Tn,
|
|
4223
|
-
onSearchInput: c(ue).onInput,
|
|
4224
|
-
onSearchNav: c(ue).onNav,
|
|
4225
|
-
onSearchToggle: c(ue).toggle,
|
|
4226
|
-
onThumbsToggle: E[2] || (E[2] = (L) => f.value = !f.value),
|
|
4227
|
-
onImportExcel: E[3] || (E[3] = (L) => F.value?.click()),
|
|
4228
|
-
onSettingsToggle: vn
|
|
4229
|
-
}, Ua({ _: 2 }, [
|
|
4230
|
-
yt.value.length <= 1 ? {
|
|
4231
|
-
name: "navigation",
|
|
4232
|
-
fn: Gt(() => [
|
|
4233
|
-
W.value > 0 && c($).navigation !== !1 ? (x(), Se(jn, {
|
|
4234
|
-
key: 0,
|
|
4235
|
-
plan: a.value,
|
|
4236
|
-
compact: "",
|
|
4237
|
-
sections: yt.value,
|
|
4238
|
-
"current-page": g.value,
|
|
4239
|
-
messages: c(K),
|
|
4240
|
-
busy: r.value || R.value || c(U).saving.value,
|
|
4241
|
-
onLocateTarget: yn,
|
|
4242
|
-
onGoto: Ee,
|
|
4243
|
-
onLocate: wn
|
|
4244
|
-
}, null, 8, ["plan", "sections", "current-page", "messages", "busy"])) : q("", !0)
|
|
4245
|
-
]),
|
|
4246
|
-
key: "0"
|
|
4247
|
-
} : void 0
|
|
4248
|
-
]), 1032, ["page-count", "current-page", "zoom-mode", "zoom", "show-export", "show-print", "show-pdf-window", "show-search", "show-thumbnails", "show-zoom", "export-formats", "show-settings", "settings-open", "messages", "search", "thumbs-visible", "show-import", "busy", "onZoom", "onSearchInput", "onSearchNav", "onSearchToggle"]),
|
|
4249
|
-
c(ze).request.value ? (x(), Se(Fr, {
|
|
4250
|
-
key: 1,
|
|
4251
|
-
messages: c(K),
|
|
4252
|
-
onAnswer: c(ze).settle
|
|
4253
|
-
}, null, 8, ["messages", "onAnswer"])) : q("", !0),
|
|
4254
|
-
ee(Kr, {
|
|
4255
|
-
task: c(ne).state.value,
|
|
4256
|
-
messages: c(K),
|
|
4257
|
-
onCancel: bn
|
|
4258
|
-
}, null, 8, ["task", "messages"]),
|
|
4259
|
-
ee(Jr, {
|
|
4260
|
-
entries: ge.value,
|
|
4261
|
-
messages: c(K),
|
|
4262
|
-
onLocate: va
|
|
4263
|
-
}, null, 8, ["entries", "messages"]),
|
|
4264
|
-
ee(nl, {
|
|
4265
|
-
entries: Re.value,
|
|
4266
|
-
messages: c(K),
|
|
4267
|
-
busy: r.value || R.value || c(U).saving.value,
|
|
4268
|
-
onLocate: ha
|
|
4269
|
-
}, null, 8, ["entries", "messages", "busy"]),
|
|
4270
|
-
p.value && c(Ke) ? (x(), Se(Rr, {
|
|
4271
|
-
key: 2,
|
|
4272
|
-
available: c(Q),
|
|
4273
|
-
enabled: c(te),
|
|
4274
|
-
messages: c(K),
|
|
4275
|
-
"persisted-editing": c(dn),
|
|
4276
|
-
interaction: c($),
|
|
4277
|
-
section: S.value,
|
|
4278
|
-
busy: r.value || R.value || c(U).saving.value || !!m.value || v.value,
|
|
4279
|
-
onSection: E[5] || (E[5] = (L) => S.value = L),
|
|
4280
|
-
onInteraction: E[6] || (E[6] = (L) => Dt.value = { ...c(Dt), ...L }),
|
|
4281
|
-
onChange: ca,
|
|
4282
|
-
onReset: da,
|
|
4283
|
-
onClose: E[7] || (E[7] = (L) => p.value = !1)
|
|
4284
|
-
}, {
|
|
4285
|
-
advanced: Gt(() => [
|
|
4286
|
-
ee(ar, {
|
|
4287
|
-
state: c(Lt),
|
|
4288
|
-
messages: zt.value
|
|
4289
|
-
}, null, 8, ["state", "messages"])
|
|
4290
|
-
]),
|
|
4291
|
-
default: Gt(() => [
|
|
4292
|
-
ht(u.$slots, "settings", {}, void 0, !0),
|
|
4293
|
-
c(te).print ? (x(), Se(il, {
|
|
4294
|
-
key: 0,
|
|
4295
|
-
value: At.value.calibration ?? {},
|
|
4296
|
-
messages: c(K),
|
|
4297
|
-
busy: v.value || r.value || R.value || c(U).saving.value,
|
|
4298
|
-
"can-test": Sn.value,
|
|
4299
|
-
onChange: E[4] || (E[4] = (L) => bt.value = L),
|
|
4300
|
-
onTest: Ia
|
|
4301
|
-
}, null, 8, ["value", "messages", "busy", "can-test"])) : q("", !0)
|
|
4302
|
-
]),
|
|
4303
|
-
_: 3
|
|
4304
|
-
}, 8, ["available", "enabled", "messages", "persisted-editing", "interaction", "section", "busy"])) : q("", !0),
|
|
4305
|
-
yt.value.length > 1 && W.value > 0 && c($).navigation !== !1 ? (x(), Se(jn, {
|
|
4306
|
-
key: 3,
|
|
4307
|
-
plan: a.value,
|
|
4308
|
-
onLocateTarget: yn,
|
|
4309
|
-
sections: yt.value,
|
|
4310
|
-
"current-page": g.value,
|
|
4311
|
-
messages: c(K),
|
|
4312
|
-
busy: r.value || R.value || c(U).saving.value,
|
|
4313
|
-
onGoto: Ee,
|
|
4314
|
-
onLocate: wn
|
|
4315
|
-
}, null, 8, ["plan", "sections", "current-page", "messages", "busy"])) : q("", !0),
|
|
4316
|
-
z.value ? (x(), Se(ri, {
|
|
4317
|
-
key: 4,
|
|
4318
|
-
result: z.value,
|
|
4319
|
-
messages: c(K)
|
|
4320
|
-
}, null, 8, ["result", "messages"])) : q("", !0),
|
|
4321
|
-
c(Te) && W.value > 0 ? (x(), Se(Al, {
|
|
4322
|
-
key: 5,
|
|
4323
|
-
differences: c(U).differences.value,
|
|
4324
|
-
conflicts: c(U).conflicts.value,
|
|
4325
|
-
messages: c(K),
|
|
4326
|
-
saving: c(U).saving.value,
|
|
4327
|
-
"can-undo": c(U).canUndo.value,
|
|
4328
|
-
"can-redo": c(U).canRedo.value,
|
|
4329
|
-
persisted: c(dn),
|
|
4330
|
-
busy: !!m.value || v.value,
|
|
4331
|
-
onUndo: c(U).undo,
|
|
4332
|
-
onRedo: c(U).redo,
|
|
4333
|
-
onRestore: c(U).restore,
|
|
4334
|
-
onLocate: ga
|
|
4335
|
-
}, null, 8, ["differences", "conflicts", "messages", "saving", "can-undo", "can-redo", "persisted", "busy", "onUndo", "onRedo", "onRestore"])) : q("", !0),
|
|
4336
|
-
c(Ye) ? (x(), P("input", {
|
|
4337
|
-
key: 6,
|
|
4338
|
-
ref_key: "importInputRef",
|
|
4339
|
-
ref: F,
|
|
4340
|
-
class: "mrp-import-input",
|
|
4341
|
-
type: "file",
|
|
4342
|
-
accept: ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
4343
|
-
hidden: "",
|
|
4344
|
-
onChange: Ta
|
|
4345
|
-
}, null, 544)) : q("", !0),
|
|
4346
|
-
c(Te) && W.value > 0 ? (x(), P("div", Ni, y(c(U).saving.value ? c(K).saving : c(K).editingHint), 1)) : q("", !0),
|
|
4347
|
-
d.value ? (x(), P("div", {
|
|
4348
|
-
key: 8,
|
|
4349
|
-
class: $e(["mrp-export-notice", `mrp-export-${d.value.kind}`]),
|
|
4350
|
-
role: "alert"
|
|
4351
|
-
}, y(d.value.message), 3)) : q("", !0),
|
|
4352
|
-
c(mn).status === "error" && fn.value ? (x(), P("div", qi, [
|
|
4353
|
-
ie(y(c(K).pdfFontUnavailable) + " ", 1),
|
|
4354
|
-
h("button", {
|
|
4355
|
-
type: "button",
|
|
4356
|
-
onClick: E[8] || (E[8] = //@ts-ignore
|
|
4357
|
-
(...L) => c(gn) && c(gn)(...L))
|
|
4358
|
-
}, y(c(K).retry), 1)
|
|
4359
|
-
])) : q("", !0),
|
|
4360
|
-
h("div", Ki, [
|
|
4361
|
-
h("div", {
|
|
4362
|
-
ref_key: "viewportRef",
|
|
4363
|
-
ref: k,
|
|
4364
|
-
class: "mrp-body",
|
|
4365
|
-
tabindex: "0",
|
|
4366
|
-
onWheel: Oa,
|
|
4367
|
-
onKeydown: Da,
|
|
4368
|
-
onDblclick: E[9] || (E[9] = //@ts-ignore
|
|
4369
|
-
(...L) => c(U).onDoubleClick && c(U).onDoubleClick(...L)),
|
|
4370
|
-
onClick: E[10] || (E[10] = //@ts-ignore
|
|
4371
|
-
(...L) => c(le).onClick && c(le).onClick(...L)),
|
|
4372
|
-
onCopy: E[11] || (E[11] = //@ts-ignore
|
|
4373
|
-
(...L) => c(le).onCopy && c(le).onCopy(...L)),
|
|
4374
|
-
onPaste: E[12] || (E[12] = //@ts-ignore
|
|
4375
|
-
(...L) => c(le).onPaste && c(le).onPaste(...L)),
|
|
4376
|
-
onScrollPassive: E[13] || (E[13] = (L) => {
|
|
4377
|
-
c(ka)(L.target), c(Ht).schedule();
|
|
4378
|
-
})
|
|
4379
|
-
}, [
|
|
4380
|
-
r.value ? (x(), P("div", Bi, y(c(K).loading), 1)) : l.value ? (x(), P("div", ji, [
|
|
4381
|
-
ie(y(l.value) + " ", 1),
|
|
4382
|
-
h("button", {
|
|
4383
|
-
class: "mrp-retry",
|
|
4384
|
-
type: "button",
|
|
4385
|
-
onClick: Xe
|
|
4386
|
-
}, y(c(K).retry), 1)
|
|
4387
|
-
])) : !a.value || W.value === 0 ? (x(), Se(Kn, {
|
|
4388
|
-
key: 2,
|
|
4389
|
-
title: c(xn) ? c(K).paramPrompt ?? c(K).paramsTitle : c(K).empty,
|
|
4390
|
-
description: c(xn) ? c(K).paramPromptDescription : c(Ot).description ?? c(K).emptyDescription
|
|
4391
|
-
}, null, 8, ["title", "description"])) : (x(), P("div", {
|
|
4392
|
-
key: 3,
|
|
4393
|
-
class: "mrp-scale",
|
|
4394
|
-
style: je({ width: `${c(jt).w * c(Ce)}px`, height: `${c(jt).h * c(Ce)}px` })
|
|
4395
|
-
}, [
|
|
4396
|
-
h("div", {
|
|
4397
|
-
ref_key: "containerRef",
|
|
4398
|
-
ref: I,
|
|
4399
|
-
class: "mrp-scale-inner",
|
|
4400
|
-
style: je({ transform: `scale(${c(Ce)})`, transformOrigin: "top left", width: `${c(jt).w}px` })
|
|
4401
|
-
}, [
|
|
4402
|
-
c(ft).padTopPx > 0 ? (x(), P("div", {
|
|
4403
|
-
key: 0,
|
|
4404
|
-
class: "mrp-spacer-top",
|
|
4405
|
-
style: je({ height: `${c(ft).padTopPx}px` }),
|
|
4406
|
-
"aria-hidden": "true"
|
|
4407
|
-
}, null, 4)) : q("", !0),
|
|
4408
|
-
(x(!0), P(he, null, be(c(Cn), (L) => (x(), P("div", {
|
|
4409
|
-
key: L.index,
|
|
4410
|
-
class: "mrp-page-holder",
|
|
4411
|
-
"data-page": L.index + 1
|
|
4412
|
-
}, null, 8, Hi))), 128)),
|
|
4413
|
-
c(ft).padBottomPx > 0 ? (x(), P("div", {
|
|
4414
|
-
key: 1,
|
|
4415
|
-
class: "mrp-spacer-bottom",
|
|
4416
|
-
style: je({ height: `${c(ft).padBottomPx}px` }),
|
|
4417
|
-
"aria-hidden": "true"
|
|
4418
|
-
}, null, 4)) : q("", !0)
|
|
4419
|
-
], 4)
|
|
4420
|
-
], 4)),
|
|
4421
|
-
!r.value && !l.value && a.value && W.value > 0 && e.emptyState ? (x(), Se(Kn, {
|
|
4422
|
-
key: 4,
|
|
4423
|
-
title: c(Ot).title ?? c(K).empty,
|
|
4424
|
-
description: c(Ot).description ?? c(K).emptyDescription
|
|
4425
|
-
}, null, 8, ["title", "description"])) : q("", !0)
|
|
4426
|
-
], 544),
|
|
4427
|
-
c(te).thumbnails && f.value && W.value > 0 ? (x(), P("aside", {
|
|
4428
|
-
key: 0,
|
|
4429
|
-
ref_key: "thumbsRef",
|
|
4430
|
-
ref: b,
|
|
4431
|
-
class: "mrp-thumbs",
|
|
4432
|
-
onScrollPassive: E[14] || (E[14] = //@ts-ignore
|
|
4433
|
-
(...L) => c(Le).onScroll && c(Le).onScroll(...L))
|
|
4434
|
-
}, [
|
|
4435
|
-
c(Le).windowRange.value.padTopPx > 0 ? (x(), P("div", {
|
|
4436
|
-
key: 0,
|
|
4437
|
-
class: "mrp-thumb-spacer",
|
|
4438
|
-
style: je({ height: `${c(Le).windowRange.value.padTopPx}px` }),
|
|
4439
|
-
"aria-hidden": "true"
|
|
4440
|
-
}, null, 4)) : q("", !0),
|
|
4441
|
-
(x(!0), P(he, null, be(c(Le).visibleThumbs.value, (L) => (x(), P("button", {
|
|
4442
|
-
key: L.index,
|
|
4443
|
-
class: $e(["mrp-thumb", { "mrp-thumb-active": L.index + 1 === g.value }]),
|
|
4444
|
-
type: "button",
|
|
4445
|
-
"aria-label": `${c(K).thumbnails} · ${c(K).pageInfo.replace("{cur}", String(L.index + 1)).replace("{total}", String(W.value))}`,
|
|
4446
|
-
"aria-current": L.index + 1 === g.value ? "page" : void 0,
|
|
4447
|
-
style: je({ height: `${L.height + 20}px` }),
|
|
4448
|
-
onClick: (me) => Ee(L.index + 1)
|
|
4449
|
-
}, [
|
|
4450
|
-
h("span", {
|
|
4451
|
-
class: "mrp-thumb-box",
|
|
4452
|
-
"data-thumb": L.index + 1,
|
|
4453
|
-
style: je({ height: `${L.height}px` })
|
|
4454
|
-
}, null, 12, Ui),
|
|
4455
|
-
h("span", Vi, y(L.index + 1), 1)
|
|
4456
|
-
], 14, Wi))), 128)),
|
|
4457
|
-
c(Le).windowRange.value.padBottomPx > 0 ? (x(), P("div", {
|
|
4458
|
-
key: 1,
|
|
4459
|
-
class: "mrp-thumb-spacer",
|
|
4460
|
-
style: je({ height: `${c(Le).windowRange.value.padBottomPx}px` }),
|
|
4461
|
-
"aria-hidden": "true"
|
|
4462
|
-
}, null, 4)) : q("", !0)
|
|
4463
|
-
], 544)) : q("", !0)
|
|
4464
|
-
]),
|
|
4465
|
-
W.value > 0 ? (x(), P("footer", Ji, [
|
|
4466
|
-
h("div", Gi, [
|
|
4467
|
-
c($).navigation !== !1 ? (x(), Se(Ks, {
|
|
4468
|
-
key: 0,
|
|
4469
|
-
plan: a.value,
|
|
4470
|
-
"current-page": g.value,
|
|
4471
|
-
messages: c(K),
|
|
4472
|
-
busy: r.value || R.value || c(U).saving.value,
|
|
4473
|
-
onGoto: Ee
|
|
4474
|
-
}, null, 8, ["plan", "current-page", "messages", "busy"])) : q("", !0),
|
|
4475
|
-
Ft.value && c(Ke) ? (x(), P("button", {
|
|
4476
|
-
key: 1,
|
|
4477
|
-
class: "mrp-calculation-toggle",
|
|
4478
|
-
type: "button",
|
|
4479
|
-
"aria-label": zt.value.calculationTitle,
|
|
4480
|
-
onClick: fa
|
|
4481
|
-
}, [
|
|
4482
|
-
E[15] || (E[15] = h("span", { "aria-hidden": "true" }, "∑", -1)),
|
|
4483
|
-
ie(y(zt.value.calculationTitle), 1),
|
|
4484
|
-
c(Lt).result.value ? (x(), P("strong", Zi, y(c(Lt).result.value.formatted), 1)) : q("", !0)
|
|
4485
|
-
], 8, Yi)) : q("", !0)
|
|
4486
|
-
]),
|
|
4487
|
-
ee(na, {
|
|
4488
|
-
"page-count": W.value,
|
|
4489
|
-
"current-page": g.value,
|
|
4490
|
-
messages: c(K),
|
|
4491
|
-
busy: r.value || R.value || c(U).saving.value,
|
|
4492
|
-
onGoto: Ee
|
|
4493
|
-
}, null, 8, ["page-count", "current-page", "messages", "busy"])
|
|
4494
|
-
])) : q("", !0),
|
|
4495
|
-
h("div", Xi, [
|
|
4496
|
-
ht(u.$slots, "default", {}, void 0, !0)
|
|
4497
|
-
]),
|
|
4498
|
-
c(_e) ? (x(), P("div", Qi, [
|
|
4499
|
-
E[16] || (E[16] = h("div", null, "mach-report debug", -1)),
|
|
4500
|
-
h("div", null, "pages: " + y(c(_e).pages) + " | window: [" + y(c(_e).window) + "]", 1),
|
|
4501
|
-
h("div", null, "zoom: " + y(c(_e).zoom) + " | load: " + y(c(_e).loadMs), 1),
|
|
4502
|
-
h("div", null, "plan: " + y(c(_e).planKB) + "KB", 1)
|
|
4503
|
-
])) : q("", !0)
|
|
4504
|
-
], 6));
|
|
4505
|
-
}
|
|
4506
|
-
}), eu = /* @__PURE__ */ xe(_i, [["__scopeId", "data-v-4d1cb297"]]), gu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4507
|
-
__proto__: null,
|
|
4508
|
-
default: eu
|
|
4509
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
4510
|
-
export {
|
|
4511
|
-
Yt as P,
|
|
4512
|
-
on as R,
|
|
4513
|
-
Hn as a,
|
|
4514
|
-
na as b,
|
|
4515
|
-
Oe as c,
|
|
4516
|
-
eu as d,
|
|
4517
|
-
Pe as e,
|
|
4518
|
-
Rs as f,
|
|
4519
|
-
Ro as g,
|
|
4520
|
-
fu as h,
|
|
4521
|
-
ml as i,
|
|
4522
|
-
du as j,
|
|
4523
|
-
ul as k,
|
|
4524
|
-
mu as l,
|
|
4525
|
-
cu as m,
|
|
4526
|
-
Zn as n,
|
|
4527
|
-
Mo as o,
|
|
4528
|
-
Qn as p,
|
|
4529
|
-
To as q,
|
|
4530
|
-
Co as r,
|
|
4531
|
-
gu as s,
|
|
4532
|
-
ko as u
|
|
4533
|
-
};
|