@firestitch/block-editor 12.0.0 → 12.1.1

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 (39) hide show
  1. package/app/components/artboard/artboard.component.d.ts +35 -0
  2. package/app/components/block/block.component.d.ts +58 -78
  3. package/app/components/block-editor/block-editor.component.d.ts +27 -37
  4. package/app/components/sidebar/sidebar.component.d.ts +74 -61
  5. package/app/consts/block-types.const.d.ts +12 -0
  6. package/app/consts/index.d.ts +1 -0
  7. package/app/directives/block-editor-margin.directive.d.ts +9 -9
  8. package/app/directives/block-editor-sidebar-panel.directive.d.ts +10 -10
  9. package/app/enums/block-type.enum.d.ts +11 -0
  10. package/app/enums/index.d.ts +1 -0
  11. package/app/fs-block-editor.module.d.ts +26 -22
  12. package/app/interfaces/block-editor-config.d.ts +20 -18
  13. package/app/interfaces/block.d.ts +48 -37
  14. package/app/services/block-editor.service.d.ts +54 -36
  15. package/app/services/index.d.ts +1 -0
  16. package/bundles/firestitch-block-editor.umd.js +1521 -1466
  17. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  18. package/esm2015/app/components/artboard/artboard.component.js +129 -0
  19. package/esm2015/app/components/block/block.component.js +317 -370
  20. package/esm2015/app/components/block-editor/block-editor.component.js +80 -141
  21. package/esm2015/app/components/sidebar/sidebar.component.js +234 -299
  22. package/esm2015/app/consts/block-types.const.js +13 -0
  23. package/esm2015/app/consts/index.js +2 -0
  24. package/esm2015/app/directives/block-editor-margin.directive.js +18 -18
  25. package/esm2015/app/directives/block-editor-sidebar-panel.directive.js +20 -20
  26. package/esm2015/app/enums/block-type.enum.js +13 -0
  27. package/esm2015/app/enums/index.js +2 -0
  28. package/esm2015/app/fs-block-editor.module.js +94 -79
  29. package/esm2015/app/interfaces/block-editor-config.js +2 -2
  30. package/esm2015/app/interfaces/block.js +2 -2
  31. package/esm2015/app/services/block-editor.service.js +230 -99
  32. package/esm2015/app/services/index.js +2 -0
  33. package/esm2015/firestitch-block-editor.js +4 -4
  34. package/esm2015/public_api.js +7 -8
  35. package/fesm2015/firestitch-block-editor.js +1072 -974
  36. package/fesm2015/firestitch-block-editor.js.map +1 -1
  37. package/firestitch-block-editor.d.ts +5 -5
  38. package/package.json +3 -6
  39. package/public_api.d.ts +8 -6
@@ -1,1001 +1,1099 @@
1
- import * as i9 from '@angular/forms';
1
+ import * as i12 from '@angular/forms';
2
2
  import { FormsModule } from '@angular/forms';
3
- import * as i8 from '@angular/material/input';
3
+ import * as i11 from '@angular/material/input';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import * as i0 from '@angular/core';
6
- import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, ViewChild, Input, Output, Directive, ContentChildren, ViewChildren, NgModule } from '@angular/core';
7
- import * as i7 from '@angular/common';
6
+ import { Injectable, Component, ChangeDetectionStrategy, ViewChild, Input, HostBinding, Directive, ContentChildren, ViewChildren, ElementRef, NgModule } from '@angular/core';
7
+ import * as i9 from '@angular/common';
8
8
  import { CommonModule } from '@angular/common';
9
- import * as i2 from '@angular/material/button';
9
+ import * as i4 from '@angular/material/button';
10
10
  import { MatButtonModule } from '@angular/material/button';
11
- import * as i4 from '@angular/material/form-field';
11
+ import * as i6 from '@angular/material/form-field';
12
12
  import { MatFormFieldModule } from '@angular/material/form-field';
13
- import * as i3 from '@angular/material/icon';
13
+ import * as i5 from '@angular/material/icon';
14
14
  import { MatIconModule } from '@angular/material/icon';
15
- import { FsHtmlEditorComponent, FsHtmlEditorModule } from '@firestitch/html-editor';
16
- import * as i5 from '@firestitch/colorpicker';
15
+ import * as i8 from '@firestitch/colorpicker';
17
16
  import { FsColorPickerModule } from '@firestitch/colorpicker';
18
- import * as i6 from '@firestitch/file';
17
+ import * as i3 from '@firestitch/file';
19
18
  import { FsFileModule } from '@firestitch/file';
20
- import { takeUntil, filter, take } from 'rxjs/operators';
19
+ import { FsMenuModule } from '@firestitch/menu';
20
+ import * as i2$1 from '@firestitch/zoom-pan';
21
+ import { FsZoomPanComponent, FsZoomPanModule } from '@firestitch/zoom-pan';
22
+ import { takeUntil, filter, switchMap, delay } from 'rxjs/operators';
21
23
  import Moveable from 'moveable';
22
- import { BehaviorSubject, Subject, fromEvent } from 'rxjs';
23
- import { guid } from '@firestitch/common';
24
+ import { Subject, BehaviorSubject, fromEvent } from 'rxjs';
25
+ import { guid, index } from '@firestitch/common';
26
+ import * as i2 from '@firestitch/prompt';
27
+ import * as i7 from '@angular/material/checkbox';
28
+ import { MatCheckboxModule } from '@angular/material/checkbox';
29
+ import * as i10 from '@angular/material/tooltip';
30
+ import { MatTooltipModule } from '@angular/material/tooltip';
24
31
 
25
- class BlockEditorService {
26
- constructor() {
27
- this.blockComponents = [];
28
- this._blocks$ = new BehaviorSubject([]);
29
- this._selectedBlockComponents$ = new BehaviorSubject([]);
30
- }
31
- get elementGuidelines() {
32
- return [
33
- ...this.blockComponents.map((block) => {
34
- return block.el;
35
- }),
36
- this.container,
37
- this.margin,
38
- ];
39
- }
40
- addBlock(block) {
41
- this.blocks$.next([...this.blocks, this.sanitizeBlock(block)]);
42
- }
43
- removeBlock(block) {
44
- const index = this.indexOf(block);
45
- if (index !== -1) {
46
- this.blocks.splice(index, 1);
47
- this.blocks$.next(this.blocks);
48
- }
49
- }
50
- get blocks$() {
51
- return this._blocks$;
52
- }
53
- get blocks() {
54
- return this.blocks$.getValue();
55
- }
56
- set blocks(blocks) {
57
- this._blocks$.next(blocks);
58
- }
59
- isSelectedBlock(block) {
60
- return this.selectedBlockComponents.indexOf(block) !== -1;
61
- }
62
- indexOf(block) {
63
- return this.blocks.map((e) => e.reference).indexOf(block.reference);
64
- }
65
- set selectedBlockComponents(blocks) {
66
- this.blockComponents.forEach((block) => {
67
- block.editable = false;
68
- block.transformable = blocks.indexOf(block) !== -1;
69
- });
70
- this._selectedBlockComponents$.next(blocks);
71
- }
72
- get selectedBlockComponents() {
73
- return this._selectedBlockComponents$.getValue();
74
- }
75
- get selectedBlocks() {
76
- return this.selectedBlockComponents.map((blockComponent) => blockComponent.block);
77
- }
78
- get selectedBlockComponents$() {
79
- return this._selectedBlockComponents$;
80
- }
81
- saveSelection() {
82
- const selection = window.getSelection();
83
- this._selectionRange = selection.getRangeAt(0);
84
- }
85
- restoreSelection() {
86
- if (this._selectionRange) {
87
- const selection = window.getSelection();
88
- selection.removeAllRanges();
89
- selection.addRange(this._selectionRange);
90
- }
91
- }
92
- hasSelectionRange() {
93
- return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
94
- }
95
- registerBlock(block) {
96
- this.blockComponents.push(block);
97
- this.blockComponents.forEach((item) => {
98
- const blocks = this.elementGuidelines
99
- .filter((el) => {
100
- return !el.isSameNode(item.el);
101
- });
102
- item.elementGuidelines = blocks;
103
- });
104
- }
105
- registerContainer(container) {
106
- this.container = container;
107
- }
108
- registerMargin(margin) {
109
- this.margin = margin;
110
- }
111
- sanitizeBlock(block) {
112
- return Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block);
113
- }
114
- }
115
- BlockEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
116
- BlockEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService });
117
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, decorators: [{
118
- type: Injectable
119
- }], ctorParameters: function () { return []; } });
32
+ class BlockEditorService {
33
+ constructor() {
34
+ this._blockChanged$ = new Subject();
35
+ this._blockRemoved$ = new Subject();
36
+ this._blockAdded$ = new Subject();
37
+ this._blocks$ = new BehaviorSubject([]);
38
+ this._selectedBlocks$ = new BehaviorSubject([]);
39
+ this._blockComponents = new Map();
40
+ this._destroy$ = new Subject();
41
+ }
42
+ get elementGuidelines() {
43
+ return [
44
+ ...Array.from(this._blockComponents.values())
45
+ .map((block) => {
46
+ return block.el;
47
+ }),
48
+ this.container,
49
+ this.margin,
50
+ ];
51
+ }
52
+ get blockComponents() {
53
+ return Array.from(this._blockComponents.values());
54
+ }
55
+ get selectedComponentBlocks() {
56
+ return this.blockComponents
57
+ .filter((blockComponent) => this.selectedBlocks.indexOf(blockComponent.block) !== -1);
58
+ }
59
+ blockUpload(block, fsFile) {
60
+ if (this.config.blockUpload) {
61
+ this.config.blockUpload(block, fsFile.file)
62
+ .pipe(takeUntil(this._destroy$))
63
+ .subscribe((block) => {
64
+ const blocks = [
65
+ ...this.blocks,
66
+ block,
67
+ ];
68
+ this.blocks = this._updateIndexesFor(blocks);
69
+ this._blockAdded$.next(block);
70
+ if (this.config.blockAdded) {
71
+ this.config.blockAdded(block);
72
+ }
73
+ //this._updateIndexes();
74
+ });
75
+ }
76
+ }
77
+ blockAdd(block) {
78
+ if (this.config.blockAdd) {
79
+ this.config.blockAdd(block)
80
+ .pipe(takeUntil(this._destroy$))
81
+ .subscribe((block) => {
82
+ const blocks = [
83
+ ...this.blocks,
84
+ block,
85
+ ];
86
+ this.blocks = this._updateIndexesFor(blocks);
87
+ this._blockAdded$.next(block);
88
+ if (this.config.blockAdded) {
89
+ this.config.blockAdded(block);
90
+ }
91
+ //this._updateIndexes();
92
+ });
93
+ }
94
+ }
95
+ _updateIndexesFor(blocks) {
96
+ blocks.forEach((block, index) => {
97
+ block.index = index;
98
+ });
99
+ return blocks;
100
+ }
101
+ // private _updateIndexes(): void {
102
+ // const sort = this.blocks.slice().sort((a, b) => {
103
+ // return a.index > b.index ? 1 : -1;
104
+ // })
105
+ // sort.forEach((block, index) => {
106
+ // this.blocks.find((item) => {
107
+ // return block.reference === item.reference;
108
+ // }).index = index;
109
+ // });
110
+ // }
111
+ removeBlock(block) {
112
+ const index = this.indexOf(block);
113
+ if (index !== -1) {
114
+ const blocks = this.blocks;
115
+ blocks.splice(index, 1);
116
+ this.blocks = blocks;
117
+ this._blockRemoved$.next(block);
118
+ }
119
+ }
120
+ removeSelectedBlocks() {
121
+ this.selectedBlocks.forEach((block) => {
122
+ this.removeBlock(block);
123
+ });
124
+ this.selectedBlocks = [];
125
+ }
126
+ get blocks$() {
127
+ return this._blocks$;
128
+ }
129
+ get blockChanged$() {
130
+ return this._blockChanged$;
131
+ }
132
+ get blockRemoved$() {
133
+ return this._blockRemoved$;
134
+ }
135
+ get blockAdded$() {
136
+ return this._blockAdded$;
137
+ }
138
+ blockChange(block) {
139
+ this._blockChanged$.next(block);
140
+ if (this.config.blockChanged) {
141
+ this.config.blockChanged(block);
142
+ }
143
+ }
144
+ get blocks() {
145
+ return this._blocks$.getValue();
146
+ }
147
+ set blocks(blocks) {
148
+ this._blocks$.next(blocks);
149
+ }
150
+ isSelectedBlock(block) {
151
+ return this.selectedBlocks.indexOf(block.block) !== -1;
152
+ }
153
+ indexOf(block) {
154
+ return this.blocks.map((e) => e.reference).indexOf(block.reference);
155
+ }
156
+ selectedBlockComponentChangeProperty(value, name) {
157
+ if (name === 'index') {
158
+ const blocks = this.blocks;
159
+ const affectedGUIDs = this.selectedBlocks.map((block) => block.guid);
160
+ blocks.forEach((block, index) => {
161
+ const guidIndex = affectedGUIDs.indexOf(block.guid);
162
+ if (guidIndex !== -1) {
163
+ blocks.splice(index, 1);
164
+ blocks.splice(+value, 0, block);
165
+ block.index = +value;
166
+ this.blockChange(block);
167
+ }
168
+ });
169
+ this._updateIndexesFor(blocks);
170
+ }
171
+ else {
172
+ this.selectedBlocks
173
+ .forEach((block) => {
174
+ block[name] = value;
175
+ this.blockChange(block);
176
+ });
177
+ }
178
+ }
179
+ get selectedBlocks$() {
180
+ return this._selectedBlocks$;
181
+ }
182
+ set selectedBlock(block) {
183
+ this.selectedBlocks = [block];
184
+ }
185
+ set selectedBlocks(blocks) {
186
+ this.blockComponents
187
+ .forEach((blockComponent) => {
188
+ blockComponent.editable = false;
189
+ if (blocks.indexOf(blockComponent.block) !== -1) {
190
+ blockComponent.transformable = true;
191
+ }
192
+ else {
193
+ blockComponent.deselect();
194
+ }
195
+ });
196
+ this._selectedBlocks$.next(blocks);
197
+ if (this.config.blocksSelected) {
198
+ this.config.blocksSelected(blocks);
199
+ }
200
+ }
201
+ get selectedBlocks() {
202
+ return this._selectedBlocks$.getValue();
203
+ }
204
+ saveSelection() {
205
+ const selection = window.getSelection();
206
+ this._selectionRange = selection.getRangeAt(0);
207
+ }
208
+ restoreSelection() {
209
+ if (this._selectionRange) {
210
+ const selection = window.getSelection();
211
+ selection.removeAllRanges();
212
+ selection.addRange(this._selectionRange);
213
+ }
214
+ }
215
+ hasSelectionRange() {
216
+ return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
217
+ }
218
+ registerBlock(block, blockComponent) {
219
+ this._blockComponents.set(block, blockComponent);
220
+ this.blockComponents.push(block);
221
+ this.blockComponents.forEach((item) => {
222
+ const blocks = this.elementGuidelines
223
+ .filter((el) => {
224
+ return !el.isSameNode(item.el);
225
+ });
226
+ item.elementGuidelines = blocks;
227
+ });
228
+ }
229
+ unregisterBlock(block) {
230
+ this._blockComponents.delete(block);
231
+ }
232
+ registerContainer(container) {
233
+ this.container = container;
234
+ }
235
+ registerMargin(margin) {
236
+ this.margin = margin;
237
+ }
238
+ sanitizeNewBlock(block) {
239
+ const width = (this.config.width * .333).toFixed(2);
240
+ const height = (this.config.height * .333).toFixed(2);
241
+ return this.sanitizeBlock(Object.assign({ top: height, left: width, width: height, height: width }, block));
242
+ }
243
+ sanitizeBlock(block) {
244
+ return Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || guid('xxxxxxxxxxxx') });
245
+ }
246
+ ngOnDestroy() {
247
+ this._destroy$.next();
248
+ this._destroy$.complete();
249
+ }
250
+ }
251
+ BlockEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
252
+ BlockEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService });
253
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, decorators: [{
254
+ type: Injectable
255
+ }] });
256
+
257
+ var BlockType;
258
+ (function (BlockType) {
259
+ BlockType["Rectangle"] = "rectangle";
260
+ BlockType["ShortText"] = "shorttext";
261
+ BlockType["LongText"] = "longtext";
262
+ BlockType["Image"] = "image";
263
+ BlockType["RadioButton"] = "radiobutton";
264
+ BlockType["Checkbox"] = "checkbox";
265
+ BlockType["Signature"] = "signature";
266
+ BlockType["Pdf"] = "pdf";
267
+ BlockType["Date"] = "date";
268
+ })(BlockType || (BlockType = {}));
120
269
 
121
- class FsBlockComponent {
122
- constructor(_service, _elementRef, _cdRef) {
123
- this._service = _service;
124
- this._elementRef = _elementRef;
125
- this._cdRef = _cdRef;
126
- this.changed = new EventEmitter();
127
- this.htmlConfig = {};
128
- this._editable = false;
129
- this._selectedElements = [];
130
- this._destroy$ = new Subject();
131
- }
132
- get el() {
133
- return this.element.nativeElement;
134
- }
135
- get moveable() {
136
- return this._moveable;
137
- }
138
- get editable() {
139
- return this._editable;
140
- }
141
- set elementGuidelines(value) {
142
- this._moveable.elementGuidelines = value;
143
- }
144
- set editable(value) {
145
- this._editable = value;
146
- if (!value) {
147
- this.deselectContent();
148
- }
149
- }
150
- set clippable(value) {
151
- this._moveable.clippable = value;
152
- }
153
- get transformable() {
154
- return this._transformable;
155
- }
156
- set transformable(value) {
157
- this._transformable = value;
158
- this.moveable.draggable = value;
159
- this.moveable.resizable = value;
160
- this.moveable.draggable = value;
161
- this.moveable.roundable = value;
162
- this.moveable.rotatable = value;
163
- }
164
- set lineHeight(value) {
165
- this.block.lineHeight = value;
166
- this._triggerChanged();
167
- }
168
- set borderWidth(value) {
169
- this.block.borderWidth = value;
170
- this._triggerChanged();
171
- }
172
- set fontSize(value) {
173
- this.block.fontSize = value;
174
- this._triggerChanged();
175
- }
176
- set backgroundColor(value) {
177
- this.block.backgroundColor = value;
178
- this._triggerChanged();
179
- }
180
- set width(value) {
181
- this.block.width = parseFloat(value);
182
- this.element.nativeElement.style.width = `${this.block.width}${this.unit}`;
183
- this._moveable.updateRect();
184
- this._triggerChanged();
185
- }
186
- set height(value) {
187
- this.block.height = parseFloat(value);
188
- this.element.nativeElement.style.height = `${this.block.height}${this.unit}`;
189
- this._moveable.updateRect();
190
- this._triggerChanged();
191
- }
192
- set top(value) {
193
- this.block.top = parseFloat(value);
194
- this.element.nativeElement.style.top = `${this.block.top}${this.unit}`;
195
- this._moveable.updateRect();
196
- this._triggerChanged();
197
- }
198
- set left(value) {
199
- this.block.left = parseFloat(value);
200
- this.element.nativeElement.style.left = `${this.block.left}${this.unit}`;
201
- this._moveable.updateRect();
202
- this._triggerChanged();
203
- }
204
- set rotate(value) {
205
- this.block.rotate = parseFloat(value);
206
- this._moveable.request('rotatable', { rotate: this.block.rotate }, true);
207
- this._triggerChanged();
208
- }
209
- set shapeRadius(value) {
210
- this.block.shapeRadius = value;
211
- this._triggerChanged();
212
- }
213
- set index(value) {
214
- this.block.index = value;
215
- }
216
- set borderColor(value) {
217
- this.block.borderColor = value;
218
- this._triggerChanged();
219
- }
220
- set paddingAll(value) {
221
- this.block.padding = value;
222
- this.block.paddingTop = null;
223
- this.block.paddingBottom = null;
224
- this.block.paddingLeft = null;
225
- this.block.paddingRight = null;
226
- this._triggerChanged();
227
- }
228
- padding(name, value) {
229
- this.block[name] = value;
230
- this.block.padding = null;
231
- this._triggerChanged();
232
- }
233
- set imageUrl(value) {
234
- this.block.imageUrl = value;
235
- this._triggerChanged();
236
- }
237
- set fontColor(value) {
238
- this.block.fontColor = value;
239
- this._triggerChanged();
240
- }
241
- set verticalAlign(value) {
242
- this.block.verticalAlign = value;
243
- this._triggerChanged();
244
- }
245
- shapeRound(name, value) {
246
- this.block[name] = value;
247
- this._triggerChanged();
248
- }
249
- set horizontalAlign(value) {
250
- this.block.horizontalAlign = value;
251
- this._triggerChanged();
252
- }
253
- set italic(value) {
254
- this.block.italic = value;
255
- this._triggerChanged();
256
- }
257
- get italic() {
258
- return this.block.italic;
259
- }
260
- set bold(value) {
261
- this.block.bold = value;
262
- this._triggerChanged();
263
- }
264
- get bold() {
265
- return this.block.bold;
266
- }
267
- set underline(value) {
268
- this.block.underline = value;
269
- this._triggerChanged();
270
- }
271
- get underline() {
272
- return this.block.underline;
273
- }
274
- updateRect() {
275
- this.moveable.updateRect();
276
- }
277
- markForCheck() {
278
- this._cdRef.markForCheck();
279
- }
280
- ngOnInit() {
281
- this.block = this._service.sanitizeBlock(this.block);
282
- this.unit = this._service.config.unit;
283
- this.content = this.block.content;
284
- this.htmlConfig = {
285
- autofocus: false,
286
- froalaConfig: {}
287
- };
288
- }
289
- saveSelectedElements() {
290
- this._selectedElements = this.htmlEditor.editor.selection.blocks();
291
- }
292
- clearSelectedElements() {
293
- this._selectedElements = [];
294
- }
295
- ngAfterContentInit() {
296
- this.el.style.width = this.block.width + this.unit;
297
- this.el.style.height = this.block.height + this.unit;
298
- this.el.style.top = this.block.top + this.unit;
299
- this.el.style.left = this.block.left + this.unit;
300
- this._setTransform();
301
- fromEvent(this.contentEditable.nativeElement, 'input')
302
- .pipe(takeUntil(this._destroy$)).subscribe((event) => {
303
- this.block.content = event.target.innerHTML;
304
- this._triggerChanged();
305
- });
306
- fromEvent(this.el, 'mousedown')
307
- .pipe(takeUntil(this._destroy$), filter(() => !this.block.readonly)).subscribe((event) => {
308
- if (this.editable) {
309
- if (this.contentElement.nativeElement.isSameNode(event.target)) {
310
- event.preventDefault();
311
- event.stopImmediatePropagation();
312
- event.stopPropagation();
313
- }
314
- }
315
- else {
316
- this._service.selectedBlockComponents = [this];
317
- }
318
- });
319
- fromEvent(this.el, 'dblclick')
320
- .pipe(filter(() => (!this.editable)), takeUntil(this._destroy$))
321
- .subscribe((event) => {
322
- if (this.block.readonly) {
323
- event.preventDefault();
324
- }
325
- else {
326
- this.editable = true;
327
- this._cdRef.markForCheck();
328
- setTimeout(() => {
329
- this.selectAll();
330
- });
331
- }
332
- });
333
- this._moveable = new Moveable(this._elementRef.nativeElement, {
334
- target: this.el,
335
- container: this._service.container,
336
- draggable: false,
337
- resizable: false,
338
- scalable: false,
339
- rotatable: false,
340
- warpable: false,
341
- origin: false,
342
- keepRatio: false,
343
- snappable: true,
344
- snapHorizontal: true,
345
- snapVertical: true,
346
- snapCenter: true,
347
- snapElement: true,
348
- edge: false,
349
- throttleDrag: 1,
350
- throttleScale: 0.01,
351
- throttleRotate: 1,
352
- throttleResize: 1,
353
- });
354
- this._service.registerBlock(this);
355
- this._moveable
356
- .on('clip', e => {
357
- this.block.clipPath = e.clipStyle;
358
- e.target.style.clipPath = e.clipStyle;
359
- this._triggerChanged();
360
- });
361
- this._moveable.on('dragStart', ({ target, clientX, clientY }) => {
362
- this.editable = false;
363
- }).on('drag', ({ target, left, top }) => {
364
- target.style.left = this.pxToIn(left) + this.unit;
365
- target.style.top = this.pxToIn(top) + this.unit;
366
- this.block.top = this.pxToIn(top);
367
- this.block.left = this.pxToIn(left);
368
- this._triggerChanged();
369
- });
370
- this._moveable.on('resizeStart', ({ target, clientX, clientY }) => {
371
- this.editable = false;
372
- }).on('resize', ({ target, width, height, dist, delta, direction }) => {
373
- width = this.pxToIn(width);
374
- height = this.pxToIn(height);
375
- if (delta[0]) {
376
- this.block.width = width;
377
- target.style.width = width + this.unit;
378
- }
379
- if (delta[1]) {
380
- this.block.height = height;
381
- target.style.height = height + this.unit;
382
- }
383
- const transform = [0, 0];
384
- if (direction[1] === -1) {
385
- transform[1] = dist[1] * -1;
386
- }
387
- if (direction[0] === -1) {
388
- transform[0] = dist[0] * -1;
389
- }
390
- this._setTransform([`translate(${transform[0]}px, ${transform[1]}px)`]);
391
- this._triggerChanged();
392
- }).on('resizeEnd', ({ target }) => {
393
- const matrix = new WebKitCSSMatrix(target.style.transform);
394
- this.block.top = parseFloat(target.style.top) + this.pxToIn(matrix.m42);
395
- this.block.left = parseFloat(target.style.left) + this.pxToIn(matrix.m41);
396
- target.style.top = this.block.top + this.unit;
397
- target.style.left = this.block.left + this.unit;
398
- this._setTransform();
399
- this._triggerChanged();
400
- });
401
- this._moveable.on('rotateStart', ({ target, clientX, clientY }) => {
402
- this.editable = false;
403
- this._rotateStart = this.block.rotate || 0;
404
- }).on('rotate', ({ rotate, transform }) => {
405
- this.block.rotate = this._rotateStart + rotate;
406
- this.el.style.transform = transform;
407
- this._triggerChanged();
408
- });
409
- }
410
- pxToIn(px) {
411
- return this.round(px / 96, 2);
412
- }
413
- round(value, decimals) {
414
- return parseFloat(value.toFixed(decimals));
415
- }
416
- deselect() {
417
- this.transformable = false;
418
- this.editable = false;
419
- }
420
- deselectContent() {
421
- if (window.getSelection) {
422
- if (window.getSelection().empty) {
423
- window.getSelection().empty();
424
- }
425
- else if (window.getSelection().removeAllRanges) {
426
- window.getSelection().removeAllRanges();
427
- }
428
- }
429
- }
430
- selectAll() {
431
- const range = document.createRange();
432
- range.selectNodeContents(this.contentEditable.nativeElement);
433
- const sel = window.getSelection();
434
- sel.removeAllRanges();
435
- sel.addRange(range);
436
- }
437
- ngOnDestroy() {
438
- this._destroy$.next();
439
- this._destroy$.complete();
440
- }
441
- _setTransform(transforms = []) {
442
- transforms = transforms !== null && transforms !== void 0 ? transforms : [];
443
- if (this.block.rotate) {
444
- transforms.push(`rotate(${this.block.rotate}deg)`);
445
- }
446
- this.el.style.transform = transforms.join(' ');
447
- }
448
- _triggerChanged() {
449
- this.changed.emit(this.block);
450
- }
451
- }
452
- 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 }], target: i0.ɵɵFactoryTarget.Component });
453
- FsBlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html" }, outputs: { changed: "changed" }, 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 }, { propertyName: "htmlEditor", first: true, predicate: FsHtmlEditorComponent, descendants: true }], ngImport: i0, template: "<div\n #element\n class=\"block\"\n [ngClass]=\"{ editable: editable, readonly: block.readonly }\">\n <div\n #contentElement\n class=\"content\"\n [style.zIndex]=\"block.index\"\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.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 + unit : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + unit : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + unit : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + unit : ''\"\n [style.padding]=\"block.padding ? block.padding + unit : ''\"\n [style.clipPath]=\"block.clipPath\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + unit : ''\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <img [src]=\"block.imageUrl\" *ngIf=\"block.imageUrl\">\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n", styles: [".block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.block .content-editable{outline:none;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:1px dashed #c5c5c5;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}: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: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
454
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, decorators: [{
455
- type: Component,
456
- args: [{
457
- selector: 'fs-block',
458
- templateUrl: 'block.component.html',
459
- styleUrls: ['block.component.scss'],
460
- changeDetection: ChangeDetectionStrategy.OnPush,
461
- }]
462
- }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { element: [{
463
- type: ViewChild,
464
- args: ['element', { static: true }]
465
- }], contentElement: [{
466
- type: ViewChild,
467
- args: ['contentElement', { static: true }]
468
- }], contentEditable: [{
469
- type: ViewChild,
470
- args: ['contentEditable', { static: true }]
471
- }], htmlEditor: [{
472
- type: ViewChild,
473
- args: [FsHtmlEditorComponent]
474
- }], block: [{
475
- type: Input
476
- }], html: [{
477
- type: Input
478
- }], changed: [{
479
- type: Output
270
+ class FsBlockComponent {
271
+ constructor(_blockEditor, _elementRef, _cdRef) {
272
+ this._blockEditor = _blockEditor;
273
+ this._elementRef = _elementRef;
274
+ this._cdRef = _cdRef;
275
+ this.transformating = false;
276
+ this.BlockType = BlockType;
277
+ this._editable = false;
278
+ this._transformable = false;
279
+ this._destroy$ = new Subject();
280
+ }
281
+ get el() {
282
+ return this.element.nativeElement;
283
+ }
284
+ get moveable() {
285
+ return this._moveable;
286
+ }
287
+ get editable() {
288
+ return this._editable;
289
+ }
290
+ set elementGuidelines(value) {
291
+ this.moveable.elementGuidelines = value;
292
+ }
293
+ set editable(value) {
294
+ this._editable = value;
295
+ if (!value) {
296
+ this.deselectContent();
297
+ }
298
+ }
299
+ set clippable(value) {
300
+ this.moveable.clippable = value;
301
+ }
302
+ get transformable() {
303
+ return this._transformable;
304
+ }
305
+ set transformable(value) {
306
+ this._transformable = value;
307
+ this.moveable.draggable = value;
308
+ this.moveable.resizable = value;
309
+ this.moveable.roundable = value;
310
+ this.moveable.rotatable = value;
311
+ }
312
+ set width(value) {
313
+ this.element.nativeElement.style.width = `${parseFloat(value)}${this.unit}`;
314
+ this.moveable.updateRect();
315
+ }
316
+ set height(value) {
317
+ this.element.nativeElement.style.height = `${parseFloat(value)}${this.unit}`;
318
+ this.moveable.updateRect();
319
+ }
320
+ set top(value) {
321
+ this.element.nativeElement.style.top = `${parseFloat(value)}${this.unit}`;
322
+ this.moveable.updateRect();
323
+ }
324
+ set left(value) {
325
+ this.element.nativeElement.style.left = `${parseFloat(value)}${this.unit}`;
326
+ this.moveable.updateRect();
327
+ }
328
+ set rotate(value) {
329
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
330
+ this.moveable.updateRect();
331
+ }
332
+ set index(value) {
333
+ this.block.index = value;
334
+ }
335
+ set keepRatio(value) {
336
+ this.moveable.keepRatio = value;
337
+ }
338
+ markForCheck() {
339
+ this._cdRef.markForCheck();
340
+ }
341
+ ngOnInit() {
342
+ this.unit = this._blockEditor.config.unit;
343
+ this.content = this.block.content;
344
+ this._blockEditor.blockChanged$
345
+ .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
346
+ .subscribe((block) => {
347
+ this.keepRatio = block.keepRatio;
348
+ this.width = block.width;
349
+ this.height = block.height;
350
+ this.top = block.top;
351
+ this.left = block.left;
352
+ this._cdRef.markForCheck();
353
+ });
354
+ }
355
+ ngAfterContentInit() {
356
+ setTimeout(() => {
357
+ this._initEvents();
358
+ this._initMoveable();
359
+ this._setTransform();
360
+ this.width = this.block.width;
361
+ this.height = this.block.height;
362
+ this.top = this.block.top;
363
+ this.left = this.block.left;
364
+ this._blockEditor.registerBlock(this.block, this);
365
+ });
366
+ }
367
+ pxToIn(px) {
368
+ return this.round(px / 96, 2);
369
+ }
370
+ round(value, decimals) {
371
+ return parseFloat(value.toFixed(decimals));
372
+ }
373
+ deselect() {
374
+ this.transformable = false;
375
+ this.editable = false;
376
+ }
377
+ deselectContent() {
378
+ if (window.getSelection) {
379
+ if (window.getSelection().empty) {
380
+ window.getSelection().empty();
381
+ }
382
+ else if (window.getSelection().removeAllRanges) {
383
+ window.getSelection().removeAllRanges();
384
+ }
385
+ }
386
+ }
387
+ selectAll() {
388
+ const range = document.createRange();
389
+ range.selectNodeContents(this.contentEditable.nativeElement);
390
+ const sel = window.getSelection();
391
+ sel.removeAllRanges();
392
+ sel.addRange(range);
393
+ }
394
+ ngOnDestroy() {
395
+ this._blockEditor.unregisterBlock(this.block);
396
+ this._destroy$.next();
397
+ this._destroy$.complete();
398
+ }
399
+ _setTransform(transforms = []) {
400
+ transforms = transforms !== null && transforms !== void 0 ? transforms : [];
401
+ if (this.block.rotate) {
402
+ transforms.push(`rotate(${this.block.rotate}deg)`);
403
+ }
404
+ this.el.style.transform = transforms.join(' ');
405
+ }
406
+ _triggerChanged() {
407
+ this._blockEditor.blockChange(this.block);
408
+ }
409
+ _initMoveable() {
410
+ this._moveable = new Moveable(this._elementRef.nativeElement, {
411
+ target: this.el,
412
+ container: this._blockEditor.container,
413
+ draggable: false,
414
+ resizable: false,
415
+ scalable: false,
416
+ rotatable: false,
417
+ warpable: false,
418
+ origin: false,
419
+ keepRatio: this.block.keepRatio,
420
+ snappable: true,
421
+ edge: false,
422
+ throttleDrag: 1,
423
+ throttleScale: 0.01,
424
+ throttleRotate: 1,
425
+ throttleResize: 1,
426
+ });
427
+ this.moveable
428
+ .on('clip', (e) => {
429
+ this.block.clipPath = e.clipStyle;
430
+ e.target.style.clipPath = e.clipStyle;
431
+ this._triggerChanged();
432
+ });
433
+ this.moveable
434
+ .on('dragStart', () => {
435
+ this.editable = false;
436
+ this.transformating = true;
437
+ this._cdRef.markForCheck();
438
+ })
439
+ .on('drag', ({ target, left, top }) => {
440
+ target.style.left = this.pxToIn(left) + this.unit;
441
+ target.style.top = this.pxToIn(top) + this.unit;
442
+ this.block.top = this.pxToIn(top);
443
+ this.block.left = this.pxToIn(left);
444
+ this._triggerChanged();
445
+ })
446
+ .on('dragEnd', () => {
447
+ this.transformating = false;
448
+ this._cdRef.markForCheck();
449
+ })
450
+ .on('resizeStart', () => {
451
+ this.editable = false;
452
+ this.zoompan.disable();
453
+ this.transformating = true;
454
+ this._cdRef.markForCheck();
455
+ })
456
+ .on('resize', ({ target, width, height, dist, delta, direction }) => {
457
+ width = this.pxToIn(width);
458
+ height = this.pxToIn(height);
459
+ if (delta[0]) {
460
+ this.block.width = width;
461
+ target.style.width = width + this.unit;
462
+ }
463
+ if (delta[1]) {
464
+ this.block.height = height;
465
+ target.style.height = height + this.unit;
466
+ }
467
+ const transform = [0, 0];
468
+ if (direction[1] === -1) {
469
+ transform[1] = dist[1] * -1;
470
+ }
471
+ if (direction[0] === -1) {
472
+ transform[0] = dist[0] * -1;
473
+ }
474
+ this._setTransform([`translate(${transform[0]}px, ${transform[1]}px)`]);
475
+ this._triggerChanged();
476
+ })
477
+ .on('resizeEnd', ({ target }) => {
478
+ const matrix = new WebKitCSSMatrix(target.style.transform);
479
+ this.block.top = parseFloat(target.style.top) + this.pxToIn(matrix.m42);
480
+ this.block.left = parseFloat(target.style.left) + this.pxToIn(matrix.m41);
481
+ target.style.top = this.block.top + this.unit;
482
+ target.style.left = this.block.left + this.unit;
483
+ this._setTransform();
484
+ this._triggerChanged();
485
+ this.zoompan.enable();
486
+ this.transformating = false;
487
+ this._cdRef.markForCheck();
488
+ })
489
+ .on('rotateStart', () => {
490
+ this.zoompan.disable();
491
+ this.editable = false;
492
+ this._rotateStart = this.block.rotate || 0;
493
+ this.transformating = true;
494
+ this._cdRef.markForCheck();
495
+ })
496
+ .on('rotate', ({ rotate, transform }) => {
497
+ this.block.rotate = this._rotateStart + rotate;
498
+ this.el.style.transform = transform;
499
+ this._triggerChanged();
500
+ this.zoompan.enable();
501
+ })
502
+ .on('rotateEnd', () => {
503
+ this.transformating = false;
504
+ this._cdRef.markForCheck();
505
+ });
506
+ }
507
+ _initEvents() {
508
+ fromEvent(this.contentEditable.nativeElement, 'input')
509
+ .pipe(takeUntil(this._destroy$)).subscribe((event) => {
510
+ this.block.content = event.target.innerHTML;
511
+ this._triggerChanged();
512
+ });
513
+ fromEvent(this.el, 'mousedown')
514
+ .pipe(takeUntil(this._destroy$), filter(() => !this.block.readonly)).subscribe((event) => {
515
+ this.zoompan.disable();
516
+ if (this.editable) {
517
+ if (this.contentElement.nativeElement.isSameNode(event.target)) {
518
+ event.preventDefault();
519
+ event.stopImmediatePropagation();
520
+ event.stopPropagation();
521
+ }
522
+ }
523
+ else {
524
+ this._blockEditor.selectedBlock = this.block;
525
+ }
526
+ });
527
+ fromEvent(this.el, 'mouseup')
528
+ .pipe(takeUntil(this._destroy$), filter(() => !this.block.readonly)).subscribe(() => {
529
+ this.zoompan.enable();
530
+ });
531
+ fromEvent(this.el, 'dblclick')
532
+ .pipe(filter(() => (!this.editable)), takeUntil(this._destroy$))
533
+ .subscribe((event) => {
534
+ if (this.block.readonly) {
535
+ event.preventDefault();
536
+ }
537
+ else {
538
+ this.editable = true;
539
+ this._cdRef.markForCheck();
540
+ setTimeout(() => {
541
+ this.selectAll();
542
+ });
543
+ }
544
+ });
545
+ }
546
+ }
547
+ 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 }], target: i0.ɵɵFactoryTarget.Component });
548
+ 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 [ngClass]=\"{ editable: editable, readonly: block.readonly }\">\n <div\n #contentElement\n class=\"content\"\n [style.zIndex]=\"block.index\"\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.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 + unit : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + unit : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + unit : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + unit : ''\"\n [style.padding]=\"block.padding ? block.padding + unit : ''\"\n [style.clipPath]=\"block.clipPath\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + unit : ''\"\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 *ngSwitchCase=\"BlockType.Pdf\">\n <img [src]=\"block.imageUrl\">\n </ng-container>\n <img [src]=\"block.imageUrl\" *ngIf=\"block.imageUrl\">\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.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </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{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.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 .content-editable{outline:none;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:1px dashed #c5c5c5;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}: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: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, decorators: [{
550
+ type: Component,
551
+ args: [{
552
+ selector: 'fs-block',
553
+ templateUrl: 'block.component.html',
554
+ styleUrls: ['block.component.scss'],
555
+ changeDetection: ChangeDetectionStrategy.OnPush,
556
+ }]
557
+ }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { element: [{
558
+ type: ViewChild,
559
+ args: ['element', { static: true }]
560
+ }], contentElement: [{
561
+ type: ViewChild,
562
+ args: ['contentElement', { static: true }]
563
+ }], contentEditable: [{
564
+ type: ViewChild,
565
+ args: ['contentEditable', { static: true }]
566
+ }], block: [{
567
+ type: Input
568
+ }], html: [{
569
+ type: Input
570
+ }], zoompan: [{
571
+ type: Input
572
+ }], transformating: [{
573
+ type: HostBinding,
574
+ args: ['class.transforming']
480
575
  }] } });
481
576
 
482
- class FsBlockEditorSidebarPanelDirective {
483
- constructor(templateRef) {
484
- this.templateRef = templateRef;
485
- this.show = true;
486
- }
487
- }
488
- FsBlockEditorSidebarPanelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
489
- FsBlockEditorSidebarPanelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0 });
490
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, decorators: [{
491
- type: Directive,
492
- args: [{
493
- selector: '[fsBlockEditorSidebarPanel]'
494
- }]
495
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { label: [{
496
- type: Input
497
- }], show: [{
498
- type: Input
577
+ class FsBlockEditorSidebarPanelDirective {
578
+ constructor(templateRef) {
579
+ this.templateRef = templateRef;
580
+ this.show = true;
581
+ }
582
+ }
583
+ FsBlockEditorSidebarPanelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
584
+ FsBlockEditorSidebarPanelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0 });
585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, decorators: [{
586
+ type: Directive,
587
+ args: [{
588
+ selector: '[fsBlockEditorSidebarPanel]'
589
+ }]
590
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { label: [{
591
+ type: Input
592
+ }], show: [{
593
+ type: Input
499
594
  }] } });
500
595
 
501
- class FsBlockEditorMarginDirective {
502
- constructor(_elementRef) {
503
- this._elementRef = _elementRef;
504
- }
505
- get element() {
506
- return this._elementRef.nativeElement;
507
- }
508
- }
509
- FsBlockEditorMarginDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
510
- FsBlockEditorMarginDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0 });
511
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, decorators: [{
512
- type: Directive,
513
- args: [{
514
- selector: '[fsBlockEditorMargin]'
515
- }]
596
+ const BlockTypes = [
597
+ { value: BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4' },
598
+ { value: BlockType.ShortText, name: 'Short Text', icon: 'short_text' },
599
+ { value: BlockType.LongText, name: 'Long Text', icon: 'subject' },
600
+ { value: BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked' },
601
+ { value: BlockType.Checkbox, name: 'Checkbox', icon: 'check_box' },
602
+ { value: BlockType.Date, name: 'Date', icon: 'calendar_today' },
603
+ { value: BlockType.Signature, name: 'Signature', icon: 'draw' },
604
+ { value: BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*' },
605
+ { value: BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf' },
606
+ ];
607
+
608
+ class SidebarComponent {
609
+ constructor(_el, _blockEditor, _cdRef, _prompt) {
610
+ this._el = _el;
611
+ this._blockEditor = _blockEditor;
612
+ this._cdRef = _cdRef;
613
+ this._prompt = _prompt;
614
+ this.BlockTypes = BlockTypes;
615
+ this.blockTypeNames = index(BlockTypes, 'value', 'name');
616
+ this.BlockType = BlockType;
617
+ this._destroy$ = new Subject();
618
+ }
619
+ get el() {
620
+ return this._el.nativeElement;
621
+ }
622
+ ngOnInit() {
623
+ this._blockEditor.selectedBlocks$
624
+ .pipe(takeUntil(this._destroy$))
625
+ .subscribe((blocks) => {
626
+ this.clippable = false;
627
+ this.block = blocks[0] ? blocks[0] : null;
628
+ this._cdRef.markForCheck();
629
+ });
630
+ this._blockEditor.blockChanged$
631
+ .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
632
+ .subscribe(() => {
633
+ this._cdRef.markForCheck();
634
+ });
635
+ }
636
+ verticalAlignClick(value) {
637
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
638
+ }
639
+ boldClick() {
640
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
641
+ }
642
+ fontColorChange(value) {
643
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
644
+ }
645
+ lineHeightChange(value) {
646
+ value = this.validNumeric(value) ? value : null;
647
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'lineHeight');
648
+ }
649
+ fontSizeChange(value) {
650
+ value = this.validNumeric(value) ? value : null;
651
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontSize');
652
+ }
653
+ borderWidthChange(value) {
654
+ value = this.validNumeric(value) ? value : null;
655
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderWidth');
656
+ }
657
+ italicClick() {
658
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
659
+ }
660
+ underlineClick() {
661
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
662
+ }
663
+ backgroundColorChange(value) {
664
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
665
+ }
666
+ widthChange(value) {
667
+ value = this.validNumeric(value) ? value : null;
668
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'width');
669
+ }
670
+ heightChange(value) {
671
+ value = this.validNumeric(value) ? value : null;
672
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'height');
673
+ }
674
+ topChange(value) {
675
+ value = this.validNumeric(value) ? value : null;
676
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'top');
677
+ }
678
+ leftChange(value) {
679
+ value = this.validNumeric(value) ? value : null;
680
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'left');
681
+ }
682
+ rotateChange(value) {
683
+ value = this.validNumeric(value) ? value : null;
684
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'rotate');
685
+ }
686
+ paddingChange(name, value) {
687
+ value = this.validNumeric(value) ? value : null;
688
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'padding');
689
+ }
690
+ paddingAllChange(value) {
691
+ value = this.validNumeric(value) ? value : null;
692
+ this.block.paddingTop = value;
693
+ this.block.paddingLeft = value;
694
+ this.block.paddingBottom = value;
695
+ this.block.paddingRight = value;
696
+ this.paddingChange('top', value);
697
+ this.paddingChange('left', value);
698
+ this.paddingChange('right', value);
699
+ this.paddingChange('bottom', value);
700
+ }
701
+ borderColorChange(value) {
702
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
703
+ }
704
+ toggleKeepRatio() {
705
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
706
+ }
707
+ horizontalAlignClick(value) {
708
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
709
+ }
710
+ shapeRound(name) {
711
+ const value = this.block[name] === 'round' ? 'square' : 'round';
712
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
713
+ }
714
+ imageRemove() {
715
+ this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
716
+ }
717
+ imageClip() {
718
+ this.clippable = !this.clippable;
719
+ this._blockEditor.selectedBlockComponentChangeProperty(this.clippable, 'clippable');
720
+ }
721
+ shapeRadiusChange(value) {
722
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'shapeRadius');
723
+ }
724
+ blockChangeProperty(value, name) {
725
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
726
+ }
727
+ imageSelect(fsFile) {
728
+ if (this.config.imageUpload) {
729
+ this.config.imageUpload(fsFile.file)
730
+ .subscribe((value) => {
731
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
732
+ });
733
+ }
734
+ }
735
+ blockRemoveClick() {
736
+ if (this.config.blocksRemove) {
737
+ this._prompt.confirm({
738
+ title: 'Confirm',
739
+ template: 'Are you sure your would like to delete this block?',
740
+ })
741
+ .pipe(switchMap(() => this.config.blocksRemove(this._blockEditor.selectedBlocks)), takeUntil(this._destroy$))
742
+ .subscribe(() => {
743
+ this._blockEditor.removeSelectedBlocks();
744
+ });
745
+ }
746
+ }
747
+ blockUpload(blockType, fsFile) {
748
+ const block = this._blockEditor.sanitizeNewBlock({
749
+ type: blockType,
750
+ });
751
+ this._blockEditor.blockUpload(block, fsFile);
752
+ }
753
+ blockAdd(type) {
754
+ if (type === BlockType.Pdf || type === BlockType.Image) {
755
+ return;
756
+ }
757
+ const block = this._blockEditor.sanitizeNewBlock({
758
+ type,
759
+ });
760
+ this._blockEditor.blockAdd(block);
761
+ }
762
+ layerMove(direction) {
763
+ this._blockEditor.blockComponents.forEach((blockComponent) => {
764
+ if (this._blockEditor.isSelectedBlock(blockComponent)) {
765
+ blockComponent.block.index += (999 * direction);
766
+ }
767
+ });
768
+ const sorted = this._blockEditor.blockComponents.sort((a, b) => {
769
+ return a.block.index > b.block.index ? 1 : -1;
770
+ });
771
+ sorted.forEach((item, index) => {
772
+ item.block.index = index;
773
+ item.markForCheck();
774
+ });
775
+ if (this.config.blocksLevelChanged) {
776
+ this.config.blocksLevelChanged(sorted.map((item) => item.block));
777
+ }
778
+ }
779
+ layerUp() {
780
+ this.layerMove(1);
781
+ }
782
+ layerDown() {
783
+ this.layerMove(-1);
784
+ }
785
+ blockChanged(block) {
786
+ if (this.config.blockChanged) {
787
+ this.config.blockChanged(block);
788
+ }
789
+ }
790
+ inputFocus(event) {
791
+ event.target.select();
792
+ }
793
+ ngOnDestroy() {
794
+ this._destroy$.next();
795
+ this._destroy$.complete();
796
+ }
797
+ validNumeric(value) {
798
+ return !value || !!String(value).match(/^\d*\.?\d*$/);
799
+ }
800
+ }
801
+ 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.FsPrompt }], target: i0.ɵɵFactoryTarget.Component });
802
+ SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Add</div>\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\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 *ngTemplateOutlet=\"addButton\"></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\"></ng-container>\n </fs-file>\n </ng-template>\n\n <ng-template #addButton>\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>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <ng-container *ngIf=\"block\">\n <button\n 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 </ng-container>\n </div>\n </div>\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 (ngModelChange)=\"leftChange($event)\">\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 (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\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 (ngModelChange)=\"widthChange($event)\">\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 (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\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 <div class=\"sidebar-panel form-field-panel\">\n <div class=\"sidebar-label\">{{blockTypeNames[block.type]}} Field</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.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.format\"\n name=\"format\"\n placeholder=\"Format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\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 [matTextareaAutosize]=\"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.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 [matTextareaAutosize]=\"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 <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\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 [matTextareaAutosize]=\"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 [matTextareaAutosize]=\"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 <mat-label>Index</mat-label>\n <input\n matInput\n [(ngModel)]=\"block.index\"\n name=\"index\"\n (ngModelChange)=\"blockChangeProperty($event, 'index')\">\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 </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-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 (ngModelChange)=\"fontSizeChange($event)\"\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 (ngModelChange)=\"lineHeightChange($event)\"\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 === '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 (ngModelChange)=\"borderWidthChange($event)\"\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 (ngModelChange)=\"shapeRadiusChange($event)\"\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 <ng-container *ngIf=\"block.type !== BlockType.Pdf\">\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 type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></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 </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 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 (ngModelChange)=\"paddingChange('paddingTop',$event)\"\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 (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\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 (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\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 (ngModelChange)=\"paddingChange('paddingRight',$event)\"\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", styles: [".sidebar{width:285px;font-size:14px;height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.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 ::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.form-field-panel mat-form-field+mat-form-field{margin-top:12px}.sidebar .sidebar-panel.info-panel .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}\n"], components: [{ type: i3.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7.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: i8.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }], directives: [{ type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i9.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.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: i12.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: i12.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i12.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6.MatPrefix, selector: "[matPrefix]" }, { type: i11.MatTextareaAutosize, selector: "textarea[mat-autosize], textarea[matTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "matAutosizeMinRows", "matAutosizeMaxRows", "mat-autosize", "matTextareaAutosize"], exportAs: ["matTextareaAutosize"] }, { type: i6.MatLabel, selector: "mat-label" }, { type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, decorators: [{
804
+ type: Component,
805
+ args: [{
806
+ selector: 'sidebar',
807
+ templateUrl: 'sidebar.component.html',
808
+ styleUrls: ['sidebar.component.scss'],
809
+ changeDetection: ChangeDetectionStrategy.OnPush,
810
+ }]
811
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i2.FsPrompt }]; }, propDecorators: { sidebarPanels: [{
812
+ type: ContentChildren,
813
+ args: [FsBlockEditorSidebarPanelDirective]
814
+ }], config: [{
815
+ type: Input
816
+ }], blocks: [{
817
+ type: Input
818
+ }] } });
819
+
820
+ class FsBlockEditorMarginDirective {
821
+ constructor(_elementRef) {
822
+ this._elementRef = _elementRef;
823
+ }
824
+ get element() {
825
+ return this._elementRef.nativeElement;
826
+ }
827
+ }
828
+ FsBlockEditorMarginDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
829
+ FsBlockEditorMarginDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0 });
830
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, decorators: [{
831
+ type: Directive,
832
+ args: [{
833
+ selector: '[fsBlockEditorMargin]'
834
+ }]
516
835
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
517
836
 
518
- class SidebarComponent {
519
- constructor(_el, _service, _cdRef) {
520
- this._el = _el;
521
- this._service = _service;
522
- this._cdRef = _cdRef;
523
- this._destroy$ = new Subject();
524
- }
525
- get changeDetector() {
526
- return this._cdRef;
527
- }
528
- get el() {
529
- return this._el.nativeElement;
530
- }
531
- ngOnInit() {
532
- this._service.selectedBlockComponents$
533
- .pipe(takeUntil(this._destroy$))
534
- .subscribe((blocks) => {
535
- this.clippable = false;
536
- this.block = blocks[0] ? blocks[0].block : null;
537
- this.changeDetector.markForCheck();
538
- if (this.config.blocksSelected) {
539
- this.config.blocksSelected(blocks.map((block) => block.block));
540
- }
541
- });
542
- }
543
- verticalAlignClick(value) {
544
- this._service.selectedBlockComponents.forEach((block) => {
545
- block.verticalAlign = value;
546
- });
547
- }
548
- boldClick() {
549
- this._service.selectedBlockComponents.forEach((block) => {
550
- block.bold = !block.bold;
551
- });
552
- }
553
- fontColorChange(value) {
554
- this._service.selectedBlockComponents.forEach((block) => {
555
- block.fontColor = value;
556
- });
557
- }
558
- lineHeightChange(value) {
559
- this._service.selectedBlockComponents.forEach((block) => {
560
- if (this.validNumeric(value)) {
561
- block.lineHeight = value || null;
562
- }
563
- });
564
- }
565
- fontSizeChange(value) {
566
- this._service.selectedBlockComponents.forEach((block) => {
567
- if (this.validNumeric(value)) {
568
- block.fontSize = value || null;
569
- }
570
- });
571
- }
572
- borderWidthChange(value) {
573
- this._service.selectedBlockComponents.forEach((block) => {
574
- if (this.validNumeric(value)) {
575
- block.borderWidth = value || null;
576
- }
577
- });
578
- }
579
- italicClick() {
580
- this._service.selectedBlockComponents.forEach((block) => {
581
- block.italic = !block.italic;
582
- });
583
- }
584
- underlineClick() {
585
- this._service.selectedBlockComponents.forEach((block) => {
586
- block.underline = !block.underline;
587
- });
588
- }
589
- backgroundColorChange(value) {
590
- this._service.selectedBlockComponents.forEach((block) => {
591
- block.backgroundColor = value;
592
- });
593
- }
594
- widthChange(value) {
595
- this._service.selectedBlockComponents.forEach((block) => {
596
- if (this.validNumeric(value)) {
597
- block.width = value;
598
- }
599
- });
600
- }
601
- heightChange(value) {
602
- this._service.selectedBlockComponents.forEach((block) => {
603
- if (this.validNumeric(value)) {
604
- block.height = value;
605
- }
606
- });
607
- }
608
- topChange(value) {
609
- this._service.selectedBlockComponents.forEach((block) => {
610
- if (this.validNumeric(value)) {
611
- block.top = value;
612
- }
613
- });
614
- }
615
- leftChange(value) {
616
- this._service.selectedBlockComponents.forEach((block) => {
617
- if (this.validNumeric(value)) {
618
- block.left = value;
619
- }
620
- });
621
- }
622
- rotateChange(value) {
623
- this._service.selectedBlockComponents.forEach((block) => {
624
- if (this.validNumeric(value)) {
625
- block.rotate = value;
626
- }
627
- });
628
- }
629
- paddingChange(name, value) {
630
- this._service.selectedBlockComponents.forEach((block) => {
631
- if (this.validNumeric(value)) {
632
- block.padding(name, value || null);
633
- }
634
- });
635
- }
636
- paddingAllChange(value) {
637
- this._service.selectedBlockComponents.forEach((block) => {
638
- if (this.validNumeric(value)) {
639
- block.paddingAll = value;
640
- }
641
- });
642
- }
643
- borderColorChange(value) {
644
- this._service.selectedBlockComponents.forEach((block) => {
645
- block.borderColor = value;
646
- });
647
- }
648
- horizontalAlignClick(value) {
649
- this._service.selectedBlockComponents.forEach((block) => {
650
- block.horizontalAlign = value;
651
- });
652
- }
653
- shapeRound(value) {
654
- this._service.selectedBlockComponents.forEach((block) => {
655
- block.shapeRound(value, block.block[value] === 'round' ? 'square' : 'round');
656
- });
657
- }
658
- imageRemove() {
659
- this._service.selectedBlockComponents.forEach((block) => {
660
- block.imageUrl = null;
661
- });
662
- }
663
- imageClip() {
664
- this.clippable = !this.clippable;
665
- this._service.selectedBlockComponents.forEach((block) => {
666
- block.clippable = this.clippable;
667
- });
668
- }
669
- shapeRadiusChange(value) {
670
- this._service.selectedBlockComponents.forEach((block) => {
671
- block.shapeRadius = value;
672
- });
673
- }
674
- fileSelect(fsFile) {
675
- if (this.config.fileUpload) {
676
- this.config.fileUpload(fsFile.file)
677
- .subscribe((value) => {
678
- this._service.selectedBlockComponents.forEach((block) => {
679
- block.imageUrl = value;
680
- });
681
- });
682
- }
683
- }
684
- blockRemoveClick() {
685
- if (this.config.blocksRemoved) {
686
- this.config.blocksRemoved(this._service.selectedBlocks)
687
- .pipe(takeUntil(this._destroy$))
688
- .subscribe(() => {
689
- this._service.selectedBlocks.forEach((block) => {
690
- this._service.removeBlock(block);
691
- });
692
- this._service.selectedBlockComponents = [];
693
- });
694
- }
695
- }
696
- blockAddClick() {
697
- const width = (this.config.width * .333).toFixed(2);
698
- const height = (this.config.height * .333).toFixed(2);
699
- const reference = guid();
700
- const block = {
701
- type: 'text',
702
- reference,
703
- top: height,
704
- left: width,
705
- width: width,
706
- height: height,
707
- };
708
- if (this.config.blockAdded) {
709
- this.config.blockAdded(block)
710
- .pipe(takeUntil(this._destroy$))
711
- .subscribe((block) => {
712
- this.addBlock(block);
713
- this.changeDetector.markForCheck();
714
- this.blockAdded
715
- .pipe(take(1), takeUntil(this._destroy$))
716
- .subscribe((blockComponent) => {
717
- this._service.selectedBlockComponents = [blockComponent];
718
- });
719
- });
720
- }
721
- }
722
- addBlock(block) {
723
- this._service.addBlock(block);
724
- this._updateIndexes();
725
- }
726
- _updateIndexes() {
727
- const sort = this.blocks.slice().sort((a, b) => {
728
- return a.index > b.index ? 1 : -1;
729
- });
730
- sort.forEach((block, index) => {
731
- this.blocks.find((item) => {
732
- return block.reference === item.reference;
733
- }).index = index;
734
- });
735
- }
736
- layerMove(direction) {
737
- this._service.blockComponents.forEach((blockComponent) => {
738
- if (this._service.isSelectedBlock(blockComponent)) {
739
- blockComponent.block.index + (999 * direction);
740
- }
741
- });
742
- const sorted = this._service.blockComponents.sort((a, b) => {
743
- return a.index > b.index ? 1 : -1;
744
- });
745
- sorted.forEach((item, index) => {
746
- item.block.index = index;
747
- item.markForCheck();
748
- });
749
- if (this.config.blocksLevelChanged) {
750
- this.config.blocksLevelChanged(sorted.map((item) => item.block));
751
- }
752
- }
753
- layerUp() {
754
- this.layerMove(1);
755
- }
756
- layerDown() {
757
- this.layerMove(-1);
758
- }
759
- getBlock(reference) {
760
- return this._service.blocks.find((block) => {
761
- return block.reference === reference;
762
- });
763
- }
764
- blockChanged(block) {
765
- if (this.config.blockChanged) {
766
- this.config.blockChanged(block);
767
- }
768
- }
769
- inputFocus(event) {
770
- event.target.select();
771
- }
772
- ngOnDestroy() {
773
- this._destroy$.next();
774
- this._destroy$.complete();
775
- }
776
- validNumeric(value) {
777
- return !value || !!String(value).match(/^\d*\.?\d*$/);
778
- }
779
- }
780
- 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 }], target: i0.ɵɵFactoryTarget.Component });
781
- SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks", blockAdded: "blockAdded" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockAddClick()\">\n <mat-icon>add</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>clear</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 </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.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\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 (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\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 (ngModelChange)=\"leftChange($event)\">\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 (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n </div>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\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 (ngModelChange)=\"fontSizeChange($event)\"\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 (ngModelChange)=\"lineHeightChange($event)\"\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 === '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 (ngModelChange)=\"borderWidthChange($event)\"\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 (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"fileSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></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 </ng-container>\n </div>\n </div>\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 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 (ngModelChange)=\"paddingChange('paddingTop',$event)\"\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 (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\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 (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\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 (ngModelChange)=\"paddingChange('paddingRight',$event)\"\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", styles: [".sidebar{width:285px;font-size:14px;height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.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 ::ng-deep .mat-form-field-prefix,.sidebar .sidebar-row ::ng-deep .field-label{color:#a5a5a5;font-size:11px;margin-right:2px}.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(.6);top:-6px;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;border-bottom:1px solid #dadada}.sidebar .sidebar-panel.info-panel .sidebar-row{justify-content:space-evenly}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.info-panel .sidebar-row >{margin:0}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}\n"], components: [{ type: i2.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: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i5.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }, { type: i6.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.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: i9.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: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i9.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4.MatPrefix, selector: "[matPrefix]" }, { type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
782
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, decorators: [{
783
- type: Component,
784
- args: [{
785
- selector: 'sidebar',
786
- templateUrl: 'sidebar.component.html',
787
- styleUrls: ['sidebar.component.scss'],
788
- changeDetection: ChangeDetectionStrategy.OnPush,
789
- }]
790
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { sidebarPanels: [{
791
- type: ContentChildren,
792
- args: [FsBlockEditorSidebarPanelDirective]
793
- }], config: [{
794
- type: Input
795
- }], blocks: [{
796
- type: Input
797
- }], blockAdded: [{
798
- type: Input
837
+ class ArtboardComponent {
838
+ constructor(_el, _blockEditor, _cdRef, _differs) {
839
+ this._el = _el;
840
+ this._blockEditor = _blockEditor;
841
+ this._cdRef = _cdRef;
842
+ this._differs = _differs;
843
+ this.blocks = [];
844
+ this._destroy$ = new Subject();
845
+ this._differ = _differs.find([]).create(null);
846
+ }
847
+ get el() {
848
+ return this._el.nativeElement;
849
+ }
850
+ ngOnInit() {
851
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
852
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
853
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
854
+ this._blockEditor.blocks$
855
+ .pipe(takeUntil(this._destroy$))
856
+ .subscribe((blocks) => {
857
+ this.blocks = blocks;
858
+ this._cdRef.markForCheck();
859
+ });
860
+ this._blockEditor.blockAdded$
861
+ .pipe(delay(300), takeUntil(this._destroy$))
862
+ .subscribe((block) => {
863
+ this._blockEditor.selectedBlocks = [block];
864
+ this._cdRef.markForCheck();
865
+ });
866
+ fromEvent(window, 'keydown')
867
+ .pipe(takeUntil(this._destroy$), filter((event) => {
868
+ return !!event.key.match(/^Arrow/) && !!this._blockEditor.selectedBlocks.length;
869
+ }))
870
+ .subscribe((event) => {
871
+ event.preventDefault();
872
+ const inchPixel = 1 / 100;
873
+ this._blockEditor.selectedComponentBlocks
874
+ .forEach((blockComponent) => {
875
+ switch (event.key) {
876
+ case 'ArrowUp':
877
+ blockComponent.top = blockComponent.block.top - inchPixel;
878
+ break;
879
+ case 'ArrowDown':
880
+ blockComponent.top = blockComponent.block.top + inchPixel;
881
+ break;
882
+ case 'ArrowLeft':
883
+ blockComponent.left = blockComponent.block.left - inchPixel;
884
+ break;
885
+ case 'ArrowRight':
886
+ blockComponent.left = blockComponent.block.left + inchPixel;
887
+ break;
888
+ }
889
+ });
890
+ });
891
+ }
892
+ blockChanged(block) {
893
+ if (this.config.blockChanged) {
894
+ this.config.blockChanged(block);
895
+ }
896
+ }
897
+ ngAfterViewInit() {
898
+ // this.blockComponents.changes
899
+ // .pipe(
900
+ // takeUntil(this._destroy$),
901
+ // )
902
+ // .subscribe((changes) => {
903
+ // const changeDiff = this._differ.diff(changes);
904
+ // if (changeDiff) {
905
+ // changeDiff.forEachAddedItem((change) => {
906
+ // //this.blockAdded.emit(change.item);
907
+ // });
908
+ // changeDiff.forEachRemovedItem((change) => {
909
+ // //this.blockRemoved.emit(change.item);
910
+ // });
911
+ // }
912
+ // });
913
+ }
914
+ ngOnDestroy() {
915
+ this._destroy$.next();
916
+ this._destroy$.complete();
917
+ }
918
+ }
919
+ 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 }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Component });
920
+ 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}.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: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
921
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ArtboardComponent, decorators: [{
922
+ type: Component,
923
+ args: [{
924
+ selector: 'app-artboard',
925
+ templateUrl: 'artboard.component.html',
926
+ styleUrls: ['artboard.component.scss'],
927
+ changeDetection: ChangeDetectionStrategy.OnPush,
928
+ }]
929
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i0.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
930
+ type: ContentChildren,
931
+ args: [FsBlockEditorSidebarPanelDirective]
932
+ }], blockComponents: [{
933
+ type: ViewChildren,
934
+ args: [FsBlockComponent]
935
+ }], artboard: [{
936
+ type: ViewChild,
937
+ args: ['artboard', { static: true }]
938
+ }], marginContainer: [{
939
+ type: ViewChild,
940
+ args: ['marginContainer', { static: true }]
941
+ }], margins: [{
942
+ type: ViewChildren,
943
+ args: [FsBlockEditorMarginDirective]
944
+ }], sidebar: [{
945
+ type: ViewChild,
946
+ args: [SidebarComponent, { static: true }]
947
+ }], config: [{
948
+ type: Input
949
+ }], zoompan: [{
950
+ type: Input
799
951
  }] } });
800
952
 
801
- class FsBlockEditorComponent {
802
- constructor(_el, _service, _cdRef, _differs) {
803
- this._el = _el;
804
- this._service = _service;
805
- this._cdRef = _cdRef;
806
- this._differs = _differs;
807
- this.blockAdded = new EventEmitter();
808
- this.blockRemoved = new EventEmitter();
809
- this._destroy$ = new Subject();
810
- this._differ = _differs.find([]).create(null);
811
- }
812
- get el() {
813
- return this._el.nativeElement;
814
- }
815
- ngOnInit() {
816
- this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
817
- this._service.registerContainer(this.artboard.nativeElement);
818
- this._service.registerMargin(this.marginContainer.nativeElement);
819
- this._service.blocks = this.config.blocks;
820
- this._service.config = this.config;
821
- this._service.blocks$
822
- .pipe(takeUntil(this._destroy$))
823
- .subscribe((blocks) => {
824
- this.blocks = blocks;
825
- });
826
- fromEvent(window, 'keydown')
827
- .pipe(takeUntil(this._destroy$), filter((event) => {
828
- return !!event.key.match(/^Arrow/) && !!this._service.selectedBlockComponents.length;
829
- }))
830
- .subscribe((event) => {
831
- event.preventDefault();
832
- const inchPixel = 1 / 100;
833
- this._service.selectedBlockComponents.forEach((blockComponent) => {
834
- switch (event.key) {
835
- case 'ArrowUp':
836
- blockComponent.top = blockComponent.block.top - inchPixel;
837
- break;
838
- case 'ArrowDown':
839
- blockComponent.top = blockComponent.block.top + inchPixel;
840
- break;
841
- case 'ArrowLeft':
842
- blockComponent.left = blockComponent.block.left - inchPixel;
843
- break;
844
- case 'ArrowRight':
845
- blockComponent.left = blockComponent.block.left + inchPixel;
846
- break;
847
- }
848
- });
849
- });
850
- }
851
- artboardClick(event) {
852
- if (event.target.isSameNode(this.artboard.nativeElement) ||
853
- event.target.isSameNode(this.artboardContainer.nativeElement)) {
854
- this._service.selectedBlockComponents.forEach((block) => {
855
- block.deselect();
856
- block.markForCheck();
857
- });
858
- this._service.selectedBlockComponents = [];
859
- }
860
- }
861
- blockChanged(block) {
862
- this.sidebar.changeDetector.markForCheck();
863
- if (this.config.blockChanged) {
864
- this.config.blockChanged(block);
865
- }
866
- }
867
- ngAfterViewInit() {
868
- this.blockComponents.changes.subscribe((changes) => {
869
- const changeDiff = this._differ.diff(changes);
870
- if (changeDiff) {
871
- changeDiff.forEachAddedItem((change) => {
872
- this.blockAdded.emit(change.item);
873
- });
874
- changeDiff.forEachRemovedItem((change) => {
875
- this.blockRemoved.emit(change.item);
876
- });
877
- }
878
- });
879
- }
880
- ngOnDestroy() {
881
- this._destroy$.next();
882
- this._destroy$.complete();
883
- }
884
- }
885
- FsBlockEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Component });
886
- FsBlockEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, outputs: { blockAdded: "blockAdded", blockRemoved: "blockRemoved" }, providers: [
887
- BlockEditorService,
888
- ], 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: "artboardContainer", first: true, predicate: ["artboardContainer"], 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 class=\"editor-container\">\n <div\n #artboardContainer\n class=\"artboard-container\"\n (click)=\"artboardClick($event)\">\n <div\n #artboard\n class=\"artboard mat-elevation-z2\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks; trackBy\"\n [block]=\"block\"\n (changed)=\"blockChanged($event)\">\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'\"></div>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n [blockAdded]=\"blockAdded\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative}.editor-container .artboard-container{display:flex;flex-grow:1;justify-content:center;padding:25px;overflow:auto;min-width:0}.editor-container .artboard-container .artboard{position:relative}.editor-container .artboard-container .artboard .margin-container{position:absolute;z-index:-1}.editor-container .artboard-container .artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.editor-container .artboard-container .artboard .margin.margin-top,.editor-container .artboard-container .artboard .margin.margin-bottom{width:100%;border-top-width:1px}.editor-container .artboard-container .artboard .margin.margin-left,.editor-container .artboard-container .artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html"], outputs: ["changed"] }, { type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks", "blockAdded"] }], directives: [{ type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
889
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, decorators: [{
890
- type: Component,
891
- args: [{
892
- selector: 'fs-block-editor',
893
- templateUrl: 'block-editor.component.html',
894
- styleUrls: ['block-editor.component.scss'],
895
- changeDetection: ChangeDetectionStrategy.OnPush,
896
- providers: [
897
- BlockEditorService,
898
- ]
899
- }]
900
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i0.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
901
- type: ContentChildren,
902
- args: [FsBlockEditorSidebarPanelDirective]
903
- }], blockComponents: [{
904
- type: ViewChildren,
905
- args: [FsBlockComponent]
906
- }], artboard: [{
907
- type: ViewChild,
908
- args: ['artboard', { static: true }]
909
- }], marginContainer: [{
910
- type: ViewChild,
911
- args: ['marginContainer', { static: true }]
912
- }], margins: [{
913
- type: ViewChildren,
914
- args: [FsBlockEditorMarginDirective]
915
- }], artboardContainer: [{
916
- type: ViewChild,
917
- args: ['artboardContainer', { static: true }]
918
- }], sidebar: [{
919
- type: ViewChild,
920
- args: [SidebarComponent, { static: true }]
921
- }], config: [{
922
- type: Input
923
- }], blockAdded: [{
924
- type: Output
925
- }], blockRemoved: [{
926
- type: Output
953
+ class FsBlockEditorComponent {
954
+ constructor(_el, _blockEditor) {
955
+ this._el = _el;
956
+ this._blockEditor = _blockEditor;
957
+ this._destroy$ = new Subject();
958
+ }
959
+ get el() {
960
+ return this._el.nativeElement;
961
+ }
962
+ ngOnInit() {
963
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
964
+ this._blockEditor.blocks = this.config.blocks;
965
+ this._blockEditor.config = this.config;
966
+ this._blockEditor.blocks$
967
+ .pipe(takeUntil(this._destroy$))
968
+ .subscribe((blocks) => {
969
+ this.blocks = blocks;
970
+ });
971
+ setTimeout(() => {
972
+ this.zoompan.center(this.artboard.nativeElement, { vertical: false });
973
+ });
974
+ }
975
+ artboardClick(event) {
976
+ if (event.target.classList.contains('deselectable')) {
977
+ this.zoompan.enable();
978
+ this._blockEditor.selectedBlocks = [];
979
+ }
980
+ }
981
+ ngOnDestroy() {
982
+ this._destroy$.next();
983
+ this._destroy$.complete();
984
+ }
985
+ }
986
+ 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 });
987
+ FsBlockEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
988
+ BlockEditorService,
989
+ ], 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 class=\"editor-container deselectable\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\"\n (mousedown)=\"artboardClick($event)\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \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 </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0}.editor-container .zoom-pan-container{flex:1}\n"], components: [{ type: i2$1.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"] }], directives: [{ type: i2$1.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
990
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, decorators: [{
991
+ type: Component,
992
+ args: [{
993
+ selector: 'fs-block-editor',
994
+ templateUrl: 'block-editor.component.html',
995
+ styleUrls: ['block-editor.component.scss'],
996
+ changeDetection: ChangeDetectionStrategy.OnPush,
997
+ providers: [
998
+ BlockEditorService,
999
+ ]
1000
+ }]
1001
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1002
+ type: ContentChildren,
1003
+ args: [FsBlockEditorSidebarPanelDirective]
1004
+ }], zoompan: [{
1005
+ type: ViewChild,
1006
+ args: [FsZoomPanComponent, { static: true }]
1007
+ }], artboardContainer: [{
1008
+ type: ViewChild,
1009
+ args: ['artboardContainer', { static: true }]
1010
+ }], sidebar: [{
1011
+ type: ViewChild,
1012
+ args: [SidebarComponent, { static: true }]
1013
+ }], artboard: [{
1014
+ type: ViewChild,
1015
+ args: [ArtboardComponent, { read: ElementRef }]
1016
+ }], config: [{
1017
+ type: Input
927
1018
  }] } });
928
1019
 
929
- class FsBlockEditorModule {
930
- static forRoot() {
931
- return {
932
- ngModule: FsBlockEditorModule,
933
- };
934
- }
935
- }
936
- FsBlockEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
937
- FsBlockEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, declarations: [FsBlockComponent,
938
- FsBlockEditorComponent,
939
- FsBlockEditorSidebarPanelDirective,
940
- FsBlockEditorMarginDirective,
941
- SidebarComponent], imports: [CommonModule,
942
- FormsModule,
943
- MatIconModule,
944
- MatButtonModule,
945
- MatInputModule,
946
- MatFormFieldModule,
947
- FsHtmlEditorModule,
948
- FsFileModule,
949
- FsColorPickerModule], exports: [FsBlockComponent,
950
- FsBlockEditorComponent,
951
- FsBlockEditorSidebarPanelDirective] });
952
- FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, imports: [[
953
- CommonModule,
954
- FormsModule,
955
- MatIconModule,
956
- MatButtonModule,
957
- MatInputModule,
958
- MatFormFieldModule,
959
- FsHtmlEditorModule,
960
- FsFileModule,
961
- FsColorPickerModule,
962
- ]] });
963
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, decorators: [{
964
- type: NgModule,
965
- args: [{
966
- imports: [
967
- CommonModule,
968
- FormsModule,
969
- MatIconModule,
970
- MatButtonModule,
971
- MatInputModule,
972
- MatFormFieldModule,
973
- FsHtmlEditorModule,
974
- FsFileModule,
975
- FsColorPickerModule,
976
- ],
977
- exports: [
978
- FsBlockComponent,
979
- FsBlockEditorComponent,
980
- FsBlockEditorSidebarPanelDirective,
981
- ],
982
- declarations: [
983
- FsBlockComponent,
984
- FsBlockEditorComponent,
985
- FsBlockEditorSidebarPanelDirective,
986
- FsBlockEditorMarginDirective,
987
- SidebarComponent,
988
- ],
989
- }]
1020
+ class FsBlockEditorModule {
1021
+ static forRoot() {
1022
+ return {
1023
+ ngModule: FsBlockEditorModule,
1024
+ };
1025
+ }
1026
+ }
1027
+ FsBlockEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1028
+ FsBlockEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1029
+ FsBlockEditorComponent,
1030
+ FsBlockEditorSidebarPanelDirective,
1031
+ FsBlockEditorMarginDirective,
1032
+ SidebarComponent,
1033
+ ArtboardComponent], imports: [CommonModule,
1034
+ FormsModule,
1035
+ MatIconModule,
1036
+ MatButtonModule,
1037
+ MatInputModule,
1038
+ MatFormFieldModule,
1039
+ MatCheckboxModule,
1040
+ MatTooltipModule,
1041
+ FsFileModule,
1042
+ FsColorPickerModule,
1043
+ FsMenuModule,
1044
+ FsZoomPanModule], exports: [FsBlockComponent,
1045
+ FsBlockEditorComponent,
1046
+ FsBlockEditorSidebarPanelDirective] });
1047
+ FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, imports: [[
1048
+ CommonModule,
1049
+ FormsModule,
1050
+ MatIconModule,
1051
+ MatButtonModule,
1052
+ MatInputModule,
1053
+ MatFormFieldModule,
1054
+ MatCheckboxModule,
1055
+ MatTooltipModule,
1056
+ FsFileModule,
1057
+ FsColorPickerModule,
1058
+ FsMenuModule,
1059
+ FsZoomPanModule,
1060
+ ]] });
1061
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, decorators: [{
1062
+ type: NgModule,
1063
+ args: [{
1064
+ imports: [
1065
+ CommonModule,
1066
+ FormsModule,
1067
+ MatIconModule,
1068
+ MatButtonModule,
1069
+ MatInputModule,
1070
+ MatFormFieldModule,
1071
+ MatCheckboxModule,
1072
+ MatTooltipModule,
1073
+ FsFileModule,
1074
+ FsColorPickerModule,
1075
+ FsMenuModule,
1076
+ FsZoomPanModule,
1077
+ ],
1078
+ exports: [
1079
+ FsBlockComponent,
1080
+ FsBlockEditorComponent,
1081
+ FsBlockEditorSidebarPanelDirective,
1082
+ ],
1083
+ declarations: [
1084
+ FsBlockComponent,
1085
+ FsBlockEditorComponent,
1086
+ FsBlockEditorSidebarPanelDirective,
1087
+ FsBlockEditorMarginDirective,
1088
+ SidebarComponent,
1089
+ ArtboardComponent,
1090
+ ],
1091
+ }]
990
1092
  }] });
991
1093
 
992
- /*
993
- * Public API Surface of fs-menu
994
- */
995
-
996
- /**
997
- * Generated bundle index. Do not edit.
1094
+ /**
1095
+ * Generated bundle index. Do not edit.
998
1096
  */
999
1097
 
1000
- export { FsBlockComponent, FsBlockEditorComponent, FsBlockEditorModule, FsBlockEditorSidebarPanelDirective };
1098
+ export { BlockType, BlockTypes, FsBlockComponent, FsBlockEditorComponent, FsBlockEditorModule, FsBlockEditorSidebarPanelDirective };
1001
1099
  //# sourceMappingURL=firestitch-block-editor.js.map