@firestitch/block-editor 12.1.2 → 12.1.5

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 -35
  2. package/app/components/block/block.component.d.ts +58 -58
  3. package/app/components/block-editor/block-editor.component.d.ts +28 -28
  4. package/app/components/sidebar/sidebar.component.d.ts +75 -75
  5. package/app/consts/block-types.const.d.ts +12 -12
  6. package/app/consts/index.d.ts +1 -1
  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 -11
  10. package/app/enums/index.d.ts +1 -1
  11. package/app/fs-block-editor.module.d.ts +26 -26
  12. package/app/interfaces/block-editor-config.d.ts +20 -20
  13. package/app/interfaces/block.d.ts +48 -48
  14. package/app/services/block-editor.service.d.ts +54 -54
  15. package/app/services/index.d.ts +1 -1
  16. package/bundles/firestitch-block-editor.umd.js +1519 -1506
  17. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  18. package/esm2015/app/components/artboard/artboard.component.js +128 -128
  19. package/esm2015/app/components/block/block.component.js +316 -316
  20. package/esm2015/app/components/block-editor/block-editor.component.js +84 -83
  21. package/esm2015/app/components/sidebar/sidebar.component.js +237 -237
  22. package/esm2015/app/consts/block-types.const.js +12 -12
  23. package/esm2015/app/consts/index.js +1 -1
  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 +12 -12
  27. package/esm2015/app/enums/index.js +1 -1
  28. package/esm2015/app/fs-block-editor.module.js +93 -93
  29. package/esm2015/app/interfaces/block-editor-config.js +1 -1
  30. package/esm2015/app/interfaces/block.js +1 -1
  31. package/esm2015/app/services/block-editor.service.js +245 -231
  32. package/esm2015/app/services/index.js +1 -1
  33. package/esm2015/firestitch-block-editor.js +4 -4
  34. package/esm2015/public_api.js +6 -6
  35. package/fesm2015/firestitch-block-editor.js +1067 -1053
  36. package/fesm2015/firestitch-block-editor.js.map +1 -1
  37. package/firestitch-block-editor.d.ts +5 -5
  38. package/package.json +1 -1
  39. package/public_api.d.ts +8 -8
@@ -39,1534 +39,1547 @@
39
39
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
40
40
  var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
41
41
 
42
- exports.BlockType = void 0;
43
- (function (BlockType) {
44
- BlockType["Rectangle"] = "rectangle";
45
- BlockType["ShortText"] = "shorttext";
46
- BlockType["LongText"] = "longtext";
47
- BlockType["Image"] = "image";
48
- BlockType["RadioButton"] = "radiobutton";
49
- BlockType["Checkbox"] = "checkbox";
50
- BlockType["Signature"] = "signature";
51
- BlockType["Pdf"] = "pdf";
52
- BlockType["Date"] = "date";
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
53
  })(exports.BlockType || (exports.BlockType = {}));
54
54
 
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;
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;
371
371
  }
372
372
 
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
- this._blockComponents.set(block, blockComponent);
607
- this.blockComponents.push(block);
608
- // Disabled for now
609
- // this.blockComponents.forEach((blockComponent: FsBlockComponent) => {
610
- // const blocks = this.elementGuidelines
611
- // .filter((el) => {
612
- // return !el.isSameNode(blockComponent.el);
613
- // });
614
- // blockComponent.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
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.guid; }).indexOf(block.guid);
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
+ this._blockComponents.set(block, blockComponent);
607
+ this.blockComponents.push(block);
608
+ // Disabled for now
609
+ // this.blockComponents.forEach((blockComponent: FsBlockComponent) => {
610
+ // const blocks = this.elementGuidelines
611
+ // .filter((el) => {
612
+ // return !el.isSameNode(blockComponent.el);
613
+ // });
614
+ // blockComponent.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 = width / 2;
629
+ if (block.type === exports.BlockType.Rectangle) {
630
+ block.borderColor = '#cccccc';
631
+ block.borderWidth = 1;
632
+ }
633
+ else if (block.type === exports.BlockType.Checkbox || block.type === exports.BlockType.RadioButton) {
634
+ width = .25;
635
+ height = .25;
636
+ }
637
+ else {
638
+ width = 2;
639
+ height = .5;
640
+ }
641
+ return this.sanitizeBlock(Object.assign({ top: height, left: width, width: width, height: height }, block));
642
+ };
643
+ BlockEditorService.prototype.sanitizeBlock = function (block) {
644
+ return Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || common.guid('xxxxxxxxxxxx') });
645
+ };
646
+ BlockEditorService.prototype.ngOnDestroy = function () {
647
+ this._destroy$.next();
648
+ this._destroy$.complete();
649
+ };
650
+ return BlockEditorService;
651
+ }());
652
+ BlockEditorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
653
+ BlockEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService });
654
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, decorators: [{
655
+ type: i0.Injectable
644
656
  }] });
645
657
 
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.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.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']
658
+ var FsBlockComponent = /** @class */ (function () {
659
+ function FsBlockComponent(_blockEditor, _elementRef, _cdRef) {
660
+ this._blockEditor = _blockEditor;
661
+ this._elementRef = _elementRef;
662
+ this._cdRef = _cdRef;
663
+ this.transformating = false;
664
+ this.BlockType = exports.BlockType;
665
+ this._editable = false;
666
+ this._transformable = false;
667
+ this._destroy$ = new rxjs.Subject();
668
+ }
669
+ Object.defineProperty(FsBlockComponent.prototype, "el", {
670
+ get: function () {
671
+ return this.element.nativeElement;
672
+ },
673
+ enumerable: false,
674
+ configurable: true
675
+ });
676
+ Object.defineProperty(FsBlockComponent.prototype, "moveable", {
677
+ get: function () {
678
+ return this._moveable;
679
+ },
680
+ enumerable: false,
681
+ configurable: true
682
+ });
683
+ Object.defineProperty(FsBlockComponent.prototype, "editable", {
684
+ get: function () {
685
+ return this._editable;
686
+ },
687
+ set: function (value) {
688
+ this._editable = value;
689
+ if (!value) {
690
+ this.deselectContent();
691
+ }
692
+ },
693
+ enumerable: false,
694
+ configurable: true
695
+ });
696
+ Object.defineProperty(FsBlockComponent.prototype, "elementGuidelines", {
697
+ set: function (value) {
698
+ this.moveable.elementGuidelines = value;
699
+ },
700
+ enumerable: false,
701
+ configurable: true
702
+ });
703
+ Object.defineProperty(FsBlockComponent.prototype, "clippable", {
704
+ set: function (value) {
705
+ this.moveable.clippable = value;
706
+ },
707
+ enumerable: false,
708
+ configurable: true
709
+ });
710
+ Object.defineProperty(FsBlockComponent.prototype, "transformable", {
711
+ get: function () {
712
+ return this._transformable;
713
+ },
714
+ set: function (value) {
715
+ this._transformable = value;
716
+ this.moveable.draggable = value;
717
+ this.moveable.resizable = value;
718
+ this.moveable.roundable = value;
719
+ this.moveable.rotatable = value;
720
+ },
721
+ enumerable: false,
722
+ configurable: true
723
+ });
724
+ Object.defineProperty(FsBlockComponent.prototype, "width", {
725
+ set: function (value) {
726
+ this.element.nativeElement.style.width = "" + parseFloat(value) + this.unit;
727
+ this.moveable.updateRect();
728
+ },
729
+ enumerable: false,
730
+ configurable: true
731
+ });
732
+ Object.defineProperty(FsBlockComponent.prototype, "height", {
733
+ set: function (value) {
734
+ this.element.nativeElement.style.height = "" + parseFloat(value) + this.unit;
735
+ this.moveable.updateRect();
736
+ },
737
+ enumerable: false,
738
+ configurable: true
739
+ });
740
+ Object.defineProperty(FsBlockComponent.prototype, "top", {
741
+ set: function (value) {
742
+ this.element.nativeElement.style.top = "" + parseFloat(value) + this.unit;
743
+ this.moveable.updateRect();
744
+ },
745
+ enumerable: false,
746
+ configurable: true
747
+ });
748
+ Object.defineProperty(FsBlockComponent.prototype, "left", {
749
+ set: function (value) {
750
+ this.element.nativeElement.style.left = "" + parseFloat(value) + this.unit;
751
+ this.moveable.updateRect();
752
+ },
753
+ enumerable: false,
754
+ configurable: true
755
+ });
756
+ Object.defineProperty(FsBlockComponent.prototype, "rotate", {
757
+ set: function (value) {
758
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
759
+ this.moveable.updateRect();
760
+ },
761
+ enumerable: false,
762
+ configurable: true
763
+ });
764
+ Object.defineProperty(FsBlockComponent.prototype, "index", {
765
+ set: function (value) {
766
+ this.block.index = value;
767
+ },
768
+ enumerable: false,
769
+ configurable: true
770
+ });
771
+ Object.defineProperty(FsBlockComponent.prototype, "keepRatio", {
772
+ set: function (value) {
773
+ this.moveable.keepRatio = value;
774
+ },
775
+ enumerable: false,
776
+ configurable: true
777
+ });
778
+ FsBlockComponent.prototype.markForCheck = function () {
779
+ this._cdRef.markForCheck();
780
+ };
781
+ FsBlockComponent.prototype.ngOnInit = function () {
782
+ var _this = this;
783
+ this.unit = this._blockEditor.config.unit;
784
+ this.content = this.block.content;
785
+ this._blockEditor.blockChanged$
786
+ .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
787
+ .subscribe(function (block) {
788
+ _this.keepRatio = block.keepRatio;
789
+ _this.width = block.width;
790
+ _this.height = block.height;
791
+ _this.top = block.top;
792
+ _this.left = block.left;
793
+ _this._cdRef.markForCheck();
794
+ });
795
+ };
796
+ FsBlockComponent.prototype.ngAfterContentInit = function () {
797
+ var _this = this;
798
+ setTimeout(function () {
799
+ _this._initEvents();
800
+ _this._initMoveable();
801
+ _this._setTransform();
802
+ _this.width = _this.block.width;
803
+ _this.height = _this.block.height;
804
+ _this.top = _this.block.top;
805
+ _this.left = _this.block.left;
806
+ _this._blockEditor.registerBlock(_this.block, _this);
807
+ });
808
+ };
809
+ FsBlockComponent.prototype.pxToIn = function (px) {
810
+ return this.round(px / 96, 2);
811
+ };
812
+ FsBlockComponent.prototype.round = function (value, decimals) {
813
+ return parseFloat(value.toFixed(decimals));
814
+ };
815
+ FsBlockComponent.prototype.deselect = function () {
816
+ this.transformable = false;
817
+ this.editable = false;
818
+ };
819
+ FsBlockComponent.prototype.deselectContent = function () {
820
+ if (window.getSelection) {
821
+ if (window.getSelection().empty) {
822
+ window.getSelection().empty();
823
+ }
824
+ else if (window.getSelection().removeAllRanges) {
825
+ window.getSelection().removeAllRanges();
826
+ }
827
+ }
828
+ };
829
+ FsBlockComponent.prototype.selectAll = function () {
830
+ var range = document.createRange();
831
+ range.selectNodeContents(this.contentEditable.nativeElement);
832
+ var sel = window.getSelection();
833
+ sel.removeAllRanges();
834
+ sel.addRange(range);
835
+ };
836
+ FsBlockComponent.prototype.ngOnDestroy = function () {
837
+ this._blockEditor.unregisterBlock(this.block);
838
+ this._destroy$.next();
839
+ this._destroy$.complete();
840
+ };
841
+ FsBlockComponent.prototype._setTransform = function (transforms) {
842
+ if (transforms === void 0) { transforms = []; }
843
+ transforms = transforms !== null && transforms !== void 0 ? transforms : [];
844
+ if (this.block.rotate) {
845
+ transforms.push("rotate(" + this.block.rotate + "deg)");
846
+ }
847
+ this.el.style.transform = transforms.join(' ');
848
+ };
849
+ FsBlockComponent.prototype._triggerChanged = function () {
850
+ this._blockEditor.blockChange(this.block);
851
+ };
852
+ FsBlockComponent.prototype._initMoveable = function () {
853
+ var _this = this;
854
+ this._moveable = new Moveable__default["default"](this._elementRef.nativeElement, {
855
+ target: this.el,
856
+ container: this._blockEditor.container,
857
+ draggable: false,
858
+ resizable: false,
859
+ scalable: false,
860
+ rotatable: false,
861
+ warpable: false,
862
+ origin: false,
863
+ keepRatio: this.block.keepRatio,
864
+ snappable: true,
865
+ edge: false,
866
+ throttleDrag: 1,
867
+ throttleScale: 0.01,
868
+ throttleRotate: 1,
869
+ throttleResize: 1,
870
+ });
871
+ this.moveable
872
+ .on('clip', function (e) {
873
+ _this.block.clipPath = e.clipStyle;
874
+ e.target.style.clipPath = e.clipStyle;
875
+ _this._triggerChanged();
876
+ });
877
+ this.moveable
878
+ .on('dragStart', function () {
879
+ _this.editable = false;
880
+ _this.transformating = true;
881
+ _this._cdRef.markForCheck();
882
+ })
883
+ .on('drag', function (_a) {
884
+ var target = _a.target, left = _a.left, top = _a.top;
885
+ target.style.left = _this.pxToIn(left) + _this.unit;
886
+ target.style.top = _this.pxToIn(top) + _this.unit;
887
+ _this.block.top = _this.pxToIn(top);
888
+ _this.block.left = _this.pxToIn(left);
889
+ _this._triggerChanged();
890
+ })
891
+ .on('dragEnd', function () {
892
+ _this.transformating = false;
893
+ _this._cdRef.markForCheck();
894
+ })
895
+ .on('resizeStart', function () {
896
+ _this.editable = false;
897
+ _this.zoompan.disable();
898
+ _this.transformating = true;
899
+ _this._cdRef.markForCheck();
900
+ })
901
+ .on('resize', function (_a) {
902
+ var target = _a.target, width = _a.width, height = _a.height, dist = _a.dist, delta = _a.delta, direction = _a.direction;
903
+ width = _this.pxToIn(width);
904
+ height = _this.pxToIn(height);
905
+ if (delta[0]) {
906
+ _this.block.width = width;
907
+ target.style.width = width + _this.unit;
908
+ }
909
+ if (delta[1]) {
910
+ _this.block.height = height;
911
+ target.style.height = height + _this.unit;
912
+ }
913
+ var transform = [0, 0];
914
+ if (direction[1] === -1) {
915
+ transform[1] = dist[1] * -1;
916
+ }
917
+ if (direction[0] === -1) {
918
+ transform[0] = dist[0] * -1;
919
+ }
920
+ _this._setTransform(["translate(" + transform[0] + "px, " + transform[1] + "px)"]);
921
+ _this._triggerChanged();
922
+ })
923
+ .on('resizeEnd', function (_a) {
924
+ var target = _a.target;
925
+ var matrix = new WebKitCSSMatrix(target.style.transform);
926
+ _this.block.top = parseFloat(target.style.top) + _this.pxToIn(matrix.m42);
927
+ _this.block.left = parseFloat(target.style.left) + _this.pxToIn(matrix.m41);
928
+ target.style.top = _this.block.top + _this.unit;
929
+ target.style.left = _this.block.left + _this.unit;
930
+ _this._setTransform();
931
+ _this._triggerChanged();
932
+ _this.zoompan.enable();
933
+ _this.transformating = false;
934
+ _this._cdRef.markForCheck();
935
+ })
936
+ .on('rotateStart', function () {
937
+ _this.zoompan.disable();
938
+ _this.editable = false;
939
+ _this._rotateStart = _this.block.rotate || 0;
940
+ _this.transformating = true;
941
+ _this._cdRef.markForCheck();
942
+ })
943
+ .on('rotate', function (_a) {
944
+ var rotate = _a.rotate, transform = _a.transform;
945
+ _this.block.rotate = _this._rotateStart + rotate;
946
+ _this.el.style.transform = transform;
947
+ _this._triggerChanged();
948
+ _this.zoompan.enable();
949
+ })
950
+ .on('rotateEnd', function () {
951
+ _this.transformating = false;
952
+ _this._cdRef.markForCheck();
953
+ });
954
+ };
955
+ FsBlockComponent.prototype._initEvents = function () {
956
+ var _this = this;
957
+ rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
958
+ .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
959
+ _this.block.content = event.target.innerHTML;
960
+ _this._triggerChanged();
961
+ });
962
+ rxjs.fromEvent(this.el, 'mousedown')
963
+ .pipe(operators.takeUntil(this._destroy$), operators.filter(function () { return !_this.block.readonly; })).subscribe(function (event) {
964
+ _this.zoompan.disable();
965
+ if (_this.editable) {
966
+ if (_this.contentElement.nativeElement.isSameNode(event.target)) {
967
+ event.preventDefault();
968
+ event.stopImmediatePropagation();
969
+ event.stopPropagation();
970
+ }
971
+ }
972
+ else {
973
+ _this._blockEditor.selectedBlock = _this.block;
974
+ }
975
+ });
976
+ rxjs.fromEvent(this.el, 'mouseup')
977
+ .pipe(operators.takeUntil(this._destroy$), operators.filter(function () { return !_this.block.readonly; })).subscribe(function () {
978
+ _this.zoompan.enable();
979
+ });
980
+ rxjs.fromEvent(this.el, 'dblclick')
981
+ .pipe(operators.filter(function () { return (!_this.editable); }), operators.takeUntil(this._destroy$))
982
+ .subscribe(function (event) {
983
+ if (_this.block.readonly) {
984
+ event.preventDefault();
985
+ }
986
+ else {
987
+ _this.editable = true;
988
+ _this._cdRef.markForCheck();
989
+ setTimeout(function () {
990
+ _this.selectAll();
991
+ });
992
+ }
993
+ });
994
+ };
995
+ return FsBlockComponent;
996
+ }());
997
+ 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 });
998
+ 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.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.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 solid transparent;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: 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 });
999
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
1000
+ type: i0.Component,
1001
+ args: [{
1002
+ selector: 'fs-block',
1003
+ templateUrl: 'block.component.html',
1004
+ styleUrls: ['block.component.scss'],
1005
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1006
+ }]
1007
+ }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { element: [{
1008
+ type: i0.ViewChild,
1009
+ args: ['element', { static: true }]
1010
+ }], contentElement: [{
1011
+ type: i0.ViewChild,
1012
+ args: ['contentElement', { static: true }]
1013
+ }], contentEditable: [{
1014
+ type: i0.ViewChild,
1015
+ args: ['contentEditable', { static: true }]
1016
+ }], block: [{
1017
+ type: i0.Input
1018
+ }], html: [{
1019
+ type: i0.Input
1020
+ }], zoompan: [{
1021
+ type: i0.Input
1022
+ }], transformating: [{
1023
+ type: i0.HostBinding,
1024
+ args: ['class.transforming']
1013
1025
  }] } });
1014
1026
 
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
1027
+ var FsBlockEditorSidebarPanelDirective = /** @class */ (function () {
1028
+ function FsBlockEditorSidebarPanelDirective(templateRef) {
1029
+ this.templateRef = templateRef;
1030
+ this.show = true;
1031
+ }
1032
+ return FsBlockEditorSidebarPanelDirective;
1033
+ }());
1034
+ 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 });
1035
+ 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 });
1036
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, decorators: [{
1037
+ type: i0.Directive,
1038
+ args: [{
1039
+ selector: '[fsBlockEditorSidebarPanel]'
1040
+ }]
1041
+ }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }]; }, propDecorators: { label: [{
1042
+ type: i0.Input
1043
+ }], show: [{
1044
+ type: i0.Input
1033
1045
  }] } });
1034
1046
 
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' },
1047
+ var BlockTypes = [
1048
+ { value: exports.BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4' },
1049
+ { value: exports.BlockType.ShortText, name: 'Short Text', icon: 'short_text' },
1050
+ { value: exports.BlockType.LongText, name: 'Long Text', icon: 'subject' },
1051
+ { value: exports.BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked' },
1052
+ { value: exports.BlockType.Checkbox, name: 'Checkbox', icon: 'check_box' },
1053
+ { value: exports.BlockType.Date, name: 'Date', icon: 'calendar_today' },
1054
+ { value: exports.BlockType.Signature, name: 'Signature', icon: 'draw' },
1055
+ { value: exports.BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*' },
1056
+ { value: exports.BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf' },
1045
1057
  ];
1046
1058
 
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.zoomCenter = new i0.EventEmitter();
1054
- this.BlockTypes = BlockTypes;
1055
- this.blockTypeNames = common.index(BlockTypes, 'value', 'name');
1056
- this.BlockType = exports.BlockType;
1057
- this._destroy$ = new rxjs.Subject();
1058
- }
1059
- Object.defineProperty(SidebarComponent.prototype, "el", {
1060
- get: function () {
1061
- return this._el.nativeElement;
1062
- },
1063
- enumerable: false,
1064
- configurable: true
1065
- });
1066
- SidebarComponent.prototype.ngOnInit = function () {
1067
- var _this = this;
1068
- this._blockEditor.selectedBlocks$
1069
- .pipe(operators.takeUntil(this._destroy$))
1070
- .subscribe(function (blocks) {
1071
- _this.clippable = false;
1072
- _this.block = blocks[0] ? blocks[0] : null;
1073
- _this._cdRef.markForCheck();
1074
- });
1075
- this._blockEditor.blockChanged$
1076
- .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
1077
- .subscribe(function () {
1078
- _this._cdRef.markForCheck();
1079
- });
1080
- };
1081
- SidebarComponent.prototype.verticalAlignClick = function (value) {
1082
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
1083
- };
1084
- SidebarComponent.prototype.boldClick = function () {
1085
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
1086
- };
1087
- SidebarComponent.prototype.fontColorChange = function (value) {
1088
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
1089
- };
1090
- SidebarComponent.prototype.lineHeightChange = function (value) {
1091
- value = this.validNumeric(value) ? value : null;
1092
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'lineHeight');
1093
- };
1094
- SidebarComponent.prototype.fontSizeChange = function (value) {
1095
- value = this.validNumeric(value) ? value : null;
1096
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontSize');
1097
- };
1098
- SidebarComponent.prototype.borderWidthChange = function (value) {
1099
- value = this.validNumeric(value) ? value : null;
1100
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderWidth');
1101
- };
1102
- SidebarComponent.prototype.italicClick = function () {
1103
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
1104
- };
1105
- SidebarComponent.prototype.underlineClick = function () {
1106
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
1107
- };
1108
- SidebarComponent.prototype.backgroundColorChange = function (value) {
1109
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
1110
- };
1111
- SidebarComponent.prototype.widthChange = function (value) {
1112
- value = this.validNumeric(value) ? value : null;
1113
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'width');
1114
- };
1115
- SidebarComponent.prototype.heightChange = function (value) {
1116
- value = this.validNumeric(value) ? value : null;
1117
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'height');
1118
- };
1119
- SidebarComponent.prototype.topChange = function (value) {
1120
- value = this.validNumeric(value) ? value : null;
1121
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'top');
1122
- };
1123
- SidebarComponent.prototype.leftChange = function (value) {
1124
- value = this.validNumeric(value) ? value : null;
1125
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'left');
1126
- };
1127
- SidebarComponent.prototype.rotateChange = function (value) {
1128
- value = this.validNumeric(value) ? value : null;
1129
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'rotate');
1130
- };
1131
- SidebarComponent.prototype.paddingChange = function (name, value) {
1132
- value = this.validNumeric(value) ? value : null;
1133
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'padding');
1134
- };
1135
- SidebarComponent.prototype.paddingAllChange = function (value) {
1136
- value = this.validNumeric(value) ? value : null;
1137
- this.block.paddingTop = value;
1138
- this.block.paddingLeft = value;
1139
- this.block.paddingBottom = value;
1140
- this.block.paddingRight = value;
1141
- this.paddingChange('top', value);
1142
- this.paddingChange('left', value);
1143
- this.paddingChange('right', value);
1144
- this.paddingChange('bottom', value);
1145
- };
1146
- SidebarComponent.prototype.borderColorChange = function (value) {
1147
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
1148
- };
1149
- SidebarComponent.prototype.toggleKeepRatio = function () {
1150
- this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
1151
- };
1152
- SidebarComponent.prototype.horizontalAlignClick = function (value) {
1153
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
1154
- };
1155
- SidebarComponent.prototype.shapeRound = function (name) {
1156
- var value = this.block[name] === 'round' ? 'square' : 'round';
1157
- this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1158
- };
1159
- SidebarComponent.prototype.imageRemove = function () {
1160
- this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
1161
- };
1162
- SidebarComponent.prototype.imageClip = function () {
1163
- this.clippable = !this.clippable;
1164
- this._blockEditor.selectedBlockComponentChangeProperty(this.clippable, 'clippable');
1165
- };
1166
- SidebarComponent.prototype.shapeRadiusChange = function (value) {
1167
- this._blockEditor.selectedBlockComponentChangeProperty(value, 'shapeRadius');
1168
- };
1169
- SidebarComponent.prototype.blockChangeProperty = function (value, name) {
1170
- this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1171
- };
1172
- SidebarComponent.prototype.imageSelect = function (fsFile) {
1173
- var _this = this;
1174
- if (this.config.imageUpload) {
1175
- this.config.imageUpload(fsFile.file)
1176
- .subscribe(function (value) {
1177
- _this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
1178
- });
1179
- }
1180
- };
1181
- SidebarComponent.prototype.blockRemoveClick = function () {
1182
- var _this = this;
1183
- if (this.config.blocksRemove) {
1184
- this._prompt.confirm({
1185
- title: 'Confirm',
1186
- template: 'Are you sure your would like to delete this block?',
1187
- })
1188
- .pipe(operators.switchMap(function () { return _this.config.blocksRemove(_this._blockEditor.selectedBlocks); }), operators.takeUntil(this._destroy$))
1189
- .subscribe(function () {
1190
- _this._blockEditor.removeSelectedBlocks();
1191
- });
1192
- }
1193
- };
1194
- SidebarComponent.prototype.blockUpload = function (blockType, fsFile) {
1195
- var block = this._blockEditor.sanitizeNewBlock({
1196
- type: blockType,
1197
- });
1198
- this._blockEditor.blockUpload(block, fsFile);
1199
- };
1200
- SidebarComponent.prototype.blockAdd = function (type) {
1201
- if (type === exports.BlockType.Pdf || type === exports.BlockType.Image) {
1202
- return;
1203
- }
1204
- var block = this._blockEditor.sanitizeNewBlock({
1205
- type: type,
1206
- });
1207
- this._blockEditor.blockAdd(block);
1208
- };
1209
- SidebarComponent.prototype.layerMove = function (direction) {
1210
- var _this = this;
1211
- this._blockEditor.blockComponents.forEach(function (blockComponent) {
1212
- if (_this._blockEditor.isSelectedBlock(blockComponent)) {
1213
- blockComponent.block.index += (999 * direction);
1214
- }
1215
- });
1216
- var sorted = this._blockEditor.blockComponents.sort(function (a, b) {
1217
- return a.block.index > b.block.index ? 1 : -1;
1218
- });
1219
- sorted.forEach(function (item, index) {
1220
- item.block.index = index;
1221
- item.markForCheck();
1222
- });
1223
- if (this.config.blocksLevelChanged) {
1224
- this.config.blocksLevelChanged(sorted.map(function (item) { return item.block; }));
1225
- }
1226
- };
1227
- SidebarComponent.prototype.layerUp = function () {
1228
- this.layerMove(1);
1229
- };
1230
- SidebarComponent.prototype.layerDown = function () {
1231
- this.layerMove(-1);
1232
- };
1233
- SidebarComponent.prototype.blockChanged = function (block) {
1234
- if (this.config.blockChanged) {
1235
- this.config.blockChanged(block);
1236
- }
1237
- };
1238
- SidebarComponent.prototype.inputFocus = function (event) {
1239
- event.target.select();
1240
- };
1241
- SidebarComponent.prototype.ngOnDestroy = function () {
1242
- this._destroy$.next();
1243
- this._destroy$.complete();
1244
- };
1245
- SidebarComponent.prototype.validNumeric = function (value) {
1246
- return !value || !!String(value).match(/^\d*\.?\d*$/);
1247
- };
1248
- return SidebarComponent;
1249
- }());
1250
- 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 });
1251
- SidebarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, outputs: { zoomCenter: "zoomCenter" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0__namespace, template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container> \n <ng-container *ngSwitchDefault>\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [accept]=\"blockType.accept\">\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </fs-file>\n </ng-template>\n\n <ng-template #addButton>\n <button \n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n </ng-template>\n </ng-container>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n matTooltip=\"Reset zoom\"\n (click)=\"zoomCenter.emit()\">\n <mat-icon>crop_free</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\"> \n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\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.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'label')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.Checkbox && block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <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 || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n \n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <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\n <mat-checkbox \n name=\"readonly\" \n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockChangeProperty($event, 'readonly')\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"block.type !== BlockType.Pdf\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"imageSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n", styles: [".sidebar{width:285px;font-size:14px;height:100%;overflow:auto}.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.form-field-panel .form-field-options{margin-top:11px}.sidebar .sidebar-panel.form-field-panel .form-field-options mat-checkbox{display:block}.sidebar .sidebar-panel.form-field-panel .form-field-options mat-checkbox+mat-checkbox{margin-top:2px}.sidebar .sidebar-panel.info-panel .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}:host ::ng-deep .mat-form-field-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], components: [{ type: i3__namespace.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 });
1252
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, decorators: [{
1253
- type: i0.Component,
1254
- args: [{
1255
- selector: 'sidebar',
1256
- templateUrl: 'sidebar.component.html',
1257
- styleUrls: ['sidebar.component.scss'],
1258
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1259
- }]
1260
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace.FsPrompt }]; }, propDecorators: { sidebarPanels: [{
1261
- type: i0.ContentChildren,
1262
- args: [FsBlockEditorSidebarPanelDirective]
1263
- }], config: [{
1264
- type: i0.Input
1265
- }], blocks: [{
1266
- type: i0.Input
1267
- }], zoomCenter: [{
1268
- type: i0.Output
1059
+ var SidebarComponent = /** @class */ (function () {
1060
+ function SidebarComponent(_el, _blockEditor, _cdRef, _prompt) {
1061
+ this._el = _el;
1062
+ this._blockEditor = _blockEditor;
1063
+ this._cdRef = _cdRef;
1064
+ this._prompt = _prompt;
1065
+ this.zoomCenter = new i0.EventEmitter();
1066
+ this.BlockTypes = BlockTypes;
1067
+ this.blockTypeNames = common.index(BlockTypes, 'value', 'name');
1068
+ this.BlockType = exports.BlockType;
1069
+ this._destroy$ = new rxjs.Subject();
1070
+ }
1071
+ Object.defineProperty(SidebarComponent.prototype, "el", {
1072
+ get: function () {
1073
+ return this._el.nativeElement;
1074
+ },
1075
+ enumerable: false,
1076
+ configurable: true
1077
+ });
1078
+ SidebarComponent.prototype.ngOnInit = function () {
1079
+ var _this = this;
1080
+ this._blockEditor.selectedBlocks$
1081
+ .pipe(operators.takeUntil(this._destroy$))
1082
+ .subscribe(function (blocks) {
1083
+ _this.clippable = false;
1084
+ _this.block = blocks[0] ? blocks[0] : null;
1085
+ _this._cdRef.markForCheck();
1086
+ });
1087
+ this._blockEditor.blockChanged$
1088
+ .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
1089
+ .subscribe(function () {
1090
+ _this._cdRef.markForCheck();
1091
+ });
1092
+ };
1093
+ SidebarComponent.prototype.verticalAlignClick = function (value) {
1094
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
1095
+ };
1096
+ SidebarComponent.prototype.boldClick = function () {
1097
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
1098
+ };
1099
+ SidebarComponent.prototype.fontColorChange = function (value) {
1100
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
1101
+ };
1102
+ SidebarComponent.prototype.lineHeightChange = function (value) {
1103
+ value = this.validNumeric(value) ? value : null;
1104
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'lineHeight');
1105
+ };
1106
+ SidebarComponent.prototype.fontSizeChange = function (value) {
1107
+ value = this.validNumeric(value) ? value : null;
1108
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontSize');
1109
+ };
1110
+ SidebarComponent.prototype.borderWidthChange = function (value) {
1111
+ value = this.validNumeric(value) ? value : null;
1112
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderWidth');
1113
+ };
1114
+ SidebarComponent.prototype.italicClick = function () {
1115
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
1116
+ };
1117
+ SidebarComponent.prototype.underlineClick = function () {
1118
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
1119
+ };
1120
+ SidebarComponent.prototype.backgroundColorChange = function (value) {
1121
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
1122
+ };
1123
+ SidebarComponent.prototype.widthChange = function (value) {
1124
+ value = this.validNumeric(value) ? value : null;
1125
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'width');
1126
+ };
1127
+ SidebarComponent.prototype.heightChange = function (value) {
1128
+ value = this.validNumeric(value) ? value : null;
1129
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'height');
1130
+ };
1131
+ SidebarComponent.prototype.topChange = function (value) {
1132
+ value = this.validNumeric(value) ? value : null;
1133
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'top');
1134
+ };
1135
+ SidebarComponent.prototype.leftChange = function (value) {
1136
+ value = this.validNumeric(value) ? value : null;
1137
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'left');
1138
+ };
1139
+ SidebarComponent.prototype.rotateChange = function (value) {
1140
+ value = this.validNumeric(value) ? value : null;
1141
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'rotate');
1142
+ };
1143
+ SidebarComponent.prototype.paddingChange = function (name, value) {
1144
+ value = this.validNumeric(value) ? value : null;
1145
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'padding');
1146
+ };
1147
+ SidebarComponent.prototype.paddingAllChange = function (value) {
1148
+ value = this.validNumeric(value) ? value : null;
1149
+ this.block.paddingTop = value;
1150
+ this.block.paddingLeft = value;
1151
+ this.block.paddingBottom = value;
1152
+ this.block.paddingRight = value;
1153
+ this.paddingChange('top', value);
1154
+ this.paddingChange('left', value);
1155
+ this.paddingChange('right', value);
1156
+ this.paddingChange('bottom', value);
1157
+ };
1158
+ SidebarComponent.prototype.borderColorChange = function (value) {
1159
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
1160
+ };
1161
+ SidebarComponent.prototype.toggleKeepRatio = function () {
1162
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
1163
+ };
1164
+ SidebarComponent.prototype.horizontalAlignClick = function (value) {
1165
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
1166
+ };
1167
+ SidebarComponent.prototype.shapeRound = function (name) {
1168
+ var value = this.block[name] === 'round' ? 'square' : 'round';
1169
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1170
+ };
1171
+ SidebarComponent.prototype.imageRemove = function () {
1172
+ this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
1173
+ };
1174
+ SidebarComponent.prototype.imageClip = function () {
1175
+ this.clippable = !this.clippable;
1176
+ this._blockEditor.selectedBlockComponentChangeProperty(this.clippable, 'clippable');
1177
+ };
1178
+ SidebarComponent.prototype.shapeRadiusChange = function (value) {
1179
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'shapeRadius');
1180
+ };
1181
+ SidebarComponent.prototype.blockChangeProperty = function (value, name) {
1182
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1183
+ };
1184
+ SidebarComponent.prototype.imageSelect = function (fsFile) {
1185
+ var _this = this;
1186
+ if (this.config.imageUpload) {
1187
+ this.config.imageUpload(fsFile.file)
1188
+ .subscribe(function (value) {
1189
+ _this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
1190
+ });
1191
+ }
1192
+ };
1193
+ SidebarComponent.prototype.blockRemoveClick = function () {
1194
+ var _this = this;
1195
+ if (this.config.blocksRemove) {
1196
+ this._prompt.confirm({
1197
+ title: 'Confirm',
1198
+ template: 'Are you sure your would like to delete this block?',
1199
+ })
1200
+ .pipe(operators.switchMap(function () { return _this.config.blocksRemove(_this._blockEditor.selectedBlocks); }), operators.takeUntil(this._destroy$))
1201
+ .subscribe(function () {
1202
+ _this._blockEditor.removeSelectedBlocks();
1203
+ });
1204
+ }
1205
+ };
1206
+ SidebarComponent.prototype.blockUpload = function (blockType, fsFile) {
1207
+ var block = this._blockEditor.sanitizeNewBlock({
1208
+ type: blockType,
1209
+ });
1210
+ this._blockEditor.blockUpload(block, fsFile);
1211
+ };
1212
+ SidebarComponent.prototype.blockAdd = function (type) {
1213
+ if (type === exports.BlockType.Pdf || type === exports.BlockType.Image) {
1214
+ return;
1215
+ }
1216
+ var block = this._blockEditor.sanitizeNewBlock({
1217
+ type: type,
1218
+ });
1219
+ this._blockEditor.blockAdd(block);
1220
+ };
1221
+ SidebarComponent.prototype.layerMove = function (direction) {
1222
+ var _this = this;
1223
+ this._blockEditor.blockComponents.forEach(function (blockComponent) {
1224
+ if (_this._blockEditor.isSelectedBlock(blockComponent)) {
1225
+ blockComponent.block.index += (999 * direction);
1226
+ }
1227
+ });
1228
+ var sorted = this._blockEditor.blockComponents.sort(function (a, b) {
1229
+ return a.block.index > b.block.index ? 1 : -1;
1230
+ });
1231
+ sorted.forEach(function (item, index) {
1232
+ item.block.index = index;
1233
+ item.markForCheck();
1234
+ });
1235
+ if (this.config.blocksLevelChanged) {
1236
+ this.config.blocksLevelChanged(sorted.map(function (item) { return item.block; }));
1237
+ }
1238
+ };
1239
+ SidebarComponent.prototype.layerUp = function () {
1240
+ this.layerMove(1);
1241
+ };
1242
+ SidebarComponent.prototype.layerDown = function () {
1243
+ this.layerMove(-1);
1244
+ };
1245
+ SidebarComponent.prototype.blockChanged = function (block) {
1246
+ if (this.config.blockChanged) {
1247
+ this.config.blockChanged(block);
1248
+ }
1249
+ };
1250
+ SidebarComponent.prototype.inputFocus = function (event) {
1251
+ event.target.select();
1252
+ };
1253
+ SidebarComponent.prototype.ngOnDestroy = function () {
1254
+ this._destroy$.next();
1255
+ this._destroy$.complete();
1256
+ };
1257
+ SidebarComponent.prototype.validNumeric = function (value) {
1258
+ return !value || !!String(value).match(/^\d*\.?\d*$/);
1259
+ };
1260
+ return SidebarComponent;
1261
+ }());
1262
+ 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 });
1263
+ SidebarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, outputs: { zoomCenter: "zoomCenter" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0__namespace, template: "<div class=\"sidebar\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container> \n <ng-container *ngSwitchDefault>\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [accept]=\"blockType.accept\">\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </fs-file>\n </ng-template>\n\n <ng-template #addButton>\n <button \n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n </ng-template>\n </ng-container>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n matTooltip=\"Reset zoom\"\n (click)=\"zoomCenter.emit()\">\n <mat-icon>crop_free</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\"> \n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\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.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'label')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.Checkbox && block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <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 || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n \n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <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\n <mat-checkbox \n name=\"readonly\" \n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockChangeProperty($event, 'readonly')\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"block.type !== BlockType.Pdf\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"imageSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n", styles: [".sidebar{width:285px;font-size:14px;height:100%;overflow:auto;background-color:#fff;padding:0 10px 10px;box-shadow:-1px 1px 4px 3px #0003;z-index:1;position:relative;box-sizing:border-box}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.form-field-panel mat-form-field+mat-form-field{margin-top:12px}.sidebar .sidebar-panel.form-field-panel .form-field-options{margin-top:11px}.sidebar .sidebar-panel.form-field-panel .form-field-options mat-checkbox{display:block}.sidebar .sidebar-panel.form-field-panel .form-field-options mat-checkbox+mat-checkbox{margin-top:2px}.sidebar .sidebar-panel.info-panel .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}:host ::ng-deep .mat-form-field-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], components: [{ type: i3__namespace.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 });
1264
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, decorators: [{
1265
+ type: i0.Component,
1266
+ args: [{
1267
+ selector: 'sidebar',
1268
+ templateUrl: 'sidebar.component.html',
1269
+ styleUrls: ['sidebar.component.scss'],
1270
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1271
+ }]
1272
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace.FsPrompt }]; }, propDecorators: { sidebarPanels: [{
1273
+ type: i0.ContentChildren,
1274
+ args: [FsBlockEditorSidebarPanelDirective]
1275
+ }], config: [{
1276
+ type: i0.Input
1277
+ }], blocks: [{
1278
+ type: i0.Input
1279
+ }], zoomCenter: [{
1280
+ type: i0.Output
1269
1281
  }] } });
1270
1282
 
1271
- var FsBlockEditorMarginDirective = /** @class */ (function () {
1272
- function FsBlockEditorMarginDirective(_elementRef) {
1273
- this._elementRef = _elementRef;
1274
- }
1275
- Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
1276
- get: function () {
1277
- return this._elementRef.nativeElement;
1278
- },
1279
- enumerable: false,
1280
- configurable: true
1281
- });
1282
- return FsBlockEditorMarginDirective;
1283
- }());
1284
- 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 });
1285
- FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
1286
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
1287
- type: i0.Directive,
1288
- args: [{
1289
- selector: '[fsBlockEditorMargin]'
1290
- }]
1283
+ var FsBlockEditorMarginDirective = /** @class */ (function () {
1284
+ function FsBlockEditorMarginDirective(_elementRef) {
1285
+ this._elementRef = _elementRef;
1286
+ }
1287
+ Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
1288
+ get: function () {
1289
+ return this._elementRef.nativeElement;
1290
+ },
1291
+ enumerable: false,
1292
+ configurable: true
1293
+ });
1294
+ return FsBlockEditorMarginDirective;
1295
+ }());
1296
+ 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 });
1297
+ FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
1298
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
1299
+ type: i0.Directive,
1300
+ args: [{
1301
+ selector: '[fsBlockEditorMargin]'
1302
+ }]
1291
1303
  }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
1292
1304
 
1293
- var ArtboardComponent = /** @class */ (function () {
1294
- function ArtboardComponent(_el, _blockEditor, _cdRef, _differs) {
1295
- this._el = _el;
1296
- this._blockEditor = _blockEditor;
1297
- this._cdRef = _cdRef;
1298
- this._differs = _differs;
1299
- this.blocks = [];
1300
- this._destroy$ = new rxjs.Subject();
1301
- this._differ = _differs.find([]).create(null);
1302
- }
1303
- Object.defineProperty(ArtboardComponent.prototype, "el", {
1304
- get: function () {
1305
- return this._el.nativeElement;
1306
- },
1307
- enumerable: false,
1308
- configurable: true
1309
- });
1310
- ArtboardComponent.prototype.ngOnInit = function () {
1311
- var _this = this;
1312
- this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1313
- this._blockEditor.registerContainer(this.artboard.nativeElement);
1314
- this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1315
- this._blockEditor.blocks$
1316
- .pipe(operators.takeUntil(this._destroy$))
1317
- .subscribe(function (blocks) {
1318
- _this.blocks = blocks;
1319
- _this._cdRef.markForCheck();
1320
- });
1321
- this._blockEditor.blockAdded$
1322
- .pipe(operators.delay(300), operators.takeUntil(this._destroy$))
1323
- .subscribe(function (block) {
1324
- _this._blockEditor.selectedBlocks = [block];
1325
- _this._cdRef.markForCheck();
1326
- });
1327
- rxjs.fromEvent(window, 'keydown')
1328
- .pipe(operators.takeUntil(this._destroy$), operators.filter(function (event) {
1329
- return !!event.key.match(/^Arrow/) && !!_this._blockEditor.selectedBlocks.length;
1330
- }))
1331
- .subscribe(function (event) {
1332
- event.preventDefault();
1333
- var inchPixel = 1 / 100;
1334
- _this._blockEditor.selectedComponentBlocks
1335
- .forEach(function (blockComponent) {
1336
- switch (event.key) {
1337
- case 'ArrowUp':
1338
- blockComponent.top = blockComponent.block.top - inchPixel;
1339
- break;
1340
- case 'ArrowDown':
1341
- blockComponent.top = blockComponent.block.top + inchPixel;
1342
- break;
1343
- case 'ArrowLeft':
1344
- blockComponent.left = blockComponent.block.left - inchPixel;
1345
- break;
1346
- case 'ArrowRight':
1347
- blockComponent.left = blockComponent.block.left + inchPixel;
1348
- break;
1349
- }
1350
- });
1351
- });
1352
- };
1353
- ArtboardComponent.prototype.blockChanged = function (block) {
1354
- if (this.config.blockChanged) {
1355
- this.config.blockChanged(block);
1356
- }
1357
- };
1358
- ArtboardComponent.prototype.ngAfterViewInit = function () {
1359
- // this.blockComponents.changes
1360
- // .pipe(
1361
- // takeUntil(this._destroy$),
1362
- // )
1363
- // .subscribe((changes) => {
1364
- // const changeDiff = this._differ.diff(changes);
1365
- // if (changeDiff) {
1366
- // changeDiff.forEachAddedItem((change) => {
1367
- // //this.blockAdded.emit(change.item);
1368
- // });
1369
- // changeDiff.forEachRemovedItem((change) => {
1370
- // //this.blockRemoved.emit(change.item);
1371
- // });
1372
- // }
1373
- // });
1374
- };
1375
- ArtboardComponent.prototype.ngOnDestroy = function () {
1376
- this._destroy$.next();
1377
- this._destroy$.complete();
1378
- };
1379
- return ArtboardComponent;
1380
- }());
1381
- 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 });
1382
- 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 });
1383
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, decorators: [{
1384
- type: i0.Component,
1385
- args: [{
1386
- selector: 'app-artboard',
1387
- templateUrl: 'artboard.component.html',
1388
- styleUrls: ['artboard.component.scss'],
1389
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1390
- }]
1391
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
1392
- type: i0.ContentChildren,
1393
- args: [FsBlockEditorSidebarPanelDirective]
1394
- }], blockComponents: [{
1395
- type: i0.ViewChildren,
1396
- args: [FsBlockComponent]
1397
- }], artboard: [{
1398
- type: i0.ViewChild,
1399
- args: ['artboard', { static: true }]
1400
- }], marginContainer: [{
1401
- type: i0.ViewChild,
1402
- args: ['marginContainer', { static: true }]
1403
- }], margins: [{
1404
- type: i0.ViewChildren,
1405
- args: [FsBlockEditorMarginDirective]
1406
- }], sidebar: [{
1407
- type: i0.ViewChild,
1408
- args: [SidebarComponent, { static: true }]
1409
- }], config: [{
1410
- type: i0.Input
1411
- }], zoompan: [{
1412
- type: i0.Input
1305
+ var ArtboardComponent = /** @class */ (function () {
1306
+ function ArtboardComponent(_el, _blockEditor, _cdRef, _differs) {
1307
+ this._el = _el;
1308
+ this._blockEditor = _blockEditor;
1309
+ this._cdRef = _cdRef;
1310
+ this._differs = _differs;
1311
+ this.blocks = [];
1312
+ this._destroy$ = new rxjs.Subject();
1313
+ this._differ = _differs.find([]).create(null);
1314
+ }
1315
+ Object.defineProperty(ArtboardComponent.prototype, "el", {
1316
+ get: function () {
1317
+ return this._el.nativeElement;
1318
+ },
1319
+ enumerable: false,
1320
+ configurable: true
1321
+ });
1322
+ ArtboardComponent.prototype.ngOnInit = function () {
1323
+ var _this = this;
1324
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1325
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
1326
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1327
+ this._blockEditor.blocks$
1328
+ .pipe(operators.takeUntil(this._destroy$))
1329
+ .subscribe(function (blocks) {
1330
+ _this.blocks = blocks;
1331
+ _this._cdRef.markForCheck();
1332
+ });
1333
+ this._blockEditor.blockAdded$
1334
+ .pipe(operators.delay(300), operators.takeUntil(this._destroy$))
1335
+ .subscribe(function (block) {
1336
+ _this._blockEditor.selectedBlocks = [block];
1337
+ _this._cdRef.markForCheck();
1338
+ });
1339
+ rxjs.fromEvent(window, 'keydown')
1340
+ .pipe(operators.takeUntil(this._destroy$), operators.filter(function (event) {
1341
+ return !!event.key.match(/^Arrow/) && !!_this._blockEditor.selectedBlocks.length;
1342
+ }))
1343
+ .subscribe(function (event) {
1344
+ event.preventDefault();
1345
+ var inchPixel = 1 / 100;
1346
+ _this._blockEditor.selectedComponentBlocks
1347
+ .forEach(function (blockComponent) {
1348
+ switch (event.key) {
1349
+ case 'ArrowUp':
1350
+ blockComponent.top = blockComponent.block.top - inchPixel;
1351
+ break;
1352
+ case 'ArrowDown':
1353
+ blockComponent.top = blockComponent.block.top + inchPixel;
1354
+ break;
1355
+ case 'ArrowLeft':
1356
+ blockComponent.left = blockComponent.block.left - inchPixel;
1357
+ break;
1358
+ case 'ArrowRight':
1359
+ blockComponent.left = blockComponent.block.left + inchPixel;
1360
+ break;
1361
+ }
1362
+ });
1363
+ });
1364
+ };
1365
+ ArtboardComponent.prototype.blockChanged = function (block) {
1366
+ if (this.config.blockChanged) {
1367
+ this.config.blockChanged(block);
1368
+ }
1369
+ };
1370
+ ArtboardComponent.prototype.ngAfterViewInit = function () {
1371
+ // this.blockComponents.changes
1372
+ // .pipe(
1373
+ // takeUntil(this._destroy$),
1374
+ // )
1375
+ // .subscribe((changes) => {
1376
+ // const changeDiff = this._differ.diff(changes);
1377
+ // if (changeDiff) {
1378
+ // changeDiff.forEachAddedItem((change) => {
1379
+ // //this.blockAdded.emit(change.item);
1380
+ // });
1381
+ // changeDiff.forEachRemovedItem((change) => {
1382
+ // //this.blockRemoved.emit(change.item);
1383
+ // });
1384
+ // }
1385
+ // });
1386
+ };
1387
+ ArtboardComponent.prototype.ngOnDestroy = function () {
1388
+ this._destroy$.next();
1389
+ this._destroy$.complete();
1390
+ };
1391
+ return ArtboardComponent;
1392
+ }());
1393
+ 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 });
1394
+ ArtboardComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ArtboardComponent, selector: "app-artboard", inputs: { config: "config", zoompan: "zoompan" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "artboard", first: true, predicate: ["artboard"], descendants: true, static: true }, { propertyName: "marginContainer", first: true, predicate: ["marginContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "blockComponents", predicate: FsBlockComponent, descendants: true }, { propertyName: "margins", predicate: FsBlockEditorMarginDirective, descendants: true }], ngImport: i0__namespace, template: "<div\n #artboard\n class=\"artboard mat-elevation-z4 deselectable\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks\"\n [zoompan]=\"zoompan\"\n [block]=\"block\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\">\n </div>\n</div> \n\n", styles: [".artboard{position:relative;display:inline-flex;background-color:#fff}.artboard .margin-container{position:absolute;z-index:-1}.artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.artboard .margin.margin-top,.artboard .margin.margin-bottom{width:100%;border-top-width:1px}.artboard .margin.margin-left,.artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html", "zoompan"] }], directives: [{ type: 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 });
1395
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, decorators: [{
1396
+ type: i0.Component,
1397
+ args: [{
1398
+ selector: 'app-artboard',
1399
+ templateUrl: 'artboard.component.html',
1400
+ styleUrls: ['artboard.component.scss'],
1401
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1402
+ }]
1403
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
1404
+ type: i0.ContentChildren,
1405
+ args: [FsBlockEditorSidebarPanelDirective]
1406
+ }], blockComponents: [{
1407
+ type: i0.ViewChildren,
1408
+ args: [FsBlockComponent]
1409
+ }], artboard: [{
1410
+ type: i0.ViewChild,
1411
+ args: ['artboard', { static: true }]
1412
+ }], marginContainer: [{
1413
+ type: i0.ViewChild,
1414
+ args: ['marginContainer', { static: true }]
1415
+ }], margins: [{
1416
+ type: i0.ViewChildren,
1417
+ args: [FsBlockEditorMarginDirective]
1418
+ }], sidebar: [{
1419
+ type: i0.ViewChild,
1420
+ args: [SidebarComponent, { static: true }]
1421
+ }], config: [{
1422
+ type: i0.Input
1423
+ }], zoompan: [{
1424
+ type: i0.Input
1413
1425
  }] } });
1414
1426
 
1415
- var FsBlockEditorComponent = /** @class */ (function () {
1416
- function FsBlockEditorComponent(_el, _blockEditor) {
1417
- this._el = _el;
1418
- this._blockEditor = _blockEditor;
1419
- this._destroy$ = new rxjs.Subject();
1420
- }
1421
- Object.defineProperty(FsBlockEditorComponent.prototype, "el", {
1422
- get: function () {
1423
- return this._el.nativeElement;
1424
- },
1425
- enumerable: false,
1426
- configurable: true
1427
- });
1428
- FsBlockEditorComponent.prototype.ngOnInit = function () {
1429
- var _this = this;
1430
- this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1431
- this._blockEditor.blocks = this.config.blocks;
1432
- this._blockEditor.config = this.config;
1433
- this._blockEditor.blocks$
1434
- .pipe(operators.takeUntil(this._destroy$))
1435
- .subscribe(function (blocks) {
1436
- _this.blocks = blocks;
1437
- });
1438
- setTimeout(function () {
1439
- _this.zoomCenter();
1440
- });
1441
- };
1442
- FsBlockEditorComponent.prototype.zoomCenter = function () {
1443
- this.zoompan.center(this.artboard.nativeElement, { vertical: false });
1444
- };
1445
- FsBlockEditorComponent.prototype.artboardClick = function (event) {
1446
- if (event.target.classList.contains('deselectable')) {
1447
- this.zoompan.enable();
1448
- this._blockEditor.selectedBlocks = [];
1449
- }
1450
- };
1451
- FsBlockEditorComponent.prototype.ngOnDestroy = function () {
1452
- this._destroy$.next();
1453
- this._destroy$.complete();
1454
- };
1455
- return FsBlockEditorComponent;
1456
- }());
1457
- 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 });
1458
- FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
1459
- BlockEditorService,
1460
- ], 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 (zoomCenter)=\"zoomCenter()\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative;height:100%}.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"], outputs: ["zoomCenter"] }], directives: [{ type: i2__namespace$1.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1461
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, decorators: [{
1462
- type: i0.Component,
1463
- args: [{
1464
- selector: 'fs-block-editor',
1465
- templateUrl: 'block-editor.component.html',
1466
- styleUrls: ['block-editor.component.scss'],
1467
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1468
- providers: [
1469
- BlockEditorService,
1470
- ]
1471
- }]
1472
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1473
- type: i0.ContentChildren,
1474
- args: [FsBlockEditorSidebarPanelDirective]
1475
- }], zoompan: [{
1476
- type: i0.ViewChild,
1477
- args: [i2$1.FsZoomPanComponent, { static: true }]
1478
- }], artboardContainer: [{
1479
- type: i0.ViewChild,
1480
- args: ['artboardContainer', { static: true }]
1481
- }], sidebar: [{
1482
- type: i0.ViewChild,
1483
- args: [SidebarComponent, { static: true }]
1484
- }], artboard: [{
1485
- type: i0.ViewChild,
1486
- args: [ArtboardComponent, { read: i0.ElementRef }]
1487
- }], config: [{
1488
- type: i0.Input
1427
+ var FsBlockEditorComponent = /** @class */ (function () {
1428
+ function FsBlockEditorComponent(_el, _blockEditor) {
1429
+ this._el = _el;
1430
+ this._blockEditor = _blockEditor;
1431
+ this._destroy$ = new rxjs.Subject();
1432
+ }
1433
+ Object.defineProperty(FsBlockEditorComponent.prototype, "el", {
1434
+ get: function () {
1435
+ return this._el.nativeElement;
1436
+ },
1437
+ enumerable: false,
1438
+ configurable: true
1439
+ });
1440
+ FsBlockEditorComponent.prototype.ngOnInit = function () {
1441
+ var _this = this;
1442
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1443
+ this._blockEditor.blocks = this.config.blocks;
1444
+ this._blockEditor.config = this.config;
1445
+ this._blockEditor.blocks$
1446
+ .pipe(operators.takeUntil(this._destroy$))
1447
+ .subscribe(function (blocks) {
1448
+ _this.blocks = blocks;
1449
+ });
1450
+ setTimeout(function () {
1451
+ _this.zoomCenter();
1452
+ });
1453
+ };
1454
+ FsBlockEditorComponent.prototype.zoomCenter = function () {
1455
+ this.zoompan.center(this.artboard.nativeElement, { vertical: false });
1456
+ };
1457
+ FsBlockEditorComponent.prototype.editorContainerClick = function (event) {
1458
+ if (event.target.classList.contains('deselectable') ||
1459
+ event.target.classList.contains('fs-zoom-pan-container')) {
1460
+ this.zoompan.enable();
1461
+ this._blockEditor.selectedBlocks = [];
1462
+ }
1463
+ };
1464
+ FsBlockEditorComponent.prototype.ngOnDestroy = function () {
1465
+ this._destroy$.next();
1466
+ this._destroy$.complete();
1467
+ };
1468
+ return FsBlockEditorComponent;
1469
+ }());
1470
+ 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 });
1471
+ FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
1472
+ BlockEditorService,
1473
+ ], 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 \n class=\"editor-container deselectable\"\n (mousedown)=\"editorContainerClick($event)\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n class=\"deselectable\"\n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n (zoomCenter)=\"zoomCenter()\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative;height:100%;background:#d8d8d8;overflow:hidden}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0}.editor-container .zoom-pan-container{flex:1}fs-zoom-pan{height:100%}\n"], components: [{ type: i2__namespace$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"], outputs: ["zoomCenter"] }], directives: [{ type: i2__namespace$1.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1474
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, decorators: [{
1475
+ type: i0.Component,
1476
+ args: [{
1477
+ selector: 'fs-block-editor',
1478
+ templateUrl: 'block-editor.component.html',
1479
+ styleUrls: ['block-editor.component.scss'],
1480
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1481
+ providers: [
1482
+ BlockEditorService,
1483
+ ]
1484
+ }]
1485
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1486
+ type: i0.ContentChildren,
1487
+ args: [FsBlockEditorSidebarPanelDirective]
1488
+ }], zoompan: [{
1489
+ type: i0.ViewChild,
1490
+ args: [i2$1.FsZoomPanComponent, { static: true }]
1491
+ }], artboardContainer: [{
1492
+ type: i0.ViewChild,
1493
+ args: ['artboardContainer', { static: true }]
1494
+ }], sidebar: [{
1495
+ type: i0.ViewChild,
1496
+ args: [SidebarComponent, { static: true }]
1497
+ }], artboard: [{
1498
+ type: i0.ViewChild,
1499
+ args: [ArtboardComponent, { read: i0.ElementRef }]
1500
+ }], config: [{
1501
+ type: i0.Input
1489
1502
  }] } });
1490
1503
 
1491
- var FsBlockEditorModule = /** @class */ (function () {
1492
- function FsBlockEditorModule() {
1493
- }
1494
- FsBlockEditorModule.forRoot = function () {
1495
- return {
1496
- ngModule: FsBlockEditorModule,
1497
- };
1498
- };
1499
- return FsBlockEditorModule;
1500
- }());
1501
- FsBlockEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1502
- FsBlockEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1503
- FsBlockEditorComponent,
1504
- FsBlockEditorSidebarPanelDirective,
1505
- FsBlockEditorMarginDirective,
1506
- SidebarComponent,
1507
- ArtboardComponent], imports: [i9.CommonModule,
1508
- i12.FormsModule,
1509
- i5.MatIconModule,
1510
- i4.MatButtonModule,
1511
- i11.MatInputModule,
1512
- i6.MatFormFieldModule,
1513
- i7.MatCheckboxModule,
1514
- i10.MatTooltipModule,
1515
- i3.FsFileModule,
1516
- i8.FsColorPickerModule,
1517
- menu.FsMenuModule,
1518
- i2$1.FsZoomPanModule], exports: [FsBlockComponent,
1519
- FsBlockEditorComponent,
1520
- FsBlockEditorSidebarPanelDirective] });
1521
- FsBlockEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, imports: [[
1522
- i9.CommonModule,
1523
- i12.FormsModule,
1524
- i5.MatIconModule,
1525
- i4.MatButtonModule,
1526
- i11.MatInputModule,
1527
- i6.MatFormFieldModule,
1528
- i7.MatCheckboxModule,
1529
- i10.MatTooltipModule,
1530
- i3.FsFileModule,
1531
- i8.FsColorPickerModule,
1532
- menu.FsMenuModule,
1533
- i2$1.FsZoomPanModule,
1534
- ]] });
1535
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, decorators: [{
1536
- type: i0.NgModule,
1537
- args: [{
1538
- imports: [
1539
- i9.CommonModule,
1540
- i12.FormsModule,
1541
- i5.MatIconModule,
1542
- i4.MatButtonModule,
1543
- i11.MatInputModule,
1544
- i6.MatFormFieldModule,
1545
- i7.MatCheckboxModule,
1546
- i10.MatTooltipModule,
1547
- i3.FsFileModule,
1548
- i8.FsColorPickerModule,
1549
- menu.FsMenuModule,
1550
- i2$1.FsZoomPanModule,
1551
- ],
1552
- exports: [
1553
- FsBlockComponent,
1554
- FsBlockEditorComponent,
1555
- FsBlockEditorSidebarPanelDirective,
1556
- ],
1557
- declarations: [
1558
- FsBlockComponent,
1559
- FsBlockEditorComponent,
1560
- FsBlockEditorSidebarPanelDirective,
1561
- FsBlockEditorMarginDirective,
1562
- SidebarComponent,
1563
- ArtboardComponent,
1564
- ],
1565
- }]
1504
+ var FsBlockEditorModule = /** @class */ (function () {
1505
+ function FsBlockEditorModule() {
1506
+ }
1507
+ FsBlockEditorModule.forRoot = function () {
1508
+ return {
1509
+ ngModule: FsBlockEditorModule,
1510
+ };
1511
+ };
1512
+ return FsBlockEditorModule;
1513
+ }());
1514
+ FsBlockEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1515
+ FsBlockEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, declarations: [FsBlockComponent,
1516
+ FsBlockEditorComponent,
1517
+ FsBlockEditorSidebarPanelDirective,
1518
+ FsBlockEditorMarginDirective,
1519
+ SidebarComponent,
1520
+ ArtboardComponent], imports: [i9.CommonModule,
1521
+ i12.FormsModule,
1522
+ i5.MatIconModule,
1523
+ i4.MatButtonModule,
1524
+ i11.MatInputModule,
1525
+ i6.MatFormFieldModule,
1526
+ i7.MatCheckboxModule,
1527
+ i10.MatTooltipModule,
1528
+ i3.FsFileModule,
1529
+ i8.FsColorPickerModule,
1530
+ menu.FsMenuModule,
1531
+ i2$1.FsZoomPanModule], exports: [FsBlockComponent,
1532
+ FsBlockEditorComponent,
1533
+ FsBlockEditorSidebarPanelDirective] });
1534
+ FsBlockEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, imports: [[
1535
+ i9.CommonModule,
1536
+ i12.FormsModule,
1537
+ i5.MatIconModule,
1538
+ i4.MatButtonModule,
1539
+ i11.MatInputModule,
1540
+ i6.MatFormFieldModule,
1541
+ i7.MatCheckboxModule,
1542
+ i10.MatTooltipModule,
1543
+ i3.FsFileModule,
1544
+ i8.FsColorPickerModule,
1545
+ menu.FsMenuModule,
1546
+ i2$1.FsZoomPanModule,
1547
+ ]] });
1548
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, decorators: [{
1549
+ type: i0.NgModule,
1550
+ args: [{
1551
+ imports: [
1552
+ i9.CommonModule,
1553
+ i12.FormsModule,
1554
+ i5.MatIconModule,
1555
+ i4.MatButtonModule,
1556
+ i11.MatInputModule,
1557
+ i6.MatFormFieldModule,
1558
+ i7.MatCheckboxModule,
1559
+ i10.MatTooltipModule,
1560
+ i3.FsFileModule,
1561
+ i8.FsColorPickerModule,
1562
+ menu.FsMenuModule,
1563
+ i2$1.FsZoomPanModule,
1564
+ ],
1565
+ exports: [
1566
+ FsBlockComponent,
1567
+ FsBlockEditorComponent,
1568
+ FsBlockEditorSidebarPanelDirective,
1569
+ ],
1570
+ declarations: [
1571
+ FsBlockComponent,
1572
+ FsBlockEditorComponent,
1573
+ FsBlockEditorSidebarPanelDirective,
1574
+ FsBlockEditorMarginDirective,
1575
+ SidebarComponent,
1576
+ ArtboardComponent,
1577
+ ],
1578
+ }]
1566
1579
  }] });
1567
1580
 
1568
- /**
1569
- * Generated bundle index. Do not edit.
1581
+ /**
1582
+ * Generated bundle index. Do not edit.
1570
1583
  */
1571
1584
 
1572
1585
  exports.BlockTypes = BlockTypes;