@freereportjs/core 0.8.0 → 0.10.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/dist/cdn/freereport.esm.js +55 -55
- package/dist/cdn/freereport.min.js +44 -44
- package/dist/index.d.ts +58 -3
- package/dist/index.js +294 -169
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,11 @@ interface ElementBase {
|
|
|
79
79
|
* of the band, so cells of a table row stay the same height.
|
|
80
80
|
*/
|
|
81
81
|
stretch?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Move down when an element above it grows (canGrow), by as much as that element grew, so
|
|
84
|
+
* long text pushes the rest of the band down instead of overlapping it. Default true.
|
|
85
|
+
*/
|
|
86
|
+
shift?: boolean;
|
|
82
87
|
/** Excel export: column name in "data" mode; ignored elsewhere. */
|
|
83
88
|
name?: string;
|
|
84
89
|
}
|
|
@@ -433,6 +438,8 @@ interface TextItem {
|
|
|
433
438
|
/** Rotation in degrees around the box centre (watermarks). */
|
|
434
439
|
rotate?: number;
|
|
435
440
|
opacity?: number;
|
|
441
|
+
/** The text does not fit its box and is cut off (a box that cannot grow, or a page-sized band). */
|
|
442
|
+
overflow?: boolean;
|
|
436
443
|
source?: ItemSource;
|
|
437
444
|
}
|
|
438
445
|
interface LineItem {
|
|
@@ -489,6 +496,21 @@ interface ReportPage {
|
|
|
489
496
|
width: number;
|
|
490
497
|
height: number;
|
|
491
498
|
items: PageItem[];
|
|
499
|
+
/** Where each element with an id landed (only with the `anchors` layout option). */
|
|
500
|
+
anchors?: ElementAnchor[];
|
|
501
|
+
}
|
|
502
|
+
/** The box of one element instance on a page, in mm from the page's top-left corner. */
|
|
503
|
+
interface ElementAnchor {
|
|
504
|
+
id: string;
|
|
505
|
+
band: BandKind;
|
|
506
|
+
/** Detail row index (detail band only). */
|
|
507
|
+
row?: number;
|
|
508
|
+
x: number;
|
|
509
|
+
y: number;
|
|
510
|
+
w: number;
|
|
511
|
+
h: number;
|
|
512
|
+
/** Its `visible` expression was false: the box it would have used. */
|
|
513
|
+
hidden?: boolean;
|
|
492
514
|
}
|
|
493
515
|
interface LayoutResult {
|
|
494
516
|
pages: ReportPage[];
|
|
@@ -511,6 +533,11 @@ interface LayoutOptions {
|
|
|
511
533
|
locale?: string;
|
|
512
534
|
/** Stop after this many pages (safety net for runaway reports). Default 10000. */
|
|
513
535
|
maxPages?: number;
|
|
536
|
+
/**
|
|
537
|
+
* Record the box of every element with an id on each page (`page.anchors`), including empty
|
|
538
|
+
* text and hidden elements. `report.anchors()` turns this on for you.
|
|
539
|
+
*/
|
|
540
|
+
anchors?: boolean;
|
|
514
541
|
}
|
|
515
542
|
interface TextMeasurer {
|
|
516
543
|
/** Width of the text in mm. */
|
|
@@ -749,6 +776,13 @@ interface ReportOptions extends LayoutOptions {
|
|
|
749
776
|
*/
|
|
750
777
|
directPrint?: boolean | AgentPrintOptions;
|
|
751
778
|
}
|
|
779
|
+
/** Where an element landed: its box in mm on a page, with that page's size. */
|
|
780
|
+
interface ReportAnchor extends ElementAnchor {
|
|
781
|
+
/** 1-based index of the page in the laid-out report (not the printed page number). */
|
|
782
|
+
page: number;
|
|
783
|
+
pageWidth: number;
|
|
784
|
+
pageHeight: number;
|
|
785
|
+
}
|
|
752
786
|
interface Report {
|
|
753
787
|
readonly definition: ReportDefinition;
|
|
754
788
|
/** Lay out (cached until data, params or the definition change). */
|
|
@@ -767,6 +801,12 @@ interface Report {
|
|
|
767
801
|
toCsv(): Promise<Blob | null>;
|
|
768
802
|
/** 한/글 document (.hwpx, KS X 6101) laid out like the printed pages. */
|
|
769
803
|
toHwpx(): Promise<Blob | null>;
|
|
804
|
+
/**
|
|
805
|
+
* Boxes of the elements with an id, page by page (mm from the page's top-left corner), including
|
|
806
|
+
* empty text and hidden elements: for signature fields, form overlays and tests. `prefix` keeps
|
|
807
|
+
* only ids that start with it, e.g. "sp:".
|
|
808
|
+
*/
|
|
809
|
+
anchors(prefix?: string): ReportAnchor[];
|
|
770
810
|
/** SHA-256 of the printed text (원본 확인); also available as `docHash` when the definition sets `fingerprint`. */
|
|
771
811
|
fingerprint(): string;
|
|
772
812
|
/** Save a file through the browser's download. */
|
|
@@ -795,6 +835,21 @@ interface ViewerOptions extends ReportOptions {
|
|
|
795
835
|
/** Show the parameter panel open at start (default: when the report has parameters without defaults). */
|
|
796
836
|
paramsOpen?: boolean;
|
|
797
837
|
fileName?: string;
|
|
838
|
+
/** After every successful run (start, 조회/Run, setData, setParams, setDefinition): page and row counts. */
|
|
839
|
+
onReady?: (e: ViewerReadyEvent) => void;
|
|
840
|
+
/** When the user submits the parameter panel, before the data is fetched. Return false to stay (e.g. failed validation), or return changed params. */
|
|
841
|
+
onParamsSubmit?: (params: Record<string, unknown>) => boolean | void | Record<string, unknown> | Promise<boolean | void | Record<string, unknown>>;
|
|
842
|
+
/** The page in view changed (1-based). */
|
|
843
|
+
onPageChange?: (page: number, total: number) => void;
|
|
844
|
+
/** Loading data, laying out, printing or saving failed. The viewer still shows its own message. */
|
|
845
|
+
onError?: (error: Error, during: 'data' | 'layout' | 'output') => void;
|
|
846
|
+
}
|
|
847
|
+
interface ViewerReadyEvent {
|
|
848
|
+
pages: number;
|
|
849
|
+
rows: number;
|
|
850
|
+
/** Layout time in milliseconds. */
|
|
851
|
+
ms: number;
|
|
852
|
+
params: Record<string, unknown>;
|
|
798
853
|
}
|
|
799
854
|
interface Viewer {
|
|
800
855
|
readonly report: Report;
|
|
@@ -997,7 +1052,7 @@ declare function checkExpression(src: string): string | null;
|
|
|
997
1052
|
* Fill a text template: "Page {page} / {pages}", "{amount:#,##0} 원". The part after the last
|
|
998
1053
|
* top-level ":" is a format when it does not parse as part of the expression ("{a ? b : c}" works).
|
|
999
1054
|
*/
|
|
1000
|
-
declare function interpolate(template: string, scope: Scope): string;
|
|
1055
|
+
declare function interpolate(template: string, scope: Scope, locale?: string): string;
|
|
1001
1056
|
|
|
1002
1057
|
/**
|
|
1003
1058
|
* Value formatting for report fields.
|
|
@@ -1130,7 +1185,7 @@ declare function verifyLicense(key: string, host: string, opts?: {
|
|
|
1130
1185
|
declare function setLicenseKey(key: string): void;
|
|
1131
1186
|
|
|
1132
1187
|
/** FreeReport version (kept in sync with releases.json by scripts/release.mjs). */
|
|
1133
|
-
declare const version = "0.
|
|
1188
|
+
declare const version = "0.10.0";
|
|
1134
1189
|
|
|
1135
1190
|
type Lang = 'ko' | 'en';
|
|
1136
1191
|
|
|
@@ -1192,4 +1247,4 @@ declare function renderXlsx(def: ReportDefinition, data?: ReportData, opts?: Ser
|
|
|
1192
1247
|
mode?: 'form' | 'data';
|
|
1193
1248
|
}): Promise<Uint8Array>;
|
|
1194
1249
|
|
|
1195
|
-
export { AgentError, type AgentLogEntry, type AgentPrintOptions, type AgentPrintResult, type AgentPrinter, type AgentStatus, type Align, type Band, type BandKind, type BarcodeElement, type BorderInput, type BorderSide, type BoxItem, type ChartElement, type ChartSeries, type CrosstabElement, type Designer, type DesignerOptions, type ElementType, type Emboss, type Expr, FUNCTIONS, type FieldElement, type FontBytes, type FontEntry, type GroupDefinition, type ImageElement, type ImageItem, type ItemSource, type LayoutOptions, type LayoutResult, type LicenseInfo, type LineElement, type LineItem, type OutputEvent, type OutputKind, PAPER, type PageItem, type PageSetup, type PaperSize, type ParamDefinition, type PathCommand, type PathItem, type PdfFontSource, type PdfOptions, type PdfPermissions, type PdfSecurity, type PrintOptions, type RectElement, type Report, type ReportData, type ReportDefinition, type ReportElement, type ReportOptions, type ReportPage, type ResolvedBorder, type ResolvedFont, type ServerRenderOptions, type Style, type TableColumn, type TableElement, type TextElement, type TextItem, type TextLine, type TextMeasurer, type VAlign, type Viewer, type ViewerOptions, type Watermark, type XCell, type XCellStyle, type XSheet, agent, applyEmboss, blankReport, canonicalText, canvasMeasurer, checkExpression, compile, contentWidth, createDesigner, createReport, createViewer, dataToCsv, dataToXlsx, defaultMeasurer, embossImage, encodeCode128, encodeDataMatrix, encodeEan13, encodePdf417, encodeQr, ensureFonts, estimateMeasurer, evaluate, fingerprintPages, formatDate, formatNumber, formatValue, getFont, interpolate, koreanAmount, koreanNumber, layoutReport, loadFontBytes, loadFonts, pageGeometry, pageToSvg, pagesToHwpx, pagesToXlsx, paramValues, printPages, registerFont, renderPage, renderPdf, renderXlsx, resetMeasurer, rowsOf, saveFile, setLicenseKey, sha256Hex, ttfMeasurer, verifyLicense, version, wrapText, writePdf, writeXlsx };
|
|
1250
|
+
export { AgentError, type AgentLogEntry, type AgentPrintOptions, type AgentPrintResult, type AgentPrinter, type AgentStatus, type Align, type Band, type BandKind, type BarcodeElement, type BorderInput, type BorderSide, type BoxItem, type ChartElement, type ChartSeries, type CrosstabElement, type Designer, type DesignerOptions, type ElementAnchor, type ElementType, type Emboss, type Expr, FUNCTIONS, type FieldElement, type FontBytes, type FontEntry, type GroupDefinition, type ImageElement, type ImageItem, type ItemSource, type LayoutOptions, type LayoutResult, type LicenseInfo, type LineElement, type LineItem, type OutputEvent, type OutputKind, PAPER, type PageItem, type PageSetup, type PaperSize, type ParamDefinition, type PathCommand, type PathItem, type PdfFontSource, type PdfOptions, type PdfPermissions, type PdfSecurity, type PrintOptions, type RectElement, type Report, type ReportAnchor, type ReportData, type ReportDefinition, type ReportElement, type ReportOptions, type ReportPage, type ResolvedBorder, type ResolvedFont, type ServerRenderOptions, type Style, type TableColumn, type TableElement, type TextElement, type TextItem, type TextLine, type TextMeasurer, type VAlign, type Viewer, type ViewerOptions, type ViewerReadyEvent, type Watermark, type XCell, type XCellStyle, type XSheet, agent, applyEmboss, blankReport, canonicalText, canvasMeasurer, checkExpression, compile, contentWidth, createDesigner, createReport, createViewer, dataToCsv, dataToXlsx, defaultMeasurer, embossImage, encodeCode128, encodeDataMatrix, encodeEan13, encodePdf417, encodeQr, ensureFonts, estimateMeasurer, evaluate, fingerprintPages, formatDate, formatNumber, formatValue, getFont, interpolate, koreanAmount, koreanNumber, layoutReport, loadFontBytes, loadFonts, pageGeometry, pageToSvg, pagesToHwpx, pagesToXlsx, paramValues, printPages, registerFont, renderPage, renderPdf, renderXlsx, resetMeasurer, rowsOf, saveFile, setLicenseKey, sha256Hex, ttfMeasurer, verifyLicense, version, wrapText, writePdf, writeXlsx };
|