@agile-team/mach-report 0.8.0 → 0.9.1
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/LICENSE +107 -0
- package/dist/ReportPreview-D-Us9mrX.cjs +6 -0
- package/dist/ReportPreview-VCx59rSt.js +926 -0
- package/dist/format.d.ts +16 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +433 -419
- package/dist/layout/paginate.d.ts +1 -2
- package/dist/{plugin-Bc6Px9Lq.js → plugin-Bo8QqzCz.js} +1 -1
- package/dist/{plugin-7W2Zy3Xc.cjs → plugin-Dh1exwdD.cjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/vue/ReportPreview.d.ts +1 -1
- package/dist/vue/ReportToolbar.d.ts +5 -3
- package/dist/vue/async.d.cts +3 -3
- package/dist/vue/async.d.ts +3 -3
- package/dist/vue/composables/usePageWindow.d.ts +0 -3
- package/dist/vue/composables/usePrintExport.d.ts +1 -0
- package/dist/vue/composables/useReportSearch.d.ts +72 -0
- package/dist/vue/config.d.ts +8 -1
- package/dist/vue/plugin.d.ts +3 -3
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +26 -25
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.js +31 -30
- package/package.json +3 -1
- package/dist/ReportPreview-BQE0C_37.cjs +0 -6
- package/dist/ReportPreview-D8X75aLV.js +0 -825
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentStyle, PlanComponent, RenderPlan } from '../schema/render-plan';
|
|
2
|
-
import {
|
|
2
|
+
import { TextMeasurer } from './textwrap';
|
|
3
3
|
import { ColumnFormat, StyleRule } from '../format';
|
|
4
4
|
export interface ListColumn {
|
|
5
5
|
header: string;
|
|
@@ -77,4 +77,3 @@ export interface PaginateResult {
|
|
|
77
77
|
warnings: string[];
|
|
78
78
|
}
|
|
79
79
|
export declare function paginateTemplate(template: ReportTemplate, datasets: DatasetRows, optionsOrMmPerRow?: number | PaginateOptions): PaginateResult;
|
|
80
|
-
export { measureTextMm, wrapText };
|
|
@@ -62,7 +62,7 @@ function w(r = { fontUrl: "/simhei.ttf" }) {
|
|
|
62
62
|
return a;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
const R = "mach-report/fetcher", b = "mach-report/pdf-exporter", y = "mach-report/config", A = "mach-report/controller", U = d(() => import("./ReportPreview-
|
|
65
|
+
const R = "mach-report/fetcher", b = "mach-report/pdf-exporter", y = "mach-report/config", A = "mach-report/controller", U = d(() => import("./ReportPreview-VCx59rSt.js").then((r) => r.k)), C = {
|
|
66
66
|
install(r, e = {}) {
|
|
67
67
|
const o = e.fetcher ?? P({
|
|
68
68
|
request: e.request ?? E({ baseUrl: e.baseUrl }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var O=Object.create;var E=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var U=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of b(e))!F.call(r,n)&&n!==t&&E(r,n,{get:()=>e[n],enumerable:!(o=A(e,n))||o.enumerable});return r};var M=(r,e,t)=>(t=r!=null?O(y(r)):{},U(e||!r||!r.__esModule?E(t,"default",{value:r,enumerable:!0}):t,r));const R=require("vue");function m(r){return r==null?[]:Array.isArray(r)?r.map(String).filter(e=>e!==""):String(r).split(",").map(e=>e.trim()).filter(e=>e!=="")}function j(r){return m(r).join(",")}class s extends Error{constructor(e){super(e),this.name="PlanLoadError"}}function P(r={}){const{baseUrl:e="",headers:t,credentials:o,timeoutMs:n=3e4}=r;return async({url:c,method:i,params:a})=>{const h=a&&Object.keys(a).length>0?`?${new URLSearchParams(a)}`:"",l=new AbortController,f=setTimeout(()=>l.abort(),n);let d;try{d=await fetch(`${e}${c}${h}`,{method:i.toUpperCase(),headers:{Accept:"application/json",...t},credentials:o,signal:l.signal})}catch(u){throw u instanceof DOMException&&u.name==="AbortError"?new s(`请求超时(${n}ms): ${c}`):new s(`请求失败(${c}): ${u instanceof Error?u.message:String(u)}`)}finally{clearTimeout(f)}if(!d.ok)throw new s(`HTTP ${d.status} ${c}`);return d.json()}}function p(r){const{request:e,baseUrl:t=""}=r;return async({tempIds:o,furnitureTempId:n,params:c})=>{if(o.length===0)throw new s("缺少报表模板 ID");const i={tempId:o.join(",")};n&&(i.furnitureTempId=n);for(const[l,f]of Object.entries(c||{}))l&&f!=null&&f!==""&&(i[l]=String(f));const a=await e({url:`${t}/report/codePrintReport/gridPlan`,method:"get",params:i});if(a&&a.code!=null&&a.code!==200)throw new s(String(a.message||"预览加载失败"));const h=a?.data?.pages;return{schemaVersion:"jh4j-compatible",pages:Array.isArray(h)?h:[]}}}function _(r={fontUrl:"/simhei.ttf"}){let e=null;return async t=>{e||(e=await import("@agile-team/mach-report/pdf"));const o=r.fontUrl?await e.loadFontWithCache(r.fontUrl):null,{bytes:n}=await e.renderPlanToPdf(t,o?{customFontBytes:o}:{});return n}}const T="mach-report/fetcher",g="mach-report/pdf-exporter",w="mach-report/config",$="mach-report/controller",C=R.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-
|
|
1
|
+
"use strict";var O=Object.create;var E=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var U=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of b(e))!F.call(r,n)&&n!==t&&E(r,n,{get:()=>e[n],enumerable:!(o=A(e,n))||o.enumerable});return r};var M=(r,e,t)=>(t=r!=null?O(y(r)):{},U(e||!r||!r.__esModule?E(t,"default",{value:r,enumerable:!0}):t,r));const R=require("vue");function m(r){return r==null?[]:Array.isArray(r)?r.map(String).filter(e=>e!==""):String(r).split(",").map(e=>e.trim()).filter(e=>e!=="")}function j(r){return m(r).join(",")}class s extends Error{constructor(e){super(e),this.name="PlanLoadError"}}function P(r={}){const{baseUrl:e="",headers:t,credentials:o,timeoutMs:n=3e4}=r;return async({url:c,method:i,params:a})=>{const h=a&&Object.keys(a).length>0?`?${new URLSearchParams(a)}`:"",l=new AbortController,f=setTimeout(()=>l.abort(),n);let d;try{d=await fetch(`${e}${c}${h}`,{method:i.toUpperCase(),headers:{Accept:"application/json",...t},credentials:o,signal:l.signal})}catch(u){throw u instanceof DOMException&&u.name==="AbortError"?new s(`请求超时(${n}ms): ${c}`):new s(`请求失败(${c}): ${u instanceof Error?u.message:String(u)}`)}finally{clearTimeout(f)}if(!d.ok)throw new s(`HTTP ${d.status} ${c}`);return d.json()}}function p(r){const{request:e,baseUrl:t=""}=r;return async({tempIds:o,furnitureTempId:n,params:c})=>{if(o.length===0)throw new s("缺少报表模板 ID");const i={tempId:o.join(",")};n&&(i.furnitureTempId=n);for(const[l,f]of Object.entries(c||{}))l&&f!=null&&f!==""&&(i[l]=String(f));const a=await e({url:`${t}/report/codePrintReport/gridPlan`,method:"get",params:i});if(a&&a.code!=null&&a.code!==200)throw new s(String(a.message||"预览加载失败"));const h=a?.data?.pages;return{schemaVersion:"jh4j-compatible",pages:Array.isArray(h)?h:[]}}}function _(r={fontUrl:"/simhei.ttf"}){let e=null;return async t=>{e||(e=await import("@agile-team/mach-report/pdf"));const o=r.fontUrl?await e.loadFontWithCache(r.fontUrl):null,{bytes:n}=await e.renderPlanToPdf(t,o?{customFontBytes:o}:{});return n}}const T="mach-report/fetcher",g="mach-report/pdf-exporter",w="mach-report/config",$="mach-report/controller",C=R.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-D-Us9mrX.cjs")).then(r=>r.ReportPreview$1)),H={install(r,e={}){const t=e.fetcher??p({request:e.request??P({baseUrl:e.baseUrl}),baseUrl:e.baseUrl});r.provide(T,t);const o=e.pdfFontUrl??e.config?.defaults?.pdfFontUrl??"/simhei.ttf";r.provide(g,e.pdfExporter??_({fontUrl:o})),r.provide(w,R.computed(()=>e.config??null)),e.globalComponent!==!1&&r.component("MachReportPreview",C)}};exports.MACH_REPORT_CONFIG_KEY=w;exports.MACH_REPORT_CONTROLLER_KEY=$;exports.MACH_REPORT_FETCHER_KEY=T;exports.MACH_REPORT_PDF_EXPORTER_KEY=g;exports.MachReportPreview=C;exports.PlanLoadError=s;exports.createDefaultPdfExporter=_;exports.createFetchRequest=P;exports.createJh4jGridPlanFetcher=p;exports.joinTempIds=j;exports.machReportPlugin=H;exports.normalizeTempIds=m;
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.mrp-toolbar[data-v-
|
|
1
|
+
.mrp-toolbar[data-v-f50c26e8]{display:flex;align-items:center;gap:8px;padding:6px 12px;background:var(--mrp-toolbar-bg, #323639);border-bottom:1px solid var(--mrp-toolbar-border, #22252a);flex:none;flex-wrap:wrap}.mrp-title[data-v-f50c26e8]{font-size:13px;font-weight:600;margin-right:8px;color:var(--mrp-toolbar-fg, #e8e8e8)}.mrp-nav[data-v-f50c26e8]{background:transparent;color:var(--mrp-btn-fg, #cfcfcf);border:1px solid var(--mrp-btn-border, #4a4d52);border-radius:4px;padding:2px 8px;font-size:12px;cursor:pointer;white-space:nowrap}.mrp-nav[data-v-f50c26e8]:hover:not(:disabled){background:var(--mrp-btn-hover-bg, #414549);color:var(--mrp-btn-hover-fg, #fff)}.mrp-nav[data-v-f50c26e8]:disabled{opacity:.4;cursor:not-allowed}.mrp-active[data-v-f50c26e8]{background:var(--mrp-btn-active-bg, #2d5fb8);border-color:var(--mrp-btn-active-bg, #2d5fb8);color:#fff}.mrp-pageinfo[data-v-f50c26e8]{font-size:12px;min-width:56px;text-align:center;color:var(--mrp-toolbar-fg, #e8e8e8)}.mrp-spacer[data-v-f50c26e8]{flex:1}.mrp-search[data-v-f50c26e8]{display:flex;align-items:center;gap:4px}.mrp-search-input[data-v-f50c26e8]{background:#22252a;color:#e8e8e8;border:1px solid var(--mrp-btn-border, #4a4d52);border-radius:4px;padding:2px 8px;font-size:12px;width:150px;outline:none}.mrp-search-input[data-v-f50c26e8]:focus{border-color:var(--mrp-btn-active-bg, #2d5fb8)}.mrp-search-count[data-v-f50c26e8]{font-size:12px;color:var(--mrp-toolbar-fg, #e8e8e8);min-width:42px;text-align:center}.mach-report-preview[data-v-2e98692a]{--mrp-shell-bg: #525659;--mrp-shell-fg: #e8e8e8;--mrp-toolbar-bg: #323639;--mrp-toolbar-border: #22252a;--mrp-toolbar-fg: #e8e8e8;--mrp-btn-fg: #cfcfcf;--mrp-btn-border: #4a4d52;--mrp-btn-hover-bg: #414549;--mrp-btn-hover-fg: #ffffff;--mrp-btn-active-bg: #2d5fb8;position:relative;display:flex;flex-direction:column;background:var(--mrp-shell-bg);color:var(--mrp-shell-fg);overflow:hidden}.mrp-main[data-v-2e98692a]{display:flex;flex:1;min-height:0}.mrp-body[data-v-2e98692a]{flex:1;overflow:auto;padding:24px;outline:none}.mrp-scale[data-v-2e98692a]{margin:0 auto}.mrp-scale-inner[data-v-2e98692a]{display:flex;flex-direction:column;align-items:center}.mrp-page-holder[data-v-2e98692a]{background:#fff;box-shadow:0 2px 8px #00000059;margin-bottom:var(--v3c509574);flex:none}.mrp-state[data-v-2e98692a]{padding:40px;text-align:center;color:#bfbfbf;font-size:13px}.mrp-error[data-v-2e98692a]{color:#ff9d9d}.mrp-retry[data-v-2e98692a]{margin-left:12px;background:transparent;color:#8fb7ff;border:1px solid #5a7fbf;border-radius:4px;padding:1px 10px;cursor:pointer}.mrp-overlay[data-v-2e98692a]{position:absolute;inset:0;pointer-events:none}.mrp-page-holder[data-v-2e98692a] mark.mrp-hit{background:#ffe066;color:#7a5c00;border-radius:2px;padding:0 1px}.mrp-thumbs[data-v-2e98692a]{width:140px;flex:none;overflow-y:auto;border-left:1px solid var(--mrp-toolbar-border);background:var(--mrp-toolbar-bg);padding:8px;display:flex;flex-direction:column;gap:8px}.mrp-thumb[data-v-2e98692a]{cursor:pointer;text-align:center}.mrp-thumb-box[data-v-2e98692a]{width:116px;background:#fff;box-shadow:0 1px 4px #0006;overflow:hidden;border:2px solid transparent}.mrp-thumb-active .mrp-thumb-box[data-v-2e98692a]{border-color:var(--mrp-btn-active-bg)}.mrp-thumb-no[data-v-2e98692a]{font-size:11px;color:var(--mrp-toolbar-fg)}.mrp-debug[data-v-2e98692a]{position:absolute;right:8px;bottom:8px;background:#000000c7;color:#7ee787;font:11px/1.6 ui-monospace,monospace;padding:6px 10px;border-radius:6px;pointer-events:none;white-space:pre}
|
|
@@ -156,13 +156,13 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
156
156
|
params: Record<string, string>;
|
|
157
157
|
furnitureTempId: string;
|
|
158
158
|
tempId: string | string[] | null;
|
|
159
|
+
debug: boolean;
|
|
159
160
|
showExport: boolean;
|
|
160
161
|
showPrint: boolean;
|
|
161
162
|
showPdfWindow: boolean;
|
|
162
163
|
messages: Partial<MachReportMessages>;
|
|
163
164
|
autoLoad: boolean;
|
|
164
165
|
preset: string;
|
|
165
|
-
debug: boolean;
|
|
166
166
|
fetcher: PlanFetcher | null;
|
|
167
167
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
168
168
|
viewportRef: HTMLDivElement;
|
|
@@ -17,8 +17,8 @@ type __VLS_Props = {
|
|
|
17
17
|
thumbsVisible: boolean;
|
|
18
18
|
};
|
|
19
19
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
20
|
-
print: () => any;
|
|
21
20
|
zoom: (mode: number | "fit") => any;
|
|
21
|
+
print: () => any;
|
|
22
22
|
goto: (page: number) => any;
|
|
23
23
|
export: (format: "html" | "pdf") => any;
|
|
24
24
|
"pdf-window": () => any;
|
|
@@ -27,8 +27,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
27
27
|
"search-toggle": () => any;
|
|
28
28
|
"thumbs-toggle": () => any;
|
|
29
29
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
30
|
-
onPrint?: (() => any) | undefined;
|
|
31
30
|
onZoom?: ((mode: number | "fit") => any) | undefined;
|
|
31
|
+
onPrint?: (() => any) | undefined;
|
|
32
32
|
onGoto?: ((page: number) => any) | undefined;
|
|
33
33
|
onExport?: ((format: "html" | "pdf") => any) | undefined;
|
|
34
34
|
"onPdf-window"?: (() => any) | undefined;
|
|
@@ -36,5 +36,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
36
36
|
"onSearch-nav"?: ((dir: 1 | -1) => any) | undefined;
|
|
37
37
|
"onSearch-toggle"?: (() => any) | undefined;
|
|
38
38
|
"onThumbs-toggle"?: (() => any) | undefined;
|
|
39
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
39
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
40
|
+
searchInputRef: HTMLInputElement;
|
|
41
|
+
}, HTMLDivElement>;
|
|
40
42
|
export default _default;
|
package/dist/vue/async.d.cts
CHANGED
|
@@ -91,13 +91,13 @@ export declare const MachReportPreview: {
|
|
|
91
91
|
params: Record<string, string>;
|
|
92
92
|
furnitureTempId: string;
|
|
93
93
|
tempId: string | string[] | null;
|
|
94
|
+
debug: boolean;
|
|
94
95
|
showExport: boolean;
|
|
95
96
|
showPrint: boolean;
|
|
96
97
|
showPdfWindow: boolean;
|
|
97
98
|
messages: Partial<import('./config').MachReportMessages>;
|
|
98
99
|
autoLoad: boolean;
|
|
99
100
|
preset: string;
|
|
100
|
-
debug: boolean;
|
|
101
101
|
fetcher: import('./adapters').PlanFetcher | null;
|
|
102
102
|
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
103
103
|
viewportRef: HTMLDivElement;
|
|
@@ -181,13 +181,13 @@ export declare const MachReportPreview: {
|
|
|
181
181
|
params: Record<string, string>;
|
|
182
182
|
furnitureTempId: string;
|
|
183
183
|
tempId: string | string[] | null;
|
|
184
|
+
debug: boolean;
|
|
184
185
|
showExport: boolean;
|
|
185
186
|
showPrint: boolean;
|
|
186
187
|
showPdfWindow: boolean;
|
|
187
188
|
messages: Partial<import('./config').MachReportMessages>;
|
|
188
189
|
autoLoad: boolean;
|
|
189
190
|
preset: string;
|
|
190
|
-
debug: boolean;
|
|
191
191
|
fetcher: import('./adapters').PlanFetcher | null;
|
|
192
192
|
}>;
|
|
193
193
|
__isFragment?: never;
|
|
@@ -270,13 +270,13 @@ export declare const MachReportPreview: {
|
|
|
270
270
|
params: Record<string, string>;
|
|
271
271
|
furnitureTempId: string;
|
|
272
272
|
tempId: string | string[] | null;
|
|
273
|
+
debug: boolean;
|
|
273
274
|
showExport: boolean;
|
|
274
275
|
showPrint: boolean;
|
|
275
276
|
showPdfWindow: boolean;
|
|
276
277
|
messages: Partial<import('./config').MachReportMessages>;
|
|
277
278
|
autoLoad: boolean;
|
|
278
279
|
preset: string;
|
|
279
|
-
debug: boolean;
|
|
280
280
|
fetcher: import('./adapters').PlanFetcher | null;
|
|
281
281
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
282
282
|
$slots: {
|
package/dist/vue/async.d.ts
CHANGED
|
@@ -91,13 +91,13 @@ export declare const MachReportPreview: {
|
|
|
91
91
|
params: Record<string, string>;
|
|
92
92
|
furnitureTempId: string;
|
|
93
93
|
tempId: string | string[] | null;
|
|
94
|
+
debug: boolean;
|
|
94
95
|
showExport: boolean;
|
|
95
96
|
showPrint: boolean;
|
|
96
97
|
showPdfWindow: boolean;
|
|
97
98
|
messages: Partial<import('./config').MachReportMessages>;
|
|
98
99
|
autoLoad: boolean;
|
|
99
100
|
preset: string;
|
|
100
|
-
debug: boolean;
|
|
101
101
|
fetcher: import('./adapters').PlanFetcher | null;
|
|
102
102
|
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
103
103
|
viewportRef: HTMLDivElement;
|
|
@@ -181,13 +181,13 @@ export declare const MachReportPreview: {
|
|
|
181
181
|
params: Record<string, string>;
|
|
182
182
|
furnitureTempId: string;
|
|
183
183
|
tempId: string | string[] | null;
|
|
184
|
+
debug: boolean;
|
|
184
185
|
showExport: boolean;
|
|
185
186
|
showPrint: boolean;
|
|
186
187
|
showPdfWindow: boolean;
|
|
187
188
|
messages: Partial<import('./config').MachReportMessages>;
|
|
188
189
|
autoLoad: boolean;
|
|
189
190
|
preset: string;
|
|
190
|
-
debug: boolean;
|
|
191
191
|
fetcher: import('./adapters').PlanFetcher | null;
|
|
192
192
|
}>;
|
|
193
193
|
__isFragment?: never;
|
|
@@ -270,13 +270,13 @@ export declare const MachReportPreview: {
|
|
|
270
270
|
params: Record<string, string>;
|
|
271
271
|
furnitureTempId: string;
|
|
272
272
|
tempId: string | string[] | null;
|
|
273
|
+
debug: boolean;
|
|
273
274
|
showExport: boolean;
|
|
274
275
|
showPrint: boolean;
|
|
275
276
|
showPdfWindow: boolean;
|
|
276
277
|
messages: Partial<import('./config').MachReportMessages>;
|
|
277
278
|
autoLoad: boolean;
|
|
278
279
|
preset: string;
|
|
279
|
-
debug: boolean;
|
|
280
280
|
fetcher: import('./adapters').PlanFetcher | null;
|
|
281
281
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
282
282
|
$slots: {
|
|
@@ -11,7 +11,6 @@ export declare function usePageWindow(plan: Ref<RenderPlan | null>, zoom: Ref<nu
|
|
|
11
11
|
pxPerMm?: number;
|
|
12
12
|
gapPx?: number;
|
|
13
13
|
}): {
|
|
14
|
-
pageHeightsPx: import('vue').ComputedRef<number[]>;
|
|
15
14
|
contentSize: import('vue').ComputedRef<{
|
|
16
15
|
w: number;
|
|
17
16
|
h: number;
|
|
@@ -21,8 +20,6 @@ export declare function usePageWindow(plan: Ref<RenderPlan | null>, zoom: Ref<nu
|
|
|
21
20
|
page: PlanPage;
|
|
22
21
|
index: number;
|
|
23
22
|
}[]>;
|
|
24
|
-
scrollTop: Ref<number, number>;
|
|
25
|
-
viewportHeight: Ref<number, number>;
|
|
26
23
|
makeScrollHandler: (currentPage: Ref<number>, pageCount: Ref<number>) => (vp: HTMLElement) => void;
|
|
27
24
|
refreshViewport(vp: HTMLElement | null): void;
|
|
28
25
|
};
|
|
@@ -13,6 +13,7 @@ export declare function buildPrintDocument(p: RenderPlan): PrintHtmlResult;
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function printPlans(plans: RenderPlan[], options?: {
|
|
15
15
|
onProgress?: (done: number, total: number) => void;
|
|
16
|
+
onError?: (message: string) => void;
|
|
16
17
|
}): Promise<void>;
|
|
17
18
|
export declare function usePrintExport(plan: Ref<RenderPlan | null>, hooks: {
|
|
18
19
|
getPdfExporter: () => PdfExporter;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { RenderPlan } from '@agile-team/mach-report';
|
|
3
|
+
/**
|
|
4
|
+
* 预览搜索:计划全文索引 → 跳页导航 → 命中页高亮。
|
|
5
|
+
*
|
|
6
|
+
* - 输入防抖(默认 200ms):避免逐键触发 O(全计划) 扫描与页面跳转抖动
|
|
7
|
+
* - matchIndex 循环导航(‹/›),每次导航 gotoPage 到命中所在页
|
|
8
|
+
* - 高亮由页面挂载方调用 apply/clear(虚拟化窗口外的页随窗口重建自然清理)
|
|
9
|
+
*/
|
|
10
|
+
export interface ReportSearchState {
|
|
11
|
+
visible: Ref<boolean>;
|
|
12
|
+
query: Ref<string>;
|
|
13
|
+
matchIndex: Ref<number>;
|
|
14
|
+
matchCount: Ref<number>;
|
|
15
|
+
toggle(): void;
|
|
16
|
+
onInput(query: string): void;
|
|
17
|
+
onNav(dir: 1 | -1): void;
|
|
18
|
+
/** 页面元素高亮(查询为空时为 no-op) */
|
|
19
|
+
apply(pageEl: HTMLElement): void;
|
|
20
|
+
clear(pageEl: HTMLElement): void;
|
|
21
|
+
/** 换单据/清空时的整体复位 */
|
|
22
|
+
reset(): void;
|
|
23
|
+
}
|
|
24
|
+
export interface ReportSearchOptions {
|
|
25
|
+
plan: Ref<RenderPlan | null>;
|
|
26
|
+
gotoPage(page: number): void;
|
|
27
|
+
debounceMs?: number;
|
|
28
|
+
highlight: (pageEl: HTMLElement, query: string) => number;
|
|
29
|
+
clearHighlights: (pageEl: HTMLElement) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function useReportSearch(options: ReportSearchOptions): ReportSearchState;
|
|
32
|
+
/**
|
|
33
|
+
* 调试面板状态:?mrp-debug=1 或 debug prop。
|
|
34
|
+
* planKB 按 plan 引用缓存(滚动/缩放不触发全量 JSON 序列化)。
|
|
35
|
+
*/
|
|
36
|
+
export declare function useDebugPanel(debug: Ref<boolean>, stats: {
|
|
37
|
+
plan: Ref<RenderPlan | null>;
|
|
38
|
+
pageCount: Ref<number>;
|
|
39
|
+
windowRange: Ref<{
|
|
40
|
+
start: number;
|
|
41
|
+
end: number;
|
|
42
|
+
}>;
|
|
43
|
+
zoom: Ref<number>;
|
|
44
|
+
loadMs: Ref<number>;
|
|
45
|
+
}): {
|
|
46
|
+
enabled: import('vue').ComputedRef<boolean>;
|
|
47
|
+
debugStats: import('vue').ComputedRef<{
|
|
48
|
+
pages: number;
|
|
49
|
+
window: string;
|
|
50
|
+
zoom: string;
|
|
51
|
+
loadMs: string;
|
|
52
|
+
planKB: number;
|
|
53
|
+
} | null>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* 缩略图侧栏:懒渲染小画布(IntersectionObserver + 低 dpr)。
|
|
57
|
+
* 无 2D 环境(SSR/测试)保留占位框,不抛错。
|
|
58
|
+
*/
|
|
59
|
+
export declare function useThumbs(plan: Ref<RenderPlan | null>, opts: {
|
|
60
|
+
thumbsRoot: Ref<HTMLElement | null>;
|
|
61
|
+
visible: Ref<boolean>;
|
|
62
|
+
renderThumbCanvas: (pageIndex: number) => HTMLCanvasElement | null;
|
|
63
|
+
}): {
|
|
64
|
+
schedule: () => void;
|
|
65
|
+
destroy: () => void;
|
|
66
|
+
};
|
|
67
|
+
/** 加载耗时计时(performance 不可用时为 0) */
|
|
68
|
+
export declare function useLoadTiming(): {
|
|
69
|
+
loadMs: Ref<number>;
|
|
70
|
+
start(): number;
|
|
71
|
+
end(t0: number): void;
|
|
72
|
+
};
|
package/dist/vue/config.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface MachReportMessages {
|
|
|
19
19
|
pdfWindow: string;
|
|
20
20
|
loading: string;
|
|
21
21
|
empty: string;
|
|
22
|
+
/** @deprecated 未被组件消费,将在下个大版本移除(保留仅为类型兼容) */
|
|
22
23
|
errorPrefix: string;
|
|
23
24
|
retry: string;
|
|
24
25
|
/** 搜索框占位文案 */
|
|
@@ -46,6 +47,8 @@ export interface MachReportTheme {
|
|
|
46
47
|
btnActiveBg: string;
|
|
47
48
|
}
|
|
48
49
|
export declare const DEFAULT_THEME: MachReportTheme;
|
|
50
|
+
/** 日志通道(默认 console;可注入 noop 静默或上报 collector) */
|
|
51
|
+
export type MachReportLogger = Pick<Console, "warn" | "info">;
|
|
49
52
|
/** defaults 层可配置项(全部可选,均有内置缺省) */
|
|
50
53
|
export interface MachReportDefaults {
|
|
51
54
|
showExport?: boolean;
|
|
@@ -57,6 +60,8 @@ export interface MachReportDefaults {
|
|
|
57
60
|
pdfFontUrl?: string;
|
|
58
61
|
theme?: Partial<MachReportTheme>;
|
|
59
62
|
messages?: Partial<MachReportMessages>;
|
|
63
|
+
/** 校验告警等内部日志通道(默认 console;静默传 { warn: () => {}, info: () => {} }) */
|
|
64
|
+
logger?: MachReportLogger;
|
|
60
65
|
}
|
|
61
66
|
export type MachReportPreset = MachReportDefaults;
|
|
62
67
|
export interface MachReportConfig {
|
|
@@ -73,7 +78,10 @@ export type ResolvedConfig = Required<Pick<MachReportDefaults, "showExport" | "s
|
|
|
73
78
|
pdfFontUrl: string;
|
|
74
79
|
theme: MachReportTheme;
|
|
75
80
|
messages: MachReportMessages;
|
|
81
|
+
logger: MachReportLogger;
|
|
76
82
|
};
|
|
83
|
+
declare const SILENT_LOGGER: MachReportLogger;
|
|
84
|
+
export { SILENT_LOGGER };
|
|
77
85
|
export declare function resolveConfig(config: MachReportConfig | null | undefined, presetName?: string): ResolvedConfig;
|
|
78
86
|
/** theme 对象 → CSS 自定义属性 style 对象(注入组件外壳) */
|
|
79
87
|
export declare function themeToCssVars(theme: Partial<MachReportTheme>): CSSProperties;
|
|
@@ -85,4 +93,3 @@ type ConfigRef = ComputedRef<MachReportConfig | null>;
|
|
|
85
93
|
export declare function provideMachReportConfig(overlay: MachReportConfig | MachReportDefaults): void;
|
|
86
94
|
/** 组件内部读取当前生效配置层(未提供时返回 null → 走内置缺省) */
|
|
87
95
|
export declare function useMachReportConfig(): ConfigRef;
|
|
88
|
-
export {};
|
package/dist/vue/plugin.d.ts
CHANGED
|
@@ -84,13 +84,13 @@ export declare const MachReportPreview: {
|
|
|
84
84
|
params: Record<string, string>;
|
|
85
85
|
furnitureTempId: string;
|
|
86
86
|
tempId: string | string[] | null;
|
|
87
|
+
debug: boolean;
|
|
87
88
|
showExport: boolean;
|
|
88
89
|
showPrint: boolean;
|
|
89
90
|
showPdfWindow: boolean;
|
|
90
91
|
messages: Partial<import('./config').MachReportMessages>;
|
|
91
92
|
autoLoad: boolean;
|
|
92
93
|
preset: string;
|
|
93
|
-
debug: boolean;
|
|
94
94
|
fetcher: PlanFetcher | null;
|
|
95
95
|
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
96
96
|
viewportRef: HTMLDivElement;
|
|
@@ -174,13 +174,13 @@ export declare const MachReportPreview: {
|
|
|
174
174
|
params: Record<string, string>;
|
|
175
175
|
furnitureTempId: string;
|
|
176
176
|
tempId: string | string[] | null;
|
|
177
|
+
debug: boolean;
|
|
177
178
|
showExport: boolean;
|
|
178
179
|
showPrint: boolean;
|
|
179
180
|
showPdfWindow: boolean;
|
|
180
181
|
messages: Partial<import('./config').MachReportMessages>;
|
|
181
182
|
autoLoad: boolean;
|
|
182
183
|
preset: string;
|
|
183
|
-
debug: boolean;
|
|
184
184
|
fetcher: PlanFetcher | null;
|
|
185
185
|
}>;
|
|
186
186
|
__isFragment?: never;
|
|
@@ -263,13 +263,13 @@ export declare const MachReportPreview: {
|
|
|
263
263
|
params: Record<string, string>;
|
|
264
264
|
furnitureTempId: string;
|
|
265
265
|
tempId: string | string[] | null;
|
|
266
|
+
debug: boolean;
|
|
266
267
|
showExport: boolean;
|
|
267
268
|
showPrint: boolean;
|
|
268
269
|
showPdfWindow: boolean;
|
|
269
270
|
messages: Partial<import('./config').MachReportMessages>;
|
|
270
271
|
autoLoad: boolean;
|
|
271
272
|
preset: string;
|
|
272
|
-
debug: boolean;
|
|
273
273
|
fetcher: PlanFetcher | null;
|
|
274
274
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
275
275
|
$slots: {
|
package/dist/vue-async.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),i=require("./plugin-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),i=require("./plugin-Dh1exwdD.cjs"),r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-D-Us9mrX.cjs")).then(e=>e.ReportPreview$1));function c(){return Promise.resolve().then(()=>require("./ReportPreview-D-Us9mrX.cjs")).then(e=>e.ReportPreview$1)}const t={install(e,o={}){i.machReportPlugin.install(e,o),e.component("MachReportPreview",r)}};exports.MachReportPreview=r;exports.default=t;exports.machReportAsyncPlugin=t;exports.preloadMachReport=c;
|
package/dist/vue-async.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineAsyncComponent as e } from "vue";
|
|
2
|
-
import { m as n } from "./plugin-
|
|
3
|
-
const r = e(() => import("./ReportPreview-
|
|
2
|
+
import { m as n } from "./plugin-Bo8QqzCz.js";
|
|
3
|
+
const r = e(() => import("./ReportPreview-VCx59rSt.js").then((t) => t.k));
|
|
4
4
|
function m() {
|
|
5
|
-
return import("./ReportPreview-
|
|
5
|
+
return import("./ReportPreview-VCx59rSt.js").then((t) => t.k);
|
|
6
6
|
}
|
|
7
7
|
const p = {
|
|
8
8
|
install(t, o = {}) {
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ReportPreview-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ReportPreview-D-Us9mrX.cjs"),r=require("./plugin-Dh1exwdD.cjs"),c=require("@agile-team/mach-report"),s=require("vue");function p(E){return async({tempIds:t})=>{if(t.length===0)throw new r.PlanLoadError("缺少报表模板 ID");const a=[];for(const n of t){const o=E[n];if(!o)throw new r.PlanLoadError(`本地模板 ${n} 不存在`);const{plan:R,warnings:i}=c.paginateTemplate(o.template,o.datasets??{});i.length>0&&console.warn("[mach-report] 分页告警:",i),a.push(...R.pages)}return{schemaVersion:"mach-local",pages:a}}}function P(){return s.inject(r.MACH_REPORT_CONTROLLER_KEY,null)}exports.DEFAULT_MESSAGES=e.DEFAULT_MESSAGES;exports.DEFAULT_THEME=e.DEFAULT_THEME;exports.MachReportError=e.MachReportError;exports.ReportPreview=e.ReportPreview;exports.ReportToolbar=e.ReportToolbar;exports.SILENT_LOGGER=e.SILENT_LOGGER;exports.buildPrintDocument=e.buildPrintDocument;exports.defineMachReportConfig=e.defineMachReportConfig;exports.defineMachReportPreset=e.defineMachReportPreset;exports.printPlans=e.printPlans;exports.provideMachReportConfig=e.provideMachReportConfig;exports.resolveConfig=e.resolveConfig;exports.themeToCssVars=e.themeToCssVars;exports.toErrorDetail=e.toErrorDetail;exports.useMachReportConfig=e.useMachReportConfig;exports.usePageWindow=e.usePageWindow;exports.usePrintExport=e.usePrintExport;exports.useZoom=e.useZoom;exports.MACH_REPORT_CONFIG_KEY=r.MACH_REPORT_CONFIG_KEY;exports.MACH_REPORT_CONTROLLER_KEY=r.MACH_REPORT_CONTROLLER_KEY;exports.MACH_REPORT_FETCHER_KEY=r.MACH_REPORT_FETCHER_KEY;exports.MACH_REPORT_PDF_EXPORTER_KEY=r.MACH_REPORT_PDF_EXPORTER_KEY;exports.MachReportPreview=r.MachReportPreview;exports.PlanLoadError=r.PlanLoadError;exports.createDefaultPdfExporter=r.createDefaultPdfExporter;exports.createFetchRequest=r.createFetchRequest;exports.createJh4jGridPlanFetcher=r.createJh4jGridPlanFetcher;exports.joinTempIds=r.joinTempIds;exports.machReportPlugin=r.machReportPlugin;exports.normalizeTempIds=r.normalizeTempIds;exports.createLocalFetcher=p;exports.useReportPreview=P;
|
package/dist/vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { P as t, M as c } from "./plugin-
|
|
3
|
-
import { a as
|
|
1
|
+
import { D as T, a as _, M as g, R as M, b as d, S as C, c as w, d as O, e as D, p as F, f as L, r as A, t as H, g as j, u as v, h as x, i as G, j as S } from "./ReportPreview-VCx59rSt.js";
|
|
2
|
+
import { P as t, M as c } from "./plugin-Bo8QqzCz.js";
|
|
3
|
+
import { a as I, b as K, c as Y, d as N, e as y, f as U, g as V, j as q, m as z, n as J } from "./plugin-Bo8QqzCz.js";
|
|
4
4
|
import { paginateTemplate as p } from "@agile-team/mach-report";
|
|
5
|
-
import { inject as
|
|
5
|
+
import { inject as E } from "vue";
|
|
6
6
|
function h(n) {
|
|
7
7
|
return async ({ tempIds: a }) => {
|
|
8
8
|
if (a.length === 0) throw new t("缺少报表模板 ID");
|
|
@@ -17,38 +17,39 @@ function h(n) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
function m() {
|
|
20
|
-
return
|
|
20
|
+
return E(c, null);
|
|
21
21
|
}
|
|
22
22
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
T as DEFAULT_MESSAGES,
|
|
24
|
+
_ as DEFAULT_THEME,
|
|
25
|
+
I as MACH_REPORT_CONFIG_KEY,
|
|
26
26
|
c as MACH_REPORT_CONTROLLER_KEY,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
K as MACH_REPORT_FETCHER_KEY,
|
|
28
|
+
Y as MACH_REPORT_PDF_EXPORTER_KEY,
|
|
29
|
+
g as MachReportError,
|
|
30
|
+
N as MachReportPreview,
|
|
31
31
|
t as PlanLoadError,
|
|
32
32
|
M as ReportPreview,
|
|
33
33
|
d as ReportToolbar,
|
|
34
|
-
C as
|
|
34
|
+
C as SILENT_LOGGER,
|
|
35
|
+
w as buildPrintDocument,
|
|
35
36
|
y as createDefaultPdfExporter,
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
U as createFetchRequest,
|
|
38
|
+
V as createJh4jGridPlanFetcher,
|
|
38
39
|
h as createLocalFetcher,
|
|
39
|
-
|
|
40
|
+
O as defineMachReportConfig,
|
|
40
41
|
D as defineMachReportPreset,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
q as joinTempIds,
|
|
43
|
+
z as machReportPlugin,
|
|
44
|
+
J as normalizeTempIds,
|
|
44
45
|
F as printPlans,
|
|
45
|
-
|
|
46
|
+
L as provideMachReportConfig,
|
|
46
47
|
A as resolveConfig,
|
|
47
48
|
H as themeToCssVars,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
j as toErrorDetail,
|
|
50
|
+
v as useMachReportConfig,
|
|
51
|
+
x as usePageWindow,
|
|
52
|
+
G as usePrintExport,
|
|
52
53
|
m as useReportPreview,
|
|
53
|
-
|
|
54
|
+
S as useZoom
|
|
54
55
|
};
|