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