@firestitch/block-editor 12.0.0 → 12.1.1

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