@firestitch/block-editor 14.0.0 → 16.0.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.
Files changed (57) hide show
  1. package/app/components/artboard/artboard.component.d.ts +1 -1
  2. package/app/components/block/block.component.d.ts +1 -1
  3. package/app/components/block-editor/block-editor.component.d.ts +1 -1
  4. package/app/components/group/group-dialog.component.d.ts +1 -1
  5. package/app/components/layers-reorder-dialog/layers-reorder-dialog.component.d.ts +1 -1
  6. package/app/components/sidebar/sidebar.component.d.ts +1 -1
  7. package/app/directives/block-editor-margin.directive.d.ts +1 -1
  8. package/app/directives/block-editor-sidebar-panel.directive.d.ts +1 -1
  9. package/esm2022/app/components/artboard/artboard.component.mjs +98 -0
  10. package/esm2022/app/components/block/block.component.mjs +562 -0
  11. package/esm2022/app/components/block-editor/block-editor.component.mjs +91 -0
  12. package/esm2022/app/components/group/group-dialog.component.mjs +52 -0
  13. package/esm2022/app/components/layers-reorder-dialog/layers-reorder-dialog.component.mjs +45 -0
  14. package/esm2022/app/components/sidebar/sidebar.component.mjs +368 -0
  15. package/esm2022/app/directives/block-editor-margin.directive.mjs +20 -0
  16. package/esm2022/app/directives/block-editor-sidebar-panel.directive.mjs +23 -0
  17. package/{esm2020 → esm2022}/app/fs-block-editor.module.mjs +53 -53
  18. package/esm2022/app/pipes/create-image-url.pipe.mjs +20 -0
  19. package/esm2022/app/services/block-editor.service.mjs +294 -0
  20. package/esm2022/app/services/blocks-store.service.mjs +109 -0
  21. package/fesm2022/firestitch-block-editor.mjs +1752 -0
  22. package/fesm2022/firestitch-block-editor.mjs.map +1 -0
  23. package/package.json +5 -11
  24. package/esm2020/app/components/artboard/artboard.component.mjs +0 -87
  25. package/esm2020/app/components/block/block.component.mjs +0 -547
  26. package/esm2020/app/components/block-editor/block-editor.component.mjs +0 -82
  27. package/esm2020/app/components/group/group-dialog.component.mjs +0 -47
  28. package/esm2020/app/components/layers-reorder-dialog/layers-reorder-dialog.component.mjs +0 -42
  29. package/esm2020/app/components/sidebar/sidebar.component.mjs +0 -353
  30. package/esm2020/app/directives/block-editor-margin.directive.mjs +0 -19
  31. package/esm2020/app/directives/block-editor-sidebar-panel.directive.mjs +0 -21
  32. package/esm2020/app/pipes/create-image-url.pipe.mjs +0 -19
  33. package/esm2020/app/services/block-editor.service.mjs +0 -287
  34. package/esm2020/app/services/blocks-store.service.mjs +0 -111
  35. package/fesm2015/firestitch-block-editor.mjs +0 -1652
  36. package/fesm2015/firestitch-block-editor.mjs.map +0 -1
  37. package/fesm2020/firestitch-block-editor.mjs +0 -1685
  38. package/fesm2020/firestitch-block-editor.mjs.map +0 -1
  39. /package/{esm2020 → esm2022}/app/components/block/index.mjs +0 -0
  40. /package/{esm2020 → esm2022}/app/components/group/index.mjs +0 -0
  41. /package/{esm2020 → esm2022}/app/components/index.mjs +0 -0
  42. /package/{esm2020 → esm2022}/app/components/layers-reorder-dialog/index.mjs +0 -0
  43. /package/{esm2020 → esm2022}/app/components/sidebar/index.mjs +0 -0
  44. /package/{esm2020 → esm2022}/app/consts/block-formats.const.mjs +0 -0
  45. /package/{esm2020 → esm2022}/app/consts/block-types.const.mjs +0 -0
  46. /package/{esm2020 → esm2022}/app/consts/index.mjs +0 -0
  47. /package/{esm2020 → esm2022}/app/directives/index.mjs +0 -0
  48. /package/{esm2020 → esm2022}/app/enums/block-format.enum.mjs +0 -0
  49. /package/{esm2020 → esm2022}/app/enums/block-type.enum.mjs +0 -0
  50. /package/{esm2020 → esm2022}/app/enums/index.mjs +0 -0
  51. /package/{esm2020 → esm2022}/app/interfaces/block-editor-config.mjs +0 -0
  52. /package/{esm2020 → esm2022}/app/interfaces/block-group.mjs +0 -0
  53. /package/{esm2020 → esm2022}/app/interfaces/block.mjs +0 -0
  54. /package/{esm2020 → esm2022}/app/interfaces/index.mjs +0 -0
  55. /package/{esm2020 → esm2022}/app/services/index.mjs +0 -0
  56. /package/{esm2020 → esm2022}/firestitch-block-editor.mjs +0 -0
  57. /package/{esm2020 → esm2022}/public_api.mjs +0 -0
@@ -0,0 +1,1752 @@
1
+ import * as i6$1 from '@angular/common';
2
+ import { DOCUMENT, CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { Component, ChangeDetectionStrategy, Inject, Directive, Input, Injectable, Pipe, ViewChild, HostBinding, HostListener, EventEmitter, ContentChildren, Output, ViewChildren, ElementRef, NgModule } from '@angular/core';
5
+ import * as i2 from '@angular/forms';
6
+ import { FormsModule } from '@angular/forms';
7
+ import * as i3$1 from '@angular/cdk/drag-drop';
8
+ import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
9
+ import * as i3 from '@angular/material/button';
10
+ import { MatButtonModule } from '@angular/material/button';
11
+ import * as i13 from '@angular/material/checkbox';
12
+ import { MatCheckboxModule } from '@angular/material/checkbox';
13
+ import * as i11 from '@angular/material/form-field';
14
+ import { MatFormFieldModule } from '@angular/material/form-field';
15
+ import * as i4$1 from '@angular/material/icon';
16
+ import { MatIconModule } from '@angular/material/icon';
17
+ import * as i4 from '@angular/material/input';
18
+ import { MatInputModule } from '@angular/material/input';
19
+ import * as i6$2 from '@angular/material/list';
20
+ import { MatListModule } from '@angular/material/list';
21
+ import * as i15 from '@angular/material/select';
22
+ import { MatSelectModule } from '@angular/material/select';
23
+ import * as i14 from '@angular/material/tooltip';
24
+ import { MatTooltipModule } from '@angular/material/tooltip';
25
+ import { FsAutocompleteModule } from '@firestitch/autocomplete';
26
+ import * as i18 from '@firestitch/colorpicker';
27
+ import { FsColorPickerModule } from '@firestitch/colorpicker';
28
+ import * as i2$1 from '@firestitch/dialog';
29
+ import { FsDialogModule } from '@firestitch/dialog';
30
+ import * as i17 from '@firestitch/file';
31
+ import { FsFileModule } from '@firestitch/file';
32
+ import * as i2$2 from '@firestitch/font-picker';
33
+ import { FsFontPickerModule } from '@firestitch/font-picker';
34
+ import * as i7 from '@firestitch/form';
35
+ import { FsFormModule } from '@firestitch/form';
36
+ import * as i20 from '@firestitch/mask';
37
+ import { FsMaskModule } from '@firestitch/mask';
38
+ import { FsMenuModule } from '@firestitch/menu';
39
+ import * as i2$4 from '@firestitch/zoom-pan';
40
+ import { FsZoomPanComponent, FsZoomPanModule } from '@firestitch/zoom-pan';
41
+ import * as i1 from '@angular/material/dialog';
42
+ import { MAT_DIALOG_DATA } from '@angular/material/dialog';
43
+ import { guid, index, round } from '@firestitch/common';
44
+ import { of, Subject, BehaviorSubject, throwError, from, fromEvent } from 'rxjs';
45
+ import * as i6 from '@angular/cdk/text-field';
46
+ import { filter, map, takeUntil, switchMap, tap, mapTo, groupBy, debounceTime, mergeAll, skip, delay } from 'rxjs/operators';
47
+ import * as i3$2 from '@firestitch/prompt';
48
+ import * as i7$1 from '@angular/material/divider';
49
+ import Moveable from 'moveable';
50
+ import * as i1$1 from '@firestitch/api';
51
+ import * as i2$3 from '@firestitch/clipboard';
52
+ import * as i3$3 from '@firestitch/message';
53
+ import * as i16 from '@angular/material/core';
54
+
55
+ class GroupDialogComponent {
56
+ _data;
57
+ _dialogRef;
58
+ block;
59
+ blockGroup;
60
+ _blockEditor;
61
+ constructor(_data, _dialogRef) {
62
+ this._data = _data;
63
+ this._dialogRef = _dialogRef;
64
+ }
65
+ ngOnInit() {
66
+ this._blockEditor = this._data.blockEditor;
67
+ this.blockGroup = this._data.blockGroup || {};
68
+ this.block = this._data.block;
69
+ }
70
+ save = () => {
71
+ if (this.blockGroup.name) {
72
+ }
73
+ else {
74
+ this.blockGroup = {
75
+ ...this.blockGroup,
76
+ name: guid(),
77
+ };
78
+ this._blockEditor.blockGroups.push(this.blockGroup);
79
+ }
80
+ this._dialogRef.close(this.blockGroup);
81
+ return of(true);
82
+ };
83
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
84
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GroupDialogComponent, selector: "ng-component", ngImport: i0, template: "<form fsForm [submit]=\"save\">\n <fs-dialog>\n <h1 mat-dialog-title>Group</h1>\n <mat-dialog-content>\n <mat-form-field class=\"full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [(ngModel)]=\"blockGroup.label\"\n name=\"groupLabel\"\n [required]=\"true\"\n placeholder=\"Group Label\">\n </textarea>\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [(ngModel)]=\"blockGroup.description\"\n name=\"groupDescription\">\n </textarea>\n </mat-form-field> \n </mat-dialog-content>\n <mat-dialog-actions>\n <button \n mat-button \n type=\"submit\"\n color=\"primary\">\n Save\n </button>\n <button \n mat-button \n type=\"button\"\n mat-dialog-close>\n Cancel\n </button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i11.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i11.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "directive", type: i7.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { kind: "directive", type: i7.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { kind: "directive", type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormGreaterEqual]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { kind: "directive", type: i7.FsButtonDirective, selector: "[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])", inputs: ["name", "dirtySubmit", "form"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i2$1.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout", "dock", "dockable", "fullscreenPercent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
85
+ }
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupDialogComponent, decorators: [{
87
+ type: Component,
88
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<form fsForm [submit]=\"save\">\n <fs-dialog>\n <h1 mat-dialog-title>Group</h1>\n <mat-dialog-content>\n <mat-form-field class=\"full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [(ngModel)]=\"blockGroup.label\"\n name=\"groupLabel\"\n [required]=\"true\"\n placeholder=\"Group Label\">\n </textarea>\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [(ngModel)]=\"blockGroup.description\"\n name=\"groupDescription\">\n </textarea>\n </mat-form-field> \n </mat-dialog-content>\n <mat-dialog-actions>\n <button \n mat-button \n type=\"submit\"\n color=\"primary\">\n Save\n </button>\n <button \n mat-button \n type=\"button\"\n mat-dialog-close>\n Cancel\n </button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>" }]
89
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
90
+ type: Inject,
91
+ args: [MAT_DIALOG_DATA]
92
+ }] }, { type: i1.MatDialogRef }]; } });
93
+
94
+ class FsBlockEditorMarginDirective {
95
+ _elementRef;
96
+ constructor(_elementRef) {
97
+ this._elementRef = _elementRef;
98
+ }
99
+ get element() {
100
+ return this._elementRef.nativeElement;
101
+ }
102
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorMarginDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
103
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0 });
104
+ }
105
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorMarginDirective, decorators: [{
106
+ type: Directive,
107
+ args: [{
108
+ selector: '[fsBlockEditorMargin]'
109
+ }]
110
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
111
+
112
+ class FsBlockEditorSidebarPanelDirective {
113
+ templateRef;
114
+ label;
115
+ show = true;
116
+ constructor(templateRef) {
117
+ this.templateRef = templateRef;
118
+ }
119
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
120
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0 });
121
+ }
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, decorators: [{
123
+ type: Directive,
124
+ args: [{
125
+ selector: '[fsBlockEditorSidebarPanel]',
126
+ }]
127
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { label: [{
128
+ type: Input
129
+ }], show: [{
130
+ type: Input
131
+ }] } });
132
+
133
+ var BlockType;
134
+ (function (BlockType) {
135
+ BlockType["Rectangle"] = "rectangle";
136
+ BlockType["ShortText"] = "shorttext";
137
+ BlockType["LongText"] = "longtext";
138
+ BlockType["Image"] = "image";
139
+ BlockType["RadioButton"] = "radiobutton";
140
+ BlockType["Checkbox"] = "checkbox";
141
+ BlockType["Signature"] = "signature";
142
+ BlockType["Pdf"] = "pdf";
143
+ BlockType["Date"] = "date";
144
+ })(BlockType || (BlockType = {}));
145
+
146
+ var BlockFormat;
147
+ (function (BlockFormat) {
148
+ BlockFormat["Date"] = "date";
149
+ BlockFormat["YYYYMMDD"] = "YYYY/MM/DD";
150
+ BlockFormat["Currency"] = "currency";
151
+ BlockFormat["Number"] = "number";
152
+ })(BlockFormat || (BlockFormat = {}));
153
+
154
+ const BlockTypes = [
155
+ { value: BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4', type: 'draw' },
156
+ { value: BlockType.ShortText, name: 'Short Text', icon: 'short_text', type: 'form' },
157
+ { value: BlockType.LongText, name: 'Long Text', icon: 'subject', type: 'form' },
158
+ { value: BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked', type: 'form' },
159
+ { value: BlockType.Checkbox, name: 'Checkbox', icon: 'check_box', type: 'form' },
160
+ { value: BlockType.Date, name: 'Date', icon: 'calendar_today', type: 'form' },
161
+ { value: BlockType.Signature, name: 'Signature', icon: 'draw', type: 'form' },
162
+ { value: BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*', type: 'draw' },
163
+ { value: BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf', type: 'draw' },
164
+ ];
165
+
166
+ class LayersReorderDialogComponent {
167
+ _dialogData;
168
+ _dialogRef;
169
+ blocks;
170
+ blockTypeIcons = index(BlockTypes, 'value', 'icon');
171
+ constructor(_dialogData, _dialogRef) {
172
+ this._dialogData = _dialogData;
173
+ this._dialogRef = _dialogRef;
174
+ this._init(_dialogData);
175
+ }
176
+ swapItems(event) {
177
+ moveItemInArray(this.blocks, event.previousIndex, event.currentIndex);
178
+ }
179
+ done() {
180
+ this._dialogRef.close(this.blocks.reverse());
181
+ }
182
+ _init(data) {
183
+ this.blocks = data.blocks;
184
+ }
185
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LayersReorderDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
186
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LayersReorderDialogComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder Blocks</h1>\n <mat-dialog-content>\n <mat-list cdkDropList (cdkDropListDropped)=\"swapItems($event)\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let block of blocks\">\n <mat-list-item cdkDrag cdkDragLockAxis=\"y\">\n <mat-icon cdkDragHandle>drag_handle</mat-icon>\n <mat-icon>\n {{ blockTypeIcons[block.type] }}\n </mat-icon>\n <span class=\"block-label\">\n {{ block.label || block.content || 'No Content'}} \n </span>\n </mat-list-item>\n <mat-divider></mat-divider>\n </ng-container>\n </mat-list>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button color=\"primary\" (click)=\"done()\">Done</button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: ["h1{display:flex}.mat-icon{margin-right:20px}.block-label{min-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:1000px}.cdk-drag-preview{display:flex;padding-left:15px!important;background:#fff;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-preview ::ng-deep .mat-list-item-content{display:flex;flex-direction:row;align-items:center;font-size:16px}.cdk-drag-handle{cursor:grab}.cdk-drag-placeholder{opacity:.2}\n"], dependencies: [{ kind: "directive", type: i6$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i3$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i3$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6$2.MatList, selector: "mat-list", exportAs: ["matList"] }, { kind: "component", type: i6$2.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "component", type: i7$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i7.FsButtonDirective, selector: "[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])", inputs: ["name", "dirtySubmit", "form"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i2$1.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout", "dock", "dockable", "fullscreenPercent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
187
+ }
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LayersReorderDialogComponent, decorators: [{
189
+ type: Component,
190
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder Blocks</h1>\n <mat-dialog-content>\n <mat-list cdkDropList (cdkDropListDropped)=\"swapItems($event)\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let block of blocks\">\n <mat-list-item cdkDrag cdkDragLockAxis=\"y\">\n <mat-icon cdkDragHandle>drag_handle</mat-icon>\n <mat-icon>\n {{ blockTypeIcons[block.type] }}\n </mat-icon>\n <span class=\"block-label\">\n {{ block.label || block.content || 'No Content'}} \n </span>\n </mat-list-item>\n <mat-divider></mat-divider>\n </ng-container>\n </mat-list>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button color=\"primary\" (click)=\"done()\">Done</button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: ["h1{display:flex}.mat-icon{margin-right:20px}.block-label{min-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:1000px}.cdk-drag-preview{display:flex;padding-left:15px!important;background:#fff;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-preview ::ng-deep .mat-list-item-content{display:flex;flex-direction:row;align-items:center;font-size:16px}.cdk-drag-handle{cursor:grab}.cdk-drag-placeholder{opacity:.2}\n"] }]
191
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
192
+ type: Inject,
193
+ args: [MAT_DIALOG_DATA]
194
+ }] }, { type: i1.MatDialogRef }]; } });
195
+
196
+ var EventType;
197
+ (function (EventType) {
198
+ EventType["Add"] = "add";
199
+ EventType["Change"] = "change";
200
+ EventType["Remove"] = "remove";
201
+ EventType["Update"] = "update";
202
+ })(EventType || (EventType = {}));
203
+ class BlocksStore {
204
+ _eventBus$ = new Subject();
205
+ _blocks$ = new BehaviorSubject([]);
206
+ _destroy$ = new Subject();
207
+ get blocks() {
208
+ return [
209
+ ...this._blocks$.getValue(),
210
+ ];
211
+ }
212
+ get blocks$() {
213
+ return this._blocks$.asObservable();
214
+ }
215
+ get blockAdded$() {
216
+ return this._eventBus$
217
+ .pipe(filter(({ type }) => type === EventType.Add), map(({ value }) => value));
218
+ }
219
+ get blockChanged$() {
220
+ return this._eventBus$
221
+ .pipe(filter(({ type }) => type === EventType.Change), map(({ value }) => value));
222
+ }
223
+ get blockUpdated$() {
224
+ return this._eventBus$
225
+ .pipe(filter(({ type }) => type === EventType.Update), map(({ value }) => value));
226
+ }
227
+ get blockRemoved$() {
228
+ return this._eventBus$
229
+ .pipe(filter(({ type }) => type === EventType.Remove), map(({ value }) => value));
230
+ }
231
+ ngOnDestroy() {
232
+ this._destroy$.next();
233
+ this._destroy$.complete();
234
+ }
235
+ init(blocks) {
236
+ blocks
237
+ .forEach((block) => {
238
+ this._appendBlock(block);
239
+ });
240
+ }
241
+ blockExists(block) {
242
+ const index = this.blocks.findIndex((b) => {
243
+ return b.guid === block.guid;
244
+ });
245
+ return index !== -1;
246
+ }
247
+ blockAdd(block) {
248
+ this._appendBlock(block);
249
+ }
250
+ blockChange(block) {
251
+ this._dispatchEvent(EventType.Change, block);
252
+ }
253
+ blockUpdate(block) {
254
+ this._dispatchEvent(EventType.Update, block);
255
+ }
256
+ blockRemove(targetBlocks) {
257
+ const blocks = this.blocks;
258
+ if (!Array.isArray(targetBlocks)) {
259
+ targetBlocks = [targetBlocks];
260
+ }
261
+ targetBlocks.forEach((block) => {
262
+ const index = blocks
263
+ .findIndex((b) => b.guid === block.guid);
264
+ if (index !== -1) {
265
+ blocks.splice(index, 1);
266
+ this._dispatchEvent(EventType.Remove, block);
267
+ }
268
+ });
269
+ this._setBlocks(blocks);
270
+ }
271
+ _setBlocks(blocks) {
272
+ this._blocks$.next([...blocks]);
273
+ }
274
+ _appendBlock(block) {
275
+ const blocks = [
276
+ ...this.blocks,
277
+ block,
278
+ ];
279
+ this._deduplicateIndexesFor(blocks);
280
+ this._setBlocks(blocks);
281
+ this._dispatchEvent(EventType.Add, block);
282
+ }
283
+ _dispatchEvent(type, value) {
284
+ this._eventBus$.next({
285
+ type,
286
+ value,
287
+ });
288
+ }
289
+ _deduplicateIndexesFor(blocks) {
290
+ blocks.forEach((block, index) => {
291
+ block.index = index;
292
+ });
293
+ }
294
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BlocksStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
295
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BlocksStore });
296
+ }
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BlocksStore, decorators: [{
298
+ type: Injectable
299
+ }] });
300
+
301
+ class BlockEditorService {
302
+ _store;
303
+ _dialog;
304
+ _prompt;
305
+ container;
306
+ margin;
307
+ config;
308
+ blockGroups = [];
309
+ _selectedBlocks$ = new BehaviorSubject([]);
310
+ _blockComponents$ = new BehaviorSubject([]);
311
+ _blockClippable$ = new BehaviorSubject(null);
312
+ _destroy$ = new Subject();
313
+ _selectionRange;
314
+ constructor(_store, _dialog, _prompt) {
315
+ this._store = _store;
316
+ this._dialog = _dialog;
317
+ this._prompt = _prompt;
318
+ }
319
+ get blockComponents$() {
320
+ return this._blockComponents$.asObservable();
321
+ }
322
+ set blockComponents(blockComponents) {
323
+ this._blockComponents$.next(blockComponents);
324
+ }
325
+ init(config) {
326
+ this.config = config;
327
+ this._store.init(config.blocks);
328
+ this._initBlockGroups();
329
+ this._initBlockChange();
330
+ }
331
+ blockAdd(block) {
332
+ if (!this.config.blockAdd) {
333
+ console.warn('[BlockEditor] Config "blockAdd" is not defined');
334
+ return;
335
+ }
336
+ block = this._initBlock(block);
337
+ this.config.blockAdd(block)
338
+ .pipe(takeUntil(this._destroy$))
339
+ .subscribe((newBlock) => {
340
+ this._store.blockAdd(newBlock);
341
+ });
342
+ }
343
+ blockUpload(block, fsFile) {
344
+ if (!this.config.blockUpload) {
345
+ return throwError('[BlockEditor] Config "blockUpload" is not defined');
346
+ }
347
+ const existing = this._store.blockExists(block);
348
+ if (!existing) {
349
+ block = this._initBlock(block);
350
+ }
351
+ return from(fsFile.imageInfo)
352
+ .pipe(switchMap((imageInfo) => {
353
+ if (!existing && imageInfo?.height && imageInfo?.width) {
354
+ const ratio = imageInfo.height / imageInfo.width;
355
+ block.width = this.config.width * .4;
356
+ block.height = block.width * ratio;
357
+ }
358
+ return this.config.blockUpload(block, fsFile.file);
359
+ }), tap((newBlock) => {
360
+ if (existing) {
361
+ this._store.blockUpdate({
362
+ ...block,
363
+ ...newBlock,
364
+ });
365
+ }
366
+ else {
367
+ this.blockAdd(newBlock);
368
+ }
369
+ }), takeUntil(this._destroy$));
370
+ }
371
+ blockRemove(block) {
372
+ this._store.blockRemove(block);
373
+ }
374
+ get blocks$() {
375
+ return this._store.blocks$;
376
+ }
377
+ get blockChanged$() {
378
+ return this._store.blockChanged$;
379
+ }
380
+ get blockUpdated$() {
381
+ return this._store.blockUpdated$;
382
+ }
383
+ get blockClippable$() {
384
+ return this._blockClippable$.asObservable();
385
+ }
386
+ set blockClippable(value) {
387
+ this._blockClippable$.next(value);
388
+ }
389
+ get blockAdded$() {
390
+ return this._store.blockAdded$;
391
+ }
392
+ get blockRemoved$() {
393
+ return this._store.blockRemoved$;
394
+ }
395
+ get blocks() {
396
+ return this._store.blocks;
397
+ }
398
+ blockChange(block) {
399
+ this._store.blockChange(block);
400
+ }
401
+ applyBlockGroup(block, blockGroup) {
402
+ block.name = blockGroup?.name;
403
+ block.description = blockGroup?.description;
404
+ block.label = blockGroup?.label;
405
+ this.blockChange(block);
406
+ }
407
+ isSelectedBlock(block) {
408
+ return this.selectedBlocks.indexOf(block) !== -1;
409
+ }
410
+ indexOf(block) {
411
+ return this.blocks.map((e) => e.guid).indexOf(block.guid);
412
+ }
413
+ selectedBlockComponentChangeProperty(values) {
414
+ this.selectedBlocks
415
+ .forEach((block) => {
416
+ Object.keys(values)
417
+ .forEach((name) => {
418
+ block[name] = values[name];
419
+ });
420
+ this.blockChange(block);
421
+ });
422
+ }
423
+ blockGroupChangeProperty(blockGroup, values) {
424
+ this.blocks
425
+ .filter((block) => block.name === blockGroup.name)
426
+ .forEach((block) => {
427
+ Object.keys(values)
428
+ .forEach((name) => {
429
+ block[name] = values[name];
430
+ });
431
+ this.blockChange(block);
432
+ });
433
+ }
434
+ get selectedBlocks$() {
435
+ return this._selectedBlocks$;
436
+ }
437
+ set selectedBlock(block) {
438
+ this.selectedBlocks = [block];
439
+ }
440
+ set selectedBlocks(blocks) {
441
+ this._selectedBlocks$.next(blocks);
442
+ if (this.config.blocksSelect) {
443
+ this.config.blocksSelect(blocks);
444
+ }
445
+ }
446
+ get selectedBlocks() {
447
+ return this._selectedBlocks$.getValue();
448
+ }
449
+ saveSelection() {
450
+ const selection = window.getSelection();
451
+ this._selectionRange = selection.getRangeAt(0);
452
+ }
453
+ restoreSelection() {
454
+ if (this._selectionRange) {
455
+ const selection = window.getSelection();
456
+ selection.removeAllRanges();
457
+ selection.addRange(this._selectionRange);
458
+ }
459
+ }
460
+ hasSelectionRange() {
461
+ return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
462
+ }
463
+ registerContainer(container) {
464
+ this.container = container;
465
+ }
466
+ registerMargin(margin) {
467
+ this.margin = margin;
468
+ }
469
+ removeBlocks(blocks) {
470
+ this._prompt.confirm({
471
+ title: 'Confirm',
472
+ template: 'Are you sure your would like to delete this block?',
473
+ })
474
+ .pipe(switchMap(() => this.config.blocksRemove ? this.config.blocksRemove(blocks) : throwError('config.blocksRemove is not configured')), takeUntil(this._destroy$))
475
+ .subscribe(() => {
476
+ blocks.forEach((block) => {
477
+ this.blockRemove(block);
478
+ });
479
+ this.selectedBlocks = [];
480
+ });
481
+ }
482
+ openReorderDialog() {
483
+ const blocks = this.blocks
484
+ .sort((blockA, blockB) => (blockA.index - blockB.index))
485
+ .reverse();
486
+ this._dialog
487
+ .open(LayersReorderDialogComponent, {
488
+ data: {
489
+ blocks,
490
+ },
491
+ })
492
+ .afterClosed()
493
+ .pipe(filter((b) => !!b), switchMap((b) => this.config.blocksReorder(b)
494
+ .pipe(mapTo(blocks))), takeUntil(this._destroy$))
495
+ .subscribe((b) => {
496
+ b
497
+ .forEach((block, index) => {
498
+ block.index = index;
499
+ });
500
+ });
501
+ }
502
+ ngOnDestroy() {
503
+ this._destroy$.next();
504
+ this._destroy$.complete();
505
+ }
506
+ _initBlockGroups() {
507
+ this.blockGroups = Object.values(this._store.blocks
508
+ .reduce((accum, block) => {
509
+ if (block.name) {
510
+ const existing = accum[block.name] || {};
511
+ accum[block.name] = {
512
+ label: block.label || existing.label,
513
+ description: block.description || existing.description,
514
+ name: block.name,
515
+ };
516
+ }
517
+ return accum;
518
+ }, {}));
519
+ }
520
+ _initBlockChange() {
521
+ if (this.config.blockChange) {
522
+ this.blockChanged$
523
+ .pipe(groupBy((block) => (block.guid)), map((group) => group.pipe(debounceTime(250))), mergeAll())
524
+ .subscribe((block) => {
525
+ this.config.blockChange(block);
526
+ });
527
+ }
528
+ }
529
+ _initBlock(block) {
530
+ let newBlock = {
531
+ ...block,
532
+ shapeBottomLeft: block.shapeBottomLeft ?? 'round',
533
+ shapeTopLeft: block.shapeTopLeft ?? 'round',
534
+ shapeTopRight: block.shapeTopRight ?? 'round',
535
+ shapeBottomRight: block.shapeBottomRight ?? 'round',
536
+ verticalAlign: block.verticalAlign ?? 'top',
537
+ horizontalAlign: block.horizontalAlign ?? 'left',
538
+ index: block.guid ? block.index : this._store.blocks.length,
539
+ guid: block.guid || guid('xxxxxxxxxxxx'),
540
+ keepRatio: block.keepRatio ?? [
541
+ BlockType.Checkbox,
542
+ BlockType.RadioButton,
543
+ BlockType.Pdf,
544
+ ]
545
+ .indexOf(block.type) !== -1,
546
+ };
547
+ let width = (this.config.width * .333).toFixed(2);
548
+ let height = width / 2;
549
+ if (newBlock.type === BlockType.Rectangle) {
550
+ newBlock = {
551
+ ...newBlock,
552
+ borderColor: newBlock.borderColor ?? '#cccccc',
553
+ borderWidth: newBlock.borderWidth ?? 1,
554
+ };
555
+ }
556
+ else if (newBlock.type === BlockType.Checkbox || newBlock.type === BlockType.RadioButton) {
557
+ width = .25;
558
+ height = .25;
559
+ }
560
+ else {
561
+ width = 2;
562
+ height = .5;
563
+ }
564
+ //get max tabindex
565
+ // newBlock.tabIndex = this._lastTabIndex + 1;
566
+ // this.updateTabIndex(newBlock.tabIndex);
567
+ return {
568
+ top: height,
569
+ left: width,
570
+ width,
571
+ height,
572
+ ...newBlock,
573
+ };
574
+ }
575
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BlockEditorService, deps: [{ token: BlocksStore }, { token: i2$1.FsDialog }, { token: i3$2.FsPrompt }], target: i0.ɵɵFactoryTarget.Injectable });
576
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BlockEditorService });
577
+ }
578
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BlockEditorService, decorators: [{
579
+ type: Injectable
580
+ }], ctorParameters: function () { return [{ type: BlocksStore }, { type: i2$1.FsDialog }, { type: i3$2.FsPrompt }]; } });
581
+
582
+ const BlockFormats = [
583
+ { value: BlockFormat.Number, name: 'Number', blockTypes: [BlockType.ShortText, BlockType.LongText] },
584
+ { value: BlockFormat.Currency, name: 'Currency', blockTypes: [BlockType.ShortText, BlockType.LongText] },
585
+ { value: BlockFormat.Date, name: 'Date', blockTypes: [BlockType.Date] },
586
+ { value: BlockFormat.YYYYMMDD, name: 'YYYY/MM/DD', blockTypes: [BlockType.Date] },
587
+ ];
588
+
589
+ class CreateImageUrlPipe {
590
+ _api;
591
+ constructor(_api) {
592
+ this._api = _api;
593
+ }
594
+ transform(url) {
595
+ return this._api.createApiFile(url).safeDataUrl;
596
+ }
597
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateImageUrlPipe, deps: [{ token: i1$1.FsApi }], target: i0.ɵɵFactoryTarget.Pipe });
598
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: CreateImageUrlPipe, name: "createImageUrl" });
599
+ }
600
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateImageUrlPipe, decorators: [{
601
+ type: Pipe,
602
+ args: [{ name: 'createImageUrl' }]
603
+ }], ctorParameters: function () { return [{ type: i1$1.FsApi }]; } });
604
+
605
+ class FsBlockComponent {
606
+ _blockEditor;
607
+ _elementRef;
608
+ _cdRef;
609
+ _fontPickerService;
610
+ element;
611
+ contentElement;
612
+ contentEditable;
613
+ set block(block) {
614
+ this._block = block;
615
+ this._block.resizable = !this.hasType([BlockType.Checkbox, BlockType.RadioButton]);
616
+ this._block.rotatable = !this.hasType([BlockType.Checkbox, BlockType.RadioButton]);
617
+ this._block.scalable = !this.hasType([BlockType.Checkbox, BlockType.RadioButton]);
618
+ if (this.moveable) {
619
+ this._updateMoveable();
620
+ }
621
+ this.typeForm = BlockTypes
622
+ .some((blockType) => {
623
+ return blockType.type === 'form' && blockType.value === this.block.type;
624
+ });
625
+ }
626
+ get block() {
627
+ return this._block;
628
+ }
629
+ html;
630
+ zoompan;
631
+ transformating = false;
632
+ unit;
633
+ content;
634
+ selected;
635
+ BlockType = BlockType;
636
+ typeForm;
637
+ _moveable;
638
+ _block;
639
+ _editable = false;
640
+ _transformable = false;
641
+ _destroy$ = new Subject();
642
+ constructor(_blockEditor, _elementRef, _cdRef, _fontPickerService) {
643
+ this._blockEditor = _blockEditor;
644
+ this._elementRef = _elementRef;
645
+ this._cdRef = _cdRef;
646
+ this._fontPickerService = _fontPickerService;
647
+ }
648
+ keydown(event) {
649
+ if (this.selected) {
650
+ if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].indexOf(event.key) !== -1) {
651
+ this._move(event);
652
+ }
653
+ if (['Delete', 'Backspace'].indexOf(event.key) !== -1) {
654
+ this._delete(event);
655
+ }
656
+ }
657
+ }
658
+ get el() {
659
+ return this.element.nativeElement;
660
+ }
661
+ get moveable() {
662
+ return this._moveable;
663
+ }
664
+ hasType(types) {
665
+ return types.includes(this.block.type);
666
+ }
667
+ get editable() {
668
+ return this._editable;
669
+ }
670
+ set editable(value) {
671
+ this._editable = value;
672
+ if (!value) {
673
+ this.deselectContent();
674
+ }
675
+ }
676
+ get styleTop() {
677
+ const top = this.block.top;
678
+ return `${top}${this.unit}`;
679
+ }
680
+ get styleLeft() {
681
+ const left = this.block.left;
682
+ return `${left}${this.unit}`;
683
+ }
684
+ get styleWidth() {
685
+ let width = this.block.width;
686
+ if (this.block.clipPath) {
687
+ width -= (this.block.width * this.block.clipPath.values[1] / 100) +
688
+ (this.block.width * this.block.clipPath.values[3] / 100);
689
+ }
690
+ return `${width}${this.unit}`;
691
+ }
692
+ get styleHeight() {
693
+ let height = this.block.height;
694
+ if (this.block.clipPath) {
695
+ height -= (this.block.height * this.block.clipPath.values[0] / 100) +
696
+ (this.block.height * this.block.clipPath.values[2] / 100);
697
+ }
698
+ return `${height}${this.unit}`;
699
+ }
700
+ get styleImageHeight() {
701
+ const height = this.block.height;
702
+ if (this.block.clipPath) {
703
+ const values = this.block.clipPath.values || {};
704
+ }
705
+ return `${height}${this.unit}`;
706
+ }
707
+ get styleImageWidth() {
708
+ const width = this.block.width;
709
+ if (this.block.clipPath) {
710
+ const values = this.block.clipPath.values || {};
711
+ }
712
+ return `${width}${this.unit}`;
713
+ }
714
+ get styleImageTop() {
715
+ let top = 0;
716
+ if (this.block.clipPath) {
717
+ const values = this.block.clipPath.values || {};
718
+ top = (values[0] / 100) * this.block.width * -1;
719
+ }
720
+ return `${top}${this.unit}`;
721
+ }
722
+ get styleImageLeft() {
723
+ let left = 0;
724
+ if (this.block.clipPath) {
725
+ const values = this.block.clipPath.values || {};
726
+ left = (values[3] / 100) * this.block.width * -1;
727
+ }
728
+ return `${left}${this.unit}`;
729
+ }
730
+ get styleClipPath() {
731
+ if (!this.block.clipPath) {
732
+ return null;
733
+ }
734
+ const values = this.block.clipPath.values || {};
735
+ const top = values[0] / 100 * this.block.height;
736
+ const right = (values[1]) / 100 * this.block.width;
737
+ const bottom = (values[2]) / 100 * this.block.height;
738
+ const left = values[3] / 100 * this.block.width;
739
+ const clipPath = `inset(${top}${this.unit} ${right}${this.unit} ${bottom}${this.unit} ${left}${this.unit})`;
740
+ return clipPath;
741
+ }
742
+ get styleBoxShadow() {
743
+ if (!this.block.shadowColor) {
744
+ return null;
745
+ }
746
+ const shadow = `${this.block.shadowX}pt ${(this.block.shadowY || 0)}pt ${(this.block.shadowBlur || 0)}pt ${(this.block.shadowSpread || 0)}pt ${this.block.shadowColor}`;
747
+ return shadow;
748
+ }
749
+ set elementGuidelines(value) {
750
+ this.moveable.elementGuidelines = value;
751
+ }
752
+ get clippable() {
753
+ return !!this.moveable.clippable;
754
+ }
755
+ set clippable(value) {
756
+ this.moveable.clippable = value;
757
+ if (this.selected) {
758
+ this.moveable.resizable = !value;
759
+ this.moveable.rotatable = !value;
760
+ this.moveable.scalable = !value;
761
+ }
762
+ }
763
+ get transformable() {
764
+ return this._transformable;
765
+ }
766
+ set transformable(value) {
767
+ this._transformable = value;
768
+ this._updateMoveable();
769
+ }
770
+ set rotate(value) {
771
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
772
+ this.moveable.updateRect();
773
+ }
774
+ set index(value) {
775
+ this.block.index = value;
776
+ }
777
+ set keepRatio(value) {
778
+ this.moveable.keepRatio = value;
779
+ }
780
+ markForCheck() {
781
+ this._cdRef.markForCheck();
782
+ }
783
+ ngOnInit() {
784
+ this.unit = this._blockEditor.config.unit;
785
+ this.content = this.block.content;
786
+ this.block.shadowOpacity = this.block.shadowOpacity || 100;
787
+ this._blockEditor.selectedBlocks$
788
+ .pipe(skip(1), takeUntil(this._destroy$))
789
+ .subscribe((blocks) => {
790
+ if (document.activeElement instanceof HTMLElement) {
791
+ document.activeElement.blur();
792
+ }
793
+ this.selected = blocks
794
+ .some((block) => block.guid === this.block.guid);
795
+ this.transformable = true;
796
+ this._cdRef.markForCheck();
797
+ });
798
+ this._blockEditor.blockClippable$
799
+ .pipe(filter(() => this.selected), takeUntil(this._destroy$))
800
+ .subscribe((clippable) => {
801
+ this.clippable = clippable;
802
+ this._cdRef.markForCheck();
803
+ });
804
+ this._blockEditor.blockAdded$
805
+ .pipe(takeUntil(this._destroy$))
806
+ .subscribe(() => {
807
+ this._cdRef.markForCheck();
808
+ });
809
+ this._blockEditor.blockUpdated$
810
+ .pipe(filter((block) => block.guid === this.block.guid), takeUntil(this._destroy$))
811
+ .subscribe((block) => {
812
+ this.block = block;
813
+ this._cdRef.markForCheck();
814
+ });
815
+ this._blockEditor.blockChanged$
816
+ .pipe(filter((block) => block.guid === this.block.guid), takeUntil(this._destroy$))
817
+ .subscribe((block) => {
818
+ this.block = block;
819
+ this._cdRef.markForCheck();
820
+ });
821
+ }
822
+ ngAfterViewInit() {
823
+ setTimeout(() => {
824
+ this._initEvents();
825
+ this._initFont();
826
+ this._initMoveable();
827
+ this._setTransform();
828
+ this._initElementGuidelines();
829
+ this.rotate = this.block.rotate;
830
+ });
831
+ }
832
+ pxToIn(px) {
833
+ return this.round(px / 96, 2);
834
+ }
835
+ round(value, decimals) {
836
+ return parseFloat(value.toFixed(decimals));
837
+ }
838
+ deselect() {
839
+ this.editable = false;
840
+ this.clippable = false;
841
+ this.transformable = false;
842
+ this.disableContentEdit();
843
+ }
844
+ disableContentEdit() {
845
+ this.editable = false;
846
+ }
847
+ deselectContent() {
848
+ if (window.getSelection) {
849
+ if (window.getSelection().empty) {
850
+ window.getSelection().empty();
851
+ }
852
+ else if (window.getSelection().removeAllRanges) {
853
+ window.getSelection().removeAllRanges();
854
+ }
855
+ }
856
+ }
857
+ selectTextAll() {
858
+ const range = document.createRange();
859
+ range.selectNodeContents(this.contentEditable.nativeElement);
860
+ const sel = window.getSelection();
861
+ sel.removeAllRanges();
862
+ sel.addRange(range);
863
+ }
864
+ ngOnDestroy() {
865
+ //this._blockEditor.destroyBlock(this.block);
866
+ this._destroy$.next();
867
+ this._destroy$.complete();
868
+ }
869
+ _setTransform(transforms = []) {
870
+ transforms = transforms ?? [];
871
+ this.el.style.transform = transforms.join(' ');
872
+ }
873
+ _triggerChanged() {
874
+ this._blockEditor.blockChange(this.block);
875
+ }
876
+ _updateMoveable() {
877
+ const value = !this.block.lock && this.selected;
878
+ this.keepRatio = this.block.keepRatio;
879
+ this.rotate = this.block.rotate;
880
+ this.moveable.resizable = this.block.resizable && value;
881
+ this.moveable.rotatable = this.block.rotatable && value;
882
+ this.moveable.scalable = this.block.scalable && value;
883
+ }
884
+ _initElementGuidelines() {
885
+ this._blockEditor.blockComponents$
886
+ .pipe(takeUntil(this._destroy$))
887
+ .subscribe((blockComponents) => {
888
+ this.moveable.elementGuidelines = blockComponents
889
+ .filter((blockComponent) => this !== blockComponent)
890
+ .map((blockComponent) => blockComponent.el);
891
+ });
892
+ }
893
+ _initMoveable() {
894
+ this._moveable = new Moveable(this._elementRef.nativeElement, {
895
+ target: this.el,
896
+ container: this._blockEditor.container,
897
+ draggable: true,
898
+ resizable: false,
899
+ scalable: false,
900
+ rotatable: false,
901
+ warpable: false,
902
+ origin: false,
903
+ clipRelative: true,
904
+ clipArea: true,
905
+ keepRatio: this.block.keepRatio,
906
+ snappable: true,
907
+ snapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
908
+ elementSnapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
909
+ edge: false,
910
+ throttleDrag: 1,
911
+ throttleScale: 0.01,
912
+ throttleRotate: 1,
913
+ throttleResize: 1,
914
+ snapDistFormat: (v, type) => `${this.round(v / 96, 2)}`,
915
+ });
916
+ this._updateMoveable();
917
+ this.moveable
918
+ .on('clip', (e) => {
919
+ this.moveable.keepRatio = false;
920
+ e.target.style.clipPath = e.clipStyle;
921
+ this.block.clipPath = {
922
+ type: 'inset',
923
+ values: e.clipStyles
924
+ .map((value) => {
925
+ const n = Number(value.replace('%', ''));
926
+ return n > 0 ? n : 0;
927
+ }),
928
+ };
929
+ })
930
+ .on('clipEnd', (e) => {
931
+ this.moveable.keepRatio = true;
932
+ e.target.style.clipPath = null;
933
+ this._triggerChanged();
934
+ setTimeout(() => {
935
+ this.moveable.updateRect();
936
+ }, 100);
937
+ })
938
+ .on('dragStart', () => {
939
+ this.disableContentEdit();
940
+ this.transformating = true;
941
+ this._cdRef.markForCheck();
942
+ })
943
+ .on('drag', ({ target, left, top }) => {
944
+ target.style.left = `${this.pxToIn(left)}${this.unit}`;
945
+ target.style.top = `${this.pxToIn(top)}${this.unit}`;
946
+ this.block.top = this.pxToIn(top);
947
+ this.block.left = this.pxToIn(left);
948
+ })
949
+ .on('dragEnd', () => {
950
+ this.transformating = false;
951
+ this._triggerChanged();
952
+ this._cdRef.markForCheck();
953
+ })
954
+ .on('resizeStart', () => {
955
+ this.disableContentEdit();
956
+ this.zoompan.disable();
957
+ this.transformating = true;
958
+ this._cdRef.markForCheck();
959
+ })
960
+ .on('resize', ({ target, width, height, dist, delta, direction }) => {
961
+ width = this.pxToIn(width);
962
+ height = this.pxToIn(height);
963
+ if (delta[0]) {
964
+ this.block.width = width;
965
+ target.style.width = `${width}${this.unit}`;
966
+ }
967
+ if (delta[1]) {
968
+ this.block.height = height;
969
+ target.style.height = `${height}${this.unit}`;
970
+ }
971
+ const transform = [0, 0];
972
+ if (direction[1] === -1) {
973
+ transform[1] = dist[1] * -1;
974
+ }
975
+ if (direction[0] === -1) {
976
+ transform[0] = dist[0] * -1;
977
+ }
978
+ this._setTransform([`translate(${transform[0]}px, ${transform[1]}px)`]);
979
+ })
980
+ .on('resizeEnd', ({ target }) => {
981
+ const matrix = new WebKitCSSMatrix(target.style.transform);
982
+ this.block.top = parseFloat(target.style.top) + this.pxToIn(matrix.m42);
983
+ this.block.left = parseFloat(target.style.left) + this.pxToIn(matrix.m41);
984
+ this._setTransform();
985
+ this._triggerChanged();
986
+ this.zoompan.enable();
987
+ this.transformating = false;
988
+ this._cdRef.markForCheck();
989
+ target.style.top = `${this.block.top}in`;
990
+ target.style.left = `${this.block.left}in`;
991
+ target.style.width = `${this.block.width}in`;
992
+ target.style.height = `${this.block.height}in`;
993
+ this.moveable.updateRect();
994
+ })
995
+ .on('rotateStart', ({ inputEvent }) => {
996
+ if (inputEvent) {
997
+ this.zoompan.disable();
998
+ this.disableContentEdit();
999
+ this.transformating = true;
1000
+ this._cdRef.markForCheck();
1001
+ }
1002
+ })
1003
+ .on('rotate', ({ inputEvent, transform, rotation }) => {
1004
+ this.el.style.transform = transform;
1005
+ this.block.rotate = rotation % 360;
1006
+ if (inputEvent) {
1007
+ this.zoompan.enable();
1008
+ }
1009
+ })
1010
+ .on('rotateEnd', ({ inputEvent }) => {
1011
+ if (inputEvent) {
1012
+ this.transformating = false;
1013
+ this._cdRef.markForCheck();
1014
+ this._triggerChanged();
1015
+ }
1016
+ });
1017
+ }
1018
+ _initFont() {
1019
+ if (this.block.fontFamily) {
1020
+ this._fontPickerService.importFont(this.block.fontFamily);
1021
+ }
1022
+ }
1023
+ _initEvents() {
1024
+ fromEvent(this.contentEditable.nativeElement, 'paste')
1025
+ .pipe(takeUntil(this._destroy$))
1026
+ .subscribe((e) => {
1027
+ e.preventDefault();
1028
+ const clipboardData = e.clipboardData;
1029
+ const text = clipboardData.getData('Text');
1030
+ const range = document.getSelection().getRangeAt(0);
1031
+ range.deleteContents();
1032
+ const textNode = document.createTextNode(text);
1033
+ range.insertNode(textNode);
1034
+ range.selectNodeContents(textNode);
1035
+ range.collapse(false);
1036
+ const selection = window.getSelection();
1037
+ selection.removeAllRanges();
1038
+ selection.addRange(range);
1039
+ this.block.content = this.contentEditable.nativeElement.innerHTML;
1040
+ this._triggerChanged();
1041
+ });
1042
+ fromEvent(this.contentEditable.nativeElement, 'input')
1043
+ .pipe(takeUntil(this._destroy$)).subscribe((event) => {
1044
+ this.block.content = event.target.innerHTML;
1045
+ this._triggerChanged();
1046
+ });
1047
+ fromEvent(this.el, 'mousedown')
1048
+ .pipe(takeUntil(this._destroy$))
1049
+ .subscribe((event) => {
1050
+ if (this.block.lock) {
1051
+ event.preventDefault();
1052
+ event.stopImmediatePropagation();
1053
+ event.stopPropagation();
1054
+ }
1055
+ else {
1056
+ this.zoompan.disable();
1057
+ }
1058
+ if (!this.moveable.clippable) {
1059
+ if (this.editable) {
1060
+ if (this.contentElement.nativeElement.isSameNode(event.target)) {
1061
+ event.preventDefault();
1062
+ event.stopImmediatePropagation();
1063
+ event.stopPropagation();
1064
+ }
1065
+ }
1066
+ else {
1067
+ this._blockEditor.selectedBlock = this.block;
1068
+ }
1069
+ }
1070
+ });
1071
+ fromEvent(this.el, 'mouseup')
1072
+ .pipe(takeUntil(this._destroy$)).subscribe(() => {
1073
+ this.zoompan.enable();
1074
+ });
1075
+ fromEvent(this.el, 'dblclick')
1076
+ .pipe(filter(() => (!this.editable)), takeUntil(this._destroy$))
1077
+ .subscribe((event) => {
1078
+ if (this.block.readonly) {
1079
+ event.preventDefault();
1080
+ }
1081
+ else {
1082
+ this.editable = true;
1083
+ this._cdRef.markForCheck();
1084
+ setTimeout(() => {
1085
+ this.selectTextAll();
1086
+ });
1087
+ }
1088
+ });
1089
+ }
1090
+ _move(event) {
1091
+ if (!this.selected ||
1092
+ this.editable) {
1093
+ return;
1094
+ }
1095
+ event.preventDefault();
1096
+ const inchPixel = 1 / 100;
1097
+ switch (event.key) {
1098
+ case 'ArrowUp':
1099
+ this.block.top = round(this.block.top - inchPixel, 2);
1100
+ break;
1101
+ case 'ArrowDown':
1102
+ this.block.top = round(this.block.top + inchPixel, 2);
1103
+ break;
1104
+ case 'ArrowLeft':
1105
+ this.block.left = round(this.block.left - inchPixel, 2);
1106
+ break;
1107
+ case 'ArrowRight':
1108
+ this.block.left = round(this.block.left + inchPixel, 2);
1109
+ break;
1110
+ }
1111
+ this._blockEditor.blockChange(this.block);
1112
+ }
1113
+ _delete(event) {
1114
+ if (this.selected &&
1115
+ !this.editable &&
1116
+ event.target?.nodeName !== 'INPUT' &&
1117
+ event.target?.nodeName !== 'TEXTAREA') {
1118
+ event.preventDefault();
1119
+ this._blockEditor.removeBlocks([this.block]);
1120
+ }
1121
+ }
1122
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i2$2.FsFontPickerService }], target: i0.ɵɵFactoryTarget.Component });
1123
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { listeners: { "document:keydown": "keydown($event)" }, properties: { "class.transforming": "this.transformating" } }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [style.top]=\"styleTop\"\n [style.left]=\"styleLeft\"\n [style.width]=\"styleWidth\"\n [style.height]=\"styleHeight\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required,\n lock: block.lock,\n selected: selected\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'in' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'in' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'in' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'in' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.boxShadow]=\"styleBoxShadow\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container *ngIf=\"block.imageUrl && ((block.imageUrl | createImageUrl) | async) as src\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"src\">\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable && !typeForm\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n <div class=\"outline\"></div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none;cursor:pointer;box-sizing:border-box}.block.selected{border-color:#31a2ff95}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block.block-radiobutton{border-radius:50%}.block.required{background-color:#f7adaa}.block .content-editable{outline:none;position:relative;z-index:100}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:0px solid transparent;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}.block.selected .outline,.block:hover .outline{border:1px solid rgba(68,170,255,.7);position:absolute;inset:0;-webkit-user-select:none;user-select:none}.block.selected.lock .outline,.block:hover.lock .outline{border-color:#e4181866;border-style:dashed}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], dependencies: [{ kind: "directive", type: i6$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i6$1.AsyncPipe, name: "async" }, { kind: "pipe", type: CreateImageUrlPipe, name: "createImageUrl" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1124
+ }
1125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockComponent, decorators: [{
1126
+ type: Component,
1127
+ args: [{ selector: 'fs-block', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [style.top]=\"styleTop\"\n [style.left]=\"styleLeft\"\n [style.width]=\"styleWidth\"\n [style.height]=\"styleHeight\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required,\n lock: block.lock,\n selected: selected\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'in' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'in' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'in' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'in' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.boxShadow]=\"styleBoxShadow\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container *ngIf=\"block.imageUrl && ((block.imageUrl | createImageUrl) | async) as src\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"src\">\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable && !typeForm\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n <div class=\"outline\"></div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none;cursor:pointer;box-sizing:border-box}.block.selected{border-color:#31a2ff95}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block.block-radiobutton{border-radius:50%}.block.required{background-color:#f7adaa}.block .content-editable{outline:none;position:relative;z-index:100}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:0px solid transparent;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}.block.selected .outline,.block:hover .outline{border:1px solid rgba(68,170,255,.7);position:absolute;inset:0;-webkit-user-select:none;user-select:none}.block.selected.lock .outline,.block:hover.lock .outline{border-color:#e4181866;border-style:dashed}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"] }]
1128
+ }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i2$2.FsFontPickerService }]; }, propDecorators: { element: [{
1129
+ type: ViewChild,
1130
+ args: ['element', { static: true }]
1131
+ }], contentElement: [{
1132
+ type: ViewChild,
1133
+ args: ['contentElement', { static: true }]
1134
+ }], contentEditable: [{
1135
+ type: ViewChild,
1136
+ args: ['contentEditable', { static: true }]
1137
+ }], block: [{
1138
+ type: Input,
1139
+ args: ['block']
1140
+ }], html: [{
1141
+ type: Input
1142
+ }], zoompan: [{
1143
+ type: Input
1144
+ }], transformating: [{
1145
+ type: HostBinding,
1146
+ args: ['class.transforming']
1147
+ }], keydown: [{
1148
+ type: HostListener,
1149
+ args: ['document:keydown', ['$event']]
1150
+ }] } });
1151
+
1152
+ class SidebarComponent {
1153
+ _el;
1154
+ _blockEditor;
1155
+ _cdRef;
1156
+ _clipboard;
1157
+ _message;
1158
+ _prompt;
1159
+ _dialog;
1160
+ _document;
1161
+ sidebarPanels;
1162
+ config;
1163
+ blocks;
1164
+ zoompan;
1165
+ zoomCenter = new EventEmitter();
1166
+ block;
1167
+ BlockTypes = BlockTypes;
1168
+ blockTypeNames = index(BlockTypes, 'value', 'name');
1169
+ blockTypeIcons = index(BlockTypes, 'value', 'icon');
1170
+ clippable = false;
1171
+ BlockType = BlockType;
1172
+ blockGroup;
1173
+ blocksReordered;
1174
+ formats = [];
1175
+ _destroy$ = new Subject();
1176
+ constructor(_el, _blockEditor, _cdRef, _clipboard, _message, _prompt, _dialog, _document) {
1177
+ this._el = _el;
1178
+ this._blockEditor = _blockEditor;
1179
+ this._cdRef = _cdRef;
1180
+ this._clipboard = _clipboard;
1181
+ this._message = _message;
1182
+ this._prompt = _prompt;
1183
+ this._dialog = _dialog;
1184
+ this._document = _document;
1185
+ }
1186
+ get el() {
1187
+ return this._el.nativeElement;
1188
+ }
1189
+ get blockGroups() {
1190
+ return this._blockEditor.blockGroups;
1191
+ }
1192
+ get blockTypeForm() {
1193
+ return this.block.type === BlockType.LongText ||
1194
+ this.block.type === BlockType.ShortText ||
1195
+ this.block.type === BlockType.RadioButton ||
1196
+ this.block.type === BlockType.Checkbox ||
1197
+ this.block.type === BlockType.Date ||
1198
+ this.block.type === BlockType.Signature;
1199
+ }
1200
+ ngOnInit() {
1201
+ this._blockEditor.selectedBlocks$
1202
+ .pipe(takeUntil(this._destroy$))
1203
+ .subscribe((blocks) => {
1204
+ this.block = blocks[0] ? blocks[0] : null;
1205
+ this.blockGroup = null;
1206
+ if (this.block) {
1207
+ this.formats = BlockFormats
1208
+ .filter((blockFormat) => (blockFormat.blockTypes.indexOf(this.block.type) !== -1));
1209
+ if (this.block.name) {
1210
+ this.blockGroup = this._blockEditor.blockGroups
1211
+ .find((blockGroup) => {
1212
+ return this.block.name === blockGroup.name;
1213
+ });
1214
+ }
1215
+ }
1216
+ this._cdRef.markForCheck();
1217
+ });
1218
+ this._blockEditor.blockChanged$
1219
+ .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
1220
+ .subscribe(() => {
1221
+ this._cdRef.markForCheck();
1222
+ });
1223
+ if (this._blockEditor.config.blocksReorder) {
1224
+ this.blocksReordered = () => {
1225
+ this._document.defaultView?.scrollTo(0, 0);
1226
+ this._blockEditor.openReorderDialog();
1227
+ };
1228
+ }
1229
+ }
1230
+ blockGroupChange(blockGroup) {
1231
+ this._blockEditor.applyBlockGroup(this.block, blockGroup);
1232
+ }
1233
+ blockRequired(value) {
1234
+ const values = { required: value, readonly: false };
1235
+ if (this.blockGroup) {
1236
+ this._blockEditor.blockGroupChangeProperty(this.blockGroup, values);
1237
+ }
1238
+ else {
1239
+ this.blockChangeProperty(values);
1240
+ }
1241
+ }
1242
+ blockReadonly(value) {
1243
+ const values = { readonly: value, required: false };
1244
+ if (this.blockGroup) {
1245
+ this._blockEditor.blockGroupChangeProperty(this.blockGroup, values);
1246
+ }
1247
+ else {
1248
+ this.blockChangeProperty(values);
1249
+ }
1250
+ }
1251
+ blockGroupEdit(event) {
1252
+ event.preventDefault();
1253
+ event.stopImmediatePropagation();
1254
+ this.blockGroupDialog(this.blockGroup)
1255
+ .subscribe((blockGroup) => {
1256
+ this._blockEditor.blocks
1257
+ .filter((block) => block.name === blockGroup.name)
1258
+ .forEach((block) => {
1259
+ this._blockEditor.applyBlockGroup(block, blockGroup);
1260
+ });
1261
+ });
1262
+ }
1263
+ blockGroupCreate(event) {
1264
+ event.preventDefault();
1265
+ event.stopImmediatePropagation();
1266
+ this.blockGroupDialog()
1267
+ .subscribe((blockGroup) => {
1268
+ this._blockEditor.applyBlockGroup(this.block, blockGroup);
1269
+ this.blockGroup = blockGroup;
1270
+ this._cdRef.markForCheck();
1271
+ });
1272
+ }
1273
+ blockGroupDialog(blockGroup) {
1274
+ return this._dialog.open(GroupDialogComponent, {
1275
+ data: {
1276
+ block: this.block,
1277
+ blockEditor: this._blockEditor,
1278
+ blockGroup,
1279
+ },
1280
+ })
1281
+ .afterClosed()
1282
+ .pipe(filter((block) => !!block), takeUntil(this._destroy$));
1283
+ }
1284
+ fontChanged(font) {
1285
+ this._blockEditor.selectedBlockComponentChangeProperty({ fontFamily: font });
1286
+ }
1287
+ verticalAlignClick(value) {
1288
+ this._blockEditor.selectedBlockComponentChangeProperty({ verticalAlign: value });
1289
+ }
1290
+ boldClick() {
1291
+ this._blockEditor.selectedBlockComponentChangeProperty({ bold: !this.block.bold });
1292
+ }
1293
+ toggleLock() {
1294
+ this._blockEditor.selectedBlockComponentChangeProperty({ lock: !this.block.lock });
1295
+ }
1296
+ fontColorChange(value) {
1297
+ this._blockEditor.selectedBlockComponentChangeProperty({ fontColor: value });
1298
+ }
1299
+ italicClick() {
1300
+ this._blockEditor.selectedBlockComponentChangeProperty({ italic: !this.block.italic });
1301
+ }
1302
+ underlineClick() {
1303
+ this._blockEditor.selectedBlockComponentChangeProperty({ underline: !this.block.underline });
1304
+ }
1305
+ backgroundColorChange(value) {
1306
+ this._blockEditor.selectedBlockComponentChangeProperty({ backgroundColor: value });
1307
+ }
1308
+ shadowColorChange(value) {
1309
+ this._blockEditor.selectedBlockComponentChangeProperty({ shadowColor: value });
1310
+ }
1311
+ paddingAllChange(value) {
1312
+ value = this.validNumeric(value) ? value : null;
1313
+ this.block.paddingTop = value;
1314
+ this.block.paddingLeft = value;
1315
+ this.block.paddingBottom = value;
1316
+ this.block.paddingRight = value;
1317
+ this._blockEditor.selectedBlocks
1318
+ .forEach((block) => {
1319
+ this._blockEditor.blockChange(block);
1320
+ });
1321
+ }
1322
+ paddingKeypress(event, name) {
1323
+ this.block.padding = null;
1324
+ this.numericInputKeypress(event, name);
1325
+ }
1326
+ paddingAllKeypress(event, unit = .1) {
1327
+ if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1328
+ this.block.padding = (this.block.padding) + ((event.code === 'ArrowDown' ? -1 : 1) * unit);
1329
+ this.paddingAllChange(this.block.padding);
1330
+ }
1331
+ }
1332
+ borderColorChange(value) {
1333
+ this._blockEditor.selectedBlockComponentChangeProperty({ borderColor: value });
1334
+ }
1335
+ toggleKeepRatio() {
1336
+ this._blockEditor.selectedBlockComponentChangeProperty({ keepRatio: !this.block.keepRatio });
1337
+ }
1338
+ horizontalAlignClick(value) {
1339
+ this._blockEditor.selectedBlockComponentChangeProperty({ horizontalAlign: value });
1340
+ }
1341
+ shapeRound(name) {
1342
+ const value = this.block[name] === 'round' ? 'square' : 'round';
1343
+ this._blockEditor.selectedBlockComponentChangeProperty({ [name]: value });
1344
+ }
1345
+ numberChange(value, name) {
1346
+ value = this.validNumeric(value) ? value : null;
1347
+ this._blockEditor.selectedBlockComponentChangeProperty({ [name]: value });
1348
+ }
1349
+ imageRemove() {
1350
+ this._blockEditor.selectedBlockComponentChangeProperty({ imageUrl: null });
1351
+ }
1352
+ imageClip() {
1353
+ this.clippable = !this.clippable;
1354
+ this._blockEditor.blockClippable = true;
1355
+ }
1356
+ blockChangeProperty(values) {
1357
+ this._blockEditor.selectedBlockComponentChangeProperty(values);
1358
+ }
1359
+ blockDuplicateClick() {
1360
+ const selectedBlock = this._blockEditor.selectedBlocks[0];
1361
+ const block = {
1362
+ ...selectedBlock,
1363
+ id: null,
1364
+ data: null,
1365
+ guid: null,
1366
+ top: selectedBlock.top + selectedBlock.height + .1,
1367
+ };
1368
+ this._blockEditor.blockAdd(block);
1369
+ }
1370
+ blockRemoveClick() {
1371
+ this._blockEditor.removeBlocks(this._blockEditor.selectedBlocks);
1372
+ }
1373
+ validate = (formControl) => {
1374
+ if (this._blockEditor.config.defaultValidation) {
1375
+ return this._blockEditor.config.defaultValidation(this.block, formControl.value);
1376
+ }
1377
+ return of(true);
1378
+ };
1379
+ blockUpload(block, fsFile) {
1380
+ this._blockEditor.blockUpload(block, fsFile)
1381
+ .subscribe();
1382
+ }
1383
+ blockAdd(type) {
1384
+ if (type === BlockType.Pdf || type === BlockType.Image) {
1385
+ return;
1386
+ }
1387
+ const block = {
1388
+ type,
1389
+ shadowX: 2,
1390
+ shadowY: 2,
1391
+ shadowBlur: 4,
1392
+ };
1393
+ this._blockEditor.blockAdd(block);
1394
+ }
1395
+ layerMove(direction) {
1396
+ this._blockEditor.blocks.forEach((block) => {
1397
+ if (this._blockEditor.isSelectedBlock(block)) {
1398
+ block.index += (999 * direction);
1399
+ }
1400
+ });
1401
+ const sorted = this._blockEditor.blocks
1402
+ .sort((a, b) => {
1403
+ return a.index > b.index ? 1 : -1;
1404
+ });
1405
+ sorted
1406
+ .forEach((block, idx) => {
1407
+ block.index = idx;
1408
+ this._blockEditor.blockChange(block);
1409
+ });
1410
+ if (this.config.blocksLevelChanged) {
1411
+ this.config.blocksLevelChanged(sorted.map((block) => block));
1412
+ }
1413
+ }
1414
+ exportBlocks() {
1415
+ const blocks = JSON.stringify(this._blockEditor.blocks);
1416
+ this._clipboard.copy(blocks, { showMessage: false });
1417
+ this._message.success('Exported blocks to clipboard');
1418
+ }
1419
+ importBlocks() {
1420
+ this._prompt.input({
1421
+ title: 'Import blocks',
1422
+ })
1423
+ .subscribe((blocks) => {
1424
+ blocks = JSON.parse(blocks);
1425
+ blocks
1426
+ .forEach((block) => {
1427
+ block = {
1428
+ ...block,
1429
+ guid: guid(),
1430
+ imageUrl: null,
1431
+ };
1432
+ this._blockEditor.blockAdd(block);
1433
+ });
1434
+ this._message
1435
+ .success(`Imported ${blocks.length} ${blocks.length === 1 ? 'block' : 'blocks'}`);
1436
+ });
1437
+ }
1438
+ layerUp() {
1439
+ this.layerMove(1);
1440
+ }
1441
+ layerDown() {
1442
+ this.layerMove(-1);
1443
+ }
1444
+ inputFocus(event) {
1445
+ event.target.select();
1446
+ }
1447
+ numericInputKeypress(event, name, unit = .1) {
1448
+ if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1449
+ this.block[name] = round(Number(this.block[name] || 0) +
1450
+ ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1451
+ this._blockEditor.selectedBlockComponentChangeProperty({ [name]: this.block[name] });
1452
+ }
1453
+ }
1454
+ ngOnDestroy() {
1455
+ this._destroy$.next();
1456
+ this._destroy$.complete();
1457
+ }
1458
+ validNumeric(value) {
1459
+ return !value || !!String(value).match(/^\d*\.?\d*$/);
1460
+ }
1461
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SidebarComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i2$3.FsClipboard }, { token: i3$3.FsMessage }, { token: i3$2.FsPrompt }, { token: i1.MatDialog }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
1462
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks", zoompan: "zoompan" }, outputs: { zoomCenter: "zoomCenter" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, template: "<div class=\"sidebar\">\n <form fsForm>\n <div class=\"sidebar-panel\"> \n <div class=\"sidebar-label\">Elements</div>\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container *ngIf=\"blockType.type === 'draw'\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container [ngTemplateOutlet]=\"addFile\" [ngTemplateOutletContext]=\"{ type: BlockType.Pdf }\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container [ngTemplateOutlet]=\"addFile\" [ngTemplateOutletContext]=\"{ type: BlockType.Rectangle }\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <ng-container \n [ngTemplateOutlet]=\"addButton\" \n [ngTemplateOutletContext]=\"{ blockType: blockType }\">\n </ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile let-type=\"type\">\n <fs-file \n (select)=\"blockUpload({ type: type, keepRatio: true, borderWidth: 0 }, $event)\" \n [accept]=\"blockType.accept\">\n <ng-container [ngTemplateOutlet]=\"addButton\" [ngTemplateOutletContext]=\"{ blockType: blockType }\"></ng-container>\n </fs-file>\n </ng-template>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Form</div>\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container *ngIf=\"blockType.type === 'form'\">\n <ng-container \n [ngTemplateOutlet]=\"addButton\" \n [ngTemplateOutletContext]=\"{ blockType: blockType }\">\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div> \n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <ng-container *ngIf=\"block\">\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\"\n [matTooltip]=\"'Increase layer'\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\"\n [matTooltip]=\"'Decrease layer'\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"toggleLock()\"\n [matTooltip]=\"block.lock ? 'Unlock' : 'Lock'\">\n <mat-icon>{{block.lock ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n [matTooltip]=\"'Duplicate block'\"\n (click)=\"blockDuplicateClick()\">\n <mat-icon>content_copy</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n [matTooltip]=\"'Delete block'\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button> \n </ng-container>\n <ng-container *ngIf=\"blocksReordered\">\n <button\n class=\"reorder-layers\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blocksReordered()\"\n [matTooltip]=\"'Reorder blocks'\">\n <mat-icon>swap_vert</mat-icon>\n </button>\n </ng-container>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n matTooltip=\"Reset zoom\"\n (click)=\"zoomCenter.emit()\">\n <mat-icon>crop_free</mat-icon>\n </button>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row field-gap\">\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'left', .01)\"\n (ngModelChange)=\"numberChange($event, 'left')\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'top', .01)\"\n (ngModelChange)=\"numberChange($event, 'top')\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix rotate\">\n <input\n matInput\n [ngModel]=\"block.rotate\"\n name=\"rotate\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'rotate', 1)\"\n (ngModelChange)=\"numberChange($event, 'rotate')\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row field-gap\">\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'width', .01)\"\n (ngModelChange)=\"numberChange($event, 'width')\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'height', .01)\"\n (ngModelChange)=\"numberChange($event, 'height')\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container\n *ngIf=\"blockTypeForm\">\n <div class=\"sidebar-panel block-form-panel\">\n <div class=\"sidebar-label\">\n <mat-icon>{{blockTypeIcons[block.type]}}</mat-icon>\n {{blockTypeNames[block.type]}}\n </div>\n <div class=\"sidebar-row\">\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton; else nameField\">\n <div class=\"group-block\">\n <mat-form-field class=\"full-width\" class=\"full-width\">\n <mat-label>Group</mat-label>\n <mat-select\n [(ngModel)]=\"blockGroup\"\n (ngModelChange)=\"blockGroupChange($event)\"\n name=\"group\">\n <ng-container *ngIf=\"blockGroups.length\">\n <mat-option [value]=\"null\">\n None\n </mat-option>\n </ng-container>\n <mat-option\n *ngFor=\"let item of blockGroups\"\n [value]=\"item\">\n {{ item.label }}\n </mat-option>\n <mat-option \n [value]=\"null\"\n (click)=\"blockGroupCreate($event)\">\n Create Group\n </mat-option>\n </mat-select> \n </mat-form-field>\n <ng-container *ngIf=\"blockGroup\">\n <a \n (click)=\"blockGroupEdit($event)\">\n <mat-icon>edit</mat-icon>\n </a>\n </ng-container>\n </div>\n </ng-container>\n \n <mat-form-field class=\"full-width\">\n <input\n matInput\n [ngModel]=\"block.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty({ label: $event })\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty({ description: $event })\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field\n *ngIf=\"formats.length\"\n class=\"full-width\">\n <mat-label>Format</mat-label>\n <mat-select\n [(ngModel)]=\"block.format\"\n name=\"format\"\n (ngModelChange)=\"blockChangeProperty({ format: $event })\"> \n <mat-option [value]=\"null\">\n None\n </mat-option>\n <mat-option\n *ngFor=\"let item of formats\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <ng-container\n *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n [validate]=\"validate\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty({ default: $event })\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty({ formula: $event })\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-template #nameField>\n <mat-form-field class=\"full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty({ name: $event })\">\n </mat-form-field>\n </ng-template>\n\n <div class=\"form-field-options\">\n <mat-checkbox\n name=\"required\"\n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockRequired($event)\">\n Required\n </mat-checkbox>\n\n <mat-checkbox\n name=\"readonly\"\n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockReadonly($event)\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.Rectangle || block.type === BlockType.Image || block.type === BlockType.Pdf\">\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row field-gap\">\n <fs-font-picker \n [(ngModel)]=\"block.fontFamily\" \n (ngModelChange)=\"fontChanged($event)\"\n name=\"fontfamily\">\n </fs-font-picker>\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless form-field-prefix font-size\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'fontSize', 1)\"\n (ngModelChange)=\"numberChange($event, 'fontSize')\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix line-height\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'lineHeight', 1)\"\n (ngModelChange)=\"numberChange($event, 'lineHeight')\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row field-gap\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'justify' }\"\n (click)=\"horizontalAlignClick('justify')\">\n <mat-icon>format_align_justify</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row field-gap\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless form-field-prefix border-width\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'borderWidth', 1)\"\n (ngModelChange)=\"numberChange($event, 'borderWidth')\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row field-gap\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless form-field-prefix shape-radius\">\n <input\n matInput\n [ngModel]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shapeRadius', 1)\"\n (ngModelChange)=\"numberChange($event, 'shapeRadius')\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <div class=\"sidebar-panel shadow-panel\">\n <div class=\"sidebar-label\">Shadow</div>\n\n <div class=\"sidebar-row field-gap\">\n <fs-color-picker-chip\n (changed)=\"shadowColorChange($event)\"\n [color]=\"block.shadowColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless form-field-prefix shadow-x\">\n <input\n matInput\n [ngModel]=\"block.shadowX\"\n name=\"shadowX\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowX')\"\n (ngModelChange)=\"numberChange($event, 'shadowX')\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix shadow-y\">\n <input\n matInput\n [ngModel]=\"block.shadowY\"\n name=\"shadowY\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowY')\"\n (ngModelChange)=\"numberChange($event, 'shadowY')\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix shadow-blur\">\n <input\n matInput\n [ngModel]=\"block.shadowBlur\"\n name=\"shadowBlur\"\n placeholder=\"Blur\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowBlur')\"\n (ngModelChange)=\"numberChange($event, 'shadowBlur')\">\n <span matPrefix *ngIf=\"block.shadowBlur\">B</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix shadow-spread\">\n <input\n matInput\n [ngModel]=\"block.shadowSpread\"\n name=\"shadowSpread\"\n placeholder=\"Spread\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowSpread')\"\n (ngModelChange)=\"numberChange($event, 'shadowSpread')\">\n <span matPrefix *ngIf=\"block.shadowSpread\">S</span>\n </mat-form-field>\n <!-- <mat-form-field class=\"form-field-padless\">\n <input\n matInput\n [ngModel]=\"block.shadowOpacity\"\n name=\"shadowOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowOpacity')\"\n (ngModelChange)=\"numberChange($event, 'shadowOpacity')\">\n <span matPrefix *ngIf=\"block.shadowOpacity\">O</span>\n </mat-form-field> -->\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.Rectangle\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"blockUpload(block, $event)\">\n <button\n type=\"button\"\n mat-icon-button>\n <mat-icon>cloud_upload</mat-icon>\n </button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n\n <mat-form-field class=\"form-field-padless opacity\">\n <input\n matInput\n [ngModel]=\"block.imageOpacity\"\n fsMaskNumber\n [scale]=\"5\"\n name=\"imageOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'imageOpacity', 1)\"\n (ngModelChange)=\"numberChange($event, 'imageOpacity')\">\n <span matPrefix *ngIf=\"block.imageOpacity\">O</span>\n </mat-form-field>\n </ng-container>\n </div>\n </div>\n </ng-container> \n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row field-gap\">\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [(ngModel)]=\"block.padding\"\n name=\"padding\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n (keydown)=\"paddingAllKeypress($event, 1)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingTop')\"\n (ngModelChange)=\"numberChange($event, 'paddingTop')\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingBottom')\"\n (ngModelChange)=\"numberChange($event, 'paddingBottom')\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingLeft')\"\n (ngModelChange)=\"numberChange($event, 'paddingLeft')\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingRight')\"\n (ngModelChange)=\"numberChange($event, 'paddingRight')\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div> \n </ng-container> \n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Utilities</div>\n <div class=\"sidebar-row padding-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"exportBlocks()\"\n [matTooltip]=\"'Export blocks'\">\n <mat-icon>download</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"importBlocks()\"\n [matTooltip]=\"'Import blocks'\">\n <mat-icon>upload</mat-icon>\n </button>\n </div>\n </div> \n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n </form>\n</div>\n<ng-template #addButton let-blockType=\"blockType\">\n <button\n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n</ng-template>", styles: [".sidebar{width:320px;font-size:14px;height:100%;overflow:auto;background-color:#fff;padding:0 10px 10px;box-shadow:0 1px 3px 1px #0003;z-index:1;position:relative;box-sizing:border-box}.sidebar form{height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row.image-row .opacity{width:60px;margin-left:10px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row.field-gap>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row.field-gap>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding,.sidebar .line-height,.sidebar .font-size{width:45px}.sidebar .border-width{width:50px}.sidebar .shape-radius{width:60px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;column-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round{background-color:#212121}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .group-block{width:100%;display:flex;align-items:center}.sidebar .group-block a{margin-left:5px;color:inherit}.sidebar .group-block a mat-icon{transform:scale(.8)}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.block-form-panel .sidebar-label{display:flex;align-items:center}.sidebar .sidebar-panel.block-form-panel .sidebar-label mat-icon{transform:scale(.8);color:inherit;margin-left:-5px}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox{display:block}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox+mat-checkbox{margin-top:2px}.sidebar .sidebar-panel.info-panel .mat-form-field{width:60px}.sidebar .sidebar-panel.info-panel .mat-form-field.rotate{width:50px}.sidebar .sidebar-panel.shadow-panel .mat-form-field{width:41px}.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-x,.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-y{width:40px}.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-blur{width:50px}.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-spread{width:60px}.sidebar .sidebar-panel.typography-panel fs-font-picker{width:100%}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel.typography-panel .align-row .mat-icon-button{width:35px;height:35px;line-height:35px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:7px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}:host ::ng-deep .mat-form-field-appearance-outline.form-field-prefix .mat-form-field-suffix,:host ::ng-deep .mat-form-field-appearance-outline.form-field-prefix .mat-form-field-prefix{top:0}:host ::ng-deep .mat-form-field-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], dependencies: [{ kind: "directive", type: i6$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i6$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i6$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i6$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i11.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i11.MatLabel, selector: "mat-label" }, { kind: "directive", type: i11.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i6.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "component", type: i13.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i14.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i15.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "panelWidth", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i16.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i17.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "orientate", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "beforeProcessing", "clicked", "declined"] }, { kind: "component", type: i18.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color", "showClear"], outputs: ["changed"] }, { kind: "directive", type: i7.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { kind: "directive", type: i7.FsFormValidateDirective, selector: "[validate]", inputs: ["validate", "validateData", "validateOnSubmit"] }, { kind: "directive", type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormGreaterEqual]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { kind: "directive", type: i20.FsMaskNumberDirective, selector: "[fsMaskNumber]" }, { kind: "component", type: i2$2.FsFontPickerComponent, selector: "fs-font-picker" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1463
+ }
1464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SidebarComponent, decorators: [{
1465
+ type: Component,
1466
+ args: [{ selector: 'sidebar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"sidebar\">\n <form fsForm>\n <div class=\"sidebar-panel\"> \n <div class=\"sidebar-label\">Elements</div>\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container *ngIf=\"blockType.type === 'draw'\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container [ngTemplateOutlet]=\"addFile\" [ngTemplateOutletContext]=\"{ type: BlockType.Pdf }\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container [ngTemplateOutlet]=\"addFile\" [ngTemplateOutletContext]=\"{ type: BlockType.Rectangle }\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <ng-container \n [ngTemplateOutlet]=\"addButton\" \n [ngTemplateOutletContext]=\"{ blockType: blockType }\">\n </ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile let-type=\"type\">\n <fs-file \n (select)=\"blockUpload({ type: type, keepRatio: true, borderWidth: 0 }, $event)\" \n [accept]=\"blockType.accept\">\n <ng-container [ngTemplateOutlet]=\"addButton\" [ngTemplateOutletContext]=\"{ blockType: blockType }\"></ng-container>\n </fs-file>\n </ng-template>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Form</div>\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container *ngIf=\"blockType.type === 'form'\">\n <ng-container \n [ngTemplateOutlet]=\"addButton\" \n [ngTemplateOutletContext]=\"{ blockType: blockType }\">\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div> \n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <ng-container *ngIf=\"block\">\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\"\n [matTooltip]=\"'Increase layer'\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\"\n [matTooltip]=\"'Decrease layer'\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"toggleLock()\"\n [matTooltip]=\"block.lock ? 'Unlock' : 'Lock'\">\n <mat-icon>{{block.lock ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n [matTooltip]=\"'Duplicate block'\"\n (click)=\"blockDuplicateClick()\">\n <mat-icon>content_copy</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n [matTooltip]=\"'Delete block'\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button> \n </ng-container>\n <ng-container *ngIf=\"blocksReordered\">\n <button\n class=\"reorder-layers\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blocksReordered()\"\n [matTooltip]=\"'Reorder blocks'\">\n <mat-icon>swap_vert</mat-icon>\n </button>\n </ng-container>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n matTooltip=\"Reset zoom\"\n (click)=\"zoomCenter.emit()\">\n <mat-icon>crop_free</mat-icon>\n </button>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row field-gap\">\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'left', .01)\"\n (ngModelChange)=\"numberChange($event, 'left')\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'top', .01)\"\n (ngModelChange)=\"numberChange($event, 'top')\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix rotate\">\n <input\n matInput\n [ngModel]=\"block.rotate\"\n name=\"rotate\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'rotate', 1)\"\n (ngModelChange)=\"numberChange($event, 'rotate')\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row field-gap\">\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'width', .01)\"\n (ngModelChange)=\"numberChange($event, 'width')\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'height', .01)\"\n (ngModelChange)=\"numberChange($event, 'height')\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container\n *ngIf=\"blockTypeForm\">\n <div class=\"sidebar-panel block-form-panel\">\n <div class=\"sidebar-label\">\n <mat-icon>{{blockTypeIcons[block.type]}}</mat-icon>\n {{blockTypeNames[block.type]}}\n </div>\n <div class=\"sidebar-row\">\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton; else nameField\">\n <div class=\"group-block\">\n <mat-form-field class=\"full-width\" class=\"full-width\">\n <mat-label>Group</mat-label>\n <mat-select\n [(ngModel)]=\"blockGroup\"\n (ngModelChange)=\"blockGroupChange($event)\"\n name=\"group\">\n <ng-container *ngIf=\"blockGroups.length\">\n <mat-option [value]=\"null\">\n None\n </mat-option>\n </ng-container>\n <mat-option\n *ngFor=\"let item of blockGroups\"\n [value]=\"item\">\n {{ item.label }}\n </mat-option>\n <mat-option \n [value]=\"null\"\n (click)=\"blockGroupCreate($event)\">\n Create Group\n </mat-option>\n </mat-select> \n </mat-form-field>\n <ng-container *ngIf=\"blockGroup\">\n <a \n (click)=\"blockGroupEdit($event)\">\n <mat-icon>edit</mat-icon>\n </a>\n </ng-container>\n </div>\n </ng-container>\n \n <mat-form-field class=\"full-width\">\n <input\n matInput\n [ngModel]=\"block.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty({ label: $event })\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty({ description: $event })\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field\n *ngIf=\"formats.length\"\n class=\"full-width\">\n <mat-label>Format</mat-label>\n <mat-select\n [(ngModel)]=\"block.format\"\n name=\"format\"\n (ngModelChange)=\"blockChangeProperty({ format: $event })\"> \n <mat-option [value]=\"null\">\n None\n </mat-option>\n <mat-option\n *ngFor=\"let item of formats\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <ng-container\n *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n [validate]=\"validate\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty({ default: $event })\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty({ formula: $event })\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-template #nameField>\n <mat-form-field class=\"full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty({ name: $event })\">\n </mat-form-field>\n </ng-template>\n\n <div class=\"form-field-options\">\n <mat-checkbox\n name=\"required\"\n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockRequired($event)\">\n Required\n </mat-checkbox>\n\n <mat-checkbox\n name=\"readonly\"\n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockReadonly($event)\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.Rectangle || block.type === BlockType.Image || block.type === BlockType.Pdf\">\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row field-gap\">\n <fs-font-picker \n [(ngModel)]=\"block.fontFamily\" \n (ngModelChange)=\"fontChanged($event)\"\n name=\"fontfamily\">\n </fs-font-picker>\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless form-field-prefix font-size\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'fontSize', 1)\"\n (ngModelChange)=\"numberChange($event, 'fontSize')\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix line-height\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'lineHeight', 1)\"\n (ngModelChange)=\"numberChange($event, 'lineHeight')\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row field-gap\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'justify' }\"\n (click)=\"horizontalAlignClick('justify')\">\n <mat-icon>format_align_justify</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row field-gap\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless form-field-prefix border-width\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'borderWidth', 1)\"\n (ngModelChange)=\"numberChange($event, 'borderWidth')\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row field-gap\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless form-field-prefix shape-radius\">\n <input\n matInput\n [ngModel]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shapeRadius', 1)\"\n (ngModelChange)=\"numberChange($event, 'shapeRadius')\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <div class=\"sidebar-panel shadow-panel\">\n <div class=\"sidebar-label\">Shadow</div>\n\n <div class=\"sidebar-row field-gap\">\n <fs-color-picker-chip\n (changed)=\"shadowColorChange($event)\"\n [color]=\"block.shadowColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless form-field-prefix shadow-x\">\n <input\n matInput\n [ngModel]=\"block.shadowX\"\n name=\"shadowX\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowX')\"\n (ngModelChange)=\"numberChange($event, 'shadowX')\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix shadow-y\">\n <input\n matInput\n [ngModel]=\"block.shadowY\"\n name=\"shadowY\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowY')\"\n (ngModelChange)=\"numberChange($event, 'shadowY')\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix shadow-blur\">\n <input\n matInput\n [ngModel]=\"block.shadowBlur\"\n name=\"shadowBlur\"\n placeholder=\"Blur\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowBlur')\"\n (ngModelChange)=\"numberChange($event, 'shadowBlur')\">\n <span matPrefix *ngIf=\"block.shadowBlur\">B</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless form-field-prefix shadow-spread\">\n <input\n matInput\n [ngModel]=\"block.shadowSpread\"\n name=\"shadowSpread\"\n placeholder=\"Spread\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowSpread')\"\n (ngModelChange)=\"numberChange($event, 'shadowSpread')\">\n <span matPrefix *ngIf=\"block.shadowSpread\">S</span>\n </mat-form-field>\n <!-- <mat-form-field class=\"form-field-padless\">\n <input\n matInput\n [ngModel]=\"block.shadowOpacity\"\n name=\"shadowOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowOpacity')\"\n (ngModelChange)=\"numberChange($event, 'shadowOpacity')\">\n <span matPrefix *ngIf=\"block.shadowOpacity\">O</span>\n </mat-form-field> -->\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.Rectangle\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"blockUpload(block, $event)\">\n <button\n type=\"button\"\n mat-icon-button>\n <mat-icon>cloud_upload</mat-icon>\n </button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n\n <mat-form-field class=\"form-field-padless opacity\">\n <input\n matInput\n [ngModel]=\"block.imageOpacity\"\n fsMaskNumber\n [scale]=\"5\"\n name=\"imageOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'imageOpacity', 1)\"\n (ngModelChange)=\"numberChange($event, 'imageOpacity')\">\n <span matPrefix *ngIf=\"block.imageOpacity\">O</span>\n </mat-form-field>\n </ng-container>\n </div>\n </div>\n </ng-container> \n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row field-gap\">\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [(ngModel)]=\"block.padding\"\n name=\"padding\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n (keydown)=\"paddingAllKeypress($event, 1)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingTop')\"\n (ngModelChange)=\"numberChange($event, 'paddingTop')\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingBottom')\"\n (ngModelChange)=\"numberChange($event, 'paddingBottom')\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingLeft')\"\n (ngModelChange)=\"numberChange($event, 'paddingLeft')\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless form-field-prefix\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n fsMaskNumber\n [scale]=\"5\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingRight')\"\n (ngModelChange)=\"numberChange($event, 'paddingRight')\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div> \n </ng-container> \n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Utilities</div>\n <div class=\"sidebar-row padding-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"exportBlocks()\"\n [matTooltip]=\"'Export blocks'\">\n <mat-icon>download</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"importBlocks()\"\n [matTooltip]=\"'Import blocks'\">\n <mat-icon>upload</mat-icon>\n </button>\n </div>\n </div> \n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n </form>\n</div>\n<ng-template #addButton let-blockType=\"blockType\">\n <button\n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n</ng-template>", styles: [".sidebar{width:320px;font-size:14px;height:100%;overflow:auto;background-color:#fff;padding:0 10px 10px;box-shadow:0 1px 3px 1px #0003;z-index:1;position:relative;box-sizing:border-box}.sidebar form{height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row.image-row .opacity{width:60px;margin-left:10px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row.field-gap>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row.field-gap>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding,.sidebar .line-height,.sidebar .font-size{width:45px}.sidebar .border-width{width:50px}.sidebar .shape-radius{width:60px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;column-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round{background-color:#212121}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .group-block{width:100%;display:flex;align-items:center}.sidebar .group-block a{margin-left:5px;color:inherit}.sidebar .group-block a mat-icon{transform:scale(.8)}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.block-form-panel .sidebar-label{display:flex;align-items:center}.sidebar .sidebar-panel.block-form-panel .sidebar-label mat-icon{transform:scale(.8);color:inherit;margin-left:-5px}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox{display:block}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox+mat-checkbox{margin-top:2px}.sidebar .sidebar-panel.info-panel .mat-form-field{width:60px}.sidebar .sidebar-panel.info-panel .mat-form-field.rotate{width:50px}.sidebar .sidebar-panel.shadow-panel .mat-form-field{width:41px}.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-x,.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-y{width:40px}.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-blur{width:50px}.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-spread{width:60px}.sidebar .sidebar-panel.typography-panel fs-font-picker{width:100%}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel.typography-panel .align-row .mat-icon-button{width:35px;height:35px;line-height:35px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:7px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}:host ::ng-deep .mat-form-field-appearance-outline.form-field-prefix .mat-form-field-suffix,:host ::ng-deep .mat-form-field-appearance-outline.form-field-prefix .mat-form-field-prefix{top:0}:host ::ng-deep .mat-form-field-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"] }]
1467
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i2$3.FsClipboard }, { type: i3$3.FsMessage }, { type: i3$2.FsPrompt }, { type: i1.MatDialog }, { type: undefined, decorators: [{
1468
+ type: Inject,
1469
+ args: [DOCUMENT]
1470
+ }] }]; }, propDecorators: { sidebarPanels: [{
1471
+ type: ContentChildren,
1472
+ args: [FsBlockEditorSidebarPanelDirective]
1473
+ }], config: [{
1474
+ type: Input
1475
+ }], blocks: [{
1476
+ type: Input
1477
+ }], zoompan: [{
1478
+ type: Input
1479
+ }], zoomCenter: [{
1480
+ type: Output
1481
+ }] } });
1482
+
1483
+ class ArtboardComponent {
1484
+ _el;
1485
+ _blockEditor;
1486
+ _cdRef;
1487
+ sidebarPanels;
1488
+ blockComponents;
1489
+ artboard;
1490
+ marginContainer;
1491
+ margins;
1492
+ sidebar;
1493
+ config;
1494
+ zoompan;
1495
+ blocks = [];
1496
+ _destroy$ = new Subject();
1497
+ constructor(_el, _blockEditor, _cdRef) {
1498
+ this._el = _el;
1499
+ this._blockEditor = _blockEditor;
1500
+ this._cdRef = _cdRef;
1501
+ }
1502
+ get el() {
1503
+ return this._el.nativeElement;
1504
+ }
1505
+ ngOnInit() {
1506
+ this.config = {
1507
+ ...this.config,
1508
+ unit: 'in',
1509
+ };
1510
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
1511
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1512
+ this._blockEditor.blocks$
1513
+ .pipe(takeUntil(this._destroy$))
1514
+ .subscribe((blocks) => {
1515
+ this.blocks = blocks;
1516
+ this._cdRef.markForCheck();
1517
+ });
1518
+ this._blockEditor.blockAdded$
1519
+ .pipe(delay(300), takeUntil(this._destroy$))
1520
+ .subscribe((block) => {
1521
+ this._blockEditor.selectedBlocks = [block];
1522
+ this._cdRef.markForCheck();
1523
+ });
1524
+ }
1525
+ ngAfterViewInit() {
1526
+ this.blockComponents
1527
+ .changes
1528
+ .pipe(takeUntil(this._destroy$))
1529
+ .subscribe(() => {
1530
+ this._blockEditor.blockComponents = this.blockComponents.toArray();
1531
+ });
1532
+ this._blockEditor.blockComponents = this.blockComponents.toArray();
1533
+ }
1534
+ ngOnDestroy() {
1535
+ this._destroy$.next();
1536
+ this._destroy$.complete();
1537
+ }
1538
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtboardComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1539
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ArtboardComponent, selector: "app-artboard", inputs: { config: "config", zoompan: "zoompan" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "artboard", first: true, predicate: ["artboard"], descendants: true, static: true }, { propertyName: "marginContainer", first: true, predicate: ["marginContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "blockComponents", predicate: FsBlockComponent, descendants: true }, { propertyName: "margins", predicate: FsBlockEditorMarginDirective, descendants: true }], ngImport: i0, template: "<div\n #artboard\n class=\"artboard mat-elevation-z4 deselectable\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks\"\n [zoompan]=\"zoompan\"\n [block]=\"block\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\">\n </div>\n</div> \n\n", styles: [".artboard{position:relative;display:inline-flex;background-color:#fff}.artboard .margin-container{position:absolute;z-index:-1}.artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.artboard .margin.margin-top,.artboard .margin.margin-bottom{width:100%;border-top-width:1px}.artboard .margin.margin-left,.artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], dependencies: [{ kind: "directive", type: i6$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html", "zoompan"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1540
+ }
1541
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtboardComponent, decorators: [{
1542
+ type: Component,
1543
+ args: [{ selector: 'app-artboard', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n #artboard\n class=\"artboard mat-elevation-z4 deselectable\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks\"\n [zoompan]=\"zoompan\"\n [block]=\"block\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\">\n </div>\n</div> \n\n", styles: [".artboard{position:relative;display:inline-flex;background-color:#fff}.artboard .margin-container{position:absolute;z-index:-1}.artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.artboard .margin.margin-top,.artboard .margin.margin-bottom{width:100%;border-top-width:1px}.artboard .margin.margin-left,.artboard .margin.margin-right{height:100%;border-left-width:1px}\n"] }]
1544
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { sidebarPanels: [{
1545
+ type: ContentChildren,
1546
+ args: [FsBlockEditorSidebarPanelDirective]
1547
+ }], blockComponents: [{
1548
+ type: ViewChildren,
1549
+ args: [FsBlockComponent]
1550
+ }], artboard: [{
1551
+ type: ViewChild,
1552
+ args: ['artboard', { static: true }]
1553
+ }], marginContainer: [{
1554
+ type: ViewChild,
1555
+ args: ['marginContainer', { static: true }]
1556
+ }], margins: [{
1557
+ type: ViewChildren,
1558
+ args: [FsBlockEditorMarginDirective]
1559
+ }], sidebar: [{
1560
+ type: ViewChild,
1561
+ args: [SidebarComponent, { static: true }]
1562
+ }], config: [{
1563
+ type: Input
1564
+ }], zoompan: [{
1565
+ type: Input
1566
+ }] } });
1567
+
1568
+ class FsBlockEditorComponent {
1569
+ _el;
1570
+ _blockEditor;
1571
+ sidebarPanels;
1572
+ zoompan;
1573
+ artboardContainer;
1574
+ sidebar;
1575
+ artboard;
1576
+ config;
1577
+ blocks;
1578
+ _destroy$ = new Subject();
1579
+ constructor(_el, _blockEditor) {
1580
+ this._el = _el;
1581
+ this._blockEditor = _blockEditor;
1582
+ }
1583
+ get el() {
1584
+ return this._el.nativeElement;
1585
+ }
1586
+ ngOnInit() {
1587
+ this.config = {
1588
+ ...this.config,
1589
+ unit: 'in',
1590
+ };
1591
+ this._blockEditor.init(this.config);
1592
+ this._blockEditor.blocks$
1593
+ .pipe(takeUntil(this._destroy$))
1594
+ .subscribe((blocks) => {
1595
+ this.blocks = blocks;
1596
+ });
1597
+ setTimeout(() => {
1598
+ this.zoomCenter();
1599
+ });
1600
+ }
1601
+ zoomCenter() {
1602
+ }
1603
+ editorContainerClick(event) {
1604
+ if (event.target.classList.contains('deselectable') ||
1605
+ event.target.classList.contains('fs-zoom-pan-container')) {
1606
+ this.zoompan.enable();
1607
+ this._blockEditor.selectedBlocks = [];
1608
+ }
1609
+ }
1610
+ ngOnDestroy() {
1611
+ this._destroy$.next();
1612
+ this._destroy$.complete();
1613
+ }
1614
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }], target: i0.ɵɵFactoryTarget.Component });
1615
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
1616
+ BlockEditorService,
1617
+ BlocksStore,
1618
+ ], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "zoompan", first: true, predicate: FsZoomPanComponent, descendants: true, static: true }, { propertyName: "artboardContainer", first: true, predicate: ["artboardContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "artboard", first: true, predicate: ArtboardComponent, descendants: true, read: ElementRef }], ngImport: i0, template: "<div \n class=\"editor-container deselectable\"\n (mousedown)=\"editorContainerClick($event)\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n class=\"deselectable\"\n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n (zoomCenter)=\"zoomCenter()\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative;height:100%;background:#d8d8d8;overflow:hidden}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0;border:1px solid #ececec}.editor-container .zoom-pan-container{flex:1}fs-zoom-pan{height:100%}\n"], dependencies: [{ kind: "component", type: i2$4.FsZoomPanComponent, selector: "fs-zoom-pan", inputs: ["zoomMax", "zoomMin", "zoomDefault", "top", "left"], outputs: ["moved", "zoomed"] }, { kind: "directive", type: i2$4.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }, { kind: "component", type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks", "zoompan"], outputs: ["zoomCenter"] }, { kind: "component", type: ArtboardComponent, selector: "app-artboard", inputs: ["config", "zoompan"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1619
+ }
1620
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorComponent, decorators: [{
1621
+ type: Component,
1622
+ args: [{ selector: 'fs-block-editor', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1623
+ BlockEditorService,
1624
+ BlocksStore,
1625
+ ], template: "<div \n class=\"editor-container deselectable\"\n (mousedown)=\"editorContainerClick($event)\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n class=\"deselectable\"\n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n (zoomCenter)=\"zoomCenter()\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative;height:100%;background:#d8d8d8;overflow:hidden}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0;border:1px solid #ececec}.editor-container .zoom-pan-container{flex:1}fs-zoom-pan{height:100%}\n"] }]
1626
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1627
+ type: ContentChildren,
1628
+ args: [FsBlockEditorSidebarPanelDirective]
1629
+ }], zoompan: [{
1630
+ type: ViewChild,
1631
+ args: [FsZoomPanComponent, { static: true }]
1632
+ }], artboardContainer: [{
1633
+ type: ViewChild,
1634
+ args: ['artboardContainer', { static: true }]
1635
+ }], sidebar: [{
1636
+ type: ViewChild,
1637
+ args: [SidebarComponent, { static: true }]
1638
+ }], artboard: [{
1639
+ type: ViewChild,
1640
+ args: [ArtboardComponent, { read: ElementRef }]
1641
+ }], config: [{
1642
+ type: Input
1643
+ }] } });
1644
+
1645
+ class FsBlockEditorModule {
1646
+ static forRoot() {
1647
+ return {
1648
+ ngModule: FsBlockEditorModule,
1649
+ };
1650
+ }
1651
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1652
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1653
+ FsBlockEditorComponent,
1654
+ FsBlockEditorSidebarPanelDirective,
1655
+ FsBlockEditorMarginDirective,
1656
+ SidebarComponent,
1657
+ ArtboardComponent,
1658
+ LayersReorderDialogComponent,
1659
+ CreateImageUrlPipe,
1660
+ GroupDialogComponent], imports: [CommonModule,
1661
+ FormsModule,
1662
+ DragDropModule,
1663
+ MatIconModule,
1664
+ MatButtonModule,
1665
+ MatInputModule,
1666
+ MatFormFieldModule,
1667
+ MatCheckboxModule,
1668
+ MatTooltipModule,
1669
+ MatSelectModule,
1670
+ MatListModule,
1671
+ FsFileModule,
1672
+ FsColorPickerModule,
1673
+ FsMenuModule,
1674
+ FsZoomPanModule,
1675
+ FsFormModule,
1676
+ FsMaskModule,
1677
+ FsFontPickerModule,
1678
+ FsAutocompleteModule,
1679
+ FsDialogModule], exports: [FsBlockComponent,
1680
+ FsBlockEditorComponent,
1681
+ FsBlockEditorSidebarPanelDirective] });
1682
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorModule, imports: [CommonModule,
1683
+ FormsModule,
1684
+ DragDropModule,
1685
+ MatIconModule,
1686
+ MatButtonModule,
1687
+ MatInputModule,
1688
+ MatFormFieldModule,
1689
+ MatCheckboxModule,
1690
+ MatTooltipModule,
1691
+ MatSelectModule,
1692
+ MatListModule,
1693
+ FsFileModule,
1694
+ FsColorPickerModule,
1695
+ FsMenuModule,
1696
+ FsZoomPanModule,
1697
+ FsFormModule,
1698
+ FsMaskModule,
1699
+ FsFontPickerModule,
1700
+ FsAutocompleteModule,
1701
+ FsDialogModule] });
1702
+ }
1703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FsBlockEditorModule, decorators: [{
1704
+ type: NgModule,
1705
+ args: [{
1706
+ imports: [
1707
+ CommonModule,
1708
+ FormsModule,
1709
+ DragDropModule,
1710
+ MatIconModule,
1711
+ MatButtonModule,
1712
+ MatInputModule,
1713
+ MatFormFieldModule,
1714
+ MatCheckboxModule,
1715
+ MatTooltipModule,
1716
+ MatSelectModule,
1717
+ MatListModule,
1718
+ FsFileModule,
1719
+ FsColorPickerModule,
1720
+ FsMenuModule,
1721
+ FsZoomPanModule,
1722
+ FsFormModule,
1723
+ FsMaskModule,
1724
+ FsFontPickerModule,
1725
+ FsAutocompleteModule,
1726
+ FsDialogModule,
1727
+ ],
1728
+ exports: [
1729
+ FsBlockComponent,
1730
+ FsBlockEditorComponent,
1731
+ FsBlockEditorSidebarPanelDirective,
1732
+ ],
1733
+ declarations: [
1734
+ FsBlockComponent,
1735
+ FsBlockEditorComponent,
1736
+ FsBlockEditorSidebarPanelDirective,
1737
+ FsBlockEditorMarginDirective,
1738
+ SidebarComponent,
1739
+ ArtboardComponent,
1740
+ LayersReorderDialogComponent,
1741
+ CreateImageUrlPipe,
1742
+ GroupDialogComponent,
1743
+ ],
1744
+ }]
1745
+ }] });
1746
+
1747
+ /**
1748
+ * Generated bundle index. Do not edit.
1749
+ */
1750
+
1751
+ export { BlockType, BlockTypes, FsBlockComponent, FsBlockEditorComponent, FsBlockEditorModule, FsBlockEditorSidebarPanelDirective };
1752
+ //# sourceMappingURL=firestitch-block-editor.mjs.map