@firestitch/block-editor 12.3.15 → 12.3.16

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