@firestitch/block-editor 12.1.5 → 12.1.8

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