@firestitch/block-editor 12.2.0 → 12.2.3

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