we-report-angular 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +45 -2
- package/esm2022/lib/designer/bindable-input.component.mjs +97 -0
- package/esm2022/lib/designer/control-factory.mjs +45 -0
- package/esm2022/lib/designer/data-sources-dialog.component.mjs +266 -0
- package/esm2022/lib/designer/database-source-editor.component.mjs +412 -0
- package/esm2022/lib/designer/design-surface.component.mjs +600 -0
- package/esm2022/lib/designer/designer-fields.mjs +37 -0
- package/esm2022/lib/designer/designer-state.mjs +182 -0
- package/esm2022/lib/designer/property-panel.component.mjs +200 -0
- package/esm2022/lib/designer/we-report-designer.component.mjs +229 -0
- package/esm2022/lib/viewer/we-report-page.component.mjs +206 -0
- package/esm2022/lib/viewer/we-report-viewer.component.mjs +301 -0
- package/esm2022/lib/we-report-backend.service.mjs +17 -0
- package/esm2022/lib/we-report-config.mjs +26 -0
- package/esm2022/lib/we-report-fonts.service.mjs +75 -0
- package/esm2022/lib/we-report-icon.pipe.mjs +19 -0
- package/esm2022/lib/we-report-icons.mjs +29 -0
- package/esm2022/lib/we-report-locale.mjs +440 -0
- package/esm2022/public-api.mjs +14 -0
- package/esm2022/we-report-angular.mjs +5 -0
- package/fesm2022/we-report-angular.mjs +3120 -0
- package/fesm2022/we-report-angular.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/designer/bindable-input.component.d.ts +26 -0
- package/lib/designer/control-factory.d.ts +14 -0
- package/lib/designer/data-sources-dialog.component.d.ts +61 -0
- package/lib/designer/database-source-editor.component.d.ts +58 -0
- package/lib/designer/design-surface.component.d.ts +93 -0
- package/lib/designer/designer-fields.d.ts +16 -0
- package/lib/designer/designer-state.d.ts +51 -0
- package/lib/designer/property-panel.component.d.ts +51 -0
- package/lib/designer/we-report-designer.component.d.ts +70 -0
- package/lib/viewer/we-report-page.component.d.ts +19 -0
- package/lib/viewer/we-report-viewer.component.d.ts +56 -0
- package/lib/we-report-backend.service.d.ts +10 -0
- package/lib/we-report-config.d.ts +34 -0
- package/lib/we-report-fonts.service.d.ts +19 -0
- package/lib/we-report-icon.pipe.d.ts +12 -0
- package/lib/we-report-icons.d.ts +26 -0
- package/lib/we-report-locale.d.ts +208 -0
- package/package.json +48 -3
- package/public-api.d.ts +10 -0
- package/styles/we-report-theme.scss +106 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Bindable } from 'we-report-core';
|
|
2
|
+
import { WeReportLocale } from '../we-report-locale';
|
|
3
|
+
import { DesignerField } from './designer-fields';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Edits a value that is either fixed or comes from data: "Fixed text" with a text box, or
|
|
7
|
+
* "From data" with a field picker and the formula it produces.
|
|
8
|
+
*/
|
|
9
|
+
export declare class BindableInputComponent {
|
|
10
|
+
readonly value: import("@angular/core").InputSignal<Bindable<string>>;
|
|
11
|
+
readonly fields: import("@angular/core").InputSignal<DesignerField[]>;
|
|
12
|
+
readonly strings: import("@angular/core").InputSignal<WeReportLocale>;
|
|
13
|
+
readonly multiline: import("@angular/core").InputSignal<boolean>;
|
|
14
|
+
readonly valueChange: import("@angular/core").OutputEmitterRef<Bindable<string>>;
|
|
15
|
+
protected readonly bound: import("@angular/core").Signal<boolean>;
|
|
16
|
+
protected readonly expression: import("@angular/core").Signal<string>;
|
|
17
|
+
protected readonly fixedText: import("@angular/core").Signal<string>;
|
|
18
|
+
protected readonly fieldMatch: import("@angular/core").Signal<boolean>;
|
|
19
|
+
protected toFixed(): void;
|
|
20
|
+
protected toBound(): void;
|
|
21
|
+
protected pickField(expression: string): void;
|
|
22
|
+
protected setExpression(expression: string): void;
|
|
23
|
+
protected setFixed(text: string): void;
|
|
24
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BindableInputComponent, never>;
|
|
25
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BindableInputComponent, "we-report-bindable-input", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; "isSignal": true; }; "strings": { "alias": "strings"; "required": true; "isSignal": true; }; "multiline": { "alias": "multiline"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FieldSchema, ReportControl, ReportControlType } from 'we-report-core';
|
|
2
|
+
export { captionFor } from 'we-report-core';
|
|
3
|
+
/** Toolbox entries in display order. */
|
|
4
|
+
export declare const TOOLBOX_ITEMS: {
|
|
5
|
+
type: ReportControlType;
|
|
6
|
+
icon: string;
|
|
7
|
+
variant?: string;
|
|
8
|
+
}[];
|
|
9
|
+
/** A new control with sensible defaults, top-left corner at (x, y) mm. */
|
|
10
|
+
export declare function createControl(type: ReportControlType, id: string, x: number, y: number, text: string, variant?: string): ReportControl;
|
|
11
|
+
/** Default display format for a data field type. */
|
|
12
|
+
export declare function formatFor(field: FieldSchema): string | undefined;
|
|
13
|
+
/** Bracketed field reference; `parent` fields read the object around the rows (`[^.number]`). */
|
|
14
|
+
export declare function fieldExpression(path: string, parent: boolean): string;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DatabaseDataSource, DataSourceDefinition, ParameterType, ReportParameter, WebServiceDataSource } from 'we-report-core';
|
|
2
|
+
import { WeReportLocale } from '../we-report-locale';
|
|
3
|
+
import { DesignerState } from './designer-state';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Data sources and parameters of the report: paste JSON/CSV, or describe a web service and test it.
|
|
7
|
+
* The test response is saved as the source's sample so fields show up and the design has data.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DataSourcesDialogComponent {
|
|
10
|
+
readonly strings: import("@angular/core").InputSignal<WeReportLocale>;
|
|
11
|
+
readonly fetchFn: import("@angular/core").InputSignal<typeof fetch | undefined>;
|
|
12
|
+
readonly closed: import("@angular/core").OutputEmitterRef<void>;
|
|
13
|
+
protected readonly state: DesignerState;
|
|
14
|
+
private readonly backend;
|
|
15
|
+
protected readonly report: import("@angular/core").Signal<import("we-report-core").ReportDefinition>;
|
|
16
|
+
protected readonly selectedId: import("@angular/core").WritableSignal<string | null>;
|
|
17
|
+
protected readonly source: import("@angular/core").Signal<DataSourceDefinition>;
|
|
18
|
+
protected readonly isMain: import("@angular/core").Signal<boolean>;
|
|
19
|
+
protected readonly listPaths: import("@angular/core").Signal<string[]>;
|
|
20
|
+
protected readonly rowCount: import("@angular/core").Signal<number>;
|
|
21
|
+
protected readonly jsonError: import("@angular/core").WritableSignal<string | null>;
|
|
22
|
+
protected readonly testing: import("@angular/core").WritableSignal<boolean>;
|
|
23
|
+
protected readonly testResult: import("@angular/core").WritableSignal<{
|
|
24
|
+
ok: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
} | null>;
|
|
27
|
+
protected readonly types: ParameterType[];
|
|
28
|
+
protected add(kind: DataSourceDefinition['kind']): void;
|
|
29
|
+
protected remove(): void;
|
|
30
|
+
protected select(id: string): void;
|
|
31
|
+
/** Edits the selected source in one undoable, coalesced step. */
|
|
32
|
+
protected edit(mutate: (s: DataSourceDefinition) => void, key: string): void;
|
|
33
|
+
protected setName(name: string): void;
|
|
34
|
+
protected useForRows(): void;
|
|
35
|
+
protected setRowsPath(path: string): void;
|
|
36
|
+
protected jsonText(s: DataSourceDefinition): string;
|
|
37
|
+
protected setJson(text: string): void;
|
|
38
|
+
protected setCsv(text: string): void;
|
|
39
|
+
protected csvRows(s: DataSourceDefinition): number;
|
|
40
|
+
protected web(s: DataSourceDefinition): WebServiceDataSource | null;
|
|
41
|
+
protected setWeb(key: 'url' | 'method' | 'body' | 'via', value: string): void;
|
|
42
|
+
protected db(s: DataSourceDefinition): DatabaseDataSource | null;
|
|
43
|
+
protected applyDbEdit(e: {
|
|
44
|
+
mutate: (s: DatabaseDataSource) => void;
|
|
45
|
+
key: string;
|
|
46
|
+
}): void;
|
|
47
|
+
protected addHeader(): void;
|
|
48
|
+
protected setHeader(index: number, key: 'name' | 'value', value: string): void;
|
|
49
|
+
protected removeHeader(index: number): void;
|
|
50
|
+
protected test(): Promise<void>;
|
|
51
|
+
/** When the main source is an object with exactly one list in it, rows come from that list. */
|
|
52
|
+
private autoPath;
|
|
53
|
+
protected addParameter(): void;
|
|
54
|
+
protected setParameter(index: number, key: keyof ReportParameter, value: string): void;
|
|
55
|
+
protected removeParameter(index: number): void;
|
|
56
|
+
protected typeLabel(t: ParameterType): string;
|
|
57
|
+
protected kindLabel(s: DataSourceDefinition): string;
|
|
58
|
+
private uniqueSourceId;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DataSourcesDialogComponent, never>;
|
|
60
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DataSourcesDialogComponent, "we-report-data-sources-dialog", never, { "strings": { "alias": "strings"; "required": true; "isSignal": true; }; "fetchFn": { "alias": "fetchFn"; "required": false; "isSignal": true; }; }, { "closed": "closed"; }, never, never, true, never>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BackendConnection, BackendSchema, DatabaseDataSource, QueryCondition, ReportParameter, StructuredQuery } from 'we-report-core';
|
|
2
|
+
import { WeReportBackendService } from '../we-report-backend.service';
|
|
3
|
+
import { WeReportLocale } from '../we-report-locale';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Visual query builder for a database source: backend → connection → table → columns → filters
|
|
7
|
+
* → order → limit, or free SQL where the connection allows it. Produces protocol/schemas/query.json.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DatabaseSourceEditorComponent {
|
|
10
|
+
readonly source: import("@angular/core").InputSignal<DatabaseDataSource>;
|
|
11
|
+
readonly parameters: import("@angular/core").InputSignal<ReportParameter[]>;
|
|
12
|
+
readonly strings: import("@angular/core").InputSignal<WeReportLocale>;
|
|
13
|
+
readonly fetchFn: import("@angular/core").InputSignal<typeof fetch | undefined>;
|
|
14
|
+
/** Emits a mutation of the source; the dialog applies it as one undoable step. */
|
|
15
|
+
readonly edit: import("@angular/core").OutputEmitterRef<{
|
|
16
|
+
mutate: (s: DatabaseDataSource) => void;
|
|
17
|
+
key: string;
|
|
18
|
+
}>;
|
|
19
|
+
protected readonly backend: WeReportBackendService;
|
|
20
|
+
protected readonly operators: ("=" | "!=" | "<" | "<=" | ">" | ">=" | "like" | "in" | "isNull" | "notNull")[];
|
|
21
|
+
protected readonly connections: import("@angular/core").WritableSignal<BackendConnection[]>;
|
|
22
|
+
protected readonly schema: import("@angular/core").WritableSignal<BackendSchema | null>;
|
|
23
|
+
protected readonly status: import("@angular/core").WritableSignal<{
|
|
24
|
+
ok: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
} | null>;
|
|
27
|
+
protected readonly testing: import("@angular/core").WritableSignal<boolean>;
|
|
28
|
+
protected readonly testResult: import("@angular/core").WritableSignal<{
|
|
29
|
+
ok: boolean;
|
|
30
|
+
message: string;
|
|
31
|
+
} | null>;
|
|
32
|
+
protected readonly query: import("@angular/core").Signal<StructuredQuery>;
|
|
33
|
+
protected readonly connection: import("@angular/core").Signal<BackendConnection | null>;
|
|
34
|
+
protected readonly tableColumns: import("@angular/core").Signal<{
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
}[]>;
|
|
38
|
+
constructor();
|
|
39
|
+
private get options();
|
|
40
|
+
connect(connectionId?: string): Promise<void>;
|
|
41
|
+
private loadSchema;
|
|
42
|
+
protected setConnection(id: string): Promise<void>;
|
|
43
|
+
private setQuery;
|
|
44
|
+
protected setTable(table: string): void;
|
|
45
|
+
protected isColumnOn(name: string): boolean;
|
|
46
|
+
protected toggleColumn(name: string, on: boolean): void;
|
|
47
|
+
protected addWhere(): void;
|
|
48
|
+
protected setWhere(i: number, key: 'column' | 'op' | 'value' | 'param', value: string): void;
|
|
49
|
+
protected removeWhere(i: number): void;
|
|
50
|
+
protected setOrder(column: string, dir: string): void;
|
|
51
|
+
protected setLimit(value: string): void;
|
|
52
|
+
protected toggleSql(on: boolean): void;
|
|
53
|
+
protected setSql(sql: string): void;
|
|
54
|
+
protected opLabel(op: QueryCondition['op']): string;
|
|
55
|
+
protected test(): Promise<void>;
|
|
56
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DatabaseSourceEditorComponent, never>;
|
|
57
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DatabaseSourceEditorComponent, "we-report-database-source-editor", never, { "source": { "alias": "source"; "required": true; "isSignal": true; }; "parameters": { "alias": "parameters"; "required": false; "isSignal": true; }; "strings": { "alias": "strings"; "required": true; "isSignal": true; }; "fetchFn": { "alias": "fetchFn"; "required": false; "isSignal": true; }; }, { "edit": "edit"; }, never, never, true, never>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { Band, ReportControl, ReportControlType } from 'we-report-core';
|
|
3
|
+
import { WeReportLocale } from '../we-report-locale';
|
|
4
|
+
import { DesignerState } from './designer-state';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/** First row of the data, shown inside bound controls while designing. */
|
|
7
|
+
export interface DesignSample {
|
|
8
|
+
row: unknown;
|
|
9
|
+
rows: readonly unknown[];
|
|
10
|
+
parent: unknown;
|
|
11
|
+
}
|
|
12
|
+
/** Payload of an HTML5 drag from the toolbox or the field list. */
|
|
13
|
+
export type DesignerDragData = {
|
|
14
|
+
kind: 'control';
|
|
15
|
+
type: ReportControlType;
|
|
16
|
+
variant?: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'field';
|
|
19
|
+
path: string;
|
|
20
|
+
parent: boolean;
|
|
21
|
+
format?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const DRAG_MIME = "application/x-we-report";
|
|
24
|
+
interface Guide {
|
|
25
|
+
bandId: string;
|
|
26
|
+
orientation: 'v' | 'h';
|
|
27
|
+
at: number;
|
|
28
|
+
}
|
|
29
|
+
type Handle = 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw';
|
|
30
|
+
/** The page, its bands and controls, with selection, drag, resize, snapping and drop targets. */
|
|
31
|
+
export declare class DesignSurfaceComponent implements OnDestroy {
|
|
32
|
+
readonly strings: import("@angular/core").InputSignal<WeReportLocale>;
|
|
33
|
+
readonly zoom: import("@angular/core").InputSignal<number>;
|
|
34
|
+
/** Snap grid in mm; 0 turns snapping off. */
|
|
35
|
+
readonly gridSize: import("@angular/core").InputSignal<number>;
|
|
36
|
+
/** When set, bound text shows this data instead of its formula. */
|
|
37
|
+
readonly sample: import("@angular/core").InputSignal<DesignSample | null>;
|
|
38
|
+
protected readonly state: DesignerState;
|
|
39
|
+
private readonly config;
|
|
40
|
+
private readonly dom;
|
|
41
|
+
private readonly host;
|
|
42
|
+
protected readonly handles: Handle[];
|
|
43
|
+
protected readonly guides: import("@angular/core").WritableSignal<Guide[]>;
|
|
44
|
+
protected readonly geometry: import("@angular/core").Signal<import("we-report-core").PageGeometry>;
|
|
45
|
+
protected readonly padding: import("@angular/core").Signal<string>;
|
|
46
|
+
private op;
|
|
47
|
+
private readonly onMove;
|
|
48
|
+
private readonly onUp;
|
|
49
|
+
private opCounter;
|
|
50
|
+
ngOnDestroy(): void;
|
|
51
|
+
protected bandLabel(band: Band): string;
|
|
52
|
+
protected isSelected(id: string): boolean;
|
|
53
|
+
protected isOnlySelected(id: string): boolean;
|
|
54
|
+
protected isBandSelected(id: string): boolean;
|
|
55
|
+
protected guidesFor(bandId: string): Guide[];
|
|
56
|
+
protected isBound(c: ReportControl): boolean;
|
|
57
|
+
protected boundExpression(c: ReportControl): string;
|
|
58
|
+
protected caption(c: ReportControl): string;
|
|
59
|
+
protected textStyle(c: ReportControl): Record<string, string>;
|
|
60
|
+
protected shapeStyle(c: ReportControl): Record<string, string>;
|
|
61
|
+
protected lineCoords(c: ReportControl): [number, number, number, number];
|
|
62
|
+
protected lineColor(c: ReportControl): string;
|
|
63
|
+
protected lineWidth(c: ReportControl): number;
|
|
64
|
+
protected staticImage(c: ReportControl): string | null;
|
|
65
|
+
protected objectFit(c: ReportControl): string;
|
|
66
|
+
protected isQr(c: ReportControl): boolean;
|
|
67
|
+
protected barcodeLabel(c: ReportControl): string;
|
|
68
|
+
protected selectBand(id: string): void;
|
|
69
|
+
protected onBodyPointerDown(e: PointerEvent): void;
|
|
70
|
+
protected onControlPointerDown(e: PointerEvent, c: ReportControl, band: Band): void;
|
|
71
|
+
protected onHandlePointerDown(e: PointerEvent, c: ReportControl, band: Band, handle: Handle): void;
|
|
72
|
+
protected onBandResizePointerDown(e: PointerEvent, band: Band): void;
|
|
73
|
+
private begin;
|
|
74
|
+
private stopListening;
|
|
75
|
+
private rectsOf;
|
|
76
|
+
private pointerMove;
|
|
77
|
+
private pointerUp;
|
|
78
|
+
private bandBodyAt;
|
|
79
|
+
private bandBodyRect;
|
|
80
|
+
private otherRects;
|
|
81
|
+
/** Finds the closest edge/centre alignment among `others` for any of `candidates`. */
|
|
82
|
+
private snapAxis;
|
|
83
|
+
private snapEdge;
|
|
84
|
+
private snapToGrid;
|
|
85
|
+
protected onDragOver(e: DragEvent): void;
|
|
86
|
+
protected onDrop(e: DragEvent, band: Band): void;
|
|
87
|
+
/** Creates controls for a drop at (x, y) mm inside `band`. */
|
|
88
|
+
dropAt(data: DesignerDragData, band: Band, x: number, y: number): void;
|
|
89
|
+
private growBand;
|
|
90
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DesignSurfaceComponent, never>;
|
|
91
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DesignSurfaceComponent, "we-report-design-surface", never, { "strings": { "alias": "strings"; "required": true; "isSignal": true; }; "zoom": { "alias": "zoom"; "required": false; "isSignal": true; }; "gridSize": { "alias": "gridSize"; "required": false; "isSignal": true; }; "sample": { "alias": "sample"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
92
|
+
}
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldType, ReportDefinition } from 'we-report-core';
|
|
2
|
+
/** A field the user can drop or pick, flattened from the data schema. */
|
|
3
|
+
export interface DesignerField {
|
|
4
|
+
path: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type: FieldType;
|
|
7
|
+
/** Belongs to the object around the rows (`[^.x]`), e.g. the invoice header. */
|
|
8
|
+
parent: boolean;
|
|
9
|
+
expression: string;
|
|
10
|
+
depth: number;
|
|
11
|
+
}
|
|
12
|
+
/** Row fields, then fields of the object holding the rows (when the rows are a nested list). */
|
|
13
|
+
export declare function designerFields(report: ReportDefinition, data?: unknown): {
|
|
14
|
+
rows: DesignerField[];
|
|
15
|
+
parent: DesignerField[];
|
|
16
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Band, ReportControl, ReportDefinition } from 'we-report-core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type Selection = {
|
|
4
|
+
kind: 'none';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'controls';
|
|
7
|
+
ids: string[];
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'band';
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The designer's document, selection and undo history. Every edit goes through `update`, which
|
|
14
|
+
* snapshots the previous state — so every edit is undoable and observable.
|
|
15
|
+
*/
|
|
16
|
+
export declare class DesignerState {
|
|
17
|
+
readonly report: import("@angular/core").WritableSignal<ReportDefinition>;
|
|
18
|
+
readonly selection: import("@angular/core").WritableSignal<Selection>;
|
|
19
|
+
readonly canUndo: import("@angular/core").WritableSignal<boolean>;
|
|
20
|
+
readonly canRedo: import("@angular/core").WritableSignal<boolean>;
|
|
21
|
+
readonly selectedControls: import("@angular/core").Signal<ReportControl[]>;
|
|
22
|
+
readonly selectedBand: import("@angular/core").Signal<Band | null>;
|
|
23
|
+
private past;
|
|
24
|
+
private future;
|
|
25
|
+
private lastKey;
|
|
26
|
+
private lastTime;
|
|
27
|
+
/** Replaces the document and clears history (a new report was opened). */
|
|
28
|
+
load(report: ReportDefinition): void;
|
|
29
|
+
/**
|
|
30
|
+
* Applies an edit to a copy of the document. Consecutive edits with the same `coalesce` key
|
|
31
|
+
* (typing in a field, dragging) within a moment become one undo step.
|
|
32
|
+
*/
|
|
33
|
+
update(mutate: (draft: ReportDefinition) => void, coalesce?: string): void;
|
|
34
|
+
undo(): void;
|
|
35
|
+
redo(): void;
|
|
36
|
+
/** A new id not used by any band or control. */
|
|
37
|
+
newId(prefix: string): string;
|
|
38
|
+
findBandOf(controlId: string, def?: ReportDefinition): Band | undefined;
|
|
39
|
+
addControls(bandId: string, controls: ReportControl[]): void;
|
|
40
|
+
/** Mutates every selected control (or the given ids) in one undoable step. */
|
|
41
|
+
updateControls(ids: string[], mutate: (control: ReportControl, band: Band) => void, coalesce?: string): void;
|
|
42
|
+
updateBand(id: string, mutate: (band: Band) => void, coalesce?: string): void;
|
|
43
|
+
deleteSelection(): void;
|
|
44
|
+
removeBand(id: string): void;
|
|
45
|
+
duplicateSelection(): void;
|
|
46
|
+
select(id: string, additive: boolean): void;
|
|
47
|
+
private pruneSelection;
|
|
48
|
+
private syncFlags;
|
|
49
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DesignerState, never>;
|
|
50
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DesignerState>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Band, Bindable, BorderStyle, ReportControl, ReportStyle } from 'we-report-core';
|
|
2
|
+
import { WeReportLocale } from '../we-report-locale';
|
|
3
|
+
import { DesignerField } from './designer-fields';
|
|
4
|
+
import { DesignerState } from './designer-state';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/** Plain-language properties of the selection: a control, a band, or the report itself. */
|
|
7
|
+
export declare class PropertyPanelComponent {
|
|
8
|
+
readonly strings: import("@angular/core").InputSignal<WeReportLocale>;
|
|
9
|
+
readonly fields: import("@angular/core").InputSignal<DesignerField[]>;
|
|
10
|
+
readonly fontFamilies: import("@angular/core").InputSignal<string[]>;
|
|
11
|
+
readonly advanced: import("@angular/core").InputSignal<boolean>;
|
|
12
|
+
protected readonly state: DesignerState;
|
|
13
|
+
protected readonly papers: readonly import("we-report-core").PaperSize[];
|
|
14
|
+
protected readonly symbologies: readonly string[];
|
|
15
|
+
protected readonly formats: {
|
|
16
|
+
value: string;
|
|
17
|
+
key: keyof WeReportLocale;
|
|
18
|
+
}[];
|
|
19
|
+
protected readonly controls: import("@angular/core").Signal<ReportControl[]>;
|
|
20
|
+
protected readonly control: import("@angular/core").Signal<ReportControl | null>;
|
|
21
|
+
protected readonly band: import("@angular/core").Signal<Band | null>;
|
|
22
|
+
protected readonly report: import("@angular/core").Signal<import("we-report-core").ReportDefinition>;
|
|
23
|
+
protected readonly style: import("@angular/core").Signal<import("we-report-core").ResolvedStyle | null>;
|
|
24
|
+
protected readonly hasText: import("@angular/core").Signal<boolean>;
|
|
25
|
+
protected readonly formatIsCustom: import("@angular/core").Signal<boolean>;
|
|
26
|
+
protected setReport<K extends 'name'>(key: K, value: string): void;
|
|
27
|
+
protected setPaper(paper: string): void;
|
|
28
|
+
protected setPage(key: 'orientation' | 'width' | 'height', value: string): void;
|
|
29
|
+
protected setMargin(side: 'top' | 'right' | 'bottom' | 'left', value: string): void;
|
|
30
|
+
protected setRowsPath(path: string): void;
|
|
31
|
+
protected setBand(key: 'height' | 'groupBy' | 'sort' | 'backgroundColor', value: string): void;
|
|
32
|
+
protected toggleBand(key: 'keepTogether' | 'repeatOnEveryPage' | 'pageBreakBefore' | 'pageBreakAfter', value: boolean): void;
|
|
33
|
+
protected removeBand(): void;
|
|
34
|
+
protected ids(): string[];
|
|
35
|
+
protected setGeometry(key: 'x' | 'y' | 'width' | 'height', value: string): void;
|
|
36
|
+
/** Sets one property on the selected control(s) of a given type. */
|
|
37
|
+
protected set(key: string, value: unknown, coalesce?: string): void;
|
|
38
|
+
protected setBindable(key: 'text' | 'value' | 'source' | 'checked' | 'visible', value: Bindable<string>): void;
|
|
39
|
+
protected visibleValue(c: ReportControl): Bindable<string>;
|
|
40
|
+
protected setVisible(value: Bindable<string>): void;
|
|
41
|
+
protected checkedValue(c: ReportControl): Bindable<string>;
|
|
42
|
+
protected setStyle<K extends keyof ReportStyle>(key: K, value: ReportStyle[K] | undefined): void;
|
|
43
|
+
protected setBorder(patch: Partial<BorderStyle> | null): void;
|
|
44
|
+
protected toggleBorderSide(side: keyof BorderStyle['sides'], on: boolean): void;
|
|
45
|
+
protected chooseImage(event: Event): Promise<void>;
|
|
46
|
+
protected textValue(c: ReportControl): Bindable<string>;
|
|
47
|
+
protected num(value: number | undefined | null): string;
|
|
48
|
+
protected asNumber(value: string, fallback: number): number;
|
|
49
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PropertyPanelComponent, never>;
|
|
50
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PropertyPanelComponent, "we-report-property-panel", never, { "strings": { "alias": "strings"; "required": true; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; "isSignal": true; }; "fontFamilies": { "alias": "fontFamilies"; "required": false; "isSignal": true; }; "advanced": { "alias": "advanced"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Band, BandKind, ReportControlType, ReportDefinition, ReportIssue } from 'we-report-core';
|
|
2
|
+
import { WeReportIcons } from '../we-report-icons';
|
|
3
|
+
import { WeReportLocale } from '../we-report-locale';
|
|
4
|
+
import { DesignSample } from './design-surface.component';
|
|
5
|
+
import { DesignerField } from './designer-fields';
|
|
6
|
+
import { DesignerState } from './designer-state';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/** Keeps bands in the order they print; sort is stable, so group nesting is preserved. */
|
|
9
|
+
export declare function orderBands(bands: Band[]): Band[];
|
|
10
|
+
/**
|
|
11
|
+
* The end-user report designer: toolbox and data fields on the left, the page in the middle,
|
|
12
|
+
* properties on the right, and a live preview tab. Two-way bind `[(report)]`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class WeReportDesignerComponent {
|
|
15
|
+
/** The report being designed. Updated on every edit. */
|
|
16
|
+
readonly report: import("@angular/core").ModelSignal<ReportDefinition>;
|
|
17
|
+
/** Sample data for the field list and preview; replaces the report's own data source data. */
|
|
18
|
+
readonly data: import("@angular/core").InputSignal<unknown>;
|
|
19
|
+
/** Overrides the `WE_REPORT_LOCALE` token, e.g. to switch language at runtime. */
|
|
20
|
+
readonly locale: import("@angular/core").InputSignal<WeReportLocale | undefined>;
|
|
21
|
+
readonly zoom: import("@angular/core").InputSignal<number>;
|
|
22
|
+
/** Fetch used for web-service data sources (testing in the designer and the preview). */
|
|
23
|
+
readonly fetchFn: import("@angular/core").InputSignal<typeof fetch | undefined>;
|
|
24
|
+
protected readonly state: DesignerState;
|
|
25
|
+
private readonly fontsService;
|
|
26
|
+
private readonly defaultLocale;
|
|
27
|
+
protected readonly strings: import("@angular/core").Signal<WeReportLocale>;
|
|
28
|
+
protected readonly toolbox: {
|
|
29
|
+
type: ReportControlType;
|
|
30
|
+
icon: string;
|
|
31
|
+
variant?: string;
|
|
32
|
+
}[];
|
|
33
|
+
protected readonly tab: import("@angular/core").WritableSignal<"design" | "preview">;
|
|
34
|
+
protected readonly advanced: import("@angular/core").WritableSignal<boolean>;
|
|
35
|
+
protected readonly zoomLevel: import("@angular/core").WritableSignal<number>;
|
|
36
|
+
protected readonly fontFamilies: import("@angular/core").WritableSignal<string[]>;
|
|
37
|
+
protected readonly bandMenuOpen: import("@angular/core").WritableSignal<boolean>;
|
|
38
|
+
protected readonly dataDialogOpen: import("@angular/core").WritableSignal<boolean>;
|
|
39
|
+
protected readonly problemsOpen: import("@angular/core").WritableSignal<boolean>;
|
|
40
|
+
/** Design problems, checked on every edit; field names are judged only when there is data. */
|
|
41
|
+
protected readonly issues: import("@angular/core").Signal<ReportIssue[]>;
|
|
42
|
+
/** Show the first data row inside bound controls instead of their formulas. */
|
|
43
|
+
protected readonly showData: import("@angular/core").WritableSignal<boolean>;
|
|
44
|
+
protected readonly sample: import("@angular/core").Signal<DesignSample | null>;
|
|
45
|
+
protected readonly fields: import("@angular/core").Signal<{
|
|
46
|
+
rows: DesignerField[];
|
|
47
|
+
parent: DesignerField[];
|
|
48
|
+
}>;
|
|
49
|
+
protected readonly allFields: import("@angular/core").Signal<DesignerField[]>;
|
|
50
|
+
protected readonly addableBands: import("@angular/core").Signal<BandKind[]>;
|
|
51
|
+
constructor();
|
|
52
|
+
protected iconName(name: string): keyof WeReportIcons;
|
|
53
|
+
protected setZoom(value: number): void;
|
|
54
|
+
protected onToolDragStart(e: DragEvent, item: {
|
|
55
|
+
type: ReportControlType;
|
|
56
|
+
variant?: string;
|
|
57
|
+
}): void;
|
|
58
|
+
protected onFieldDragStart(e: DragEvent, field: DesignerField): void;
|
|
59
|
+
private setDrag;
|
|
60
|
+
protected addBand(kind: BandKind): void;
|
|
61
|
+
/** Replaces the layout with a tidy list of the data (undoable): the fastest way to a first report. */
|
|
62
|
+
protected autoDesign(): void;
|
|
63
|
+
protected issueText(issue: ReportIssue): string;
|
|
64
|
+
protected showIssue(issue: ReportIssue): void;
|
|
65
|
+
/** Moves (and if needed narrows) an item back inside the paper. */
|
|
66
|
+
protected fixIssue(issue: ReportIssue): void;
|
|
67
|
+
protected onKeydown(e: KeyboardEvent): void;
|
|
68
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WeReportDesignerComponent, never>;
|
|
69
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WeReportDesignerComponent, "we-report-designer", never, { "report": { "alias": "report"; "required": true; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "zoom": { "alias": "zoom"; "required": false; "isSignal": true; }; "fetchFn": { "alias": "fetchFn"; "required": false; "isSignal": true; }; }, { "report": "reportChange"; }, never, never, true, never>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LayoutPage, PathItem, TextItem } from 'we-report-core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Draws one laid-out page as SVG in millimetre units. It only draws what the layout engine
|
|
5
|
+
* positioned — text lines included — so it matches the PDF exactly.
|
|
6
|
+
*/
|
|
7
|
+
export declare class WeReportPageComponent {
|
|
8
|
+
readonly page: import("@angular/core").InputSignal<LayoutPage>;
|
|
9
|
+
readonly zoom: import("@angular/core").InputSignal<number>;
|
|
10
|
+
protected readonly ptToMm: number;
|
|
11
|
+
protected text(item: unknown): TextItem;
|
|
12
|
+
protected path(item: unknown): PathItem;
|
|
13
|
+
protected paint(color: string | undefined): string;
|
|
14
|
+
protected stroke(color: string | undefined): string | null;
|
|
15
|
+
protected textColor(color: string): string;
|
|
16
|
+
protected family(item: TextItem): string;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WeReportPageComponent, never>;
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WeReportPageComponent, "we-report-page", never, { "page": { "alias": "page"; "required": true; "isSignal": true; }; "zoom": { "alias": "zoom"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { LayoutDocument, LayoutProblem, ReportDefinition, ReportParameter } from 'we-report-core';
|
|
2
|
+
import { WeReportLocale } from '../we-report-locale';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/** Paged preview of a report with zoom, PDF download and print. No server involved. */
|
|
5
|
+
export declare class WeReportViewerComponent {
|
|
6
|
+
readonly report: import("@angular/core").InputSignal<ReportDefinition>;
|
|
7
|
+
/** Rows (or an object holding them) to print; replaces the report's own data source data. */
|
|
8
|
+
readonly data: import("@angular/core").InputSignal<unknown>;
|
|
9
|
+
readonly zoom: import("@angular/core").InputSignal<number>;
|
|
10
|
+
/** Overrides the `WE_REPORT_LOCALE` token. */
|
|
11
|
+
readonly locale: import("@angular/core").InputSignal<WeReportLocale | undefined>;
|
|
12
|
+
/** Print time; defaults to now. Fix it for reproducible output. */
|
|
13
|
+
readonly printDate: import("@angular/core").InputSignal<Date | undefined>;
|
|
14
|
+
/** Report parameter values from the host; the user can still change them in the parameter bar. */
|
|
15
|
+
readonly parameters: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
16
|
+
/** Fetch used for web-service data sources (add auth, or route through your backend). */
|
|
17
|
+
readonly fetchFn: import("@angular/core").InputSignal<typeof fetch | undefined>;
|
|
18
|
+
readonly problems: import("@angular/core").OutputEmitterRef<LayoutProblem[]>;
|
|
19
|
+
readonly rendered: import("@angular/core").OutputEmitterRef<LayoutDocument>;
|
|
20
|
+
private readonly config;
|
|
21
|
+
private readonly fontsService;
|
|
22
|
+
private readonly backend;
|
|
23
|
+
private readonly dom;
|
|
24
|
+
private readonly defaultLocale;
|
|
25
|
+
protected readonly strings: import("@angular/core").Signal<WeReportLocale>;
|
|
26
|
+
protected readonly zoomLevel: import("@angular/core").WritableSignal<number>;
|
|
27
|
+
protected readonly document: import("@angular/core").WritableSignal<LayoutDocument | null>;
|
|
28
|
+
protected readonly error: import("@angular/core").WritableSignal<string | null>;
|
|
29
|
+
protected readonly loadErrors: import("@angular/core").WritableSignal<string[]>;
|
|
30
|
+
protected readonly loadWarnings: import("@angular/core").WritableSignal<string[]>;
|
|
31
|
+
/** Values typed into the parameter bar, applied with "Run report". */
|
|
32
|
+
private readonly draftParams;
|
|
33
|
+
private readonly appliedParams;
|
|
34
|
+
protected readonly pageLabel: import("@angular/core").Signal<string>;
|
|
35
|
+
private fonts?;
|
|
36
|
+
private run;
|
|
37
|
+
/** What the current preview was laid out from, so exports use exactly the same data. */
|
|
38
|
+
private lastInput;
|
|
39
|
+
constructor();
|
|
40
|
+
protected setZoom(value: number): void;
|
|
41
|
+
protected paramValue(p: ReportParameter): unknown;
|
|
42
|
+
protected setParam(p: ReportParameter, value: unknown): void;
|
|
43
|
+
protected applyParams(): void;
|
|
44
|
+
private layout;
|
|
45
|
+
/** The current preview as PDF bytes. */
|
|
46
|
+
toPdf(): Promise<Uint8Array>;
|
|
47
|
+
/** The report's rows as an Excel workbook (one column per detail field, typed values). */
|
|
48
|
+
toXlsx(): Uint8Array;
|
|
49
|
+
protected downloadPdf(): Promise<void>;
|
|
50
|
+
protected downloadExcel(): void;
|
|
51
|
+
private save;
|
|
52
|
+
/** Prints the PDF through a hidden frame, so page size and margins are exact. */
|
|
53
|
+
protected print(): Promise<void>;
|
|
54
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WeReportViewerComponent, never>;
|
|
55
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WeReportViewerComponent, "we-report-viewer", never, { "report": { "alias": "report"; "required": true; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "zoom": { "alias": "zoom"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "printDate": { "alias": "printDate"; "required": false; "isSignal": true; }; "parameters": { "alias": "parameters"; "required": false; "isSignal": true; }; "fetchFn": { "alias": "fetchFn"; "required": false; "isSignal": true; }; }, { "problems": "problems"; "rendered": "rendered"; }, never, never, true, never>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* The data backend address used for database sources and proxied web services. Starts from
|
|
4
|
+
* `provideWeReport({ backendUrl })`; the designer lets the user change it (e.g. the public Studio).
|
|
5
|
+
*/
|
|
6
|
+
export declare class WeReportBackendService {
|
|
7
|
+
readonly url: import("@angular/core").WritableSignal<string>;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WeReportBackendService, never>;
|
|
9
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WeReportBackendService>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EnvironmentProviders, InjectionToken } from '@angular/core';
|
|
2
|
+
import { WeReportLocale } from './we-report-locale';
|
|
3
|
+
/** A font file: a URL to fetch or the bytes themselves. */
|
|
4
|
+
export type WeReportFontFile = string | Uint8Array;
|
|
5
|
+
export interface WeReportFontFamily {
|
|
6
|
+
family: string;
|
|
7
|
+
regular: WeReportFontFile;
|
|
8
|
+
bold?: WeReportFontFile;
|
|
9
|
+
italic?: WeReportFontFile;
|
|
10
|
+
boldItalic?: WeReportFontFile;
|
|
11
|
+
}
|
|
12
|
+
export interface WeReportConfig {
|
|
13
|
+
/** Font families reports can use, in addition to (or replacing) the bundled Noto Sans. */
|
|
14
|
+
fonts?: WeReportFontFamily[];
|
|
15
|
+
/**
|
|
16
|
+
* Where the bundled Noto Sans files are served from. Add this to `angular.json` assets:
|
|
17
|
+
* `{ "glob": "*.ttf", "input": "node_modules/we-report-core/fonts", "output": "assets/we-report/fonts" }`.
|
|
18
|
+
* Set to `null` to not load them (then `fonts` must provide at least one family).
|
|
19
|
+
*/
|
|
20
|
+
defaultFontsUrl?: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Address of a we-report data backend (any language implementing protocol/openapi.yaml), for live
|
|
23
|
+
* database data and proxied web services. Not needed for JSON, CSV or open web services.
|
|
24
|
+
*/
|
|
25
|
+
backendUrl?: string;
|
|
26
|
+
/** Number and currency formatting of report output (`tr-TR`, `TRY`). */
|
|
27
|
+
locale?: string;
|
|
28
|
+
currency?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const WE_REPORT_CONFIG: InjectionToken<WeReportConfig>;
|
|
31
|
+
export declare const DEFAULT_FONTS_URL = "assets/we-report/fonts/";
|
|
32
|
+
export declare function defaultFontFamily(baseUrl: string): WeReportFontFamily;
|
|
33
|
+
/** `provideWeReport({ fonts, locale: 'tr-TR', currency: 'TRY' }, weReportLocaleTr)` in app config. */
|
|
34
|
+
export declare function provideWeReport(config?: WeReportConfig, uiLocale?: WeReportLocale): EnvironmentProviders;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FontRegistry } from 'we-report-core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Loads the configured fonts once. The same bytes feed the layout engine (measurement), the PDF
|
|
5
|
+
* (embedding) and the browser (`FontFace`, used by the on-screen SVG), so preview and PDF match.
|
|
6
|
+
*/
|
|
7
|
+
export declare class WeReportFontsService {
|
|
8
|
+
private readonly config;
|
|
9
|
+
private readonly document;
|
|
10
|
+
private registry?;
|
|
11
|
+
/** CSS family the browser renders a report family with. Prefixed so an installed font of the same name can never be picked instead. */
|
|
12
|
+
static cssFamily(family: string): string;
|
|
13
|
+
ready(): Promise<FontRegistry>;
|
|
14
|
+
private load;
|
|
15
|
+
private read;
|
|
16
|
+
private addFontFaces;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WeReportFontsService, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WeReportFontsService>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
3
|
+
import { WeReportIcons } from './we-report-icons';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/** `<span [innerHTML]="'print' | weReportIcon"></span>` — icons are trusted constants from the token, never report content. */
|
|
6
|
+
export declare class WeReportIconPipe implements PipeTransform {
|
|
7
|
+
private readonly icons;
|
|
8
|
+
private readonly sanitizer;
|
|
9
|
+
transform(name: keyof WeReportIcons): SafeHtml;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WeReportIconPipe, never>;
|
|
11
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<WeReportIconPipe, "weReportIcon", true>;
|
|
12
|
+
}
|