@firestitch/block-editor 9.0.11 → 12.1.0

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 (55) hide show
  1. package/app/components/artboard/artboard.component.d.ts +35 -0
  2. package/app/components/block/block.component.d.ts +20 -38
  3. package/app/components/block-editor/block-editor.component.d.ts +10 -17
  4. package/app/components/sidebar/sidebar.component.d.ts +29 -12
  5. package/app/consts/block-types.const.d.ts +12 -0
  6. package/app/consts/index.d.ts +1 -0
  7. package/app/directives/block-editor-margin.directive.d.ts +3 -0
  8. package/app/directives/block-editor-sidebar-panel.directive.d.ts +3 -0
  9. package/app/enums/block-type.enum.d.ts +11 -0
  10. package/app/enums/index.d.ts +1 -0
  11. package/app/fs-block-editor.module.d.ts +22 -0
  12. package/app/interfaces/block-editor-config.d.ts +9 -7
  13. package/app/interfaces/block.d.ts +12 -1
  14. package/app/services/block-editor.service.d.ts +34 -14
  15. package/app/services/index.d.ts +1 -0
  16. package/bundles/firestitch-block-editor.umd.js +966 -838
  17. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  18. package/esm2015/app/components/artboard/artboard.component.js +129 -0
  19. package/esm2015/app/components/block/block.component.js +162 -254
  20. package/esm2015/app/components/block-editor/block-editor.component.js +55 -131
  21. package/esm2015/app/components/sidebar/sidebar.component.js +128 -192
  22. package/esm2015/app/consts/block-types.const.js +13 -0
  23. package/esm2015/app/consts/index.js +2 -0
  24. package/esm2015/app/directives/block-editor-margin.directive.js +13 -15
  25. package/esm2015/app/directives/block-editor-sidebar-panel.directive.js +16 -22
  26. package/esm2015/app/enums/block-type.enum.js +13 -0
  27. package/esm2015/app/enums/index.js +2 -0
  28. package/esm2015/app/fs-block-editor.module.js +68 -27
  29. package/esm2015/app/interfaces/block-editor-config.js +2 -1
  30. package/esm2015/app/interfaces/block.js +2 -1
  31. package/esm2015/app/services/block-editor.service.js +140 -33
  32. package/esm2015/app/services/index.js +2 -0
  33. package/esm2015/firestitch-block-editor.js +1 -4
  34. package/esm2015/public_api.js +3 -4
  35. package/fesm2015/firestitch-block-editor.js +665 -626
  36. package/fesm2015/firestitch-block-editor.js.map +1 -1
  37. package/firestitch-block-editor.d.ts +1 -3
  38. package/package.json +6 -12
  39. package/public_api.d.ts +2 -0
  40. package/bundles/firestitch-block-editor.umd.min.js +0 -2
  41. package/bundles/firestitch-block-editor.umd.min.js.map +0 -1
  42. package/esm5/app/components/block/block.component.js +0 -498
  43. package/esm5/app/components/block-editor/block-editor.component.js +0 -163
  44. package/esm5/app/components/sidebar/sidebar.component.js +0 -329
  45. package/esm5/app/directives/block-editor-margin.directive.js +0 -26
  46. package/esm5/app/directives/block-editor-sidebar-panel.directive.js +0 -28
  47. package/esm5/app/fs-block-editor.module.js +0 -57
  48. package/esm5/app/interfaces/block-editor-config.js +0 -1
  49. package/esm5/app/interfaces/block.js +0 -1
  50. package/esm5/app/services/block-editor.service.js +0 -124
  51. package/esm5/firestitch-block-editor.js +0 -8
  52. package/esm5/public_api.js +0 -8
  53. package/fesm5/firestitch-block-editor.js +0 -1198
  54. package/fesm5/firestitch-block-editor.js.map +0 -1
  55. package/firestitch-block-editor.metadata.json +0 -1
@@ -1,55 +1,104 @@
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('@firestitch/html-editor'), require('@firestitch/colorpicker'), require('@firestitch/file'), require('rxjs/operators'), require('moveable'), require('rxjs'), require('@firestitch/common')) :
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', '@firestitch/html-editor', '@firestitch/colorpicker', '@firestitch/file', 'rxjs/operators', 'moveable', 'rxjs', '@firestitch/common'], factory) :
4
- (global = 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.htmlEditor, global.colorpicker, global.file, global.rxjs.operators, global.Moveable, global.rxjs, global.common$1));
5
- }(this, (function (exports, forms, input, core, common, button, formField, icon, htmlEditor, colorpicker, file, operators, Moveable, rxjs, common$1) { 'use strict';
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('@firestitch/colorpicker'), require('@firestitch/file'), require('@firestitch/menu'), require('@firestitch/zoom-pan'), require('rxjs/operators'), require('moveable'), require('rxjs'), require('@firestitch/common'), require('@firestitch/prompt'), require('@angular/material/checkbox'), require('@angular/material/tooltip')) :
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', '@firestitch/colorpicker', '@firestitch/file', '@firestitch/menu', '@firestitch/zoom-pan', 'rxjs/operators', 'moveable', 'rxjs', '@firestitch/common', '@firestitch/prompt', '@angular/material/checkbox', '@angular/material/tooltip'], 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.i8, global.i3, global.menu, global.i2$1, global.rxjs.operators, global.Moveable, global.rxjs, global.common, global.i2, global.ng.material.checkbox, global.ng.material.tooltip));
5
+ })(this, (function (exports, i12, i11, i0, i9, i4, i6, i5, i8, i3, menu, i2$1, operators, Moveable, rxjs, common, i2, i7, i10) { 'use strict';
6
6
 
7
- Moveable = Moveable && Object.prototype.hasOwnProperty.call(Moveable, 'default') ? Moveable['default'] : Moveable;
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
28
+ var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
29
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
+ var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
31
+ var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
32
+ var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
33
+ var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
34
+ var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
35
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
36
+ var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
37
+ var Moveable__default = /*#__PURE__*/_interopDefaultLegacy(Moveable);
38
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
39
+ var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
40
+ var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
41
+
42
+ exports.BlockType = void 0;
43
+ (function (BlockType) {
44
+ BlockType["Rectangle"] = "rectangle";
45
+ BlockType["ShortText"] = "shorttext";
46
+ BlockType["LongText"] = "longtext";
47
+ BlockType["Image"] = "image";
48
+ BlockType["RadioButton"] = "radiobutton";
49
+ BlockType["Checkbox"] = "checkbox";
50
+ BlockType["Signature"] = "signature";
51
+ BlockType["Pdf"] = "pdf";
52
+ BlockType["Date"] = "date";
53
+ })(exports.BlockType || (exports.BlockType = {}));
8
54
 
9
55
  /*! *****************************************************************************
10
- Copyright (c) Microsoft Corporation. All rights reserved.
11
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
12
- this file except in compliance with the License. You may obtain a copy of the
13
- License at http://www.apache.org/licenses/LICENSE-2.0
56
+ Copyright (c) Microsoft Corporation.
14
57
 
15
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
17
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
18
- MERCHANTABLITY OR NON-INFRINGEMENT.
58
+ Permission to use, copy, modify, and/or distribute this software for any
59
+ purpose with or without fee is hereby granted.
19
60
 
20
- See the Apache Version 2.0 License for specific language governing permissions
21
- and limitations under the License.
61
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
62
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
63
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
64
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
65
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
66
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
67
+ PERFORMANCE OF THIS SOFTWARE.
22
68
  ***************************************************************************** */
23
69
  /* global Reflect, Promise */
24
-
25
- var extendStatics = function(d, b) {
70
+ var extendStatics = function (d, b) {
26
71
  extendStatics = Object.setPrototypeOf ||
27
72
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
73
+ function (d, b) { for (var p in b)
74
+ if (Object.prototype.hasOwnProperty.call(b, p))
75
+ d[p] = b[p]; };
29
76
  return extendStatics(d, b);
30
77
  };
31
-
32
78
  function __extends(d, b) {
79
+ if (typeof b !== "function" && b !== null)
80
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33
81
  extendStatics(d, b);
34
82
  function __() { this.constructor = d; }
35
83
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
84
  }
37
-
38
- var __assign = function() {
85
+ var __assign = function () {
39
86
  __assign = Object.assign || function __assign(t) {
40
87
  for (var s, i = 1, n = arguments.length; i < n; i++) {
41
88
  s = arguments[i];
42
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
89
+ for (var p in s)
90
+ if (Object.prototype.hasOwnProperty.call(s, p))
91
+ t[p] = s[p];
43
92
  }
44
93
  return t;
45
94
  };
46
95
  return __assign.apply(this, arguments);
47
96
  };
48
-
49
97
  function __rest(s, e) {
50
98
  var t = {};
51
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
52
- t[p] = s[p];
99
+ for (var p in s)
100
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
101
+ t[p] = s[p];
53
102
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
54
103
  for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
55
104
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
@@ -57,246 +106,462 @@
57
106
  }
58
107
  return t;
59
108
  }
60
-
61
109
  function __decorate(decorators, target, key, desc) {
62
110
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
63
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
64
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
111
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
112
+ r = Reflect.decorate(decorators, target, key, desc);
113
+ else
114
+ for (var i = decorators.length - 1; i >= 0; i--)
115
+ if (d = decorators[i])
116
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
65
117
  return c > 3 && r && Object.defineProperty(target, key, r), r;
66
118
  }
67
-
68
119
  function __param(paramIndex, decorator) {
69
- return function (target, key) { decorator(target, key, paramIndex); }
120
+ return function (target, key) { decorator(target, key, paramIndex); };
70
121
  }
71
-
72
122
  function __metadata(metadataKey, metadataValue) {
73
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
123
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
124
+ return Reflect.metadata(metadataKey, metadataValue);
74
125
  }
75
-
76
126
  function __awaiter(thisArg, _arguments, P, generator) {
77
127
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
78
128
  return new (P || (P = Promise))(function (resolve, reject) {
79
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
80
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
129
+ function fulfilled(value) { try {
130
+ step(generator.next(value));
131
+ }
132
+ catch (e) {
133
+ reject(e);
134
+ } }
135
+ function rejected(value) { try {
136
+ step(generator["throw"](value));
137
+ }
138
+ catch (e) {
139
+ reject(e);
140
+ } }
81
141
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
82
142
  step((generator = generator.apply(thisArg, _arguments || [])).next());
83
143
  });
84
144
  }
85
-
86
145
  function __generator(thisArg, body) {
87
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
88
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
146
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
147
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
148
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
89
149
  function verb(n) { return function (v) { return step([n, v]); }; }
90
150
  function step(op) {
91
- if (f) throw new TypeError("Generator is already executing.");
92
- while (_) try {
93
- 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) return t;
94
- if (y = 0, t) op = [op[0] & 2, t.value];
95
- switch (op[0]) {
96
- case 0: case 1: t = op; break;
97
- case 4: _.label++; return { value: op[1], done: false };
98
- case 5: _.label++; y = op[1]; op = [0]; continue;
99
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
100
- default:
101
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
102
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
103
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
104
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
105
- if (t[2]) _.ops.pop();
106
- _.trys.pop(); continue;
151
+ if (f)
152
+ throw new TypeError("Generator is already executing.");
153
+ while (_)
154
+ try {
155
+ 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)
156
+ return t;
157
+ if (y = 0, t)
158
+ op = [op[0] & 2, t.value];
159
+ switch (op[0]) {
160
+ case 0:
161
+ case 1:
162
+ t = op;
163
+ break;
164
+ case 4:
165
+ _.label++;
166
+ return { value: op[1], done: false };
167
+ case 5:
168
+ _.label++;
169
+ y = op[1];
170
+ op = [0];
171
+ continue;
172
+ case 7:
173
+ op = _.ops.pop();
174
+ _.trys.pop();
175
+ continue;
176
+ default:
177
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
178
+ _ = 0;
179
+ continue;
180
+ }
181
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
182
+ _.label = op[1];
183
+ break;
184
+ }
185
+ if (op[0] === 6 && _.label < t[1]) {
186
+ _.label = t[1];
187
+ t = op;
188
+ break;
189
+ }
190
+ if (t && _.label < t[2]) {
191
+ _.label = t[2];
192
+ _.ops.push(op);
193
+ break;
194
+ }
195
+ if (t[2])
196
+ _.ops.pop();
197
+ _.trys.pop();
198
+ continue;
199
+ }
200
+ op = body.call(thisArg, _);
201
+ }
202
+ catch (e) {
203
+ op = [6, e];
204
+ y = 0;
107
205
  }
108
- op = body.call(thisArg, _);
109
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
110
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
206
+ finally {
207
+ f = t = 0;
208
+ }
209
+ if (op[0] & 5)
210
+ throw op[1];
211
+ return { value: op[0] ? op[1] : void 0, done: true };
111
212
  }
112
213
  }
113
-
114
- function __exportStar(m, exports) {
115
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
214
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
215
+ if (k2 === undefined)
216
+ k2 = k;
217
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
218
+ }) : (function (o, m, k, k2) {
219
+ if (k2 === undefined)
220
+ k2 = k;
221
+ o[k2] = m[k];
222
+ });
223
+ function __exportStar(m, o) {
224
+ for (var p in m)
225
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
226
+ __createBinding(o, m, p);
116
227
  }
117
-
118
228
  function __values(o) {
119
229
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
120
- if (m) return m.call(o);
121
- if (o && typeof o.length === "number") return {
122
- next: function () {
123
- if (o && i >= o.length) o = void 0;
124
- return { value: o && o[i++], done: !o };
125
- }
126
- };
230
+ if (m)
231
+ return m.call(o);
232
+ if (o && typeof o.length === "number")
233
+ return {
234
+ next: function () {
235
+ if (o && i >= o.length)
236
+ o = void 0;
237
+ return { value: o && o[i++], done: !o };
238
+ }
239
+ };
127
240
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
128
241
  }
129
-
130
242
  function __read(o, n) {
131
243
  var m = typeof Symbol === "function" && o[Symbol.iterator];
132
- if (!m) return o;
244
+ if (!m)
245
+ return o;
133
246
  var i = m.call(o), r, ar = [], e;
134
247
  try {
135
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
248
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
249
+ ar.push(r.value);
250
+ }
251
+ catch (error) {
252
+ e = { error: error };
136
253
  }
137
- catch (error) { e = { error: error }; }
138
254
  finally {
139
255
  try {
140
- if (r && !r.done && (m = i["return"])) m.call(i);
256
+ if (r && !r.done && (m = i["return"]))
257
+ m.call(i);
258
+ }
259
+ finally {
260
+ if (e)
261
+ throw e.error;
141
262
  }
142
- finally { if (e) throw e.error; }
143
263
  }
144
264
  return ar;
145
265
  }
146
-
266
+ /** @deprecated */
147
267
  function __spread() {
148
268
  for (var ar = [], i = 0; i < arguments.length; i++)
149
269
  ar = ar.concat(__read(arguments[i]));
150
270
  return ar;
151
271
  }
152
-
272
+ /** @deprecated */
153
273
  function __spreadArrays() {
154
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
274
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
275
+ s += arguments[i].length;
155
276
  for (var r = Array(s), k = 0, i = 0; i < il; i++)
156
277
  for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
157
278
  r[k] = a[j];
158
279
  return r;
159
- };
160
-
280
+ }
281
+ function __spreadArray(to, from, pack) {
282
+ if (pack || arguments.length === 2)
283
+ for (var i = 0, l = from.length, ar; i < l; i++) {
284
+ if (ar || !(i in from)) {
285
+ if (!ar)
286
+ ar = Array.prototype.slice.call(from, 0, i);
287
+ ar[i] = from[i];
288
+ }
289
+ }
290
+ return to.concat(ar || Array.prototype.slice.call(from));
291
+ }
161
292
  function __await(v) {
162
293
  return this instanceof __await ? (this.v = v, this) : new __await(v);
163
294
  }
164
-
165
295
  function __asyncGenerator(thisArg, _arguments, generator) {
166
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
296
+ if (!Symbol.asyncIterator)
297
+ throw new TypeError("Symbol.asyncIterator is not defined.");
167
298
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
168
299
  return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
169
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
170
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
300
+ function verb(n) { if (g[n])
301
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
302
+ function resume(n, v) { try {
303
+ step(g[n](v));
304
+ }
305
+ catch (e) {
306
+ settle(q[0][3], e);
307
+ } }
171
308
  function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
172
309
  function fulfill(value) { resume("next", value); }
173
310
  function reject(value) { resume("throw", value); }
174
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
311
+ function settle(f, v) { if (f(v), q.shift(), q.length)
312
+ resume(q[0][0], q[0][1]); }
175
313
  }
176
-
177
314
  function __asyncDelegator(o) {
178
315
  var i, p;
179
316
  return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
180
317
  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; }
181
318
  }
182
-
183
319
  function __asyncValues(o) {
184
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
320
+ if (!Symbol.asyncIterator)
321
+ throw new TypeError("Symbol.asyncIterator is not defined.");
185
322
  var m = o[Symbol.asyncIterator], i;
186
323
  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);
187
324
  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); }); }; }
188
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
325
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
189
326
  }
190
-
191
327
  function __makeTemplateObject(cooked, raw) {
192
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
328
+ if (Object.defineProperty) {
329
+ Object.defineProperty(cooked, "raw", { value: raw });
330
+ }
331
+ else {
332
+ cooked.raw = raw;
333
+ }
193
334
  return cooked;
335
+ }
336
+ ;
337
+ var __setModuleDefault = Object.create ? (function (o, v) {
338
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
339
+ }) : function (o, v) {
340
+ o["default"] = v;
194
341
  };
195
-
196
342
  function __importStar(mod) {
197
- if (mod && mod.__esModule) return mod;
343
+ if (mod && mod.__esModule)
344
+ return mod;
198
345
  var result = {};
199
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
200
- result.default = mod;
346
+ if (mod != null)
347
+ for (var k in mod)
348
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
349
+ __createBinding(result, mod, k);
350
+ __setModuleDefault(result, mod);
201
351
  return result;
202
352
  }
203
-
204
353
  function __importDefault(mod) {
205
354
  return (mod && mod.__esModule) ? mod : { default: mod };
206
355
  }
207
-
208
- function __classPrivateFieldGet(receiver, privateMap) {
209
- if (!privateMap.has(receiver)) {
210
- throw new TypeError("attempted to get private field on non-instance");
211
- }
212
- return privateMap.get(receiver);
356
+ function __classPrivateFieldGet(receiver, state, kind, f) {
357
+ if (kind === "a" && !f)
358
+ throw new TypeError("Private accessor was defined without a getter");
359
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
360
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
361
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
213
362
  }
214
-
215
- function __classPrivateFieldSet(receiver, privateMap, value) {
216
- if (!privateMap.has(receiver)) {
217
- throw new TypeError("attempted to set private field on non-instance");
218
- }
219
- privateMap.set(receiver, value);
220
- return value;
363
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
364
+ if (kind === "m")
365
+ throw new TypeError("Private method is not writable");
366
+ if (kind === "a" && !f)
367
+ throw new TypeError("Private accessor was defined without a setter");
368
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
369
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
370
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
221
371
  }
222
372
 
223
373
  var BlockEditorService = /** @class */ (function () {
224
374
  function BlockEditorService() {
225
- this.blockComponents = [];
375
+ this._blockChanged$ = new rxjs.Subject();
376
+ this._blockRemoved$ = new rxjs.Subject();
377
+ this._blockAdded$ = new rxjs.Subject();
226
378
  this._blocks$ = new rxjs.BehaviorSubject([]);
227
- this._selectedBlockComponents$ = new rxjs.BehaviorSubject([]);
379
+ this._selectedBlocks$ = new rxjs.BehaviorSubject([]);
380
+ this._blockComponents = new Map();
381
+ this._destroy$ = new rxjs.Subject();
228
382
  }
229
383
  Object.defineProperty(BlockEditorService.prototype, "elementGuidelines", {
230
384
  get: function () {
231
- return __spread(this.blockComponents.map(function (block) {
385
+ return __spreadArray(__spreadArray([], __read(Array.from(this._blockComponents.values())
386
+ .map(function (block) {
232
387
  return block.el;
233
- }), [
388
+ }))), [
234
389
  this.container,
235
390
  this.margin,
236
391
  ]);
237
392
  },
238
- enumerable: true,
393
+ enumerable: false,
394
+ configurable: true
395
+ });
396
+ Object.defineProperty(BlockEditorService.prototype, "blockComponents", {
397
+ get: function () {
398
+ return Array.from(this._blockComponents.values());
399
+ },
400
+ enumerable: false,
239
401
  configurable: true
240
402
  });
241
- BlockEditorService.prototype.addBlock = function (block) {
242
- this.blocks$.next(__spread(this.blocks, [this.sanitizeBlock(block)]));
403
+ Object.defineProperty(BlockEditorService.prototype, "selectedComponentBlocks", {
404
+ get: function () {
405
+ var _this = this;
406
+ return this.blockComponents
407
+ .filter(function (blockComponent) { return _this.selectedBlocks.indexOf(blockComponent.block) !== -1; });
408
+ },
409
+ enumerable: false,
410
+ configurable: true
411
+ });
412
+ BlockEditorService.prototype.blockUpload = function (block, fsFile) {
413
+ var _this = this;
414
+ if (this.config.blockUpload) {
415
+ this.config.blockUpload(block, fsFile.file)
416
+ .pipe(operators.takeUntil(this._destroy$))
417
+ .subscribe(function (block) {
418
+ _this.blocks = __spreadArray(__spreadArray([], __read(_this.blocks)), [
419
+ block,
420
+ ]);
421
+ _this._blockAdded$.next(block);
422
+ if (_this.config.blockAdded) {
423
+ _this.config.blockAdded(block);
424
+ }
425
+ //this._updateIndexes();
426
+ });
427
+ }
428
+ };
429
+ BlockEditorService.prototype.blockAdd = function (block) {
430
+ var _this = this;
431
+ if (this.config.blockAdd) {
432
+ this.config.blockAdd(block)
433
+ .pipe(operators.takeUntil(this._destroy$))
434
+ .subscribe(function (block) {
435
+ _this.blocks = __spreadArray(__spreadArray([], __read(_this.blocks)), [
436
+ block,
437
+ ]);
438
+ _this._blockAdded$.next(block);
439
+ if (_this.config.blockAdded) {
440
+ _this.config.blockAdded(block);
441
+ }
442
+ //this._updateIndexes();
443
+ });
444
+ }
243
445
  };
446
+ // private _updateIndexes(): void {
447
+ // const sort = this.blocks.slice().sort((a, b) => {
448
+ // return a.index > b.index ? 1 : -1;
449
+ // })
450
+ // sort.forEach((block, index) => {
451
+ // this.blocks.find((item) => {
452
+ // return block.reference === item.reference;
453
+ // }).index = index;
454
+ // });
455
+ // }
244
456
  BlockEditorService.prototype.removeBlock = function (block) {
245
457
  var index = this.indexOf(block);
246
458
  if (index !== -1) {
247
- this.blocks.splice(index, 1);
248
- this.blocks$.next(this.blocks);
459
+ var blocks = this.blocks;
460
+ blocks.splice(index, 1);
461
+ this.blocks = blocks;
462
+ this._blockRemoved$.next(block);
249
463
  }
250
464
  };
465
+ BlockEditorService.prototype.removeSelectedBlocks = function () {
466
+ var _this = this;
467
+ this.selectedBlocks.forEach(function (block) {
468
+ _this.removeBlock(block);
469
+ });
470
+ this.selectedBlocks = [];
471
+ };
251
472
  Object.defineProperty(BlockEditorService.prototype, "blocks$", {
252
473
  get: function () {
253
474
  return this._blocks$;
254
475
  },
255
- enumerable: true,
476
+ enumerable: false,
477
+ configurable: true
478
+ });
479
+ Object.defineProperty(BlockEditorService.prototype, "blockChanged$", {
480
+ get: function () {
481
+ return this._blockChanged$;
482
+ },
483
+ enumerable: false,
484
+ configurable: true
485
+ });
486
+ Object.defineProperty(BlockEditorService.prototype, "blockRemoved$", {
487
+ get: function () {
488
+ return this._blockRemoved$;
489
+ },
490
+ enumerable: false,
256
491
  configurable: true
257
492
  });
493
+ Object.defineProperty(BlockEditorService.prototype, "blockAdded$", {
494
+ get: function () {
495
+ return this._blockAdded$;
496
+ },
497
+ enumerable: false,
498
+ configurable: true
499
+ });
500
+ BlockEditorService.prototype.blockChange = function (block) {
501
+ this._blockChanged$.next(block);
502
+ if (this.config.blockChanged) {
503
+ this.config.blockChanged(block);
504
+ }
505
+ };
258
506
  Object.defineProperty(BlockEditorService.prototype, "blocks", {
259
507
  get: function () {
260
- return this.blocks$.getValue();
508
+ return this._blocks$.getValue();
261
509
  },
262
510
  set: function (blocks) {
263
511
  this._blocks$.next(blocks);
264
512
  },
265
- enumerable: true,
513
+ enumerable: false,
266
514
  configurable: true
267
515
  });
268
516
  BlockEditorService.prototype.isSelectedBlock = function (block) {
269
- return this.selectedBlockComponents.indexOf(block) !== -1;
517
+ return this.selectedBlocks.indexOf(block) !== -1;
270
518
  };
271
519
  BlockEditorService.prototype.indexOf = function (block) {
272
520
  return this.blocks.map(function (e) { return e.reference; }).indexOf(block.reference);
273
521
  };
274
- Object.defineProperty(BlockEditorService.prototype, "selectedBlockComponents", {
522
+ BlockEditorService.prototype.selectedBlockComponentChangeProperty = function (value, name) {
523
+ var _this = this;
524
+ this.selectedBlocks
525
+ .forEach(function (block) {
526
+ block[name] = value;
527
+ _this.blockChange(block);
528
+ });
529
+ };
530
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlocks$", {
275
531
  get: function () {
276
- return this._selectedBlockComponents$.getValue();
277
- },
278
- set: function (blocks) {
279
- this.blockComponents.forEach(function (block) {
280
- block.editable = false;
281
- block.transformable = blocks.indexOf(block) !== -1;
282
- });
283
- this._selectedBlockComponents$.next(blocks);
532
+ return this._selectedBlocks$;
284
533
  },
285
- enumerable: true,
534
+ enumerable: false,
286
535
  configurable: true
287
536
  });
288
- Object.defineProperty(BlockEditorService.prototype, "selectedBlocks", {
289
- get: function () {
290
- return this.selectedBlockComponents.map(function (blockComponent) { return blockComponent.block; });
537
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlock", {
538
+ set: function (block) {
539
+ this.selectedBlocks = [block];
291
540
  },
292
- enumerable: true,
541
+ enumerable: false,
293
542
  configurable: true
294
543
  });
295
- Object.defineProperty(BlockEditorService.prototype, "selectedBlockComponents$", {
544
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlocks", {
296
545
  get: function () {
297
- return this._selectedBlockComponents$;
546
+ return this._selectedBlocks$.getValue();
298
547
  },
299
- enumerable: true,
548
+ set: function (blocks) {
549
+ this.blockComponents
550
+ .forEach(function (blockComponent) {
551
+ blockComponent.editable = false;
552
+ if (blocks.indexOf(blockComponent.block) !== -1) {
553
+ blockComponent.transformable = true;
554
+ }
555
+ else {
556
+ blockComponent.deselect();
557
+ }
558
+ });
559
+ this._selectedBlocks$.next(blocks);
560
+ if (this.config.blocksSelected) {
561
+ this.config.blocksSelected(blocks);
562
+ }
563
+ },
564
+ enumerable: false,
300
565
  configurable: true
301
566
  });
302
567
  BlockEditorService.prototype.saveSelection = function () {
@@ -313,8 +578,9 @@
313
578
  BlockEditorService.prototype.hasSelectionRange = function () {
314
579
  return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
315
580
  };
316
- BlockEditorService.prototype.registerBlock = function (block) {
581
+ BlockEditorService.prototype.registerBlock = function (block, blockComponent) {
317
582
  var _this = this;
583
+ this._blockComponents.set(block, blockComponent);
318
584
  this.blockComponents.push(block);
319
585
  this.blockComponents.forEach(function (item) {
320
586
  var blocks = _this.elementGuidelines
@@ -324,45 +590,57 @@
324
590
  item.elementGuidelines = blocks;
325
591
  });
326
592
  };
593
+ BlockEditorService.prototype.unregisterBlock = function (block) {
594
+ this._blockComponents.delete(block);
595
+ };
327
596
  BlockEditorService.prototype.registerContainer = function (container) {
328
597
  this.container = container;
329
598
  };
330
599
  BlockEditorService.prototype.registerMargin = function (margin) {
331
600
  this.margin = margin;
332
601
  };
602
+ BlockEditorService.prototype.sanitizeNewBlock = function (block) {
603
+ var width = (this.config.width * .333).toFixed(2);
604
+ var height = (this.config.height * .333).toFixed(2);
605
+ return this.sanitizeBlock(Object.assign({ top: height, left: width, width: height, height: width }, block));
606
+ };
333
607
  BlockEditorService.prototype.sanitizeBlock = function (block) {
334
- return __assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block);
608
+ return Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || common.guid() });
609
+ };
610
+ BlockEditorService.prototype.ngOnDestroy = function () {
611
+ this._destroy$.next();
612
+ this._destroy$.complete();
335
613
  };
336
- BlockEditorService = __decorate([
337
- core.Injectable(),
338
- __metadata("design:paramtypes", [])
339
- ], BlockEditorService);
340
614
  return BlockEditorService;
341
- }());
615
+ }());
616
+ BlockEditorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
617
+ BlockEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService });
618
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, decorators: [{
619
+ type: i0.Injectable
620
+ }] });
342
621
 
343
622
  var FsBlockComponent = /** @class */ (function () {
344
- function FsBlockComponent(_service, _elementRef, _cdRef) {
345
- this._service = _service;
623
+ function FsBlockComponent(_blockEditor, _elementRef, _cdRef) {
624
+ this._blockEditor = _blockEditor;
346
625
  this._elementRef = _elementRef;
347
626
  this._cdRef = _cdRef;
348
- this.changed = new core.EventEmitter();
349
- this.htmlConfig = {};
627
+ this.BlockType = exports.BlockType;
350
628
  this._editable = false;
351
- this._selectedElements = [];
629
+ this._transformable = false;
352
630
  this._destroy$ = new rxjs.Subject();
353
631
  }
354
632
  Object.defineProperty(FsBlockComponent.prototype, "el", {
355
633
  get: function () {
356
634
  return this.element.nativeElement;
357
635
  },
358
- enumerable: true,
636
+ enumerable: false,
359
637
  configurable: true
360
638
  });
361
639
  Object.defineProperty(FsBlockComponent.prototype, "moveable", {
362
640
  get: function () {
363
641
  return this._moveable;
364
642
  },
365
- enumerable: true,
643
+ enumerable: false,
366
644
  configurable: true
367
645
  });
368
646
  Object.defineProperty(FsBlockComponent.prototype, "editable", {
@@ -375,21 +653,21 @@
375
653
  this.deselectContent();
376
654
  }
377
655
  },
378
- enumerable: true,
656
+ enumerable: false,
379
657
  configurable: true
380
658
  });
381
659
  Object.defineProperty(FsBlockComponent.prototype, "elementGuidelines", {
382
660
  set: function (value) {
383
- this._moveable.elementGuidelines = value;
661
+ this.moveable.elementGuidelines = value;
384
662
  },
385
- enumerable: true,
663
+ enumerable: false,
386
664
  configurable: true
387
665
  });
388
666
  Object.defineProperty(FsBlockComponent.prototype, "clippable", {
389
667
  set: function (value) {
390
- this._moveable.clippable = value;
668
+ this.moveable.clippable = value;
391
669
  },
392
- enumerable: true,
670
+ enumerable: false,
393
671
  configurable: true
394
672
  });
395
673
  Object.defineProperty(FsBlockComponent.prototype, "transformable", {
@@ -400,292 +678,166 @@
400
678
  this._transformable = value;
401
679
  this.moveable.draggable = value;
402
680
  this.moveable.resizable = value;
403
- this.moveable.draggable = value;
404
681
  this.moveable.roundable = value;
405
682
  this.moveable.rotatable = value;
406
683
  },
407
- enumerable: true,
408
- configurable: true
409
- });
410
- Object.defineProperty(FsBlockComponent.prototype, "lineHeight", {
411
- set: function (value) {
412
- this.block.lineHeight = value;
413
- this._triggerChanged();
414
- },
415
- enumerable: true,
416
- configurable: true
417
- });
418
- Object.defineProperty(FsBlockComponent.prototype, "borderWidth", {
419
- set: function (value) {
420
- this.block.borderWidth = value;
421
- this._triggerChanged();
422
- },
423
- enumerable: true,
424
- configurable: true
425
- });
426
- Object.defineProperty(FsBlockComponent.prototype, "fontSize", {
427
- set: function (value) {
428
- this.block.fontSize = value;
429
- this._triggerChanged();
430
- },
431
- enumerable: true,
432
- configurable: true
433
- });
434
- Object.defineProperty(FsBlockComponent.prototype, "backgroundColor", {
435
- set: function (value) {
436
- this.block.backgroundColor = value;
437
- this._triggerChanged();
438
- },
439
- enumerable: true,
684
+ enumerable: false,
440
685
  configurable: true
441
686
  });
442
687
  Object.defineProperty(FsBlockComponent.prototype, "width", {
443
688
  set: function (value) {
444
- this.block.width = parseFloat(value);
445
- this.element.nativeElement.style.width = "" + this.block.width + this.unit;
446
- this._moveable.updateRect();
447
- this._triggerChanged();
689
+ this.element.nativeElement.style.width = "" + parseFloat(value) + this.unit;
690
+ this.moveable.updateRect();
448
691
  },
449
- enumerable: true,
692
+ enumerable: false,
450
693
  configurable: true
451
694
  });
452
695
  Object.defineProperty(FsBlockComponent.prototype, "height", {
453
696
  set: function (value) {
454
- this.block.height = parseFloat(value);
455
- this.element.nativeElement.style.height = "" + this.block.height + this.unit;
456
- this._moveable.updateRect();
457
- this._triggerChanged();
697
+ this.element.nativeElement.style.height = "" + parseFloat(value) + this.unit;
698
+ this.moveable.updateRect();
458
699
  },
459
- enumerable: true,
700
+ enumerable: false,
460
701
  configurable: true
461
702
  });
462
703
  Object.defineProperty(FsBlockComponent.prototype, "top", {
463
704
  set: function (value) {
464
- this.block.top = parseFloat(value);
465
- this.element.nativeElement.style.top = "" + this.block.top + this.unit;
466
- this._moveable.updateRect();
467
- this._triggerChanged();
705
+ this.element.nativeElement.style.top = "" + parseFloat(value) + this.unit;
706
+ this.moveable.updateRect();
468
707
  },
469
- enumerable: true,
708
+ enumerable: false,
470
709
  configurable: true
471
710
  });
472
711
  Object.defineProperty(FsBlockComponent.prototype, "left", {
473
712
  set: function (value) {
474
- this.block.left = parseFloat(value);
475
- this.element.nativeElement.style.left = "" + this.block.left + this.unit;
476
- this._moveable.updateRect();
477
- this._triggerChanged();
713
+ this.element.nativeElement.style.left = "" + parseFloat(value) + this.unit;
714
+ this.moveable.updateRect();
478
715
  },
479
- enumerable: true,
716
+ enumerable: false,
480
717
  configurable: true
481
718
  });
482
719
  Object.defineProperty(FsBlockComponent.prototype, "rotate", {
483
720
  set: function (value) {
484
- this.block.rotate = parseFloat(value);
485
- this._moveable.request('rotatable', { rotate: this.block.rotate }, true);
486
- this._triggerChanged();
487
- },
488
- enumerable: true,
489
- configurable: true
490
- });
491
- Object.defineProperty(FsBlockComponent.prototype, "shapeRadius", {
492
- set: function (value) {
493
- this.block.shapeRadius = value;
494
- this._triggerChanged();
721
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
722
+ this.moveable.updateRect();
495
723
  },
496
- enumerable: true,
724
+ enumerable: false,
497
725
  configurable: true
498
726
  });
499
727
  Object.defineProperty(FsBlockComponent.prototype, "index", {
500
728
  set: function (value) {
501
729
  this.block.index = value;
502
730
  },
503
- enumerable: true,
504
- configurable: true
505
- });
506
- Object.defineProperty(FsBlockComponent.prototype, "borderColor", {
507
- set: function (value) {
508
- this.block.borderColor = value;
509
- this._triggerChanged();
510
- },
511
- enumerable: true,
731
+ enumerable: false,
512
732
  configurable: true
513
733
  });
514
- Object.defineProperty(FsBlockComponent.prototype, "paddingAll", {
734
+ Object.defineProperty(FsBlockComponent.prototype, "keepRatio", {
515
735
  set: function (value) {
516
- this.block.padding = value;
517
- this.block.paddingTop = null;
518
- this.block.paddingBottom = null;
519
- this.block.paddingLeft = null;
520
- this.block.paddingRight = null;
521
- this._triggerChanged();
736
+ this.moveable.keepRatio = value;
522
737
  },
523
- enumerable: true,
738
+ enumerable: false,
524
739
  configurable: true
525
740
  });
526
- FsBlockComponent.prototype.padding = function (name, value) {
527
- this.block[name] = value;
528
- this.block.padding = null;
529
- this._triggerChanged();
530
- };
531
- Object.defineProperty(FsBlockComponent.prototype, "imageUrl", {
532
- set: function (value) {
533
- this.block.imageUrl = value;
534
- this._triggerChanged();
535
- },
536
- enumerable: true,
537
- configurable: true
538
- });
539
- Object.defineProperty(FsBlockComponent.prototype, "fontColor", {
540
- set: function (value) {
541
- this.block.fontColor = value;
542
- this._triggerChanged();
543
- },
544
- enumerable: true,
545
- configurable: true
546
- });
547
- Object.defineProperty(FsBlockComponent.prototype, "verticalAlign", {
548
- set: function (value) {
549
- this.block.verticalAlign = value;
550
- this._triggerChanged();
551
- },
552
- enumerable: true,
553
- configurable: true
554
- });
555
- FsBlockComponent.prototype.shapeRound = function (name, value) {
556
- this.block[name] = value;
557
- this._triggerChanged();
558
- };
559
- Object.defineProperty(FsBlockComponent.prototype, "horizontalAlign", {
560
- set: function (value) {
561
- this.block.horizontalAlign = value;
562
- this._triggerChanged();
563
- },
564
- enumerable: true,
565
- configurable: true
566
- });
567
- Object.defineProperty(FsBlockComponent.prototype, "italic", {
568
- get: function () {
569
- return this.block.italic;
570
- },
571
- set: function (value) {
572
- this.block.italic = value;
573
- this._triggerChanged();
574
- },
575
- enumerable: true,
576
- configurable: true
577
- });
578
- Object.defineProperty(FsBlockComponent.prototype, "bold", {
579
- get: function () {
580
- return this.block.bold;
581
- },
582
- set: function (value) {
583
- this.block.bold = value;
584
- this._triggerChanged();
585
- },
586
- enumerable: true,
587
- configurable: true
588
- });
589
- Object.defineProperty(FsBlockComponent.prototype, "underline", {
590
- get: function () {
591
- return this.block.underline;
592
- },
593
- set: function (value) {
594
- this.block.underline = value;
595
- this._triggerChanged();
596
- },
597
- enumerable: true,
598
- configurable: true
599
- });
600
- FsBlockComponent.prototype.updateRect = function () {
601
- this.moveable.updateRect();
602
- };
603
741
  FsBlockComponent.prototype.markForCheck = function () {
604
742
  this._cdRef.markForCheck();
605
743
  };
606
744
  FsBlockComponent.prototype.ngOnInit = function () {
607
- this.block = this._service.sanitizeBlock(this.block);
608
- this.unit = this._service.config.unit;
745
+ var _this = this;
746
+ this.unit = this._blockEditor.config.unit;
609
747
  this.content = this.block.content;
610
- this.htmlConfig = {
611
- autofocus: false,
612
- froalaConfig: {}
613
- };
614
- };
615
- FsBlockComponent.prototype.saveSelectedElements = function () {
616
- this._selectedElements = this.htmlEditor.editor.selection.blocks();
617
- };
618
- FsBlockComponent.prototype.clearSelectedElements = function () {
619
- this._selectedElements = [];
748
+ this._blockEditor.blockChanged$
749
+ .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
750
+ .subscribe(function (block) {
751
+ _this.keepRatio = block.keepRatio;
752
+ _this.width = block.width;
753
+ _this.height = block.height;
754
+ _this.top = block.top;
755
+ _this.left = block.left;
756
+ _this._cdRef.markForCheck();
757
+ });
620
758
  };
621
759
  FsBlockComponent.prototype.ngAfterContentInit = function () {
622
760
  var _this = this;
623
- this.el.style.width = this.block.width + this.unit;
624
- this.el.style.height = this.block.height + this.unit;
625
- this.el.style.top = this.block.top + this.unit;
626
- this.el.style.left = this.block.left + this.unit;
627
- this._setTransform();
628
- rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
629
- .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
630
- _this.block.content = event.target.innerHTML;
631
- _this._triggerChanged();
632
- });
633
- rxjs.fromEvent(this.el, 'mousedown')
634
- .pipe(operators.takeUntil(this._destroy$), operators.filter(function () { return !_this.block.readonly; })).subscribe(function (event) {
635
- if (_this.editable) {
636
- if (_this.contentElement.nativeElement.isSameNode(event.target)) {
637
- event.preventDefault();
638
- event.stopImmediatePropagation();
639
- event.stopPropagation();
640
- }
641
- }
642
- else {
643
- _this._service.selectedBlockComponents = [_this];
644
- }
761
+ setTimeout(function () {
762
+ _this._initEvents();
763
+ _this._initMoveable();
764
+ _this._setTransform();
765
+ _this.width = _this.block.width;
766
+ _this.height = _this.block.height;
767
+ _this.top = _this.block.top;
768
+ _this.left = _this.block.left;
769
+ _this._blockEditor.registerBlock(_this.block, _this);
645
770
  });
646
- rxjs.fromEvent(this.el, 'dblclick')
647
- .pipe(operators.filter(function () { return (!_this.editable); }), operators.takeUntil(this._destroy$))
648
- .subscribe(function (event) {
649
- if (_this.block.readonly) {
650
- event.preventDefault();
771
+ };
772
+ FsBlockComponent.prototype.pxToIn = function (px) {
773
+ return this.round(px / 96, 2);
774
+ };
775
+ FsBlockComponent.prototype.round = function (value, decimals) {
776
+ return parseFloat(value.toFixed(decimals));
777
+ };
778
+ FsBlockComponent.prototype.deselect = function () {
779
+ this.transformable = false;
780
+ this.editable = false;
781
+ };
782
+ FsBlockComponent.prototype.deselectContent = function () {
783
+ if (window.getSelection) {
784
+ if (window.getSelection().empty) {
785
+ window.getSelection().empty();
651
786
  }
652
- else {
653
- _this.editable = true;
654
- _this._cdRef.markForCheck();
655
- setTimeout(function () {
656
- _this.selectAll();
657
- });
787
+ else if (window.getSelection().removeAllRanges) {
788
+ window.getSelection().removeAllRanges();
658
789
  }
659
- });
660
- this._moveable = new Moveable(this._elementRef.nativeElement, {
790
+ }
791
+ };
792
+ FsBlockComponent.prototype.selectAll = function () {
793
+ var range = document.createRange();
794
+ range.selectNodeContents(this.contentEditable.nativeElement);
795
+ var sel = window.getSelection();
796
+ sel.removeAllRanges();
797
+ sel.addRange(range);
798
+ };
799
+ FsBlockComponent.prototype.ngOnDestroy = function () {
800
+ this._blockEditor.unregisterBlock(this.block);
801
+ this._destroy$.next();
802
+ this._destroy$.complete();
803
+ };
804
+ FsBlockComponent.prototype._setTransform = function (transforms) {
805
+ if (transforms === void 0) { transforms = []; }
806
+ transforms = transforms !== null && transforms !== void 0 ? transforms : [];
807
+ if (this.block.rotate) {
808
+ transforms.push("rotate(" + this.block.rotate + "deg)");
809
+ }
810
+ this.el.style.transform = transforms.join(' ');
811
+ };
812
+ FsBlockComponent.prototype._triggerChanged = function () {
813
+ this._blockEditor.blockChange(this.block);
814
+ };
815
+ FsBlockComponent.prototype._initMoveable = function () {
816
+ var _this = this;
817
+ this._moveable = new Moveable__default["default"](this._elementRef.nativeElement, {
661
818
  target: this.el,
662
- container: this._service.container,
819
+ container: this._blockEditor.container,
663
820
  draggable: false,
664
821
  resizable: false,
665
822
  scalable: false,
666
823
  rotatable: false,
667
824
  warpable: false,
668
825
  origin: false,
669
- keepRatio: false,
826
+ keepRatio: this.block.keepRatio,
670
827
  snappable: true,
671
- snapHorizontal: true,
672
- snapVertical: true,
673
- snapCenter: true,
674
- snapElement: true,
675
828
  edge: false,
676
829
  throttleDrag: 1,
677
830
  throttleScale: 0.01,
678
831
  throttleRotate: 1,
679
832
  throttleResize: 1,
680
833
  });
681
- this._service.registerBlock(this);
682
- this._moveable
834
+ this.moveable
683
835
  .on('clip', function (e) {
684
836
  _this.block.clipPath = e.clipStyle;
685
837
  e.target.style.clipPath = e.clipStyle;
686
838
  _this._triggerChanged();
687
839
  });
688
- this._moveable.on('dragStart', function (_a) {
840
+ this.moveable.on('dragStart', function (_a) {
689
841
  var target = _a.target, clientX = _a.clientX, clientY = _a.clientY;
690
842
  _this.editable = false;
691
843
  }).on('drag', function (_a) {
@@ -696,9 +848,10 @@
696
848
  _this.block.left = _this.pxToIn(left);
697
849
  _this._triggerChanged();
698
850
  });
699
- this._moveable.on('resizeStart', function (_a) {
851
+ this.moveable.on('resizeStart', function (_a) {
700
852
  var target = _a.target, clientX = _a.clientX, clientY = _a.clientY;
701
853
  _this.editable = false;
854
+ _this.zoompan.disable();
702
855
  }).on('resize', function (_a) {
703
856
  var target = _a.target, width = _a.width, height = _a.height, dist = _a.dist, delta = _a.delta, direction = _a.direction;
704
857
  width = _this.pxToIn(width);
@@ -729,9 +882,11 @@
729
882
  target.style.left = _this.block.left + _this.unit;
730
883
  _this._setTransform();
731
884
  _this._triggerChanged();
885
+ _this.zoompan.enable();
732
886
  });
733
- this._moveable.on('rotateStart', function (_a) {
887
+ this.moveable.on('rotateStart', function (_a) {
734
888
  var target = _a.target, clientX = _a.clientX, clientY = _a.clientY;
889
+ _this.zoompan.disable();
735
890
  _this.editable = false;
736
891
  _this._rotateStart = _this.block.rotate || 0;
737
892
  }).on('rotate', function (_a) {
@@ -739,395 +894,279 @@
739
894
  _this.block.rotate = _this._rotateStart + rotate;
740
895
  _this.el.style.transform = transform;
741
896
  _this._triggerChanged();
897
+ _this.zoompan.enable();
742
898
  });
743
899
  };
744
- FsBlockComponent.prototype.pxToIn = function (px) {
745
- return this.round(px / 96, 2);
746
- };
747
- FsBlockComponent.prototype.round = function (value, decimals) {
748
- return parseFloat(value.toFixed(decimals));
749
- };
750
- FsBlockComponent.prototype.deselect = function () {
751
- this.transformable = false;
752
- this.editable = false;
753
- };
754
- FsBlockComponent.prototype.deselectContent = function () {
755
- if (window.getSelection) {
756
- if (window.getSelection().empty) {
757
- window.getSelection().empty();
900
+ FsBlockComponent.prototype._initEvents = function () {
901
+ var _this = this;
902
+ rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
903
+ .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
904
+ _this.block.content = event.target.innerHTML;
905
+ _this._triggerChanged();
906
+ });
907
+ rxjs.fromEvent(this.el, 'mousedown')
908
+ .pipe(operators.takeUntil(this._destroy$), operators.filter(function () { return !_this.block.readonly; })).subscribe(function (event) {
909
+ _this.zoompan.disable();
910
+ if (_this.editable) {
911
+ if (_this.contentElement.nativeElement.isSameNode(event.target)) {
912
+ event.preventDefault();
913
+ event.stopImmediatePropagation();
914
+ event.stopPropagation();
915
+ }
758
916
  }
759
- else if (window.getSelection().removeAllRanges) {
760
- window.getSelection().removeAllRanges();
917
+ else {
918
+ _this._blockEditor.selectedBlock = _this.block;
761
919
  }
762
- }
763
- };
764
- FsBlockComponent.prototype.selectAll = function () {
765
- var range = document.createRange();
766
- range.selectNodeContents(this.contentEditable.nativeElement);
767
- var sel = window.getSelection();
768
- sel.removeAllRanges();
769
- sel.addRange(range);
770
- };
771
- FsBlockComponent.prototype.ngOnDestroy = function () {
772
- this._destroy$.next();
773
- this._destroy$.complete();
774
- };
775
- FsBlockComponent.prototype._setTransform = function (transforms) {
776
- if (transforms === void 0) { transforms = []; }
777
- transforms = (transforms !== null && transforms !== void 0 ? transforms : []);
778
- if (this.block.rotate) {
779
- transforms.push("rotate(" + this.block.rotate + "deg)");
780
- }
781
- this.el.style.transform = transforms.join(' ');
920
+ });
921
+ rxjs.fromEvent(this.el, 'mouseup')
922
+ .pipe(operators.takeUntil(this._destroy$), operators.filter(function () { return !_this.block.readonly; })).subscribe(function () {
923
+ _this.zoompan.enable();
924
+ });
925
+ rxjs.fromEvent(this.el, 'dblclick')
926
+ .pipe(operators.filter(function () { return (!_this.editable); }), operators.takeUntil(this._destroy$))
927
+ .subscribe(function (event) {
928
+ if (_this.block.readonly) {
929
+ event.preventDefault();
930
+ }
931
+ else {
932
+ _this.editable = true;
933
+ _this._cdRef.markForCheck();
934
+ setTimeout(function () {
935
+ _this.selectAll();
936
+ });
937
+ }
938
+ });
782
939
  };
783
- FsBlockComponent.prototype._triggerChanged = function () {
784
- this.changed.emit(this.block);
785
- };
786
- FsBlockComponent.ctorParameters = function () { return [
787
- { type: BlockEditorService },
788
- { type: core.ElementRef },
789
- { type: core.ChangeDetectorRef }
790
- ]; };
791
- __decorate([
792
- core.ViewChild('element', { static: true }),
793
- __metadata("design:type", core.ElementRef)
794
- ], FsBlockComponent.prototype, "element", void 0);
795
- __decorate([
796
- core.ViewChild('contentElement', { static: true }),
797
- __metadata("design:type", core.ElementRef)
798
- ], FsBlockComponent.prototype, "contentElement", void 0);
799
- __decorate([
800
- core.ViewChild('contentEditable', { static: true }),
801
- __metadata("design:type", core.ElementRef)
802
- ], FsBlockComponent.prototype, "contentEditable", void 0);
803
- __decorate([
804
- core.ViewChild(htmlEditor.FsHtmlEditorComponent),
805
- __metadata("design:type", htmlEditor.FsHtmlEditorComponent)
806
- ], FsBlockComponent.prototype, "htmlEditor", void 0);
807
- __decorate([
808
- core.Input(),
809
- __metadata("design:type", Object)
810
- ], FsBlockComponent.prototype, "block", void 0);
811
- __decorate([
812
- core.Input(),
813
- __metadata("design:type", String)
814
- ], FsBlockComponent.prototype, "html", void 0);
815
- __decorate([
816
- core.Output(),
817
- __metadata("design:type", Object)
818
- ], FsBlockComponent.prototype, "changed", void 0);
819
- FsBlockComponent = __decorate([
820
- core.Component({
821
- selector: 'fs-block',
822
- template: "<div\n #element\n class=\"block\"\n [ngClass]=\"{ editable: editable, readonly: block.readonly }\">\n <div\n #contentElement\n class=\"content\"\n [style.zIndex]=\"block.index\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + unit : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + unit : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + unit : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + unit : ''\"\n [style.padding]=\"block.padding ? block.padding + unit : ''\"\n [style.clipPath]=\"block.clipPath\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + unit : ''\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <img [src]=\"block.imageUrl\" *ngIf=\"block.imageUrl\">\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n",
823
- changeDetection: core.ChangeDetectionStrategy.OnPush,
824
- styles: [".block{position:absolute;display:block;outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.block .content-editable{outline:0;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:1px dashed #c5c5c5;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:0 0!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:0 0!important}"]
825
- }),
826
- __metadata("design:paramtypes", [BlockEditorService,
827
- core.ElementRef,
828
- core.ChangeDetectorRef])
829
- ], FsBlockComponent);
830
940
  return FsBlockComponent;
831
- }());
941
+ }());
942
+ 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 }], target: i0__namespace.ɵɵFactoryTarget.Component });
943
+ 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" }, 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 [ngClass]=\"{ editable: editable, readonly: block.readonly }\">\n <div\n #contentElement\n class=\"content\"\n [style.zIndex]=\"block.index\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + unit : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + unit : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + unit : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + unit : ''\"\n [style.padding]=\"block.padding ? block.padding + unit : ''\"\n [style.clipPath]=\"block.clipPath\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + unit : ''\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <img [src]=\"block.imageUrl\">\n </ng-container>\n <img [src]=\"block.imageUrl\" *ngIf=\"block.imageUrl\">\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block .content-editable{outline:none;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:1px dashed #c5c5c5;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i9__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
944
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
945
+ type: i0.Component,
946
+ args: [{
947
+ selector: 'fs-block',
948
+ templateUrl: 'block.component.html',
949
+ styleUrls: ['block.component.scss'],
950
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
951
+ }]
952
+ }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { element: [{
953
+ type: i0.ViewChild,
954
+ args: ['element', { static: true }]
955
+ }], contentElement: [{
956
+ type: i0.ViewChild,
957
+ args: ['contentElement', { static: true }]
958
+ }], contentEditable: [{
959
+ type: i0.ViewChild,
960
+ args: ['contentEditable', { static: true }]
961
+ }], block: [{
962
+ type: i0.Input
963
+ }], html: [{
964
+ type: i0.Input
965
+ }], zoompan: [{
966
+ type: i0.Input
967
+ }] } });
832
968
 
833
969
  var FsBlockEditorSidebarPanelDirective = /** @class */ (function () {
834
970
  function FsBlockEditorSidebarPanelDirective(templateRef) {
835
971
  this.templateRef = templateRef;
836
972
  this.show = true;
837
973
  }
838
- FsBlockEditorSidebarPanelDirective.ctorParameters = function () { return [
839
- { type: core.TemplateRef }
840
- ]; };
841
- __decorate([
842
- core.Input(),
843
- __metadata("design:type", String)
844
- ], FsBlockEditorSidebarPanelDirective.prototype, "label", void 0);
845
- __decorate([
846
- core.Input(),
847
- __metadata("design:type", Object)
848
- ], FsBlockEditorSidebarPanelDirective.prototype, "show", void 0);
849
- FsBlockEditorSidebarPanelDirective = __decorate([
850
- core.Directive({
851
- selector: '[fsBlockEditorSidebarPanel]'
852
- }),
853
- __metadata("design:paramtypes", [core.TemplateRef])
854
- ], FsBlockEditorSidebarPanelDirective);
855
974
  return FsBlockEditorSidebarPanelDirective;
856
- }());
975
+ }());
976
+ 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 });
977
+ 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 });
978
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, decorators: [{
979
+ type: i0.Directive,
980
+ args: [{
981
+ selector: '[fsBlockEditorSidebarPanel]'
982
+ }]
983
+ }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }]; }, propDecorators: { label: [{
984
+ type: i0.Input
985
+ }], show: [{
986
+ type: i0.Input
987
+ }] } });
857
988
 
858
- var FsBlockEditorMarginDirective = /** @class */ (function () {
859
- function FsBlockEditorMarginDirective(_elementRef) {
860
- this._elementRef = _elementRef;
861
- }
862
- Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
863
- get: function () {
864
- return this._elementRef.nativeElement;
865
- },
866
- enumerable: true,
867
- configurable: true
868
- });
869
- FsBlockEditorMarginDirective.ctorParameters = function () { return [
870
- { type: core.ElementRef }
871
- ]; };
872
- FsBlockEditorMarginDirective = __decorate([
873
- core.Directive({
874
- selector: '[fsBlockEditorMargin]'
875
- }),
876
- __metadata("design:paramtypes", [core.ElementRef])
877
- ], FsBlockEditorMarginDirective);
878
- return FsBlockEditorMarginDirective;
879
- }());
989
+ var BlockTypes = [
990
+ { value: exports.BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4' },
991
+ { value: exports.BlockType.ShortText, name: 'Short Text', icon: 'short_text' },
992
+ { value: exports.BlockType.LongText, name: 'Long Text', icon: 'subject' },
993
+ { value: exports.BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked' },
994
+ { value: exports.BlockType.Checkbox, name: 'Checkbox', icon: 'check_box' },
995
+ { value: exports.BlockType.Date, name: 'Date', icon: 'calendar_today' },
996
+ { value: exports.BlockType.Signature, name: 'Signature', icon: 'draw' },
997
+ { value: exports.BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*' },
998
+ { value: exports.BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf' },
999
+ ];
880
1000
 
881
1001
  var SidebarComponent = /** @class */ (function () {
882
- function SidebarComponent(_el, _service, _cdRef) {
1002
+ function SidebarComponent(_el, _blockEditor, _cdRef, _prompt) {
883
1003
  this._el = _el;
884
- this._service = _service;
1004
+ this._blockEditor = _blockEditor;
885
1005
  this._cdRef = _cdRef;
1006
+ this._prompt = _prompt;
1007
+ this.BlockTypes = BlockTypes;
1008
+ this.blockTypeNames = common.index(BlockTypes, 'value', 'name');
1009
+ this.BlockType = exports.BlockType;
886
1010
  this._destroy$ = new rxjs.Subject();
887
1011
  }
888
- Object.defineProperty(SidebarComponent.prototype, "changeDetector", {
889
- get: function () {
890
- return this._cdRef;
891
- },
892
- enumerable: true,
893
- configurable: true
894
- });
895
1012
  Object.defineProperty(SidebarComponent.prototype, "el", {
896
1013
  get: function () {
897
1014
  return this._el.nativeElement;
898
1015
  },
899
- enumerable: true,
1016
+ enumerable: false,
900
1017
  configurable: true
901
1018
  });
902
1019
  SidebarComponent.prototype.ngOnInit = function () {
903
1020
  var _this = this;
904
- this._service.selectedBlockComponents$
1021
+ this._blockEditor.selectedBlocks$
905
1022
  .pipe(operators.takeUntil(this._destroy$))
906
1023
  .subscribe(function (blocks) {
907
1024
  _this.clippable = false;
908
- _this.block = blocks[0] ? blocks[0].block : null;
909
- _this.changeDetector.markForCheck();
910
- if (_this.config.blocksSelected) {
911
- _this.config.blocksSelected(blocks.map(function (block) { return block.block; }));
912
- }
1025
+ _this.block = blocks[0] ? blocks[0] : null;
1026
+ _this._cdRef.markForCheck();
1027
+ });
1028
+ this._blockEditor.blockChanged$
1029
+ .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
1030
+ .subscribe(function () {
1031
+ _this._cdRef.markForCheck();
913
1032
  });
914
1033
  };
915
1034
  SidebarComponent.prototype.verticalAlignClick = function (value) {
916
- this._service.selectedBlockComponents.forEach(function (block) {
917
- block.verticalAlign = value;
918
- });
1035
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
919
1036
  };
920
1037
  SidebarComponent.prototype.boldClick = function () {
921
- this._service.selectedBlockComponents.forEach(function (block) {
922
- block.bold = !block.bold;
923
- });
1038
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
924
1039
  };
925
1040
  SidebarComponent.prototype.fontColorChange = function (value) {
926
- this._service.selectedBlockComponents.forEach(function (block) {
927
- block.fontColor = value;
928
- });
1041
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
929
1042
  };
930
1043
  SidebarComponent.prototype.lineHeightChange = function (value) {
931
- var _this = this;
932
- this._service.selectedBlockComponents.forEach(function (block) {
933
- if (_this.validNumeric(value)) {
934
- block.lineHeight = value || null;
935
- }
936
- });
1044
+ value = this.validNumeric(value) ? value : null;
1045
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'lineHeight');
937
1046
  };
938
1047
  SidebarComponent.prototype.fontSizeChange = function (value) {
939
- var _this = this;
940
- this._service.selectedBlockComponents.forEach(function (block) {
941
- if (_this.validNumeric(value)) {
942
- block.fontSize = value || null;
943
- }
944
- });
1048
+ value = this.validNumeric(value) ? value : null;
1049
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontSize');
945
1050
  };
946
1051
  SidebarComponent.prototype.borderWidthChange = function (value) {
947
- var _this = this;
948
- this._service.selectedBlockComponents.forEach(function (block) {
949
- if (_this.validNumeric(value)) {
950
- block.borderWidth = value || null;
951
- }
952
- });
1052
+ value = this.validNumeric(value) ? value : null;
1053
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderWidth');
953
1054
  };
954
1055
  SidebarComponent.prototype.italicClick = function () {
955
- this._service.selectedBlockComponents.forEach(function (block) {
956
- block.italic = !block.italic;
957
- });
1056
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
958
1057
  };
959
1058
  SidebarComponent.prototype.underlineClick = function () {
960
- this._service.selectedBlockComponents.forEach(function (block) {
961
- block.underline = !block.underline;
962
- });
1059
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
963
1060
  };
964
1061
  SidebarComponent.prototype.backgroundColorChange = function (value) {
965
- this._service.selectedBlockComponents.forEach(function (block) {
966
- block.backgroundColor = value;
967
- });
1062
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
968
1063
  };
969
1064
  SidebarComponent.prototype.widthChange = function (value) {
970
- var _this = this;
971
- this._service.selectedBlockComponents.forEach(function (block) {
972
- if (_this.validNumeric(value)) {
973
- block.width = value;
974
- }
975
- });
1065
+ value = this.validNumeric(value) ? value : null;
1066
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'width');
976
1067
  };
977
1068
  SidebarComponent.prototype.heightChange = function (value) {
978
- var _this = this;
979
- this._service.selectedBlockComponents.forEach(function (block) {
980
- if (_this.validNumeric(value)) {
981
- block.height = value;
982
- }
983
- });
1069
+ value = this.validNumeric(value) ? value : null;
1070
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'height');
984
1071
  };
985
1072
  SidebarComponent.prototype.topChange = function (value) {
986
- var _this = this;
987
- this._service.selectedBlockComponents.forEach(function (block) {
988
- if (_this.validNumeric(value)) {
989
- block.top = value;
990
- }
991
- });
1073
+ value = this.validNumeric(value) ? value : null;
1074
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'top');
992
1075
  };
993
1076
  SidebarComponent.prototype.leftChange = function (value) {
994
- var _this = this;
995
- this._service.selectedBlockComponents.forEach(function (block) {
996
- if (_this.validNumeric(value)) {
997
- block.left = value;
998
- }
999
- });
1077
+ value = this.validNumeric(value) ? value : null;
1078
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'left');
1000
1079
  };
1001
1080
  SidebarComponent.prototype.rotateChange = function (value) {
1002
- var _this = this;
1003
- this._service.selectedBlockComponents.forEach(function (block) {
1004
- if (_this.validNumeric(value)) {
1005
- block.rotate = value;
1006
- }
1007
- });
1081
+ value = this.validNumeric(value) ? value : null;
1082
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'rotate');
1008
1083
  };
1009
1084
  SidebarComponent.prototype.paddingChange = function (name, value) {
1010
- var _this = this;
1011
- this._service.selectedBlockComponents.forEach(function (block) {
1012
- if (_this.validNumeric(value)) {
1013
- block.padding(name, value || null);
1014
- }
1015
- });
1085
+ value = this.validNumeric(value) ? value : null;
1086
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'padding');
1016
1087
  };
1017
1088
  SidebarComponent.prototype.paddingAllChange = function (value) {
1018
- var _this = this;
1019
- this._service.selectedBlockComponents.forEach(function (block) {
1020
- if (_this.validNumeric(value)) {
1021
- block.paddingAll = value;
1022
- }
1023
- });
1089
+ value = this.validNumeric(value) ? value : null;
1090
+ this.block.paddingTop = value;
1091
+ this.block.paddingLeft = value;
1092
+ this.block.paddingBottom = value;
1093
+ this.block.paddingRight = value;
1094
+ this.paddingChange('top', value);
1095
+ this.paddingChange('left', value);
1096
+ this.paddingChange('right', value);
1097
+ this.paddingChange('bottom', value);
1024
1098
  };
1025
1099
  SidebarComponent.prototype.borderColorChange = function (value) {
1026
- this._service.selectedBlockComponents.forEach(function (block) {
1027
- block.borderColor = value;
1028
- });
1100
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
1101
+ };
1102
+ SidebarComponent.prototype.toggleKeepRatio = function () {
1103
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
1029
1104
  };
1030
1105
  SidebarComponent.prototype.horizontalAlignClick = function (value) {
1031
- this._service.selectedBlockComponents.forEach(function (block) {
1032
- block.horizontalAlign = value;
1033
- });
1106
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
1034
1107
  };
1035
- SidebarComponent.prototype.shapeRound = function (value) {
1036
- this._service.selectedBlockComponents.forEach(function (block) {
1037
- block.shapeRound(value, block.block[value] === 'round' ? 'square' : 'round');
1038
- });
1108
+ SidebarComponent.prototype.shapeRound = function (name) {
1109
+ var value = this.block[name] === 'round' ? 'square' : 'round';
1110
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1039
1111
  };
1040
1112
  SidebarComponent.prototype.imageRemove = function () {
1041
- this._service.selectedBlockComponents.forEach(function (block) {
1042
- block.imageUrl = null;
1043
- });
1113
+ this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
1044
1114
  };
1045
1115
  SidebarComponent.prototype.imageClip = function () {
1046
- var _this = this;
1047
1116
  this.clippable = !this.clippable;
1048
- this._service.selectedBlockComponents.forEach(function (block) {
1049
- block.clippable = _this.clippable;
1050
- });
1117
+ this._blockEditor.selectedBlockComponentChangeProperty(this.clippable, 'clippable');
1051
1118
  };
1052
1119
  SidebarComponent.prototype.shapeRadiusChange = function (value) {
1053
- this._service.selectedBlockComponents.forEach(function (block) {
1054
- block.shapeRadius = value;
1055
- });
1120
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'shapeRadius');
1121
+ };
1122
+ SidebarComponent.prototype.blockChangeProperty = function (value, name) {
1123
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1056
1124
  };
1057
- SidebarComponent.prototype.fileSelect = function (fsFile) {
1125
+ SidebarComponent.prototype.imageSelect = function (fsFile) {
1058
1126
  var _this = this;
1059
- if (this.config.fileUpload) {
1060
- this.config.fileUpload(fsFile.file)
1127
+ if (this.config.imageUpload) {
1128
+ this.config.imageUpload(fsFile.file)
1061
1129
  .subscribe(function (value) {
1062
- _this._service.selectedBlockComponents.forEach(function (block) {
1063
- block.imageUrl = value;
1064
- });
1130
+ _this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
1065
1131
  });
1066
1132
  }
1067
1133
  };
1068
1134
  SidebarComponent.prototype.blockRemoveClick = function () {
1069
1135
  var _this = this;
1070
- if (this.config.blocksRemoved) {
1071
- this.config.blocksRemoved(this._service.selectedBlocks)
1072
- .pipe(operators.takeUntil(this._destroy$))
1136
+ if (this.config.blocksRemove) {
1137
+ this._prompt.confirm({
1138
+ title: 'Confirm',
1139
+ template: 'Are you sure your would like to delete this block?',
1140
+ })
1141
+ .pipe(operators.switchMap(function () { return _this.config.blocksRemove(_this._blockEditor.selectedBlocks); }), operators.takeUntil(this._destroy$))
1073
1142
  .subscribe(function () {
1074
- _this._service.selectedBlocks.forEach(function (block) {
1075
- _this._service.removeBlock(block);
1076
- });
1077
- _this._service.selectedBlockComponents = [];
1078
- });
1079
- }
1080
- };
1081
- SidebarComponent.prototype.blockAddClick = function () {
1082
- var _this = this;
1083
- var width = (this.config.width * .333).toFixed(2);
1084
- var height = (this.config.height * .333).toFixed(2);
1085
- var reference = common$1.guid();
1086
- var block = {
1087
- type: 'text',
1088
- reference: reference,
1089
- top: height,
1090
- left: width,
1091
- width: width,
1092
- height: height,
1093
- };
1094
- if (this.config.blockAdded) {
1095
- this.config.blockAdded(block)
1096
- .pipe(operators.takeUntil(this._destroy$))
1097
- .subscribe(function (block) {
1098
- _this.addBlock(block);
1099
- _this.changeDetector.markForCheck();
1100
- _this.blockAdded
1101
- .pipe(operators.take(1), operators.takeUntil(_this._destroy$))
1102
- .subscribe(function (blockComponent) {
1103
- _this._service.selectedBlockComponents = [blockComponent];
1104
- });
1143
+ _this._blockEditor.removeSelectedBlocks();
1105
1144
  });
1106
1145
  }
1107
1146
  };
1108
- SidebarComponent.prototype.addBlock = function (block) {
1109
- this._service.addBlock(block);
1110
- this._updateIndexes();
1111
- };
1112
- SidebarComponent.prototype._updateIndexes = function () {
1113
- var _this = this;
1114
- var sort = this.blocks.slice().sort(function (a, b) {
1115
- return a.index > b.index ? 1 : -1;
1147
+ SidebarComponent.prototype.blockUpload = function (blockType, fsFile) {
1148
+ var block = this._blockEditor.sanitizeNewBlock({
1149
+ type: blockType,
1116
1150
  });
1117
- sort.forEach(function (block, index) {
1118
- _this.blocks.find(function (item) {
1119
- return block.reference === item.reference;
1120
- }).index = index;
1151
+ this._blockEditor.blockUpload(block, fsFile);
1152
+ };
1153
+ SidebarComponent.prototype.blockAdd = function (type) {
1154
+ if (type === exports.BlockType.Pdf || type === exports.BlockType.Image) {
1155
+ return;
1156
+ }
1157
+ var block = this._blockEditor.sanitizeNewBlock({
1158
+ type: type,
1121
1159
  });
1160
+ this._blockEditor.blockAdd(block);
1122
1161
  };
1123
1162
  SidebarComponent.prototype.layerMove = function (direction) {
1124
1163
  var _this = this;
1125
- this._service.blockComponents.forEach(function (blockComponent) {
1126
- if (_this._service.isSelectedBlock(blockComponent)) {
1164
+ this._blockEditor.blockComponents.forEach(function (blockComponent) {
1165
+ if (_this._blockEditor.isSelectedBlock(blockComponent)) {
1127
1166
  blockComponent.block.index + (999 * direction);
1128
1167
  }
1129
1168
  });
1130
- var sorted = this._service.blockComponents.sort(function (a, b) {
1169
+ var sorted = this._blockEditor.blockComponents.sort(function (a, b) {
1131
1170
  return a.index > b.index ? 1 : -1;
1132
1171
  });
1133
1172
  sorted.forEach(function (item, index) {
@@ -1145,7 +1184,7 @@
1145
1184
  this.layerMove(-1);
1146
1185
  };
1147
1186
  SidebarComponent.prototype.getBlock = function (reference) {
1148
- return this._service.blocks.find(function (block) {
1187
+ return this._blockEditor.blocks.find(function (block) {
1149
1188
  return block.reference === reference;
1150
1189
  });
1151
1190
  };
@@ -1164,79 +1203,92 @@
1164
1203
  SidebarComponent.prototype.validNumeric = function (value) {
1165
1204
  return !value || !!String(value).match(/^\d*\.?\d*$/);
1166
1205
  };
1167
- SidebarComponent.ctorParameters = function () { return [
1168
- { type: core.ElementRef },
1169
- { type: BlockEditorService },
1170
- { type: core.ChangeDetectorRef }
1171
- ]; };
1172
- __decorate([
1173
- core.ContentChildren(FsBlockEditorSidebarPanelDirective),
1174
- __metadata("design:type", core.QueryList)
1175
- ], SidebarComponent.prototype, "sidebarPanels", void 0);
1176
- __decorate([
1177
- core.Input(),
1178
- __metadata("design:type", Object)
1179
- ], SidebarComponent.prototype, "config", void 0);
1180
- __decorate([
1181
- core.Input(),
1182
- __metadata("design:type", Object)
1183
- ], SidebarComponent.prototype, "blocks", void 0);
1184
- __decorate([
1185
- core.Input(),
1186
- __metadata("design:type", core.EventEmitter)
1187
- ], SidebarComponent.prototype, "blockAdded", void 0);
1188
- SidebarComponent = __decorate([
1189
- core.Component({
1190
- selector: 'sidebar',
1191
- template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockAddClick()\">\n <mat-icon>add</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n </div>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"fileSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n",
1192
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1193
- styles: [".sidebar{width:285px;font-size:14px;height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .field-label,.sidebar .sidebar-row ::ng-deep .mat-form-field-prefix{color:#a5a5a5;font-size:11px;margin-right:2px}.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-down ::ng-deep .mat-button-wrapper,.sidebar .layer-up ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.6);top:-6px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .border-width,.sidebar .font-size,.sidebar .line-height,.sidebar .padding{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:-ms-grid;display:grid;-ms-grid-columns:1fr 1fr;grid-template-columns:1fr 1fr;-moz-column-gap:1px;column-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px;border-bottom:1px solid #dadada}.sidebar .sidebar-panel.info-panel .sidebar-row{justify-content:space-evenly}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.info-panel .sidebar-row>{margin:0}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}"]
1194
- }),
1195
- __metadata("design:paramtypes", [core.ElementRef,
1196
- BlockEditorService,
1197
- core.ChangeDetectorRef])
1198
- ], SidebarComponent);
1199
1206
  return SidebarComponent;
1200
- }());
1207
+ }());
1208
+ 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.FsPrompt }], target: i0__namespace.ɵɵFactoryTarget.Component });
1209
+ SidebarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0__namespace, template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Add</div>\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container> \n <ng-container *ngSwitchDefault>\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [accept]=\"blockType.accept\">\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </fs-file>\n </ng-template>\n\n <ng-template #addButton>\n <button \n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n </ng-template>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n <div class=\"sidebar-panel form-field-panel\">\n <div class=\"sidebar-label\">{{blockTypeNames[block.type]}} Field</div>\n <div class=\"sidebar-row\">\n\n <mat-form-field class=\"form-field-padless full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless full-width\">\n <input\n matInput\n [ngModel]=\"block.format\"\n name=\"format\"\n placeholder=\"Format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n \n <mat-form-field class=\"form-field-padless full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless full-width\">\n <mat-label>Index</mat-label>\n <input\n matInput\n [(ngModel)]=\"block.index\"\n name=\"index\"\n (ngModelChange)=\"blockChangeProperty($event, 'index')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox \n name=\"required\" \n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"block.type !== BlockType.Pdf\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"imageSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n", styles: [".sidebar{width:285px;font-size:14px;height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}\n"], components: [{ type: i3__namespace.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i4__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: i5__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7__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: i8__namespace.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }], directives: [{ type: i9__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i9__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i10__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11__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: i12__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: i12__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i12__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6__namespace.MatPrefix, selector: "[matPrefix]" }, { type: i11__namespace.MatTextareaAutosize, selector: "textarea[mat-autosize], textarea[matTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "matAutosizeMinRows", "matAutosizeMaxRows", "mat-autosize", "matTextareaAutosize"], exportAs: ["matTextareaAutosize"] }, { type: i6__namespace.MatLabel, selector: "mat-label" }, { type: i9__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1210
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, decorators: [{
1211
+ type: i0.Component,
1212
+ args: [{
1213
+ selector: 'sidebar',
1214
+ templateUrl: 'sidebar.component.html',
1215
+ styleUrls: ['sidebar.component.scss'],
1216
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1217
+ }]
1218
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace.FsPrompt }]; }, propDecorators: { sidebarPanels: [{
1219
+ type: i0.ContentChildren,
1220
+ args: [FsBlockEditorSidebarPanelDirective]
1221
+ }], config: [{
1222
+ type: i0.Input
1223
+ }], blocks: [{
1224
+ type: i0.Input
1225
+ }] } });
1201
1226
 
1202
- var FsBlockEditorComponent = /** @class */ (function () {
1203
- function FsBlockEditorComponent(_el, _service, _cdRef, _differs) {
1227
+ var FsBlockEditorMarginDirective = /** @class */ (function () {
1228
+ function FsBlockEditorMarginDirective(_elementRef) {
1229
+ this._elementRef = _elementRef;
1230
+ }
1231
+ Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
1232
+ get: function () {
1233
+ return this._elementRef.nativeElement;
1234
+ },
1235
+ enumerable: false,
1236
+ configurable: true
1237
+ });
1238
+ return FsBlockEditorMarginDirective;
1239
+ }());
1240
+ 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 });
1241
+ FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
1242
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
1243
+ type: i0.Directive,
1244
+ args: [{
1245
+ selector: '[fsBlockEditorMargin]'
1246
+ }]
1247
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
1248
+
1249
+ var ArtboardComponent = /** @class */ (function () {
1250
+ function ArtboardComponent(_el, _blockEditor, _cdRef, _differs) {
1204
1251
  this._el = _el;
1205
- this._service = _service;
1252
+ this._blockEditor = _blockEditor;
1206
1253
  this._cdRef = _cdRef;
1207
1254
  this._differs = _differs;
1208
- this.blockAdded = new core.EventEmitter();
1209
- this.blockRemoved = new core.EventEmitter();
1255
+ this.blocks = [];
1210
1256
  this._destroy$ = new rxjs.Subject();
1211
1257
  this._differ = _differs.find([]).create(null);
1212
1258
  }
1213
- Object.defineProperty(FsBlockEditorComponent.prototype, "el", {
1259
+ Object.defineProperty(ArtboardComponent.prototype, "el", {
1214
1260
  get: function () {
1215
1261
  return this._el.nativeElement;
1216
1262
  },
1217
- enumerable: true,
1263
+ enumerable: false,
1218
1264
  configurable: true
1219
1265
  });
1220
- FsBlockEditorComponent.prototype.ngOnInit = function () {
1266
+ ArtboardComponent.prototype.ngOnInit = function () {
1221
1267
  var _this = this;
1222
- this.config = __assign(__assign({}, this.config), { unit: 'in' });
1223
- this._service.registerContainer(this.artboard.nativeElement);
1224
- this._service.registerMargin(this.marginContainer.nativeElement);
1225
- this._service.blocks = this.config.blocks;
1226
- this._service.config = this.config;
1227
- this._service.blocks$
1268
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1269
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
1270
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1271
+ this._blockEditor.blocks$
1228
1272
  .pipe(operators.takeUntil(this._destroy$))
1229
1273
  .subscribe(function (blocks) {
1230
1274
  _this.blocks = blocks;
1275
+ _this._cdRef.markForCheck();
1276
+ });
1277
+ this._blockEditor.blockAdded$
1278
+ .pipe(operators.delay(300), operators.takeUntil(this._destroy$))
1279
+ .subscribe(function (block) {
1280
+ _this._blockEditor.selectedBlocks = [block];
1281
+ _this._cdRef.markForCheck();
1231
1282
  });
1232
1283
  rxjs.fromEvent(window, 'keydown')
1233
1284
  .pipe(operators.takeUntil(this._destroy$), operators.filter(function (event) {
1234
- return !!event.key.match(/^Arrow/) && !!_this._service.selectedBlockComponents.length;
1285
+ return !!event.key.match(/^Arrow/) && !!_this._blockEditor.selectedBlocks.length;
1235
1286
  }))
1236
1287
  .subscribe(function (event) {
1237
1288
  event.preventDefault();
1238
1289
  var inchPixel = 1 / 100;
1239
- _this._service.selectedBlockComponents.forEach(function (blockComponent) {
1290
+ _this._blockEditor.selectedComponentBlocks
1291
+ .forEach(function (blockComponent) {
1240
1292
  switch (event.key) {
1241
1293
  case 'ArrowUp':
1242
1294
  blockComponent.top = blockComponent.block.top - inchPixel;
@@ -1254,153 +1306,229 @@
1254
1306
  });
1255
1307
  });
1256
1308
  };
1257
- FsBlockEditorComponent.prototype.artboardClick = function (event) {
1258
- if (event.target.isSameNode(this.artboard.nativeElement) ||
1259
- event.target.isSameNode(this.artboardContainer.nativeElement)) {
1260
- this._service.selectedBlockComponents.forEach(function (block) {
1261
- block.deselect();
1262
- block.markForCheck();
1263
- });
1264
- this._service.selectedBlockComponents = [];
1265
- }
1266
- };
1267
- FsBlockEditorComponent.prototype.blockChanged = function (block) {
1268
- this.sidebar.changeDetector.markForCheck();
1309
+ ArtboardComponent.prototype.blockChanged = function (block) {
1269
1310
  if (this.config.blockChanged) {
1270
1311
  this.config.blockChanged(block);
1271
1312
  }
1272
1313
  };
1273
- FsBlockEditorComponent.prototype.ngAfterViewInit = function () {
1314
+ ArtboardComponent.prototype.ngAfterViewInit = function () {
1315
+ // this.blockComponents.changes
1316
+ // .pipe(
1317
+ // takeUntil(this._destroy$),
1318
+ // )
1319
+ // .subscribe((changes) => {
1320
+ // const changeDiff = this._differ.diff(changes);
1321
+ // if (changeDiff) {
1322
+ // changeDiff.forEachAddedItem((change) => {
1323
+ // //this.blockAdded.emit(change.item);
1324
+ // });
1325
+ // changeDiff.forEachRemovedItem((change) => {
1326
+ // //this.blockRemoved.emit(change.item);
1327
+ // });
1328
+ // }
1329
+ // });
1330
+ };
1331
+ ArtboardComponent.prototype.ngOnDestroy = function () {
1332
+ this._destroy$.next();
1333
+ this._destroy$.complete();
1334
+ };
1335
+ return ArtboardComponent;
1336
+ }());
1337
+ 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 }, { token: i0__namespace.IterableDiffers }], target: i0__namespace.ɵɵFactoryTarget.Component });
1338
+ 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}.artboard .margin-container{position:absolute;z-index:-1}.artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.artboard .margin.margin-top,.artboard .margin.margin-bottom{width:100%;border-top-width:1px}.artboard .margin.margin-left,.artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html", "zoompan"] }], directives: [{ type: i9__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1339
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, decorators: [{
1340
+ type: i0.Component,
1341
+ args: [{
1342
+ selector: 'app-artboard',
1343
+ templateUrl: 'artboard.component.html',
1344
+ styleUrls: ['artboard.component.scss'],
1345
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1346
+ }]
1347
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
1348
+ type: i0.ContentChildren,
1349
+ args: [FsBlockEditorSidebarPanelDirective]
1350
+ }], blockComponents: [{
1351
+ type: i0.ViewChildren,
1352
+ args: [FsBlockComponent]
1353
+ }], artboard: [{
1354
+ type: i0.ViewChild,
1355
+ args: ['artboard', { static: true }]
1356
+ }], marginContainer: [{
1357
+ type: i0.ViewChild,
1358
+ args: ['marginContainer', { static: true }]
1359
+ }], margins: [{
1360
+ type: i0.ViewChildren,
1361
+ args: [FsBlockEditorMarginDirective]
1362
+ }], sidebar: [{
1363
+ type: i0.ViewChild,
1364
+ args: [SidebarComponent, { static: true }]
1365
+ }], config: [{
1366
+ type: i0.Input
1367
+ }], zoompan: [{
1368
+ type: i0.Input
1369
+ }] } });
1370
+
1371
+ var FsBlockEditorComponent = /** @class */ (function () {
1372
+ function FsBlockEditorComponent(_el, _blockEditor) {
1373
+ this._el = _el;
1374
+ this._blockEditor = _blockEditor;
1375
+ this._destroy$ = new rxjs.Subject();
1376
+ }
1377
+ Object.defineProperty(FsBlockEditorComponent.prototype, "el", {
1378
+ get: function () {
1379
+ return this._el.nativeElement;
1380
+ },
1381
+ enumerable: false,
1382
+ configurable: true
1383
+ });
1384
+ FsBlockEditorComponent.prototype.ngOnInit = function () {
1274
1385
  var _this = this;
1275
- this.blockComponents.changes.subscribe(function (changes) {
1276
- var changeDiff = _this._differ.diff(changes);
1277
- if (changeDiff) {
1278
- changeDiff.forEachAddedItem(function (change) {
1279
- _this.blockAdded.emit(change.item);
1280
- });
1281
- changeDiff.forEachRemovedItem(function (change) {
1282
- _this.blockRemoved.emit(change.item);
1283
- });
1284
- }
1386
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1387
+ this._blockEditor.blocks = this.config.blocks;
1388
+ this._blockEditor.config = this.config;
1389
+ this._blockEditor.blocks$
1390
+ .pipe(operators.takeUntil(this._destroy$))
1391
+ .subscribe(function (blocks) {
1392
+ _this.blocks = blocks;
1393
+ });
1394
+ setTimeout(function () {
1395
+ _this.zoompan.center(_this.artboard.nativeElement, { vertical: false });
1285
1396
  });
1286
1397
  };
1398
+ FsBlockEditorComponent.prototype.artboardClick = function (event) {
1399
+ if (event.target.classList.contains('deselectable')) {
1400
+ this.zoompan.enable();
1401
+ this._blockEditor.selectedBlocks = [];
1402
+ }
1403
+ };
1287
1404
  FsBlockEditorComponent.prototype.ngOnDestroy = function () {
1288
1405
  this._destroy$.next();
1289
1406
  this._destroy$.complete();
1290
1407
  };
1291
- FsBlockEditorComponent.ctorParameters = function () { return [
1292
- { type: core.ElementRef },
1293
- { type: BlockEditorService },
1294
- { type: core.ChangeDetectorRef },
1295
- { type: core.IterableDiffers }
1296
- ]; };
1297
- __decorate([
1298
- core.ContentChildren(FsBlockEditorSidebarPanelDirective),
1299
- __metadata("design:type", core.QueryList)
1300
- ], FsBlockEditorComponent.prototype, "sidebarPanels", void 0);
1301
- __decorate([
1302
- core.ViewChildren(FsBlockComponent),
1303
- __metadata("design:type", core.QueryList)
1304
- ], FsBlockEditorComponent.prototype, "blockComponents", void 0);
1305
- __decorate([
1306
- core.ViewChild('artboard', { static: true }),
1307
- __metadata("design:type", core.ElementRef)
1308
- ], FsBlockEditorComponent.prototype, "artboard", void 0);
1309
- __decorate([
1310
- core.ViewChild('marginContainer', { static: true }),
1311
- __metadata("design:type", core.ElementRef)
1312
- ], FsBlockEditorComponent.prototype, "marginContainer", void 0);
1313
- __decorate([
1314
- core.ViewChildren(FsBlockEditorMarginDirective),
1315
- __metadata("design:type", core.QueryList)
1316
- ], FsBlockEditorComponent.prototype, "margins", void 0);
1317
- __decorate([
1318
- core.ViewChild('artboardContainer', { static: true }),
1319
- __metadata("design:type", core.ElementRef)
1320
- ], FsBlockEditorComponent.prototype, "artboardContainer", void 0);
1321
- __decorate([
1322
- core.ViewChild(SidebarComponent, { static: true }),
1323
- __metadata("design:type", SidebarComponent)
1324
- ], FsBlockEditorComponent.prototype, "sidebar", void 0);
1325
- __decorate([
1326
- core.Input(),
1327
- __metadata("design:type", Object)
1328
- ], FsBlockEditorComponent.prototype, "config", void 0);
1329
- __decorate([
1330
- core.Output(),
1331
- __metadata("design:type", Object)
1332
- ], FsBlockEditorComponent.prototype, "blockAdded", void 0);
1333
- __decorate([
1334
- core.Output(),
1335
- __metadata("design:type", Object)
1336
- ], FsBlockEditorComponent.prototype, "blockRemoved", void 0);
1337
- FsBlockEditorComponent = __decorate([
1338
- core.Component({
1339
- selector: 'fs-block-editor',
1340
- template: "<div class=\"editor-container\">\n <div\n #artboardContainer\n class=\"artboard-container\"\n (click)=\"artboardClick($event)\">\n <div\n #artboard\n class=\"artboard mat-elevation-z2\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks; trackBy\"\n [block]=\"block\"\n (changed)=\"blockChanged($event)\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\"></div>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n [blockAdded]=\"blockAdded\">\n </sidebar>\n</div>\n",
1341
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1342
- providers: [
1343
- BlockEditorService,
1344
- ],
1345
- styles: [".editor-container{display:flex;flex-direction:row;position:relative}.editor-container .artboard-container{display:flex;flex-grow:1;justify-content:center;padding:25px;overflow:auto;min-width:0}.editor-container .artboard-container .artboard{position:relative}.editor-container .artboard-container .artboard .margin-container{position:absolute;z-index:-1}.editor-container .artboard-container .artboard .margin{position:absolute;border:0 dashed #ff85bd5e}.editor-container .artboard-container .artboard .margin.margin-bottom,.editor-container .artboard-container .artboard .margin.margin-top{width:100%;border-top-width:1px}.editor-container .artboard-container .artboard .margin.margin-left,.editor-container .artboard-container .artboard .margin.margin-right{height:100%;border-left-width:1px}"]
1346
- }),
1347
- __metadata("design:paramtypes", [core.ElementRef,
1348
- BlockEditorService,
1349
- core.ChangeDetectorRef,
1350
- core.IterableDiffers])
1351
- ], FsBlockEditorComponent);
1352
1408
  return FsBlockEditorComponent;
1353
- }());
1409
+ }());
1410
+ 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 });
1411
+ FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
1412
+ BlockEditorService,
1413
+ ], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "zoompan", first: true, predicate: i2$1.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 class=\"editor-container deselectable\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\"\n (mousedown)=\"artboardClick($event)\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0}.editor-container .zoom-pan-container{flex:1}\n"], components: [{ type: i2__namespace$1.FsZoomPanComponent, selector: "fs-zoom-pan", inputs: ["zoomMax", "zoomMin", "zoomDefault", "top", "left"], outputs: ["moved", "zoomed"] }, { type: ArtboardComponent, selector: "app-artboard", inputs: ["config", "zoompan"] }, { type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks"] }], directives: [{ type: i2__namespace$1.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1414
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, decorators: [{
1415
+ type: i0.Component,
1416
+ args: [{
1417
+ selector: 'fs-block-editor',
1418
+ templateUrl: 'block-editor.component.html',
1419
+ styleUrls: ['block-editor.component.scss'],
1420
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1421
+ providers: [
1422
+ BlockEditorService,
1423
+ ]
1424
+ }]
1425
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1426
+ type: i0.ContentChildren,
1427
+ args: [FsBlockEditorSidebarPanelDirective]
1428
+ }], zoompan: [{
1429
+ type: i0.ViewChild,
1430
+ args: [i2$1.FsZoomPanComponent, { static: true }]
1431
+ }], artboardContainer: [{
1432
+ type: i0.ViewChild,
1433
+ args: ['artboardContainer', { static: true }]
1434
+ }], sidebar: [{
1435
+ type: i0.ViewChild,
1436
+ args: [SidebarComponent, { static: true }]
1437
+ }], artboard: [{
1438
+ type: i0.ViewChild,
1439
+ args: [ArtboardComponent, { read: i0.ElementRef }]
1440
+ }], config: [{
1441
+ type: i0.Input
1442
+ }] } });
1354
1443
 
1355
1444
  var FsBlockEditorModule = /** @class */ (function () {
1356
1445
  function FsBlockEditorModule() {
1357
1446
  }
1358
- FsBlockEditorModule_1 = FsBlockEditorModule;
1359
1447
  FsBlockEditorModule.forRoot = function () {
1360
1448
  return {
1361
- ngModule: FsBlockEditorModule_1,
1449
+ ngModule: FsBlockEditorModule,
1362
1450
  };
1363
1451
  };
1364
- var FsBlockEditorModule_1;
1365
- FsBlockEditorModule = FsBlockEditorModule_1 = __decorate([
1366
- core.NgModule({
1367
- imports: [
1368
- common.CommonModule,
1369
- forms.FormsModule,
1370
- icon.MatIconModule,
1371
- button.MatButtonModule,
1372
- input.MatInputModule,
1373
- formField.MatFormFieldModule,
1374
- htmlEditor.FsHtmlEditorModule,
1375
- file.FsFileModule,
1376
- colorpicker.FsColorPickerModule,
1377
- ],
1378
- exports: [
1379
- FsBlockComponent,
1380
- FsBlockEditorComponent,
1381
- FsBlockEditorSidebarPanelDirective,
1382
- ],
1383
- declarations: [
1384
- FsBlockComponent,
1385
- FsBlockEditorComponent,
1386
- FsBlockEditorSidebarPanelDirective,
1387
- FsBlockEditorMarginDirective,
1388
- SidebarComponent,
1389
- ],
1390
- })
1391
- ], FsBlockEditorModule);
1392
1452
  return FsBlockEditorModule;
1393
- }());
1453
+ }());
1454
+ FsBlockEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1455
+ FsBlockEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1456
+ FsBlockEditorComponent,
1457
+ FsBlockEditorSidebarPanelDirective,
1458
+ FsBlockEditorMarginDirective,
1459
+ SidebarComponent,
1460
+ ArtboardComponent], imports: [i9.CommonModule,
1461
+ i12.FormsModule,
1462
+ i5.MatIconModule,
1463
+ i4.MatButtonModule,
1464
+ i11.MatInputModule,
1465
+ i6.MatFormFieldModule,
1466
+ i7.MatCheckboxModule,
1467
+ i10.MatTooltipModule,
1468
+ i3.FsFileModule,
1469
+ i8.FsColorPickerModule,
1470
+ menu.FsMenuModule,
1471
+ i2$1.FsZoomPanModule], exports: [FsBlockComponent,
1472
+ FsBlockEditorComponent,
1473
+ FsBlockEditorSidebarPanelDirective] });
1474
+ FsBlockEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, imports: [[
1475
+ i9.CommonModule,
1476
+ i12.FormsModule,
1477
+ i5.MatIconModule,
1478
+ i4.MatButtonModule,
1479
+ i11.MatInputModule,
1480
+ i6.MatFormFieldModule,
1481
+ i7.MatCheckboxModule,
1482
+ i10.MatTooltipModule,
1483
+ i3.FsFileModule,
1484
+ i8.FsColorPickerModule,
1485
+ menu.FsMenuModule,
1486
+ i2$1.FsZoomPanModule,
1487
+ ]] });
1488
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, decorators: [{
1489
+ type: i0.NgModule,
1490
+ args: [{
1491
+ imports: [
1492
+ i9.CommonModule,
1493
+ i12.FormsModule,
1494
+ i5.MatIconModule,
1495
+ i4.MatButtonModule,
1496
+ i11.MatInputModule,
1497
+ i6.MatFormFieldModule,
1498
+ i7.MatCheckboxModule,
1499
+ i10.MatTooltipModule,
1500
+ i3.FsFileModule,
1501
+ i8.FsColorPickerModule,
1502
+ menu.FsMenuModule,
1503
+ i2$1.FsZoomPanModule,
1504
+ ],
1505
+ exports: [
1506
+ FsBlockComponent,
1507
+ FsBlockEditorComponent,
1508
+ FsBlockEditorSidebarPanelDirective,
1509
+ ],
1510
+ declarations: [
1511
+ FsBlockComponent,
1512
+ FsBlockEditorComponent,
1513
+ FsBlockEditorSidebarPanelDirective,
1514
+ FsBlockEditorMarginDirective,
1515
+ SidebarComponent,
1516
+ ArtboardComponent,
1517
+ ],
1518
+ }]
1519
+ }] });
1520
+
1521
+ /**
1522
+ * Generated bundle index. Do not edit.
1523
+ */
1394
1524
 
1525
+ exports.BlockTypes = BlockTypes;
1395
1526
  exports.FsBlockComponent = FsBlockComponent;
1396
1527
  exports.FsBlockEditorComponent = FsBlockEditorComponent;
1397
1528
  exports.FsBlockEditorModule = FsBlockEditorModule;
1398
1529
  exports.FsBlockEditorSidebarPanelDirective = FsBlockEditorSidebarPanelDirective;
1399
- exports.ɵa = BlockEditorService;
1400
- exports.ɵb = FsBlockEditorMarginDirective;
1401
- exports.ɵc = SidebarComponent;
1402
1530
 
1403
1531
  Object.defineProperty(exports, '__esModule', { value: true });
1404
1532
 
1405
- })));
1533
+ }));
1406
1534
  //# sourceMappingURL=firestitch-block-editor.umd.js.map