@firestitch/block-editor 12.3.18 → 12.3.20

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 (59) hide show
  1. package/app/components/artboard/artboard.component.d.ts +31 -31
  2. package/app/components/block/block.component.d.ts +71 -71
  3. package/app/components/block-editor/block-editor.component.d.ts +29 -28
  4. package/app/components/font/font.component.d.ts +12 -12
  5. package/app/components/font/index.d.ts +1 -1
  6. package/app/components/index.d.ts +1 -1
  7. package/app/components/layers-reorder-dialog/layers-reorder-dialog.component.d.ts +15 -15
  8. package/app/components/sidebar/sidebar.component.d.ts +80 -81
  9. package/app/consts/block-formats.const.d.ts +6 -6
  10. package/app/consts/block-types.const.d.ts +14 -14
  11. package/app/consts/index.d.ts +2 -2
  12. package/app/directives/block-editor-margin.directive.d.ts +9 -9
  13. package/app/directives/block-editor-sidebar-panel.directive.d.ts +10 -10
  14. package/app/enums/block-format.enum.d.ts +6 -6
  15. package/app/enums/block-type.enum.d.ts +11 -11
  16. package/app/enums/index.d.ts +2 -2
  17. package/app/fs-block-editor.module.d.ts +34 -33
  18. package/app/interfaces/block-editor-config.d.ts +18 -19
  19. package/app/interfaces/block.d.ts +63 -63
  20. package/app/interfaces/index.d.ts +2 -2
  21. package/app/pipes/create-image-url.pipe.d.ts +10 -0
  22. package/app/services/block-editor.service.d.ts +57 -57
  23. package/app/services/blocks-store.service.d.ts +34 -34
  24. package/app/services/google-font.service.d.ts +15 -15
  25. package/app/services/index.d.ts +2 -2
  26. package/bundles/firestitch-block-editor.umd.js +2015 -2000
  27. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  28. package/esm2015/app/components/artboard/artboard.component.js +108 -108
  29. package/esm2015/app/components/block/block.component.js +478 -477
  30. package/esm2015/app/components/block-editor/block-editor.component.js +96 -86
  31. package/esm2015/app/components/font/font.component.js +31 -31
  32. package/esm2015/app/components/font/index.js +1 -1
  33. package/esm2015/app/components/index.js +1 -1
  34. package/esm2015/app/components/layers-reorder-dialog/layers-reorder-dialog.component.js +43 -43
  35. package/esm2015/app/components/sidebar/sidebar.component.js +242 -249
  36. package/esm2015/app/consts/block-formats.const.js +7 -7
  37. package/esm2015/app/consts/block-types.const.js +12 -12
  38. package/esm2015/app/consts/index.js +2 -2
  39. package/esm2015/app/directives/block-editor-margin.directive.js +18 -18
  40. package/esm2015/app/directives/block-editor-sidebar-panel.directive.js +20 -20
  41. package/esm2015/app/enums/block-format.enum.js +7 -7
  42. package/esm2015/app/enums/block-type.enum.js +12 -12
  43. package/esm2015/app/enums/index.js +2 -2
  44. package/esm2015/app/fs-block-editor.module.js +129 -126
  45. package/esm2015/app/interfaces/block-editor-config.js +2 -2
  46. package/esm2015/app/interfaces/block.js +1 -1
  47. package/esm2015/app/interfaces/index.js +2 -2
  48. package/esm2015/app/pipes/create-image-url.pipe.js +19 -0
  49. package/esm2015/app/services/block-editor.service.js +170 -170
  50. package/esm2015/app/services/blocks-store.service.js +188 -190
  51. package/esm2015/app/services/google-font.service.js +37 -37
  52. package/esm2015/app/services/index.js +2 -2
  53. package/esm2015/firestitch-block-editor.js +4 -4
  54. package/esm2015/public_api.js +6 -6
  55. package/fesm2015/firestitch-block-editor.js +1481 -1462
  56. package/fesm2015/firestitch-block-editor.js.map +1 -1
  57. package/firestitch-block-editor.d.ts +5 -5
  58. package/package.json +1 -1
  59. package/public_api.d.ts +8 -8
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/forms'), require('@angular/material/input'), require('@angular/core'), require('@angular/common'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/checkbox'), require('@angular/material/tooltip'), require('@angular/material/select'), require('@angular/material/list'), require('@angular/cdk/drag-drop'), require('@firestitch/colorpicker'), require('@firestitch/file'), require('@firestitch/menu'), require('@firestitch/zoom-pan'), require('@firestitch/dialog'), require('rxjs/operators'), require('moveable'), require('rxjs'), require('@angular/material/dialog'), require('@firestitch/common'), require('@angular/material/divider'), require('@angular/common/http'), require('@firestitch/prompt'), require('@angular/material/core'), require('@firestitch/autocomplete'), require('@angular/cdk/text-field')) :
3
- typeof define === 'function' && define.amd ? define('@firestitch/block-editor', ['exports', '@angular/forms', '@angular/material/input', '@angular/core', '@angular/common', '@angular/material/button', '@angular/material/form-field', '@angular/material/icon', '@angular/material/checkbox', '@angular/material/tooltip', '@angular/material/select', '@angular/material/list', '@angular/cdk/drag-drop', '@firestitch/colorpicker', '@firestitch/file', '@firestitch/menu', '@firestitch/zoom-pan', '@firestitch/dialog', 'rxjs/operators', 'moveable', 'rxjs', '@angular/material/dialog', '@firestitch/common', '@angular/material/divider', '@angular/common/http', '@firestitch/prompt', '@angular/material/core', '@firestitch/autocomplete', '@angular/cdk/text-field'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch["block-editor"] = {}), global.ng.forms, global.ng.material.input, global.ng.core, global.ng.common, global.ng.material.button, global.ng.material.formField, global.ng.material.icon, global.ng.material.checkbox, global.ng.material.tooltip, global.ng.material.select, global.ng.material.list, global.ng.cdk.dragDrop, global.i12, global.i3$1, global.menu, global.i2$2, global.i2, global.rxjs.operators, global.Moveable, global.rxjs, global.ng.material.dialog, global.common, global.ng.material.divider, global.ng.common.http, global.i2$1, global.ng.material.core, global.i10, global.ng.cdk.textField));
5
- })(this, (function (exports, i16, i15, i0, i13, i6, i6$1, i3, i9, i14, i7$1, i4, i7, i12, i3$1, menu, i2$2, i2, operators, Moveable, rxjs, i1, common, i5, i1$1, i2$1, i8, i10, i17) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/input'), require('@angular/cdk/drag-drop'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/select'), require('@angular/material/tooltip'), require('@firestitch/colorpicker'), require('@firestitch/dialog'), require('@firestitch/file'), require('@firestitch/menu'), require('@firestitch/zoom-pan'), require('@firestitch/autocomplete'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http'), require('moveable'), require('@angular/material/dialog'), require('@firestitch/common'), require('@angular/material/divider'), require('@firestitch/api'), require('@firestitch/prompt'), require('@angular/material/core'), require('@angular/cdk/text-field')) :
3
+ typeof define === 'function' && define.amd ? define('@firestitch/block-editor', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/input', '@angular/cdk/drag-drop', '@angular/material/button', '@angular/material/checkbox', '@angular/material/form-field', '@angular/material/icon', '@angular/material/list', '@angular/material/select', '@angular/material/tooltip', '@firestitch/colorpicker', '@firestitch/dialog', '@firestitch/file', '@firestitch/menu', '@firestitch/zoom-pan', '@firestitch/autocomplete', 'rxjs', 'rxjs/operators', '@angular/common/http', 'moveable', '@angular/material/dialog', '@firestitch/common', '@angular/material/divider', '@firestitch/api', '@firestitch/prompt', '@angular/material/core', '@angular/cdk/text-field'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch["block-editor"] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.input, global.ng.cdk.dragDrop, global.ng.material.button, global.ng.material.checkbox, global.ng.material.formField, global.ng.material.icon, global.ng.material.list, global.ng.material.select, global.ng.material.tooltip, global.i12, global.i2, global.i3$1, global.menu, global.i2$2, global.i10, global.rxjs, global.rxjs.operators, global.ng.common.http, global.Moveable, global.ng.material.dialog, global.common, global.ng.material.divider, global.i1$2, global.i2$1, global.ng.material.core, global.ng.cdk.textField));
5
+ })(this, (function (exports, i13, i0, i16, i15, i7, i6, i9, i6$1, i3, i4, i7$1, i14, i12, i2, i3$1, menu, i2$2, i10, rxjs, operators, i1, Moveable, i1$1, common, i5, i1$2, i2$1, i8, i17) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -24,2048 +24,2063 @@
24
24
  return Object.freeze(n);
25
25
  }
26
26
 
27
+ var i13__namespace = /*#__PURE__*/_interopNamespace(i13);
28
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
27
29
  var i16__namespace = /*#__PURE__*/_interopNamespace(i16);
28
30
  var i15__namespace = /*#__PURE__*/_interopNamespace(i15);
29
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
- var i13__namespace = /*#__PURE__*/_interopNamespace(i13);
31
+ var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
31
32
  var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
33
+ var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
32
34
  var i6__namespace$1 = /*#__PURE__*/_interopNamespace(i6$1);
33
35
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
34
- var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
35
- var i14__namespace = /*#__PURE__*/_interopNamespace(i14);
36
- var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
37
36
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
38
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
37
+ var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
38
+ var i14__namespace = /*#__PURE__*/_interopNamespace(i14);
39
39
  var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
40
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
40
41
  var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
41
42
  var i2__namespace$2 = /*#__PURE__*/_interopNamespace(i2$2);
42
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
43
- var Moveable__default = /*#__PURE__*/_interopDefaultLegacy(Moveable);
43
+ var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
44
44
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
45
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
45
+ var Moveable__default = /*#__PURE__*/_interopDefaultLegacy(Moveable);
46
46
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
47
+ var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
48
+ var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
47
49
  var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
48
50
  var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
49
- var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
50
51
  var i17__namespace = /*#__PURE__*/_interopNamespace(i17);
51
52
 
52
- exports.BlockType = void 0;
53
- (function (BlockType) {
54
- BlockType["Rectangle"] = "rectangle";
55
- BlockType["ShortText"] = "shorttext";
56
- BlockType["LongText"] = "longtext";
57
- BlockType["Image"] = "image";
58
- BlockType["RadioButton"] = "radiobutton";
59
- BlockType["Checkbox"] = "checkbox";
60
- BlockType["Signature"] = "signature";
61
- BlockType["Pdf"] = "pdf";
62
- BlockType["Date"] = "date";
53
+ var GoogleFontService = /** @class */ (function () {
54
+ function GoogleFontService(httpClient) {
55
+ this.httpClient = httpClient;
56
+ this._apiKey = 'AIzaSyAoT2RLzCSFUb148F4uLXyAuquAzjcjyGk';
57
+ }
58
+ GoogleFontService.prototype.loadFont = function (font) {
59
+ var link = document.createElement('link');
60
+ link.rel = 'stylesheet';
61
+ link.href = "https://fonts.googleapis.com/css2?family=" + font.family + "&family=Tangerine&display=swap";
62
+ document.getElementsByTagName('head')[0].appendChild(link);
63
+ };
64
+ GoogleFontService.prototype.getItems = function () {
65
+ if (this._fonts$) {
66
+ return this._fonts$.asObservable();
67
+ }
68
+ if (!this._apiKey) {
69
+ return rxjs.throwError("Error: api key was not provided to the google fonts service");
70
+ }
71
+ var url = "https://www.googleapis.com/webfonts/v1/webfonts?key=" + this._apiKey;
72
+ return this.httpClient.get(url)
73
+ .pipe(operators.map(function (response) { return response.items
74
+ .map(function (item) {
75
+ return { family: item.family };
76
+ }); }));
77
+ };
78
+ return GoogleFontService;
79
+ }());
80
+ GoogleFontService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GoogleFontService, deps: [{ token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
81
+ GoogleFontService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GoogleFontService });
82
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GoogleFontService, decorators: [{
83
+ type: i0.Injectable
84
+ }], ctorParameters: function () { return [{ type: i1__namespace.HttpClient }]; } });
85
+
86
+ var FontComponent = /** @class */ (function () {
87
+ function FontComponent(_el, _googleFontService) {
88
+ this._el = _el;
89
+ this._googleFontService = _googleFontService;
90
+ }
91
+ FontComponent.prototype.ngOnInit = function () {
92
+ var _this = this;
93
+ var observer = new IntersectionObserver(function (entries) {
94
+ if (entries[0].isIntersecting === true) {
95
+ _this._googleFontService.loadFont(_this.font);
96
+ }
97
+ }, { threshold: [0] });
98
+ observer.observe(this._el.nativeElement);
99
+ };
100
+ return FontComponent;
101
+ }());
102
+ FontComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FontComponent, deps: [{ token: i0__namespace.ElementRef }, { token: GoogleFontService }], target: i0__namespace.ɵɵFactoryTarget.Component });
103
+ FontComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FontComponent, selector: "app-font", inputs: { font: "font" }, ngImport: i0__namespace, template: "<div\n [style.fontFamily]=\"font.family\">\n {{font.family}}\n</div>\n", styles: [""], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
104
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FontComponent, decorators: [{
105
+ type: i0.Component,
106
+ args: [{
107
+ selector: 'app-font',
108
+ templateUrl: 'font.component.html',
109
+ styleUrls: ['font.component.scss'],
110
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
111
+ }]
112
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: GoogleFontService }]; }, propDecorators: { font: [{
113
+ type: i0.Input
114
+ }] } });
115
+
116
+ exports.BlockType = void 0;
117
+ (function (BlockType) {
118
+ BlockType["Rectangle"] = "rectangle";
119
+ BlockType["ShortText"] = "shorttext";
120
+ BlockType["LongText"] = "longtext";
121
+ BlockType["Image"] = "image";
122
+ BlockType["RadioButton"] = "radiobutton";
123
+ BlockType["Checkbox"] = "checkbox";
124
+ BlockType["Signature"] = "signature";
125
+ BlockType["Pdf"] = "pdf";
126
+ BlockType["Date"] = "date";
63
127
  })(exports.BlockType || (exports.BlockType = {}));
64
128
 
65
- var BlockFormat;
66
- (function (BlockFormat) {
67
- BlockFormat["Date"] = "date";
68
- BlockFormat["YYYYMMDD"] = "YYYY/MM/DD";
69
- BlockFormat["Currency"] = "currency";
70
- BlockFormat["Number"] = "number";
129
+ var BlockFormat;
130
+ (function (BlockFormat) {
131
+ BlockFormat["Date"] = "date";
132
+ BlockFormat["YYYYMMDD"] = "YYYY/MM/DD";
133
+ BlockFormat["Currency"] = "currency";
134
+ BlockFormat["Number"] = "number";
71
135
  })(BlockFormat || (BlockFormat = {}));
72
136
 
73
- var BlockTypes = [
74
- { value: exports.BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4', type: 'draw' },
75
- { value: exports.BlockType.ShortText, name: 'Short Text', icon: 'short_text', type: 'form' },
76
- { value: exports.BlockType.LongText, name: 'Long Text', icon: 'subject', type: 'form' },
77
- { value: exports.BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked', type: 'form' },
78
- { value: exports.BlockType.Checkbox, name: 'Checkbox', icon: 'check_box', type: 'form' },
79
- { value: exports.BlockType.Date, name: 'Date', icon: 'calendar_today', type: 'form' },
80
- { value: exports.BlockType.Signature, name: 'Signature', icon: 'draw', type: 'form' },
81
- { value: exports.BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*', type: 'draw' },
82
- { value: exports.BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf', type: 'draw' },
137
+ var BlockTypes = [
138
+ { value: exports.BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4', type: 'draw' },
139
+ { value: exports.BlockType.ShortText, name: 'Short Text', icon: 'short_text', type: 'form' },
140
+ { value: exports.BlockType.LongText, name: 'Long Text', icon: 'subject', type: 'form' },
141
+ { value: exports.BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked', type: 'form' },
142
+ { value: exports.BlockType.Checkbox, name: 'Checkbox', icon: 'check_box', type: 'form' },
143
+ { value: exports.BlockType.Date, name: 'Date', icon: 'calendar_today', type: 'form' },
144
+ { value: exports.BlockType.Signature, name: 'Signature', icon: 'draw', type: 'form' },
145
+ { value: exports.BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*', type: 'draw' },
146
+ { value: exports.BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf', type: 'draw' },
83
147
  ];
84
148
 
85
- var LayersReorderDialogComponent = /** @class */ (function () {
86
- function LayersReorderDialogComponent(_dialogData, _dialogRef) {
87
- this._dialogRef = _dialogRef;
88
- this.blockTypeIcons = common.index(BlockTypes, 'value', 'icon');
89
- this._init(_dialogData);
90
- }
91
- LayersReorderDialogComponent.prototype.swapItems = function (event) {
92
- i7.moveItemInArray(this.blockComponents, event.previousIndex, event.currentIndex);
93
- };
94
- LayersReorderDialogComponent.prototype.done = function () {
95
- this._dialogRef.close(this.blockComponents);
96
- };
97
- LayersReorderDialogComponent.prototype._init = function (data) {
98
- this.blockComponents = data.blockComponents;
99
- };
100
- return LayersReorderDialogComponent;
101
- }());
102
- LayersReorderDialogComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LayersReorderDialogComponent, deps: [{ token: i1.MAT_DIALOG_DATA }, { token: i1__namespace.MatDialogRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
103
- LayersReorderDialogComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LayersReorderDialogComponent, selector: "ng-component", ngImport: i0__namespace, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder Fields</h1>\n <mat-dialog-content>\n <mat-list cdkDropList (cdkDropListDropped)=\"swapItems($event)\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let blockComponent of blockComponents\">\n <mat-list-item cdkDrag cdkDragLockAxis=\"y\">\n <mat-icon cdkDragHandle>drag_handle</mat-icon>\n <mat-icon>\n {{ blockTypeIcons[blockComponent.block.type] }}\n </mat-icon>\n <span class=\"block-label\">\n {{ blockComponent.block.label || blockComponent.block.content || 'No Content'}} \n </span>\n </mat-list-item>\n <mat-divider></mat-divider>\n </ng-container>\n </mat-list>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button color=\"primary\" (click)=\"done()\">Done</button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: ["h1{display:flex}.mat-icon{margin-right:20px}.block-label{min-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:1000px}.cdk-drag-preview{display:flex;padding-left:15px!important;background:#fff;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-preview ::ng-deep .mat-list-item-content{display:flex;flex-direction:row;align-items:center;font-size:16px}.cdk-drag-handle{cursor:grab}.cdk-drag-placeholder{opacity:.2}\n"], components: [{ type: i2__namespace.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i3__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4__namespace.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i5__namespace.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i4__namespace.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i6__namespace.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__namespace.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1__namespace.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i7__namespace.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i13__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.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__namespace.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1__namespace.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
104
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LayersReorderDialogComponent, decorators: [{
105
- type: i0.Component,
106
- args: [{
107
- templateUrl: './layers-reorder-dialog.component.html',
108
- styleUrls: ['./layers-reorder-dialog.component.scss'],
109
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
110
- }]
111
- }], ctorParameters: function () {
112
- return [{ type: undefined, decorators: [{
113
- type: i0.Inject,
114
- args: [i1.MAT_DIALOG_DATA]
115
- }] }, { type: i1__namespace.MatDialogRef }];
149
+ var LayersReorderDialogComponent = /** @class */ (function () {
150
+ function LayersReorderDialogComponent(_dialogData, _dialogRef) {
151
+ this._dialogRef = _dialogRef;
152
+ this.blockTypeIcons = common.index(BlockTypes, 'value', 'icon');
153
+ this._init(_dialogData);
154
+ }
155
+ LayersReorderDialogComponent.prototype.swapItems = function (event) {
156
+ i7.moveItemInArray(this.blockComponents, event.previousIndex, event.currentIndex);
157
+ };
158
+ LayersReorderDialogComponent.prototype.done = function () {
159
+ this._dialogRef.close(this.blockComponents);
160
+ };
161
+ LayersReorderDialogComponent.prototype._init = function (data) {
162
+ this.blockComponents = data.blockComponents;
163
+ };
164
+ return LayersReorderDialogComponent;
165
+ }());
166
+ LayersReorderDialogComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LayersReorderDialogComponent, deps: [{ token: i1$1.MAT_DIALOG_DATA }, { token: i1__namespace$1.MatDialogRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
167
+ LayersReorderDialogComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LayersReorderDialogComponent, selector: "ng-component", ngImport: i0__namespace, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder Fields</h1>\n <mat-dialog-content>\n <mat-list cdkDropList (cdkDropListDropped)=\"swapItems($event)\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let blockComponent of blockComponents\">\n <mat-list-item cdkDrag cdkDragLockAxis=\"y\">\n <mat-icon cdkDragHandle>drag_handle</mat-icon>\n <mat-icon>\n {{ blockTypeIcons[blockComponent.block.type] }}\n </mat-icon>\n <span class=\"block-label\">\n {{ blockComponent.block.label || blockComponent.block.content || 'No Content'}} \n </span>\n </mat-list-item>\n <mat-divider></mat-divider>\n </ng-container>\n </mat-list>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button color=\"primary\" (click)=\"done()\">Done</button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: ["h1{display:flex}.mat-icon{margin-right:20px}.block-label{min-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:1000px}.cdk-drag-preview{display:flex;padding-left:15px!important;background:#fff;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-preview ::ng-deep .mat-list-item-content{display:flex;flex-direction:row;align-items:center;font-size:16px}.cdk-drag-handle{cursor:grab}.cdk-drag-placeholder{opacity:.2}\n"], components: [{ type: i2__namespace.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i3__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4__namespace.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i5__namespace.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i4__namespace.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i6__namespace.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__namespace$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1__namespace$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i7__namespace.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i13__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.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__namespace.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1__namespace$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
168
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LayersReorderDialogComponent, decorators: [{
169
+ type: i0.Component,
170
+ args: [{
171
+ templateUrl: './layers-reorder-dialog.component.html',
172
+ styleUrls: ['./layers-reorder-dialog.component.scss'],
173
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
174
+ }]
175
+ }], ctorParameters: function () {
176
+ return [{ type: undefined, decorators: [{
177
+ type: i0.Inject,
178
+ args: [i1$1.MAT_DIALOG_DATA]
179
+ }] }, { type: i1__namespace$1.MatDialogRef }];
116
180
  } });
117
181
 
118
- /*! *****************************************************************************
119
- Copyright (c) Microsoft Corporation.
120
-
121
- Permission to use, copy, modify, and/or distribute this software for any
122
- purpose with or without fee is hereby granted.
123
-
124
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
125
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
126
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
127
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
128
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
129
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
130
- PERFORMANCE OF THIS SOFTWARE.
131
- ***************************************************************************** */
132
- /* global Reflect, Promise */
133
- var extendStatics = function (d, b) {
134
- extendStatics = Object.setPrototypeOf ||
135
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
136
- function (d, b) { for (var p in b)
137
- if (Object.prototype.hasOwnProperty.call(b, p))
138
- d[p] = b[p]; };
139
- return extendStatics(d, b);
140
- };
141
- function __extends(d, b) {
142
- if (typeof b !== "function" && b !== null)
143
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
144
- extendStatics(d, b);
145
- function __() { this.constructor = d; }
146
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
147
- }
148
- var __assign = function () {
149
- __assign = Object.assign || function __assign(t) {
150
- for (var s, i = 1, n = arguments.length; i < n; i++) {
151
- s = arguments[i];
152
- for (var p in s)
153
- if (Object.prototype.hasOwnProperty.call(s, p))
154
- t[p] = s[p];
155
- }
156
- return t;
157
- };
158
- return __assign.apply(this, arguments);
159
- };
160
- function __rest(s, e) {
161
- var t = {};
162
- for (var p in s)
163
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
164
- t[p] = s[p];
165
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
166
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
167
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
168
- t[p[i]] = s[p[i]];
169
- }
170
- return t;
171
- }
172
- function __decorate(decorators, target, key, desc) {
173
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
174
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
175
- r = Reflect.decorate(decorators, target, key, desc);
176
- else
177
- for (var i = decorators.length - 1; i >= 0; i--)
178
- if (d = decorators[i])
179
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
180
- return c > 3 && r && Object.defineProperty(target, key, r), r;
181
- }
182
- function __param(paramIndex, decorator) {
183
- return function (target, key) { decorator(target, key, paramIndex); };
184
- }
185
- function __metadata(metadataKey, metadataValue) {
186
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
187
- return Reflect.metadata(metadataKey, metadataValue);
188
- }
189
- function __awaiter(thisArg, _arguments, P, generator) {
190
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
191
- return new (P || (P = Promise))(function (resolve, reject) {
192
- function fulfilled(value) { try {
193
- step(generator.next(value));
194
- }
195
- catch (e) {
196
- reject(e);
197
- } }
198
- function rejected(value) { try {
199
- step(generator["throw"](value));
200
- }
201
- catch (e) {
202
- reject(e);
203
- } }
204
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
205
- step((generator = generator.apply(thisArg, _arguments || [])).next());
206
- });
207
- }
208
- function __generator(thisArg, body) {
209
- var _ = { label: 0, sent: function () { if (t[0] & 1)
210
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
211
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
212
- function verb(n) { return function (v) { return step([n, v]); }; }
213
- function step(op) {
214
- if (f)
215
- throw new TypeError("Generator is already executing.");
216
- while (_)
217
- try {
218
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
219
- return t;
220
- if (y = 0, t)
221
- op = [op[0] & 2, t.value];
222
- switch (op[0]) {
223
- case 0:
224
- case 1:
225
- t = op;
226
- break;
227
- case 4:
228
- _.label++;
229
- return { value: op[1], done: false };
230
- case 5:
231
- _.label++;
232
- y = op[1];
233
- op = [0];
234
- continue;
235
- case 7:
236
- op = _.ops.pop();
237
- _.trys.pop();
238
- continue;
239
- default:
240
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
241
- _ = 0;
242
- continue;
243
- }
244
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
245
- _.label = op[1];
246
- break;
247
- }
248
- if (op[0] === 6 && _.label < t[1]) {
249
- _.label = t[1];
250
- t = op;
251
- break;
252
- }
253
- if (t && _.label < t[2]) {
254
- _.label = t[2];
255
- _.ops.push(op);
256
- break;
257
- }
258
- if (t[2])
259
- _.ops.pop();
260
- _.trys.pop();
261
- continue;
262
- }
263
- op = body.call(thisArg, _);
264
- }
265
- catch (e) {
266
- op = [6, e];
267
- y = 0;
268
- }
269
- finally {
270
- f = t = 0;
271
- }
272
- if (op[0] & 5)
273
- throw op[1];
274
- return { value: op[0] ? op[1] : void 0, done: true };
275
- }
276
- }
277
- var __createBinding = Object.create ? (function (o, m, k, k2) {
278
- if (k2 === undefined)
279
- k2 = k;
280
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
281
- }) : (function (o, m, k, k2) {
282
- if (k2 === undefined)
283
- k2 = k;
284
- o[k2] = m[k];
285
- });
286
- function __exportStar(m, o) {
287
- for (var p in m)
288
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
289
- __createBinding(o, m, p);
290
- }
291
- function __values(o) {
292
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
293
- if (m)
294
- return m.call(o);
295
- if (o && typeof o.length === "number")
296
- return {
297
- next: function () {
298
- if (o && i >= o.length)
299
- o = void 0;
300
- return { value: o && o[i++], done: !o };
301
- }
302
- };
303
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
304
- }
305
- function __read(o, n) {
306
- var m = typeof Symbol === "function" && o[Symbol.iterator];
307
- if (!m)
308
- return o;
309
- var i = m.call(o), r, ar = [], e;
310
- try {
311
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
312
- ar.push(r.value);
313
- }
314
- catch (error) {
315
- e = { error: error };
316
- }
317
- finally {
318
- try {
319
- if (r && !r.done && (m = i["return"]))
320
- m.call(i);
321
- }
322
- finally {
323
- if (e)
324
- throw e.error;
325
- }
326
- }
327
- return ar;
328
- }
329
- /** @deprecated */
330
- function __spread() {
331
- for (var ar = [], i = 0; i < arguments.length; i++)
332
- ar = ar.concat(__read(arguments[i]));
333
- return ar;
334
- }
335
- /** @deprecated */
336
- function __spreadArrays() {
337
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
338
- s += arguments[i].length;
339
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
340
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
341
- r[k] = a[j];
342
- return r;
343
- }
344
- function __spreadArray(to, from, pack) {
345
- if (pack || arguments.length === 2)
346
- for (var i = 0, l = from.length, ar; i < l; i++) {
347
- if (ar || !(i in from)) {
348
- if (!ar)
349
- ar = Array.prototype.slice.call(from, 0, i);
350
- ar[i] = from[i];
351
- }
352
- }
353
- return to.concat(ar || Array.prototype.slice.call(from));
354
- }
355
- function __await(v) {
356
- return this instanceof __await ? (this.v = v, this) : new __await(v);
357
- }
358
- function __asyncGenerator(thisArg, _arguments, generator) {
359
- if (!Symbol.asyncIterator)
360
- throw new TypeError("Symbol.asyncIterator is not defined.");
361
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
362
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
363
- function verb(n) { if (g[n])
364
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
365
- function resume(n, v) { try {
366
- step(g[n](v));
367
- }
368
- catch (e) {
369
- settle(q[0][3], e);
370
- } }
371
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
372
- function fulfill(value) { resume("next", value); }
373
- function reject(value) { resume("throw", value); }
374
- function settle(f, v) { if (f(v), q.shift(), q.length)
375
- resume(q[0][0], q[0][1]); }
376
- }
377
- function __asyncDelegator(o) {
378
- var i, p;
379
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
380
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
381
- }
382
- function __asyncValues(o) {
383
- if (!Symbol.asyncIterator)
384
- throw new TypeError("Symbol.asyncIterator is not defined.");
385
- var m = o[Symbol.asyncIterator], i;
386
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
387
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
388
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
389
- }
390
- function __makeTemplateObject(cooked, raw) {
391
- if (Object.defineProperty) {
392
- Object.defineProperty(cooked, "raw", { value: raw });
393
- }
394
- else {
395
- cooked.raw = raw;
396
- }
397
- return cooked;
398
- }
399
- ;
400
- var __setModuleDefault = Object.create ? (function (o, v) {
401
- Object.defineProperty(o, "default", { enumerable: true, value: v });
402
- }) : function (o, v) {
403
- o["default"] = v;
404
- };
405
- function __importStar(mod) {
406
- if (mod && mod.__esModule)
407
- return mod;
408
- var result = {};
409
- if (mod != null)
410
- for (var k in mod)
411
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
412
- __createBinding(result, mod, k);
413
- __setModuleDefault(result, mod);
414
- return result;
415
- }
416
- function __importDefault(mod) {
417
- return (mod && mod.__esModule) ? mod : { default: mod };
418
- }
419
- function __classPrivateFieldGet(receiver, state, kind, f) {
420
- if (kind === "a" && !f)
421
- throw new TypeError("Private accessor was defined without a getter");
422
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
423
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
424
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
425
- }
426
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
427
- if (kind === "m")
428
- throw new TypeError("Private method is not writable");
429
- if (kind === "a" && !f)
430
- throw new TypeError("Private accessor was defined without a setter");
431
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
432
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
433
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
182
+ /*! *****************************************************************************
183
+ Copyright (c) Microsoft Corporation.
184
+
185
+ Permission to use, copy, modify, and/or distribute this software for any
186
+ purpose with or without fee is hereby granted.
187
+
188
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
189
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
190
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
191
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
192
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
193
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
194
+ PERFORMANCE OF THIS SOFTWARE.
195
+ ***************************************************************************** */
196
+ /* global Reflect, Promise */
197
+ var extendStatics = function (d, b) {
198
+ extendStatics = Object.setPrototypeOf ||
199
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
200
+ function (d, b) { for (var p in b)
201
+ if (Object.prototype.hasOwnProperty.call(b, p))
202
+ d[p] = b[p]; };
203
+ return extendStatics(d, b);
204
+ };
205
+ function __extends(d, b) {
206
+ if (typeof b !== "function" && b !== null)
207
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
208
+ extendStatics(d, b);
209
+ function __() { this.constructor = d; }
210
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
211
+ }
212
+ var __assign = function () {
213
+ __assign = Object.assign || function __assign(t) {
214
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
215
+ s = arguments[i];
216
+ for (var p in s)
217
+ if (Object.prototype.hasOwnProperty.call(s, p))
218
+ t[p] = s[p];
219
+ }
220
+ return t;
221
+ };
222
+ return __assign.apply(this, arguments);
223
+ };
224
+ function __rest(s, e) {
225
+ var t = {};
226
+ for (var p in s)
227
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
228
+ t[p] = s[p];
229
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
230
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
231
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
232
+ t[p[i]] = s[p[i]];
233
+ }
234
+ return t;
235
+ }
236
+ function __decorate(decorators, target, key, desc) {
237
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
238
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
239
+ r = Reflect.decorate(decorators, target, key, desc);
240
+ else
241
+ for (var i = decorators.length - 1; i >= 0; i--)
242
+ if (d = decorators[i])
243
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
244
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
245
+ }
246
+ function __param(paramIndex, decorator) {
247
+ return function (target, key) { decorator(target, key, paramIndex); };
248
+ }
249
+ function __metadata(metadataKey, metadataValue) {
250
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
251
+ return Reflect.metadata(metadataKey, metadataValue);
252
+ }
253
+ function __awaiter(thisArg, _arguments, P, generator) {
254
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
255
+ return new (P || (P = Promise))(function (resolve, reject) {
256
+ function fulfilled(value) { try {
257
+ step(generator.next(value));
258
+ }
259
+ catch (e) {
260
+ reject(e);
261
+ } }
262
+ function rejected(value) { try {
263
+ step(generator["throw"](value));
264
+ }
265
+ catch (e) {
266
+ reject(e);
267
+ } }
268
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
269
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
270
+ });
271
+ }
272
+ function __generator(thisArg, body) {
273
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
274
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
275
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
276
+ function verb(n) { return function (v) { return step([n, v]); }; }
277
+ function step(op) {
278
+ if (f)
279
+ throw new TypeError("Generator is already executing.");
280
+ while (_)
281
+ try {
282
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
283
+ return t;
284
+ if (y = 0, t)
285
+ op = [op[0] & 2, t.value];
286
+ switch (op[0]) {
287
+ case 0:
288
+ case 1:
289
+ t = op;
290
+ break;
291
+ case 4:
292
+ _.label++;
293
+ return { value: op[1], done: false };
294
+ case 5:
295
+ _.label++;
296
+ y = op[1];
297
+ op = [0];
298
+ continue;
299
+ case 7:
300
+ op = _.ops.pop();
301
+ _.trys.pop();
302
+ continue;
303
+ default:
304
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
305
+ _ = 0;
306
+ continue;
307
+ }
308
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
309
+ _.label = op[1];
310
+ break;
311
+ }
312
+ if (op[0] === 6 && _.label < t[1]) {
313
+ _.label = t[1];
314
+ t = op;
315
+ break;
316
+ }
317
+ if (t && _.label < t[2]) {
318
+ _.label = t[2];
319
+ _.ops.push(op);
320
+ break;
321
+ }
322
+ if (t[2])
323
+ _.ops.pop();
324
+ _.trys.pop();
325
+ continue;
326
+ }
327
+ op = body.call(thisArg, _);
328
+ }
329
+ catch (e) {
330
+ op = [6, e];
331
+ y = 0;
332
+ }
333
+ finally {
334
+ f = t = 0;
335
+ }
336
+ if (op[0] & 5)
337
+ throw op[1];
338
+ return { value: op[0] ? op[1] : void 0, done: true };
339
+ }
340
+ }
341
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
342
+ if (k2 === undefined)
343
+ k2 = k;
344
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
345
+ }) : (function (o, m, k, k2) {
346
+ if (k2 === undefined)
347
+ k2 = k;
348
+ o[k2] = m[k];
349
+ });
350
+ function __exportStar(m, o) {
351
+ for (var p in m)
352
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
353
+ __createBinding(o, m, p);
354
+ }
355
+ function __values(o) {
356
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
357
+ if (m)
358
+ return m.call(o);
359
+ if (o && typeof o.length === "number")
360
+ return {
361
+ next: function () {
362
+ if (o && i >= o.length)
363
+ o = void 0;
364
+ return { value: o && o[i++], done: !o };
365
+ }
366
+ };
367
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
368
+ }
369
+ function __read(o, n) {
370
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
371
+ if (!m)
372
+ return o;
373
+ var i = m.call(o), r, ar = [], e;
374
+ try {
375
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
376
+ ar.push(r.value);
377
+ }
378
+ catch (error) {
379
+ e = { error: error };
380
+ }
381
+ finally {
382
+ try {
383
+ if (r && !r.done && (m = i["return"]))
384
+ m.call(i);
385
+ }
386
+ finally {
387
+ if (e)
388
+ throw e.error;
389
+ }
390
+ }
391
+ return ar;
392
+ }
393
+ /** @deprecated */
394
+ function __spread() {
395
+ for (var ar = [], i = 0; i < arguments.length; i++)
396
+ ar = ar.concat(__read(arguments[i]));
397
+ return ar;
398
+ }
399
+ /** @deprecated */
400
+ function __spreadArrays() {
401
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
402
+ s += arguments[i].length;
403
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
404
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
405
+ r[k] = a[j];
406
+ return r;
407
+ }
408
+ function __spreadArray(to, from, pack) {
409
+ if (pack || arguments.length === 2)
410
+ for (var i = 0, l = from.length, ar; i < l; i++) {
411
+ if (ar || !(i in from)) {
412
+ if (!ar)
413
+ ar = Array.prototype.slice.call(from, 0, i);
414
+ ar[i] = from[i];
415
+ }
416
+ }
417
+ return to.concat(ar || Array.prototype.slice.call(from));
418
+ }
419
+ function __await(v) {
420
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
421
+ }
422
+ function __asyncGenerator(thisArg, _arguments, generator) {
423
+ if (!Symbol.asyncIterator)
424
+ throw new TypeError("Symbol.asyncIterator is not defined.");
425
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
426
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
427
+ function verb(n) { if (g[n])
428
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
429
+ function resume(n, v) { try {
430
+ step(g[n](v));
431
+ }
432
+ catch (e) {
433
+ settle(q[0][3], e);
434
+ } }
435
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
436
+ function fulfill(value) { resume("next", value); }
437
+ function reject(value) { resume("throw", value); }
438
+ function settle(f, v) { if (f(v), q.shift(), q.length)
439
+ resume(q[0][0], q[0][1]); }
440
+ }
441
+ function __asyncDelegator(o) {
442
+ var i, p;
443
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
444
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
445
+ }
446
+ function __asyncValues(o) {
447
+ if (!Symbol.asyncIterator)
448
+ throw new TypeError("Symbol.asyncIterator is not defined.");
449
+ var m = o[Symbol.asyncIterator], i;
450
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
451
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
452
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
453
+ }
454
+ function __makeTemplateObject(cooked, raw) {
455
+ if (Object.defineProperty) {
456
+ Object.defineProperty(cooked, "raw", { value: raw });
457
+ }
458
+ else {
459
+ cooked.raw = raw;
460
+ }
461
+ return cooked;
462
+ }
463
+ ;
464
+ var __setModuleDefault = Object.create ? (function (o, v) {
465
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
466
+ }) : function (o, v) {
467
+ o["default"] = v;
468
+ };
469
+ function __importStar(mod) {
470
+ if (mod && mod.__esModule)
471
+ return mod;
472
+ var result = {};
473
+ if (mod != null)
474
+ for (var k in mod)
475
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
476
+ __createBinding(result, mod, k);
477
+ __setModuleDefault(result, mod);
478
+ return result;
479
+ }
480
+ function __importDefault(mod) {
481
+ return (mod && mod.__esModule) ? mod : { default: mod };
482
+ }
483
+ function __classPrivateFieldGet(receiver, state, kind, f) {
484
+ if (kind === "a" && !f)
485
+ throw new TypeError("Private accessor was defined without a getter");
486
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
487
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
488
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
489
+ }
490
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
491
+ if (kind === "m")
492
+ throw new TypeError("Private method is not writable");
493
+ if (kind === "a" && !f)
494
+ throw new TypeError("Private accessor was defined without a setter");
495
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
496
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
497
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
434
498
  }
435
499
 
436
- var EventType;
437
- (function (EventType) {
438
- EventType["Add"] = "add";
439
- EventType["Change"] = "change";
440
- EventType["Remove"] = "remove";
441
- })(EventType || (EventType = {}));
442
- var BlocksStore = /** @class */ (function () {
443
- function BlocksStore() {
444
- this._lastTabIndex = -1;
445
- this._eventBus$ = new rxjs.Subject();
446
- this._blocks$ = new rxjs.BehaviorSubject([]);
447
- this._destroy$ = new rxjs.Subject();
448
- }
449
- Object.defineProperty(BlocksStore.prototype, "blocks", {
450
- get: function () {
451
- return __spreadArray([], __read(this._blocks$.getValue()));
452
- },
453
- enumerable: false,
454
- configurable: true
455
- });
456
- Object.defineProperty(BlocksStore.prototype, "blocks$", {
457
- get: function () {
458
- return this._blocks$.asObservable();
459
- },
460
- enumerable: false,
461
- configurable: true
462
- });
463
- Object.defineProperty(BlocksStore.prototype, "blockAdded$", {
464
- get: function () {
465
- return this._eventBus$
466
- .pipe(operators.filter(function (_a) {
467
- var type = _a.type;
468
- return type === EventType.Add;
469
- }), operators.map(function (_a) {
470
- var value = _a.value;
471
- return value;
472
- }));
473
- },
474
- enumerable: false,
475
- configurable: true
476
- });
477
- Object.defineProperty(BlocksStore.prototype, "blockChanged$", {
478
- get: function () {
479
- return this._eventBus$
480
- .pipe(operators.filter(function (_a) {
481
- var type = _a.type;
482
- return type === EventType.Change;
483
- }), operators.map(function (_a) {
484
- var value = _a.value;
485
- return value;
486
- }));
487
- },
488
- enumerable: false,
489
- configurable: true
490
- });
491
- Object.defineProperty(BlocksStore.prototype, "blockRemoved$", {
492
- get: function () {
493
- return this._eventBus$
494
- .pipe(operators.filter(function (_a) {
495
- var type = _a.type;
496
- return type === EventType.Remove;
497
- }), operators.map(function (_a) {
498
- var value = _a.value;
499
- return value;
500
- }));
501
- },
502
- enumerable: false,
503
- configurable: true
504
- });
505
- BlocksStore.prototype.ngOnDestroy = function () {
506
- this._destroy$.next();
507
- this._destroy$.complete();
508
- };
509
- BlocksStore.prototype.init = function (config) {
510
- var _this = this;
511
- this._config = config;
512
- this._setBlocks(this._config.blocks);
513
- if (this._config.blockChanged) {
514
- this.blockChanged$
515
- .pipe(operators.groupBy(function (block) { return (block.guid); }), operators.map(function (group) { return group.pipe(operators.debounceTime(250)); }), operators.mergeAll())
516
- .subscribe(function (block) {
517
- _this._config.blockChanged(block);
518
- });
519
- }
520
- };
521
- BlocksStore.prototype.blockExists = function (block) {
522
- var index = this.blocks.findIndex(function (b) {
523
- return b.guid === block.guid;
524
- });
525
- return index !== -1;
526
- };
527
- BlocksStore.prototype.blockAdd = function (block, initBlock) {
528
- var _this = this;
529
- if (initBlock === void 0) { initBlock = false; }
530
- if (!this._config.blockAdd) {
531
- console.warn('[BlockEditor] Config "blockAdd" is not defined');
532
- return;
533
- }
534
- if (initBlock) {
535
- block = this._createBlock(block);
536
- }
537
- this._config.blockAdd(block)
538
- .pipe(operators.takeUntil(this._destroy$))
539
- .subscribe(function (newBlock) {
540
- _this._appendBlock(newBlock);
541
- });
542
- };
543
- BlocksStore.prototype.blockUpload = function (block, fsFile, initBlock) {
544
- var _this = this;
545
- if (initBlock === void 0) { initBlock = false; }
546
- if (!this._config.blockUpload) {
547
- console.warn('[BlockEditor] Config "blockUpload" is not defined');
548
- return;
549
- }
550
- if (initBlock) {
551
- block = this._createBlock(block);
552
- }
553
- rxjs.from(fsFile.imageInfo)
554
- .pipe(operators.switchMap(function (imageInfo) {
555
- if ((imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.height) && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.width)) {
556
- var ratio = imageInfo.height / imageInfo.width;
557
- block.width = _this._config.width * .4;
558
- block.height = block.width * ratio;
559
- }
560
- return _this._config.blockUpload(block, fsFile.file);
561
- }), operators.takeUntil(this._destroy$))
562
- .subscribe(function (newBlock) {
563
- _this._appendBlock(newBlock);
564
- });
565
- };
566
- BlocksStore.prototype.blockChange = function (block) {
567
- this._dispatchEvent(EventType.Change, block);
568
- };
569
- BlocksStore.prototype.blockRemove = function (targetBlocks) {
570
- var _this = this;
571
- var blocks = this.blocks;
572
- if (!Array.isArray(targetBlocks)) {
573
- targetBlocks = [targetBlocks];
574
- }
575
- targetBlocks.forEach(function (block) {
576
- var index = blocks
577
- .findIndex(function (b) { return b.guid === block.guid; });
578
- if (index !== -1) {
579
- blocks.splice(index, 1);
580
- _this._dispatchEvent(EventType.Remove, block);
581
- }
582
- });
583
- this._setBlocks(blocks);
584
- };
585
- BlocksStore.prototype.isReordableBlock = function (block) {
586
- return [
587
- exports.BlockType.LongText,
588
- exports.BlockType.ShortText,
589
- exports.BlockType.RadioButton,
590
- exports.BlockType.Checkbox,
591
- exports.BlockType.Date,
592
- exports.BlockType.Signature,
593
- ].indexOf(block.type) > -1;
594
- };
595
- BlocksStore.prototype.updateTabIndex = function (index) {
596
- this._lastTabIndex = index;
597
- };
598
- BlocksStore.prototype._setBlocks = function (blocks) {
599
- var _this = this;
600
- this._blocks$.next(__spreadArray([], __read(blocks)));
601
- blocks
602
- .filter(function (b) { return _this.isReordableBlock(b); })
603
- .forEach(function (b) {
604
- _this._lastTabIndex = Math.max(b.tabIndex, _this._lastTabIndex);
605
- });
606
- };
607
- BlocksStore.prototype._appendBlock = function (block) {
608
- var blocks = __spreadArray(__spreadArray([], __read(this.blocks)), [
609
- block,
610
- ]);
611
- this._deduplicateIndexesFor(blocks);
612
- this._setBlocks(blocks);
613
- this._dispatchEvent(EventType.Add, block);
614
- };
615
- BlocksStore.prototype._dispatchEvent = function (type, value) {
616
- this._eventBus$.next({
617
- type: type,
618
- value: value,
619
- });
620
- };
621
- BlocksStore.prototype._createBlock = function (block) {
622
- var newBlock = Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || common.guid('xxxxxxxxxxxx'), keepRatio: [
623
- exports.BlockType.Checkbox,
624
- exports.BlockType.RadioButton,
625
- exports.BlockType.Image,
626
- exports.BlockType.Pdf,
627
- ]
628
- .indexOf(block.type) !== -1 });
629
- var width = (this._config.width * .333).toFixed(2);
630
- var height = width / 2;
631
- if (newBlock.type === exports.BlockType.Rectangle) {
632
- newBlock.borderColor = '#cccccc';
633
- newBlock.borderWidth = 1;
634
- }
635
- else if (newBlock.type === exports.BlockType.Checkbox || newBlock.type === exports.BlockType.RadioButton) {
636
- width = .25;
637
- height = .25;
638
- }
639
- else {
640
- width = 2;
641
- height = .5;
642
- }
643
- if (this.isReordableBlock(newBlock)) {
644
- newBlock.tabIndex = this._lastTabIndex + 1;
645
- this.updateTabIndex(newBlock.tabIndex);
646
- }
647
- return Object.assign({ top: height, left: width, width: width, height: height }, newBlock);
648
- };
649
- BlocksStore.prototype._deduplicateIndexesFor = function (blocks) {
650
- blocks.forEach(function (block, index) {
651
- block.index = index;
652
- });
653
- };
654
- return BlocksStore;
655
- }());
656
- BlocksStore.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlocksStore, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
657
- BlocksStore.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlocksStore });
658
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlocksStore, decorators: [{
659
- type: i0.Injectable
500
+ var EventType;
501
+ (function (EventType) {
502
+ EventType["Add"] = "add";
503
+ EventType["Change"] = "change";
504
+ EventType["Remove"] = "remove";
505
+ })(EventType || (EventType = {}));
506
+ var BlocksStore = /** @class */ (function () {
507
+ function BlocksStore() {
508
+ this._lastTabIndex = -1;
509
+ this._eventBus$ = new rxjs.Subject();
510
+ this._blocks$ = new rxjs.BehaviorSubject([]);
511
+ this._destroy$ = new rxjs.Subject();
512
+ }
513
+ Object.defineProperty(BlocksStore.prototype, "blocks", {
514
+ get: function () {
515
+ return __spreadArray([], __read(this._blocks$.getValue()));
516
+ },
517
+ enumerable: false,
518
+ configurable: true
519
+ });
520
+ Object.defineProperty(BlocksStore.prototype, "blocks$", {
521
+ get: function () {
522
+ return this._blocks$.asObservable();
523
+ },
524
+ enumerable: false,
525
+ configurable: true
526
+ });
527
+ Object.defineProperty(BlocksStore.prototype, "blockAdded$", {
528
+ get: function () {
529
+ return this._eventBus$
530
+ .pipe(operators.filter(function (_k) {
531
+ var type = _k.type;
532
+ return type === EventType.Add;
533
+ }), operators.map(function (_k) {
534
+ var value = _k.value;
535
+ return value;
536
+ }));
537
+ },
538
+ enumerable: false,
539
+ configurable: true
540
+ });
541
+ Object.defineProperty(BlocksStore.prototype, "blockChanged$", {
542
+ get: function () {
543
+ return this._eventBus$
544
+ .pipe(operators.filter(function (_k) {
545
+ var type = _k.type;
546
+ return type === EventType.Change;
547
+ }), operators.map(function (_k) {
548
+ var value = _k.value;
549
+ return value;
550
+ }));
551
+ },
552
+ enumerable: false,
553
+ configurable: true
554
+ });
555
+ Object.defineProperty(BlocksStore.prototype, "blockRemoved$", {
556
+ get: function () {
557
+ return this._eventBus$
558
+ .pipe(operators.filter(function (_k) {
559
+ var type = _k.type;
560
+ return type === EventType.Remove;
561
+ }), operators.map(function (_k) {
562
+ var value = _k.value;
563
+ return value;
564
+ }));
565
+ },
566
+ enumerable: false,
567
+ configurable: true
568
+ });
569
+ BlocksStore.prototype.ngOnDestroy = function () {
570
+ this._destroy$.next();
571
+ this._destroy$.complete();
572
+ };
573
+ BlocksStore.prototype.init = function (config) {
574
+ var _this = this;
575
+ this._config = config;
576
+ this._setBlocks(this._config.blocks);
577
+ if (this._config.blockChanged) {
578
+ this.blockChanged$
579
+ .pipe(operators.groupBy(function (block) { return (block.guid); }), operators.map(function (group) { return group.pipe(operators.debounceTime(250)); }), operators.mergeAll())
580
+ .subscribe(function (block) {
581
+ _this._config.blockChanged(block);
582
+ });
583
+ }
584
+ };
585
+ BlocksStore.prototype.blockExists = function (block) {
586
+ var index = this.blocks.findIndex(function (b) {
587
+ return b.guid === block.guid;
588
+ });
589
+ return index !== -1;
590
+ };
591
+ BlocksStore.prototype.blockAdd = function (block) {
592
+ var _this = this;
593
+ if (!this._config.blockAdd) {
594
+ console.warn('[BlockEditor] Config "blockAdd" is not defined');
595
+ return;
596
+ }
597
+ block = this._createBlock(block);
598
+ this._config.blockAdd(block)
599
+ .pipe(operators.takeUntil(this._destroy$))
600
+ .subscribe(function (newBlock) {
601
+ _this._appendBlock(newBlock);
602
+ });
603
+ };
604
+ BlocksStore.prototype.blockUpload = function (block, fsFile) {
605
+ var _this = this;
606
+ if (!this._config.blockUpload) {
607
+ console.warn('[BlockEditor] Config "blockUpload" is not defined');
608
+ return;
609
+ }
610
+ var existing = this.blockExists(block);
611
+ block = this._createBlock(block);
612
+ rxjs.from(fsFile.imageInfo)
613
+ .pipe(operators.switchMap(function (imageInfo) {
614
+ if (!existing && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.height) && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.width)) {
615
+ var ratio = imageInfo.height / imageInfo.width;
616
+ block.width = _this._config.width * .4;
617
+ block.height = block.width * ratio;
618
+ }
619
+ return _this._config.blockUpload(block, fsFile.file);
620
+ }), operators.takeUntil(this._destroy$))
621
+ .subscribe(function (newBlock) {
622
+ if (!existing) {
623
+ _this._appendBlock(newBlock);
624
+ }
625
+ });
626
+ };
627
+ BlocksStore.prototype.blockChange = function (block) {
628
+ this._dispatchEvent(EventType.Change, block);
629
+ };
630
+ BlocksStore.prototype.blockRemove = function (targetBlocks) {
631
+ var _this = this;
632
+ var blocks = this.blocks;
633
+ if (!Array.isArray(targetBlocks)) {
634
+ targetBlocks = [targetBlocks];
635
+ }
636
+ targetBlocks.forEach(function (block) {
637
+ var index = blocks
638
+ .findIndex(function (b) { return b.guid === block.guid; });
639
+ if (index !== -1) {
640
+ blocks.splice(index, 1);
641
+ _this._dispatchEvent(EventType.Remove, block);
642
+ }
643
+ });
644
+ this._setBlocks(blocks);
645
+ };
646
+ BlocksStore.prototype.isReordableBlock = function (block) {
647
+ return [
648
+ exports.BlockType.LongText,
649
+ exports.BlockType.ShortText,
650
+ exports.BlockType.RadioButton,
651
+ exports.BlockType.Checkbox,
652
+ exports.BlockType.Date,
653
+ exports.BlockType.Signature,
654
+ ].indexOf(block.type) > -1;
655
+ };
656
+ BlocksStore.prototype.updateTabIndex = function (index) {
657
+ this._lastTabIndex = index;
658
+ };
659
+ BlocksStore.prototype._setBlocks = function (blocks) {
660
+ var _this = this;
661
+ this._blocks$.next(__spreadArray([], __read(blocks)));
662
+ blocks
663
+ .filter(function (b) { return _this.isReordableBlock(b); })
664
+ .forEach(function (b) {
665
+ _this._lastTabIndex = Math.max(b.tabIndex, _this._lastTabIndex);
666
+ });
667
+ };
668
+ BlocksStore.prototype._appendBlock = function (block) {
669
+ var blocks = __spreadArray(__spreadArray([], __read(this.blocks)), [
670
+ block,
671
+ ]);
672
+ this._deduplicateIndexesFor(blocks);
673
+ this._setBlocks(blocks);
674
+ this._dispatchEvent(EventType.Add, block);
675
+ };
676
+ BlocksStore.prototype._dispatchEvent = function (type, value) {
677
+ this._eventBus$.next({
678
+ type: type,
679
+ value: value,
680
+ });
681
+ };
682
+ BlocksStore.prototype._createBlock = function (block) {
683
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
684
+ var newBlock = Object.assign(Object.assign({}, block), { shapeBottomLeft: (_a = block.shapeBottomLeft) !== null && _a !== void 0 ? _a : 'round', shapeTopLeft: (_b = block.shapeTopLeft) !== null && _b !== void 0 ? _b : 'round', shapeTopRight: (_c = block.shapeTopRight) !== null && _c !== void 0 ? _c : 'round', shapeBottomRight: (_d = block.shapeBottomRight) !== null && _d !== void 0 ? _d : 'round', verticalAlign: (_e = block.verticalAlign) !== null && _e !== void 0 ? _e : 'top', horizontalAlign: (_f = block.horizontalAlign) !== null && _f !== void 0 ? _f : 'left', guid: block.guid || common.guid('xxxxxxxxxxxx'), keepRatio: (_g = block.keepRatio) !== null && _g !== void 0 ? _g : [
685
+ exports.BlockType.Checkbox,
686
+ exports.BlockType.RadioButton,
687
+ exports.BlockType.Pdf,
688
+ ]
689
+ .indexOf(block.type) !== -1 });
690
+ var width = (this._config.width * .333).toFixed(2);
691
+ var height = width / 2;
692
+ if (newBlock.type === exports.BlockType.Rectangle) {
693
+ newBlock = Object.assign(Object.assign({}, newBlock), { borderColor: (_h = newBlock.borderColor) !== null && _h !== void 0 ? _h : '#cccccc', borderWidth: (_j = newBlock.borderWidth) !== null && _j !== void 0 ? _j : 1 });
694
+ }
695
+ else if (newBlock.type === exports.BlockType.Checkbox || newBlock.type === exports.BlockType.RadioButton) {
696
+ width = .25;
697
+ height = .25;
698
+ }
699
+ else {
700
+ width = 2;
701
+ height = .5;
702
+ }
703
+ if (this.isReordableBlock(newBlock)) {
704
+ newBlock.tabIndex = this._lastTabIndex + 1;
705
+ this.updateTabIndex(newBlock.tabIndex);
706
+ }
707
+ return Object.assign({ top: height, left: width, width: width, height: height }, newBlock);
708
+ };
709
+ BlocksStore.prototype._deduplicateIndexesFor = function (blocks) {
710
+ blocks.forEach(function (block, index) {
711
+ block.index = index;
712
+ });
713
+ };
714
+ return BlocksStore;
715
+ }());
716
+ BlocksStore.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlocksStore, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
717
+ BlocksStore.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlocksStore });
718
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlocksStore, decorators: [{
719
+ type: i0.Injectable
660
720
  }] });
661
721
 
662
- var BlockEditorService = /** @class */ (function () {
663
- function BlockEditorService(_store, _dialog) {
664
- this._store = _store;
665
- this._dialog = _dialog;
666
- this._selectedBlocks$ = new rxjs.BehaviorSubject([]);
667
- this._blockComponents = new Map();
668
- this._blockClippable$ = new rxjs.BehaviorSubject(null);
669
- this._destroy$ = new rxjs.Subject();
670
- this._blockInited$ = new rxjs.Subject();
671
- }
672
- Object.defineProperty(BlockEditorService.prototype, "blockComponents", {
673
- get: function () {
674
- return Array.from(this._blockComponents.values());
675
- },
676
- enumerable: false,
677
- configurable: true
678
- });
679
- Object.defineProperty(BlockEditorService.prototype, "selectedComponentBlocks", {
680
- get: function () {
681
- var _this = this;
682
- return this.blockComponents
683
- .filter(function (blockComponent) { return _this.selectedBlocks.indexOf(blockComponent.block) !== -1; });
684
- },
685
- enumerable: false,
686
- configurable: true
687
- });
688
- BlockEditorService.prototype.init = function (config) {
689
- this.config = config;
690
- this._store.init(Object.assign({}, this.config));
691
- };
692
- BlockEditorService.prototype.blockAdd = function (block, newBlock) {
693
- if (newBlock === void 0) { newBlock = false; }
694
- this._store.blockAdd(block, newBlock);
695
- };
696
- BlockEditorService.prototype.blockUpload = function (block, fsFile, newBlock) {
697
- if (newBlock === void 0) { newBlock = false; }
698
- this._store.blockUpload(block, fsFile, true);
699
- };
700
- BlockEditorService.prototype.blockRemove = function (block) {
701
- this._store.blockRemove(block);
702
- };
703
- BlockEditorService.prototype.removeSelectedBlocks = function () {
704
- var _this = this;
705
- this.selectedBlocks
706
- .forEach(function (block) {
707
- _this.blockRemove(block);
708
- });
709
- this.selectedBlocks = [];
710
- };
711
- Object.defineProperty(BlockEditorService.prototype, "blocks$", {
712
- get: function () {
713
- return this._store.blocks$;
714
- },
715
- enumerable: false,
716
- configurable: true
717
- });
718
- Object.defineProperty(BlockEditorService.prototype, "blockChanged$", {
719
- get: function () {
720
- return this._store.blockChanged$;
721
- },
722
- enumerable: false,
723
- configurable: true
724
- });
725
- Object.defineProperty(BlockEditorService.prototype, "blockClippable$", {
726
- get: function () {
727
- return this._blockClippable$;
728
- },
729
- enumerable: false,
730
- configurable: true
731
- });
732
- Object.defineProperty(BlockEditorService.prototype, "blockClippable", {
733
- set: function (value) {
734
- this._blockClippable$.next(value);
735
- },
736
- enumerable: false,
737
- configurable: true
738
- });
739
- Object.defineProperty(BlockEditorService.prototype, "blockAdded$", {
740
- get: function () {
741
- return this._store.blockAdded$;
742
- },
743
- enumerable: false,
744
- configurable: true
745
- });
746
- Object.defineProperty(BlockEditorService.prototype, "blockInited$", {
747
- get: function () {
748
- return this._blockInited$;
749
- },
750
- enumerable: false,
751
- configurable: true
752
- });
753
- Object.defineProperty(BlockEditorService.prototype, "blockRemoved$", {
754
- get: function () {
755
- return this._store.blockRemoved$;
756
- },
757
- enumerable: false,
758
- configurable: true
759
- });
760
- Object.defineProperty(BlockEditorService.prototype, "blocks", {
761
- get: function () {
762
- return this._store.blocks;
763
- },
764
- enumerable: false,
765
- configurable: true
766
- });
767
- BlockEditorService.prototype.blockChange = function (block) {
768
- this._store.blockChange(block);
769
- };
770
- BlockEditorService.prototype.isSelectedBlock = function (block) {
771
- return this.selectedBlocks.indexOf(block.block) !== -1;
772
- };
773
- BlockEditorService.prototype.indexOf = function (block) {
774
- return this.blocks.map(function (e) { return e.guid; }).indexOf(block.guid);
775
- };
776
- BlockEditorService.prototype.selectedBlockComponentChangeProperty = function (value, name) {
777
- var _this = this;
778
- this.selectedBlocks
779
- .forEach(function (block) {
780
- block[name] = value;
781
- _this.blockChange(block);
782
- });
783
- };
784
- Object.defineProperty(BlockEditorService.prototype, "selectedBlocks$", {
785
- get: function () {
786
- return this._selectedBlocks$;
787
- },
788
- enumerable: false,
789
- configurable: true
790
- });
791
- Object.defineProperty(BlockEditorService.prototype, "selectedBlock", {
792
- set: function (block) {
793
- this.selectedBlocks = [block];
794
- },
795
- enumerable: false,
796
- configurable: true
797
- });
798
- Object.defineProperty(BlockEditorService.prototype, "selectedBlocks", {
799
- get: function () {
800
- return this._selectedBlocks$.getValue();
801
- },
802
- set: function (blocks) {
803
- this.blockComponents
804
- .forEach(function (blockComponent) {
805
- if (blocks.indexOf(blockComponent.block) !== -1) {
806
- blockComponent.select();
807
- }
808
- else {
809
- blockComponent.deselect();
810
- }
811
- });
812
- this._selectedBlocks$.next(blocks);
813
- if (this.config.blocksSelected) {
814
- this.config.blocksSelected(blocks);
815
- }
816
- },
817
- enumerable: false,
818
- configurable: true
819
- });
820
- BlockEditorService.prototype.saveSelection = function () {
821
- var selection = window.getSelection();
822
- this._selectionRange = selection.getRangeAt(0);
823
- };
824
- BlockEditorService.prototype.restoreSelection = function () {
825
- if (this._selectionRange) {
826
- var selection = window.getSelection();
827
- selection.removeAllRanges();
828
- selection.addRange(this._selectionRange);
829
- }
830
- };
831
- BlockEditorService.prototype.hasSelectionRange = function () {
832
- return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
833
- };
834
- BlockEditorService.prototype.initBlock = function (block, blockComponent) {
835
- this._blockComponents.set(block, blockComponent);
836
- this._blockInited$.next(block);
837
- };
838
- BlockEditorService.prototype.destroyBlock = function (block) {
839
- this._blockComponents.delete(block);
840
- };
841
- BlockEditorService.prototype.registerContainer = function (container) {
842
- this.container = container;
843
- };
844
- BlockEditorService.prototype.registerMargin = function (margin) {
845
- this.margin = margin;
846
- };
847
- BlockEditorService.prototype.openReorderDialog = function () {
848
- var _this = this;
849
- var blockComponents = this.blockComponents
850
- .sort(function (blockCmpA, blockCmpB) { return (blockCmpA.block.index - blockCmpB.block.index); })
851
- .reverse();
852
- this._dialog
853
- .open(LayersReorderDialogComponent, {
854
- data: {
855
- blockComponents: blockComponents,
856
- }
857
- })
858
- .afterClosed()
859
- .pipe(operators.filter(function (blockComponents) { return !!blockComponents; }), operators.takeUntil(this._destroy$))
860
- .subscribe(function (blockComponents) {
861
- blockComponents
862
- .reverse()
863
- .forEach(function (blockCmp, index) {
864
- blockCmp.block.index = index;
865
- _this._store.blockChange(blockCmp.block);
866
- _this._store.updateTabIndex(index);
867
- });
868
- });
869
- };
870
- BlockEditorService.prototype.ngOnDestroy = function () {
871
- this._destroy$.next();
872
- this._destroy$.complete();
873
- };
874
- return BlockEditorService;
875
- }());
876
- BlockEditorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, deps: [{ token: BlocksStore }, { token: i2__namespace.FsDialog }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
877
- BlockEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService });
878
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, decorators: [{
879
- type: i0.Injectable
722
+ var BlockEditorService = /** @class */ (function () {
723
+ function BlockEditorService(_store, _dialog) {
724
+ this._store = _store;
725
+ this._dialog = _dialog;
726
+ this._selectedBlocks$ = new rxjs.BehaviorSubject([]);
727
+ this._blockComponents = new Map();
728
+ this._blockClippable$ = new rxjs.BehaviorSubject(null);
729
+ this._destroy$ = new rxjs.Subject();
730
+ this._blockInited$ = new rxjs.Subject();
731
+ }
732
+ Object.defineProperty(BlockEditorService.prototype, "blockComponents", {
733
+ get: function () {
734
+ return Array.from(this._blockComponents.values());
735
+ },
736
+ enumerable: false,
737
+ configurable: true
738
+ });
739
+ Object.defineProperty(BlockEditorService.prototype, "selectedComponentBlocks", {
740
+ get: function () {
741
+ var _this = this;
742
+ return this.blockComponents
743
+ .filter(function (blockComponent) { return _this.selectedBlocks.indexOf(blockComponent.block) !== -1; });
744
+ },
745
+ enumerable: false,
746
+ configurable: true
747
+ });
748
+ BlockEditorService.prototype.init = function (config) {
749
+ this.config = config;
750
+ this._store.init(Object.assign({}, this.config));
751
+ };
752
+ BlockEditorService.prototype.blockAdd = function (block) {
753
+ this._store.blockAdd(block);
754
+ };
755
+ BlockEditorService.prototype.blockUpload = function (block, fsFile) {
756
+ this._store.blockUpload(block, fsFile);
757
+ };
758
+ BlockEditorService.prototype.blockRemove = function (block) {
759
+ this._store.blockRemove(block);
760
+ };
761
+ BlockEditorService.prototype.removeSelectedBlocks = function () {
762
+ var _this = this;
763
+ this.selectedBlocks
764
+ .forEach(function (block) {
765
+ _this.blockRemove(block);
766
+ });
767
+ this.selectedBlocks = [];
768
+ };
769
+ Object.defineProperty(BlockEditorService.prototype, "blocks$", {
770
+ get: function () {
771
+ return this._store.blocks$;
772
+ },
773
+ enumerable: false,
774
+ configurable: true
775
+ });
776
+ Object.defineProperty(BlockEditorService.prototype, "blockChanged$", {
777
+ get: function () {
778
+ return this._store.blockChanged$;
779
+ },
780
+ enumerable: false,
781
+ configurable: true
782
+ });
783
+ Object.defineProperty(BlockEditorService.prototype, "blockClippable$", {
784
+ get: function () {
785
+ return this._blockClippable$;
786
+ },
787
+ enumerable: false,
788
+ configurable: true
789
+ });
790
+ Object.defineProperty(BlockEditorService.prototype, "blockClippable", {
791
+ set: function (value) {
792
+ this._blockClippable$.next(value);
793
+ },
794
+ enumerable: false,
795
+ configurable: true
796
+ });
797
+ Object.defineProperty(BlockEditorService.prototype, "blockAdded$", {
798
+ get: function () {
799
+ return this._store.blockAdded$;
800
+ },
801
+ enumerable: false,
802
+ configurable: true
803
+ });
804
+ Object.defineProperty(BlockEditorService.prototype, "blockInited$", {
805
+ get: function () {
806
+ return this._blockInited$;
807
+ },
808
+ enumerable: false,
809
+ configurable: true
810
+ });
811
+ Object.defineProperty(BlockEditorService.prototype, "blockRemoved$", {
812
+ get: function () {
813
+ return this._store.blockRemoved$;
814
+ },
815
+ enumerable: false,
816
+ configurable: true
817
+ });
818
+ Object.defineProperty(BlockEditorService.prototype, "blocks", {
819
+ get: function () {
820
+ return this._store.blocks;
821
+ },
822
+ enumerable: false,
823
+ configurable: true
824
+ });
825
+ BlockEditorService.prototype.blockChange = function (block) {
826
+ this._store.blockChange(block);
827
+ };
828
+ BlockEditorService.prototype.isSelectedBlock = function (block) {
829
+ return this.selectedBlocks.indexOf(block.block) !== -1;
830
+ };
831
+ BlockEditorService.prototype.indexOf = function (block) {
832
+ return this.blocks.map(function (e) { return e.guid; }).indexOf(block.guid);
833
+ };
834
+ BlockEditorService.prototype.selectedBlockComponentChangeProperty = function (value, name) {
835
+ var _this = this;
836
+ this.selectedBlocks
837
+ .forEach(function (block) {
838
+ block[name] = value;
839
+ _this.blockChange(block);
840
+ });
841
+ };
842
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlocks$", {
843
+ get: function () {
844
+ return this._selectedBlocks$;
845
+ },
846
+ enumerable: false,
847
+ configurable: true
848
+ });
849
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlock", {
850
+ set: function (block) {
851
+ this.selectedBlocks = [block];
852
+ },
853
+ enumerable: false,
854
+ configurable: true
855
+ });
856
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlocks", {
857
+ get: function () {
858
+ return this._selectedBlocks$.getValue();
859
+ },
860
+ set: function (blocks) {
861
+ this.blockComponents
862
+ .forEach(function (blockComponent) {
863
+ if (blocks.indexOf(blockComponent.block) !== -1) {
864
+ blockComponent.select();
865
+ }
866
+ else {
867
+ blockComponent.deselect();
868
+ }
869
+ });
870
+ this._selectedBlocks$.next(blocks);
871
+ if (this.config.blocksSelected) {
872
+ this.config.blocksSelected(blocks);
873
+ }
874
+ },
875
+ enumerable: false,
876
+ configurable: true
877
+ });
878
+ BlockEditorService.prototype.saveSelection = function () {
879
+ var selection = window.getSelection();
880
+ this._selectionRange = selection.getRangeAt(0);
881
+ };
882
+ BlockEditorService.prototype.restoreSelection = function () {
883
+ if (this._selectionRange) {
884
+ var selection = window.getSelection();
885
+ selection.removeAllRanges();
886
+ selection.addRange(this._selectionRange);
887
+ }
888
+ };
889
+ BlockEditorService.prototype.hasSelectionRange = function () {
890
+ return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
891
+ };
892
+ BlockEditorService.prototype.initBlock = function (block, blockComponent) {
893
+ this._blockComponents.set(block, blockComponent);
894
+ this._blockInited$.next(block);
895
+ };
896
+ BlockEditorService.prototype.destroyBlock = function (block) {
897
+ this._blockComponents.delete(block);
898
+ };
899
+ BlockEditorService.prototype.registerContainer = function (container) {
900
+ this.container = container;
901
+ };
902
+ BlockEditorService.prototype.registerMargin = function (margin) {
903
+ this.margin = margin;
904
+ };
905
+ BlockEditorService.prototype.openReorderDialog = function () {
906
+ var _this = this;
907
+ var blockComponents = this.blockComponents
908
+ .sort(function (blockCmpA, blockCmpB) { return (blockCmpA.block.index - blockCmpB.block.index); })
909
+ .reverse();
910
+ this._dialog
911
+ .open(LayersReorderDialogComponent, {
912
+ data: {
913
+ blockComponents: blockComponents,
914
+ }
915
+ })
916
+ .afterClosed()
917
+ .pipe(operators.filter(function (blockComponents) { return !!blockComponents; }), operators.takeUntil(this._destroy$))
918
+ .subscribe(function (blockComponents) {
919
+ blockComponents
920
+ .reverse()
921
+ .forEach(function (blockCmp, index) {
922
+ blockCmp.block.index = index;
923
+ _this._store.blockChange(blockCmp.block);
924
+ _this._store.updateTabIndex(index);
925
+ });
926
+ });
927
+ };
928
+ BlockEditorService.prototype.ngOnDestroy = function () {
929
+ this._destroy$.next();
930
+ this._destroy$.complete();
931
+ };
932
+ return BlockEditorService;
933
+ }());
934
+ BlockEditorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, deps: [{ token: BlocksStore }, { token: i2__namespace.FsDialog }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
935
+ BlockEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService });
936
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, decorators: [{
937
+ type: i0.Injectable
880
938
  }], ctorParameters: function () { return [{ type: BlocksStore }, { type: i2__namespace.FsDialog }]; } });
881
939
 
882
- var GoogleFontService = /** @class */ (function () {
883
- function GoogleFontService(httpClient) {
884
- this.httpClient = httpClient;
885
- this._apiKey = 'AIzaSyAoT2RLzCSFUb148F4uLXyAuquAzjcjyGk';
886
- }
887
- GoogleFontService.prototype.loadFont = function (font) {
888
- var link = document.createElement('link');
889
- link.rel = 'stylesheet';
890
- link.href = "https://fonts.googleapis.com/css2?family=" + font.family + "&family=Tangerine&display=swap";
891
- document.getElementsByTagName('head')[0].appendChild(link);
892
- };
893
- GoogleFontService.prototype.getItems = function () {
894
- if (this._fonts$) {
895
- return this._fonts$.asObservable();
896
- }
897
- if (!this._apiKey) {
898
- return rxjs.throwError("Error: api key was not provided to the google fonts service");
899
- }
900
- var url = "https://www.googleapis.com/webfonts/v1/webfonts?key=" + this._apiKey;
901
- return this.httpClient.get(url)
902
- .pipe(operators.map(function (response) { return response.items
903
- .map(function (item) {
904
- return { family: item.family };
905
- }); }));
906
- };
907
- return GoogleFontService;
908
- }());
909
- GoogleFontService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GoogleFontService, deps: [{ token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
910
- GoogleFontService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GoogleFontService });
911
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GoogleFontService, decorators: [{
912
- type: i0.Injectable
913
- }], ctorParameters: function () { return [{ type: i1__namespace$1.HttpClient }]; } });
940
+ var CreateImageUrlPipe = /** @class */ (function () {
941
+ function CreateImageUrlPipe(_api) {
942
+ this._api = _api;
943
+ }
944
+ CreateImageUrlPipe.prototype.transform = function (url) {
945
+ return this._api.createApiFile(url).safeDataUrl;
946
+ };
947
+ return CreateImageUrlPipe;
948
+ }());
949
+ CreateImageUrlPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CreateImageUrlPipe, deps: [{ token: i1__namespace$2.FsApi }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
950
+ CreateImageUrlPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CreateImageUrlPipe, name: "createImageUrl" });
951
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CreateImageUrlPipe, decorators: [{
952
+ type: i0.Pipe,
953
+ args: [{ name: 'createImageUrl' }]
954
+ }], ctorParameters: function () { return [{ type: i1__namespace$2.FsApi }]; } });
914
955
 
915
- var FsBlockComponent = /** @class */ (function () {
916
- function FsBlockComponent(_blockEditor, _elementRef, _cdRef, _googleFontService) {
917
- this._blockEditor = _blockEditor;
918
- this._elementRef = _elementRef;
919
- this._cdRef = _cdRef;
920
- this._googleFontService = _googleFontService;
921
- this.transformating = false;
922
- this.BlockType = exports.BlockType;
923
- this._editable = false;
924
- this._transformable = false;
925
- this._destroy$ = new rxjs.Subject();
926
- }
927
- Object.defineProperty(FsBlockComponent.prototype, "el", {
928
- get: function () {
929
- return this.element.nativeElement;
930
- },
931
- enumerable: false,
932
- configurable: true
933
- });
934
- Object.defineProperty(FsBlockComponent.prototype, "moveable", {
935
- get: function () {
936
- return this._moveable;
937
- },
938
- enumerable: false,
939
- configurable: true
940
- });
941
- Object.defineProperty(FsBlockComponent.prototype, "editable", {
942
- get: function () {
943
- return this._editable;
944
- },
945
- set: function (value) {
946
- this._editable = value;
947
- if (!value) {
948
- this.deselectContent();
949
- }
950
- },
951
- enumerable: false,
952
- configurable: true
953
- });
954
- Object.defineProperty(FsBlockComponent.prototype, "styleTop", {
955
- get: function () {
956
- var top = this.block.top;
957
- return "" + top + this.unit;
958
- },
959
- enumerable: false,
960
- configurable: true
961
- });
962
- Object.defineProperty(FsBlockComponent.prototype, "styleLeft", {
963
- get: function () {
964
- var left = this.block.left;
965
- return "" + left + this.unit;
966
- },
967
- enumerable: false,
968
- configurable: true
969
- });
970
- Object.defineProperty(FsBlockComponent.prototype, "styleWidth", {
971
- get: function () {
972
- var width = this.block.width;
973
- if (this.block.clipPath) {
974
- width -= (this.block.width * this.block.clipPath.values[1] / 100) + (this.block.width * this.block.clipPath.values[3] / 100);
975
- }
976
- return "" + width + this.unit;
977
- },
978
- enumerable: false,
979
- configurable: true
980
- });
981
- Object.defineProperty(FsBlockComponent.prototype, "styleHeight", {
982
- get: function () {
983
- var height = this.block.height;
984
- if (this.block.clipPath) {
985
- height -= (this.block.height * this.block.clipPath.values[0] / 100) + (this.block.height * this.block.clipPath.values[2] / 100);
986
- }
987
- return "" + height + this.unit;
988
- },
989
- enumerable: false,
990
- configurable: true
991
- });
992
- Object.defineProperty(FsBlockComponent.prototype, "styleImageHeight", {
993
- get: function () {
994
- var height = this.block.height;
995
- if (this.block.clipPath) {
996
- var values = this.block.clipPath.values || {};
997
- //height += (values[0]/100 * height) + (values[2]/100 * height);
998
- }
999
- return "" + height + this.unit;
1000
- },
1001
- enumerable: false,
1002
- configurable: true
1003
- });
1004
- Object.defineProperty(FsBlockComponent.prototype, "styleImageWidth", {
1005
- get: function () {
1006
- var width = this.block.width;
1007
- if (this.block.clipPath) {
1008
- var values = this.block.clipPath.values || {};
1009
- //width += (values[1]/100 * width) + (values[3]/100 * width);
1010
- }
1011
- return "" + width + this.unit;
1012
- },
1013
- enumerable: false,
1014
- configurable: true
1015
- });
1016
- Object.defineProperty(FsBlockComponent.prototype, "styleImageTop", {
1017
- get: function () {
1018
- var top = 0;
1019
- if (this.block.clipPath) {
1020
- var values = this.block.clipPath.values || {};
1021
- top = (values[0] / 100) * this.block.width * -1;
1022
- }
1023
- return "" + top + this.unit;
1024
- },
1025
- enumerable: false,
1026
- configurable: true
1027
- });
1028
- Object.defineProperty(FsBlockComponent.prototype, "styleImageLeft", {
1029
- get: function () {
1030
- var left = 0;
1031
- if (this.block.clipPath) {
1032
- var values = this.block.clipPath.values || {};
1033
- left = (values[3] / 100) * this.block.width * -1;
1034
- }
1035
- return "" + left + this.unit;
1036
- },
1037
- enumerable: false,
1038
- configurable: true
1039
- });
1040
- Object.defineProperty(FsBlockComponent.prototype, "styleClipPath", {
1041
- get: function () {
1042
- if (!this.block.clipPath) {
1043
- return null;
1044
- }
1045
- var values = this.block.clipPath.values || {};
1046
- var top = values[0] / 100 * this.block.height;
1047
- var right = (values[1]) / 100 * this.block.width;
1048
- var bottom = (values[2]) / 100 * this.block.height;
1049
- var left = values[3] / 100 * this.block.width;
1050
- var clipPath = "inset(" + top + this.unit + " " + right + this.unit + " " + bottom + this.unit + " " + left + this.unit + ")";
1051
- return clipPath;
1052
- },
1053
- enumerable: false,
1054
- configurable: true
1055
- });
1056
- Object.defineProperty(FsBlockComponent.prototype, "styleBoxShadow", {
1057
- get: function () {
1058
- if (!this.block.shadowColor) {
1059
- return null;
1060
- }
1061
- var shadow = this.block.shadowX + "pt " + (this.block.shadowY || 0) + "pt " + (this.block.shadowBlur || 0) + "pt " + (this.block.shadowSpread || 0) + "pt " + this.block.shadowColor;
1062
- return shadow;
1063
- },
1064
- enumerable: false,
1065
- configurable: true
1066
- });
1067
- Object.defineProperty(FsBlockComponent.prototype, "elementGuidelines", {
1068
- set: function (value) {
1069
- this.moveable.elementGuidelines = value;
1070
- },
1071
- enumerable: false,
1072
- configurable: true
1073
- });
1074
- Object.defineProperty(FsBlockComponent.prototype, "clippable", {
1075
- get: function () {
1076
- return !!this.moveable.clippable;
1077
- },
1078
- set: function (value) {
1079
- this.moveable.clippable = value;
1080
- if (this.selected) {
1081
- this.moveable.resizable = !value;
1082
- this.moveable.rotatable = !value;
1083
- this.moveable.scalable = !value;
1084
- }
1085
- },
1086
- enumerable: false,
1087
- configurable: true
1088
- });
1089
- Object.defineProperty(FsBlockComponent.prototype, "transformable", {
1090
- get: function () {
1091
- return this._transformable;
1092
- },
1093
- set: function (value) {
1094
- if (this.block.lock) {
1095
- value = false;
1096
- }
1097
- this._transformable = value;
1098
- this.moveable.resizable = value;
1099
- this.moveable.rotatable = value;
1100
- this.moveable.scalable = value;
1101
- },
1102
- enumerable: false,
1103
- configurable: true
1104
- });
1105
- Object.defineProperty(FsBlockComponent.prototype, "rotate", {
1106
- set: function (value) {
1107
- this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
1108
- this.moveable.updateRect();
1109
- },
1110
- enumerable: false,
1111
- configurable: true
1112
- });
1113
- Object.defineProperty(FsBlockComponent.prototype, "index", {
1114
- set: function (value) {
1115
- this.block.index = value;
1116
- },
1117
- enumerable: false,
1118
- configurable: true
1119
- });
1120
- Object.defineProperty(FsBlockComponent.prototype, "keepRatio", {
1121
- set: function (value) {
1122
- this.moveable.keepRatio = value;
1123
- },
1124
- enumerable: false,
1125
- configurable: true
1126
- });
1127
- FsBlockComponent.prototype.markForCheck = function () {
1128
- this._cdRef.markForCheck();
1129
- };
1130
- FsBlockComponent.prototype.ngOnInit = function () {
1131
- var _this = this;
1132
- this.unit = this._blockEditor.config.unit;
1133
- this.content = this.block.content;
1134
- this.block.shadowOpacity = this.block.shadowOpacity || 100;
1135
- this._initFonts();
1136
- this._blockEditor.selectedBlocks$
1137
- .pipe(operators.takeUntil(this._destroy$))
1138
- .subscribe(function (blocks) {
1139
- _this.selected = blocks.includes(_this.block);
1140
- _this._cdRef.markForCheck();
1141
- });
1142
- this._blockEditor.blockClippable$
1143
- .pipe(operators.filter(function () { return _this.selected; }), operators.takeUntil(this._destroy$))
1144
- .subscribe(function (clippable) {
1145
- _this.clippable = clippable;
1146
- _this._cdRef.markForCheck();
1147
- });
1148
- this._blockEditor.blockAdded$
1149
- .pipe(operators.takeUntil(this._destroy$))
1150
- .subscribe(function () {
1151
- _this._cdRef.markForCheck();
1152
- });
1153
- this._blockEditor.blockChanged$
1154
- .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
1155
- .subscribe(function (block) {
1156
- _this.keepRatio = block.keepRatio;
1157
- _this.rotate = _this.block.rotate;
1158
- _this._updateMoveable();
1159
- _this._cdRef.markForCheck();
1160
- });
1161
- };
1162
- FsBlockComponent.prototype.ngAfterContentInit = function () {
1163
- var _this = this;
1164
- setTimeout(function () {
1165
- _this._initEvents();
1166
- _this._initMoveable();
1167
- _this._setTransform();
1168
- _this.rotate = _this.block.rotate;
1169
- _this._blockEditor.initBlock(_this.block, _this);
1170
- _this._blockEditor.blockInited$
1171
- .pipe(operators.takeUntil(_this._destroy$))
1172
- .subscribe(function () {
1173
- _this._updateElementGuidelines();
1174
- });
1175
- });
1176
- };
1177
- FsBlockComponent.prototype.pxToIn = function (px) {
1178
- return this.round(px / 96, 2);
1179
- };
1180
- FsBlockComponent.prototype.round = function (value, decimals) {
1181
- return parseFloat(value.toFixed(decimals));
1182
- };
1183
- FsBlockComponent.prototype.select = function () {
1184
- this.transformable = true;
1185
- };
1186
- FsBlockComponent.prototype.deselect = function () {
1187
- this.editable = false;
1188
- this.clippable = false;
1189
- this.transformable = false;
1190
- this.disableContentEdit();
1191
- };
1192
- FsBlockComponent.prototype.disableContentEdit = function () {
1193
- this.editable = false;
1194
- };
1195
- FsBlockComponent.prototype.deselectContent = function () {
1196
- if (window.getSelection) {
1197
- if (window.getSelection().empty) {
1198
- window.getSelection().empty();
1199
- }
1200
- else if (window.getSelection().removeAllRanges) {
1201
- window.getSelection().removeAllRanges();
1202
- }
1203
- }
1204
- };
1205
- FsBlockComponent.prototype.selectAll = function () {
1206
- var range = document.createRange();
1207
- range.selectNodeContents(this.contentEditable.nativeElement);
1208
- var sel = window.getSelection();
1209
- sel.removeAllRanges();
1210
- sel.addRange(range);
1211
- };
1212
- FsBlockComponent.prototype.ngOnDestroy = function () {
1213
- this._blockEditor.destroyBlock(this.block);
1214
- this._destroy$.next();
1215
- this._destroy$.complete();
1216
- };
1217
- FsBlockComponent.prototype._setTransform = function (transforms) {
1218
- if (transforms === void 0) { transforms = []; }
1219
- transforms = transforms !== null && transforms !== void 0 ? transforms : [];
1220
- this.el.style.transform = transforms.join(' ');
1221
- };
1222
- FsBlockComponent.prototype._triggerChanged = function () {
1223
- this._blockEditor.blockChange(this.block);
1224
- };
1225
- FsBlockComponent.prototype._updateElementGuidelines = function () {
1226
- var _this = this;
1227
- this.moveable.elementGuidelines = this._blockEditor.blockComponents
1228
- .map(function (blockComponent) { return blockComponent.el; })
1229
- .filter(function (el) { return !el.isSameNode(_this.el); });
1230
- };
1231
- FsBlockComponent.prototype._updateMoveable = function () {
1232
- this._moveable.draggable = !this.block.lock;
1233
- if (this.selected) {
1234
- this._moveable.resizable = !this.block.lock;
1235
- this._moveable.rotatable = !this.block.lock;
1236
- }
1237
- };
1238
- FsBlockComponent.prototype._initMoveable = function () {
1239
- var _this = this;
1240
- this._moveable = new Moveable__default["default"](this._elementRef.nativeElement, {
1241
- target: this.el,
1242
- container: this._blockEditor.container,
1243
- draggable: true,
1244
- resizable: false,
1245
- scalable: false,
1246
- rotatable: false,
1247
- warpable: false,
1248
- origin: false,
1249
- clipRelative: true,
1250
- clipArea: true,
1251
- keepRatio: this.block.keepRatio,
1252
- snappable: true,
1253
- snapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
1254
- elementSnapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
1255
- edge: false,
1256
- throttleDrag: 1,
1257
- throttleScale: 0.01,
1258
- throttleRotate: 1,
1259
- throttleResize: 1,
1260
- snapDistFormat: function (v, type) { return "" + _this.round(v / 96, 2); },
1261
- });
1262
- this._updateElementGuidelines();
1263
- this._updateMoveable();
1264
- this.moveable
1265
- .on('clip', function (e) {
1266
- _this.moveable.keepRatio = false;
1267
- e.target.style.clipPath = e.clipStyle;
1268
- _this.block.clipPath = {
1269
- type: 'inset',
1270
- values: e.clipStyles
1271
- .map(function (value) {
1272
- var number = Number(value.replace('%', ''));
1273
- return number > 0 ? number : 0;
1274
- }),
1275
- };
1276
- })
1277
- .on('clipEnd', function (e) {
1278
- _this.moveable.keepRatio = true;
1279
- e.target.style.clipPath = null;
1280
- _this._triggerChanged();
1281
- setTimeout(function () {
1282
- _this.moveable.updateRect();
1283
- }, 100);
1284
- })
1285
- .on('dragStart', function () {
1286
- _this.disableContentEdit();
1287
- _this.transformating = true;
1288
- _this._cdRef.markForCheck();
1289
- })
1290
- .on('drag', function (_a) {
1291
- var target = _a.target, left = _a.left, top = _a.top;
1292
- target.style.left = _this.pxToIn(left) + _this.unit;
1293
- target.style.top = _this.pxToIn(top) + _this.unit;
1294
- _this.block.top = _this.pxToIn(top);
1295
- _this.block.left = _this.pxToIn(left);
1296
- })
1297
- .on('dragEnd', function () {
1298
- _this.transformating = false;
1299
- _this._triggerChanged();
1300
- _this._cdRef.markForCheck();
1301
- })
1302
- .on('resizeStart', function () {
1303
- _this.disableContentEdit();
1304
- _this.zoompan.disable();
1305
- _this.transformating = true;
1306
- _this._cdRef.markForCheck();
1307
- })
1308
- .on('resize', function (_a) {
1309
- var target = _a.target, width = _a.width, height = _a.height, dist = _a.dist, delta = _a.delta, direction = _a.direction;
1310
- width = _this.pxToIn(width);
1311
- height = _this.pxToIn(height);
1312
- if (delta[0]) {
1313
- _this.block.width = width;
1314
- target.style.width = width + _this.unit;
1315
- }
1316
- if (delta[1]) {
1317
- _this.block.height = height;
1318
- target.style.height = height + _this.unit;
1319
- }
1320
- var transform = [0, 0];
1321
- if (direction[1] === -1) {
1322
- transform[1] = dist[1] * -1;
1323
- }
1324
- if (direction[0] === -1) {
1325
- transform[0] = dist[0] * -1;
1326
- }
1327
- _this._setTransform(["translate(" + transform[0] + "px, " + transform[1] + "px)"]);
1328
- })
1329
- .on('resizeEnd', function (_a) {
1330
- var target = _a.target;
1331
- var matrix = new WebKitCSSMatrix(target.style.transform);
1332
- _this.block.top = parseFloat(target.style.top) + _this.pxToIn(matrix.m42);
1333
- _this.block.left = parseFloat(target.style.left) + _this.pxToIn(matrix.m41);
1334
- _this._setTransform();
1335
- _this._triggerChanged();
1336
- _this.zoompan.enable();
1337
- _this.transformating = false;
1338
- _this._cdRef.markForCheck();
1339
- target.style.top = _this.block.top + "in";
1340
- target.style.left = _this.block.left + "in";
1341
- target.style.width = _this.block.width + "in";
1342
- target.style.height = _this.block.height + "in";
1343
- _this.moveable.updateRect();
1344
- })
1345
- .on('rotateStart', function (_a) {
1346
- var inputEvent = _a.inputEvent;
1347
- if (inputEvent) {
1348
- _this.zoompan.disable();
1349
- _this.disableContentEdit();
1350
- _this.transformating = true;
1351
- _this._cdRef.markForCheck();
1352
- }
1353
- })
1354
- .on('rotate', function (_a) {
1355
- var inputEvent = _a.inputEvent, transform = _a.transform, rotation = _a.rotation;
1356
- _this.el.style.transform = transform;
1357
- _this.block.rotate = rotation % 360;
1358
- if (inputEvent) {
1359
- _this.zoompan.enable();
1360
- }
1361
- })
1362
- .on('rotateEnd', function (_a) {
1363
- var inputEvent = _a.inputEvent;
1364
- if (inputEvent) {
1365
- _this.transformating = false;
1366
- _this._cdRef.markForCheck();
1367
- _this._triggerChanged();
1368
- }
1369
- });
1370
- };
1371
- FsBlockComponent.prototype._initEvents = function () {
1372
- var _this = this;
1373
- rxjs.fromEvent(this.contentEditable.nativeElement, 'paste')
1374
- .pipe(operators.takeUntil(this._destroy$))
1375
- .subscribe(function (e) {
1376
- e.preventDefault();
1377
- var clipboardData = e.clipboardData;
1378
- var text = clipboardData.getData('Text');
1379
- ;
1380
- var range = document.getSelection().getRangeAt(0);
1381
- range.deleteContents();
1382
- var textNode = document.createTextNode(text);
1383
- range.insertNode(textNode);
1384
- range.selectNodeContents(textNode);
1385
- range.collapse(false);
1386
- var selection = window.getSelection();
1387
- selection.removeAllRanges();
1388
- selection.addRange(range);
1389
- _this.block.content = _this.contentEditable.nativeElement.innerHTML;
1390
- _this._triggerChanged();
1391
- });
1392
- rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
1393
- .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
1394
- _this.block.content = event.target.innerHTML;
1395
- _this._triggerChanged();
1396
- });
1397
- rxjs.fromEvent(this.el, 'mousedown')
1398
- .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
1399
- if (!_this.block.lock) {
1400
- _this.zoompan.disable();
1401
- }
1402
- if (!_this.moveable.clippable) {
1403
- if (_this.editable) {
1404
- if (_this.contentElement.nativeElement.isSameNode(event.target)) {
1405
- event.preventDefault();
1406
- event.stopImmediatePropagation();
1407
- event.stopPropagation();
1408
- }
1409
- }
1410
- else {
1411
- _this._blockEditor.selectedBlock = _this.block;
1412
- }
1413
- }
1414
- });
1415
- rxjs.fromEvent(this.el, 'mouseup')
1416
- .pipe(operators.takeUntil(this._destroy$)).subscribe(function () {
1417
- _this.zoompan.enable();
1418
- });
1419
- rxjs.fromEvent(this.el, 'dblclick')
1420
- .pipe(operators.filter(function () { return (!_this.editable); }), operators.takeUntil(this._destroy$))
1421
- .subscribe(function (event) {
1422
- if (_this.block.readonly) {
1423
- event.preventDefault();
1424
- }
1425
- else {
1426
- _this.editable = true;
1427
- _this._cdRef.markForCheck();
1428
- setTimeout(function () {
1429
- _this.selectAll();
1430
- });
1431
- }
1432
- });
1433
- };
1434
- FsBlockComponent.prototype._initFonts = function () {
1435
- if (this.block.fontFamily) {
1436
- this._googleFontService.loadFont({ family: this.block.fontFamily });
1437
- }
1438
- };
1439
- return FsBlockComponent;
1440
- }());
1441
- FsBlockComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: GoogleFontService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1442
- FsBlockComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [style.top]=\"styleTop\"\n [style.left]=\"styleLeft\"\n [style.width]=\"styleWidth\"\n [style.height]=\"styleHeight\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required,\n lock: block.lock,\n selected: selected\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'in' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'in' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'in' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'in' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.boxShadow]=\"styleBoxShadow\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngIf=\"block.imageUrl\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"block.imageUrl\">\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n <div class=\"outline\"></div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none;cursor:pointer;box-sizing:border-box}.block.selected{border-color:#31a2ff95}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block.block-radiobutton{border-radius:50%}.block.required{background-color:#f7adaa}.block .content-editable{outline:none;position:relative;margin:-1px}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:0px solid transparent;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}.block.selected .outline,.block:hover .outline{border:1px solid rgba(68,170,255,.7);position:absolute;top:0;left:0;bottom:0;right:0}.block.selected.lock .outline,.block:hover.lock .outline{border-color:#e4181866;border-style:dashed}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i13__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1443
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
1444
- type: i0.Component,
1445
- args: [{
1446
- selector: 'fs-block',
1447
- templateUrl: 'block.component.html',
1448
- styleUrls: ['block.component.scss'],
1449
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1450
- }]
1451
- }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: GoogleFontService }]; }, propDecorators: { element: [{
1452
- type: i0.ViewChild,
1453
- args: ['element', { static: true }]
1454
- }], contentElement: [{
1455
- type: i0.ViewChild,
1456
- args: ['contentElement', { static: true }]
1457
- }], contentEditable: [{
1458
- type: i0.ViewChild,
1459
- args: ['contentEditable', { static: true }]
1460
- }], block: [{
1461
- type: i0.Input
1462
- }], html: [{
1463
- type: i0.Input
1464
- }], zoompan: [{
1465
- type: i0.Input
1466
- }], transformating: [{
1467
- type: i0.HostBinding,
1468
- args: ['class.transforming']
956
+ var FsBlockComponent = /** @class */ (function () {
957
+ function FsBlockComponent(_blockEditor, _elementRef, _cdRef, _googleFontService) {
958
+ this._blockEditor = _blockEditor;
959
+ this._elementRef = _elementRef;
960
+ this._cdRef = _cdRef;
961
+ this._googleFontService = _googleFontService;
962
+ this.transformating = false;
963
+ this.BlockType = exports.BlockType;
964
+ this._editable = false;
965
+ this._transformable = false;
966
+ this._destroy$ = new rxjs.Subject();
967
+ }
968
+ Object.defineProperty(FsBlockComponent.prototype, "el", {
969
+ get: function () {
970
+ return this.element.nativeElement;
971
+ },
972
+ enumerable: false,
973
+ configurable: true
974
+ });
975
+ Object.defineProperty(FsBlockComponent.prototype, "moveable", {
976
+ get: function () {
977
+ return this._moveable;
978
+ },
979
+ enumerable: false,
980
+ configurable: true
981
+ });
982
+ Object.defineProperty(FsBlockComponent.prototype, "editable", {
983
+ get: function () {
984
+ return this._editable;
985
+ },
986
+ set: function (value) {
987
+ this._editable = value;
988
+ if (!value) {
989
+ this.deselectContent();
990
+ }
991
+ },
992
+ enumerable: false,
993
+ configurable: true
994
+ });
995
+ Object.defineProperty(FsBlockComponent.prototype, "styleTop", {
996
+ get: function () {
997
+ var top = this.block.top;
998
+ return "" + top + this.unit;
999
+ },
1000
+ enumerable: false,
1001
+ configurable: true
1002
+ });
1003
+ Object.defineProperty(FsBlockComponent.prototype, "styleLeft", {
1004
+ get: function () {
1005
+ var left = this.block.left;
1006
+ return "" + left + this.unit;
1007
+ },
1008
+ enumerable: false,
1009
+ configurable: true
1010
+ });
1011
+ Object.defineProperty(FsBlockComponent.prototype, "styleWidth", {
1012
+ get: function () {
1013
+ var width = this.block.width;
1014
+ if (this.block.clipPath) {
1015
+ width -= (this.block.width * this.block.clipPath.values[1] / 100) + (this.block.width * this.block.clipPath.values[3] / 100);
1016
+ }
1017
+ return "" + width + this.unit;
1018
+ },
1019
+ enumerable: false,
1020
+ configurable: true
1021
+ });
1022
+ Object.defineProperty(FsBlockComponent.prototype, "styleHeight", {
1023
+ get: function () {
1024
+ var height = this.block.height;
1025
+ if (this.block.clipPath) {
1026
+ height -= (this.block.height * this.block.clipPath.values[0] / 100) + (this.block.height * this.block.clipPath.values[2] / 100);
1027
+ }
1028
+ return "" + height + this.unit;
1029
+ },
1030
+ enumerable: false,
1031
+ configurable: true
1032
+ });
1033
+ Object.defineProperty(FsBlockComponent.prototype, "styleImageHeight", {
1034
+ get: function () {
1035
+ var height = this.block.height;
1036
+ if (this.block.clipPath) {
1037
+ var values = this.block.clipPath.values || {};
1038
+ //height += (values[0]/100 * height) + (values[2]/100 * height);
1039
+ }
1040
+ return "" + height + this.unit;
1041
+ },
1042
+ enumerable: false,
1043
+ configurable: true
1044
+ });
1045
+ Object.defineProperty(FsBlockComponent.prototype, "styleImageWidth", {
1046
+ get: function () {
1047
+ var width = this.block.width;
1048
+ if (this.block.clipPath) {
1049
+ var values = this.block.clipPath.values || {};
1050
+ //width += (values[1]/100 * width) + (values[3]/100 * width);
1051
+ }
1052
+ return "" + width + this.unit;
1053
+ },
1054
+ enumerable: false,
1055
+ configurable: true
1056
+ });
1057
+ Object.defineProperty(FsBlockComponent.prototype, "styleImageTop", {
1058
+ get: function () {
1059
+ var top = 0;
1060
+ if (this.block.clipPath) {
1061
+ var values = this.block.clipPath.values || {};
1062
+ top = (values[0] / 100) * this.block.width * -1;
1063
+ }
1064
+ return "" + top + this.unit;
1065
+ },
1066
+ enumerable: false,
1067
+ configurable: true
1068
+ });
1069
+ Object.defineProperty(FsBlockComponent.prototype, "styleImageLeft", {
1070
+ get: function () {
1071
+ var left = 0;
1072
+ if (this.block.clipPath) {
1073
+ var values = this.block.clipPath.values || {};
1074
+ left = (values[3] / 100) * this.block.width * -1;
1075
+ }
1076
+ return "" + left + this.unit;
1077
+ },
1078
+ enumerable: false,
1079
+ configurable: true
1080
+ });
1081
+ Object.defineProperty(FsBlockComponent.prototype, "styleClipPath", {
1082
+ get: function () {
1083
+ if (!this.block.clipPath) {
1084
+ return null;
1085
+ }
1086
+ var values = this.block.clipPath.values || {};
1087
+ var top = values[0] / 100 * this.block.height;
1088
+ var right = (values[1]) / 100 * this.block.width;
1089
+ var bottom = (values[2]) / 100 * this.block.height;
1090
+ var left = values[3] / 100 * this.block.width;
1091
+ var clipPath = "inset(" + top + this.unit + " " + right + this.unit + " " + bottom + this.unit + " " + left + this.unit + ")";
1092
+ return clipPath;
1093
+ },
1094
+ enumerable: false,
1095
+ configurable: true
1096
+ });
1097
+ Object.defineProperty(FsBlockComponent.prototype, "styleBoxShadow", {
1098
+ get: function () {
1099
+ if (!this.block.shadowColor) {
1100
+ return null;
1101
+ }
1102
+ var shadow = this.block.shadowX + "pt " + (this.block.shadowY || 0) + "pt " + (this.block.shadowBlur || 0) + "pt " + (this.block.shadowSpread || 0) + "pt " + this.block.shadowColor;
1103
+ return shadow;
1104
+ },
1105
+ enumerable: false,
1106
+ configurable: true
1107
+ });
1108
+ Object.defineProperty(FsBlockComponent.prototype, "elementGuidelines", {
1109
+ set: function (value) {
1110
+ this.moveable.elementGuidelines = value;
1111
+ },
1112
+ enumerable: false,
1113
+ configurable: true
1114
+ });
1115
+ Object.defineProperty(FsBlockComponent.prototype, "clippable", {
1116
+ get: function () {
1117
+ return !!this.moveable.clippable;
1118
+ },
1119
+ set: function (value) {
1120
+ this.moveable.clippable = value;
1121
+ if (this.selected) {
1122
+ this.moveable.resizable = !value;
1123
+ this.moveable.rotatable = !value;
1124
+ this.moveable.scalable = !value;
1125
+ }
1126
+ },
1127
+ enumerable: false,
1128
+ configurable: true
1129
+ });
1130
+ Object.defineProperty(FsBlockComponent.prototype, "transformable", {
1131
+ get: function () {
1132
+ return this._transformable;
1133
+ },
1134
+ set: function (value) {
1135
+ if (this.block.lock) {
1136
+ value = false;
1137
+ }
1138
+ this._transformable = value;
1139
+ this.moveable.resizable = value;
1140
+ this.moveable.rotatable = value;
1141
+ this.moveable.scalable = value;
1142
+ },
1143
+ enumerable: false,
1144
+ configurable: true
1145
+ });
1146
+ Object.defineProperty(FsBlockComponent.prototype, "rotate", {
1147
+ set: function (value) {
1148
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
1149
+ this.moveable.updateRect();
1150
+ },
1151
+ enumerable: false,
1152
+ configurable: true
1153
+ });
1154
+ Object.defineProperty(FsBlockComponent.prototype, "index", {
1155
+ set: function (value) {
1156
+ this.block.index = value;
1157
+ },
1158
+ enumerable: false,
1159
+ configurable: true
1160
+ });
1161
+ Object.defineProperty(FsBlockComponent.prototype, "keepRatio", {
1162
+ set: function (value) {
1163
+ this.moveable.keepRatio = value;
1164
+ },
1165
+ enumerable: false,
1166
+ configurable: true
1167
+ });
1168
+ FsBlockComponent.prototype.markForCheck = function () {
1169
+ this._cdRef.markForCheck();
1170
+ };
1171
+ FsBlockComponent.prototype.ngOnInit = function () {
1172
+ var _this = this;
1173
+ this.unit = this._blockEditor.config.unit;
1174
+ this.content = this.block.content;
1175
+ this.block.shadowOpacity = this.block.shadowOpacity || 100;
1176
+ this._initFonts();
1177
+ this._blockEditor.selectedBlocks$
1178
+ .pipe(operators.takeUntil(this._destroy$))
1179
+ .subscribe(function (blocks) {
1180
+ _this.selected = blocks.includes(_this.block);
1181
+ _this._cdRef.markForCheck();
1182
+ });
1183
+ this._blockEditor.blockClippable$
1184
+ .pipe(operators.filter(function () { return _this.selected; }), operators.takeUntil(this._destroy$))
1185
+ .subscribe(function (clippable) {
1186
+ _this.clippable = clippable;
1187
+ _this._cdRef.markForCheck();
1188
+ });
1189
+ this._blockEditor.blockAdded$
1190
+ .pipe(operators.takeUntil(this._destroy$))
1191
+ .subscribe(function () {
1192
+ _this._cdRef.markForCheck();
1193
+ });
1194
+ this._blockEditor.blockChanged$
1195
+ .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
1196
+ .subscribe(function (block) {
1197
+ _this.keepRatio = block.keepRatio;
1198
+ _this.rotate = _this.block.rotate;
1199
+ _this._updateMoveable();
1200
+ _this._cdRef.markForCheck();
1201
+ });
1202
+ };
1203
+ FsBlockComponent.prototype.ngAfterContentInit = function () {
1204
+ var _this = this;
1205
+ setTimeout(function () {
1206
+ _this._initEvents();
1207
+ _this._initMoveable();
1208
+ _this._setTransform();
1209
+ _this.rotate = _this.block.rotate;
1210
+ _this._blockEditor.initBlock(_this.block, _this);
1211
+ _this._blockEditor.blockInited$
1212
+ .pipe(operators.takeUntil(_this._destroy$))
1213
+ .subscribe(function () {
1214
+ _this._updateElementGuidelines();
1215
+ });
1216
+ });
1217
+ };
1218
+ FsBlockComponent.prototype.pxToIn = function (px) {
1219
+ return this.round(px / 96, 2);
1220
+ };
1221
+ FsBlockComponent.prototype.round = function (value, decimals) {
1222
+ return parseFloat(value.toFixed(decimals));
1223
+ };
1224
+ FsBlockComponent.prototype.select = function () {
1225
+ this.transformable = true;
1226
+ };
1227
+ FsBlockComponent.prototype.deselect = function () {
1228
+ this.editable = false;
1229
+ this.clippable = false;
1230
+ this.transformable = false;
1231
+ this.disableContentEdit();
1232
+ };
1233
+ FsBlockComponent.prototype.disableContentEdit = function () {
1234
+ this.editable = false;
1235
+ };
1236
+ FsBlockComponent.prototype.deselectContent = function () {
1237
+ if (window.getSelection) {
1238
+ if (window.getSelection().empty) {
1239
+ window.getSelection().empty();
1240
+ }
1241
+ else if (window.getSelection().removeAllRanges) {
1242
+ window.getSelection().removeAllRanges();
1243
+ }
1244
+ }
1245
+ };
1246
+ FsBlockComponent.prototype.selectAll = function () {
1247
+ var range = document.createRange();
1248
+ range.selectNodeContents(this.contentEditable.nativeElement);
1249
+ var sel = window.getSelection();
1250
+ sel.removeAllRanges();
1251
+ sel.addRange(range);
1252
+ };
1253
+ FsBlockComponent.prototype.ngOnDestroy = function () {
1254
+ this._blockEditor.destroyBlock(this.block);
1255
+ this._destroy$.next();
1256
+ this._destroy$.complete();
1257
+ };
1258
+ FsBlockComponent.prototype._setTransform = function (transforms) {
1259
+ if (transforms === void 0) { transforms = []; }
1260
+ transforms = transforms !== null && transforms !== void 0 ? transforms : [];
1261
+ this.el.style.transform = transforms.join(' ');
1262
+ };
1263
+ FsBlockComponent.prototype._triggerChanged = function () {
1264
+ this._blockEditor.blockChange(this.block);
1265
+ };
1266
+ FsBlockComponent.prototype._updateElementGuidelines = function () {
1267
+ var _this = this;
1268
+ this.moveable.elementGuidelines = this._blockEditor.blockComponents
1269
+ .map(function (blockComponent) { return blockComponent.el; })
1270
+ .filter(function (el) { return !el.isSameNode(_this.el); });
1271
+ };
1272
+ FsBlockComponent.prototype._updateMoveable = function () {
1273
+ this._moveable.draggable = !this.block.lock;
1274
+ if (this.selected) {
1275
+ this._moveable.resizable = !this.block.lock;
1276
+ this._moveable.rotatable = !this.block.lock;
1277
+ }
1278
+ };
1279
+ FsBlockComponent.prototype._initMoveable = function () {
1280
+ var _this = this;
1281
+ this._moveable = new Moveable__default["default"](this._elementRef.nativeElement, {
1282
+ target: this.el,
1283
+ container: this._blockEditor.container,
1284
+ draggable: true,
1285
+ resizable: false,
1286
+ scalable: false,
1287
+ rotatable: false,
1288
+ warpable: false,
1289
+ origin: false,
1290
+ clipRelative: true,
1291
+ clipArea: true,
1292
+ keepRatio: this.block.keepRatio,
1293
+ snappable: true,
1294
+ snapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
1295
+ elementSnapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
1296
+ edge: false,
1297
+ throttleDrag: 1,
1298
+ throttleScale: 0.01,
1299
+ throttleRotate: 1,
1300
+ throttleResize: 1,
1301
+ snapDistFormat: function (v, type) { return "" + _this.round(v / 96, 2); },
1302
+ });
1303
+ this._updateElementGuidelines();
1304
+ this._updateMoveable();
1305
+ this.moveable
1306
+ .on('clip', function (e) {
1307
+ _this.moveable.keepRatio = false;
1308
+ e.target.style.clipPath = e.clipStyle;
1309
+ _this.block.clipPath = {
1310
+ type: 'inset',
1311
+ values: e.clipStyles
1312
+ .map(function (value) {
1313
+ var number = Number(value.replace('%', ''));
1314
+ return number > 0 ? number : 0;
1315
+ }),
1316
+ };
1317
+ })
1318
+ .on('clipEnd', function (e) {
1319
+ _this.moveable.keepRatio = true;
1320
+ e.target.style.clipPath = null;
1321
+ _this._triggerChanged();
1322
+ setTimeout(function () {
1323
+ _this.moveable.updateRect();
1324
+ }, 100);
1325
+ })
1326
+ .on('dragStart', function () {
1327
+ _this.disableContentEdit();
1328
+ _this.transformating = true;
1329
+ _this._cdRef.markForCheck();
1330
+ })
1331
+ .on('drag', function (_a) {
1332
+ var target = _a.target, left = _a.left, top = _a.top;
1333
+ target.style.left = _this.pxToIn(left) + _this.unit;
1334
+ target.style.top = _this.pxToIn(top) + _this.unit;
1335
+ _this.block.top = _this.pxToIn(top);
1336
+ _this.block.left = _this.pxToIn(left);
1337
+ })
1338
+ .on('dragEnd', function () {
1339
+ _this.transformating = false;
1340
+ _this._triggerChanged();
1341
+ _this._cdRef.markForCheck();
1342
+ })
1343
+ .on('resizeStart', function () {
1344
+ _this.disableContentEdit();
1345
+ _this.zoompan.disable();
1346
+ _this.transformating = true;
1347
+ _this._cdRef.markForCheck();
1348
+ })
1349
+ .on('resize', function (_a) {
1350
+ var target = _a.target, width = _a.width, height = _a.height, dist = _a.dist, delta = _a.delta, direction = _a.direction;
1351
+ width = _this.pxToIn(width);
1352
+ height = _this.pxToIn(height);
1353
+ if (delta[0]) {
1354
+ _this.block.width = width;
1355
+ target.style.width = width + _this.unit;
1356
+ }
1357
+ if (delta[1]) {
1358
+ _this.block.height = height;
1359
+ target.style.height = height + _this.unit;
1360
+ }
1361
+ var transform = [0, 0];
1362
+ if (direction[1] === -1) {
1363
+ transform[1] = dist[1] * -1;
1364
+ }
1365
+ if (direction[0] === -1) {
1366
+ transform[0] = dist[0] * -1;
1367
+ }
1368
+ _this._setTransform(["translate(" + transform[0] + "px, " + transform[1] + "px)"]);
1369
+ })
1370
+ .on('resizeEnd', function (_a) {
1371
+ var target = _a.target;
1372
+ var matrix = new WebKitCSSMatrix(target.style.transform);
1373
+ _this.block.top = parseFloat(target.style.top) + _this.pxToIn(matrix.m42);
1374
+ _this.block.left = parseFloat(target.style.left) + _this.pxToIn(matrix.m41);
1375
+ _this._setTransform();
1376
+ _this._triggerChanged();
1377
+ _this.zoompan.enable();
1378
+ _this.transformating = false;
1379
+ _this._cdRef.markForCheck();
1380
+ target.style.top = _this.block.top + "in";
1381
+ target.style.left = _this.block.left + "in";
1382
+ target.style.width = _this.block.width + "in";
1383
+ target.style.height = _this.block.height + "in";
1384
+ _this.moveable.updateRect();
1385
+ })
1386
+ .on('rotateStart', function (_a) {
1387
+ var inputEvent = _a.inputEvent;
1388
+ if (inputEvent) {
1389
+ _this.zoompan.disable();
1390
+ _this.disableContentEdit();
1391
+ _this.transformating = true;
1392
+ _this._cdRef.markForCheck();
1393
+ }
1394
+ })
1395
+ .on('rotate', function (_a) {
1396
+ var inputEvent = _a.inputEvent, transform = _a.transform, rotation = _a.rotation;
1397
+ _this.el.style.transform = transform;
1398
+ _this.block.rotate = rotation % 360;
1399
+ if (inputEvent) {
1400
+ _this.zoompan.enable();
1401
+ }
1402
+ })
1403
+ .on('rotateEnd', function (_a) {
1404
+ var inputEvent = _a.inputEvent;
1405
+ if (inputEvent) {
1406
+ _this.transformating = false;
1407
+ _this._cdRef.markForCheck();
1408
+ _this._triggerChanged();
1409
+ }
1410
+ });
1411
+ };
1412
+ FsBlockComponent.prototype._initEvents = function () {
1413
+ var _this = this;
1414
+ rxjs.fromEvent(this.contentEditable.nativeElement, 'paste')
1415
+ .pipe(operators.takeUntil(this._destroy$))
1416
+ .subscribe(function (e) {
1417
+ e.preventDefault();
1418
+ var clipboardData = e.clipboardData;
1419
+ var text = clipboardData.getData('Text');
1420
+ ;
1421
+ var range = document.getSelection().getRangeAt(0);
1422
+ range.deleteContents();
1423
+ var textNode = document.createTextNode(text);
1424
+ range.insertNode(textNode);
1425
+ range.selectNodeContents(textNode);
1426
+ range.collapse(false);
1427
+ var selection = window.getSelection();
1428
+ selection.removeAllRanges();
1429
+ selection.addRange(range);
1430
+ _this.block.content = _this.contentEditable.nativeElement.innerHTML;
1431
+ _this._triggerChanged();
1432
+ });
1433
+ rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
1434
+ .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
1435
+ _this.block.content = event.target.innerHTML;
1436
+ _this._triggerChanged();
1437
+ });
1438
+ rxjs.fromEvent(this.el, 'mousedown')
1439
+ .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
1440
+ if (!_this.block.lock) {
1441
+ _this.zoompan.disable();
1442
+ }
1443
+ if (!_this.moveable.clippable) {
1444
+ if (_this.editable) {
1445
+ if (_this.contentElement.nativeElement.isSameNode(event.target)) {
1446
+ event.preventDefault();
1447
+ event.stopImmediatePropagation();
1448
+ event.stopPropagation();
1449
+ }
1450
+ }
1451
+ else {
1452
+ _this._blockEditor.selectedBlock = _this.block;
1453
+ }
1454
+ }
1455
+ });
1456
+ rxjs.fromEvent(this.el, 'mouseup')
1457
+ .pipe(operators.takeUntil(this._destroy$)).subscribe(function () {
1458
+ _this.zoompan.enable();
1459
+ });
1460
+ rxjs.fromEvent(this.el, 'dblclick')
1461
+ .pipe(operators.filter(function () { return (!_this.editable); }), operators.takeUntil(this._destroy$))
1462
+ .subscribe(function (event) {
1463
+ if (_this.block.readonly) {
1464
+ event.preventDefault();
1465
+ }
1466
+ else {
1467
+ _this.editable = true;
1468
+ _this._cdRef.markForCheck();
1469
+ setTimeout(function () {
1470
+ _this.selectAll();
1471
+ });
1472
+ }
1473
+ });
1474
+ };
1475
+ FsBlockComponent.prototype._initFonts = function () {
1476
+ if (this.block.fontFamily) {
1477
+ this._googleFontService.loadFont({ family: this.block.fontFamily });
1478
+ }
1479
+ };
1480
+ return FsBlockComponent;
1481
+ }());
1482
+ FsBlockComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: GoogleFontService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1483
+ FsBlockComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [style.top]=\"styleTop\"\n [style.left]=\"styleLeft\"\n [style.width]=\"styleWidth\"\n [style.height]=\"styleHeight\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required,\n lock: block.lock,\n selected: selected\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'in' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'in' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'in' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'in' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.boxShadow]=\"styleBoxShadow\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngIf=\"block.imageUrl && ((block.imageUrl | createImageUrl) | async) as src\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"src\">\n </ng-container>\n\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n <div class=\"outline\"></div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none;cursor:pointer;box-sizing:border-box}.block.selected{border-color:#31a2ff95}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block.block-radiobutton{border-radius:50%}.block.required{background-color:#f7adaa}.block .content-editable{outline:none;position:relative;margin:-1px}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:0px solid transparent;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}.block.selected .outline,.block:hover .outline{border:1px solid rgba(68,170,255,.7);position:absolute;top:0;left:0;bottom:0;right:0}.block.selected.lock .outline,.block:hover.lock .outline{border-color:#e4181866;border-style:dashed}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i13__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i13__namespace.AsyncPipe, "createImageUrl": CreateImageUrlPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1484
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
1485
+ type: i0.Component,
1486
+ args: [{
1487
+ selector: 'fs-block',
1488
+ templateUrl: 'block.component.html',
1489
+ styleUrls: ['block.component.scss'],
1490
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1491
+ }]
1492
+ }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: GoogleFontService }]; }, propDecorators: { element: [{
1493
+ type: i0.ViewChild,
1494
+ args: ['element', { static: true }]
1495
+ }], contentElement: [{
1496
+ type: i0.ViewChild,
1497
+ args: ['contentElement', { static: true }]
1498
+ }], contentEditable: [{
1499
+ type: i0.ViewChild,
1500
+ args: ['contentEditable', { static: true }]
1501
+ }], block: [{
1502
+ type: i0.Input
1503
+ }], html: [{
1504
+ type: i0.Input
1505
+ }], zoompan: [{
1506
+ type: i0.Input
1507
+ }], transformating: [{
1508
+ type: i0.HostBinding,
1509
+ args: ['class.transforming']
1469
1510
  }] } });
1470
1511
 
1471
- var FsBlockEditorSidebarPanelDirective = /** @class */ (function () {
1472
- function FsBlockEditorSidebarPanelDirective(templateRef) {
1473
- this.templateRef = templateRef;
1474
- this.show = true;
1475
- }
1476
- return FsBlockEditorSidebarPanelDirective;
1477
- }());
1478
- FsBlockEditorSidebarPanelDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0__namespace.TemplateRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1479
- FsBlockEditorSidebarPanelDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0__namespace });
1480
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, decorators: [{
1481
- type: i0.Directive,
1482
- args: [{
1483
- selector: '[fsBlockEditorSidebarPanel]'
1484
- }]
1485
- }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }]; }, propDecorators: { label: [{
1486
- type: i0.Input
1487
- }], show: [{
1488
- type: i0.Input
1512
+ var FsBlockEditorSidebarPanelDirective = /** @class */ (function () {
1513
+ function FsBlockEditorSidebarPanelDirective(templateRef) {
1514
+ this.templateRef = templateRef;
1515
+ this.show = true;
1516
+ }
1517
+ return FsBlockEditorSidebarPanelDirective;
1518
+ }());
1519
+ FsBlockEditorSidebarPanelDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0__namespace.TemplateRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1520
+ FsBlockEditorSidebarPanelDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0__namespace });
1521
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, decorators: [{
1522
+ type: i0.Directive,
1523
+ args: [{
1524
+ selector: '[fsBlockEditorSidebarPanel]'
1525
+ }]
1526
+ }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }]; }, propDecorators: { label: [{
1527
+ type: i0.Input
1528
+ }], show: [{
1529
+ type: i0.Input
1489
1530
  }] } });
1490
1531
 
1491
- var FsBlockEditorMarginDirective = /** @class */ (function () {
1492
- function FsBlockEditorMarginDirective(_elementRef) {
1493
- this._elementRef = _elementRef;
1494
- }
1495
- Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
1496
- get: function () {
1497
- return this._elementRef.nativeElement;
1498
- },
1499
- enumerable: false,
1500
- configurable: true
1501
- });
1502
- return FsBlockEditorMarginDirective;
1503
- }());
1504
- FsBlockEditorMarginDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1505
- FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
1506
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
1507
- type: i0.Directive,
1508
- args: [{
1509
- selector: '[fsBlockEditorMargin]'
1510
- }]
1532
+ var FsBlockEditorMarginDirective = /** @class */ (function () {
1533
+ function FsBlockEditorMarginDirective(_elementRef) {
1534
+ this._elementRef = _elementRef;
1535
+ }
1536
+ Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
1537
+ get: function () {
1538
+ return this._elementRef.nativeElement;
1539
+ },
1540
+ enumerable: false,
1541
+ configurable: true
1542
+ });
1543
+ return FsBlockEditorMarginDirective;
1544
+ }());
1545
+ FsBlockEditorMarginDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1546
+ FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
1547
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
1548
+ type: i0.Directive,
1549
+ args: [{
1550
+ selector: '[fsBlockEditorMargin]'
1551
+ }]
1511
1552
  }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
1512
1553
 
1513
- var BlockFormats = [
1514
- { value: BlockFormat.Number, name: 'Number', blockTypes: [exports.BlockType.ShortText, exports.BlockType.LongText] },
1515
- { value: BlockFormat.Currency, name: 'Currency', blockTypes: [exports.BlockType.ShortText, exports.BlockType.LongText] },
1516
- { value: BlockFormat.Date, name: 'Date', blockTypes: [exports.BlockType.Date] },
1517
- { value: BlockFormat.YYYYMMDD, name: 'YYYY/MM/DD', blockTypes: [exports.BlockType.Date] },
1554
+ var BlockFormats = [
1555
+ { value: BlockFormat.Number, name: 'Number', blockTypes: [exports.BlockType.ShortText, exports.BlockType.LongText] },
1556
+ { value: BlockFormat.Currency, name: 'Currency', blockTypes: [exports.BlockType.ShortText, exports.BlockType.LongText] },
1557
+ { value: BlockFormat.Date, name: 'Date', blockTypes: [exports.BlockType.Date] },
1558
+ { value: BlockFormat.YYYYMMDD, name: 'YYYY/MM/DD', blockTypes: [exports.BlockType.Date] },
1518
1559
  ];
1519
1560
 
1520
- var FontComponent = /** @class */ (function () {
1521
- function FontComponent(_el, _googleFontService) {
1522
- this._el = _el;
1523
- this._googleFontService = _googleFontService;
1524
- }
1525
- FontComponent.prototype.ngOnInit = function () {
1526
- var _this = this;
1527
- var observer = new IntersectionObserver(function (entries) {
1528
- if (entries[0].isIntersecting === true) {
1529
- _this._googleFontService.loadFont(_this.font);
1530
- }
1531
- }, { threshold: [0] });
1532
- observer.observe(this._el.nativeElement);
1533
- };
1534
- return FontComponent;
1535
- }());
1536
- FontComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FontComponent, deps: [{ token: i0__namespace.ElementRef }, { token: GoogleFontService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1537
- FontComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FontComponent, selector: "app-font", inputs: { font: "font" }, ngImport: i0__namespace, template: "<div\n [style.fontFamily]=\"font.family\">\n {{font.family}}\n</div>\n", styles: [""], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1538
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FontComponent, decorators: [{
1539
- type: i0.Component,
1540
- args: [{
1541
- selector: 'app-font',
1542
- templateUrl: 'font.component.html',
1543
- styleUrls: ['font.component.scss'],
1544
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1545
- }]
1546
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: GoogleFontService }]; }, propDecorators: { font: [{
1547
- type: i0.Input
1548
- }] } });
1549
-
1550
- var SidebarComponent = /** @class */ (function () {
1551
- function SidebarComponent(_el, _blockEditor, _cdRef, _prompt, _googleFontService, _document) {
1552
- var _this = this;
1553
- this._el = _el;
1554
- this._blockEditor = _blockEditor;
1555
- this._cdRef = _cdRef;
1556
- this._prompt = _prompt;
1557
- this._googleFontService = _googleFontService;
1558
- this._document = _document;
1559
- this.zoomCenter = new i0.EventEmitter();
1560
- this.BlockTypes = BlockTypes;
1561
- this.blockTypeNames = common.index(BlockTypes, 'value', 'name');
1562
- this.blockTypeIcons = common.index(BlockTypes, 'value', 'icon');
1563
- this.clippable = false;
1564
- this.BlockType = exports.BlockType;
1565
- this.formats = [];
1566
- this._destroy$ = new rxjs.Subject();
1567
- this.fontFetch = function (value) {
1568
- return _this._googleFontService.getItems();
1569
- };
1570
- this.fontDisplayWith = function (value) {
1571
- return value === null || value === void 0 ? void 0 : value.family;
1572
- };
1573
- }
1574
- Object.defineProperty(SidebarComponent.prototype, "el", {
1575
- get: function () {
1576
- return this._el.nativeElement;
1577
- },
1578
- enumerable: false,
1579
- configurable: true
1580
- });
1581
- SidebarComponent.prototype.ngOnInit = function () {
1582
- var _this = this;
1583
- this._blockEditor.selectedBlocks$
1584
- .pipe(operators.takeUntil(this._destroy$))
1585
- .subscribe(function (blocks) {
1586
- _this.block = blocks[0] ? blocks[0] : null;
1587
- _this.formats = BlockFormats
1588
- .filter(function (blockFormat) { var _a; return (blockFormat.blockTypes.indexOf((_a = _this.block) === null || _a === void 0 ? void 0 : _a.type) !== -1); });
1589
- _this._cdRef.markForCheck();
1590
- });
1591
- this._blockEditor.blockChanged$
1592
- .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
1593
- .subscribe(function () {
1594
- _this._cdRef.markForCheck();
1595
- });
1596
- };
1597
- SidebarComponent.prototype.fontChanged = function (font) {
1598
- this._blockEditor.selectedBlockComponentChangeProperty(font === null || font === void 0 ? void 0 : font.family, 'fontFamily');
1599
- };
1600
- SidebarComponent.prototype.verticalAlignClick = function (value) {
1601
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
1602
- };
1603
- SidebarComponent.prototype.boldClick = function () {
1604
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
1605
- };
1606
- SidebarComponent.prototype.toggleLock = function () {
1607
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.lock, 'lock');
1608
- };
1609
- SidebarComponent.prototype.fontColorChange = function (value) {
1610
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
1611
- };
1612
- SidebarComponent.prototype.italicClick = function () {
1613
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
1614
- };
1615
- SidebarComponent.prototype.underlineClick = function () {
1616
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
1617
- };
1618
- SidebarComponent.prototype.backgroundColorChange = function (value) {
1619
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
1620
- };
1621
- SidebarComponent.prototype.shadowColorChange = function (value) {
1622
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'shadowColor');
1623
- };
1624
- SidebarComponent.prototype.paddingAllChange = function (value) {
1625
- var _this = this;
1626
- value = this.validNumeric(value) ? value : null;
1627
- this.block.paddingTop = value;
1628
- this.block.paddingLeft = value;
1629
- this.block.paddingBottom = value;
1630
- this.block.paddingRight = value;
1631
- this._blockEditor.selectedBlocks
1632
- .forEach(function (block) {
1633
- _this._blockEditor.blockChange(block);
1634
- });
1635
- };
1636
- SidebarComponent.prototype.paddingKeypress = function (event, name) {
1637
- this.block.padding = null;
1638
- this.numericInputKeypress(event, name, 1);
1639
- };
1640
- SidebarComponent.prototype.paddingAllKeypress = function (event, unit) {
1641
- if (unit === void 0) { unit = 1; }
1642
- if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1643
- this.block.padding = common.round(Number(this.block.padding || 0) + ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1644
- this.paddingAllChange(this.block.padding);
1645
- }
1646
- };
1647
- SidebarComponent.prototype.borderColorChange = function (value) {
1648
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
1649
- };
1650
- SidebarComponent.prototype.toggleKeepRatio = function () {
1651
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
1652
- };
1653
- SidebarComponent.prototype.horizontalAlignClick = function (value) {
1654
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
1655
- };
1656
- SidebarComponent.prototype.shapeRound = function (name) {
1657
- var value = this.block[name] === 'round' ? 'square' : 'round';
1658
- this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1659
- };
1660
- SidebarComponent.prototype.numberChange = function (value, name) {
1661
- value = this.validNumeric(value) ? Number(value) : null;
1662
- this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1663
- };
1664
- SidebarComponent.prototype.imageRemove = function () {
1665
- this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
1666
- };
1667
- SidebarComponent.prototype.imageClip = function () {
1668
- this.clippable = !this.clippable;
1669
- this._blockEditor.blockClippable = true;
1670
- };
1671
- SidebarComponent.prototype.blockChangeProperty = function (value, name) {
1672
- this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1673
- };
1674
- SidebarComponent.prototype.imageSelect = function (fsFile) {
1675
- var _this = this;
1676
- if (this.config.imageUpload) {
1677
- this.config.imageUpload(fsFile.file)
1678
- .subscribe(function (value) {
1679
- _this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
1680
- });
1681
- }
1682
- };
1683
- SidebarComponent.prototype.blockRemoveClick = function () {
1684
- var _this = this;
1685
- var _a;
1686
- if (this.config.blocksRemove && ((_a = this._blockEditor.selectedBlocks) === null || _a === void 0 ? void 0 : _a.length)) {
1687
- this._prompt.confirm({
1688
- title: 'Confirm',
1689
- template: 'Are you sure your would like to delete this block?',
1690
- })
1691
- .pipe(operators.switchMap(function () { return _this.config.blocksRemove(_this._blockEditor.selectedBlocks); }), operators.takeUntil(this._destroy$))
1692
- .subscribe(function () {
1693
- _this._blockEditor.removeSelectedBlocks();
1694
- });
1695
- }
1696
- };
1697
- SidebarComponent.prototype.blockUpload = function (type, fsFile) {
1698
- this._blockEditor.blockUpload({ type: type }, fsFile, true);
1699
- };
1700
- SidebarComponent.prototype.blockAdd = function (type) {
1701
- if (type === exports.BlockType.Pdf || type === exports.BlockType.Image) {
1702
- return;
1703
- }
1704
- var block = {
1705
- type: type,
1706
- shadowX: 2,
1707
- shadowY: 2,
1708
- shadowBlur: 4,
1709
- };
1710
- this._blockEditor.blockAdd(block, true);
1711
- };
1712
- SidebarComponent.prototype.layerMove = function (direction) {
1713
- var _this = this;
1714
- this._blockEditor.blockComponents.forEach(function (blockComponent) {
1715
- if (_this._blockEditor.isSelectedBlock(blockComponent)) {
1716
- blockComponent.block.index += (999 * direction);
1717
- }
1718
- });
1719
- var sorted = this._blockEditor.blockComponents.sort(function (a, b) {
1720
- return a.block.index > b.block.index ? 1 : -1;
1721
- });
1722
- sorted.forEach(function (item, index) {
1723
- item.block.index = index;
1724
- item.markForCheck();
1725
- });
1726
- if (this.config.blocksLevelChanged) {
1727
- this.config.blocksLevelChanged(sorted.map(function (item) { return item.block; }));
1728
- }
1729
- };
1730
- SidebarComponent.prototype.layerUp = function () {
1731
- this.layerMove(1);
1732
- };
1733
- SidebarComponent.prototype.layerDown = function () {
1734
- this.layerMove(-1);
1735
- };
1736
- SidebarComponent.prototype.reorderLayers = function () {
1737
- var _a;
1738
- (_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
1739
- this._blockEditor.openReorderDialog();
1740
- };
1741
- SidebarComponent.prototype.inputFocus = function (event) {
1742
- event.target.select();
1743
- };
1744
- SidebarComponent.prototype.numericInputKeypress = function (event, name, unit) {
1745
- if (unit === void 0) { unit = 1; }
1746
- if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1747
- this.block[name] = common.round(Number(this.block[name] || 0) + ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1748
- this._blockEditor.selectedBlockComponentChangeProperty(this.block[name], name);
1749
- }
1750
- };
1751
- SidebarComponent.prototype.ngOnDestroy = function () {
1752
- this._destroy$.next();
1753
- this._destroy$.complete();
1754
- };
1755
- SidebarComponent.prototype.validNumeric = function (value) {
1756
- return !value || !!String(value).match(/^\d*\.?\d*$/);
1757
- };
1758
- return SidebarComponent;
1759
- }());
1760
- SidebarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }, { token: i0__namespace.ChangeDetectorRef }, { token: i2__namespace$1.FsPrompt }, { token: GoogleFontService }, { token: i13.DOCUMENT }], target: i0__namespace.ɵɵFactoryTarget.Component });
1761
- SidebarComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<div class=\"sidebar\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container *ngIf=\"blockType.type === 'draw'\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <ng-container \n [ngTemplateOutlet]=\"addButton\" \n [ngTemplateOutletContext]=\"{ blockType: blockType }\">\n </ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [accept]=\"blockType.accept\">\n <ng-container [ngTemplateOutlet]=\"addButton\" [ngTemplateOutletContext]=\"{ blockType: blockType }\"></ng-container>\n </fs-file>\n </ng-template>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container *ngIf=\"blockType.type === 'form'\">\n <ng-container \n [ngTemplateOutlet]=\"addButton\" \n [ngTemplateOutletContext]=\"{ blockType: blockType }\">\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div> \n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n matTooltip=\"Reset zoom\"\n (click)=\"zoomCenter.emit()\">\n <mat-icon>crop_free</mat-icon>\n </button>\n <button\n class=\"reorder-layers\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"reorderLayers()\">\n <mat-icon>swap_vert</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"toggleLock()\"\n [matTooltip]=\"block.lock ? 'Unlock' : 'Lock'\">\n <mat-icon>{{block.lock ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </button>\n\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'left', .01)\"\n (ngModelChange)=\"numberChange($event, 'left')\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'top', .01)\"\n (ngModelChange)=\"numberChange($event, 'top')\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless rotate\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'rotate')\"\n (ngModelChange)=\"numberChange($event, 'rotate')\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'width', .01)\"\n (ngModelChange)=\"numberChange($event, 'width')\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'height', .01)\"\n (ngModelChange)=\"numberChange($event, 'height')\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container\n *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date || block.type === BlockType.Signature\">\n <div class=\"sidebar-panel block-form-panel\">\n <div class=\"sidebar-label\">\n <mat-icon>{{blockTypeIcons[block.type]}}</mat-icon>\n {{blockTypeNames[block.type]}}\n </div>\n <div class=\"sidebar-row\">\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'label')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.Checkbox && block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field\n *ngIf=\"formats.length\"\n class=\"form-field-padless-bottom full-width\">\n <mat-label>Format</mat-label>\n <mat-select\n [(ngModel)]=\"block.format\"\n name=\"format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\n <mat-option [value]=\"null\">\n None\n </mat-option>\n <mat-option\n *ngFor=\"let item of formats\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <ng-container\n *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox\n name=\"required\"\n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n\n <mat-checkbox\n name=\"readonly\"\n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockChangeProperty($event, 'readonly')\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-autocomplete\n [fetch]=\"fontFetch\"\n [fetchOnFocus]=\"true\"\n [displayWith]=\"fontDisplayWith\"\n [ngModel]=\"block.fontFamily ? { family: block.fontFamily } : null\"\n placeholder=\"Font\"\n [panelClass]=\"'font-autocomplete-panel'\"\n (ngModelChange)=\"fontChanged($event)\"\n name=\"fontfamily\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n <app-font [font]=\"data\"></app-font>\n </ng-template>\n </fs-autocomplete>\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'fontSize')\"\n (ngModelChange)=\"numberChange($event, 'fontSize')\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'lineHeight')\"\n (ngModelChange)=\"numberChange($event, 'lineHeight')\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'justify' }\"\n (click)=\"horizontalAlignClick('justify')\">\n <mat-icon>format_align_justify</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'borderWidth')\"\n (ngModelChange)=\"numberChange($event, 'borderWidth')\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shapeRadius', 1)\"\n (ngModelChange)=\"numberChange($event, 'shapeRadius')\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n\n <div class=\"sidebar-panel shadow-panel\">\n <div class=\"sidebar-label\">Shadow</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"shadowColorChange($event)\"\n [color]=\"block.shadowColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shadow-x\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowX\"\n name=\"shadowX\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowX')\"\n (ngModelChange)=\"numberChange($event, 'shadowX')\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless shadow-y\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowY\"\n name=\"shadowY\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowY')\"\n (ngModelChange)=\"numberChange($event, 'shadowY')\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless shadow-blur\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowBlur\"\n name=\"shadowBlur\"\n placeholder=\"Blur\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowBlur')\"\n (ngModelChange)=\"numberChange($event, 'shadowBlur')\">\n <span matPrefix *ngIf=\"block.shadowBlur\">B</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowSpread\"\n name=\"shadowSpread\"\n placeholder=\"Spread\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowSpread')\"\n (ngModelChange)=\"numberChange($event, 'shadowSpread')\">\n <span matPrefix *ngIf=\"block.shadowSpread\">S</span>\n </mat-form-field>\n <!-- <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowOpacity\"\n name=\"shadowOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowOpacity')\"\n (ngModelChange)=\"numberChange($event, 'shadowOpacity')\">\n <span matPrefix *ngIf=\"block.shadowOpacity\">O</span>\n </mat-form-field> -->\n </div>\n </div>\n\n <ng-container *ngIf=\"block.type === BlockType.Rectangle\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"imageSelect($event)\">\n <button\n type=\"button\"\n mat-icon-button>\n <mat-icon>cloud_upload</mat-icon>\n </button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n\n <mat-form-field class=\"form-field-padless opacity\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.imageOpacity\"\n name=\"imageOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'imageOpacity')\"\n (ngModelChange)=\"numberChange($event, 'imageOpacity')\">\n <span matPrefix *ngIf=\"block.imageOpacity\">O</span>\n </mat-form-field>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n (keydown)=\"paddingAllKeypress($event, 1)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingTop')\"\n (ngModelChange)=\"numberChange($event, 'paddingTop')\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingBottom')\"\n (ngModelChange)=\"numberChange($event, 'paddingBottom')\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingLeft')\"\n (ngModelChange)=\"numberChange($event, 'paddingLeft')\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingRight')\"\n (ngModelChange)=\"numberChange($event, 'paddingRight')\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n\n\n\n<ng-template #addButton let-blockType=\"blockType\">\n <button\n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n</ng-template>", styles: [".sidebar{width:285px;font-size:14px;height:100%;overflow:auto;background-color:#fff;padding:0 10px 10px;box-shadow:-1px 1px 4px 3px #0003;z-index:1;position:relative;box-sizing:border-box}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row.image-row .opacity{width:55px;margin-left:10px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.block-form-panel .sidebar-label{display:flex;align-items:center}.sidebar .sidebar-panel.block-form-panel .sidebar-label mat-icon{transform:scale(.8);color:inherit;margin-left:-5px}.sidebar .sidebar-panel.block-form-panel mat-form-field+mat-form-field{margin-top:12px}.sidebar .sidebar-panel.block-form-panel .form-field-options{margin-top:11px}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox{display:block}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox+mat-checkbox{margin-top:2px}.sidebar .sidebar-panel.info-panel .mat-form-field{width:60px}.sidebar .sidebar-panel.info-panel .mat-form-field.rotate{width:40px}.sidebar .sidebar-panel.shadow-panel .mat-form-field{width:41px}.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-x,.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-y,.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-blur{width:26px}.sidebar .sidebar-panel.typography-panel fs-autocomplete{width:100%}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel.typography-panel .align-row .mat-icon-button{width:35px;height:35px;line-height:35px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:7px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}:host ::ng-deep .mat-form-field-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], components: [{ type: i3__namespace$1.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "orientate", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i6__namespace.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__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6__namespace$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7__namespace$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i8__namespace.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i9__namespace.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__namespace.FsAutocompleteComponent, selector: "fs-autocomplete", inputs: ["fetch", "placeholder", "displayWith", "fetchOnFocus", "readonly", "required", "disabled", "appearance", "hint", "panelWidth", "panelClass", "showClear"], outputs: ["cleared", "opened", "closed"] }, { type: FontComponent, selector: "app-font", inputs: ["font"] }, { type: i12__namespace.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color", "showClear"], outputs: ["changed"] }], directives: [{ type: i13__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i13__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i13__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i14__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i15__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i16__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i16__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i16__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6__namespace$1.MatPrefix, selector: "[matPrefix]" }, { type: i17__namespace.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i6__namespace$1.MatLabel, selector: "mat-label" }, { type: i10__namespace.FsAutocompleteTemplateDirective, selector: "[fsAutocompleteTemplate]" }, { type: i13__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1762
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, decorators: [{
1763
- type: i0.Component,
1764
- args: [{
1765
- selector: 'sidebar',
1766
- templateUrl: 'sidebar.component.html',
1767
- styleUrls: ['sidebar.component.scss'],
1768
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1769
- }]
1770
- }], ctorParameters: function () {
1771
- return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace$1.FsPrompt }, { type: GoogleFontService }, { type: undefined, decorators: [{
1772
- type: i0.Inject,
1773
- args: [i13.DOCUMENT]
1774
- }] }];
1775
- }, propDecorators: { sidebarPanels: [{
1776
- type: i0.ContentChildren,
1777
- args: [FsBlockEditorSidebarPanelDirective]
1778
- }], config: [{
1779
- type: i0.Input
1780
- }], blocks: [{
1781
- type: i0.Input
1782
- }], zoomCenter: [{
1783
- type: i0.Output
1561
+ var SidebarComponent = /** @class */ (function () {
1562
+ function SidebarComponent(_el, _blockEditor, _cdRef, _prompt, _googleFontService, _document) {
1563
+ var _this = this;
1564
+ this._el = _el;
1565
+ this._blockEditor = _blockEditor;
1566
+ this._cdRef = _cdRef;
1567
+ this._prompt = _prompt;
1568
+ this._googleFontService = _googleFontService;
1569
+ this._document = _document;
1570
+ this.zoomCenter = new i0.EventEmitter();
1571
+ this.BlockTypes = BlockTypes;
1572
+ this.blockTypeNames = common.index(BlockTypes, 'value', 'name');
1573
+ this.blockTypeIcons = common.index(BlockTypes, 'value', 'icon');
1574
+ this.clippable = false;
1575
+ this.BlockType = exports.BlockType;
1576
+ this.formats = [];
1577
+ this._destroy$ = new rxjs.Subject();
1578
+ this.fontFetch = function (value) {
1579
+ return _this._googleFontService.getItems();
1580
+ };
1581
+ this.fontDisplayWith = function (value) {
1582
+ return value === null || value === void 0 ? void 0 : value.family;
1583
+ };
1584
+ }
1585
+ Object.defineProperty(SidebarComponent.prototype, "el", {
1586
+ get: function () {
1587
+ return this._el.nativeElement;
1588
+ },
1589
+ enumerable: false,
1590
+ configurable: true
1591
+ });
1592
+ SidebarComponent.prototype.ngOnInit = function () {
1593
+ var _this = this;
1594
+ this._blockEditor.selectedBlocks$
1595
+ .pipe(operators.takeUntil(this._destroy$))
1596
+ .subscribe(function (blocks) {
1597
+ _this.block = blocks[0] ? blocks[0] : null;
1598
+ _this.formats = BlockFormats
1599
+ .filter(function (blockFormat) { var _a; return (blockFormat.blockTypes.indexOf((_a = _this.block) === null || _a === void 0 ? void 0 : _a.type) !== -1); });
1600
+ _this._cdRef.markForCheck();
1601
+ });
1602
+ this._blockEditor.blockChanged$
1603
+ .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
1604
+ .subscribe(function () {
1605
+ _this._cdRef.markForCheck();
1606
+ });
1607
+ };
1608
+ SidebarComponent.prototype.fontChanged = function (font) {
1609
+ this._blockEditor.selectedBlockComponentChangeProperty(font === null || font === void 0 ? void 0 : font.family, 'fontFamily');
1610
+ };
1611
+ SidebarComponent.prototype.verticalAlignClick = function (value) {
1612
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
1613
+ };
1614
+ SidebarComponent.prototype.boldClick = function () {
1615
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
1616
+ };
1617
+ SidebarComponent.prototype.toggleLock = function () {
1618
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.lock, 'lock');
1619
+ };
1620
+ SidebarComponent.prototype.fontColorChange = function (value) {
1621
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
1622
+ };
1623
+ SidebarComponent.prototype.italicClick = function () {
1624
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
1625
+ };
1626
+ SidebarComponent.prototype.underlineClick = function () {
1627
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
1628
+ };
1629
+ SidebarComponent.prototype.backgroundColorChange = function (value) {
1630
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
1631
+ };
1632
+ SidebarComponent.prototype.shadowColorChange = function (value) {
1633
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'shadowColor');
1634
+ };
1635
+ SidebarComponent.prototype.paddingAllChange = function (value) {
1636
+ var _this = this;
1637
+ value = this.validNumeric(value) ? value : null;
1638
+ this.block.paddingTop = value;
1639
+ this.block.paddingLeft = value;
1640
+ this.block.paddingBottom = value;
1641
+ this.block.paddingRight = value;
1642
+ this._blockEditor.selectedBlocks
1643
+ .forEach(function (block) {
1644
+ _this._blockEditor.blockChange(block);
1645
+ });
1646
+ };
1647
+ SidebarComponent.prototype.paddingKeypress = function (event, name) {
1648
+ this.block.padding = null;
1649
+ this.numericInputKeypress(event, name, 1);
1650
+ };
1651
+ SidebarComponent.prototype.paddingAllKeypress = function (event, unit) {
1652
+ if (unit === void 0) { unit = 1; }
1653
+ if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1654
+ this.block.padding = common.round(Number(this.block.padding || 0) + ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1655
+ this.paddingAllChange(this.block.padding);
1656
+ }
1657
+ };
1658
+ SidebarComponent.prototype.borderColorChange = function (value) {
1659
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
1660
+ };
1661
+ SidebarComponent.prototype.toggleKeepRatio = function () {
1662
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
1663
+ };
1664
+ SidebarComponent.prototype.horizontalAlignClick = function (value) {
1665
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
1666
+ };
1667
+ SidebarComponent.prototype.shapeRound = function (name) {
1668
+ var value = this.block[name] === 'round' ? 'square' : 'round';
1669
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1670
+ };
1671
+ SidebarComponent.prototype.numberChange = function (value, name) {
1672
+ value = this.validNumeric(value) ? Number(value) : null;
1673
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1674
+ };
1675
+ SidebarComponent.prototype.imageRemove = function () {
1676
+ this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
1677
+ };
1678
+ SidebarComponent.prototype.imageClip = function () {
1679
+ this.clippable = !this.clippable;
1680
+ this._blockEditor.blockClippable = true;
1681
+ };
1682
+ SidebarComponent.prototype.blockChangeProperty = function (value, name) {
1683
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1684
+ };
1685
+ SidebarComponent.prototype.blockRemoveClick = function () {
1686
+ var _this = this;
1687
+ var _a;
1688
+ if (this.config.blocksRemove && ((_a = this._blockEditor.selectedBlocks) === null || _a === void 0 ? void 0 : _a.length)) {
1689
+ this._prompt.confirm({
1690
+ title: 'Confirm',
1691
+ template: 'Are you sure your would like to delete this block?',
1692
+ })
1693
+ .pipe(operators.switchMap(function () { return _this.config.blocksRemove(_this._blockEditor.selectedBlocks); }), operators.takeUntil(this._destroy$))
1694
+ .subscribe(function () {
1695
+ _this._blockEditor.removeSelectedBlocks();
1696
+ });
1697
+ }
1698
+ };
1699
+ SidebarComponent.prototype.blockUpload = function (block, fsFile) {
1700
+ this._blockEditor
1701
+ .blockUpload(block, fsFile);
1702
+ };
1703
+ SidebarComponent.prototype.blockAdd = function (type) {
1704
+ if (type === exports.BlockType.Pdf || type === exports.BlockType.Image) {
1705
+ return;
1706
+ }
1707
+ var block = {
1708
+ type: type,
1709
+ shadowX: 2,
1710
+ shadowY: 2,
1711
+ shadowBlur: 4,
1712
+ };
1713
+ this._blockEditor.blockAdd(block);
1714
+ };
1715
+ SidebarComponent.prototype.layerMove = function (direction) {
1716
+ var _this = this;
1717
+ this._blockEditor.blockComponents.forEach(function (blockComponent) {
1718
+ if (_this._blockEditor.isSelectedBlock(blockComponent)) {
1719
+ blockComponent.block.index += (999 * direction);
1720
+ }
1721
+ });
1722
+ var sorted = this._blockEditor.blockComponents.sort(function (a, b) {
1723
+ return a.block.index > b.block.index ? 1 : -1;
1724
+ });
1725
+ sorted.forEach(function (item, index) {
1726
+ item.block.index = index;
1727
+ item.markForCheck();
1728
+ });
1729
+ if (this.config.blocksLevelChanged) {
1730
+ this.config.blocksLevelChanged(sorted.map(function (item) { return item.block; }));
1731
+ }
1732
+ };
1733
+ SidebarComponent.prototype.layerUp = function () {
1734
+ this.layerMove(1);
1735
+ };
1736
+ SidebarComponent.prototype.layerDown = function () {
1737
+ this.layerMove(-1);
1738
+ };
1739
+ SidebarComponent.prototype.reorderLayers = function () {
1740
+ var _a;
1741
+ (_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
1742
+ this._blockEditor.openReorderDialog();
1743
+ };
1744
+ SidebarComponent.prototype.inputFocus = function (event) {
1745
+ event.target.select();
1746
+ };
1747
+ SidebarComponent.prototype.numericInputKeypress = function (event, name, unit) {
1748
+ if (unit === void 0) { unit = 1; }
1749
+ if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
1750
+ this.block[name] = common.round(Number(this.block[name] || 0) + ((event.code === 'ArrowDown' ? -1 : 1) * unit), 3);
1751
+ this._blockEditor.selectedBlockComponentChangeProperty(this.block[name], name);
1752
+ }
1753
+ };
1754
+ SidebarComponent.prototype.ngOnDestroy = function () {
1755
+ this._destroy$.next();
1756
+ this._destroy$.complete();
1757
+ };
1758
+ SidebarComponent.prototype.validNumeric = function (value) {
1759
+ return !value || !!String(value).match(/^\d*\.?\d*$/);
1760
+ };
1761
+ return SidebarComponent;
1762
+ }());
1763
+ SidebarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }, { token: i0__namespace.ChangeDetectorRef }, { token: i2__namespace$1.FsPrompt }, { token: GoogleFontService }, { token: i13.DOCUMENT }], target: i0__namespace.ɵɵFactoryTarget.Component });
1764
+ SidebarComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<div class=\"sidebar\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container *ngIf=\"blockType.type === 'draw'\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container [ngTemplateOutlet]=\"addFile\" [ngTemplateOutletContext]=\"{ type: BlockType.Pdf }\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container [ngTemplateOutlet]=\"addFile\" [ngTemplateOutletContext]=\"{ type: BlockType.Rectangle }\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <ng-container \n [ngTemplateOutlet]=\"addButton\" \n [ngTemplateOutletContext]=\"{ blockType: blockType }\">\n </ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile let-type=\"type\">\n <fs-file \n (select)=\"blockUpload({ type: type, keepRatio: true, borderWidth: 0 }, $event)\" \n [accept]=\"blockType.accept\">\n <ng-container [ngTemplateOutlet]=\"addButton\" [ngTemplateOutletContext]=\"{ blockType: blockType }\"></ng-container>\n </fs-file>\n </ng-template>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container *ngIf=\"blockType.type === 'form'\">\n <ng-container \n [ngTemplateOutlet]=\"addButton\" \n [ngTemplateOutletContext]=\"{ blockType: blockType }\">\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div> \n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n matTooltip=\"Reset zoom\"\n (click)=\"zoomCenter.emit()\">\n <mat-icon>crop_free</mat-icon>\n </button>\n <button\n class=\"reorder-layers\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"reorderLayers()\">\n <mat-icon>swap_vert</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"toggleLock()\"\n [matTooltip]=\"block.lock ? 'Unlock' : 'Lock'\">\n <mat-icon>{{block.lock ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </button>\n\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'left', .01)\"\n (ngModelChange)=\"numberChange($event, 'left')\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'top', .01)\"\n (ngModelChange)=\"numberChange($event, 'top')\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless rotate\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'rotate')\"\n (ngModelChange)=\"numberChange($event, 'rotate')\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'width', .01)\"\n (ngModelChange)=\"numberChange($event, 'width')\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'height', .01)\"\n (ngModelChange)=\"numberChange($event, 'height')\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container\n *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date || block.type === BlockType.Signature\">\n <div class=\"sidebar-panel block-form-panel\">\n <div class=\"sidebar-label\">\n <mat-icon>{{blockTypeIcons[block.type]}}</mat-icon>\n {{blockTypeNames[block.type]}}\n </div>\n <div class=\"sidebar-row\">\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'label')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.Checkbox && block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field\n *ngIf=\"formats.length\"\n class=\"form-field-padless-bottom full-width\">\n <mat-label>Format</mat-label>\n <mat-select\n [(ngModel)]=\"block.format\"\n name=\"format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\n <mat-option [value]=\"null\">\n None\n </mat-option>\n <mat-option\n *ngFor=\"let item of formats\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <ng-container\n *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [cdkTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox\n name=\"required\"\n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n\n <mat-checkbox\n name=\"readonly\"\n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockChangeProperty($event, 'readonly')\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-autocomplete\n [fetch]=\"fontFetch\"\n [fetchOnFocus]=\"true\"\n [displayWith]=\"fontDisplayWith\"\n [ngModel]=\"block.fontFamily ? { family: block.fontFamily } : null\"\n placeholder=\"Font\"\n [panelClass]=\"'font-autocomplete-panel'\"\n (ngModelChange)=\"fontChanged($event)\"\n name=\"fontfamily\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n <app-font [font]=\"data\"></app-font>\n </ng-template>\n </fs-autocomplete>\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'fontSize')\"\n (ngModelChange)=\"numberChange($event, 'fontSize')\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'lineHeight')\"\n (ngModelChange)=\"numberChange($event, 'lineHeight')\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'justify' }\"\n (click)=\"horizontalAlignClick('justify')\">\n <mat-icon>format_align_justify</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'borderWidth')\"\n (ngModelChange)=\"numberChange($event, 'borderWidth')\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shapeRadius', 1)\"\n (ngModelChange)=\"numberChange($event, 'shapeRadius')\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n\n <div class=\"sidebar-panel shadow-panel\">\n <div class=\"sidebar-label\">Shadow</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"shadowColorChange($event)\"\n [color]=\"block.shadowColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shadow-x\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowX\"\n name=\"shadowX\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowX')\"\n (ngModelChange)=\"numberChange($event, 'shadowX')\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless shadow-y\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowY\"\n name=\"shadowY\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowY')\"\n (ngModelChange)=\"numberChange($event, 'shadowY')\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless shadow-blur\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowBlur\"\n name=\"shadowBlur\"\n placeholder=\"Blur\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowBlur')\"\n (ngModelChange)=\"numberChange($event, 'shadowBlur')\">\n <span matPrefix *ngIf=\"block.shadowBlur\">B</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowSpread\"\n name=\"shadowSpread\"\n placeholder=\"Spread\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowSpread')\"\n (ngModelChange)=\"numberChange($event, 'shadowSpread')\">\n <span matPrefix *ngIf=\"block.shadowSpread\">S</span>\n </mat-form-field>\n <!-- <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.shadowOpacity\"\n name=\"shadowOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'shadowOpacity')\"\n (ngModelChange)=\"numberChange($event, 'shadowOpacity')\">\n <span matPrefix *ngIf=\"block.shadowOpacity\">O</span>\n </mat-form-field> -->\n </div>\n </div>\n\n <ng-container *ngIf=\"block.type === BlockType.Rectangle\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"blockUpload(block, $event)\">\n <button\n type=\"button\"\n mat-icon-button>\n <mat-icon>cloud_upload</mat-icon>\n </button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n\n <mat-form-field class=\"form-field-padless opacity\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.imageOpacity\"\n name=\"imageOpacity\"\n placeholder=\"Opacity\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"numericInputKeypress($event, 'imageOpacity')\"\n (ngModelChange)=\"numberChange($event, 'imageOpacity')\">\n <span matPrefix *ngIf=\"block.imageOpacity\">O</span>\n </mat-form-field>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n (keydown)=\"paddingAllKeypress($event, 1)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingTop')\"\n (ngModelChange)=\"numberChange($event, 'paddingTop')\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingBottom')\"\n (ngModelChange)=\"numberChange($event, 'paddingBottom')\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingLeft')\"\n (ngModelChange)=\"numberChange($event, 'paddingLeft')\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (keydown)=\"paddingKeypress($event, 'paddingRight')\"\n (ngModelChange)=\"numberChange($event, 'paddingRight')\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n<ng-template #addButton let-blockType=\"blockType\">\n <button\n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n</ng-template>", styles: [".sidebar{width:285px;font-size:14px;height:100%;overflow:auto;background-color:#fff;padding:0 10px 10px;box-shadow:0 1px 3px 1px #0003;z-index:1;position:relative;box-sizing:border-box}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row.image-row .opacity{width:55px;margin-left:10px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.block-form-panel .sidebar-label{display:flex;align-items:center}.sidebar .sidebar-panel.block-form-panel .sidebar-label mat-icon{transform:scale(.8);color:inherit;margin-left:-5px}.sidebar .sidebar-panel.block-form-panel mat-form-field+mat-form-field{margin-top:12px}.sidebar .sidebar-panel.block-form-panel .form-field-options{margin-top:11px}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox{display:block}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox+mat-checkbox{margin-top:2px}.sidebar .sidebar-panel.info-panel .mat-form-field{width:60px}.sidebar .sidebar-panel.info-panel .mat-form-field.rotate{width:40px}.sidebar .sidebar-panel.shadow-panel .mat-form-field{width:41px}.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-x,.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-y,.sidebar .sidebar-panel.shadow-panel .mat-form-field.shadow-blur{width:26px}.sidebar .sidebar-panel.typography-panel fs-autocomplete{width:100%}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel.typography-panel .align-row .mat-icon-button{width:35px;height:35px;line-height:35px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:7px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}:host ::ng-deep .mat-form-field-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], components: [{ type: i3__namespace$1.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "orientate", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i6__namespace.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__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6__namespace$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7__namespace$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i8__namespace.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i9__namespace.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__namespace.FsAutocompleteComponent, selector: "fs-autocomplete", inputs: ["fetch", "placeholder", "displayWith", "fetchOnFocus", "readonly", "required", "disabled", "appearance", "hint", "panelWidth", "panelClass", "showClear"], outputs: ["cleared", "opened", "closed"] }, { type: FontComponent, selector: "app-font", inputs: ["font"] }, { type: i12__namespace.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color", "showClear"], outputs: ["changed"] }], directives: [{ type: i13__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i13__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i13__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i14__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i15__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i16__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i16__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i16__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6__namespace$1.MatPrefix, selector: "[matPrefix]" }, { type: i17__namespace.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { type: i6__namespace$1.MatLabel, selector: "mat-label" }, { type: i10__namespace.FsAutocompleteTemplateDirective, selector: "[fsAutocompleteTemplate]" }, { type: i13__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1765
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, decorators: [{
1766
+ type: i0.Component,
1767
+ args: [{
1768
+ selector: 'sidebar',
1769
+ templateUrl: 'sidebar.component.html',
1770
+ styleUrls: ['sidebar.component.scss'],
1771
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1772
+ }]
1773
+ }], ctorParameters: function () {
1774
+ return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace$1.FsPrompt }, { type: GoogleFontService }, { type: undefined, decorators: [{
1775
+ type: i0.Inject,
1776
+ args: [i13.DOCUMENT]
1777
+ }] }];
1778
+ }, propDecorators: { sidebarPanels: [{
1779
+ type: i0.ContentChildren,
1780
+ args: [FsBlockEditorSidebarPanelDirective]
1781
+ }], config: [{
1782
+ type: i0.Input
1783
+ }], blocks: [{
1784
+ type: i0.Input
1785
+ }], zoomCenter: [{
1786
+ type: i0.Output
1784
1787
  }] } });
1785
1788
 
1786
- var ArtboardComponent = /** @class */ (function () {
1787
- function ArtboardComponent(_el, _blockEditor, _cdRef) {
1788
- this._el = _el;
1789
- this._blockEditor = _blockEditor;
1790
- this._cdRef = _cdRef;
1791
- this.blocks = [];
1792
- this._destroy$ = new rxjs.Subject();
1793
- }
1794
- Object.defineProperty(ArtboardComponent.prototype, "el", {
1795
- get: function () {
1796
- return this._el.nativeElement;
1797
- },
1798
- enumerable: false,
1799
- configurable: true
1800
- });
1801
- ArtboardComponent.prototype.ngOnInit = function () {
1802
- var _this = this;
1803
- this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1804
- this._blockEditor.registerContainer(this.artboard.nativeElement);
1805
- this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1806
- this._blockEditor.blocks$
1807
- .pipe(operators.takeUntil(this._destroy$))
1808
- .subscribe(function (blocks) {
1809
- _this.blocks = blocks;
1810
- _this._cdRef.markForCheck();
1811
- });
1812
- this._blockEditor.blockAdded$
1813
- .pipe(operators.delay(300), operators.takeUntil(this._destroy$))
1814
- .subscribe(function (block) {
1815
- _this._blockEditor.selectedBlocks = [block];
1816
- _this._cdRef.markForCheck();
1817
- });
1818
- rxjs.fromEvent(window, 'keydown')
1819
- .pipe(operators.filter(function (event) {
1820
- return ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].indexOf(event.key) !== -1;
1821
- }), operators.filter(function () {
1822
- var el = document.activeElement;
1823
- return !(el instanceof HTMLInputElement || (el && el.classList.contains('content-editable')));
1824
- }), operators.takeUntil(this._destroy$))
1825
- .subscribe(function (event) {
1826
- event.preventDefault();
1827
- var inchPixel = 1 / 100;
1828
- _this._blockEditor.selectedComponentBlocks
1829
- .forEach(function (blockComponent) {
1830
- switch (event.key) {
1831
- case 'ArrowUp':
1832
- blockComponent.block.top = blockComponent.block.top - inchPixel;
1833
- break;
1834
- case 'ArrowDown':
1835
- blockComponent.block.top = blockComponent.block.top + inchPixel;
1836
- break;
1837
- case 'ArrowLeft':
1838
- blockComponent.block.left = blockComponent.block.left - inchPixel;
1839
- break;
1840
- case 'ArrowRight':
1841
- blockComponent.block.left = blockComponent.block.left + inchPixel;
1842
- break;
1843
- }
1844
- _this._blockEditor.blockChange(blockComponent.block);
1845
- });
1846
- });
1847
- };
1848
- ArtboardComponent.prototype.ngOnDestroy = function () {
1849
- this._destroy$.next();
1850
- this._destroy$.complete();
1851
- };
1852
- return ArtboardComponent;
1853
- }());
1854
- ArtboardComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1855
- ArtboardComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<div\n #artboard\n class=\"artboard mat-elevation-z4 deselectable\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks\"\n [zoompan]=\"zoompan\"\n [block]=\"block\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\">\n </div>\n</div> \n\n", styles: [".artboard{position:relative;display:inline-flex;background-color:#fff}.artboard .margin-container{position:absolute;z-index:-1}.artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.artboard .margin.margin-top,.artboard .margin.margin-bottom{width:100%;border-top-width:1px}.artboard .margin.margin-left,.artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html", "zoompan"] }], directives: [{ type: i13__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1856
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, decorators: [{
1857
- type: i0.Component,
1858
- args: [{
1859
- selector: 'app-artboard',
1860
- templateUrl: 'artboard.component.html',
1861
- styleUrls: ['artboard.component.scss'],
1862
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1863
- }]
1864
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { sidebarPanels: [{
1865
- type: i0.ContentChildren,
1866
- args: [FsBlockEditorSidebarPanelDirective]
1867
- }], blockComponents: [{
1868
- type: i0.ViewChildren,
1869
- args: [FsBlockComponent]
1870
- }], artboard: [{
1871
- type: i0.ViewChild,
1872
- args: ['artboard', { static: true }]
1873
- }], marginContainer: [{
1874
- type: i0.ViewChild,
1875
- args: ['marginContainer', { static: true }]
1876
- }], margins: [{
1877
- type: i0.ViewChildren,
1878
- args: [FsBlockEditorMarginDirective]
1879
- }], sidebar: [{
1880
- type: i0.ViewChild,
1881
- args: [SidebarComponent, { static: true }]
1882
- }], config: [{
1883
- type: i0.Input
1884
- }], zoompan: [{
1885
- type: i0.Input
1789
+ var ArtboardComponent = /** @class */ (function () {
1790
+ function ArtboardComponent(_el, _blockEditor, _cdRef) {
1791
+ this._el = _el;
1792
+ this._blockEditor = _blockEditor;
1793
+ this._cdRef = _cdRef;
1794
+ this.blocks = [];
1795
+ this._destroy$ = new rxjs.Subject();
1796
+ }
1797
+ Object.defineProperty(ArtboardComponent.prototype, "el", {
1798
+ get: function () {
1799
+ return this._el.nativeElement;
1800
+ },
1801
+ enumerable: false,
1802
+ configurable: true
1803
+ });
1804
+ ArtboardComponent.prototype.ngOnInit = function () {
1805
+ var _this = this;
1806
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1807
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
1808
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1809
+ this._blockEditor.blocks$
1810
+ .pipe(operators.takeUntil(this._destroy$))
1811
+ .subscribe(function (blocks) {
1812
+ _this.blocks = blocks;
1813
+ _this._cdRef.markForCheck();
1814
+ });
1815
+ this._blockEditor.blockAdded$
1816
+ .pipe(operators.delay(300), operators.takeUntil(this._destroy$))
1817
+ .subscribe(function (block) {
1818
+ _this._blockEditor.selectedBlocks = [block];
1819
+ _this._cdRef.markForCheck();
1820
+ });
1821
+ rxjs.fromEvent(window, 'keydown')
1822
+ .pipe(operators.filter(function (event) {
1823
+ return ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].indexOf(event.key) !== -1;
1824
+ }), operators.filter(function () {
1825
+ var el = document.activeElement;
1826
+ return !(el instanceof HTMLInputElement || (el && el.classList.contains('content-editable')));
1827
+ }), operators.takeUntil(this._destroy$))
1828
+ .subscribe(function (event) {
1829
+ event.preventDefault();
1830
+ var inchPixel = 1 / 100;
1831
+ _this._blockEditor.selectedComponentBlocks
1832
+ .forEach(function (blockComponent) {
1833
+ switch (event.key) {
1834
+ case 'ArrowUp':
1835
+ blockComponent.block.top = blockComponent.block.top - inchPixel;
1836
+ break;
1837
+ case 'ArrowDown':
1838
+ blockComponent.block.top = blockComponent.block.top + inchPixel;
1839
+ break;
1840
+ case 'ArrowLeft':
1841
+ blockComponent.block.left = blockComponent.block.left - inchPixel;
1842
+ break;
1843
+ case 'ArrowRight':
1844
+ blockComponent.block.left = blockComponent.block.left + inchPixel;
1845
+ break;
1846
+ }
1847
+ _this._blockEditor.blockChange(blockComponent.block);
1848
+ });
1849
+ });
1850
+ };
1851
+ ArtboardComponent.prototype.ngOnDestroy = function () {
1852
+ this._destroy$.next();
1853
+ this._destroy$.complete();
1854
+ };
1855
+ return ArtboardComponent;
1856
+ }());
1857
+ ArtboardComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1858
+ ArtboardComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<div\n #artboard\n class=\"artboard mat-elevation-z4 deselectable\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks\"\n [zoompan]=\"zoompan\"\n [block]=\"block\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\">\n </div>\n</div> \n\n", styles: [".artboard{position:relative;display:inline-flex;background-color:#fff}.artboard .margin-container{position:absolute;z-index:-1}.artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.artboard .margin.margin-top,.artboard .margin.margin-bottom{width:100%;border-top-width:1px}.artboard .margin.margin-left,.artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html", "zoompan"] }], directives: [{ type: i13__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1859
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, decorators: [{
1860
+ type: i0.Component,
1861
+ args: [{
1862
+ selector: 'app-artboard',
1863
+ templateUrl: 'artboard.component.html',
1864
+ styleUrls: ['artboard.component.scss'],
1865
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1866
+ }]
1867
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { sidebarPanels: [{
1868
+ type: i0.ContentChildren,
1869
+ args: [FsBlockEditorSidebarPanelDirective]
1870
+ }], blockComponents: [{
1871
+ type: i0.ViewChildren,
1872
+ args: [FsBlockComponent]
1873
+ }], artboard: [{
1874
+ type: i0.ViewChild,
1875
+ args: ['artboard', { static: true }]
1876
+ }], marginContainer: [{
1877
+ type: i0.ViewChild,
1878
+ args: ['marginContainer', { static: true }]
1879
+ }], margins: [{
1880
+ type: i0.ViewChildren,
1881
+ args: [FsBlockEditorMarginDirective]
1882
+ }], sidebar: [{
1883
+ type: i0.ViewChild,
1884
+ args: [SidebarComponent, { static: true }]
1885
+ }], config: [{
1886
+ type: i0.Input
1887
+ }], zoompan: [{
1888
+ type: i0.Input
1886
1889
  }] } });
1887
1890
 
1888
- var FsBlockEditorComponent = /** @class */ (function () {
1889
- function FsBlockEditorComponent(_el, _blockEditor) {
1890
- this._el = _el;
1891
- this._blockEditor = _blockEditor;
1892
- this._destroy$ = new rxjs.Subject();
1893
- }
1894
- Object.defineProperty(FsBlockEditorComponent.prototype, "el", {
1895
- get: function () {
1896
- return this._el.nativeElement;
1897
- },
1898
- enumerable: false,
1899
- configurable: true
1900
- });
1901
- FsBlockEditorComponent.prototype.ngOnInit = function () {
1902
- var _this = this;
1903
- this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1904
- this._blockEditor.init(this.config);
1905
- this._blockEditor.blocks$
1906
- .pipe(operators.takeUntil(this._destroy$))
1907
- .subscribe(function (blocks) {
1908
- _this.blocks = blocks;
1909
- });
1910
- setTimeout(function () {
1911
- _this.zoomCenter();
1912
- });
1913
- };
1914
- FsBlockEditorComponent.prototype.zoomCenter = function () {
1915
- this.zoompan.center(this.artboard.nativeElement, { vertical: false });
1916
- };
1917
- FsBlockEditorComponent.prototype.editorContainerClick = function (event) {
1918
- if (event.target.classList.contains('deselectable') ||
1919
- event.target.classList.contains('fs-zoom-pan-container')) {
1920
- this.zoompan.enable();
1921
- this._blockEditor.selectedBlocks = [];
1922
- }
1923
- };
1924
- FsBlockEditorComponent.prototype.ngOnDestroy = function () {
1925
- this._destroy$.next();
1926
- this._destroy$.complete();
1927
- };
1928
- return FsBlockEditorComponent;
1929
- }());
1930
- FsBlockEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1931
- FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
1932
- BlockEditorService,
1933
- BlocksStore,
1934
- ], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "zoompan", first: true, predicate: i2$2.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: i0.ElementRef }], ngImport: i0__namespace, 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__namespace$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__namespace$2.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1935
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, decorators: [{
1936
- type: i0.Component,
1937
- args: [{
1938
- selector: 'fs-block-editor',
1939
- templateUrl: 'block-editor.component.html',
1940
- styleUrls: ['block-editor.component.scss'],
1941
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1942
- providers: [
1943
- BlockEditorService,
1944
- BlocksStore,
1945
- ]
1946
- }]
1947
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1948
- type: i0.ContentChildren,
1949
- args: [FsBlockEditorSidebarPanelDirective]
1950
- }], zoompan: [{
1951
- type: i0.ViewChild,
1952
- args: [i2$2.FsZoomPanComponent, { static: true }]
1953
- }], artboardContainer: [{
1954
- type: i0.ViewChild,
1955
- args: ['artboardContainer', { static: true }]
1956
- }], sidebar: [{
1957
- type: i0.ViewChild,
1958
- args: [SidebarComponent, { static: true }]
1959
- }], artboard: [{
1960
- type: i0.ViewChild,
1961
- args: [ArtboardComponent, { read: i0.ElementRef }]
1962
- }], config: [{
1963
- type: i0.Input
1891
+ var FsBlockEditorComponent = /** @class */ (function () {
1892
+ function FsBlockEditorComponent(_el, _blockEditor) {
1893
+ this._el = _el;
1894
+ this._blockEditor = _blockEditor;
1895
+ this._destroy$ = new rxjs.Subject();
1896
+ }
1897
+ Object.defineProperty(FsBlockEditorComponent.prototype, "el", {
1898
+ get: function () {
1899
+ return this._el.nativeElement;
1900
+ },
1901
+ enumerable: false,
1902
+ configurable: true
1903
+ });
1904
+ FsBlockEditorComponent.prototype.ngOnInit = function () {
1905
+ var _this = this;
1906
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1907
+ this._blockEditor.init(this.config);
1908
+ this._blockEditor.blocks$
1909
+ .pipe(operators.takeUntil(this._destroy$))
1910
+ .subscribe(function (blocks) {
1911
+ _this.blocks = blocks;
1912
+ });
1913
+ setTimeout(function () {
1914
+ _this.zoomCenter();
1915
+ });
1916
+ };
1917
+ FsBlockEditorComponent.prototype.zoomCenter = function () {
1918
+ this.zoompan.center(this.artboard.nativeElement, { vertical: false });
1919
+ };
1920
+ FsBlockEditorComponent.prototype.editorContainerKeyDown = function (event) {
1921
+ var _a;
1922
+ if ((event.key === 'Delete' || event.key === 'Backspace') && ((_a = event.target) === null || _a === void 0 ? void 0 : _a.nodeName) !== 'INPUT') {
1923
+ this.sidebar.blockRemoveClick();
1924
+ event.preventDefault();
1925
+ }
1926
+ };
1927
+ FsBlockEditorComponent.prototype.editorContainerClick = function (event) {
1928
+ if (event.target.classList.contains('deselectable') ||
1929
+ event.target.classList.contains('fs-zoom-pan-container')) {
1930
+ this.zoompan.enable();
1931
+ this._blockEditor.selectedBlocks = [];
1932
+ }
1933
+ };
1934
+ FsBlockEditorComponent.prototype.ngOnDestroy = function () {
1935
+ this._destroy$.next();
1936
+ this._destroy$.complete();
1937
+ };
1938
+ return FsBlockEditorComponent;
1939
+ }());
1940
+ FsBlockEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1941
+ FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, host: { listeners: { "document:keydown": "editorContainerKeyDown($event)" } }, providers: [
1942
+ BlockEditorService,
1943
+ BlocksStore,
1944
+ ], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "zoompan", first: true, predicate: i2$2.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: i0.ElementRef }], ngImport: i0__namespace, template: "<div \n class=\"editor-container deselectable\"\n (mousedown)=\"editorContainerClick($event)\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n class=\"deselectable\"\n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n (zoomCenter)=\"zoomCenter()\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative;height:100%;background:#d8d8d8;overflow:hidden}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0;border:1px solid #ececec}.editor-container .zoom-pan-container{flex:1}fs-zoom-pan{height:100%}\n"], components: [{ type: i2__namespace$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__namespace$2.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1945
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, decorators: [{
1946
+ type: i0.Component,
1947
+ args: [{
1948
+ selector: 'fs-block-editor',
1949
+ templateUrl: 'block-editor.component.html',
1950
+ styleUrls: ['block-editor.component.scss'],
1951
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1952
+ providers: [
1953
+ BlockEditorService,
1954
+ BlocksStore,
1955
+ ]
1956
+ }]
1957
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1958
+ type: i0.ContentChildren,
1959
+ args: [FsBlockEditorSidebarPanelDirective]
1960
+ }], zoompan: [{
1961
+ type: i0.ViewChild,
1962
+ args: [i2$2.FsZoomPanComponent, { static: true }]
1963
+ }], artboardContainer: [{
1964
+ type: i0.ViewChild,
1965
+ args: ['artboardContainer', { static: true }]
1966
+ }], sidebar: [{
1967
+ type: i0.ViewChild,
1968
+ args: [SidebarComponent, { static: true }]
1969
+ }], artboard: [{
1970
+ type: i0.ViewChild,
1971
+ args: [ArtboardComponent, { read: i0.ElementRef }]
1972
+ }], config: [{
1973
+ type: i0.Input
1974
+ }], editorContainerKeyDown: [{
1975
+ type: i0.HostListener,
1976
+ args: ['document:keydown', ['$event']]
1964
1977
  }] } });
1965
1978
 
1966
- var FsBlockEditorModule = /** @class */ (function () {
1967
- function FsBlockEditorModule() {
1968
- }
1969
- FsBlockEditorModule.forRoot = function () {
1970
- return {
1971
- ngModule: FsBlockEditorModule,
1972
- };
1973
- };
1974
- return FsBlockEditorModule;
1975
- }());
1976
- FsBlockEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1977
- FsBlockEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1978
- FsBlockEditorComponent,
1979
- FsBlockEditorSidebarPanelDirective,
1980
- FsBlockEditorMarginDirective,
1981
- SidebarComponent,
1982
- ArtboardComponent,
1983
- LayersReorderDialogComponent,
1984
- FontComponent], imports: [i13.CommonModule,
1985
- i16.FormsModule,
1986
- i3.MatIconModule,
1987
- i6.MatButtonModule,
1988
- i15.MatInputModule,
1989
- i6$1.MatFormFieldModule,
1990
- i9.MatCheckboxModule,
1991
- i14.MatTooltipModule,
1992
- i7$1.MatSelectModule,
1993
- i4.MatListModule,
1994
- i7.DragDropModule,
1995
- i3$1.FsFileModule,
1996
- i12.FsColorPickerModule,
1997
- menu.FsMenuModule,
1998
- i2$2.FsZoomPanModule,
1999
- i10.FsAutocompleteModule,
2000
- i2.FsDialogModule], exports: [FsBlockComponent,
2001
- FsBlockEditorComponent,
2002
- FsBlockEditorSidebarPanelDirective] });
2003
- FsBlockEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, providers: [
2004
- GoogleFontService,
2005
- ], imports: [[
2006
- i13.CommonModule,
2007
- i16.FormsModule,
2008
- i3.MatIconModule,
2009
- i6.MatButtonModule,
2010
- i15.MatInputModule,
2011
- i6$1.MatFormFieldModule,
2012
- i9.MatCheckboxModule,
2013
- i14.MatTooltipModule,
2014
- i7$1.MatSelectModule,
2015
- i4.MatListModule,
2016
- i7.DragDropModule,
2017
- i3$1.FsFileModule,
2018
- i12.FsColorPickerModule,
2019
- menu.FsMenuModule,
2020
- i2$2.FsZoomPanModule,
2021
- i10.FsAutocompleteModule,
2022
- i2.FsDialogModule,
2023
- ]] });
2024
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, decorators: [{
2025
- type: i0.NgModule,
2026
- args: [{
2027
- imports: [
2028
- i13.CommonModule,
2029
- i16.FormsModule,
2030
- i3.MatIconModule,
2031
- i6.MatButtonModule,
2032
- i15.MatInputModule,
2033
- i6$1.MatFormFieldModule,
2034
- i9.MatCheckboxModule,
2035
- i14.MatTooltipModule,
2036
- i7$1.MatSelectModule,
2037
- i4.MatListModule,
2038
- i7.DragDropModule,
2039
- i3$1.FsFileModule,
2040
- i12.FsColorPickerModule,
2041
- menu.FsMenuModule,
2042
- i2$2.FsZoomPanModule,
2043
- i10.FsAutocompleteModule,
2044
- i2.FsDialogModule,
2045
- ],
2046
- exports: [
2047
- FsBlockComponent,
2048
- FsBlockEditorComponent,
2049
- FsBlockEditorSidebarPanelDirective,
2050
- ],
2051
- declarations: [
2052
- FsBlockComponent,
2053
- FsBlockEditorComponent,
2054
- FsBlockEditorSidebarPanelDirective,
2055
- FsBlockEditorMarginDirective,
2056
- SidebarComponent,
2057
- ArtboardComponent,
2058
- LayersReorderDialogComponent,
2059
- FontComponent,
2060
- ],
2061
- providers: [
2062
- GoogleFontService,
2063
- ]
2064
- }]
1979
+ var FsBlockEditorModule = /** @class */ (function () {
1980
+ function FsBlockEditorModule() {
1981
+ }
1982
+ FsBlockEditorModule.forRoot = function () {
1983
+ return {
1984
+ ngModule: FsBlockEditorModule,
1985
+ };
1986
+ };
1987
+ return FsBlockEditorModule;
1988
+ }());
1989
+ FsBlockEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1990
+ FsBlockEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1991
+ FsBlockEditorComponent,
1992
+ FsBlockEditorSidebarPanelDirective,
1993
+ FsBlockEditorMarginDirective,
1994
+ SidebarComponent,
1995
+ ArtboardComponent,
1996
+ LayersReorderDialogComponent,
1997
+ FontComponent,
1998
+ CreateImageUrlPipe], imports: [i13.CommonModule,
1999
+ i16.FormsModule,
2000
+ i3.MatIconModule,
2001
+ i6.MatButtonModule,
2002
+ i15.MatInputModule,
2003
+ i6$1.MatFormFieldModule,
2004
+ i9.MatCheckboxModule,
2005
+ i14.MatTooltipModule,
2006
+ i7$1.MatSelectModule,
2007
+ i4.MatListModule,
2008
+ i7.DragDropModule,
2009
+ i3$1.FsFileModule,
2010
+ i12.FsColorPickerModule,
2011
+ menu.FsMenuModule,
2012
+ i2$2.FsZoomPanModule,
2013
+ i10.FsAutocompleteModule,
2014
+ i2.FsDialogModule], exports: [FsBlockComponent,
2015
+ FsBlockEditorComponent,
2016
+ FsBlockEditorSidebarPanelDirective] });
2017
+ FsBlockEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, providers: [
2018
+ GoogleFontService,
2019
+ ], imports: [[
2020
+ i13.CommonModule,
2021
+ i16.FormsModule,
2022
+ i3.MatIconModule,
2023
+ i6.MatButtonModule,
2024
+ i15.MatInputModule,
2025
+ i6$1.MatFormFieldModule,
2026
+ i9.MatCheckboxModule,
2027
+ i14.MatTooltipModule,
2028
+ i7$1.MatSelectModule,
2029
+ i4.MatListModule,
2030
+ i7.DragDropModule,
2031
+ i3$1.FsFileModule,
2032
+ i12.FsColorPickerModule,
2033
+ menu.FsMenuModule,
2034
+ i2$2.FsZoomPanModule,
2035
+ i10.FsAutocompleteModule,
2036
+ i2.FsDialogModule,
2037
+ ]] });
2038
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, decorators: [{
2039
+ type: i0.NgModule,
2040
+ args: [{
2041
+ imports: [
2042
+ i13.CommonModule,
2043
+ i16.FormsModule,
2044
+ i3.MatIconModule,
2045
+ i6.MatButtonModule,
2046
+ i15.MatInputModule,
2047
+ i6$1.MatFormFieldModule,
2048
+ i9.MatCheckboxModule,
2049
+ i14.MatTooltipModule,
2050
+ i7$1.MatSelectModule,
2051
+ i4.MatListModule,
2052
+ i7.DragDropModule,
2053
+ i3$1.FsFileModule,
2054
+ i12.FsColorPickerModule,
2055
+ menu.FsMenuModule,
2056
+ i2$2.FsZoomPanModule,
2057
+ i10.FsAutocompleteModule,
2058
+ i2.FsDialogModule,
2059
+ ],
2060
+ exports: [
2061
+ FsBlockComponent,
2062
+ FsBlockEditorComponent,
2063
+ FsBlockEditorSidebarPanelDirective,
2064
+ ],
2065
+ declarations: [
2066
+ FsBlockComponent,
2067
+ FsBlockEditorComponent,
2068
+ FsBlockEditorSidebarPanelDirective,
2069
+ FsBlockEditorMarginDirective,
2070
+ SidebarComponent,
2071
+ ArtboardComponent,
2072
+ LayersReorderDialogComponent,
2073
+ FontComponent,
2074
+ CreateImageUrlPipe,
2075
+ ],
2076
+ providers: [
2077
+ GoogleFontService,
2078
+ ]
2079
+ }]
2065
2080
  }] });
2066
2081
 
2067
- /**
2068
- * Generated bundle index. Do not edit.
2082
+ /**
2083
+ * Generated bundle index. Do not edit.
2069
2084
  */
2070
2085
 
2071
2086
  exports.BlockTypes = BlockTypes;