@formancy/report-builder-angular 0.1.0 → 0.3.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.
@@ -1,6 +1,30 @@
1
- import { CanvasBox, DiagnosticEntry, DragSubject, DropTarget, EditorAction, EditorOutcome, EditorPanel, EditorState, EditorText, OutlineNode, PaletteEntry, PropertyField, ReportEditor } from "@formancy/report-builder-core";
1
+ import { CanvasBox, DiagnosticEntry, DragSubject, DropTarget, EditorAction, EditorOutcome, EditorPanel, EditorState, EditorText, HideablePanel, OutlineNode, OutlinePart, PaletteEntry, PropertyAction, PropertyField, ReportEditor } from "@formancy/report-builder-core";
2
2
  import * as i0 from "@angular/core";
3
- import { Signal } from "@angular/core";
3
+ import { Signal, TemplateRef } from "@angular/core";
4
+ /** Marks the template a host gives `<report-builder>` as its view. */
5
+ export declare class ReportHostView {
6
+ readonly template: TemplateRef<unknown>;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReportHostView, never>;
8
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ReportHostView, "ng-template[reportHostView]", never, {}, {}, never, never, true, never>;
9
+ }
10
+ /**
11
+ * Stamps the host's template where it stands, for as long as it stands
12
+ * there: the builder's template draws it only while the host's view is in
13
+ * the middle, and the view goes with the element when that ends.
14
+ */
15
+ declare class ReportHostOutlet {
16
+ readonly template: import("@angular/core").InputSignal<TemplateRef<unknown> | null>;
17
+ private readonly container;
18
+ constructor();
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReportHostOutlet, never>;
20
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ReportHostOutlet, "[reportHostOutlet]", never, {
21
+ "template": {
22
+ "alias": "reportHostOutlet";
23
+ "required": true;
24
+ "isSignal": true;
25
+ };
26
+ }, {}, never, never, true, never>;
27
+ }
4
28
  /** Where focus goes once what an action changed has rendered. */
5
29
  type FocusAfter =
6
30
  /** The selected outline row, which focus follows (the tree pattern); the tree itself when nothing is selected. */
@@ -20,6 +44,12 @@ type FocusAfter =
20
44
  {
21
45
  readonly to: 'pane';
22
46
  readonly panel: EditorPanel;
47
+ } |
48
+ /** Where a group's button says the keyboard goes once it is done (`then`, 0044): a button of the group with that key, or its first field. */
49
+ {
50
+ readonly to: 'group';
51
+ readonly group: string;
52
+ readonly button?: number;
23
53
  };
24
54
  export declare class ReportEditorRoot {
25
55
  /** The editor this builder renders and acts on. Several builders may share one; each is told of the others' edits. */
@@ -31,10 +61,18 @@ export declare class ReportEditorRoot {
31
61
  readonly id: string;
32
62
  /** The sentence beside an outline with no row, which describes the empty tree. */
33
63
  readonly outlineEmpty: string;
64
+ /** The panes the person hid, as report-builder.css reads them; no attribute when none is. */
65
+ protected readonly hidden: import("@angular/core").Signal<string | null>;
34
66
  private readonly host;
35
67
  private focusAfter;
36
68
  /** What opened the place chooser, for focus to go back to when it is cancelled. */
37
69
  private opener;
70
+ /** The element the keyboard last stood on in this builder, for a middle pane swapped from under it to hand the keyboard on. */
71
+ private lastFocused;
72
+ /** Whether that element stood in the properties form, for a row taken from under it to hand the keyboard to the first field. */
73
+ private lastInProperties;
74
+ /** What the middle pane showed at the last render: null before the first. */
75
+ private view;
38
76
  constructor();
39
77
  /**
40
78
  * Sends `action` to the editor, and moves focus as `focus` says once
@@ -44,6 +82,15 @@ export declare class ReportEditorRoot {
44
82
  * renders next.
45
83
  */
46
84
  dispatch(action: EditorAction, focus?: FocusAfter): EditorOutcome;
85
+ /**
86
+ * Sends `action`, and moves focus as `focus` says only when it was done,
87
+ * or where the outcome says, where the action decided it only once done
88
+ * -- a run's button, whose run a split moved (0061): a refused one leaves
89
+ * the keyboard where the person pressed, the live region saying why -- a
90
+ * Remove of an image something draws (0033). The render the action
91
+ * causes comes after this returns, so it finds the focus asked for.
92
+ */
93
+ attempt(action: EditorAction, focus?: FocusAfter): EditorOutcome;
47
94
  /**
48
95
  * Opens the place chooser for `subject`, remembering `opener` to come back
49
96
  * to. It floats over the outline pane, so that is the pane a narrow screen
@@ -75,10 +122,25 @@ export declare class ReportEditorRoot {
75
122
  private placedFrom;
76
123
  /** A pointer's drag let go of anywhere but a place: it ends, and nothing changes. After a drop there is none left to end. */
77
124
  dragEnded(): void;
78
- /** Shows `panel` on a narrow screen and takes focus into it, so the pane that appears is where the keyboard is. */
125
+ /** Shows `panel` -- on a narrow screen, or hidden -- and takes focus into it, so the pane that appears is where the keyboard is. */
79
126
  showPane(panel: EditorPanel): void;
127
+ /** Hides `panel`; its Hide goes with it, so focus goes to the design view that took its room. */
128
+ hidePane(panel: HideablePanel): void;
129
+ protected focused(event: FocusEvent): void;
80
130
  protected keydown(event: KeyboardEvent): void;
131
+ /**
132
+ * The middle pane swapped by the host -- its view placed or shown from
133
+ * outside, as the window crosses a width -- takes the keyboard along
134
+ * rather than drop it on the page: where the element it stood on went
135
+ * with the pane, and nothing has taken it since. So does an undo or a
136
+ * redo that takes away the row it stood on in the properties -- an
137
+ * image's Remove, the add undone or the remove redone: it goes to the
138
+ * first field, as a Remove that worked sends it.
139
+ */
140
+ private dropped;
81
141
  private moveFocus;
142
+ /** The button at `button` of the properties' group with the key `key`, or its first field: the groups stand in the form in the order of the state's rows. */
143
+ private inGroup;
82
144
  static ɵfac: i0.ɵɵFactoryDeclaration<ReportEditorRoot, never>;
83
145
  static ɵdir: i0.ɵɵDirectiveDeclaration<ReportEditorRoot, "[reportEditor]", never, {
84
146
  "editor": {
@@ -93,12 +155,16 @@ export declare class ReportBuilder {
93
155
  protected readonly state: import("@angular/core").Signal<import("@formancy/report-builder-core").EditorState>;
94
156
  protected readonly t: import("@angular/core").Signal<import("@formancy/report-builder-core").EditorText>;
95
157
  protected readonly count: import("@angular/core").Signal<number>;
158
+ /** The template the host gave as its view, if it gave one. */
159
+ protected readonly hostView: import("@angular/core").Signal<ReportHostView | undefined>;
96
160
  /** No row in any region: the outline is an empty tree, and this says so beside it. */
97
161
  protected readonly empty: import("@angular/core").Signal<boolean>;
98
162
  /** What colour the count is: an error's, when any problem is one. */
99
163
  protected readonly severity: import("@angular/core").Signal<"error" | "warning">;
164
+ /** Whether the pane is drawn: every one the person has not hidden. */
165
+ protected shows(panel: HideablePanel): boolean;
100
166
  static ɵfac: i0.ɵɵFactoryDeclaration<ReportBuilder, never>;
101
- static ɵcmp: i0.ɵɵComponentDeclaration<ReportBuilder, "report-builder", never, {}, {}, never, never, true, [{
167
+ static ɵcmp: i0.ɵɵComponentDeclaration<ReportBuilder, "report-builder", never, {}, {}, ["hostView"], never, true, [{
102
168
  directive: typeof ReportEditorRoot;
103
169
  inputs: {
104
170
  "reportEditor": "editor";
@@ -113,7 +179,10 @@ export declare class ReportCanvas {
113
179
  protected readonly canvas: import("@angular/core").Signal<import("@formancy/report-builder-core").Canvas>;
114
180
  /** The component being moved, drawn faded where it stands. */
115
181
  protected readonly dragged: import("@angular/core").Signal<string | null>;
182
+ /** What a box says beyond its name, as its description: that it runs over, and that a word it prints is missing in the language edited. */
183
+ protected described(box: CanvasBox): string | null;
116
184
  protected select(box: CanvasBox): void;
185
+ protected selectBill(): void;
117
186
  protected drag(box: CanvasBox, event: DragEvent): void;
118
187
  /**
119
188
  * The place nearest the pointer, among those whose list it is over;
@@ -126,7 +195,7 @@ export declare class ReportCanvas {
126
195
  static ɵcmp: i0.ɵɵComponentDeclaration<ReportCanvas, "section[reportCanvas]", never, {}, {}, never, never, true, never>;
127
196
  }
128
197
  /** A node with its place among its siblings. */
129
- interface Row {
198
+ interface Row$1 {
130
199
  readonly node: OutlineNode;
131
200
  readonly position: number;
132
201
  readonly siblings: number;
@@ -136,20 +205,24 @@ export declare class ReportOutline {
136
205
  private readonly host;
137
206
  protected readonly t: import("@angular/core").Signal<import("@formancy/report-builder-core").EditorText>;
138
207
  protected readonly regions: import("@angular/core").Signal<{
139
- region: "body" | "summary" | "reportHeader" | "pageHeader" | "pageFooter";
208
+ region: "body" | "summary" | "reportHeader" | "firstPageHeader" | "pageHeader" | "pageFooter";
140
209
  label: string;
141
- rows: Row[];
210
+ rows: Row$1[];
142
211
  }[]>;
143
212
  private readonly all;
213
+ /** The rows of the parts of the report's own level, after the regions'. */
214
+ protected readonly parts: import("@angular/core").Signal<readonly OutlinePart[]>;
144
215
  /** The row Tab lands on: the selected one, else the first; none when the tree is empty. */
145
216
  protected readonly stop: import("@angular/core").Signal<string>;
146
- protected problems(node: OutlineNode): string;
217
+ protected problems(row: OutlineNode | OutlinePart): string;
147
218
  protected overflow(node: OutlineNode): string;
148
219
  /** The ids of what describes a row: how many problems it has, and that it is wider than its place. */
149
220
  protected described(node: OutlineNode): string | null;
150
221
  protected select(node: OutlineNode): void;
151
222
  /** Focus that arrives on a row -- by Tab, or put there after an undo -- selects it, so the properties beside it are the focused row's. */
152
223
  protected focused(node: OutlineNode): void;
224
+ protected selectPart(part: OutlinePart): void;
225
+ protected focusedPart(part: OutlinePart): void;
153
226
  protected drag(node: OutlineNode, event: DragEvent): void;
154
227
  /**
155
228
  * The place beside the row the pointer is over: before it over its upper
@@ -165,6 +238,7 @@ export declare class ReportPalette {
165
238
  protected readonly root: ReportEditorRoot;
166
239
  protected readonly state: import("@angular/core").Signal<import("@formancy/report-builder-core").EditorState>;
167
240
  protected readonly t: import("@angular/core").Signal<import("@formancy/report-builder-core").EditorText>;
241
+ protected readonly addWhy: string;
168
242
  protected why(entry: PaletteEntry): string;
169
243
  protected choose(entry: PaletteEntry, event: Event): void;
170
244
  protected drag(entry: PaletteEntry, event: DragEvent): void;
@@ -199,25 +273,61 @@ declare const CONTROLS: {
199
273
  readonly checkbox: "checkbox";
200
274
  };
201
275
  type Control = (typeof CONTROLS)[keyof typeof CONTROLS] | 'textarea';
276
+ /** A field as the properties draw it: with its control and its ids. */
202
277
  interface Shown {
203
278
  readonly field: PropertyField;
204
279
  readonly control: Control;
205
280
  readonly id: string;
206
281
  readonly errorId: string | null;
282
+ /** The id of the note under a field at a word in another language than the report's own (0063). */
283
+ readonly noteId: string | null;
284
+ /** What describes the control: its error, then its note; null when it has neither. */
285
+ readonly describedBy: string | null;
286
+ }
287
+ declare class ReportPropertyRow {
288
+ private readonly root;
289
+ readonly shown: import("@angular/core").InputSignal<Shown>;
290
+ /** The field as the editor has it now. */
291
+ private now;
292
+ /** `value` sent, where it is not what the field holds; then, for a typed control, what the field reads back in it. */
293
+ protected commit(field: PropertyField, value: string | boolean, control?: HTMLInputElement | HTMLTextAreaElement): void;
294
+ protected enter(field: PropertyField, event: Event): void;
295
+ /** Escape: what the report holds, back in the field, so nothing typed since is committed when it is left. */
296
+ protected giveBack(field: PropertyField, event: Event): void;
297
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReportPropertyRow, never>;
298
+ static ɵcmp: i0.ɵɵComponentDeclaration<ReportPropertyRow, "div[reportPropertyRow]", never, {
299
+ "shown": {
300
+ "alias": "shown";
301
+ "required": true;
302
+ "isSignal": true;
303
+ };
304
+ }, {}, never, never, true, never>;
305
+ }
306
+ /** A group of fields as the form draws it: its name, its fields and its buttons. */
307
+ interface ShownGroup {
308
+ readonly label: string;
309
+ readonly fields: readonly Shown[];
310
+ readonly actions: readonly PropertyAction[];
311
+ }
312
+ /** A row of the form: a field by itself, or a group of them with its button; the other one null. */
313
+ interface Row {
314
+ readonly key: string;
315
+ readonly field: Shown | null;
316
+ readonly group: ShownGroup | null;
207
317
  }
208
318
  export declare class ReportProperties {
209
319
  protected readonly root: ReportEditorRoot;
210
320
  /**
211
- * Each field with its control and ids. The ids carry whose fields these
212
- * are, and the rows are tracked by them, so a field of the next selection
213
- * is a new control rather than one still holding what was typed into the
214
- * last selection's.
321
+ * Each row, each field with its control and ids. The ids carry whose
322
+ * fields these are, and the rows are tracked by them, so a field of the
323
+ * next selection is a new control rather than one still holding what was
324
+ * typed into the last selection's.
215
325
  */
216
- protected readonly shown: import("@angular/core").Signal<readonly Shown[]>;
217
- protected commit(field: PropertyField, value: string | boolean): void;
218
- protected enter(field: PropertyField, event: Event): void;
219
- /** Escape: what the report holds, back in the field, so nothing typed since is committed when it is left. */
220
- protected giveBack(field: PropertyField, event: Event): void;
326
+ protected readonly rows: import("@angular/core").Signal<readonly Row[]>;
327
+ /** The field of a row that is no group. */
328
+ protected fieldOf(row: Row): Shown;
329
+ /** A group's button: what it says it does, the keyboard going where the editor says once it is done. */
330
+ protected press(action: PropertyAction, group: HTMLElement): void;
221
331
  static ɵfac: i0.ɵɵFactoryDeclaration<ReportProperties, never>;
222
332
  static ɵcmp: i0.ɵɵComponentDeclaration<ReportProperties, "form[reportProperties]", never, {}, {}, never, never, true, never>;
223
333
  }