@agile-team/mach-report 2.0.0 → 2.2.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/LICENSE +2 -4
- package/LICENSING.md +15 -0
- package/README.md +317 -76
- package/dist/ReportPreview-BWrQCj9M.js +1643 -0
- package/dist/ReportPreview-DY0PGGqF.cjs +6 -0
- package/dist/grid-geometry-DBH9ExuY.cjs +1 -0
- package/dist/grid-geometry-DONcjshk.js +130 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +806 -13
- package/dist/index.d.ts +806 -13
- package/dist/index.js +1170 -653
- package/dist/page-window-index-CIuT4BAv.js +43 -0
- package/dist/page-window-index-DEjnM6IB.cjs +1 -0
- package/dist/pdf.cjs +48 -48
- package/dist/pdf.d.cts +159 -6
- package/dist/pdf.d.ts +159 -6
- package/dist/pdf.js +3542 -3466
- package/dist/plugin-BMoMUxrw.cjs +1 -0
- package/dist/plugin-CAcNe0FT.js +25 -0
- package/dist/report-params-B3Fia6JO.js +10 -0
- package/dist/report-params-D1gZ1DME.cjs +1 -0
- package/dist/sql.cjs +65 -64
- package/dist/sql.d.cts +109 -5
- package/dist/sql.d.ts +109 -5
- package/dist/sql.js +7947 -7922
- package/dist/style.css +1 -1
- package/dist/textwrap-DdaewxAd.js +117 -0
- package/dist/textwrap-DqiFwAV3.cjs +3 -0
- package/dist/vue/async.d.cts +820 -320
- package/dist/vue/async.d.ts +820 -320
- package/dist/vue/index.d.cts +1374 -14
- package/dist/vue/index.d.ts +1374 -14
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +11 -12
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +129 -49
- package/dist/xlsx.cjs +21 -21
- package/dist/xlsx.d.cts +2300 -5
- package/dist/xlsx.d.ts +2300 -5
- package/dist/xlsx.js +6390 -6347
- package/package.json +8 -3
- package/dist/ReportPreview-Cr0IH1Rz.cjs +0 -6
- package/dist/ReportPreview-DwknBgsJ.js +0 -1266
- package/dist/builder/template-builder.d.ts +0 -69
- package/dist/defaults.d.ts +0 -23
- package/dist/format.d.ts +0 -48
- package/dist/grid-geometry-BXpOxznT.cjs +0 -1
- package/dist/grid-geometry-Bs8QXz1X.js +0 -65
- package/dist/layout/paginate.d.ts +0 -97
- package/dist/layout/textwrap.d.ts +0 -36
- package/dist/pdf/font-loader.d.ts +0 -6
- package/dist/pdf/index.d.ts +0 -2
- package/dist/pdf/render-pdf.d.ts +0 -25
- package/dist/plugin-Cj3c2wJc.cjs +0 -1
- package/dist/plugin-DJf_6_fl.js +0 -18
- package/dist/render/canvas.d.ts +0 -76
- package/dist/render/dom.d.ts +0 -10
- package/dist/render/grid-geometry.d.ts +0 -41
- package/dist/render/style.d.ts +0 -33
- package/dist/render/window.d.ts +0 -23
- package/dist/schema/render-plan.d.ts +0 -88
- package/dist/schema/validate.d.ts +0 -15
- package/dist/sql/ast-check.d.ts +0 -14
- package/dist/sql/compile.d.ts +0 -31
- package/dist/sql/expr.d.ts +0 -21
- package/dist/sql/index.d.ts +0 -4
- package/dist/sql/tokenizer.d.ts +0 -25
- package/dist/style-CFZ-HE2s.cjs +0 -3
- package/dist/style-DnmtG7Gl.js +0 -180
- package/dist/units.d.ts +0 -11
- package/dist/vue/ReportParamPanel.d.ts +0 -19
- package/dist/vue/ReportPreview.d.ts +0 -200
- package/dist/vue/ReportToolbar.d.ts +0 -42
- package/dist/vue/adapters.d.ts +0 -34
- package/dist/vue/composables/useHighlight.d.ts +0 -8
- package/dist/vue/composables/usePageWindow.d.ts +0 -25
- package/dist/vue/composables/usePrintExport.d.ts +0 -40
- package/dist/vue/composables/useReportSearch.d.ts +0 -73
- package/dist/vue/composables/useZoom.d.ts +0 -15
- package/dist/vue/config.d.ts +0 -108
- package/dist/vue/controller.d.ts +0 -29
- package/dist/vue/errors.d.ts +0 -16
- package/dist/vue/injection-keys.d.ts +0 -14
- package/dist/vue/local-adapter.d.ts +0 -11
- package/dist/vue/pdf-exporter.d.ts +0 -13
- package/dist/vue/plugin.d.ts +0 -332
- package/dist/xlsx/render-xlsx.d.ts +0 -20
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export type ComponentKind = "text" | "image" | "barcode" | "qrcode" | "chart" | "line" | "rect" | "ellipse";
|
|
2
|
-
export interface ComponentStyle {
|
|
3
|
-
fontSizePx?: number;
|
|
4
|
-
fontSize?: number;
|
|
5
|
-
fontFamily?: string;
|
|
6
|
-
bold?: boolean;
|
|
7
|
-
italic?: boolean;
|
|
8
|
-
underline?: boolean;
|
|
9
|
-
color?: string;
|
|
10
|
-
backgroundColor?: string;
|
|
11
|
-
align?: "left" | "center" | "right" | "justify";
|
|
12
|
-
verticalAlign?: "top" | "middle" | "bottom";
|
|
13
|
-
lineColor?: string;
|
|
14
|
-
borderColor?: string;
|
|
15
|
-
lineWidthPt?: number;
|
|
16
|
-
borderTop?: boolean;
|
|
17
|
-
borderRight?: boolean;
|
|
18
|
-
borderBottom?: boolean;
|
|
19
|
-
borderLeft?: boolean;
|
|
20
|
-
lineHeight?: number;
|
|
21
|
-
letterSpacing?: number;
|
|
22
|
-
opacity?: number;
|
|
23
|
-
rotateDeg?: number;
|
|
24
|
-
}
|
|
25
|
-
export interface RichParagraph {
|
|
26
|
-
segments: RichSegment[];
|
|
27
|
-
align?: ComponentStyle["align"];
|
|
28
|
-
lineHeight?: number;
|
|
29
|
-
spaceBeforeMm?: number;
|
|
30
|
-
spaceAfterMm?: number;
|
|
31
|
-
indentMm?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface RichSegment {
|
|
34
|
-
kind?: "text" | "field";
|
|
35
|
-
text?: string;
|
|
36
|
-
field?: string;
|
|
37
|
-
style?: ComponentStyle;
|
|
38
|
-
}
|
|
39
|
-
export interface GridCell {
|
|
40
|
-
text?: string;
|
|
41
|
-
rawText?: string;
|
|
42
|
-
children?: PlanComponent[];
|
|
43
|
-
colSpan?: number;
|
|
44
|
-
rowSpan?: number;
|
|
45
|
-
style?: ComponentStyle;
|
|
46
|
-
}
|
|
47
|
-
export interface PlanGrid {
|
|
48
|
-
/** 行内允许 null 空位;渲染器按空单元格处理 */
|
|
49
|
-
cells: (GridCell | null)[][];
|
|
50
|
-
colWidthsMm?: number[];
|
|
51
|
-
rowHeightsMm?: number[];
|
|
52
|
-
gapMm?: number;
|
|
53
|
-
}
|
|
54
|
-
export interface PlanComponent {
|
|
55
|
-
kind: ComponentKind;
|
|
56
|
-
leftMm: number;
|
|
57
|
-
topMm: number;
|
|
58
|
-
widthMm: number;
|
|
59
|
-
heightMm: number;
|
|
60
|
-
nid?: string;
|
|
61
|
-
rkey?: string;
|
|
62
|
-
text?: string;
|
|
63
|
-
rawText?: string;
|
|
64
|
-
lines?: string[];
|
|
65
|
-
richParagraphs?: RichParagraph[];
|
|
66
|
-
imageData?: string;
|
|
67
|
-
grid?: PlanGrid;
|
|
68
|
-
style?: ComponentStyle;
|
|
69
|
-
meta?: Record<string, unknown>;
|
|
70
|
-
/** MachReport 扩展字段:未知 kind 的兜底渲染标记 */
|
|
71
|
-
fallbackText?: string;
|
|
72
|
-
}
|
|
73
|
-
export interface PlanPage {
|
|
74
|
-
pageWidthMm: number;
|
|
75
|
-
pageHeightMm: number;
|
|
76
|
-
marginTopMm?: number;
|
|
77
|
-
marginBottomMm?: number;
|
|
78
|
-
marginLeftMm?: number;
|
|
79
|
-
marginRightMm?: number;
|
|
80
|
-
components: PlanComponent[];
|
|
81
|
-
}
|
|
82
|
-
export interface RenderPlan {
|
|
83
|
-
schemaVersion: string;
|
|
84
|
-
pages: PlanPage[];
|
|
85
|
-
}
|
|
86
|
-
export declare const RENDER_PLAN_SCHEMA_VERSION = "1.0.0-mach";
|
|
87
|
-
export declare function isImageBackedComponent(comp: PlanComponent): boolean;
|
|
88
|
-
export declare function isRichText(comp: PlanComponent): boolean;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PlanComponent, PlanPage } from './render-plan';
|
|
2
|
-
export interface ValidationError {
|
|
3
|
-
path: string;
|
|
4
|
-
message: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ValidationResult {
|
|
7
|
-
ok: boolean;
|
|
8
|
-
errors: ValidationError[];
|
|
9
|
-
warnings: ValidationError[];
|
|
10
|
-
}
|
|
11
|
-
export declare function validateComponent(comp: unknown, path: string, errors: ValidationError[], warnings?: ValidationError[]): void;
|
|
12
|
-
export declare function validatePage(page: unknown, path: string, errors: ValidationError[], warnings?: ValidationError[]): void;
|
|
13
|
-
export declare function validateRenderPlan(input: unknown): ValidationResult;
|
|
14
|
-
export declare function assertRenderPlan(input: unknown): PlanPage[];
|
|
15
|
-
export type { PlanComponent, PlanPage };
|
package/dist/sql/ast-check.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface AstCheckResult {
|
|
2
|
-
ok: boolean;
|
|
3
|
-
/** ast 深度校验是否执行(方言不支持时降级词法) */
|
|
4
|
-
degraded: boolean;
|
|
5
|
-
message?: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* AST 深度校验(双保险策略):
|
|
9
|
-
* 1. node-sql-parser(MySQL 方言,支持 ? 占位符)AST 顶层必须为 SELECT/集合运算
|
|
10
|
-
* 2. AST 通过后再叠加词法校验(MySQL 方言把 SELECT INTO 解析为别名,AST 层不可见,
|
|
11
|
-
* 由词法层兜底拦截)
|
|
12
|
-
* AST 解析失败(方言不兼容)自动降级为纯词法校验,返回 degraded=true。
|
|
13
|
-
*/
|
|
14
|
-
export declare function assertSingleSelectAst(sql: string): AstCheckResult;
|
package/dist/sql/compile.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export { SqlSyntaxError } from './tokenizer';
|
|
2
|
-
export interface RenderedSql {
|
|
3
|
-
sql: string;
|
|
4
|
-
binds: unknown[];
|
|
5
|
-
warnings: string[];
|
|
6
|
-
}
|
|
7
|
-
export interface CompiledSql {
|
|
8
|
-
original: string;
|
|
9
|
-
/** 参数名集合(bind 与 subst 并集) */
|
|
10
|
-
paramNames: string[];
|
|
11
|
-
render(params: Record<string, unknown>): RenderedSql;
|
|
12
|
-
}
|
|
13
|
-
export declare class SqlValidationError extends Error {
|
|
14
|
-
readonly sql: string;
|
|
15
|
-
constructor(message: string, sql: string);
|
|
16
|
-
}
|
|
17
|
-
export declare function compileDynamicSql(source: string): CompiledSql;
|
|
18
|
-
/**
|
|
19
|
-
* 去注释:-- 行注释、# 行注释(仅行首/空白后,且排除 #{ 绑定占位)、/* 块注释。
|
|
20
|
-
* 注意:此函数用于校验口径,输出会折叠空白。
|
|
21
|
-
*/
|
|
22
|
-
export declare function stripSqlComments(sql: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* 单 SELECT 结构校验(词法层;AST 级校验见 ast-check.ts 双保险):
|
|
25
|
-
* - 去注释后必须以 select 或 with 开头
|
|
26
|
-
* - 语句内除末尾外不允许出现分号
|
|
27
|
-
* - 顶层禁止 DML/DDL/调用关键字(字符串字面量内容不参与匹配)
|
|
28
|
-
*/
|
|
29
|
-
export declare function assertSingleSelect(sql: string): void;
|
|
30
|
-
/** 便捷入口:编译 + 渲染 + 校验一体 */
|
|
31
|
-
export declare function renderDynamicSql(source: string, params: Record<string, unknown>): RenderedSql;
|
package/dist/sql/expr.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface ExprContext {
|
|
2
|
-
params: Record<string, unknown>;
|
|
3
|
-
}
|
|
4
|
-
export declare class ExprError extends Error {
|
|
5
|
-
constructor(message: string);
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* 求值动态 SQL 条件表达式(用于 {if(cond, a, b)} 的 cond 与操作数):
|
|
9
|
-
* - #param 引用(渲染时被替换为参数值;此实现按值求值)
|
|
10
|
-
* - "..." 字符串字面量(仅双引号)
|
|
11
|
-
* - isEmpty(x)、isNotEmpty(x)
|
|
12
|
-
* - == / != 比较
|
|
13
|
-
* - + 拼接
|
|
14
|
-
*/
|
|
15
|
-
export declare function evalExpr(input: string, ctx: ExprContext): unknown;
|
|
16
|
-
/** {if(cond, whenTrue, whenFalse)} 的参数拆分(2 或 3 段) */
|
|
17
|
-
export declare function parseIfArgs(inner: string): {
|
|
18
|
-
cond: string;
|
|
19
|
-
whenTrue: string;
|
|
20
|
-
whenFalse: string;
|
|
21
|
-
};
|
package/dist/sql/index.d.ts
DELETED
package/dist/sql/tokenizer.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type TokenType = "literal" | "bind" | "subst" | "if" | "escape";
|
|
2
|
-
export interface Token {
|
|
3
|
-
type: TokenType;
|
|
4
|
-
text: string;
|
|
5
|
-
/** bind/subst 参数名;if 表达式源码 */
|
|
6
|
-
value?: string;
|
|
7
|
-
start: number;
|
|
8
|
-
end: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class SqlSyntaxError extends Error {
|
|
11
|
-
readonly position: number;
|
|
12
|
-
readonly source: string;
|
|
13
|
-
constructor(message: string, position: number, source: string);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* 扫描动态 SQL,产出 token 流:
|
|
17
|
-
* - literal: 纯 SQL 文本(已反转义 \{ \})
|
|
18
|
-
* - bind: #{name}
|
|
19
|
-
* - subst: ${name}
|
|
20
|
-
* - if: {if(expr, a, b)} —— value 为去壳后的参数串
|
|
21
|
-
* - escape: \{ 或 \}
|
|
22
|
-
*/
|
|
23
|
-
export declare function tokenize(sql: string): Token[];
|
|
24
|
-
/** 按顶层逗号拆分(忽略双引号内与括号/花括号内) */
|
|
25
|
-
export declare function splitTopLevel(input: string): string[];
|
package/dist/style-CFZ-HE2s.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";const m="#333333",M="#000000",E="1.0.0-mach";function h(t=96){return t/25.4}function l(t,e=96){return(t||0)*h(e)}function C(t,e=96){return t/h(e)}function d(t,e=96){return t*e/72}function A(t,e){const r=10**e;return Math.round(t*r)/r}const R={a3:{widthMm:297,heightMm:420},a4:{widthMm:210,heightMm:297},a5:{widthMm:148,heightMm:210},b4:{widthMm:250,heightMm:353},b5:{widthMm:176,heightMm:250}},x=E;function I(t){return(t.kind==="image"||t.kind==="barcode"||t.kind==="qrcode"||t.kind==="chart")&&!!t.imageData}function L(t){return t.kind==="text"&&Array.isArray(t.richParagraphs)&&t.richParagraphs.length>0}const P=/[\u3000-\u9fff\uff00-\uffef]/,f=new Uint8Array(128);{for(const t of"iljtf.,:;'`|!()[]")f[t.charCodeAt(0)]=1;for(const t of"mwMW@")f[t.charCodeAt(0)]=2;for(let t=48;t<=57;t++)f[t]=3;for(let t=65;t<=90;t++)f[t]=4;f[32]=5}const D=[.54,.26,.95,.59,.67,.3];function S(t){const e=t.charCodeAt(0);return e<128?D[f[e]]:P.test(t)?1:/[A-Z]/.test(t)?.67:.54}const a={measureMm(t,e){const{fontSizePt:r,bold:n=!1,letterSpacingPt:u=0}=e,c=25.4/72;let i=0;for(const o of t)i+=S(o);return n&&(i*=1.04),(i*r+u*t.length)*c}};function H(){return a}function g(t,e){return a.measureMm(t,e)}function w(t){let e;return{measureMm(r,n){if(e===void 0&&(e=t()),!e)return a.measureMm(r,n);const u=n.fontSizePt*96/72;return e.font=`${n.bold?"bold ":""}${u}px sans-serif`,e.measureText(r).width*25.4/96}}}function N(t,e,r){const n=[];let u="",c=0;const i=()=>{u&&(n.push({text:u,widthMm:c,cjk:!1}),u="",c=0)};for(const o of t){if(o===`
|
|
2
|
-
`){i(),n.push({text:`
|
|
3
|
-
`,widthMm:0,cjk:!1,br:!0});continue}if(o===" "){i(),n.push({text:o,widthMm:r.measureMm(o,e),cjk:!1,space:!0});continue}if(P.test(o)){i(),n.push({text:o,widthMm:r.measureMm(o,e),cjk:!0});continue}u+=o,c+=r.measureMm(o,e)}return i(),n}function O(t,e,r,n=a){if(!t)return[""];const u=[];let c="",i=0;const o=()=>{u.push(c),c="",i=0};for(const s of N(t,r,n)){if(s.br){o();continue}if(i+s.widthMm<=e){c+=s.text,i+=s.widthMm;continue}if(s.space){o();continue}if(s.cjk){c.length>0&&o(),c=s.text,i=s.widthMm;continue}if(c.length>0&&o(),s.widthMm<=e){c=s.text,i=s.widthMm;continue}for(const _ of s.text){const T=n.measureMm(_,r);i+T>e&&c.length>0&&o(),c+=_,i+=T}}return o(),u}function F(t,e=96,r=10.5){if(t?.fontSizePx!=null)return{fontSizePt:t.fontSizePx*72/e,fontSizePx:t.fontSizePx};const n=t?.fontSize??r;return{fontSizePt:n,fontSizePx:d(n,e)}}function k(t,e=m){return{color:t?.borderColor??t?.lineColor??e,widthPt:t?.lineWidthPt??.75}}function b(t,e=M){return t?.color??e}function p(t){return t?.lineHeight??1.35}function v(t){const e=t?.borderTop!==!1,r=t?.borderRight!==!1,n=t?.borderBottom!==!1,u=t?.borderLeft!==!1;return{top:e,right:r,bottom:n,left:u,inner:e||r||n||u}}exports.CSS_DPI=96;exports.DEFAULT_BORDER_PT=.75;exports.DEFAULT_FONT_PT=10.5;exports.DEFAULT_STROKE_COLOR=m;exports.DEFAULT_TEXT_COLOR=M;exports.LINE_HEIGHT=1.35;exports.MM_PER_INCH=25.4;exports.PAPER_SIZES=R;exports.RENDER_PLAN_SCHEMA_VERSION=x;exports.SCHEMA_VERSION_MACH=E;exports.charWidthEm=S;exports.createCanvasMeasurer=w;exports.createHeuristicMeasurer=H;exports.heuristicMeasurer=a;exports.isImageBackedComponent=I;exports.isRichText=L;exports.measureTextMm=g;exports.mmToPx=l;exports.mmToPxFactor=h;exports.ptToPx=d;exports.pxToMm=C;exports.resolveBoxBorders=v;exports.resolveFontSize=F;exports.resolveLineHeight=p;exports.resolveStroke=k;exports.resolveTextColor=b;exports.round=A;exports.wrapText=O;
|
package/dist/style-DnmtG7Gl.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
const C = 1.35, w = 10.5, g = 0.75, l = "#333333", S = "#000000", P = "1.0.0-mach", A = 25.4, I = 96;
|
|
2
|
-
function m(t = 96) {
|
|
3
|
-
return t / 25.4;
|
|
4
|
-
}
|
|
5
|
-
function L(t, e = 96) {
|
|
6
|
-
return (t || 0) * m(e);
|
|
7
|
-
}
|
|
8
|
-
function R(t, e = 96) {
|
|
9
|
-
return t / m(e);
|
|
10
|
-
}
|
|
11
|
-
function _(t, e = 96) {
|
|
12
|
-
return t * e / 72;
|
|
13
|
-
}
|
|
14
|
-
function D(t, e) {
|
|
15
|
-
const r = 10 ** e;
|
|
16
|
-
return Math.round(t * r) / r;
|
|
17
|
-
}
|
|
18
|
-
const b = {
|
|
19
|
-
a3: { widthMm: 297, heightMm: 420 },
|
|
20
|
-
a4: { widthMm: 210, heightMm: 297 },
|
|
21
|
-
a5: { widthMm: 148, heightMm: 210 },
|
|
22
|
-
b4: { widthMm: 250, heightMm: 353 },
|
|
23
|
-
b5: { widthMm: 176, heightMm: 250 }
|
|
24
|
-
}, k = P;
|
|
25
|
-
function H(t) {
|
|
26
|
-
return (t.kind === "image" || t.kind === "barcode" || t.kind === "qrcode" || t.kind === "chart") && !!t.imageData;
|
|
27
|
-
}
|
|
28
|
-
function z(t) {
|
|
29
|
-
return t.kind === "text" && Array.isArray(t.richParagraphs) && t.richParagraphs.length > 0;
|
|
30
|
-
}
|
|
31
|
-
const M = /[\u3000-\u9fff\uff00-\uffef]/, u = new Uint8Array(128);
|
|
32
|
-
{
|
|
33
|
-
for (const t of "iljtf.,:;'`|!()[]") u[t.charCodeAt(0)] = 1;
|
|
34
|
-
for (const t of "mwMW@") u[t.charCodeAt(0)] = 2;
|
|
35
|
-
for (let t = 48; t <= 57; t++) u[t] = 3;
|
|
36
|
-
for (let t = 65; t <= 90; t++) u[t] = 4;
|
|
37
|
-
u[32] = 5;
|
|
38
|
-
}
|
|
39
|
-
const T = [0.54, 0.26, 0.95, 0.59, 0.67, 0.3];
|
|
40
|
-
function E(t) {
|
|
41
|
-
const e = t.charCodeAt(0);
|
|
42
|
-
return e < 128 ? T[u[e]] : M.test(t) ? 1 : /[A-Z]/.test(t) ? 0.67 : 0.54;
|
|
43
|
-
}
|
|
44
|
-
const a = {
|
|
45
|
-
measureMm(t, e) {
|
|
46
|
-
const { fontSizePt: r, bold: n = !1, letterSpacingPt: c = 0 } = e, s = 25.4 / 72;
|
|
47
|
-
let i = 0;
|
|
48
|
-
for (const o of t)
|
|
49
|
-
i += E(o);
|
|
50
|
-
return n && (i *= 1.04), (i * r + c * t.length) * s;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
function N() {
|
|
54
|
-
return a;
|
|
55
|
-
}
|
|
56
|
-
function p(t, e) {
|
|
57
|
-
return a.measureMm(t, e);
|
|
58
|
-
}
|
|
59
|
-
function O(t) {
|
|
60
|
-
let e;
|
|
61
|
-
return {
|
|
62
|
-
measureMm(r, n) {
|
|
63
|
-
if (e === void 0 && (e = t()), !e) return a.measureMm(r, n);
|
|
64
|
-
const c = n.fontSizePt * 96 / 72;
|
|
65
|
-
return e.font = `${n.bold ? "bold " : ""}${c}px sans-serif`, e.measureText(r).width * 25.4 / 96;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function x(t, e, r) {
|
|
70
|
-
const n = [];
|
|
71
|
-
let c = "", s = 0;
|
|
72
|
-
const i = () => {
|
|
73
|
-
c && (n.push({ text: c, widthMm: s, cjk: !1 }), c = "", s = 0);
|
|
74
|
-
};
|
|
75
|
-
for (const o of t) {
|
|
76
|
-
if (o === `
|
|
77
|
-
`) {
|
|
78
|
-
i(), n.push({ text: `
|
|
79
|
-
`, widthMm: 0, cjk: !1, br: !0 });
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
if (o === " ") {
|
|
83
|
-
i(), n.push({ text: o, widthMm: r.measureMm(o, e), cjk: !1, space: !0 });
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (M.test(o)) {
|
|
87
|
-
i(), n.push({ text: o, widthMm: r.measureMm(o, e), cjk: !0 });
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
c += o, s += r.measureMm(o, e);
|
|
91
|
-
}
|
|
92
|
-
return i(), n;
|
|
93
|
-
}
|
|
94
|
-
function F(t, e, r, n = a) {
|
|
95
|
-
if (!t) return [""];
|
|
96
|
-
const c = [];
|
|
97
|
-
let s = "", i = 0;
|
|
98
|
-
const o = () => {
|
|
99
|
-
c.push(s), s = "", i = 0;
|
|
100
|
-
};
|
|
101
|
-
for (const f of x(t, r, n)) {
|
|
102
|
-
if (f.br) {
|
|
103
|
-
o();
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
if (i + f.widthMm <= e) {
|
|
107
|
-
s += f.text, i += f.widthMm;
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
if (f.space) {
|
|
111
|
-
o();
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
if (f.cjk) {
|
|
115
|
-
s.length > 0 && o(), s = f.text, i = f.widthMm;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
if (s.length > 0 && o(), f.widthMm <= e) {
|
|
119
|
-
s = f.text, i = f.widthMm;
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
for (const h of f.text) {
|
|
123
|
-
const d = n.measureMm(h, r);
|
|
124
|
-
i + d > e && s.length > 0 && o(), s += h, i += d;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return o(), c;
|
|
128
|
-
}
|
|
129
|
-
function j(t, e = 96, r = 10.5) {
|
|
130
|
-
if (t?.fontSizePx != null)
|
|
131
|
-
return { fontSizePt: t.fontSizePx * 72 / e, fontSizePx: t.fontSizePx };
|
|
132
|
-
const n = t?.fontSize ?? r;
|
|
133
|
-
return { fontSizePt: n, fontSizePx: _(n, e) };
|
|
134
|
-
}
|
|
135
|
-
function v(t, e = l) {
|
|
136
|
-
return {
|
|
137
|
-
color: t?.borderColor ?? t?.lineColor ?? e,
|
|
138
|
-
widthPt: t?.lineWidthPt ?? 0.75
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function U(t, e = S) {
|
|
142
|
-
return t?.color ?? e;
|
|
143
|
-
}
|
|
144
|
-
function B(t) {
|
|
145
|
-
return t?.lineHeight ?? 1.35;
|
|
146
|
-
}
|
|
147
|
-
function W(t) {
|
|
148
|
-
const e = t?.borderTop !== !1, r = t?.borderRight !== !1, n = t?.borderBottom !== !1, c = t?.borderLeft !== !1;
|
|
149
|
-
return { top: e, right: r, bottom: n, left: c, inner: e || r || n || c };
|
|
150
|
-
}
|
|
151
|
-
export {
|
|
152
|
-
I as C,
|
|
153
|
-
w as D,
|
|
154
|
-
C as L,
|
|
155
|
-
A as M,
|
|
156
|
-
b as P,
|
|
157
|
-
k as R,
|
|
158
|
-
P as S,
|
|
159
|
-
j as a,
|
|
160
|
-
z as b,
|
|
161
|
-
v as c,
|
|
162
|
-
W as d,
|
|
163
|
-
B as e,
|
|
164
|
-
U as f,
|
|
165
|
-
S as g,
|
|
166
|
-
a as h,
|
|
167
|
-
H as i,
|
|
168
|
-
g as j,
|
|
169
|
-
l as k,
|
|
170
|
-
E as l,
|
|
171
|
-
L as m,
|
|
172
|
-
O as n,
|
|
173
|
-
N as o,
|
|
174
|
-
_ as p,
|
|
175
|
-
p as q,
|
|
176
|
-
D as r,
|
|
177
|
-
m as s,
|
|
178
|
-
R as t,
|
|
179
|
-
F as w
|
|
180
|
-
};
|
package/dist/units.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const MM_PER_INCH = 25.4;
|
|
2
|
-
export declare const CSS_DPI = 96;
|
|
3
|
-
export declare function mmToPxFactor(dpi?: number): number;
|
|
4
|
-
export declare function mmToPx(value: number, dpi?: number): number;
|
|
5
|
-
export declare function pxToMm(value: number, dpi?: number): number;
|
|
6
|
-
export declare function ptToPx(pt: number, dpi?: number): number;
|
|
7
|
-
export declare function round(value: number, digits: number): number;
|
|
8
|
-
export declare const PAPER_SIZES: Record<string, {
|
|
9
|
-
widthMm: number;
|
|
10
|
-
heightMm: number;
|
|
11
|
-
}>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ReportParamDef } from '@agile-team/mach-report';
|
|
2
|
-
import { MachReportMessages } from './config';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
defs: ReportParamDef[];
|
|
5
|
-
modelValue: Record<string, string>;
|
|
6
|
-
messages: MachReportMessages;
|
|
7
|
-
/** 触发过查询后才开始必填提示(避免首屏一片红) */
|
|
8
|
-
attempted: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
11
|
-
reset: () => any;
|
|
12
|
-
query: () => any;
|
|
13
|
-
"update:modelValue": (value: Record<string, string>) => any;
|
|
14
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
-
onReset?: (() => any) | undefined;
|
|
16
|
-
onQuery?: (() => any) | undefined;
|
|
17
|
-
"onUpdate:modelValue"?: ((value: Record<string, string>) => any) | undefined;
|
|
18
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
19
|
-
export default _default;
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
2
|
-
import { PlanFetcher } from './adapters';
|
|
3
|
-
import { ReportParamDef } from '@agile-team/mach-report';
|
|
4
|
-
import { MachReportMessages } from './config';
|
|
5
|
-
declare function reload(): Promise<void>;
|
|
6
|
-
declare function gotoPage(n: number): void;
|
|
7
|
-
/** 控制器注入:后代组件 useReportPreview() 免模板 ref 编程式访问(与 expose 同面) */
|
|
8
|
-
/** 编程式设参查询:合并进面板值(面板本地字典经 v-model 同步),可选立即重载 */
|
|
9
|
-
declare function setParams(values: Record<string, string>, opts?: {
|
|
10
|
-
reload?: boolean;
|
|
11
|
-
}): void;
|
|
12
|
-
declare function __VLS_template(): {
|
|
13
|
-
attrs: Partial<{}>;
|
|
14
|
-
slots: {
|
|
15
|
-
default?(_: {}): any;
|
|
16
|
-
};
|
|
17
|
-
refs: {
|
|
18
|
-
viewportRef: HTMLDivElement;
|
|
19
|
-
containerRef: HTMLDivElement;
|
|
20
|
-
thumbsRef: HTMLElement;
|
|
21
|
-
};
|
|
22
|
-
rootEl: HTMLDivElement;
|
|
23
|
-
};
|
|
24
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
25
|
-
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
26
|
-
reportId: {
|
|
27
|
-
type: PropType<string | string[] | null>;
|
|
28
|
-
default: null;
|
|
29
|
-
};
|
|
30
|
-
params: {
|
|
31
|
-
type: PropType<Record<string, string>>;
|
|
32
|
-
default: () => {};
|
|
33
|
-
};
|
|
34
|
-
height: {
|
|
35
|
-
type: StringConstructor;
|
|
36
|
-
default: string;
|
|
37
|
-
};
|
|
38
|
-
autoLoad: {
|
|
39
|
-
type: BooleanConstructor;
|
|
40
|
-
default: boolean;
|
|
41
|
-
};
|
|
42
|
-
/** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
|
|
43
|
-
showExport: {
|
|
44
|
-
type: BooleanConstructor;
|
|
45
|
-
default: undefined;
|
|
46
|
-
};
|
|
47
|
-
showPrint: {
|
|
48
|
-
type: BooleanConstructor;
|
|
49
|
-
default: undefined;
|
|
50
|
-
};
|
|
51
|
-
showPdfWindow: {
|
|
52
|
-
type: BooleanConstructor;
|
|
53
|
-
default: undefined;
|
|
54
|
-
};
|
|
55
|
-
/** 页间距(px);不传走配置中心 */
|
|
56
|
-
gapPx: {
|
|
57
|
-
type: NumberConstructor;
|
|
58
|
-
default: undefined;
|
|
59
|
-
};
|
|
60
|
-
/** 工具栏/状态文案覆写(不传走配置中心 messages) */
|
|
61
|
-
messages: {
|
|
62
|
-
type: PropType<Partial<MachReportMessages>>;
|
|
63
|
-
default: undefined;
|
|
64
|
-
};
|
|
65
|
-
/** 启用的 preset 名(不传用配置中心 defaultPreset) */
|
|
66
|
-
preset: {
|
|
67
|
-
type: StringConstructor;
|
|
68
|
-
default: undefined;
|
|
69
|
-
};
|
|
70
|
-
/** 调试面板(也可用 URL ?mrp-debug=1 开启) */
|
|
71
|
-
debug: {
|
|
72
|
-
type: BooleanConstructor;
|
|
73
|
-
default: boolean;
|
|
74
|
-
};
|
|
75
|
-
/** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
|
|
76
|
-
paramDefs: {
|
|
77
|
-
type: PropType<ReportParamDef[] | undefined>;
|
|
78
|
-
default: undefined;
|
|
79
|
-
};
|
|
80
|
-
/** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
|
|
81
|
-
showParams: {
|
|
82
|
-
type: BooleanConstructor;
|
|
83
|
-
default: undefined;
|
|
84
|
-
};
|
|
85
|
-
fetcher: {
|
|
86
|
-
type: PropType<PlanFetcher | null>;
|
|
87
|
-
default: null;
|
|
88
|
-
};
|
|
89
|
-
}>, {
|
|
90
|
-
reload: typeof reload;
|
|
91
|
-
print: () => Promise<void>;
|
|
92
|
-
exportAs: (format: string) => void;
|
|
93
|
-
openPdfWindow: () => void;
|
|
94
|
-
gotoPage: typeof gotoPage;
|
|
95
|
-
setParams: typeof setParams;
|
|
96
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
97
|
-
error: (message: string, detail?: {
|
|
98
|
-
code: string;
|
|
99
|
-
cause?: unknown;
|
|
100
|
-
} | undefined) => any;
|
|
101
|
-
loaded: (pageCount: number) => any;
|
|
102
|
-
warning: (message: string) => any;
|
|
103
|
-
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
104
|
-
reportId: {
|
|
105
|
-
type: PropType<string | string[] | null>;
|
|
106
|
-
default: null;
|
|
107
|
-
};
|
|
108
|
-
params: {
|
|
109
|
-
type: PropType<Record<string, string>>;
|
|
110
|
-
default: () => {};
|
|
111
|
-
};
|
|
112
|
-
height: {
|
|
113
|
-
type: StringConstructor;
|
|
114
|
-
default: string;
|
|
115
|
-
};
|
|
116
|
-
autoLoad: {
|
|
117
|
-
type: BooleanConstructor;
|
|
118
|
-
default: boolean;
|
|
119
|
-
};
|
|
120
|
-
/** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
|
|
121
|
-
showExport: {
|
|
122
|
-
type: BooleanConstructor;
|
|
123
|
-
default: undefined;
|
|
124
|
-
};
|
|
125
|
-
showPrint: {
|
|
126
|
-
type: BooleanConstructor;
|
|
127
|
-
default: undefined;
|
|
128
|
-
};
|
|
129
|
-
showPdfWindow: {
|
|
130
|
-
type: BooleanConstructor;
|
|
131
|
-
default: undefined;
|
|
132
|
-
};
|
|
133
|
-
/** 页间距(px);不传走配置中心 */
|
|
134
|
-
gapPx: {
|
|
135
|
-
type: NumberConstructor;
|
|
136
|
-
default: undefined;
|
|
137
|
-
};
|
|
138
|
-
/** 工具栏/状态文案覆写(不传走配置中心 messages) */
|
|
139
|
-
messages: {
|
|
140
|
-
type: PropType<Partial<MachReportMessages>>;
|
|
141
|
-
default: undefined;
|
|
142
|
-
};
|
|
143
|
-
/** 启用的 preset 名(不传用配置中心 defaultPreset) */
|
|
144
|
-
preset: {
|
|
145
|
-
type: StringConstructor;
|
|
146
|
-
default: undefined;
|
|
147
|
-
};
|
|
148
|
-
/** 调试面板(也可用 URL ?mrp-debug=1 开启) */
|
|
149
|
-
debug: {
|
|
150
|
-
type: BooleanConstructor;
|
|
151
|
-
default: boolean;
|
|
152
|
-
};
|
|
153
|
-
/** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
|
|
154
|
-
paramDefs: {
|
|
155
|
-
type: PropType<ReportParamDef[] | undefined>;
|
|
156
|
-
default: undefined;
|
|
157
|
-
};
|
|
158
|
-
/** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
|
|
159
|
-
showParams: {
|
|
160
|
-
type: BooleanConstructor;
|
|
161
|
-
default: undefined;
|
|
162
|
-
};
|
|
163
|
-
fetcher: {
|
|
164
|
-
type: PropType<PlanFetcher | null>;
|
|
165
|
-
default: null;
|
|
166
|
-
};
|
|
167
|
-
}>> & Readonly<{
|
|
168
|
-
onError?: ((message: string, detail?: {
|
|
169
|
-
code: string;
|
|
170
|
-
cause?: unknown;
|
|
171
|
-
} | undefined) => any) | undefined;
|
|
172
|
-
onLoaded?: ((pageCount: number) => any) | undefined;
|
|
173
|
-
onWarning?: ((message: string) => any) | undefined;
|
|
174
|
-
}>, {
|
|
175
|
-
height: string;
|
|
176
|
-
gapPx: number;
|
|
177
|
-
params: Record<string, string>;
|
|
178
|
-
debug: boolean;
|
|
179
|
-
showExport: boolean;
|
|
180
|
-
showPrint: boolean;
|
|
181
|
-
showPdfWindow: boolean;
|
|
182
|
-
showParams: boolean;
|
|
183
|
-
messages: Partial<MachReportMessages>;
|
|
184
|
-
reportId: string | string[] | null;
|
|
185
|
-
autoLoad: boolean;
|
|
186
|
-
preset: string;
|
|
187
|
-
paramDefs: ReportParamDef[] | undefined;
|
|
188
|
-
fetcher: PlanFetcher | null;
|
|
189
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
190
|
-
viewportRef: HTMLDivElement;
|
|
191
|
-
containerRef: HTMLDivElement;
|
|
192
|
-
thumbsRef: HTMLElement;
|
|
193
|
-
}, HTMLDivElement>;
|
|
194
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
195
|
-
export default _default;
|
|
196
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
197
|
-
new (): {
|
|
198
|
-
$slots: S;
|
|
199
|
-
};
|
|
200
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { MachReportMessages } from './config';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
pageCount: number;
|
|
4
|
-
currentPage: number;
|
|
5
|
-
zoomMode: "fit" | "raw";
|
|
6
|
-
zoom: number;
|
|
7
|
-
showExport: boolean;
|
|
8
|
-
showPrint: boolean;
|
|
9
|
-
showPdfWindow: boolean;
|
|
10
|
-
messages: MachReportMessages;
|
|
11
|
-
search: {
|
|
12
|
-
visible: boolean;
|
|
13
|
-
query: string;
|
|
14
|
-
matchIndex: number;
|
|
15
|
-
matchCount: number;
|
|
16
|
-
};
|
|
17
|
-
thumbsVisible: boolean;
|
|
18
|
-
};
|
|
19
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
20
|
-
export: (format: "html" | "png" | "pdf" | "xlsx" | "word") => any;
|
|
21
|
-
zoom: (mode: number | "fit") => any;
|
|
22
|
-
print: () => any;
|
|
23
|
-
goto: (page: number) => any;
|
|
24
|
-
"pdf-window": () => any;
|
|
25
|
-
"search-input": (query: string) => any;
|
|
26
|
-
"search-nav": (dir: 1 | -1) => any;
|
|
27
|
-
"search-toggle": () => any;
|
|
28
|
-
"thumbs-toggle": () => any;
|
|
29
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
30
|
-
onExport?: ((format: "html" | "png" | "pdf" | "xlsx" | "word") => any) | undefined;
|
|
31
|
-
onZoom?: ((mode: number | "fit") => any) | undefined;
|
|
32
|
-
onPrint?: (() => any) | undefined;
|
|
33
|
-
onGoto?: ((page: number) => any) | undefined;
|
|
34
|
-
"onPdf-window"?: (() => any) | undefined;
|
|
35
|
-
"onSearch-input"?: ((query: string) => any) | undefined;
|
|
36
|
-
"onSearch-nav"?: ((dir: 1 | -1) => any) | undefined;
|
|
37
|
-
"onSearch-toggle"?: (() => any) | undefined;
|
|
38
|
-
"onThumbs-toggle"?: (() => any) | undefined;
|
|
39
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
40
|
-
searchInputRef: HTMLInputElement;
|
|
41
|
-
}, HTMLDivElement>;
|
|
42
|
-
export default _default;
|