@formancy/report-builder-angular 0.1.0 → 0.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, Directive, ElementRef, afterEveryRender, computed, effect, inject, input, linkedSignal, signal } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Directive, ElementRef, TemplateRef, ViewContainerRef, afterEveryRender, computed, contentChild, effect, inject, input, linkedSignal, signal } from "@angular/core";
|
|
3
3
|
import { PROPERTY_ROLES, actionForKey, editorText, targetBeside, targetNear } from "@formancy/report-builder-core";
|
|
4
4
|
function injectEditorState(editor) {
|
|
5
5
|
const state = linkedSignal(() => editor().state(), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
@@ -28,7 +28,7 @@ const PANE_FOCUS = {
|
|
|
28
28
|
"[role=\"treeitem\"][tabindex=\"0\"]",
|
|
29
29
|
"[role=\"tree\"]"
|
|
30
30
|
],
|
|
31
|
-
canvas: ["[data-report-part=\"canvas\"]"],
|
|
31
|
+
canvas: ["[data-report-part=\"canvas\"]", "[data-report-part=\"view\"]"],
|
|
32
32
|
properties: ["[data-report-part=\"properties\"] :is(input, select, textarea)"],
|
|
33
33
|
diagnostics: ["[data-report-part=\"diagnostics\"]"]
|
|
34
34
|
};
|
|
@@ -42,9 +42,13 @@ var ReportEditorRoot = class ReportEditorRoot {
|
|
|
42
42
|
t = computed(() => editorText(this.state().locale), ...ngDevMode ? [{ debugName: "t" }] : /* istanbul ignore next */ []);
|
|
43
43
|
id = `report-editor-${String(roots += 1)}`;
|
|
44
44
|
outlineEmpty = `${this.id}-outline-empty`;
|
|
45
|
+
hidden = computed(() => this.state().hidden.length === 0 ? null : this.state().hidden.join(" "), ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
|
|
45
46
|
host = inject(ElementRef);
|
|
46
47
|
focusAfter = null;
|
|
47
48
|
opener = null;
|
|
49
|
+
lastFocused = null;
|
|
50
|
+
lastInProperties = false;
|
|
51
|
+
view = null;
|
|
48
52
|
constructor() {
|
|
49
53
|
afterEveryRender(() => this.moveFocus());
|
|
50
54
|
}
|
|
@@ -52,6 +56,11 @@ var ReportEditorRoot = class ReportEditorRoot {
|
|
|
52
56
|
if (focus !== void 0) this.focusAfter = focus;
|
|
53
57
|
return this.editor().dispatch(action);
|
|
54
58
|
}
|
|
59
|
+
attempt(action, focus) {
|
|
60
|
+
const outcome = this.editor().dispatch(action);
|
|
61
|
+
if (outcome.ok) this.focusAfter = focus;
|
|
62
|
+
return outcome;
|
|
63
|
+
}
|
|
55
64
|
choosePlace(subject, opener) {
|
|
56
65
|
this.opener = opener;
|
|
57
66
|
if (this.dispatch({
|
|
@@ -115,9 +124,24 @@ var ReportEditorRoot = class ReportEditorRoot {
|
|
|
115
124
|
panel
|
|
116
125
|
});
|
|
117
126
|
}
|
|
127
|
+
hidePane(panel) {
|
|
128
|
+
this.dispatch({
|
|
129
|
+
type: "hidePanel",
|
|
130
|
+
panel
|
|
131
|
+
}, {
|
|
132
|
+
to: "pane",
|
|
133
|
+
panel: "canvas"
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
focused(event) {
|
|
137
|
+
this.lastFocused = event.target;
|
|
138
|
+
this.lastInProperties = event.target instanceof Element && event.target.closest("[data-report-part=\"properties\"]") !== null;
|
|
139
|
+
}
|
|
118
140
|
keydown(event) {
|
|
119
141
|
const target = event.target;
|
|
120
142
|
if (keepsItsKeys(target)) return;
|
|
143
|
+
const view = target.closest("[data-report-part=\"view\"]");
|
|
144
|
+
if (view !== null && this.host.nativeElement.contains(view)) return;
|
|
121
145
|
const scope = target.closest("[role=\"tree\"]") === null ? "editor" : "outline";
|
|
122
146
|
const action = actionForKey(event, scope, this.state().drag !== null);
|
|
123
147
|
if (action === void 0) return;
|
|
@@ -125,8 +149,25 @@ var ReportEditorRoot = class ReportEditorRoot {
|
|
|
125
149
|
if (action.type === "cancelDrag") return this.cancelPlacing();
|
|
126
150
|
this.dispatch(action, scope === "outline" ? { to: "selection" } : void 0);
|
|
127
151
|
}
|
|
152
|
+
dropped() {
|
|
153
|
+
const view = this.state().view;
|
|
154
|
+
const swapped = this.view !== null && this.view !== view;
|
|
155
|
+
this.view = view;
|
|
156
|
+
const last = this.lastFocused;
|
|
157
|
+
const nowhere = document.activeElement === null || document.activeElement === document.body;
|
|
158
|
+
if (!(last instanceof Node) || last.isConnected || !nowhere) return null;
|
|
159
|
+
if (swapped) return {
|
|
160
|
+
to: "pane",
|
|
161
|
+
panel: "canvas"
|
|
162
|
+
};
|
|
163
|
+
return this.lastInProperties ? {
|
|
164
|
+
to: "pane",
|
|
165
|
+
panel: "properties"
|
|
166
|
+
} : null;
|
|
167
|
+
}
|
|
128
168
|
moveFocus() {
|
|
129
|
-
const
|
|
169
|
+
const dropped = this.dropped();
|
|
170
|
+
const focus = this.focusAfter ?? dropped;
|
|
130
171
|
if (focus === null) return;
|
|
131
172
|
this.focusAfter = null;
|
|
132
173
|
const root = this.host.nativeElement;
|
|
@@ -159,10 +200,14 @@ var ReportEditorRoot = class ReportEditorRoot {
|
|
|
159
200
|
"role": "region",
|
|
160
201
|
"data-report-part": "editor"
|
|
161
202
|
},
|
|
162
|
-
listeners: {
|
|
203
|
+
listeners: {
|
|
204
|
+
"keydown": "keydown($event)",
|
|
205
|
+
"focusin": "focused($event)"
|
|
206
|
+
},
|
|
163
207
|
properties: {
|
|
164
208
|
"attr.aria-label": "t()(\"editor.label\")",
|
|
165
|
-
"attr.data-panel": "state().panel"
|
|
209
|
+
"attr.data-panel": "state().panel",
|
|
210
|
+
"attr.data-hidden": "hidden()"
|
|
166
211
|
},
|
|
167
212
|
classAttribute: "wb"
|
|
168
213
|
},
|
|
@@ -184,7 +229,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
184
229
|
class: "wb",
|
|
185
230
|
"[attr.aria-label]": "t()(\"editor.label\")",
|
|
186
231
|
"[attr.data-panel]": "state().panel",
|
|
187
|
-
"
|
|
232
|
+
"[attr.data-hidden]": "hidden()",
|
|
233
|
+
"(keydown)": "keydown($event)",
|
|
234
|
+
"(focusin)": "focused($event)"
|
|
188
235
|
}
|
|
189
236
|
}]
|
|
190
237
|
}],
|
|
@@ -298,6 +345,19 @@ var ReportCanvas = class ReportCanvas {
|
|
|
298
345
|
(dragend)="root.dragEnded()"
|
|
299
346
|
><span data-report-part="box-label">{{ box.label }}</span>@if (box.problems > 0) {<span data-report-part="badge" [attr.data-severity]="box.severity ?? null" aria-hidden="true">{{ box.problems }}</span>}</div>
|
|
300
347
|
}
|
|
348
|
+
<!-- Where a payment part's slip prints, below every region: a picture
|
|
349
|
+
named as SIX names the part, as a box is named by its label. -->
|
|
350
|
+
@if (canvas().paymentPart; as band) {
|
|
351
|
+
<div
|
|
352
|
+
role="img"
|
|
353
|
+
data-report-part="payment-part"
|
|
354
|
+
[attr.aria-label]="band.label"
|
|
355
|
+
[style.left.px]="band.px.x"
|
|
356
|
+
[style.top.px]="band.px.y"
|
|
357
|
+
[style.width.px]="band.px.width"
|
|
358
|
+
[style.height.px]="band.px.height"
|
|
359
|
+
><span data-report-part="region-label">{{ band.label }}</span></div>
|
|
360
|
+
}
|
|
301
361
|
<!-- Drawn only for the places the session accepts, named as the place
|
|
302
362
|
chooser names them; the one under the pointer, or focused in the
|
|
303
363
|
chooser, is marked. -->
|
|
@@ -377,6 +437,19 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
377
437
|
(dragend)="root.dragEnded()"
|
|
378
438
|
><span data-report-part="box-label">{{ box.label }}</span>@if (box.problems > 0) {<span data-report-part="badge" [attr.data-severity]="box.severity ?? null" aria-hidden="true">{{ box.problems }}</span>}</div>
|
|
379
439
|
}
|
|
440
|
+
<!-- Where a payment part's slip prints, below every region: a picture
|
|
441
|
+
named as SIX names the part, as a box is named by its label. -->
|
|
442
|
+
@if (canvas().paymentPart; as band) {
|
|
443
|
+
<div
|
|
444
|
+
role="img"
|
|
445
|
+
data-report-part="payment-part"
|
|
446
|
+
[attr.aria-label]="band.label"
|
|
447
|
+
[style.left.px]="band.px.x"
|
|
448
|
+
[style.top.px]="band.px.y"
|
|
449
|
+
[style.width.px]="band.px.width"
|
|
450
|
+
[style.height.px]="band.px.height"
|
|
451
|
+
><span data-report-part="region-label">{{ band.label }}</span></div>
|
|
452
|
+
}
|
|
380
453
|
<!-- Drawn only for the places the session accepts, named as the place
|
|
381
454
|
chooser names them; the one under the pointer, or focused in the
|
|
382
455
|
chooser, is marked. -->
|
|
@@ -397,6 +470,91 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
397
470
|
}]
|
|
398
471
|
}]
|
|
399
472
|
});
|
|
473
|
+
var ReportHostView = class ReportHostView {
|
|
474
|
+
template = inject(TemplateRef);
|
|
475
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
476
|
+
minVersion: "12.0.0",
|
|
477
|
+
version: "22.2.2",
|
|
478
|
+
ngImport: i0,
|
|
479
|
+
type: ReportHostView,
|
|
480
|
+
deps: [],
|
|
481
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
482
|
+
});
|
|
483
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
484
|
+
minVersion: "14.0.0",
|
|
485
|
+
version: "22.2.2",
|
|
486
|
+
type: ReportHostView,
|
|
487
|
+
isStandalone: true,
|
|
488
|
+
selector: "ng-template[reportHostView]",
|
|
489
|
+
ngImport: i0
|
|
490
|
+
});
|
|
491
|
+
};
|
|
492
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
493
|
+
minVersion: "12.0.0",
|
|
494
|
+
version: "22.2.2",
|
|
495
|
+
ngImport: i0,
|
|
496
|
+
type: ReportHostView,
|
|
497
|
+
decorators: [{
|
|
498
|
+
type: Directive,
|
|
499
|
+
args: [{ selector: "ng-template[reportHostView]" }]
|
|
500
|
+
}]
|
|
501
|
+
});
|
|
502
|
+
var ReportHostOutlet = class ReportHostOutlet {
|
|
503
|
+
template = input.required({
|
|
504
|
+
...ngDevMode ? { debugName: "template" } : /* istanbul ignore next */ {},
|
|
505
|
+
alias: "reportHostOutlet"
|
|
506
|
+
});
|
|
507
|
+
container = inject(ViewContainerRef);
|
|
508
|
+
constructor() {
|
|
509
|
+
effect(() => {
|
|
510
|
+
const template = this.template();
|
|
511
|
+
this.container.clear();
|
|
512
|
+
if (template !== null) this.container.createEmbeddedView(template);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
516
|
+
minVersion: "12.0.0",
|
|
517
|
+
version: "22.2.2",
|
|
518
|
+
ngImport: i0,
|
|
519
|
+
type: ReportHostOutlet,
|
|
520
|
+
deps: [],
|
|
521
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
522
|
+
});
|
|
523
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
524
|
+
minVersion: "17.1.0",
|
|
525
|
+
version: "22.2.2",
|
|
526
|
+
type: ReportHostOutlet,
|
|
527
|
+
isStandalone: true,
|
|
528
|
+
selector: "[reportHostOutlet]",
|
|
529
|
+
inputs: { template: {
|
|
530
|
+
classPropertyName: "template",
|
|
531
|
+
publicName: "reportHostOutlet",
|
|
532
|
+
isSignal: true,
|
|
533
|
+
isRequired: true,
|
|
534
|
+
transformFunction: null
|
|
535
|
+
} },
|
|
536
|
+
ngImport: i0
|
|
537
|
+
});
|
|
538
|
+
};
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
540
|
+
minVersion: "12.0.0",
|
|
541
|
+
version: "22.2.2",
|
|
542
|
+
ngImport: i0,
|
|
543
|
+
type: ReportHostOutlet,
|
|
544
|
+
decorators: [{
|
|
545
|
+
type: Directive,
|
|
546
|
+
args: [{ selector: "[reportHostOutlet]" }]
|
|
547
|
+
}],
|
|
548
|
+
ctorParameters: () => [],
|
|
549
|
+
propDecorators: { template: [{
|
|
550
|
+
type: i0.Input,
|
|
551
|
+
args: [{
|
|
552
|
+
isSignal: true,
|
|
553
|
+
alias: "reportHostOutlet",
|
|
554
|
+
required: true
|
|
555
|
+
}]
|
|
556
|
+
}] }
|
|
557
|
+
});
|
|
400
558
|
function rows(nodes, into = []) {
|
|
401
559
|
nodes.forEach((node, at) => {
|
|
402
560
|
into.push({
|
|
@@ -597,10 +755,68 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
597
755
|
}]
|
|
598
756
|
}]
|
|
599
757
|
});
|
|
758
|
+
var ReportImageChooser = class ReportImageChooser {
|
|
759
|
+
root = inject(ReportEditorRoot);
|
|
760
|
+
input = inject(ElementRef);
|
|
761
|
+
open() {
|
|
762
|
+
if (this.root.dispatch({ type: "chooseImage" }).ok) this.input.nativeElement.click();
|
|
763
|
+
}
|
|
764
|
+
take() {
|
|
765
|
+
const input = this.input.nativeElement;
|
|
766
|
+
const file = input.files?.[0];
|
|
767
|
+
input.value = "";
|
|
768
|
+
if (file !== void 0) this.root.editor().addImage(file);
|
|
769
|
+
}
|
|
770
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
771
|
+
minVersion: "12.0.0",
|
|
772
|
+
version: "22.2.2",
|
|
773
|
+
ngImport: i0,
|
|
774
|
+
type: ReportImageChooser,
|
|
775
|
+
deps: [],
|
|
776
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
777
|
+
});
|
|
778
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
779
|
+
minVersion: "14.0.0",
|
|
780
|
+
version: "22.2.2",
|
|
781
|
+
type: ReportImageChooser,
|
|
782
|
+
isStandalone: true,
|
|
783
|
+
selector: "input[reportImageChooser]",
|
|
784
|
+
host: {
|
|
785
|
+
attributes: {
|
|
786
|
+
"type": "file",
|
|
787
|
+
"hidden": ""
|
|
788
|
+
},
|
|
789
|
+
listeners: { "change": "take()" },
|
|
790
|
+
properties: { "accept": "root.state().images.accept" }
|
|
791
|
+
},
|
|
792
|
+
exportAs: ["reportImageChooser"],
|
|
793
|
+
ngImport: i0
|
|
794
|
+
});
|
|
795
|
+
};
|
|
796
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
797
|
+
minVersion: "12.0.0",
|
|
798
|
+
version: "22.2.2",
|
|
799
|
+
ngImport: i0,
|
|
800
|
+
type: ReportImageChooser,
|
|
801
|
+
decorators: [{
|
|
802
|
+
type: Directive,
|
|
803
|
+
args: [{
|
|
804
|
+
selector: "input[reportImageChooser]",
|
|
805
|
+
exportAs: "reportImageChooser",
|
|
806
|
+
host: {
|
|
807
|
+
type: "file",
|
|
808
|
+
hidden: "",
|
|
809
|
+
"[accept]": "root.state().images.accept",
|
|
810
|
+
"(change)": "take()"
|
|
811
|
+
}
|
|
812
|
+
}]
|
|
813
|
+
}]
|
|
814
|
+
});
|
|
600
815
|
var ReportPalette = class ReportPalette {
|
|
601
816
|
root = inject(ReportEditorRoot);
|
|
602
817
|
state = this.root.state;
|
|
603
818
|
t = this.root.t;
|
|
819
|
+
addWhy = `${this.root.id}-unavailable-add-image`;
|
|
604
820
|
why(entry) {
|
|
605
821
|
return `${this.root.id}-unavailable-${entry.kind}`;
|
|
606
822
|
}
|
|
@@ -646,8 +862,25 @@ var ReportPalette = class ReportPalette {
|
|
|
646
862
|
(dragend)="root.dragEnded()"
|
|
647
863
|
>{{ entry.label }}@if (entry.unavailable !== undefined) {<span [id]="why(entry)" hidden>{{ entry.unavailable }}</span>}</button>
|
|
648
864
|
}
|
|
865
|
+
@if (state().images.store) {
|
|
866
|
+
<button
|
|
867
|
+
type="button"
|
|
868
|
+
data-report-part="palette-item"
|
|
869
|
+
[attr.aria-disabled]="state().can.addImage ? null : 'true'"
|
|
870
|
+
[attr.aria-describedby]="state().images.unavailable === undefined ? null : addWhy"
|
|
871
|
+
[attr.aria-busy]="state().images.adding === null ? null : 'true'"
|
|
872
|
+
(click)="file.open()"
|
|
873
|
+
>{{ t()('images.add') }}@if (state().images.unavailable !== undefined) {<span [id]="addWhy" hidden>{{ state().images.unavailable }}</span>}</button>
|
|
874
|
+
<input reportImageChooser #file="reportImageChooser" />
|
|
875
|
+
}
|
|
649
876
|
`,
|
|
650
877
|
isInline: true,
|
|
878
|
+
dependencies: [{
|
|
879
|
+
kind: "directive",
|
|
880
|
+
type: ReportImageChooser,
|
|
881
|
+
selector: "input[reportImageChooser]",
|
|
882
|
+
exportAs: ["reportImageChooser"]
|
|
883
|
+
}],
|
|
651
884
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
652
885
|
});
|
|
653
886
|
};
|
|
@@ -661,6 +894,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
661
894
|
args: [{
|
|
662
895
|
selector: "div[reportPalette]",
|
|
663
896
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
897
|
+
imports: [ReportImageChooser],
|
|
664
898
|
host: {
|
|
665
899
|
role: "group",
|
|
666
900
|
"data-report-part": "palette",
|
|
@@ -680,6 +914,17 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
680
914
|
(dragend)="root.dragEnded()"
|
|
681
915
|
>{{ entry.label }}@if (entry.unavailable !== undefined) {<span [id]="why(entry)" hidden>{{ entry.unavailable }}</span>}</button>
|
|
682
916
|
}
|
|
917
|
+
@if (state().images.store) {
|
|
918
|
+
<button
|
|
919
|
+
type="button"
|
|
920
|
+
data-report-part="palette-item"
|
|
921
|
+
[attr.aria-disabled]="state().can.addImage ? null : 'true'"
|
|
922
|
+
[attr.aria-describedby]="state().images.unavailable === undefined ? null : addWhy"
|
|
923
|
+
[attr.aria-busy]="state().images.adding === null ? null : 'true'"
|
|
924
|
+
(click)="file.open()"
|
|
925
|
+
>{{ t()('images.add') }}@if (state().images.unavailable !== undefined) {<span [id]="addWhy" hidden>{{ state().images.unavailable }}</span>}</button>
|
|
926
|
+
<input reportImageChooser #file="reportImageChooser" />
|
|
927
|
+
}
|
|
683
928
|
`
|
|
684
929
|
}]
|
|
685
930
|
}]
|
|
@@ -849,6 +1094,88 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
849
1094
|
}]
|
|
850
1095
|
}]
|
|
851
1096
|
});
|
|
1097
|
+
var ReportImageLibrary = class ReportImageLibrary {
|
|
1098
|
+
root = inject(ReportEditorRoot);
|
|
1099
|
+
why(at) {
|
|
1100
|
+
return `${this.root.id}-image-${String(at)}-in-use`;
|
|
1101
|
+
}
|
|
1102
|
+
remove(asset) {
|
|
1103
|
+
this.root.attempt({
|
|
1104
|
+
type: "removeImage",
|
|
1105
|
+
asset
|
|
1106
|
+
}, {
|
|
1107
|
+
to: "pane",
|
|
1108
|
+
panel: "properties"
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1112
|
+
minVersion: "12.0.0",
|
|
1113
|
+
version: "22.2.2",
|
|
1114
|
+
ngImport: i0,
|
|
1115
|
+
type: ReportImageLibrary,
|
|
1116
|
+
deps: [],
|
|
1117
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1118
|
+
});
|
|
1119
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1120
|
+
minVersion: "17.0.0",
|
|
1121
|
+
version: "22.2.2",
|
|
1122
|
+
type: ReportImageLibrary,
|
|
1123
|
+
isStandalone: true,
|
|
1124
|
+
selector: "div[reportImageLibrary]",
|
|
1125
|
+
host: {
|
|
1126
|
+
attributes: { "role": "group" },
|
|
1127
|
+
properties: { "attr.aria-label": "root.t()(\"images.heading\")" }
|
|
1128
|
+
},
|
|
1129
|
+
ngImport: i0,
|
|
1130
|
+
template: `
|
|
1131
|
+
@for (image of root.state().images.assets; track image.id; let at = $index) {
|
|
1132
|
+
<div data-report-part="property">
|
|
1133
|
+
<span>{{ image.label }}</span>
|
|
1134
|
+
<button
|
|
1135
|
+
type="button"
|
|
1136
|
+
[attr.aria-label]="image.removeLabel"
|
|
1137
|
+
[attr.aria-disabled]="image.inUse === undefined ? null : 'true'"
|
|
1138
|
+
[attr.aria-describedby]="image.inUse === undefined ? null : why(at)"
|
|
1139
|
+
(click)="remove(image.id)"
|
|
1140
|
+
>{{ root.t()('images.remove') }}@if (image.inUse !== undefined) {<span [id]="why(at)" hidden>{{ image.inUse }}</span>}</button>
|
|
1141
|
+
</div>
|
|
1142
|
+
}
|
|
1143
|
+
`,
|
|
1144
|
+
isInline: true,
|
|
1145
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1146
|
+
});
|
|
1147
|
+
};
|
|
1148
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1149
|
+
minVersion: "12.0.0",
|
|
1150
|
+
version: "22.2.2",
|
|
1151
|
+
ngImport: i0,
|
|
1152
|
+
type: ReportImageLibrary,
|
|
1153
|
+
decorators: [{
|
|
1154
|
+
type: Component,
|
|
1155
|
+
args: [{
|
|
1156
|
+
selector: "div[reportImageLibrary]",
|
|
1157
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1158
|
+
host: {
|
|
1159
|
+
role: "group",
|
|
1160
|
+
"[attr.aria-label]": "root.t()(\"images.heading\")"
|
|
1161
|
+
},
|
|
1162
|
+
template: `
|
|
1163
|
+
@for (image of root.state().images.assets; track image.id; let at = $index) {
|
|
1164
|
+
<div data-report-part="property">
|
|
1165
|
+
<span>{{ image.label }}</span>
|
|
1166
|
+
<button
|
|
1167
|
+
type="button"
|
|
1168
|
+
[attr.aria-label]="image.removeLabel"
|
|
1169
|
+
[attr.aria-disabled]="image.inUse === undefined ? null : 'true'"
|
|
1170
|
+
[attr.aria-describedby]="image.inUse === undefined ? null : why(at)"
|
|
1171
|
+
(click)="remove(image.id)"
|
|
1172
|
+
>{{ root.t()('images.remove') }}@if (image.inUse !== undefined) {<span [id]="why(at)" hidden>{{ image.inUse }}</span>}</button>
|
|
1173
|
+
</div>
|
|
1174
|
+
}
|
|
1175
|
+
`
|
|
1176
|
+
}]
|
|
1177
|
+
}]
|
|
1178
|
+
});
|
|
852
1179
|
const CONTROLS = {
|
|
853
1180
|
textbox: "text",
|
|
854
1181
|
spinbutton: "number",
|
|
@@ -968,8 +1295,16 @@ var ReportProperties = class ReportProperties {
|
|
|
968
1295
|
}
|
|
969
1296
|
</div>
|
|
970
1297
|
}
|
|
1298
|
+
@if (root.state().selection === null && root.state().images.assets.length > 0) {
|
|
1299
|
+
<div reportImageLibrary></div>
|
|
1300
|
+
}
|
|
971
1301
|
`,
|
|
972
1302
|
isInline: true,
|
|
1303
|
+
dependencies: [{
|
|
1304
|
+
kind: "component",
|
|
1305
|
+
type: ReportImageLibrary,
|
|
1306
|
+
selector: "div[reportImageLibrary]"
|
|
1307
|
+
}],
|
|
973
1308
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
974
1309
|
});
|
|
975
1310
|
};
|
|
@@ -983,6 +1318,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
983
1318
|
args: [{
|
|
984
1319
|
selector: "form[reportProperties]",
|
|
985
1320
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1321
|
+
imports: [ReportImageLibrary],
|
|
986
1322
|
host: {
|
|
987
1323
|
"data-report-part": "properties",
|
|
988
1324
|
"[attr.aria-label]": "root.state().properties.heading",
|
|
@@ -1049,6 +1385,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1049
1385
|
}
|
|
1050
1386
|
</div>
|
|
1051
1387
|
}
|
|
1388
|
+
@if (root.state().selection === null && root.state().images.assets.length > 0) {
|
|
1389
|
+
<div reportImageLibrary></div>
|
|
1390
|
+
}
|
|
1052
1391
|
`
|
|
1053
1392
|
}]
|
|
1054
1393
|
}]
|
|
@@ -1251,8 +1590,12 @@ var ReportBuilder = class ReportBuilder {
|
|
|
1251
1590
|
state = this.root.state;
|
|
1252
1591
|
t = this.root.t;
|
|
1253
1592
|
count = computed(() => this.state().diagnostics.length, ...ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []);
|
|
1593
|
+
hostView = contentChild(ReportHostView, ...ngDevMode ? [{ debugName: "hostView" }] : /* istanbul ignore next */ []);
|
|
1254
1594
|
empty = computed(() => this.state().outline.every((region) => region.nodes.length === 0), ...ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []);
|
|
1255
1595
|
severity = computed(() => this.state().diagnostics.some((entry) => entry.severity === "error") ? "error" : "warning", ...ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []);
|
|
1596
|
+
shows(panel) {
|
|
1597
|
+
return !this.state().hidden.includes(panel);
|
|
1598
|
+
}
|
|
1256
1599
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1257
1600
|
minVersion: "12.0.0",
|
|
1258
1601
|
version: "22.2.2",
|
|
@@ -1267,6 +1610,13 @@ var ReportBuilder = class ReportBuilder {
|
|
|
1267
1610
|
type: ReportBuilder,
|
|
1268
1611
|
isStandalone: true,
|
|
1269
1612
|
selector: "report-builder",
|
|
1613
|
+
queries: [{
|
|
1614
|
+
propertyName: "hostView",
|
|
1615
|
+
first: true,
|
|
1616
|
+
predicate: ReportHostView,
|
|
1617
|
+
descendants: true,
|
|
1618
|
+
isSignal: true
|
|
1619
|
+
}],
|
|
1270
1620
|
hostDirectives: [{
|
|
1271
1621
|
directive: ReportEditorRoot,
|
|
1272
1622
|
inputs: ["reportEditor", "editor"]
|
|
@@ -1279,46 +1629,65 @@ var ReportBuilder = class ReportBuilder {
|
|
|
1279
1629
|
<div reportToolbar></div>
|
|
1280
1630
|
</header>
|
|
1281
1631
|
</div>
|
|
1282
|
-
|
|
1283
|
-
<
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1632
|
+
@if (shows('outline')) {
|
|
1633
|
+
<section class="wb-pane" data-pane="outline">
|
|
1634
|
+
<header>
|
|
1635
|
+
<span>{{ t()('pane.outline') }}</span>
|
|
1636
|
+
<button type="button" data-report-part="hide-pane" [attr.aria-label]="t()('action.hidePane', { pane: t()('pane.outline') })" (click)="root.hidePane('outline')">{{ t()('action.hide') }}</button>
|
|
1637
|
+
</header>
|
|
1638
|
+
<div class="wb-body">
|
|
1639
|
+
<div reportPalette></div>
|
|
1640
|
+
<div reportOutline></div>
|
|
1641
|
+
@if (empty()) {
|
|
1642
|
+
<p data-report-part="outline-empty" [id]="root.outlineEmpty">{{ t()('outline.empty') }}</p>
|
|
1643
|
+
}
|
|
1644
|
+
</div>
|
|
1645
|
+
<div reportPlaces></div>
|
|
1646
|
+
</section>
|
|
1647
|
+
}
|
|
1648
|
+
@if (state().view === 'host') {
|
|
1649
|
+
<section data-pane="canvas" data-report-part="view" tabindex="-1" [attr.aria-label]="state().hostView?.name">
|
|
1650
|
+
<ng-container [reportHostOutlet]="hostView()?.template ?? null"></ng-container>
|
|
1651
|
+
</section>
|
|
1652
|
+
} @else {
|
|
1653
|
+
<section class="wb-pane wb-canvas" data-pane="canvas">
|
|
1654
|
+
<header>{{ t()('pane.canvas') }}</header>
|
|
1655
|
+
<div class="wb-body">
|
|
1656
|
+
<section reportCanvas></section>
|
|
1657
|
+
</div>
|
|
1658
|
+
</section>
|
|
1659
|
+
}
|
|
1660
|
+
@if (shows('properties') || shows('diagnostics')) {
|
|
1661
|
+
<section class="wb-pane" [attr.data-pane]="state().panel === 'diagnostics' || !shows('properties') ? 'diagnostics' : 'properties'">
|
|
1662
|
+
@if (shows('properties')) {
|
|
1663
|
+
<header data-pane="properties">
|
|
1664
|
+
<span>{{ state().properties.heading }}</span>
|
|
1665
|
+
@if (state().selection !== null) {
|
|
1666
|
+
<button type="button" (click)="root.dispatch({ type: 'select', id: null }, { to: 'pane', panel: 'properties' })">{{ t()('properties.report') }}</button>
|
|
1667
|
+
}
|
|
1668
|
+
<button type="button" data-report-part="hide-pane" [attr.aria-label]="t()('action.hidePane', { pane: t()('pane.properties') })" (click)="root.hidePane('properties')">{{ t()('action.hide') }}</button>
|
|
1669
|
+
</header>
|
|
1670
|
+
<div class="wb-body" data-pane="properties">
|
|
1671
|
+
<form reportProperties></form>
|
|
1672
|
+
</div>
|
|
1289
1673
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1674
|
+
@if (shows('diagnostics')) {
|
|
1675
|
+
<header data-pane="diagnostics">
|
|
1676
|
+
<!-- A status, so a change in how many problems there are is said
|
|
1677
|
+
without taking the person's place: "Problems 2". Named in
|
|
1678
|
+
words, never after its own heading, which the Studio sets in
|
|
1679
|
+
capitals that Chromium would put in the name. -->
|
|
1680
|
+
<div role="status" [attr.aria-label]="t()('pane.problems')">
|
|
1681
|
+
<span>{{ t()('pane.problems') }}</span>{{ count() > 0 ? ' ' : '' }}@if (count() > 0) {<span data-report-part="badge" [attr.data-severity]="severity()">{{ count() }}</span>}
|
|
1682
|
+
</div>
|
|
1683
|
+
<button type="button" data-report-part="hide-pane" [attr.aria-label]="t()('action.hidePane', { pane: t()('pane.problems') })" (click)="root.hidePane('diagnostics')">{{ t()('action.hide') }}</button>
|
|
1684
|
+
</header>
|
|
1685
|
+
<div class="wb-body" data-pane="diagnostics">
|
|
1686
|
+
<div reportProblems></div>
|
|
1687
|
+
</div>
|
|
1304
1688
|
}
|
|
1305
|
-
</
|
|
1306
|
-
|
|
1307
|
-
<form reportProperties></form>
|
|
1308
|
-
</div>
|
|
1309
|
-
<header data-pane="diagnostics">
|
|
1310
|
-
<!-- A status, so a change in how many problems there are is said
|
|
1311
|
-
without taking the person's place: "Problems 2". Named in
|
|
1312
|
-
words, never after its own heading, which the Studio sets in
|
|
1313
|
-
capitals that Chromium would put in the name. -->
|
|
1314
|
-
<div role="status" [attr.aria-label]="t()('pane.problems')">
|
|
1315
|
-
<span>{{ t()('pane.problems') }}</span>{{ count() > 0 ? ' ' : '' }}@if (count() > 0) {<span data-report-part="badge" [attr.data-severity]="severity()">{{ count() }}</span>}
|
|
1316
|
-
</div>
|
|
1317
|
-
</header>
|
|
1318
|
-
<div class="wb-body" data-pane="diagnostics">
|
|
1319
|
-
<div reportProblems></div>
|
|
1320
|
-
</div>
|
|
1321
|
-
</section>
|
|
1689
|
+
</section>
|
|
1690
|
+
}
|
|
1322
1691
|
<div class="wb-pane">
|
|
1323
1692
|
<p reportStatus></p>
|
|
1324
1693
|
</div>
|
|
@@ -1330,6 +1699,12 @@ var ReportBuilder = class ReportBuilder {
|
|
|
1330
1699
|
type: ReportCanvas,
|
|
1331
1700
|
selector: "section[reportCanvas]"
|
|
1332
1701
|
},
|
|
1702
|
+
{
|
|
1703
|
+
kind: "directive",
|
|
1704
|
+
type: ReportHostOutlet,
|
|
1705
|
+
selector: "[reportHostOutlet]",
|
|
1706
|
+
inputs: ["reportHostOutlet"]
|
|
1707
|
+
},
|
|
1333
1708
|
{
|
|
1334
1709
|
kind: "component",
|
|
1335
1710
|
type: ReportOutline,
|
|
@@ -1385,6 +1760,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1385
1760
|
}],
|
|
1386
1761
|
imports: [
|
|
1387
1762
|
ReportCanvas,
|
|
1763
|
+
ReportHostOutlet,
|
|
1388
1764
|
ReportOutline,
|
|
1389
1765
|
ReportPalette,
|
|
1390
1766
|
ReportPlaces,
|
|
@@ -1400,53 +1776,76 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1400
1776
|
<div reportToolbar></div>
|
|
1401
1777
|
</header>
|
|
1402
1778
|
</div>
|
|
1403
|
-
|
|
1404
|
-
<
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1779
|
+
@if (shows('outline')) {
|
|
1780
|
+
<section class="wb-pane" data-pane="outline">
|
|
1781
|
+
<header>
|
|
1782
|
+
<span>{{ t()('pane.outline') }}</span>
|
|
1783
|
+
<button type="button" data-report-part="hide-pane" [attr.aria-label]="t()('action.hidePane', { pane: t()('pane.outline') })" (click)="root.hidePane('outline')">{{ t()('action.hide') }}</button>
|
|
1784
|
+
</header>
|
|
1785
|
+
<div class="wb-body">
|
|
1786
|
+
<div reportPalette></div>
|
|
1787
|
+
<div reportOutline></div>
|
|
1788
|
+
@if (empty()) {
|
|
1789
|
+
<p data-report-part="outline-empty" [id]="root.outlineEmpty">{{ t()('outline.empty') }}</p>
|
|
1790
|
+
}
|
|
1791
|
+
</div>
|
|
1792
|
+
<div reportPlaces></div>
|
|
1793
|
+
</section>
|
|
1794
|
+
}
|
|
1795
|
+
@if (state().view === 'host') {
|
|
1796
|
+
<section data-pane="canvas" data-report-part="view" tabindex="-1" [attr.aria-label]="state().hostView?.name">
|
|
1797
|
+
<ng-container [reportHostOutlet]="hostView()?.template ?? null"></ng-container>
|
|
1798
|
+
</section>
|
|
1799
|
+
} @else {
|
|
1800
|
+
<section class="wb-pane wb-canvas" data-pane="canvas">
|
|
1801
|
+
<header>{{ t()('pane.canvas') }}</header>
|
|
1802
|
+
<div class="wb-body">
|
|
1803
|
+
<section reportCanvas></section>
|
|
1804
|
+
</div>
|
|
1805
|
+
</section>
|
|
1806
|
+
}
|
|
1807
|
+
@if (shows('properties') || shows('diagnostics')) {
|
|
1808
|
+
<section class="wb-pane" [attr.data-pane]="state().panel === 'diagnostics' || !shows('properties') ? 'diagnostics' : 'properties'">
|
|
1809
|
+
@if (shows('properties')) {
|
|
1810
|
+
<header data-pane="properties">
|
|
1811
|
+
<span>{{ state().properties.heading }}</span>
|
|
1812
|
+
@if (state().selection !== null) {
|
|
1813
|
+
<button type="button" (click)="root.dispatch({ type: 'select', id: null }, { to: 'pane', panel: 'properties' })">{{ t()('properties.report') }}</button>
|
|
1814
|
+
}
|
|
1815
|
+
<button type="button" data-report-part="hide-pane" [attr.aria-label]="t()('action.hidePane', { pane: t()('pane.properties') })" (click)="root.hidePane('properties')">{{ t()('action.hide') }}</button>
|
|
1816
|
+
</header>
|
|
1817
|
+
<div class="wb-body" data-pane="properties">
|
|
1818
|
+
<form reportProperties></form>
|
|
1819
|
+
</div>
|
|
1410
1820
|
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1821
|
+
@if (shows('diagnostics')) {
|
|
1822
|
+
<header data-pane="diagnostics">
|
|
1823
|
+
<!-- A status, so a change in how many problems there are is said
|
|
1824
|
+
without taking the person's place: "Problems 2". Named in
|
|
1825
|
+
words, never after its own heading, which the Studio sets in
|
|
1826
|
+
capitals that Chromium would put in the name. -->
|
|
1827
|
+
<div role="status" [attr.aria-label]="t()('pane.problems')">
|
|
1828
|
+
<span>{{ t()('pane.problems') }}</span>{{ count() > 0 ? ' ' : '' }}@if (count() > 0) {<span data-report-part="badge" [attr.data-severity]="severity()">{{ count() }}</span>}
|
|
1829
|
+
</div>
|
|
1830
|
+
<button type="button" data-report-part="hide-pane" [attr.aria-label]="t()('action.hidePane', { pane: t()('pane.problems') })" (click)="root.hidePane('diagnostics')">{{ t()('action.hide') }}</button>
|
|
1831
|
+
</header>
|
|
1832
|
+
<div class="wb-body" data-pane="diagnostics">
|
|
1833
|
+
<div reportProblems></div>
|
|
1834
|
+
</div>
|
|
1425
1835
|
}
|
|
1426
|
-
</
|
|
1427
|
-
|
|
1428
|
-
<form reportProperties></form>
|
|
1429
|
-
</div>
|
|
1430
|
-
<header data-pane="diagnostics">
|
|
1431
|
-
<!-- A status, so a change in how many problems there are is said
|
|
1432
|
-
without taking the person's place: "Problems 2". Named in
|
|
1433
|
-
words, never after its own heading, which the Studio sets in
|
|
1434
|
-
capitals that Chromium would put in the name. -->
|
|
1435
|
-
<div role="status" [attr.aria-label]="t()('pane.problems')">
|
|
1436
|
-
<span>{{ t()('pane.problems') }}</span>{{ count() > 0 ? ' ' : '' }}@if (count() > 0) {<span data-report-part="badge" [attr.data-severity]="severity()">{{ count() }}</span>}
|
|
1437
|
-
</div>
|
|
1438
|
-
</header>
|
|
1439
|
-
<div class="wb-body" data-pane="diagnostics">
|
|
1440
|
-
<div reportProblems></div>
|
|
1441
|
-
</div>
|
|
1442
|
-
</section>
|
|
1836
|
+
</section>
|
|
1837
|
+
}
|
|
1443
1838
|
<div class="wb-pane">
|
|
1444
1839
|
<p reportStatus></p>
|
|
1445
1840
|
</div>
|
|
1446
1841
|
`
|
|
1447
1842
|
}]
|
|
1448
|
-
}]
|
|
1843
|
+
}],
|
|
1844
|
+
propDecorators: { hostView: [{
|
|
1845
|
+
type: i0.ContentChild,
|
|
1846
|
+
args: [i0.forwardRef(() => ReportHostView), { isSignal: true }]
|
|
1847
|
+
}] }
|
|
1449
1848
|
});
|
|
1450
|
-
export { ReportBuilder, ReportCanvas, ReportEditorRoot, ReportOutline, ReportPalette, ReportPlaces, ReportProblems, ReportProperties, ReportStatus, ReportToolbar, injectEditorState };
|
|
1849
|
+
export { ReportBuilder, ReportCanvas, ReportEditorRoot, ReportHostView, ReportOutline, ReportPalette, ReportPlaces, ReportProblems, ReportProperties, ReportStatus, ReportToolbar, injectEditorState };
|
|
1451
1850
|
|
|
1452
1851
|
//# sourceMappingURL=formancy-report-builder-angular.mjs.map
|