@firestitch/block-editor 12.3.18 → 12.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/app/components/artboard/artboard.component.d.ts +31 -31
  2. package/app/components/block/block.component.d.ts +71 -71
  3. package/app/components/block-editor/block-editor.component.d.ts +29 -28
  4. package/app/components/font/font.component.d.ts +12 -12
  5. package/app/components/font/index.d.ts +1 -1
  6. package/app/components/index.d.ts +1 -1
  7. package/app/components/layers-reorder-dialog/layers-reorder-dialog.component.d.ts +15 -15
  8. package/app/components/sidebar/sidebar.component.d.ts +80 -81
  9. package/app/consts/block-formats.const.d.ts +6 -6
  10. package/app/consts/block-types.const.d.ts +14 -14
  11. package/app/consts/index.d.ts +2 -2
  12. package/app/directives/block-editor-margin.directive.d.ts +9 -9
  13. package/app/directives/block-editor-sidebar-panel.directive.d.ts +10 -10
  14. package/app/enums/block-format.enum.d.ts +6 -6
  15. package/app/enums/block-type.enum.d.ts +11 -11
  16. package/app/enums/index.d.ts +2 -2
  17. package/app/fs-block-editor.module.d.ts +33 -33
  18. package/app/interfaces/block-editor-config.d.ts +18 -19
  19. package/app/interfaces/block.d.ts +63 -63
  20. package/app/interfaces/index.d.ts +2 -2
  21. package/app/services/block-editor.service.d.ts +57 -57
  22. package/app/services/blocks-store.service.d.ts +34 -34
  23. package/app/services/google-font.service.d.ts +15 -15
  24. package/app/services/index.d.ts +2 -2
  25. package/bundles/firestitch-block-editor.umd.js +1979 -1983
  26. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  27. package/esm2015/app/components/artboard/artboard.component.js +108 -108
  28. package/esm2015/app/components/block/block.component.js +476 -476
  29. package/esm2015/app/components/block-editor/block-editor.component.js +96 -86
  30. package/esm2015/app/components/font/font.component.js +31 -31
  31. package/esm2015/app/components/font/index.js +1 -1
  32. package/esm2015/app/components/index.js +1 -1
  33. package/esm2015/app/components/layers-reorder-dialog/layers-reorder-dialog.component.js +43 -43
  34. package/esm2015/app/components/sidebar/sidebar.component.js +242 -249
  35. package/esm2015/app/consts/block-formats.const.js +7 -7
  36. package/esm2015/app/consts/block-types.const.js +12 -12
  37. package/esm2015/app/consts/index.js +2 -2
  38. package/esm2015/app/directives/block-editor-margin.directive.js +18 -18
  39. package/esm2015/app/directives/block-editor-sidebar-panel.directive.js +20 -20
  40. package/esm2015/app/enums/block-format.enum.js +7 -7
  41. package/esm2015/app/enums/block-type.enum.js +12 -12
  42. package/esm2015/app/enums/index.js +2 -2
  43. package/esm2015/app/fs-block-editor.module.js +125 -125
  44. package/esm2015/app/interfaces/block-editor-config.js +2 -2
  45. package/esm2015/app/interfaces/block.js +1 -1
  46. package/esm2015/app/interfaces/index.js +2 -2
  47. package/esm2015/app/services/block-editor.service.js +170 -170
  48. package/esm2015/app/services/blocks-store.service.js +188 -190
  49. package/esm2015/app/services/google-font.service.js +37 -37
  50. package/esm2015/app/services/index.js +2 -2
  51. package/esm2015/firestitch-block-editor.js +4 -4
  52. package/esm2015/public_api.js +6 -6
  53. package/fesm2015/firestitch-block-editor.js +1440 -1439
  54. package/fesm2015/firestitch-block-editor.js.map +1 -1
  55. package/firestitch-block-editor.d.ts +5 -5
  56. package/package.json +1 -1
  57. package/public_api.d.ts +8 -8
@@ -3,7 +3,7 @@ import { FormsModule } from '@angular/forms';
3
3
  import * as i15 from '@angular/material/input';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import * as i0 from '@angular/core';
6
- import { Injectable, Component, ChangeDetectionStrategy, Inject, ViewChild, Input, HostBinding, Directive, EventEmitter, ContentChildren, Output, ViewChildren, ElementRef, NgModule } from '@angular/core';
6
+ import { Component, ChangeDetectionStrategy, Inject, Injectable, ViewChild, Input, HostBinding, Directive, EventEmitter, ContentChildren, Output, ViewChildren, ElementRef, HostListener, NgModule } from '@angular/core';
7
7
  import * as i13 from '@angular/common';
8
8
  import { DOCUMENT, CommonModule } from '@angular/common';
9
9
  import * as i6 from '@angular/material/button';
@@ -34,9 +34,9 @@ import { FsDialogModule } from '@firestitch/dialog';
34
34
  import { filter, map, groupBy, debounceTime, mergeAll, takeUntil, switchMap, delay } from 'rxjs/operators';
35
35
  import Moveable from 'moveable';
36
36
  import { Subject, BehaviorSubject, from, throwError, fromEvent } from 'rxjs';
37
- import { guid, index, round } from '@firestitch/common';
38
37
  import * as i1 from '@angular/material/dialog';
39
38
  import { MAT_DIALOG_DATA } from '@angular/material/dialog';
39
+ import { index, guid, round } from '@firestitch/common';
40
40
  import * as i5 from '@angular/material/divider';
41
41
  import * as i1$1 from '@angular/common/http';
42
42
  import * as i2$1 from '@firestitch/prompt';
@@ -45,1473 +45,1474 @@ import * as i10 from '@firestitch/autocomplete';
45
45
  import { FsAutocompleteModule } from '@firestitch/autocomplete';
46
46
  import * as i17 from '@angular/cdk/text-field';
47
47
 
48
- var BlockType;
49
- (function (BlockType) {
50
- BlockType["Rectangle"] = "rectangle";
51
- BlockType["ShortText"] = "shorttext";
52
- BlockType["LongText"] = "longtext";
53
- BlockType["Image"] = "image";
54
- BlockType["RadioButton"] = "radiobutton";
55
- BlockType["Checkbox"] = "checkbox";
56
- BlockType["Signature"] = "signature";
57
- BlockType["Pdf"] = "pdf";
58
- BlockType["Date"] = "date";
48
+ var BlockType;
49
+ (function (BlockType) {
50
+ BlockType["Rectangle"] = "rectangle";
51
+ BlockType["ShortText"] = "shorttext";
52
+ BlockType["LongText"] = "longtext";
53
+ BlockType["Image"] = "image";
54
+ BlockType["RadioButton"] = "radiobutton";
55
+ BlockType["Checkbox"] = "checkbox";
56
+ BlockType["Signature"] = "signature";
57
+ BlockType["Pdf"] = "pdf";
58
+ BlockType["Date"] = "date";
59
59
  })(BlockType || (BlockType = {}));
60
60
 
61
- var BlockFormat;
62
- (function (BlockFormat) {
63
- BlockFormat["Date"] = "date";
64
- BlockFormat["YYYYMMDD"] = "YYYY/MM/DD";
65
- BlockFormat["Currency"] = "currency";
66
- BlockFormat["Number"] = "number";
61
+ var BlockFormat;
62
+ (function (BlockFormat) {
63
+ BlockFormat["Date"] = "date";
64
+ BlockFormat["YYYYMMDD"] = "YYYY/MM/DD";
65
+ BlockFormat["Currency"] = "currency";
66
+ BlockFormat["Number"] = "number";
67
67
  })(BlockFormat || (BlockFormat = {}));
68
68
 
69
- var EventType;
70
- (function (EventType) {
71
- EventType["Add"] = "add";
72
- EventType["Change"] = "change";
73
- EventType["Remove"] = "remove";
74
- })(EventType || (EventType = {}));
75
- class BlocksStore {
76
- constructor() {
77
- this._lastTabIndex = -1;
78
- this._eventBus$ = new Subject();
79
- this._blocks$ = new BehaviorSubject([]);
80
- this._destroy$ = new Subject();
81
- }
82
- get blocks() {
83
- return [
84
- ...this._blocks$.getValue(),
85
- ];
86
- }
87
- get blocks$() {
88
- return this._blocks$.asObservable();
89
- }
90
- get blockAdded$() {
91
- return this._eventBus$
92
- .pipe(filter(({ type }) => type === EventType.Add), map(({ value }) => value));
93
- }
94
- get blockChanged$() {
95
- return this._eventBus$
96
- .pipe(filter(({ type }) => type === EventType.Change), map(({ value }) => value));
97
- }
98
- get blockRemoved$() {
99
- return this._eventBus$
100
- .pipe(filter(({ type }) => type === EventType.Remove), map(({ value }) => value));
101
- }
102
- ngOnDestroy() {
103
- this._destroy$.next();
104
- this._destroy$.complete();
105
- }
106
- init(config) {
107
- this._config = config;
108
- this._setBlocks(this._config.blocks);
109
- if (this._config.blockChanged) {
110
- this.blockChanged$
111
- .pipe(groupBy((block) => (block.guid)), map((group) => group.pipe(debounceTime(250))), mergeAll())
112
- .subscribe((block) => {
113
- this._config.blockChanged(block);
114
- });
115
- }
116
- }
117
- blockExists(block) {
118
- const index = this.blocks.findIndex((b) => {
119
- return b.guid === block.guid;
120
- });
121
- return index !== -1;
122
- }
123
- blockAdd(block, initBlock = false) {
124
- if (!this._config.blockAdd) {
125
- console.warn('[BlockEditor] Config "blockAdd" is not defined');
126
- return;
127
- }
128
- if (initBlock) {
129
- block = this._createBlock(block);
130
- }
131
- this._config.blockAdd(block)
132
- .pipe(takeUntil(this._destroy$))
133
- .subscribe((newBlock) => {
134
- this._appendBlock(newBlock);
135
- });
136
- }
137
- blockUpload(block, fsFile, initBlock = false) {
138
- if (!this._config.blockUpload) {
139
- console.warn('[BlockEditor] Config "blockUpload" is not defined');
140
- return;
141
- }
142
- if (initBlock) {
143
- block = this._createBlock(block);
144
- }
145
- from(fsFile.imageInfo)
146
- .pipe(switchMap((imageInfo) => {
147
- if ((imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.height) && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.width)) {
148
- const ratio = imageInfo.height / imageInfo.width;
149
- block.width = this._config.width * .4;
150
- block.height = block.width * ratio;
151
- }
152
- return this._config.blockUpload(block, fsFile.file);
153
- }), takeUntil(this._destroy$))
154
- .subscribe((newBlock) => {
155
- this._appendBlock(newBlock);
156
- });
157
- }
158
- blockChange(block) {
159
- this._dispatchEvent(EventType.Change, block);
160
- }
161
- blockRemove(targetBlocks) {
162
- const blocks = this.blocks;
163
- if (!Array.isArray(targetBlocks)) {
164
- targetBlocks = [targetBlocks];
165
- }
166
- targetBlocks.forEach((block) => {
167
- const index = blocks
168
- .findIndex((b) => b.guid === block.guid);
169
- if (index !== -1) {
170
- blocks.splice(index, 1);
171
- this._dispatchEvent(EventType.Remove, block);
172
- }
173
- });
174
- this._setBlocks(blocks);
175
- }
176
- isReordableBlock(block) {
177
- return [
178
- BlockType.LongText,
179
- BlockType.ShortText,
180
- BlockType.RadioButton,
181
- BlockType.Checkbox,
182
- BlockType.Date,
183
- BlockType.Signature,
184
- ].indexOf(block.type) > -1;
185
- }
186
- updateTabIndex(index) {
187
- this._lastTabIndex = index;
188
- }
189
- _setBlocks(blocks) {
190
- this._blocks$.next([...blocks]);
191
- blocks
192
- .filter((b) => this.isReordableBlock(b))
193
- .forEach((b) => {
194
- this._lastTabIndex = Math.max(b.tabIndex, this._lastTabIndex);
195
- });
196
- }
197
- _appendBlock(block) {
198
- const blocks = [
199
- ...this.blocks,
200
- block,
201
- ];
202
- this._deduplicateIndexesFor(blocks);
203
- this._setBlocks(blocks);
204
- this._dispatchEvent(EventType.Add, block);
205
- }
206
- _dispatchEvent(type, value) {
207
- this._eventBus$.next({
208
- type,
209
- value,
210
- });
211
- }
212
- _createBlock(block) {
213
- const newBlock = Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || guid('xxxxxxxxxxxx'), keepRatio: [
214
- BlockType.Checkbox,
215
- BlockType.RadioButton,
216
- BlockType.Image,
217
- BlockType.Pdf,
218
- ]
219
- .indexOf(block.type) !== -1 });
220
- let width = (this._config.width * .333).toFixed(2);
221
- let height = width / 2;
222
- if (newBlock.type === BlockType.Rectangle) {
223
- newBlock.borderColor = '#cccccc';
224
- newBlock.borderWidth = 1;
225
- }
226
- else if (newBlock.type === BlockType.Checkbox || newBlock.type === BlockType.RadioButton) {
227
- width = .25;
228
- height = .25;
229
- }
230
- else {
231
- width = 2;
232
- height = .5;
233
- }
234
- if (this.isReordableBlock(newBlock)) {
235
- newBlock.tabIndex = this._lastTabIndex + 1;
236
- this.updateTabIndex(newBlock.tabIndex);
237
- }
238
- return Object.assign({ top: height, left: width, width,
239
- height }, newBlock);
240
- }
241
- _deduplicateIndexesFor(blocks) {
242
- blocks.forEach((block, index) => {
243
- block.index = index;
244
- });
245
- }
246
- }
247
- BlocksStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
248
- BlocksStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore });
249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore, decorators: [{
250
- type: Injectable
251
- }] });
252
-
253
- const BlockTypes = [
254
- { value: BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4', type: 'draw' },
255
- { value: BlockType.ShortText, name: 'Short Text', icon: 'short_text', type: 'form' },
256
- { value: BlockType.LongText, name: 'Long Text', icon: 'subject', type: 'form' },
257
- { value: BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked', type: 'form' },
258
- { value: BlockType.Checkbox, name: 'Checkbox', icon: 'check_box', type: 'form' },
259
- { value: BlockType.Date, name: 'Date', icon: 'calendar_today', type: 'form' },
260
- { value: BlockType.Signature, name: 'Signature', icon: 'draw', type: 'form' },
261
- { value: BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*', type: 'draw' },
262
- { value: BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf', type: 'draw' },
69
+ const BlockTypes = [
70
+ { value: BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4', type: 'draw' },
71
+ { value: BlockType.ShortText, name: 'Short Text', icon: 'short_text', type: 'form' },
72
+ { value: BlockType.LongText, name: 'Long Text', icon: 'subject', type: 'form' },
73
+ { value: BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked', type: 'form' },
74
+ { value: BlockType.Checkbox, name: 'Checkbox', icon: 'check_box', type: 'form' },
75
+ { value: BlockType.Date, name: 'Date', icon: 'calendar_today', type: 'form' },
76
+ { value: BlockType.Signature, name: 'Signature', icon: 'draw', type: 'form' },
77
+ { value: BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*', type: 'draw' },
78
+ { value: BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf', type: 'draw' },
263
79
  ];
264
80
 
265
- class LayersReorderDialogComponent {
266
- constructor(_dialogData, _dialogRef) {
267
- this._dialogRef = _dialogRef;
268
- this.blockTypeIcons = index(BlockTypes, 'value', 'icon');
269
- this._init(_dialogData);
270
- }
271
- swapItems(event) {
272
- moveItemInArray(this.blockComponents, event.previousIndex, event.currentIndex);
273
- }
274
- done() {
275
- this._dialogRef.close(this.blockComponents);
276
- }
277
- _init(data) {
278
- this.blockComponents = data.blockComponents;
279
- }
280
- }
281
- LayersReorderDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LayersReorderDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
282
- LayersReorderDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LayersReorderDialogComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder Fields</h1>\n <mat-dialog-content>\n <mat-list cdkDropList (cdkDropListDropped)=\"swapItems($event)\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let blockComponent of blockComponents\">\n <mat-list-item cdkDrag cdkDragLockAxis=\"y\">\n <mat-icon cdkDragHandle>drag_handle</mat-icon>\n <mat-icon>\n {{ blockTypeIcons[blockComponent.block.type] }}\n </mat-icon>\n <span class=\"block-label\">\n {{ blockComponent.block.label || blockComponent.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"] }, { type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i6.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.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i7.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LayersReorderDialogComponent, decorators: [{
284
- type: Component,
285
- args: [{
286
- templateUrl: './layers-reorder-dialog.component.html',
287
- styleUrls: ['./layers-reorder-dialog.component.scss'],
288
- changeDetection: ChangeDetectionStrategy.OnPush,
289
- }]
290
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
291
- type: Inject,
292
- args: [MAT_DIALOG_DATA]
81
+ class LayersReorderDialogComponent {
82
+ constructor(_dialogData, _dialogRef) {
83
+ this._dialogRef = _dialogRef;
84
+ this.blockTypeIcons = index(BlockTypes, 'value', 'icon');
85
+ this._init(_dialogData);
86
+ }
87
+ swapItems(event) {
88
+ moveItemInArray(this.blockComponents, event.previousIndex, event.currentIndex);
89
+ }
90
+ done() {
91
+ this._dialogRef.close(this.blockComponents);
92
+ }
93
+ _init(data) {
94
+ this.blockComponents = data.blockComponents;
95
+ }
96
+ }
97
+ LayersReorderDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LayersReorderDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
98
+ LayersReorderDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LayersReorderDialogComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder Fields</h1>\n <mat-dialog-content>\n <mat-list cdkDropList (cdkDropListDropped)=\"swapItems($event)\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let blockComponent of blockComponents\">\n <mat-list-item cdkDrag cdkDragLockAxis=\"y\">\n <mat-icon cdkDragHandle>drag_handle</mat-icon>\n <mat-icon>\n {{ blockTypeIcons[blockComponent.block.type] }}\n </mat-icon>\n <span class=\"block-label\">\n {{ blockComponent.block.label || blockComponent.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"] }, { type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i6.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.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i7.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
99
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LayersReorderDialogComponent, decorators: [{
100
+ type: Component,
101
+ args: [{
102
+ templateUrl: './layers-reorder-dialog.component.html',
103
+ styleUrls: ['./layers-reorder-dialog.component.scss'],
104
+ changeDetection: ChangeDetectionStrategy.OnPush,
105
+ }]
106
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
107
+ type: Inject,
108
+ args: [MAT_DIALOG_DATA]
293
109
  }] }, { type: i1.MatDialogRef }]; } });
294
110
 
295
- class BlockEditorService {
296
- constructor(_store, _dialog) {
297
- this._store = _store;
298
- this._dialog = _dialog;
299
- this._selectedBlocks$ = new BehaviorSubject([]);
300
- this._blockComponents = new Map();
301
- this._blockClippable$ = new BehaviorSubject(null);
302
- this._destroy$ = new Subject();
303
- this._blockInited$ = new Subject();
304
- }
305
- get blockComponents() {
306
- return Array.from(this._blockComponents.values());
307
- }
308
- get selectedComponentBlocks() {
309
- return this.blockComponents
310
- .filter((blockComponent) => this.selectedBlocks.indexOf(blockComponent.block) !== -1);
311
- }
312
- init(config) {
313
- this.config = config;
314
- this._store.init(Object.assign({}, this.config));
315
- }
316
- blockAdd(block, newBlock = false) {
317
- this._store.blockAdd(block, newBlock);
318
- }
319
- blockUpload(block, fsFile, newBlock = false) {
320
- this._store.blockUpload(block, fsFile, true);
321
- }
322
- blockRemove(block) {
323
- this._store.blockRemove(block);
324
- }
325
- removeSelectedBlocks() {
326
- this.selectedBlocks
327
- .forEach((block) => {
328
- this.blockRemove(block);
329
- });
330
- this.selectedBlocks = [];
331
- }
332
- get blocks$() {
333
- return this._store.blocks$;
334
- }
335
- get blockChanged$() {
336
- return this._store.blockChanged$;
337
- }
338
- get blockClippable$() {
339
- return this._blockClippable$;
340
- }
341
- set blockClippable(value) {
342
- this._blockClippable$.next(value);
343
- }
344
- get blockAdded$() {
345
- return this._store.blockAdded$;
346
- }
347
- get blockInited$() {
348
- return this._blockInited$;
349
- }
350
- get blockRemoved$() {
351
- return this._store.blockRemoved$;
352
- }
353
- get blocks() {
354
- return this._store.blocks;
355
- }
356
- blockChange(block) {
357
- this._store.blockChange(block);
358
- }
359
- isSelectedBlock(block) {
360
- return this.selectedBlocks.indexOf(block.block) !== -1;
361
- }
362
- indexOf(block) {
363
- return this.blocks.map((e) => e.guid).indexOf(block.guid);
364
- }
365
- selectedBlockComponentChangeProperty(value, name) {
366
- this.selectedBlocks
367
- .forEach((block) => {
368
- block[name] = value;
369
- this.blockChange(block);
370
- });
371
- }
372
- get selectedBlocks$() {
373
- return this._selectedBlocks$;
374
- }
375
- set selectedBlock(block) {
376
- this.selectedBlocks = [block];
377
- }
378
- set selectedBlocks(blocks) {
379
- this.blockComponents
380
- .forEach((blockComponent) => {
381
- if (blocks.indexOf(blockComponent.block) !== -1) {
382
- blockComponent.select();
383
- }
384
- else {
385
- blockComponent.deselect();
386
- }
387
- });
388
- this._selectedBlocks$.next(blocks);
389
- if (this.config.blocksSelected) {
390
- this.config.blocksSelected(blocks);
391
- }
392
- }
393
- get selectedBlocks() {
394
- return this._selectedBlocks$.getValue();
395
- }
396
- saveSelection() {
397
- const selection = window.getSelection();
398
- this._selectionRange = selection.getRangeAt(0);
399
- }
400
- restoreSelection() {
401
- if (this._selectionRange) {
402
- const selection = window.getSelection();
403
- selection.removeAllRanges();
404
- selection.addRange(this._selectionRange);
405
- }
406
- }
407
- hasSelectionRange() {
408
- return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
409
- }
410
- initBlock(block, blockComponent) {
411
- this._blockComponents.set(block, blockComponent);
412
- this._blockInited$.next(block);
413
- }
414
- destroyBlock(block) {
415
- this._blockComponents.delete(block);
416
- }
417
- registerContainer(container) {
418
- this.container = container;
419
- }
420
- registerMargin(margin) {
421
- this.margin = margin;
422
- }
423
- openReorderDialog() {
424
- const blockComponents = this.blockComponents
425
- .sort((blockCmpA, blockCmpB) => (blockCmpA.block.index - blockCmpB.block.index))
426
- .reverse();
427
- this._dialog
428
- .open(LayersReorderDialogComponent, {
429
- data: {
430
- blockComponents,
431
- }
432
- })
433
- .afterClosed()
434
- .pipe(filter((blockComponents) => !!blockComponents), takeUntil(this._destroy$))
435
- .subscribe((blockComponents) => {
436
- blockComponents
437
- .reverse()
438
- .forEach((blockCmp, index) => {
439
- blockCmp.block.index = index;
440
- this._store.blockChange(blockCmp.block);
441
- this._store.updateTabIndex(index);
442
- });
443
- });
444
- }
445
- ngOnDestroy() {
446
- this._destroy$.next();
447
- this._destroy$.complete();
448
- }
449
- }
450
- BlockEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, deps: [{ token: BlocksStore }, { token: i2.FsDialog }], target: i0.ɵɵFactoryTarget.Injectable });
451
- BlockEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService });
452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, decorators: [{
453
- type: Injectable
111
+ var EventType;
112
+ (function (EventType) {
113
+ EventType["Add"] = "add";
114
+ EventType["Change"] = "change";
115
+ EventType["Remove"] = "remove";
116
+ })(EventType || (EventType = {}));
117
+ class BlocksStore {
118
+ constructor() {
119
+ this._lastTabIndex = -1;
120
+ this._eventBus$ = new Subject();
121
+ this._blocks$ = new BehaviorSubject([]);
122
+ this._destroy$ = new Subject();
123
+ }
124
+ get blocks() {
125
+ return [
126
+ ...this._blocks$.getValue(),
127
+ ];
128
+ }
129
+ get blocks$() {
130
+ return this._blocks$.asObservable();
131
+ }
132
+ get blockAdded$() {
133
+ return this._eventBus$
134
+ .pipe(filter(({ type }) => type === EventType.Add), map(({ value }) => value));
135
+ }
136
+ get blockChanged$() {
137
+ return this._eventBus$
138
+ .pipe(filter(({ type }) => type === EventType.Change), map(({ value }) => value));
139
+ }
140
+ get blockRemoved$() {
141
+ return this._eventBus$
142
+ .pipe(filter(({ type }) => type === EventType.Remove), map(({ value }) => value));
143
+ }
144
+ ngOnDestroy() {
145
+ this._destroy$.next();
146
+ this._destroy$.complete();
147
+ }
148
+ init(config) {
149
+ this._config = config;
150
+ this._setBlocks(this._config.blocks);
151
+ if (this._config.blockChanged) {
152
+ this.blockChanged$
153
+ .pipe(groupBy((block) => (block.guid)), map((group) => group.pipe(debounceTime(250))), mergeAll())
154
+ .subscribe((block) => {
155
+ this._config.blockChanged(block);
156
+ });
157
+ }
158
+ }
159
+ blockExists(block) {
160
+ const index = this.blocks.findIndex((b) => {
161
+ return b.guid === block.guid;
162
+ });
163
+ return index !== -1;
164
+ }
165
+ blockAdd(block) {
166
+ if (!this._config.blockAdd) {
167
+ console.warn('[BlockEditor] Config "blockAdd" is not defined');
168
+ return;
169
+ }
170
+ block = this._createBlock(block);
171
+ this._config.blockAdd(block)
172
+ .pipe(takeUntil(this._destroy$))
173
+ .subscribe((newBlock) => {
174
+ this._appendBlock(newBlock);
175
+ });
176
+ }
177
+ blockUpload(block, fsFile) {
178
+ if (!this._config.blockUpload) {
179
+ console.warn('[BlockEditor] Config "blockUpload" is not defined');
180
+ return;
181
+ }
182
+ const existing = this.blockExists(block);
183
+ block = this._createBlock(block);
184
+ from(fsFile.imageInfo)
185
+ .pipe(switchMap((imageInfo) => {
186
+ if (!existing && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.height) && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.width)) {
187
+ const ratio = imageInfo.height / imageInfo.width;
188
+ block.width = this._config.width * .4;
189
+ block.height = block.width * ratio;
190
+ }
191
+ return this._config.blockUpload(block, fsFile.file);
192
+ }), takeUntil(this._destroy$))
193
+ .subscribe((newBlock) => {
194
+ if (!existing) {
195
+ this._appendBlock(newBlock);
196
+ }
197
+ });
198
+ }
199
+ blockChange(block) {
200
+ this._dispatchEvent(EventType.Change, block);
201
+ }
202
+ blockRemove(targetBlocks) {
203
+ const blocks = this.blocks;
204
+ if (!Array.isArray(targetBlocks)) {
205
+ targetBlocks = [targetBlocks];
206
+ }
207
+ targetBlocks.forEach((block) => {
208
+ const index = blocks
209
+ .findIndex((b) => b.guid === block.guid);
210
+ if (index !== -1) {
211
+ blocks.splice(index, 1);
212
+ this._dispatchEvent(EventType.Remove, block);
213
+ }
214
+ });
215
+ this._setBlocks(blocks);
216
+ }
217
+ isReordableBlock(block) {
218
+ return [
219
+ BlockType.LongText,
220
+ BlockType.ShortText,
221
+ BlockType.RadioButton,
222
+ BlockType.Checkbox,
223
+ BlockType.Date,
224
+ BlockType.Signature,
225
+ ].indexOf(block.type) > -1;
226
+ }
227
+ updateTabIndex(index) {
228
+ this._lastTabIndex = index;
229
+ }
230
+ _setBlocks(blocks) {
231
+ this._blocks$.next([...blocks]);
232
+ blocks
233
+ .filter((b) => this.isReordableBlock(b))
234
+ .forEach((b) => {
235
+ this._lastTabIndex = Math.max(b.tabIndex, this._lastTabIndex);
236
+ });
237
+ }
238
+ _appendBlock(block) {
239
+ const blocks = [
240
+ ...this.blocks,
241
+ block,
242
+ ];
243
+ this._deduplicateIndexesFor(blocks);
244
+ this._setBlocks(blocks);
245
+ this._dispatchEvent(EventType.Add, block);
246
+ }
247
+ _dispatchEvent(type, value) {
248
+ this._eventBus$.next({
249
+ type,
250
+ value,
251
+ });
252
+ }
253
+ _createBlock(block) {
254
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
255
+ let newBlock = Object.assign(Object.assign({}, block), { shapeBottomLeft: (_a = block.shapeBottomLeft) !== null && _a !== void 0 ? _a : 'round', shapeTopLeft: (_b = block.shapeTopLeft) !== null && _b !== void 0 ? _b : 'round', shapeTopRight: (_c = block.shapeTopRight) !== null && _c !== void 0 ? _c : 'round', shapeBottomRight: (_d = block.shapeBottomRight) !== null && _d !== void 0 ? _d : 'round', verticalAlign: (_e = block.verticalAlign) !== null && _e !== void 0 ? _e : 'top', horizontalAlign: (_f = block.horizontalAlign) !== null && _f !== void 0 ? _f : 'left', guid: block.guid || guid('xxxxxxxxxxxx'), keepRatio: (_g = block.keepRatio) !== null && _g !== void 0 ? _g : [
256
+ BlockType.Checkbox,
257
+ BlockType.RadioButton,
258
+ BlockType.Pdf,
259
+ ]
260
+ .indexOf(block.type) !== -1 });
261
+ let width = (this._config.width * .333).toFixed(2);
262
+ let height = width / 2;
263
+ if (newBlock.type === BlockType.Rectangle) {
264
+ newBlock = Object.assign(Object.assign({}, newBlock), { borderColor: (_h = newBlock.borderColor) !== null && _h !== void 0 ? _h : '#cccccc', borderWidth: (_j = newBlock.borderWidth) !== null && _j !== void 0 ? _j : 1 });
265
+ }
266
+ else if (newBlock.type === BlockType.Checkbox || newBlock.type === BlockType.RadioButton) {
267
+ width = .25;
268
+ height = .25;
269
+ }
270
+ else {
271
+ width = 2;
272
+ height = .5;
273
+ }
274
+ if (this.isReordableBlock(newBlock)) {
275
+ newBlock.tabIndex = this._lastTabIndex + 1;
276
+ this.updateTabIndex(newBlock.tabIndex);
277
+ }
278
+ return Object.assign({ top: height, left: width, width,
279
+ height }, newBlock);
280
+ }
281
+ _deduplicateIndexesFor(blocks) {
282
+ blocks.forEach((block, index) => {
283
+ block.index = index;
284
+ });
285
+ }
286
+ }
287
+ BlocksStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
288
+ BlocksStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore });
289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore, decorators: [{
290
+ type: Injectable
291
+ }] });
292
+
293
+ class BlockEditorService {
294
+ constructor(_store, _dialog) {
295
+ this._store = _store;
296
+ this._dialog = _dialog;
297
+ this._selectedBlocks$ = new BehaviorSubject([]);
298
+ this._blockComponents = new Map();
299
+ this._blockClippable$ = new BehaviorSubject(null);
300
+ this._destroy$ = new Subject();
301
+ this._blockInited$ = new Subject();
302
+ }
303
+ get blockComponents() {
304
+ return Array.from(this._blockComponents.values());
305
+ }
306
+ get selectedComponentBlocks() {
307
+ return this.blockComponents
308
+ .filter((blockComponent) => this.selectedBlocks.indexOf(blockComponent.block) !== -1);
309
+ }
310
+ init(config) {
311
+ this.config = config;
312
+ this._store.init(Object.assign({}, this.config));
313
+ }
314
+ blockAdd(block) {
315
+ this._store.blockAdd(block);
316
+ }
317
+ blockUpload(block, fsFile) {
318
+ this._store.blockUpload(block, fsFile);
319
+ }
320
+ blockRemove(block) {
321
+ this._store.blockRemove(block);
322
+ }
323
+ removeSelectedBlocks() {
324
+ this.selectedBlocks
325
+ .forEach((block) => {
326
+ this.blockRemove(block);
327
+ });
328
+ this.selectedBlocks = [];
329
+ }
330
+ get blocks$() {
331
+ return this._store.blocks$;
332
+ }
333
+ get blockChanged$() {
334
+ return this._store.blockChanged$;
335
+ }
336
+ get blockClippable$() {
337
+ return this._blockClippable$;
338
+ }
339
+ set blockClippable(value) {
340
+ this._blockClippable$.next(value);
341
+ }
342
+ get blockAdded$() {
343
+ return this._store.blockAdded$;
344
+ }
345
+ get blockInited$() {
346
+ return this._blockInited$;
347
+ }
348
+ get blockRemoved$() {
349
+ return this._store.blockRemoved$;
350
+ }
351
+ get blocks() {
352
+ return this._store.blocks;
353
+ }
354
+ blockChange(block) {
355
+ this._store.blockChange(block);
356
+ }
357
+ isSelectedBlock(block) {
358
+ return this.selectedBlocks.indexOf(block.block) !== -1;
359
+ }
360
+ indexOf(block) {
361
+ return this.blocks.map((e) => e.guid).indexOf(block.guid);
362
+ }
363
+ selectedBlockComponentChangeProperty(value, name) {
364
+ this.selectedBlocks
365
+ .forEach((block) => {
366
+ block[name] = value;
367
+ this.blockChange(block);
368
+ });
369
+ }
370
+ get selectedBlocks$() {
371
+ return this._selectedBlocks$;
372
+ }
373
+ set selectedBlock(block) {
374
+ this.selectedBlocks = [block];
375
+ }
376
+ set selectedBlocks(blocks) {
377
+ this.blockComponents
378
+ .forEach((blockComponent) => {
379
+ if (blocks.indexOf(blockComponent.block) !== -1) {
380
+ blockComponent.select();
381
+ }
382
+ else {
383
+ blockComponent.deselect();
384
+ }
385
+ });
386
+ this._selectedBlocks$.next(blocks);
387
+ if (this.config.blocksSelected) {
388
+ this.config.blocksSelected(blocks);
389
+ }
390
+ }
391
+ get selectedBlocks() {
392
+ return this._selectedBlocks$.getValue();
393
+ }
394
+ saveSelection() {
395
+ const selection = window.getSelection();
396
+ this._selectionRange = selection.getRangeAt(0);
397
+ }
398
+ restoreSelection() {
399
+ if (this._selectionRange) {
400
+ const selection = window.getSelection();
401
+ selection.removeAllRanges();
402
+ selection.addRange(this._selectionRange);
403
+ }
404
+ }
405
+ hasSelectionRange() {
406
+ return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
407
+ }
408
+ initBlock(block, blockComponent) {
409
+ this._blockComponents.set(block, blockComponent);
410
+ this._blockInited$.next(block);
411
+ }
412
+ destroyBlock(block) {
413
+ this._blockComponents.delete(block);
414
+ }
415
+ registerContainer(container) {
416
+ this.container = container;
417
+ }
418
+ registerMargin(margin) {
419
+ this.margin = margin;
420
+ }
421
+ openReorderDialog() {
422
+ const blockComponents = this.blockComponents
423
+ .sort((blockCmpA, blockCmpB) => (blockCmpA.block.index - blockCmpB.block.index))
424
+ .reverse();
425
+ this._dialog
426
+ .open(LayersReorderDialogComponent, {
427
+ data: {
428
+ blockComponents,
429
+ }
430
+ })
431
+ .afterClosed()
432
+ .pipe(filter((blockComponents) => !!blockComponents), takeUntil(this._destroy$))
433
+ .subscribe((blockComponents) => {
434
+ blockComponents
435
+ .reverse()
436
+ .forEach((blockCmp, index) => {
437
+ blockCmp.block.index = index;
438
+ this._store.blockChange(blockCmp.block);
439
+ this._store.updateTabIndex(index);
440
+ });
441
+ });
442
+ }
443
+ ngOnDestroy() {
444
+ this._destroy$.next();
445
+ this._destroy$.complete();
446
+ }
447
+ }
448
+ BlockEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, deps: [{ token: BlocksStore }, { token: i2.FsDialog }], target: i0.ɵɵFactoryTarget.Injectable });
449
+ BlockEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService });
450
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, decorators: [{
451
+ type: Injectable
454
452
  }], ctorParameters: function () { return [{ type: BlocksStore }, { type: i2.FsDialog }]; } });
455
453
 
456
- class GoogleFontService {
457
- constructor(httpClient) {
458
- this.httpClient = httpClient;
459
- this._apiKey = 'AIzaSyAoT2RLzCSFUb148F4uLXyAuquAzjcjyGk';
460
- }
461
- loadFont(font) {
462
- var link = document.createElement('link');
463
- link.rel = 'stylesheet';
464
- link.href = `https://fonts.googleapis.com/css2?family=${font.family}&family=Tangerine&display=swap`;
465
- document.getElementsByTagName('head')[0].appendChild(link);
466
- }
467
- getItems() {
468
- if (this._fonts$) {
469
- return this._fonts$.asObservable();
470
- }
471
- if (!this._apiKey) {
472
- return throwError(`Error: api key was not provided to the google fonts service`);
473
- }
474
- const url = `https://www.googleapis.com/webfonts/v1/webfonts?key=${this._apiKey}`;
475
- return this.httpClient.get(url)
476
- .pipe(map((response) => response.items
477
- .map((item) => {
478
- return { family: item.family };
479
- })));
480
- }
481
- }
482
- GoogleFontService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: GoogleFontService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
483
- GoogleFontService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: GoogleFontService });
484
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: GoogleFontService, decorators: [{
485
- type: Injectable
454
+ class GoogleFontService {
455
+ constructor(httpClient) {
456
+ this.httpClient = httpClient;
457
+ this._apiKey = 'AIzaSyAoT2RLzCSFUb148F4uLXyAuquAzjcjyGk';
458
+ }
459
+ loadFont(font) {
460
+ var link = document.createElement('link');
461
+ link.rel = 'stylesheet';
462
+ link.href = `https://fonts.googleapis.com/css2?family=${font.family}&family=Tangerine&display=swap`;
463
+ document.getElementsByTagName('head')[0].appendChild(link);
464
+ }
465
+ getItems() {
466
+ if (this._fonts$) {
467
+ return this._fonts$.asObservable();
468
+ }
469
+ if (!this._apiKey) {
470
+ return throwError(`Error: api key was not provided to the google fonts service`);
471
+ }
472
+ const url = `https://www.googleapis.com/webfonts/v1/webfonts?key=${this._apiKey}`;
473
+ return this.httpClient.get(url)
474
+ .pipe(map((response) => response.items
475
+ .map((item) => {
476
+ return { family: item.family };
477
+ })));
478
+ }
479
+ }
480
+ GoogleFontService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: GoogleFontService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
481
+ GoogleFontService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: GoogleFontService });
482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: GoogleFontService, decorators: [{
483
+ type: Injectable
486
484
  }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
487
485
 
488
- class FsBlockComponent {
489
- constructor(_blockEditor, _elementRef, _cdRef, _googleFontService) {
490
- this._blockEditor = _blockEditor;
491
- this._elementRef = _elementRef;
492
- this._cdRef = _cdRef;
493
- this._googleFontService = _googleFontService;
494
- this.transformating = false;
495
- this.BlockType = BlockType;
496
- this._editable = false;
497
- this._transformable = false;
498
- this._destroy$ = new Subject();
499
- }
500
- get el() {
501
- return this.element.nativeElement;
502
- }
503
- get moveable() {
504
- return this._moveable;
505
- }
506
- get editable() {
507
- return this._editable;
508
- }
509
- get styleTop() {
510
- let top = this.block.top;
511
- return `${top}${this.unit}`;
512
- }
513
- get styleLeft() {
514
- let left = this.block.left;
515
- return `${left}${this.unit}`;
516
- }
517
- get styleWidth() {
518
- let width = this.block.width;
519
- if (this.block.clipPath) {
520
- width -= (this.block.width * this.block.clipPath.values[1] / 100) + (this.block.width * this.block.clipPath.values[3] / 100);
521
- }
522
- return `${width}${this.unit}`;
523
- }
524
- get styleHeight() {
525
- let height = this.block.height;
526
- if (this.block.clipPath) {
527
- height -= (this.block.height * this.block.clipPath.values[0] / 100) + (this.block.height * this.block.clipPath.values[2] / 100);
528
- }
529
- return `${height}${this.unit}`;
530
- }
531
- get styleImageHeight() {
532
- let height = this.block.height;
533
- if (this.block.clipPath) {
534
- const values = this.block.clipPath.values || {};
535
- //height += (values[0]/100 * height) + (values[2]/100 * height);
536
- }
537
- return `${height}${this.unit}`;
538
- }
539
- get styleImageWidth() {
540
- let width = this.block.width;
541
- if (this.block.clipPath) {
542
- const values = this.block.clipPath.values || {};
543
- //width += (values[1]/100 * width) + (values[3]/100 * width);
544
- }
545
- return `${width}${this.unit}`;
546
- }
547
- get styleImageTop() {
548
- let top = 0;
549
- if (this.block.clipPath) {
550
- const values = this.block.clipPath.values || {};
551
- top = (values[0] / 100) * this.block.width * -1;
552
- }
553
- return `${top}${this.unit}`;
554
- }
555
- get styleImageLeft() {
556
- let left = 0;
557
- if (this.block.clipPath) {
558
- const values = this.block.clipPath.values || {};
559
- left = (values[3] / 100) * this.block.width * -1;
560
- }
561
- return `${left}${this.unit}`;
562
- }
563
- get styleClipPath() {
564
- if (!this.block.clipPath) {
565
- return null;
566
- }
567
- const values = this.block.clipPath.values || {};
568
- const top = values[0] / 100 * this.block.height;
569
- const right = (values[1]) / 100 * this.block.width;
570
- const bottom = (values[2]) / 100 * this.block.height;
571
- const left = values[3] / 100 * this.block.width;
572
- const clipPath = `inset(${top}${this.unit} ${right}${this.unit} ${bottom}${this.unit} ${left}${this.unit})`;
573
- return clipPath;
574
- }
575
- get styleBoxShadow() {
576
- if (!this.block.shadowColor) {
577
- return null;
578
- }
579
- const shadow = `${this.block.shadowX}pt ${(this.block.shadowY || 0)}pt ${(this.block.shadowBlur || 0)}pt ${(this.block.shadowSpread || 0)}pt ${this.block.shadowColor}`;
580
- return shadow;
581
- }
582
- set elementGuidelines(value) {
583
- this.moveable.elementGuidelines = value;
584
- }
585
- set editable(value) {
586
- this._editable = value;
587
- if (!value) {
588
- this.deselectContent();
589
- }
590
- }
591
- get clippable() {
592
- return !!this.moveable.clippable;
593
- }
594
- set clippable(value) {
595
- this.moveable.clippable = value;
596
- if (this.selected) {
597
- this.moveable.resizable = !value;
598
- this.moveable.rotatable = !value;
599
- this.moveable.scalable = !value;
600
- }
601
- }
602
- get transformable() {
603
- return this._transformable;
604
- }
605
- set transformable(value) {
606
- if (this.block.lock) {
607
- value = false;
608
- }
609
- this._transformable = value;
610
- this.moveable.resizable = value;
611
- this.moveable.rotatable = value;
612
- this.moveable.scalable = value;
613
- }
614
- set rotate(value) {
615
- this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
616
- this.moveable.updateRect();
617
- }
618
- set index(value) {
619
- this.block.index = value;
620
- }
621
- set keepRatio(value) {
622
- this.moveable.keepRatio = value;
623
- }
624
- markForCheck() {
625
- this._cdRef.markForCheck();
626
- }
627
- ngOnInit() {
628
- this.unit = this._blockEditor.config.unit;
629
- this.content = this.block.content;
630
- this.block.shadowOpacity = this.block.shadowOpacity || 100;
631
- this._initFonts();
632
- this._blockEditor.selectedBlocks$
633
- .pipe(takeUntil(this._destroy$))
634
- .subscribe((blocks) => {
635
- this.selected = blocks.includes(this.block);
636
- this._cdRef.markForCheck();
637
- });
638
- this._blockEditor.blockClippable$
639
- .pipe(filter(() => this.selected), takeUntil(this._destroy$))
640
- .subscribe((clippable) => {
641
- this.clippable = clippable;
642
- this._cdRef.markForCheck();
643
- });
644
- this._blockEditor.blockAdded$
645
- .pipe(takeUntil(this._destroy$))
646
- .subscribe(() => {
647
- this._cdRef.markForCheck();
648
- });
649
- this._blockEditor.blockChanged$
650
- .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
651
- .subscribe((block) => {
652
- this.keepRatio = block.keepRatio;
653
- this.rotate = this.block.rotate;
654
- this._updateMoveable();
655
- this._cdRef.markForCheck();
656
- });
657
- }
658
- ngAfterContentInit() {
659
- setTimeout(() => {
660
- this._initEvents();
661
- this._initMoveable();
662
- this._setTransform();
663
- this.rotate = this.block.rotate;
664
- this._blockEditor.initBlock(this.block, this);
665
- this._blockEditor.blockInited$
666
- .pipe(takeUntil(this._destroy$))
667
- .subscribe(() => {
668
- this._updateElementGuidelines();
669
- });
670
- });
671
- }
672
- pxToIn(px) {
673
- return this.round(px / 96, 2);
674
- }
675
- round(value, decimals) {
676
- return parseFloat(value.toFixed(decimals));
677
- }
678
- select() {
679
- this.transformable = true;
680
- }
681
- deselect() {
682
- this.editable = false;
683
- this.clippable = false;
684
- this.transformable = false;
685
- this.disableContentEdit();
686
- }
687
- disableContentEdit() {
688
- this.editable = false;
689
- }
690
- deselectContent() {
691
- if (window.getSelection) {
692
- if (window.getSelection().empty) {
693
- window.getSelection().empty();
694
- }
695
- else if (window.getSelection().removeAllRanges) {
696
- window.getSelection().removeAllRanges();
697
- }
698
- }
699
- }
700
- selectAll() {
701
- const range = document.createRange();
702
- range.selectNodeContents(this.contentEditable.nativeElement);
703
- const sel = window.getSelection();
704
- sel.removeAllRanges();
705
- sel.addRange(range);
706
- }
707
- ngOnDestroy() {
708
- this._blockEditor.destroyBlock(this.block);
709
- this._destroy$.next();
710
- this._destroy$.complete();
711
- }
712
- _setTransform(transforms = []) {
713
- transforms = transforms !== null && transforms !== void 0 ? transforms : [];
714
- this.el.style.transform = transforms.join(' ');
715
- }
716
- _triggerChanged() {
717
- this._blockEditor.blockChange(this.block);
718
- }
719
- _updateElementGuidelines() {
720
- this.moveable.elementGuidelines = this._blockEditor.blockComponents
721
- .map((blockComponent) => blockComponent.el)
722
- .filter((el) => !el.isSameNode(this.el));
723
- }
724
- _updateMoveable() {
725
- this._moveable.draggable = !this.block.lock;
726
- if (this.selected) {
727
- this._moveable.resizable = !this.block.lock;
728
- this._moveable.rotatable = !this.block.lock;
729
- }
730
- }
731
- _initMoveable() {
732
- this._moveable = new Moveable(this._elementRef.nativeElement, {
733
- target: this.el,
734
- container: this._blockEditor.container,
735
- draggable: true,
736
- resizable: false,
737
- scalable: false,
738
- rotatable: false,
739
- warpable: false,
740
- origin: false,
741
- clipRelative: true,
742
- clipArea: true,
743
- keepRatio: this.block.keepRatio,
744
- snappable: true,
745
- snapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
746
- elementSnapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
747
- edge: false,
748
- throttleDrag: 1,
749
- throttleScale: 0.01,
750
- throttleRotate: 1,
751
- throttleResize: 1,
752
- snapDistFormat: (v, type) => `${this.round(v / 96, 2)}`,
753
- });
754
- this._updateElementGuidelines();
755
- this._updateMoveable();
756
- this.moveable
757
- .on('clip', (e) => {
758
- this.moveable.keepRatio = false;
759
- e.target.style.clipPath = e.clipStyle;
760
- this.block.clipPath = {
761
- type: 'inset',
762
- values: e.clipStyles
763
- .map((value) => {
764
- const number = Number(value.replace('%', ''));
765
- return number > 0 ? number : 0;
766
- }),
767
- };
768
- })
769
- .on('clipEnd', (e) => {
770
- this.moveable.keepRatio = true;
771
- e.target.style.clipPath = null;
772
- this._triggerChanged();
773
- setTimeout(() => {
774
- this.moveable.updateRect();
775
- }, 100);
776
- })
777
- .on('dragStart', () => {
778
- this.disableContentEdit();
779
- this.transformating = true;
780
- this._cdRef.markForCheck();
781
- })
782
- .on('drag', ({ target, left, top }) => {
783
- target.style.left = this.pxToIn(left) + this.unit;
784
- target.style.top = this.pxToIn(top) + this.unit;
785
- this.block.top = this.pxToIn(top);
786
- this.block.left = this.pxToIn(left);
787
- })
788
- .on('dragEnd', () => {
789
- this.transformating = false;
790
- this._triggerChanged();
791
- this._cdRef.markForCheck();
792
- })
793
- .on('resizeStart', () => {
794
- this.disableContentEdit();
795
- this.zoompan.disable();
796
- this.transformating = true;
797
- this._cdRef.markForCheck();
798
- })
799
- .on('resize', ({ target, width, height, dist, delta, direction }) => {
800
- width = this.pxToIn(width);
801
- height = this.pxToIn(height);
802
- if (delta[0]) {
803
- this.block.width = width;
804
- target.style.width = width + this.unit;
805
- }
806
- if (delta[1]) {
807
- this.block.height = height;
808
- target.style.height = height + this.unit;
809
- }
810
- const transform = [0, 0];
811
- if (direction[1] === -1) {
812
- transform[1] = dist[1] * -1;
813
- }
814
- if (direction[0] === -1) {
815
- transform[0] = dist[0] * -1;
816
- }
817
- this._setTransform([`translate(${transform[0]}px, ${transform[1]}px)`]);
818
- })
819
- .on('resizeEnd', ({ target }) => {
820
- const matrix = new WebKitCSSMatrix(target.style.transform);
821
- this.block.top = parseFloat(target.style.top) + this.pxToIn(matrix.m42);
822
- this.block.left = parseFloat(target.style.left) + this.pxToIn(matrix.m41);
823
- this._setTransform();
824
- this._triggerChanged();
825
- this.zoompan.enable();
826
- this.transformating = false;
827
- this._cdRef.markForCheck();
828
- target.style.top = `${this.block.top}in`;
829
- target.style.left = `${this.block.left}in`;
830
- target.style.width = `${this.block.width}in`;
831
- target.style.height = `${this.block.height}in`;
832
- this.moveable.updateRect();
833
- })
834
- .on('rotateStart', ({ inputEvent }) => {
835
- if (inputEvent) {
836
- this.zoompan.disable();
837
- this.disableContentEdit();
838
- this.transformating = true;
839
- this._cdRef.markForCheck();
840
- }
841
- })
842
- .on('rotate', ({ inputEvent, transform, rotation }) => {
843
- this.el.style.transform = transform;
844
- this.block.rotate = rotation % 360;
845
- if (inputEvent) {
846
- this.zoompan.enable();
847
- }
848
- })
849
- .on('rotateEnd', ({ inputEvent }) => {
850
- if (inputEvent) {
851
- this.transformating = false;
852
- this._cdRef.markForCheck();
853
- this._triggerChanged();
854
- }
855
- });
856
- }
857
- _initEvents() {
858
- fromEvent(this.contentEditable.nativeElement, 'paste')
859
- .pipe(takeUntil(this._destroy$))
860
- .subscribe((e) => {
861
- e.preventDefault();
862
- const clipboardData = e.clipboardData;
863
- const text = clipboardData.getData('Text');
864
- ;
865
- const range = document.getSelection().getRangeAt(0);
866
- range.deleteContents();
867
- const textNode = document.createTextNode(text);
868
- range.insertNode(textNode);
869
- range.selectNodeContents(textNode);
870
- range.collapse(false);
871
- const selection = window.getSelection();
872
- selection.removeAllRanges();
873
- selection.addRange(range);
874
- this.block.content = this.contentEditable.nativeElement.innerHTML;
875
- this._triggerChanged();
876
- });
877
- fromEvent(this.contentEditable.nativeElement, 'input')
878
- .pipe(takeUntil(this._destroy$)).subscribe((event) => {
879
- this.block.content = event.target.innerHTML;
880
- this._triggerChanged();
881
- });
882
- fromEvent(this.el, 'mousedown')
883
- .pipe(takeUntil(this._destroy$)).subscribe((event) => {
884
- if (!this.block.lock) {
885
- this.zoompan.disable();
886
- }
887
- if (!this.moveable.clippable) {
888
- if (this.editable) {
889
- if (this.contentElement.nativeElement.isSameNode(event.target)) {
890
- event.preventDefault();
891
- event.stopImmediatePropagation();
892
- event.stopPropagation();
893
- }
894
- }
895
- else {
896
- this._blockEditor.selectedBlock = this.block;
897
- }
898
- }
899
- });
900
- fromEvent(this.el, 'mouseup')
901
- .pipe(takeUntil(this._destroy$)).subscribe(() => {
902
- this.zoompan.enable();
903
- });
904
- fromEvent(this.el, 'dblclick')
905
- .pipe(filter(() => (!this.editable)), takeUntil(this._destroy$))
906
- .subscribe((event) => {
907
- if (this.block.readonly) {
908
- event.preventDefault();
909
- }
910
- else {
911
- this.editable = true;
912
- this._cdRef.markForCheck();
913
- setTimeout(() => {
914
- this.selectAll();
915
- });
916
- }
917
- });
918
- }
919
- _initFonts() {
920
- if (this.block.fontFamily) {
921
- this._googleFontService.loadFont({ family: this.block.fontFamily });
922
- }
923
- }
924
- }
925
- FsBlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: GoogleFontService }], target: i0.ɵɵFactoryTarget.Component });
926
- FsBlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { 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 [ngSwitch]=\"block.type\">\n <ng-container *ngIf=\"block.imageUrl\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"block.imageUrl\">\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\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;margin:-1px}.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;top:0;left:0;bottom:0;right:0}.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: i13.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
927
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, decorators: [{
928
- type: Component,
929
- args: [{
930
- selector: 'fs-block',
931
- templateUrl: 'block.component.html',
932
- styleUrls: ['block.component.scss'],
933
- changeDetection: ChangeDetectionStrategy.OnPush,
934
- }]
935
- }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: GoogleFontService }]; }, propDecorators: { element: [{
936
- type: ViewChild,
937
- args: ['element', { static: true }]
938
- }], contentElement: [{
939
- type: ViewChild,
940
- args: ['contentElement', { static: true }]
941
- }], contentEditable: [{
942
- type: ViewChild,
943
- args: ['contentEditable', { static: true }]
944
- }], block: [{
945
- type: Input
946
- }], html: [{
947
- type: Input
948
- }], zoompan: [{
949
- type: Input
950
- }], transformating: [{
951
- type: HostBinding,
952
- args: ['class.transforming']
486
+ class FsBlockComponent {
487
+ constructor(_blockEditor, _elementRef, _cdRef, _googleFontService) {
488
+ this._blockEditor = _blockEditor;
489
+ this._elementRef = _elementRef;
490
+ this._cdRef = _cdRef;
491
+ this._googleFontService = _googleFontService;
492
+ this.transformating = false;
493
+ this.BlockType = BlockType;
494
+ this._editable = false;
495
+ this._transformable = false;
496
+ this._destroy$ = new Subject();
497
+ }
498
+ get el() {
499
+ return this.element.nativeElement;
500
+ }
501
+ get moveable() {
502
+ return this._moveable;
503
+ }
504
+ get editable() {
505
+ return this._editable;
506
+ }
507
+ get styleTop() {
508
+ let top = this.block.top;
509
+ return `${top}${this.unit}`;
510
+ }
511
+ get styleLeft() {
512
+ let left = this.block.left;
513
+ return `${left}${this.unit}`;
514
+ }
515
+ get styleWidth() {
516
+ let width = this.block.width;
517
+ if (this.block.clipPath) {
518
+ width -= (this.block.width * this.block.clipPath.values[1] / 100) + (this.block.width * this.block.clipPath.values[3] / 100);
519
+ }
520
+ return `${width}${this.unit}`;
521
+ }
522
+ get styleHeight() {
523
+ let height = this.block.height;
524
+ if (this.block.clipPath) {
525
+ height -= (this.block.height * this.block.clipPath.values[0] / 100) + (this.block.height * this.block.clipPath.values[2] / 100);
526
+ }
527
+ return `${height}${this.unit}`;
528
+ }
529
+ get styleImageHeight() {
530
+ let height = this.block.height;
531
+ if (this.block.clipPath) {
532
+ const values = this.block.clipPath.values || {};
533
+ //height += (values[0]/100 * height) + (values[2]/100 * height);
534
+ }
535
+ return `${height}${this.unit}`;
536
+ }
537
+ get styleImageWidth() {
538
+ let width = this.block.width;
539
+ if (this.block.clipPath) {
540
+ const values = this.block.clipPath.values || {};
541
+ //width += (values[1]/100 * width) + (values[3]/100 * width);
542
+ }
543
+ return `${width}${this.unit}`;
544
+ }
545
+ get styleImageTop() {
546
+ let top = 0;
547
+ if (this.block.clipPath) {
548
+ const values = this.block.clipPath.values || {};
549
+ top = (values[0] / 100) * this.block.width * -1;
550
+ }
551
+ return `${top}${this.unit}`;
552
+ }
553
+ get styleImageLeft() {
554
+ let left = 0;
555
+ if (this.block.clipPath) {
556
+ const values = this.block.clipPath.values || {};
557
+ left = (values[3] / 100) * this.block.width * -1;
558
+ }
559
+ return `${left}${this.unit}`;
560
+ }
561
+ get styleClipPath() {
562
+ if (!this.block.clipPath) {
563
+ return null;
564
+ }
565
+ const values = this.block.clipPath.values || {};
566
+ const top = values[0] / 100 * this.block.height;
567
+ const right = (values[1]) / 100 * this.block.width;
568
+ const bottom = (values[2]) / 100 * this.block.height;
569
+ const left = values[3] / 100 * this.block.width;
570
+ const clipPath = `inset(${top}${this.unit} ${right}${this.unit} ${bottom}${this.unit} ${left}${this.unit})`;
571
+ return clipPath;
572
+ }
573
+ get styleBoxShadow() {
574
+ if (!this.block.shadowColor) {
575
+ return null;
576
+ }
577
+ const shadow = `${this.block.shadowX}pt ${(this.block.shadowY || 0)}pt ${(this.block.shadowBlur || 0)}pt ${(this.block.shadowSpread || 0)}pt ${this.block.shadowColor}`;
578
+ return shadow;
579
+ }
580
+ set elementGuidelines(value) {
581
+ this.moveable.elementGuidelines = value;
582
+ }
583
+ set editable(value) {
584
+ this._editable = value;
585
+ if (!value) {
586
+ this.deselectContent();
587
+ }
588
+ }
589
+ get clippable() {
590
+ return !!this.moveable.clippable;
591
+ }
592
+ set clippable(value) {
593
+ this.moveable.clippable = value;
594
+ if (this.selected) {
595
+ this.moveable.resizable = !value;
596
+ this.moveable.rotatable = !value;
597
+ this.moveable.scalable = !value;
598
+ }
599
+ }
600
+ get transformable() {
601
+ return this._transformable;
602
+ }
603
+ set transformable(value) {
604
+ if (this.block.lock) {
605
+ value = false;
606
+ }
607
+ this._transformable = value;
608
+ this.moveable.resizable = value;
609
+ this.moveable.rotatable = value;
610
+ this.moveable.scalable = value;
611
+ }
612
+ set rotate(value) {
613
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
614
+ this.moveable.updateRect();
615
+ }
616
+ set index(value) {
617
+ this.block.index = value;
618
+ }
619
+ set keepRatio(value) {
620
+ this.moveable.keepRatio = value;
621
+ }
622
+ markForCheck() {
623
+ this._cdRef.markForCheck();
624
+ }
625
+ ngOnInit() {
626
+ this.unit = this._blockEditor.config.unit;
627
+ this.content = this.block.content;
628
+ this.block.shadowOpacity = this.block.shadowOpacity || 100;
629
+ this._initFonts();
630
+ this._blockEditor.selectedBlocks$
631
+ .pipe(takeUntil(this._destroy$))
632
+ .subscribe((blocks) => {
633
+ this.selected = blocks.includes(this.block);
634
+ this._cdRef.markForCheck();
635
+ });
636
+ this._blockEditor.blockClippable$
637
+ .pipe(filter(() => this.selected), takeUntil(this._destroy$))
638
+ .subscribe((clippable) => {
639
+ this.clippable = clippable;
640
+ this._cdRef.markForCheck();
641
+ });
642
+ this._blockEditor.blockAdded$
643
+ .pipe(takeUntil(this._destroy$))
644
+ .subscribe(() => {
645
+ this._cdRef.markForCheck();
646
+ });
647
+ this._blockEditor.blockChanged$
648
+ .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
649
+ .subscribe((block) => {
650
+ this.keepRatio = block.keepRatio;
651
+ this.rotate = this.block.rotate;
652
+ this._updateMoveable();
653
+ this._cdRef.markForCheck();
654
+ });
655
+ }
656
+ ngAfterContentInit() {
657
+ setTimeout(() => {
658
+ this._initEvents();
659
+ this._initMoveable();
660
+ this._setTransform();
661
+ this.rotate = this.block.rotate;
662
+ this._blockEditor.initBlock(this.block, this);
663
+ this._blockEditor.blockInited$
664
+ .pipe(takeUntil(this._destroy$))
665
+ .subscribe(() => {
666
+ this._updateElementGuidelines();
667
+ });
668
+ });
669
+ }
670
+ pxToIn(px) {
671
+ return this.round(px / 96, 2);
672
+ }
673
+ round(value, decimals) {
674
+ return parseFloat(value.toFixed(decimals));
675
+ }
676
+ select() {
677
+ this.transformable = true;
678
+ }
679
+ deselect() {
680
+ this.editable = false;
681
+ this.clippable = false;
682
+ this.transformable = false;
683
+ this.disableContentEdit();
684
+ }
685
+ disableContentEdit() {
686
+ this.editable = false;
687
+ }
688
+ deselectContent() {
689
+ if (window.getSelection) {
690
+ if (window.getSelection().empty) {
691
+ window.getSelection().empty();
692
+ }
693
+ else if (window.getSelection().removeAllRanges) {
694
+ window.getSelection().removeAllRanges();
695
+ }
696
+ }
697
+ }
698
+ selectAll() {
699
+ const range = document.createRange();
700
+ range.selectNodeContents(this.contentEditable.nativeElement);
701
+ const sel = window.getSelection();
702
+ sel.removeAllRanges();
703
+ sel.addRange(range);
704
+ }
705
+ ngOnDestroy() {
706
+ this._blockEditor.destroyBlock(this.block);
707
+ this._destroy$.next();
708
+ this._destroy$.complete();
709
+ }
710
+ _setTransform(transforms = []) {
711
+ transforms = transforms !== null && transforms !== void 0 ? transforms : [];
712
+ this.el.style.transform = transforms.join(' ');
713
+ }
714
+ _triggerChanged() {
715
+ this._blockEditor.blockChange(this.block);
716
+ }
717
+ _updateElementGuidelines() {
718
+ this.moveable.elementGuidelines = this._blockEditor.blockComponents
719
+ .map((blockComponent) => blockComponent.el)
720
+ .filter((el) => !el.isSameNode(this.el));
721
+ }
722
+ _updateMoveable() {
723
+ this._moveable.draggable = !this.block.lock;
724
+ if (this.selected) {
725
+ this._moveable.resizable = !this.block.lock;
726
+ this._moveable.rotatable = !this.block.lock;
727
+ }
728
+ }
729
+ _initMoveable() {
730
+ this._moveable = new Moveable(this._elementRef.nativeElement, {
731
+ target: this.el,
732
+ container: this._blockEditor.container,
733
+ draggable: true,
734
+ resizable: false,
735
+ scalable: false,
736
+ rotatable: false,
737
+ warpable: false,
738
+ origin: false,
739
+ clipRelative: true,
740
+ clipArea: true,
741
+ keepRatio: this.block.keepRatio,
742
+ snappable: true,
743
+ snapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
744
+ elementSnapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
745
+ edge: false,
746
+ throttleDrag: 1,
747
+ throttleScale: 0.01,
748
+ throttleRotate: 1,
749
+ throttleResize: 1,
750
+ snapDistFormat: (v, type) => `${this.round(v / 96, 2)}`,
751
+ });
752
+ this._updateElementGuidelines();
753
+ this._updateMoveable();
754
+ this.moveable
755
+ .on('clip', (e) => {
756
+ this.moveable.keepRatio = false;
757
+ e.target.style.clipPath = e.clipStyle;
758
+ this.block.clipPath = {
759
+ type: 'inset',
760
+ values: e.clipStyles
761
+ .map((value) => {
762
+ const number = Number(value.replace('%', ''));
763
+ return number > 0 ? number : 0;
764
+ }),
765
+ };
766
+ })
767
+ .on('clipEnd', (e) => {
768
+ this.moveable.keepRatio = true;
769
+ e.target.style.clipPath = null;
770
+ this._triggerChanged();
771
+ setTimeout(() => {
772
+ this.moveable.updateRect();
773
+ }, 100);
774
+ })
775
+ .on('dragStart', () => {
776
+ this.disableContentEdit();
777
+ this.transformating = true;
778
+ this._cdRef.markForCheck();
779
+ })
780
+ .on('drag', ({ target, left, top }) => {
781
+ target.style.left = this.pxToIn(left) + this.unit;
782
+ target.style.top = this.pxToIn(top) + this.unit;
783
+ this.block.top = this.pxToIn(top);
784
+ this.block.left = this.pxToIn(left);
785
+ })
786
+ .on('dragEnd', () => {
787
+ this.transformating = false;
788
+ this._triggerChanged();
789
+ this._cdRef.markForCheck();
790
+ })
791
+ .on('resizeStart', () => {
792
+ this.disableContentEdit();
793
+ this.zoompan.disable();
794
+ this.transformating = true;
795
+ this._cdRef.markForCheck();
796
+ })
797
+ .on('resize', ({ target, width, height, dist, delta, direction }) => {
798
+ width = this.pxToIn(width);
799
+ height = this.pxToIn(height);
800
+ if (delta[0]) {
801
+ this.block.width = width;
802
+ target.style.width = width + this.unit;
803
+ }
804
+ if (delta[1]) {
805
+ this.block.height = height;
806
+ target.style.height = height + this.unit;
807
+ }
808
+ const transform = [0, 0];
809
+ if (direction[1] === -1) {
810
+ transform[1] = dist[1] * -1;
811
+ }
812
+ if (direction[0] === -1) {
813
+ transform[0] = dist[0] * -1;
814
+ }
815
+ this._setTransform([`translate(${transform[0]}px, ${transform[1]}px)`]);
816
+ })
817
+ .on('resizeEnd', ({ target }) => {
818
+ const matrix = new WebKitCSSMatrix(target.style.transform);
819
+ this.block.top = parseFloat(target.style.top) + this.pxToIn(matrix.m42);
820
+ this.block.left = parseFloat(target.style.left) + this.pxToIn(matrix.m41);
821
+ this._setTransform();
822
+ this._triggerChanged();
823
+ this.zoompan.enable();
824
+ this.transformating = false;
825
+ this._cdRef.markForCheck();
826
+ target.style.top = `${this.block.top}in`;
827
+ target.style.left = `${this.block.left}in`;
828
+ target.style.width = `${this.block.width}in`;
829
+ target.style.height = `${this.block.height}in`;
830
+ this.moveable.updateRect();
831
+ })
832
+ .on('rotateStart', ({ inputEvent }) => {
833
+ if (inputEvent) {
834
+ this.zoompan.disable();
835
+ this.disableContentEdit();
836
+ this.transformating = true;
837
+ this._cdRef.markForCheck();
838
+ }
839
+ })
840
+ .on('rotate', ({ inputEvent, transform, rotation }) => {
841
+ this.el.style.transform = transform;
842
+ this.block.rotate = rotation % 360;
843
+ if (inputEvent) {
844
+ this.zoompan.enable();
845
+ }
846
+ })
847
+ .on('rotateEnd', ({ inputEvent }) => {
848
+ if (inputEvent) {
849
+ this.transformating = false;
850
+ this._cdRef.markForCheck();
851
+ this._triggerChanged();
852
+ }
853
+ });
854
+ }
855
+ _initEvents() {
856
+ fromEvent(this.contentEditable.nativeElement, 'paste')
857
+ .pipe(takeUntil(this._destroy$))
858
+ .subscribe((e) => {
859
+ e.preventDefault();
860
+ const clipboardData = e.clipboardData;
861
+ const text = clipboardData.getData('Text');
862
+ ;
863
+ const range = document.getSelection().getRangeAt(0);
864
+ range.deleteContents();
865
+ const textNode = document.createTextNode(text);
866
+ range.insertNode(textNode);
867
+ range.selectNodeContents(textNode);
868
+ range.collapse(false);
869
+ const selection = window.getSelection();
870
+ selection.removeAllRanges();
871
+ selection.addRange(range);
872
+ this.block.content = this.contentEditable.nativeElement.innerHTML;
873
+ this._triggerChanged();
874
+ });
875
+ fromEvent(this.contentEditable.nativeElement, 'input')
876
+ .pipe(takeUntil(this._destroy$)).subscribe((event) => {
877
+ this.block.content = event.target.innerHTML;
878
+ this._triggerChanged();
879
+ });
880
+ fromEvent(this.el, 'mousedown')
881
+ .pipe(takeUntil(this._destroy$)).subscribe((event) => {
882
+ if (!this.block.lock) {
883
+ this.zoompan.disable();
884
+ }
885
+ if (!this.moveable.clippable) {
886
+ if (this.editable) {
887
+ if (this.contentElement.nativeElement.isSameNode(event.target)) {
888
+ event.preventDefault();
889
+ event.stopImmediatePropagation();
890
+ event.stopPropagation();
891
+ }
892
+ }
893
+ else {
894
+ this._blockEditor.selectedBlock = this.block;
895
+ }
896
+ }
897
+ });
898
+ fromEvent(this.el, 'mouseup')
899
+ .pipe(takeUntil(this._destroy$)).subscribe(() => {
900
+ this.zoompan.enable();
901
+ });
902
+ fromEvent(this.el, 'dblclick')
903
+ .pipe(filter(() => (!this.editable)), takeUntil(this._destroy$))
904
+ .subscribe((event) => {
905
+ if (this.block.readonly) {
906
+ event.preventDefault();
907
+ }
908
+ else {
909
+ this.editable = true;
910
+ this._cdRef.markForCheck();
911
+ setTimeout(() => {
912
+ this.selectAll();
913
+ });
914
+ }
915
+ });
916
+ }
917
+ _initFonts() {
918
+ if (this.block.fontFamily) {
919
+ this._googleFontService.loadFont({ family: this.block.fontFamily });
920
+ }
921
+ }
922
+ }
923
+ FsBlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: GoogleFontService }], target: i0.ɵɵFactoryTarget.Component });
924
+ FsBlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { 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 [ngSwitch]=\"block.type\">\n <ng-container *ngIf=\"block.imageUrl\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"block.imageUrl\">\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\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;margin:-1px}.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;top:0;left:0;bottom:0;right:0}.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: i13.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
925
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, decorators: [{
926
+ type: Component,
927
+ args: [{
928
+ selector: 'fs-block',
929
+ templateUrl: 'block.component.html',
930
+ styleUrls: ['block.component.scss'],
931
+ changeDetection: ChangeDetectionStrategy.OnPush,
932
+ }]
933
+ }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: GoogleFontService }]; }, propDecorators: { element: [{
934
+ type: ViewChild,
935
+ args: ['element', { static: true }]
936
+ }], contentElement: [{
937
+ type: ViewChild,
938
+ args: ['contentElement', { static: true }]
939
+ }], contentEditable: [{
940
+ type: ViewChild,
941
+ args: ['contentEditable', { static: true }]
942
+ }], block: [{
943
+ type: Input
944
+ }], html: [{
945
+ type: Input
946
+ }], zoompan: [{
947
+ type: Input
948
+ }], transformating: [{
949
+ type: HostBinding,
950
+ args: ['class.transforming']
953
951
  }] } });
954
952
 
955
- class FsBlockEditorSidebarPanelDirective {
956
- constructor(templateRef) {
957
- this.templateRef = templateRef;
958
- this.show = true;
959
- }
960
- }
961
- FsBlockEditorSidebarPanelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
962
- FsBlockEditorSidebarPanelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0 });
963
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, decorators: [{
964
- type: Directive,
965
- args: [{
966
- selector: '[fsBlockEditorSidebarPanel]'
967
- }]
968
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { label: [{
969
- type: Input
970
- }], show: [{
971
- type: Input
953
+ class FsBlockEditorSidebarPanelDirective {
954
+ constructor(templateRef) {
955
+ this.templateRef = templateRef;
956
+ this.show = true;
957
+ }
958
+ }
959
+ FsBlockEditorSidebarPanelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
960
+ FsBlockEditorSidebarPanelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0 });
961
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, decorators: [{
962
+ type: Directive,
963
+ args: [{
964
+ selector: '[fsBlockEditorSidebarPanel]'
965
+ }]
966
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { label: [{
967
+ type: Input
968
+ }], show: [{
969
+ type: Input
972
970
  }] } });
973
971
 
974
- class FsBlockEditorMarginDirective {
975
- constructor(_elementRef) {
976
- this._elementRef = _elementRef;
977
- }
978
- get element() {
979
- return this._elementRef.nativeElement;
980
- }
981
- }
982
- FsBlockEditorMarginDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
983
- FsBlockEditorMarginDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0 });
984
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, decorators: [{
985
- type: Directive,
986
- args: [{
987
- selector: '[fsBlockEditorMargin]'
988
- }]
972
+ class FsBlockEditorMarginDirective {
973
+ constructor(_elementRef) {
974
+ this._elementRef = _elementRef;
975
+ }
976
+ get element() {
977
+ return this._elementRef.nativeElement;
978
+ }
979
+ }
980
+ FsBlockEditorMarginDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
981
+ FsBlockEditorMarginDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0 });
982
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, decorators: [{
983
+ type: Directive,
984
+ args: [{
985
+ selector: '[fsBlockEditorMargin]'
986
+ }]
989
987
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
990
988
 
991
- const BlockFormats = [
992
- { value: BlockFormat.Number, name: 'Number', blockTypes: [BlockType.ShortText, BlockType.LongText] },
993
- { value: BlockFormat.Currency, name: 'Currency', blockTypes: [BlockType.ShortText, BlockType.LongText] },
994
- { value: BlockFormat.Date, name: 'Date', blockTypes: [BlockType.Date] },
995
- { value: BlockFormat.YYYYMMDD, name: 'YYYY/MM/DD', blockTypes: [BlockType.Date] },
989
+ const BlockFormats = [
990
+ { value: BlockFormat.Number, name: 'Number', blockTypes: [BlockType.ShortText, BlockType.LongText] },
991
+ { value: BlockFormat.Currency, name: 'Currency', blockTypes: [BlockType.ShortText, BlockType.LongText] },
992
+ { value: BlockFormat.Date, name: 'Date', blockTypes: [BlockType.Date] },
993
+ { value: BlockFormat.YYYYMMDD, name: 'YYYY/MM/DD', blockTypes: [BlockType.Date] },
996
994
  ];
997
995
 
998
- class FontComponent {
999
- constructor(_el, _googleFontService) {
1000
- this._el = _el;
1001
- this._googleFontService = _googleFontService;
1002
- }
1003
- ngOnInit() {
1004
- var observer = new IntersectionObserver((entries) => {
1005
- if (entries[0].isIntersecting === true) {
1006
- this._googleFontService.loadFont(this.font);
1007
- }
1008
- }, { threshold: [0] });
1009
- observer.observe(this._el.nativeElement);
1010
- }
1011
- }
1012
- FontComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FontComponent, deps: [{ token: i0.ElementRef }, { token: GoogleFontService }], target: i0.ɵɵFactoryTarget.Component });
1013
- FontComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FontComponent, selector: "app-font", inputs: { font: "font" }, ngImport: i0, template: "<div\n [style.fontFamily]=\"font.family\">\n {{font.family}}\n</div>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1014
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FontComponent, decorators: [{
1015
- type: Component,
1016
- args: [{
1017
- selector: 'app-font',
1018
- templateUrl: 'font.component.html',
1019
- styleUrls: ['font.component.scss'],
1020
- changeDetection: ChangeDetectionStrategy.OnPush,
1021
- }]
1022
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GoogleFontService }]; }, propDecorators: { font: [{
1023
- type: Input
996
+ class FontComponent {
997
+ constructor(_el, _googleFontService) {
998
+ this._el = _el;
999
+ this._googleFontService = _googleFontService;
1000
+ }
1001
+ ngOnInit() {
1002
+ var observer = new IntersectionObserver((entries) => {
1003
+ if (entries[0].isIntersecting === true) {
1004
+ this._googleFontService.loadFont(this.font);
1005
+ }
1006
+ }, { threshold: [0] });
1007
+ observer.observe(this._el.nativeElement);
1008
+ }
1009
+ }
1010
+ FontComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FontComponent, deps: [{ token: i0.ElementRef }, { token: GoogleFontService }], target: i0.ɵɵFactoryTarget.Component });
1011
+ FontComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FontComponent, selector: "app-font", inputs: { font: "font" }, ngImport: i0, template: "<div\n [style.fontFamily]=\"font.family\">\n {{font.family}}\n</div>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1012
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FontComponent, decorators: [{
1013
+ type: Component,
1014
+ args: [{
1015
+ selector: 'app-font',
1016
+ templateUrl: 'font.component.html',
1017
+ styleUrls: ['font.component.scss'],
1018
+ changeDetection: ChangeDetectionStrategy.OnPush,
1019
+ }]
1020
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GoogleFontService }]; }, propDecorators: { font: [{
1021
+ type: Input
1024
1022
  }] } });
1025
1023
 
1026
- class SidebarComponent {
1027
- constructor(_el, _blockEditor, _cdRef, _prompt, _googleFontService, _document) {
1028
- this._el = _el;
1029
- this._blockEditor = _blockEditor;
1030
- this._cdRef = _cdRef;
1031
- this._prompt = _prompt;
1032
- this._googleFontService = _googleFontService;
1033
- this._document = _document;
1034
- this.zoomCenter = new EventEmitter();
1035
- this.BlockTypes = BlockTypes;
1036
- this.blockTypeNames = index(BlockTypes, 'value', 'name');
1037
- this.blockTypeIcons = index(BlockTypes, 'value', 'icon');
1038
- this.clippable = false;
1039
- this.BlockType = BlockType;
1040
- this.formats = [];
1041
- this._destroy$ = new Subject();
1042
- this.fontFetch = (value) => {
1043
- return this._googleFontService.getItems();
1044
- };
1045
- this.fontDisplayWith = (value) => {
1046
- return value === null || value === void 0 ? void 0 : value.family;
1047
- };
1048
- }
1049
- get el() {
1050
- return this._el.nativeElement;
1051
- }
1052
- ngOnInit() {
1053
- this._blockEditor.selectedBlocks$
1054
- .pipe(takeUntil(this._destroy$))
1055
- .subscribe((blocks) => {
1056
- this.block = blocks[0] ? blocks[0] : null;
1057
- this.formats = BlockFormats
1058
- .filter((blockFormat) => { var _a; return (blockFormat.blockTypes.indexOf((_a = this.block) === null || _a === void 0 ? void 0 : _a.type) !== -1); });
1059
- this._cdRef.markForCheck();
1060
- });
1061
- this._blockEditor.blockChanged$
1062
- .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
1063
- .subscribe(() => {
1064
- this._cdRef.markForCheck();
1065
- });
1066
- }
1067
- fontChanged(font) {
1068
- this._blockEditor.selectedBlockComponentChangeProperty(font === null || font === void 0 ? void 0 : font.family, 'fontFamily');
1069
- }
1070
- verticalAlignClick(value) {
1071
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
1072
- }
1073
- boldClick() {
1074
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
1075
- }
1076
- toggleLock() {
1077
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.lock, 'lock');
1078
- }
1079
- fontColorChange(value) {
1080
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
1081
- }
1082
- italicClick() {
1083
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
1084
- }
1085
- underlineClick() {
1086
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
1087
- }
1088
- backgroundColorChange(value) {
1089
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
1090
- }
1091
- shadowColorChange(value) {
1092
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'shadowColor');
1093
- }
1094
- paddingAllChange(value) {
1095
- value = this.validNumeric(value) ? value : null;
1096
- this.block.paddingTop = value;
1097
- this.block.paddingLeft = value;
1098
- this.block.paddingBottom = value;
1099
- this.block.paddingRight = value;
1100
- this._blockEditor.selectedBlocks
1101
- .forEach((block) => {
1102
- this._blockEditor.blockChange(block);
1103
- });
1104
- }
1105
- paddingKeypress(event, name) {
1106
- this.block.padding = null;
1107
- this.numericInputKeypress(event, name, 1);
1108
- }
1109
- paddingAllKeypress(event, unit = 1) {
1110
- if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1111
- this.block.padding = round(Number(this.block.padding || 0) + ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1112
- this.paddingAllChange(this.block.padding);
1113
- }
1114
- }
1115
- borderColorChange(value) {
1116
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
1117
- }
1118
- toggleKeepRatio() {
1119
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
1120
- }
1121
- horizontalAlignClick(value) {
1122
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
1123
- }
1124
- shapeRound(name) {
1125
- const value = this.block[name] === 'round' ? 'square' : 'round';
1126
- this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1127
- }
1128
- numberChange(value, name) {
1129
- value = this.validNumeric(value) ? Number(value) : null;
1130
- this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1131
- }
1132
- imageRemove() {
1133
- this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
1134
- }
1135
- imageClip() {
1136
- this.clippable = !this.clippable;
1137
- this._blockEditor.blockClippable = true;
1138
- }
1139
- blockChangeProperty(value, name) {
1140
- this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1141
- }
1142
- imageSelect(fsFile) {
1143
- if (this.config.imageUpload) {
1144
- this.config.imageUpload(fsFile.file)
1145
- .subscribe((value) => {
1146
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
1147
- });
1148
- }
1149
- }
1150
- blockRemoveClick() {
1151
- var _a;
1152
- if (this.config.blocksRemove && ((_a = this._blockEditor.selectedBlocks) === null || _a === void 0 ? void 0 : _a.length)) {
1153
- this._prompt.confirm({
1154
- title: 'Confirm',
1155
- template: 'Are you sure your would like to delete this block?',
1156
- })
1157
- .pipe(switchMap(() => this.config.blocksRemove(this._blockEditor.selectedBlocks)), takeUntil(this._destroy$))
1158
- .subscribe(() => {
1159
- this._blockEditor.removeSelectedBlocks();
1160
- });
1161
- }
1162
- }
1163
- blockUpload(type, fsFile) {
1164
- this._blockEditor.blockUpload({ type }, fsFile, true);
1165
- }
1166
- blockAdd(type) {
1167
- if (type === BlockType.Pdf || type === BlockType.Image) {
1168
- return;
1169
- }
1170
- const block = {
1171
- type,
1172
- shadowX: 2,
1173
- shadowY: 2,
1174
- shadowBlur: 4,
1175
- };
1176
- this._blockEditor.blockAdd(block, true);
1177
- }
1178
- layerMove(direction) {
1179
- this._blockEditor.blockComponents.forEach((blockComponent) => {
1180
- if (this._blockEditor.isSelectedBlock(blockComponent)) {
1181
- blockComponent.block.index += (999 * direction);
1182
- }
1183
- });
1184
- const sorted = this._blockEditor.blockComponents.sort((a, b) => {
1185
- return a.block.index > b.block.index ? 1 : -1;
1186
- });
1187
- sorted.forEach((item, index) => {
1188
- item.block.index = index;
1189
- item.markForCheck();
1190
- });
1191
- if (this.config.blocksLevelChanged) {
1192
- this.config.blocksLevelChanged(sorted.map((item) => item.block));
1193
- }
1194
- }
1195
- layerUp() {
1196
- this.layerMove(1);
1197
- }
1198
- layerDown() {
1199
- this.layerMove(-1);
1200
- }
1201
- reorderLayers() {
1202
- var _a;
1203
- (_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
1204
- this._blockEditor.openReorderDialog();
1205
- }
1206
- inputFocus(event) {
1207
- event.target.select();
1208
- }
1209
- numericInputKeypress(event, name, unit = 1) {
1210
- if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1211
- this.block[name] = round(Number(this.block[name] || 0) + ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1212
- this._blockEditor.selectedBlockComponentChangeProperty(this.block[name], name);
1213
- }
1214
- }
1215
- ngOnDestroy() {
1216
- this._destroy$.next();
1217
- this._destroy$.complete();
1218
- }
1219
- validNumeric(value) {
1220
- return !value || !!String(value).match(/^\d*\.?\d*$/);
1221
- }
1222
- }
1223
- SidebarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i2$1.FsPrompt }, { token: GoogleFontService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
1224
- SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, outputs: { zoomCenter: "zoomCenter" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, template: "<div class=\"sidebar\">\n <div class=\"sidebar-panel\">\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\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></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>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [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-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-row\">\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 <button\n class=\"reorder-layers\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"reorderLayers()\">\n <mat-icon>swap_vert</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\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 <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n\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\n </ng-container>\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\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\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 rotate\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'rotate')\"\n (ngModelChange)=\"numberChange($event, 'rotate')\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\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=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date || block.type === BlockType.Signature\">\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 <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'label')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.Checkbox && block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field\n *ngIf=\"formats.length\"\n class=\"form-field-padless-bottom full-width\">\n <mat-label>Format</mat-label>\n <mat-select\n [(ngModel)]=\"block.format\"\n name=\"format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\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=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\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=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox\n name=\"required\"\n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n\n <mat-checkbox\n name=\"readonly\"\n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockChangeProperty($event, 'readonly')\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-autocomplete\n [fetch]=\"fontFetch\"\n [fetchOnFocus]=\"true\"\n [displayWith]=\"fontDisplayWith\"\n [ngModel]=\"block.fontFamily ? { family: block.fontFamily } : null\"\n placeholder=\"Font\"\n [panelClass]=\"'font-autocomplete-panel'\"\n (ngModelChange)=\"fontChanged($event)\"\n name=\"fontfamily\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n <app-font [font]=\"data\"></app-font>\n </ng-template>\n </fs-autocomplete>\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 font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'fontSize')\"\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 line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'lineHeight')\"\n (ngModelChange)=\"numberChange($event, 'lineHeight')\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\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\">\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\">\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 border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'borderWidth')\"\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\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\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 shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shapeRadius\"\n name=\"shapeRadius\"\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\n <div class=\"sidebar-panel shadow-panel\">\n <div class=\"sidebar-label\">Shadow</div>\n\n <div class=\"sidebar-row\">\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 shadow-x\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowX\"\n name=\"shadowX\"\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 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 shadow-blur\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowBlur\"\n name=\"shadowBlur\"\n placeholder=\"Blur\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowSpread\"\n name=\"shadowSpread\"\n placeholder=\"Spread\"\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\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)=\"imageSelect($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 name=\"imageOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'imageOpacity')\"\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\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.padding\"\n name=\"padding\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\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\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</div>\n\n\n\n\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:285px;font-size:14px;height:100%;overflow:auto;background-color:#fff;padding:0 10px 10px;box-shadow:-1px 1px 4px 3px #0003;z-index:1;position:relative;box-sizing:border-box}.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:55px;margin-left:10px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*: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{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.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.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 .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 mat-form-field+mat-form-field{margin-top:12px}.sidebar .sidebar-panel.block-form-panel .form-field-options{margin-top:11px}.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:40px}.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,.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-blur{width:26px}.sidebar .sidebar-panel.typography-panel fs-autocomplete{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-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], components: [{ type: i3$1.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "orientate", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i6.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: i6$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i8.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i9.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i10.FsAutocompleteComponent, selector: "fs-autocomplete", inputs: ["fetch", "placeholder", "displayWith", "fetchOnFocus", "readonly", "required", "disabled", "appearance", "hint", "panelWidth", "panelClass", "showClear"], outputs: ["cleared", "opened", "closed"] }, { type: FontComponent, selector: "app-font", inputs: ["font"] }, { type: i12.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color", "showClear"], outputs: ["changed"] }], directives: [{ type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i13.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i13.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i14.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i15.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i16.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: i16.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i16.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6$1.MatPrefix, selector: "[matPrefix]" }, { type: i17.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i6$1.MatLabel, selector: "mat-label" }, { type: i10.FsAutocompleteTemplateDirective, selector: "[fsAutocompleteTemplate]" }, { type: i13.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, decorators: [{
1226
- type: Component,
1227
- args: [{
1228
- selector: 'sidebar',
1229
- templateUrl: 'sidebar.component.html',
1230
- styleUrls: ['sidebar.component.scss'],
1231
- changeDetection: ChangeDetectionStrategy.OnPush,
1232
- }]
1233
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i2$1.FsPrompt }, { type: GoogleFontService }, { type: undefined, decorators: [{
1234
- type: Inject,
1235
- args: [DOCUMENT]
1236
- }] }]; }, propDecorators: { sidebarPanels: [{
1237
- type: ContentChildren,
1238
- args: [FsBlockEditorSidebarPanelDirective]
1239
- }], config: [{
1240
- type: Input
1241
- }], blocks: [{
1242
- type: Input
1243
- }], zoomCenter: [{
1244
- type: Output
1024
+ class SidebarComponent {
1025
+ constructor(_el, _blockEditor, _cdRef, _prompt, _googleFontService, _document) {
1026
+ this._el = _el;
1027
+ this._blockEditor = _blockEditor;
1028
+ this._cdRef = _cdRef;
1029
+ this._prompt = _prompt;
1030
+ this._googleFontService = _googleFontService;
1031
+ this._document = _document;
1032
+ this.zoomCenter = new EventEmitter();
1033
+ this.BlockTypes = BlockTypes;
1034
+ this.blockTypeNames = index(BlockTypes, 'value', 'name');
1035
+ this.blockTypeIcons = index(BlockTypes, 'value', 'icon');
1036
+ this.clippable = false;
1037
+ this.BlockType = BlockType;
1038
+ this.formats = [];
1039
+ this._destroy$ = new Subject();
1040
+ this.fontFetch = (value) => {
1041
+ return this._googleFontService.getItems();
1042
+ };
1043
+ this.fontDisplayWith = (value) => {
1044
+ return value === null || value === void 0 ? void 0 : value.family;
1045
+ };
1046
+ }
1047
+ get el() {
1048
+ return this._el.nativeElement;
1049
+ }
1050
+ ngOnInit() {
1051
+ this._blockEditor.selectedBlocks$
1052
+ .pipe(takeUntil(this._destroy$))
1053
+ .subscribe((blocks) => {
1054
+ this.block = blocks[0] ? blocks[0] : null;
1055
+ this.formats = BlockFormats
1056
+ .filter((blockFormat) => { var _a; return (blockFormat.blockTypes.indexOf((_a = this.block) === null || _a === void 0 ? void 0 : _a.type) !== -1); });
1057
+ this._cdRef.markForCheck();
1058
+ });
1059
+ this._blockEditor.blockChanged$
1060
+ .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
1061
+ .subscribe(() => {
1062
+ this._cdRef.markForCheck();
1063
+ });
1064
+ }
1065
+ fontChanged(font) {
1066
+ this._blockEditor.selectedBlockComponentChangeProperty(font === null || font === void 0 ? void 0 : font.family, 'fontFamily');
1067
+ }
1068
+ verticalAlignClick(value) {
1069
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
1070
+ }
1071
+ boldClick() {
1072
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
1073
+ }
1074
+ toggleLock() {
1075
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.lock, 'lock');
1076
+ }
1077
+ fontColorChange(value) {
1078
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
1079
+ }
1080
+ italicClick() {
1081
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
1082
+ }
1083
+ underlineClick() {
1084
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
1085
+ }
1086
+ backgroundColorChange(value) {
1087
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
1088
+ }
1089
+ shadowColorChange(value) {
1090
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'shadowColor');
1091
+ }
1092
+ paddingAllChange(value) {
1093
+ value = this.validNumeric(value) ? value : null;
1094
+ this.block.paddingTop = value;
1095
+ this.block.paddingLeft = value;
1096
+ this.block.paddingBottom = value;
1097
+ this.block.paddingRight = value;
1098
+ this._blockEditor.selectedBlocks
1099
+ .forEach((block) => {
1100
+ this._blockEditor.blockChange(block);
1101
+ });
1102
+ }
1103
+ paddingKeypress(event, name) {
1104
+ this.block.padding = null;
1105
+ this.numericInputKeypress(event, name, 1);
1106
+ }
1107
+ paddingAllKeypress(event, unit = 1) {
1108
+ if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1109
+ this.block.padding = round(Number(this.block.padding || 0) + ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1110
+ this.paddingAllChange(this.block.padding);
1111
+ }
1112
+ }
1113
+ borderColorChange(value) {
1114
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
1115
+ }
1116
+ toggleKeepRatio() {
1117
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
1118
+ }
1119
+ horizontalAlignClick(value) {
1120
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
1121
+ }
1122
+ shapeRound(name) {
1123
+ const value = this.block[name] === 'round' ? 'square' : 'round';
1124
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1125
+ }
1126
+ numberChange(value, name) {
1127
+ value = this.validNumeric(value) ? Number(value) : null;
1128
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1129
+ }
1130
+ imageRemove() {
1131
+ this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
1132
+ }
1133
+ imageClip() {
1134
+ this.clippable = !this.clippable;
1135
+ this._blockEditor.blockClippable = true;
1136
+ }
1137
+ blockChangeProperty(value, name) {
1138
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1139
+ }
1140
+ blockRemoveClick() {
1141
+ var _a;
1142
+ if (this.config.blocksRemove && ((_a = this._blockEditor.selectedBlocks) === null || _a === void 0 ? void 0 : _a.length)) {
1143
+ this._prompt.confirm({
1144
+ title: 'Confirm',
1145
+ template: 'Are you sure your would like to delete this block?',
1146
+ })
1147
+ .pipe(switchMap(() => this.config.blocksRemove(this._blockEditor.selectedBlocks)), takeUntil(this._destroy$))
1148
+ .subscribe(() => {
1149
+ this._blockEditor.removeSelectedBlocks();
1150
+ });
1151
+ }
1152
+ }
1153
+ blockUpload(block, fsFile) {
1154
+ this._blockEditor
1155
+ .blockUpload(block, fsFile);
1156
+ }
1157
+ blockAdd(type) {
1158
+ if (type === BlockType.Pdf || type === BlockType.Image) {
1159
+ return;
1160
+ }
1161
+ const block = {
1162
+ type,
1163
+ shadowX: 2,
1164
+ shadowY: 2,
1165
+ shadowBlur: 4,
1166
+ };
1167
+ this._blockEditor.blockAdd(block);
1168
+ }
1169
+ layerMove(direction) {
1170
+ this._blockEditor.blockComponents.forEach((blockComponent) => {
1171
+ if (this._blockEditor.isSelectedBlock(blockComponent)) {
1172
+ blockComponent.block.index += (999 * direction);
1173
+ }
1174
+ });
1175
+ const sorted = this._blockEditor.blockComponents.sort((a, b) => {
1176
+ return a.block.index > b.block.index ? 1 : -1;
1177
+ });
1178
+ sorted.forEach((item, index) => {
1179
+ item.block.index = index;
1180
+ item.markForCheck();
1181
+ });
1182
+ if (this.config.blocksLevelChanged) {
1183
+ this.config.blocksLevelChanged(sorted.map((item) => item.block));
1184
+ }
1185
+ }
1186
+ layerUp() {
1187
+ this.layerMove(1);
1188
+ }
1189
+ layerDown() {
1190
+ this.layerMove(-1);
1191
+ }
1192
+ reorderLayers() {
1193
+ var _a;
1194
+ (_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
1195
+ this._blockEditor.openReorderDialog();
1196
+ }
1197
+ inputFocus(event) {
1198
+ event.target.select();
1199
+ }
1200
+ numericInputKeypress(event, name, unit = 1) {
1201
+ if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1202
+ this.block[name] = round(Number(this.block[name] || 0) + ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1203
+ this._blockEditor.selectedBlockComponentChangeProperty(this.block[name], name);
1204
+ }
1205
+ }
1206
+ ngOnDestroy() {
1207
+ this._destroy$.next();
1208
+ this._destroy$.complete();
1209
+ }
1210
+ validNumeric(value) {
1211
+ return !value || !!String(value).match(/^\d*\.?\d*$/);
1212
+ }
1213
+ }
1214
+ SidebarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i2$1.FsPrompt }, { token: GoogleFontService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
1215
+ SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, outputs: { zoomCenter: "zoomCenter" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, template: "<div class=\"sidebar\">\n <div class=\"sidebar-panel\">\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-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-row\">\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 <button\n class=\"reorder-layers\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"reorderLayers()\">\n <mat-icon>swap_vert</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\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 <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n\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\n </ng-container>\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\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\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 rotate\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'rotate')\"\n (ngModelChange)=\"numberChange($event, 'rotate')\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\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=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date || block.type === BlockType.Signature\">\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 <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'label')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.Checkbox && block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field\n *ngIf=\"formats.length\"\n class=\"form-field-padless-bottom full-width\">\n <mat-label>Format</mat-label>\n <mat-select\n [(ngModel)]=\"block.format\"\n name=\"format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\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=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\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=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox\n name=\"required\"\n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n\n <mat-checkbox\n name=\"readonly\"\n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockChangeProperty($event, 'readonly')\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-autocomplete\n [fetch]=\"fontFetch\"\n [fetchOnFocus]=\"true\"\n [displayWith]=\"fontDisplayWith\"\n [ngModel]=\"block.fontFamily ? { family: block.fontFamily } : null\"\n placeholder=\"Font\"\n [panelClass]=\"'font-autocomplete-panel'\"\n (ngModelChange)=\"fontChanged($event)\"\n name=\"fontfamily\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n <app-font [font]=\"data\"></app-font>\n </ng-template>\n </fs-autocomplete>\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 font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'fontSize')\"\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 line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'lineHeight')\"\n (ngModelChange)=\"numberChange($event, 'lineHeight')\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\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\">\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\">\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 border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'borderWidth')\"\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\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\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 shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shapeRadius\"\n name=\"shapeRadius\"\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\n <div class=\"sidebar-panel shadow-panel\">\n <div class=\"sidebar-label\">Shadow</div>\n\n <div class=\"sidebar-row\">\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 shadow-x\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowX\"\n name=\"shadowX\"\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 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 shadow-blur\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowBlur\"\n name=\"shadowBlur\"\n placeholder=\"Blur\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowSpread\"\n name=\"shadowSpread\"\n placeholder=\"Spread\"\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\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 name=\"imageOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'imageOpacity')\"\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\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.padding\"\n name=\"padding\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\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\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\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\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</div>\n\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:285px;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 .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:55px;margin-left:10px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*: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{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.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.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 .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 mat-form-field+mat-form-field{margin-top:12px}.sidebar .sidebar-panel.block-form-panel .form-field-options{margin-top:11px}.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:40px}.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,.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-blur{width:26px}.sidebar .sidebar-panel.typography-panel fs-autocomplete{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-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], components: [{ type: i3$1.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "orientate", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i6.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: i6$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i8.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i9.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i10.FsAutocompleteComponent, selector: "fs-autocomplete", inputs: ["fetch", "placeholder", "displayWith", "fetchOnFocus", "readonly", "required", "disabled", "appearance", "hint", "panelWidth", "panelClass", "showClear"], outputs: ["cleared", "opened", "closed"] }, { type: FontComponent, selector: "app-font", inputs: ["font"] }, { type: i12.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color", "showClear"], outputs: ["changed"] }], directives: [{ type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i13.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i13.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i14.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i15.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i16.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: i16.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i16.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6$1.MatPrefix, selector: "[matPrefix]" }, { type: i17.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i6$1.MatLabel, selector: "mat-label" }, { type: i10.FsAutocompleteTemplateDirective, selector: "[fsAutocompleteTemplate]" }, { type: i13.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, decorators: [{
1217
+ type: Component,
1218
+ args: [{
1219
+ selector: 'sidebar',
1220
+ templateUrl: 'sidebar.component.html',
1221
+ styleUrls: ['sidebar.component.scss'],
1222
+ changeDetection: ChangeDetectionStrategy.OnPush,
1223
+ }]
1224
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i2$1.FsPrompt }, { type: GoogleFontService }, { type: undefined, decorators: [{
1225
+ type: Inject,
1226
+ args: [DOCUMENT]
1227
+ }] }]; }, propDecorators: { sidebarPanels: [{
1228
+ type: ContentChildren,
1229
+ args: [FsBlockEditorSidebarPanelDirective]
1230
+ }], config: [{
1231
+ type: Input
1232
+ }], blocks: [{
1233
+ type: Input
1234
+ }], zoomCenter: [{
1235
+ type: Output
1245
1236
  }] } });
1246
1237
 
1247
- class ArtboardComponent {
1248
- constructor(_el, _blockEditor, _cdRef) {
1249
- this._el = _el;
1250
- this._blockEditor = _blockEditor;
1251
- this._cdRef = _cdRef;
1252
- this.blocks = [];
1253
- this._destroy$ = new Subject();
1254
- }
1255
- get el() {
1256
- return this._el.nativeElement;
1257
- }
1258
- ngOnInit() {
1259
- this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1260
- this._blockEditor.registerContainer(this.artboard.nativeElement);
1261
- this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1262
- this._blockEditor.blocks$
1263
- .pipe(takeUntil(this._destroy$))
1264
- .subscribe((blocks) => {
1265
- this.blocks = blocks;
1266
- this._cdRef.markForCheck();
1267
- });
1268
- this._blockEditor.blockAdded$
1269
- .pipe(delay(300), takeUntil(this._destroy$))
1270
- .subscribe((block) => {
1271
- this._blockEditor.selectedBlocks = [block];
1272
- this._cdRef.markForCheck();
1273
- });
1274
- fromEvent(window, 'keydown')
1275
- .pipe(filter((event) => {
1276
- return ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].indexOf(event.key) !== -1;
1277
- }), filter(() => {
1278
- const el = document.activeElement;
1279
- return !(el instanceof HTMLInputElement || (el && el.classList.contains('content-editable')));
1280
- }), takeUntil(this._destroy$))
1281
- .subscribe((event) => {
1282
- event.preventDefault();
1283
- const inchPixel = 1 / 100;
1284
- this._blockEditor.selectedComponentBlocks
1285
- .forEach((blockComponent) => {
1286
- switch (event.key) {
1287
- case 'ArrowUp':
1288
- blockComponent.block.top = blockComponent.block.top - inchPixel;
1289
- break;
1290
- case 'ArrowDown':
1291
- blockComponent.block.top = blockComponent.block.top + inchPixel;
1292
- break;
1293
- case 'ArrowLeft':
1294
- blockComponent.block.left = blockComponent.block.left - inchPixel;
1295
- break;
1296
- case 'ArrowRight':
1297
- blockComponent.block.left = blockComponent.block.left + inchPixel;
1298
- break;
1299
- }
1300
- this._blockEditor.blockChange(blockComponent.block);
1301
- });
1302
- });
1303
- }
1304
- ngOnDestroy() {
1305
- this._destroy$.next();
1306
- this._destroy$.complete();
1307
- }
1308
- }
1309
- ArtboardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ArtboardComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1310
- ArtboardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1311
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ArtboardComponent, decorators: [{
1312
- type: Component,
1313
- args: [{
1314
- selector: 'app-artboard',
1315
- templateUrl: 'artboard.component.html',
1316
- styleUrls: ['artboard.component.scss'],
1317
- changeDetection: ChangeDetectionStrategy.OnPush,
1318
- }]
1319
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { sidebarPanels: [{
1320
- type: ContentChildren,
1321
- args: [FsBlockEditorSidebarPanelDirective]
1322
- }], blockComponents: [{
1323
- type: ViewChildren,
1324
- args: [FsBlockComponent]
1325
- }], artboard: [{
1326
- type: ViewChild,
1327
- args: ['artboard', { static: true }]
1328
- }], marginContainer: [{
1329
- type: ViewChild,
1330
- args: ['marginContainer', { static: true }]
1331
- }], margins: [{
1332
- type: ViewChildren,
1333
- args: [FsBlockEditorMarginDirective]
1334
- }], sidebar: [{
1335
- type: ViewChild,
1336
- args: [SidebarComponent, { static: true }]
1337
- }], config: [{
1338
- type: Input
1339
- }], zoompan: [{
1340
- type: Input
1238
+ class ArtboardComponent {
1239
+ constructor(_el, _blockEditor, _cdRef) {
1240
+ this._el = _el;
1241
+ this._blockEditor = _blockEditor;
1242
+ this._cdRef = _cdRef;
1243
+ this.blocks = [];
1244
+ this._destroy$ = new Subject();
1245
+ }
1246
+ get el() {
1247
+ return this._el.nativeElement;
1248
+ }
1249
+ ngOnInit() {
1250
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1251
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
1252
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1253
+ this._blockEditor.blocks$
1254
+ .pipe(takeUntil(this._destroy$))
1255
+ .subscribe((blocks) => {
1256
+ this.blocks = blocks;
1257
+ this._cdRef.markForCheck();
1258
+ });
1259
+ this._blockEditor.blockAdded$
1260
+ .pipe(delay(300), takeUntil(this._destroy$))
1261
+ .subscribe((block) => {
1262
+ this._blockEditor.selectedBlocks = [block];
1263
+ this._cdRef.markForCheck();
1264
+ });
1265
+ fromEvent(window, 'keydown')
1266
+ .pipe(filter((event) => {
1267
+ return ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].indexOf(event.key) !== -1;
1268
+ }), filter(() => {
1269
+ const el = document.activeElement;
1270
+ return !(el instanceof HTMLInputElement || (el && el.classList.contains('content-editable')));
1271
+ }), takeUntil(this._destroy$))
1272
+ .subscribe((event) => {
1273
+ event.preventDefault();
1274
+ const inchPixel = 1 / 100;
1275
+ this._blockEditor.selectedComponentBlocks
1276
+ .forEach((blockComponent) => {
1277
+ switch (event.key) {
1278
+ case 'ArrowUp':
1279
+ blockComponent.block.top = blockComponent.block.top - inchPixel;
1280
+ break;
1281
+ case 'ArrowDown':
1282
+ blockComponent.block.top = blockComponent.block.top + inchPixel;
1283
+ break;
1284
+ case 'ArrowLeft':
1285
+ blockComponent.block.left = blockComponent.block.left - inchPixel;
1286
+ break;
1287
+ case 'ArrowRight':
1288
+ blockComponent.block.left = blockComponent.block.left + inchPixel;
1289
+ break;
1290
+ }
1291
+ this._blockEditor.blockChange(blockComponent.block);
1292
+ });
1293
+ });
1294
+ }
1295
+ ngOnDestroy() {
1296
+ this._destroy$.next();
1297
+ this._destroy$.complete();
1298
+ }
1299
+ }
1300
+ ArtboardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ArtboardComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1301
+ ArtboardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ArtboardComponent, decorators: [{
1303
+ type: Component,
1304
+ args: [{
1305
+ selector: 'app-artboard',
1306
+ templateUrl: 'artboard.component.html',
1307
+ styleUrls: ['artboard.component.scss'],
1308
+ changeDetection: ChangeDetectionStrategy.OnPush,
1309
+ }]
1310
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { sidebarPanels: [{
1311
+ type: ContentChildren,
1312
+ args: [FsBlockEditorSidebarPanelDirective]
1313
+ }], blockComponents: [{
1314
+ type: ViewChildren,
1315
+ args: [FsBlockComponent]
1316
+ }], artboard: [{
1317
+ type: ViewChild,
1318
+ args: ['artboard', { static: true }]
1319
+ }], marginContainer: [{
1320
+ type: ViewChild,
1321
+ args: ['marginContainer', { static: true }]
1322
+ }], margins: [{
1323
+ type: ViewChildren,
1324
+ args: [FsBlockEditorMarginDirective]
1325
+ }], sidebar: [{
1326
+ type: ViewChild,
1327
+ args: [SidebarComponent, { static: true }]
1328
+ }], config: [{
1329
+ type: Input
1330
+ }], zoompan: [{
1331
+ type: Input
1341
1332
  }] } });
1342
1333
 
1343
- class FsBlockEditorComponent {
1344
- constructor(_el, _blockEditor) {
1345
- this._el = _el;
1346
- this._blockEditor = _blockEditor;
1347
- this._destroy$ = new Subject();
1348
- }
1349
- get el() {
1350
- return this._el.nativeElement;
1351
- }
1352
- ngOnInit() {
1353
- this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1354
- this._blockEditor.init(this.config);
1355
- this._blockEditor.blocks$
1356
- .pipe(takeUntil(this._destroy$))
1357
- .subscribe((blocks) => {
1358
- this.blocks = blocks;
1359
- });
1360
- setTimeout(() => {
1361
- this.zoomCenter();
1362
- });
1363
- }
1364
- zoomCenter() {
1365
- this.zoompan.center(this.artboard.nativeElement, { vertical: false });
1366
- }
1367
- editorContainerClick(event) {
1368
- if (event.target.classList.contains('deselectable') ||
1369
- event.target.classList.contains('fs-zoom-pan-container')) {
1370
- this.zoompan.enable();
1371
- this._blockEditor.selectedBlocks = [];
1372
- }
1373
- }
1374
- ngOnDestroy() {
1375
- this._destroy$.next();
1376
- this._destroy$.complete();
1377
- }
1378
- }
1379
- FsBlockEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }], target: i0.ɵɵFactoryTarget.Component });
1380
- FsBlockEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
1381
- BlockEditorService,
1382
- BlocksStore,
1383
- ], 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}.editor-container .zoom-pan-container{flex:1}fs-zoom-pan{height:100%}\n"], components: [{ type: i2$2.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"], outputs: ["zoomCenter"] }], directives: [{ type: i2$2.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1384
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, decorators: [{
1385
- type: Component,
1386
- args: [{
1387
- selector: 'fs-block-editor',
1388
- templateUrl: 'block-editor.component.html',
1389
- styleUrls: ['block-editor.component.scss'],
1390
- changeDetection: ChangeDetectionStrategy.OnPush,
1391
- providers: [
1392
- BlockEditorService,
1393
- BlocksStore,
1394
- ]
1395
- }]
1396
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1397
- type: ContentChildren,
1398
- args: [FsBlockEditorSidebarPanelDirective]
1399
- }], zoompan: [{
1400
- type: ViewChild,
1401
- args: [FsZoomPanComponent, { static: true }]
1402
- }], artboardContainer: [{
1403
- type: ViewChild,
1404
- args: ['artboardContainer', { static: true }]
1405
- }], sidebar: [{
1406
- type: ViewChild,
1407
- args: [SidebarComponent, { static: true }]
1408
- }], artboard: [{
1409
- type: ViewChild,
1410
- args: [ArtboardComponent, { read: ElementRef }]
1411
- }], config: [{
1412
- type: Input
1334
+ class FsBlockEditorComponent {
1335
+ constructor(_el, _blockEditor) {
1336
+ this._el = _el;
1337
+ this._blockEditor = _blockEditor;
1338
+ this._destroy$ = new Subject();
1339
+ }
1340
+ get el() {
1341
+ return this._el.nativeElement;
1342
+ }
1343
+ ngOnInit() {
1344
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1345
+ this._blockEditor.init(this.config);
1346
+ this._blockEditor.blocks$
1347
+ .pipe(takeUntil(this._destroy$))
1348
+ .subscribe((blocks) => {
1349
+ this.blocks = blocks;
1350
+ });
1351
+ setTimeout(() => {
1352
+ this.zoomCenter();
1353
+ });
1354
+ }
1355
+ zoomCenter() {
1356
+ this.zoompan.center(this.artboard.nativeElement, { vertical: false });
1357
+ }
1358
+ editorContainerKeyDown(event) {
1359
+ var _a;
1360
+ if ((event.key === 'Delete' || event.key === 'Backspace') && ((_a = event.target) === null || _a === void 0 ? void 0 : _a.nodeName) !== 'INPUT') {
1361
+ this.sidebar.blockRemoveClick();
1362
+ event.preventDefault();
1363
+ }
1364
+ }
1365
+ editorContainerClick(event) {
1366
+ if (event.target.classList.contains('deselectable') ||
1367
+ event.target.classList.contains('fs-zoom-pan-container')) {
1368
+ this.zoompan.enable();
1369
+ this._blockEditor.selectedBlocks = [];
1370
+ }
1371
+ }
1372
+ ngOnDestroy() {
1373
+ this._destroy$.next();
1374
+ this._destroy$.complete();
1375
+ }
1376
+ }
1377
+ FsBlockEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }], target: i0.ɵɵFactoryTarget.Component });
1378
+ FsBlockEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, host: { listeners: { "document:keydown": "editorContainerKeyDown($event)" } }, providers: [
1379
+ BlockEditorService,
1380
+ BlocksStore,
1381
+ ], 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$2.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"], outputs: ["zoomCenter"] }], directives: [{ type: i2$2.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, decorators: [{
1383
+ type: Component,
1384
+ args: [{
1385
+ selector: 'fs-block-editor',
1386
+ templateUrl: 'block-editor.component.html',
1387
+ styleUrls: ['block-editor.component.scss'],
1388
+ changeDetection: ChangeDetectionStrategy.OnPush,
1389
+ providers: [
1390
+ BlockEditorService,
1391
+ BlocksStore,
1392
+ ]
1393
+ }]
1394
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1395
+ type: ContentChildren,
1396
+ args: [FsBlockEditorSidebarPanelDirective]
1397
+ }], zoompan: [{
1398
+ type: ViewChild,
1399
+ args: [FsZoomPanComponent, { static: true }]
1400
+ }], artboardContainer: [{
1401
+ type: ViewChild,
1402
+ args: ['artboardContainer', { static: true }]
1403
+ }], sidebar: [{
1404
+ type: ViewChild,
1405
+ args: [SidebarComponent, { static: true }]
1406
+ }], artboard: [{
1407
+ type: ViewChild,
1408
+ args: [ArtboardComponent, { read: ElementRef }]
1409
+ }], config: [{
1410
+ type: Input
1411
+ }], editorContainerKeyDown: [{
1412
+ type: HostListener,
1413
+ args: ['document:keydown', ['$event']]
1413
1414
  }] } });
1414
1415
 
1415
- class FsBlockEditorModule {
1416
- static forRoot() {
1417
- return {
1418
- ngModule: FsBlockEditorModule,
1419
- };
1420
- }
1421
- }
1422
- FsBlockEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1423
- FsBlockEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1424
- FsBlockEditorComponent,
1425
- FsBlockEditorSidebarPanelDirective,
1426
- FsBlockEditorMarginDirective,
1427
- SidebarComponent,
1428
- ArtboardComponent,
1429
- LayersReorderDialogComponent,
1430
- FontComponent], imports: [CommonModule,
1431
- FormsModule,
1432
- MatIconModule,
1433
- MatButtonModule,
1434
- MatInputModule,
1435
- MatFormFieldModule,
1436
- MatCheckboxModule,
1437
- MatTooltipModule,
1438
- MatSelectModule,
1439
- MatListModule,
1440
- DragDropModule,
1441
- FsFileModule,
1442
- FsColorPickerModule,
1443
- FsMenuModule,
1444
- FsZoomPanModule,
1445
- FsAutocompleteModule,
1446
- FsDialogModule], exports: [FsBlockComponent,
1447
- FsBlockEditorComponent,
1448
- FsBlockEditorSidebarPanelDirective] });
1449
- FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, providers: [
1450
- GoogleFontService,
1451
- ], imports: [[
1452
- CommonModule,
1453
- FormsModule,
1454
- MatIconModule,
1455
- MatButtonModule,
1456
- MatInputModule,
1457
- MatFormFieldModule,
1458
- MatCheckboxModule,
1459
- MatTooltipModule,
1460
- MatSelectModule,
1461
- MatListModule,
1462
- DragDropModule,
1463
- FsFileModule,
1464
- FsColorPickerModule,
1465
- FsMenuModule,
1466
- FsZoomPanModule,
1467
- FsAutocompleteModule,
1468
- FsDialogModule,
1469
- ]] });
1470
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, decorators: [{
1471
- type: NgModule,
1472
- args: [{
1473
- imports: [
1474
- CommonModule,
1475
- FormsModule,
1476
- MatIconModule,
1477
- MatButtonModule,
1478
- MatInputModule,
1479
- MatFormFieldModule,
1480
- MatCheckboxModule,
1481
- MatTooltipModule,
1482
- MatSelectModule,
1483
- MatListModule,
1484
- DragDropModule,
1485
- FsFileModule,
1486
- FsColorPickerModule,
1487
- FsMenuModule,
1488
- FsZoomPanModule,
1489
- FsAutocompleteModule,
1490
- FsDialogModule,
1491
- ],
1492
- exports: [
1493
- FsBlockComponent,
1494
- FsBlockEditorComponent,
1495
- FsBlockEditorSidebarPanelDirective,
1496
- ],
1497
- declarations: [
1498
- FsBlockComponent,
1499
- FsBlockEditorComponent,
1500
- FsBlockEditorSidebarPanelDirective,
1501
- FsBlockEditorMarginDirective,
1502
- SidebarComponent,
1503
- ArtboardComponent,
1504
- LayersReorderDialogComponent,
1505
- FontComponent,
1506
- ],
1507
- providers: [
1508
- GoogleFontService,
1509
- ]
1510
- }]
1416
+ class FsBlockEditorModule {
1417
+ static forRoot() {
1418
+ return {
1419
+ ngModule: FsBlockEditorModule,
1420
+ };
1421
+ }
1422
+ }
1423
+ FsBlockEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1424
+ FsBlockEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1425
+ FsBlockEditorComponent,
1426
+ FsBlockEditorSidebarPanelDirective,
1427
+ FsBlockEditorMarginDirective,
1428
+ SidebarComponent,
1429
+ ArtboardComponent,
1430
+ LayersReorderDialogComponent,
1431
+ FontComponent], imports: [CommonModule,
1432
+ FormsModule,
1433
+ MatIconModule,
1434
+ MatButtonModule,
1435
+ MatInputModule,
1436
+ MatFormFieldModule,
1437
+ MatCheckboxModule,
1438
+ MatTooltipModule,
1439
+ MatSelectModule,
1440
+ MatListModule,
1441
+ DragDropModule,
1442
+ FsFileModule,
1443
+ FsColorPickerModule,
1444
+ FsMenuModule,
1445
+ FsZoomPanModule,
1446
+ FsAutocompleteModule,
1447
+ FsDialogModule], exports: [FsBlockComponent,
1448
+ FsBlockEditorComponent,
1449
+ FsBlockEditorSidebarPanelDirective] });
1450
+ FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, providers: [
1451
+ GoogleFontService,
1452
+ ], imports: [[
1453
+ CommonModule,
1454
+ FormsModule,
1455
+ MatIconModule,
1456
+ MatButtonModule,
1457
+ MatInputModule,
1458
+ MatFormFieldModule,
1459
+ MatCheckboxModule,
1460
+ MatTooltipModule,
1461
+ MatSelectModule,
1462
+ MatListModule,
1463
+ DragDropModule,
1464
+ FsFileModule,
1465
+ FsColorPickerModule,
1466
+ FsMenuModule,
1467
+ FsZoomPanModule,
1468
+ FsAutocompleteModule,
1469
+ FsDialogModule,
1470
+ ]] });
1471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, decorators: [{
1472
+ type: NgModule,
1473
+ args: [{
1474
+ imports: [
1475
+ CommonModule,
1476
+ FormsModule,
1477
+ MatIconModule,
1478
+ MatButtonModule,
1479
+ MatInputModule,
1480
+ MatFormFieldModule,
1481
+ MatCheckboxModule,
1482
+ MatTooltipModule,
1483
+ MatSelectModule,
1484
+ MatListModule,
1485
+ DragDropModule,
1486
+ FsFileModule,
1487
+ FsColorPickerModule,
1488
+ FsMenuModule,
1489
+ FsZoomPanModule,
1490
+ FsAutocompleteModule,
1491
+ FsDialogModule,
1492
+ ],
1493
+ exports: [
1494
+ FsBlockComponent,
1495
+ FsBlockEditorComponent,
1496
+ FsBlockEditorSidebarPanelDirective,
1497
+ ],
1498
+ declarations: [
1499
+ FsBlockComponent,
1500
+ FsBlockEditorComponent,
1501
+ FsBlockEditorSidebarPanelDirective,
1502
+ FsBlockEditorMarginDirective,
1503
+ SidebarComponent,
1504
+ ArtboardComponent,
1505
+ LayersReorderDialogComponent,
1506
+ FontComponent,
1507
+ ],
1508
+ providers: [
1509
+ GoogleFontService,
1510
+ ]
1511
+ }]
1511
1512
  }] });
1512
1513
 
1513
- /**
1514
- * Generated bundle index. Do not edit.
1514
+ /**
1515
+ * Generated bundle index. Do not edit.
1515
1516
  */
1516
1517
 
1517
1518
  export { BlockType, BlockTypes, FsBlockComponent, FsBlockEditorComponent, FsBlockEditorModule, FsBlockEditorSidebarPanelDirective };