@firestitch/block-editor 12.0.1 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/app/components/artboard/artboard.component.d.ts +35 -0
  2. package/app/components/block/block.component.d.ts +18 -33
  3. package/app/components/block-editor/block-editor.component.d.ts +8 -18
  4. package/app/components/sidebar/sidebar.component.d.ts +27 -13
  5. package/app/consts/block-types.const.d.ts +12 -0
  6. package/app/consts/index.d.ts +1 -0
  7. package/app/enums/block-type.enum.d.ts +11 -0
  8. package/app/enums/index.d.ts +1 -0
  9. package/app/fs-block-editor.module.d.ts +14 -9
  10. package/app/interfaces/block-editor-config.d.ts +9 -7
  11. package/app/interfaces/block.d.ts +12 -1
  12. package/app/services/block-editor.service.d.ts +31 -14
  13. package/app/services/index.d.ts +1 -0
  14. package/bundles/firestitch-block-editor.umd.js +593 -561
  15. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  16. package/esm2015/app/components/artboard/artboard.component.js +129 -0
  17. package/esm2015/app/components/block/block.component.js +135 -197
  18. package/esm2015/app/components/block-editor/block-editor.component.js +28 -89
  19. package/esm2015/app/components/sidebar/sidebar.component.js +109 -169
  20. package/esm2015/app/consts/block-types.const.js +13 -0
  21. package/esm2015/app/consts/index.js +2 -0
  22. package/esm2015/app/enums/block-type.enum.js +13 -0
  23. package/esm2015/app/enums/index.js +2 -0
  24. package/esm2015/app/fs-block-editor.module.js +22 -3
  25. package/esm2015/app/interfaces/block-editor-config.js +1 -1
  26. package/esm2015/app/interfaces/block.js +1 -1
  27. package/esm2015/app/services/block-editor.service.js +132 -25
  28. package/esm2015/app/services/index.js +2 -0
  29. package/esm2015/public_api.js +3 -4
  30. package/fesm2015/firestitch-block-editor.js +530 -457
  31. package/fesm2015/firestitch-block-editor.js.map +1 -1
  32. package/package.json +3 -2
  33. package/public_api.d.ts +2 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/forms'), require('@angular/material/input'), require('@angular/core'), require('@angular/common'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@firestitch/colorpicker'), require('@firestitch/file'), require('rxjs/operators'), require('moveable'), require('rxjs'), require('@firestitch/common')) :
3
- typeof define === 'function' && define.amd ? define('@firestitch/block-editor', ['exports', '@angular/forms', '@angular/material/input', '@angular/core', '@angular/common', '@angular/material/button', '@angular/material/form-field', '@angular/material/icon', '@firestitch/colorpicker', '@firestitch/file', 'rxjs/operators', 'moveable', 'rxjs', '@firestitch/common'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch["block-editor"] = {}), global.ng.forms, global.ng.material.input, global.ng.core, global.ng.common, global.ng.material.button, global.ng.material.formField, global.ng.material.icon, global.i5, global.i6, global.rxjs.operators, global.Moveable, global.rxjs, global.common));
5
- })(this, (function (exports, i9, i8, i0, i7, i2, i4, i3, i5, i6, operators, Moveable, rxjs, common) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/forms'), require('@angular/material/input'), require('@angular/core'), require('@angular/common'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@firestitch/colorpicker'), require('@firestitch/file'), require('@firestitch/menu'), require('@firestitch/zoom-pan'), require('rxjs/operators'), require('moveable'), require('rxjs'), require('@firestitch/common'), require('@firestitch/prompt'), require('@angular/material/checkbox'), require('@angular/material/tooltip')) :
3
+ typeof define === 'function' && define.amd ? define('@firestitch/block-editor', ['exports', '@angular/forms', '@angular/material/input', '@angular/core', '@angular/common', '@angular/material/button', '@angular/material/form-field', '@angular/material/icon', '@firestitch/colorpicker', '@firestitch/file', '@firestitch/menu', '@firestitch/zoom-pan', 'rxjs/operators', 'moveable', 'rxjs', '@firestitch/common', '@firestitch/prompt', '@angular/material/checkbox', '@angular/material/tooltip'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch["block-editor"] = {}), global.ng.forms, global.ng.material.input, global.ng.core, global.ng.common, global.ng.material.button, global.ng.material.formField, global.ng.material.icon, global.i8, global.i3, global.menu, global.i2$1, global.rxjs.operators, global.Moveable, global.rxjs, global.common, global.i2, global.ng.material.checkbox, global.ng.material.tooltip));
5
+ })(this, (function (exports, i12, i11, i0, i9, i4, i6, i5, i8, i3, menu, i2$1, operators, Moveable, rxjs, common, i2, i7, i10) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -24,16 +24,33 @@
24
24
  return Object.freeze(n);
25
25
  }
26
26
 
27
- var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
28
- var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
27
+ var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
28
+ var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
29
29
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
31
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
+ var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
32
31
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
33
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
34
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
35
32
  var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
33
+ var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
34
+ var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
35
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
36
+ var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
36
37
  var Moveable__default = /*#__PURE__*/_interopDefaultLegacy(Moveable);
38
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
39
+ var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
40
+ var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
41
+
42
+ exports.BlockType = void 0;
43
+ (function (BlockType) {
44
+ BlockType["Rectangle"] = "rectangle";
45
+ BlockType["ShortText"] = "shorttext";
46
+ BlockType["LongText"] = "longtext";
47
+ BlockType["Image"] = "image";
48
+ BlockType["RadioButton"] = "radiobutton";
49
+ BlockType["Checkbox"] = "checkbox";
50
+ BlockType["Signature"] = "signature";
51
+ BlockType["Pdf"] = "pdf";
52
+ BlockType["Date"] = "date";
53
+ })(exports.BlockType || (exports.BlockType = {}));
37
54
 
38
55
  /*! *****************************************************************************
39
56
  Copyright (c) Microsoft Corporation.
@@ -355,13 +372,18 @@
355
372
 
356
373
  var BlockEditorService = /** @class */ (function () {
357
374
  function BlockEditorService() {
358
- this.blockComponents = [];
375
+ this._blockChanged$ = new rxjs.Subject();
376
+ this._blockRemoved$ = new rxjs.Subject();
377
+ this._blockAdded$ = new rxjs.Subject();
359
378
  this._blocks$ = new rxjs.BehaviorSubject([]);
360
- this._selectedBlockComponents$ = new rxjs.BehaviorSubject([]);
379
+ this._selectedBlocks$ = new rxjs.BehaviorSubject([]);
380
+ this._blockComponents = new Map();
381
+ this._destroy$ = new rxjs.Subject();
361
382
  }
362
383
  Object.defineProperty(BlockEditorService.prototype, "elementGuidelines", {
363
384
  get: function () {
364
- return __spreadArray(__spreadArray([], __read(this.blockComponents.map(function (block) {
385
+ return __spreadArray(__spreadArray([], __read(Array.from(this._blockComponents.values())
386
+ .map(function (block) {
365
387
  return block.el;
366
388
  }))), [
367
389
  this.container,
@@ -371,16 +393,82 @@
371
393
  enumerable: false,
372
394
  configurable: true
373
395
  });
374
- BlockEditorService.prototype.addBlock = function (block) {
375
- this.blocks$.next(__spreadArray(__spreadArray([], __read(this.blocks)), [this.sanitizeBlock(block)]));
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
+ _this.blocks = __spreadArray(__spreadArray([], __read(_this.blocks)), [
419
+ block,
420
+ ]);
421
+ _this._blockAdded$.next(block);
422
+ if (_this.config.blockAdded) {
423
+ _this.config.blockAdded(block);
424
+ }
425
+ //this._updateIndexes();
426
+ });
427
+ }
428
+ };
429
+ BlockEditorService.prototype.blockAdd = function (block) {
430
+ var _this = this;
431
+ if (this.config.blockAdd) {
432
+ this.config.blockAdd(block)
433
+ .pipe(operators.takeUntil(this._destroy$))
434
+ .subscribe(function (block) {
435
+ _this.blocks = __spreadArray(__spreadArray([], __read(_this.blocks)), [
436
+ block,
437
+ ]);
438
+ _this._blockAdded$.next(block);
439
+ if (_this.config.blockAdded) {
440
+ _this.config.blockAdded(block);
441
+ }
442
+ //this._updateIndexes();
443
+ });
444
+ }
376
445
  };
446
+ // private _updateIndexes(): void {
447
+ // const sort = this.blocks.slice().sort((a, b) => {
448
+ // return a.index > b.index ? 1 : -1;
449
+ // })
450
+ // sort.forEach((block, index) => {
451
+ // this.blocks.find((item) => {
452
+ // return block.reference === item.reference;
453
+ // }).index = index;
454
+ // });
455
+ // }
377
456
  BlockEditorService.prototype.removeBlock = function (block) {
378
457
  var index = this.indexOf(block);
379
458
  if (index !== -1) {
380
- this.blocks.splice(index, 1);
381
- this.blocks$.next(this.blocks);
459
+ var blocks = this.blocks;
460
+ blocks.splice(index, 1);
461
+ this.blocks = blocks;
462
+ this._blockRemoved$.next(block);
382
463
  }
383
464
  };
465
+ BlockEditorService.prototype.removeSelectedBlocks = function () {
466
+ var _this = this;
467
+ this.selectedBlocks.forEach(function (block) {
468
+ _this.removeBlock(block);
469
+ });
470
+ this.selectedBlocks = [];
471
+ };
384
472
  Object.defineProperty(BlockEditorService.prototype, "blocks$", {
385
473
  get: function () {
386
474
  return this._blocks$;
@@ -388,9 +476,36 @@
388
476
  enumerable: false,
389
477
  configurable: true
390
478
  });
479
+ Object.defineProperty(BlockEditorService.prototype, "blockChanged$", {
480
+ get: function () {
481
+ return this._blockChanged$;
482
+ },
483
+ enumerable: false,
484
+ configurable: true
485
+ });
486
+ Object.defineProperty(BlockEditorService.prototype, "blockRemoved$", {
487
+ get: function () {
488
+ return this._blockRemoved$;
489
+ },
490
+ enumerable: false,
491
+ configurable: true
492
+ });
493
+ Object.defineProperty(BlockEditorService.prototype, "blockAdded$", {
494
+ get: function () {
495
+ return this._blockAdded$;
496
+ },
497
+ enumerable: false,
498
+ configurable: true
499
+ });
500
+ BlockEditorService.prototype.blockChange = function (block) {
501
+ this._blockChanged$.next(block);
502
+ if (this.config.blockChanged) {
503
+ this.config.blockChanged(block);
504
+ }
505
+ };
391
506
  Object.defineProperty(BlockEditorService.prototype, "blocks", {
392
507
  get: function () {
393
- return this.blocks$.getValue();
508
+ return this._blocks$.getValue();
394
509
  },
395
510
  set: function (blocks) {
396
511
  this._blocks$.next(blocks);
@@ -399,35 +514,52 @@
399
514
  configurable: true
400
515
  });
401
516
  BlockEditorService.prototype.isSelectedBlock = function (block) {
402
- return this.selectedBlockComponents.indexOf(block) !== -1;
517
+ return this.selectedBlocks.indexOf(block) !== -1;
403
518
  };
404
519
  BlockEditorService.prototype.indexOf = function (block) {
405
520
  return this.blocks.map(function (e) { return e.reference; }).indexOf(block.reference);
406
521
  };
407
- Object.defineProperty(BlockEditorService.prototype, "selectedBlockComponents", {
522
+ BlockEditorService.prototype.selectedBlockComponentChangeProperty = function (value, name) {
523
+ var _this = this;
524
+ this.selectedBlocks
525
+ .forEach(function (block) {
526
+ block[name] = value;
527
+ _this.blockChange(block);
528
+ });
529
+ };
530
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlocks$", {
408
531
  get: function () {
409
- return this._selectedBlockComponents$.getValue();
410
- },
411
- set: function (blocks) {
412
- this.blockComponents.forEach(function (block) {
413
- block.editable = false;
414
- block.transformable = blocks.indexOf(block) !== -1;
415
- });
416
- this._selectedBlockComponents$.next(blocks);
532
+ return this._selectedBlocks$;
417
533
  },
418
534
  enumerable: false,
419
535
  configurable: true
420
536
  });
421
- Object.defineProperty(BlockEditorService.prototype, "selectedBlocks", {
422
- get: function () {
423
- return this.selectedBlockComponents.map(function (blockComponent) { return blockComponent.block; });
537
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlock", {
538
+ set: function (block) {
539
+ this.selectedBlocks = [block];
424
540
  },
425
541
  enumerable: false,
426
542
  configurable: true
427
543
  });
428
- Object.defineProperty(BlockEditorService.prototype, "selectedBlockComponents$", {
544
+ Object.defineProperty(BlockEditorService.prototype, "selectedBlocks", {
429
545
  get: function () {
430
- return this._selectedBlockComponents$;
546
+ return this._selectedBlocks$.getValue();
547
+ },
548
+ set: function (blocks) {
549
+ this.blockComponents
550
+ .forEach(function (blockComponent) {
551
+ blockComponent.editable = false;
552
+ if (blocks.indexOf(blockComponent.block) !== -1) {
553
+ blockComponent.transformable = true;
554
+ }
555
+ else {
556
+ blockComponent.deselect();
557
+ }
558
+ });
559
+ this._selectedBlocks$.next(blocks);
560
+ if (this.config.blocksSelected) {
561
+ this.config.blocksSelected(blocks);
562
+ }
431
563
  },
432
564
  enumerable: false,
433
565
  configurable: true
@@ -446,8 +578,9 @@
446
578
  BlockEditorService.prototype.hasSelectionRange = function () {
447
579
  return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
448
580
  };
449
- BlockEditorService.prototype.registerBlock = function (block) {
581
+ BlockEditorService.prototype.registerBlock = function (block, blockComponent) {
450
582
  var _this = this;
583
+ this._blockComponents.set(block, blockComponent);
451
584
  this.blockComponents.push(block);
452
585
  this.blockComponents.forEach(function (item) {
453
586
  var blocks = _this.elementGuidelines
@@ -457,14 +590,26 @@
457
590
  item.elementGuidelines = blocks;
458
591
  });
459
592
  };
593
+ BlockEditorService.prototype.unregisterBlock = function (block) {
594
+ this._blockComponents.delete(block);
595
+ };
460
596
  BlockEditorService.prototype.registerContainer = function (container) {
461
597
  this.container = container;
462
598
  };
463
599
  BlockEditorService.prototype.registerMargin = function (margin) {
464
600
  this.margin = margin;
465
601
  };
602
+ BlockEditorService.prototype.sanitizeNewBlock = function (block) {
603
+ var width = (this.config.width * .333).toFixed(2);
604
+ var height = (this.config.height * .333).toFixed(2);
605
+ return this.sanitizeBlock(Object.assign({ top: height, left: width, width: height, height: width }, block));
606
+ };
466
607
  BlockEditorService.prototype.sanitizeBlock = function (block) {
467
- return Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block);
608
+ return Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || common.guid() });
609
+ };
610
+ BlockEditorService.prototype.ngOnDestroy = function () {
611
+ this._destroy$.next();
612
+ this._destroy$.complete();
468
613
  };
469
614
  return BlockEditorService;
470
615
  }());
@@ -472,15 +617,16 @@
472
617
  BlockEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService });
473
618
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlockEditorService, decorators: [{
474
619
  type: i0.Injectable
475
- }], ctorParameters: function () { return []; } });
620
+ }] });
476
621
 
477
622
  var FsBlockComponent = /** @class */ (function () {
478
- function FsBlockComponent(_service, _elementRef, _cdRef) {
479
- this._service = _service;
623
+ function FsBlockComponent(_blockEditor, _elementRef, _cdRef) {
624
+ this._blockEditor = _blockEditor;
480
625
  this._elementRef = _elementRef;
481
626
  this._cdRef = _cdRef;
482
- this.changed = new i0.EventEmitter();
627
+ this.BlockType = exports.BlockType;
483
628
  this._editable = false;
629
+ this._transformable = false;
484
630
  this._destroy$ = new rxjs.Subject();
485
631
  }
486
632
  Object.defineProperty(FsBlockComponent.prototype, "el", {
@@ -512,14 +658,14 @@
512
658
  });
513
659
  Object.defineProperty(FsBlockComponent.prototype, "elementGuidelines", {
514
660
  set: function (value) {
515
- this._moveable.elementGuidelines = value;
661
+ this.moveable.elementGuidelines = value;
516
662
  },
517
663
  enumerable: false,
518
664
  configurable: true
519
665
  });
520
666
  Object.defineProperty(FsBlockComponent.prototype, "clippable", {
521
667
  set: function (value) {
522
- this._moveable.clippable = value;
668
+ this.moveable.clippable = value;
523
669
  },
524
670
  enumerable: false,
525
671
  configurable: true
@@ -532,98 +678,48 @@
532
678
  this._transformable = value;
533
679
  this.moveable.draggable = value;
534
680
  this.moveable.resizable = value;
535
- this.moveable.draggable = value;
536
681
  this.moveable.roundable = value;
537
682
  this.moveable.rotatable = value;
538
683
  },
539
684
  enumerable: false,
540
685
  configurable: true
541
686
  });
542
- Object.defineProperty(FsBlockComponent.prototype, "lineHeight", {
543
- set: function (value) {
544
- this.block.lineHeight = value;
545
- this._triggerChanged();
546
- },
547
- enumerable: false,
548
- configurable: true
549
- });
550
- Object.defineProperty(FsBlockComponent.prototype, "borderWidth", {
551
- set: function (value) {
552
- this.block.borderWidth = value;
553
- this._triggerChanged();
554
- },
555
- enumerable: false,
556
- configurable: true
557
- });
558
- Object.defineProperty(FsBlockComponent.prototype, "fontSize", {
559
- set: function (value) {
560
- this.block.fontSize = value;
561
- this._triggerChanged();
562
- },
563
- enumerable: false,
564
- configurable: true
565
- });
566
- Object.defineProperty(FsBlockComponent.prototype, "backgroundColor", {
567
- set: function (value) {
568
- this.block.backgroundColor = value;
569
- this._triggerChanged();
570
- },
571
- enumerable: false,
572
- configurable: true
573
- });
574
687
  Object.defineProperty(FsBlockComponent.prototype, "width", {
575
688
  set: function (value) {
576
- this.block.width = parseFloat(value);
577
- this.element.nativeElement.style.width = "" + this.block.width + this.unit;
578
- this._moveable.updateRect();
579
- this._triggerChanged();
689
+ this.element.nativeElement.style.width = "" + parseFloat(value) + this.unit;
690
+ this.moveable.updateRect();
580
691
  },
581
692
  enumerable: false,
582
693
  configurable: true
583
694
  });
584
695
  Object.defineProperty(FsBlockComponent.prototype, "height", {
585
696
  set: function (value) {
586
- this.block.height = parseFloat(value);
587
- this.element.nativeElement.style.height = "" + this.block.height + this.unit;
588
- this._moveable.updateRect();
589
- this._triggerChanged();
697
+ this.element.nativeElement.style.height = "" + parseFloat(value) + this.unit;
698
+ this.moveable.updateRect();
590
699
  },
591
700
  enumerable: false,
592
701
  configurable: true
593
702
  });
594
703
  Object.defineProperty(FsBlockComponent.prototype, "top", {
595
704
  set: function (value) {
596
- this.block.top = parseFloat(value);
597
- this.element.nativeElement.style.top = "" + this.block.top + this.unit;
598
- this._moveable.updateRect();
599
- this._triggerChanged();
705
+ this.element.nativeElement.style.top = "" + parseFloat(value) + this.unit;
706
+ this.moveable.updateRect();
600
707
  },
601
708
  enumerable: false,
602
709
  configurable: true
603
710
  });
604
711
  Object.defineProperty(FsBlockComponent.prototype, "left", {
605
712
  set: function (value) {
606
- this.block.left = parseFloat(value);
607
- this.element.nativeElement.style.left = "" + this.block.left + this.unit;
608
- this._moveable.updateRect();
609
- this._triggerChanged();
713
+ this.element.nativeElement.style.left = "" + parseFloat(value) + this.unit;
714
+ this.moveable.updateRect();
610
715
  },
611
716
  enumerable: false,
612
717
  configurable: true
613
718
  });
614
719
  Object.defineProperty(FsBlockComponent.prototype, "rotate", {
615
720
  set: function (value) {
616
- this.block.rotate = parseFloat(value);
617
- this._moveable.request('rotatable', { rotate: this.block.rotate }, true);
618
- this._triggerChanged();
619
- },
620
- enumerable: false,
621
- configurable: true
622
- });
623
- Object.defineProperty(FsBlockComponent.prototype, "shapeRadius", {
624
- set: function (value) {
625
- this.block.shapeRadius = value;
626
- this._triggerChanged();
721
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
722
+ this.moveable.updateRect();
627
723
  },
628
724
  enumerable: false,
629
725
  configurable: true
@@ -635,179 +731,113 @@
635
731
  enumerable: false,
636
732
  configurable: true
637
733
  });
638
- Object.defineProperty(FsBlockComponent.prototype, "borderColor", {
639
- set: function (value) {
640
- this.block.borderColor = value;
641
- this._triggerChanged();
642
- },
643
- enumerable: false,
644
- configurable: true
645
- });
646
- Object.defineProperty(FsBlockComponent.prototype, "paddingAll", {
647
- set: function (value) {
648
- this.block.padding = value;
649
- this.block.paddingTop = null;
650
- this.block.paddingBottom = null;
651
- this.block.paddingLeft = null;
652
- this.block.paddingRight = null;
653
- this._triggerChanged();
654
- },
655
- enumerable: false,
656
- configurable: true
657
- });
658
- FsBlockComponent.prototype.padding = function (name, value) {
659
- this.block[name] = value;
660
- this.block.padding = null;
661
- this._triggerChanged();
662
- };
663
- Object.defineProperty(FsBlockComponent.prototype, "imageUrl", {
664
- set: function (value) {
665
- this.block.imageUrl = value;
666
- this._triggerChanged();
667
- },
668
- enumerable: false,
669
- configurable: true
670
- });
671
- Object.defineProperty(FsBlockComponent.prototype, "fontColor", {
672
- set: function (value) {
673
- this.block.fontColor = value;
674
- this._triggerChanged();
675
- },
676
- enumerable: false,
677
- configurable: true
678
- });
679
- Object.defineProperty(FsBlockComponent.prototype, "verticalAlign", {
680
- set: function (value) {
681
- this.block.verticalAlign = value;
682
- this._triggerChanged();
683
- },
684
- enumerable: false,
685
- configurable: true
686
- });
687
- FsBlockComponent.prototype.shapeRound = function (name, value) {
688
- this.block[name] = value;
689
- this._triggerChanged();
690
- };
691
- Object.defineProperty(FsBlockComponent.prototype, "horizontalAlign", {
692
- set: function (value) {
693
- this.block.horizontalAlign = value;
694
- this._triggerChanged();
695
- },
696
- enumerable: false,
697
- configurable: true
698
- });
699
- Object.defineProperty(FsBlockComponent.prototype, "italic", {
700
- get: function () {
701
- return this.block.italic;
702
- },
703
- set: function (value) {
704
- this.block.italic = value;
705
- this._triggerChanged();
706
- },
707
- enumerable: false,
708
- configurable: true
709
- });
710
- Object.defineProperty(FsBlockComponent.prototype, "bold", {
711
- get: function () {
712
- return this.block.bold;
713
- },
714
- set: function (value) {
715
- this.block.bold = value;
716
- this._triggerChanged();
717
- },
718
- enumerable: false,
719
- configurable: true
720
- });
721
- Object.defineProperty(FsBlockComponent.prototype, "underline", {
722
- get: function () {
723
- return this.block.underline;
724
- },
734
+ Object.defineProperty(FsBlockComponent.prototype, "keepRatio", {
725
735
  set: function (value) {
726
- this.block.underline = value;
727
- this._triggerChanged();
736
+ this.moveable.keepRatio = value;
728
737
  },
729
738
  enumerable: false,
730
739
  configurable: true
731
740
  });
732
- FsBlockComponent.prototype.updateRect = function () {
733
- this.moveable.updateRect();
734
- };
735
741
  FsBlockComponent.prototype.markForCheck = function () {
736
742
  this._cdRef.markForCheck();
737
743
  };
738
744
  FsBlockComponent.prototype.ngOnInit = function () {
739
- this.block = this._service.sanitizeBlock(this.block);
740
- this.unit = this._service.config.unit;
745
+ var _this = this;
746
+ this.unit = this._blockEditor.config.unit;
741
747
  this.content = this.block.content;
748
+ this._blockEditor.blockChanged$
749
+ .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
750
+ .subscribe(function (block) {
751
+ _this.keepRatio = block.keepRatio;
752
+ _this.width = block.width;
753
+ _this.height = block.height;
754
+ _this.top = block.top;
755
+ _this.left = block.left;
756
+ _this._cdRef.markForCheck();
757
+ });
742
758
  };
743
759
  FsBlockComponent.prototype.ngAfterContentInit = function () {
744
760
  var _this = this;
745
- this.el.style.width = this.block.width + this.unit;
746
- this.el.style.height = this.block.height + this.unit;
747
- this.el.style.top = this.block.top + this.unit;
748
- this.el.style.left = this.block.left + this.unit;
749
- this._setTransform();
750
- rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
751
- .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
752
- _this.block.content = event.target.innerHTML;
753
- _this._triggerChanged();
754
- });
755
- rxjs.fromEvent(this.el, 'mousedown')
756
- .pipe(operators.takeUntil(this._destroy$), operators.filter(function () { return !_this.block.readonly; })).subscribe(function (event) {
757
- if (_this.editable) {
758
- if (_this.contentElement.nativeElement.isSameNode(event.target)) {
759
- event.preventDefault();
760
- event.stopImmediatePropagation();
761
- event.stopPropagation();
762
- }
763
- }
764
- else {
765
- _this._service.selectedBlockComponents = [_this];
766
- }
761
+ setTimeout(function () {
762
+ _this._initEvents();
763
+ _this._initMoveable();
764
+ _this._setTransform();
765
+ _this.width = _this.block.width;
766
+ _this.height = _this.block.height;
767
+ _this.top = _this.block.top;
768
+ _this.left = _this.block.left;
769
+ _this._blockEditor.registerBlock(_this.block, _this);
767
770
  });
768
- rxjs.fromEvent(this.el, 'dblclick')
769
- .pipe(operators.filter(function () { return (!_this.editable); }), operators.takeUntil(this._destroy$))
770
- .subscribe(function (event) {
771
- if (_this.block.readonly) {
772
- event.preventDefault();
771
+ };
772
+ FsBlockComponent.prototype.pxToIn = function (px) {
773
+ return this.round(px / 96, 2);
774
+ };
775
+ FsBlockComponent.prototype.round = function (value, decimals) {
776
+ return parseFloat(value.toFixed(decimals));
777
+ };
778
+ FsBlockComponent.prototype.deselect = function () {
779
+ this.transformable = false;
780
+ this.editable = false;
781
+ };
782
+ FsBlockComponent.prototype.deselectContent = function () {
783
+ if (window.getSelection) {
784
+ if (window.getSelection().empty) {
785
+ window.getSelection().empty();
773
786
  }
774
- else {
775
- _this.editable = true;
776
- _this._cdRef.markForCheck();
777
- setTimeout(function () {
778
- _this.selectAll();
779
- });
787
+ else if (window.getSelection().removeAllRanges) {
788
+ window.getSelection().removeAllRanges();
780
789
  }
781
- });
790
+ }
791
+ };
792
+ FsBlockComponent.prototype.selectAll = function () {
793
+ var range = document.createRange();
794
+ range.selectNodeContents(this.contentEditable.nativeElement);
795
+ var sel = window.getSelection();
796
+ sel.removeAllRanges();
797
+ sel.addRange(range);
798
+ };
799
+ FsBlockComponent.prototype.ngOnDestroy = function () {
800
+ this._blockEditor.unregisterBlock(this.block);
801
+ this._destroy$.next();
802
+ this._destroy$.complete();
803
+ };
804
+ FsBlockComponent.prototype._setTransform = function (transforms) {
805
+ if (transforms === void 0) { transforms = []; }
806
+ transforms = transforms !== null && transforms !== void 0 ? transforms : [];
807
+ if (this.block.rotate) {
808
+ transforms.push("rotate(" + this.block.rotate + "deg)");
809
+ }
810
+ this.el.style.transform = transforms.join(' ');
811
+ };
812
+ FsBlockComponent.prototype._triggerChanged = function () {
813
+ this._blockEditor.blockChange(this.block);
814
+ };
815
+ FsBlockComponent.prototype._initMoveable = function () {
816
+ var _this = this;
782
817
  this._moveable = new Moveable__default["default"](this._elementRef.nativeElement, {
783
818
  target: this.el,
784
- container: this._service.container,
819
+ container: this._blockEditor.container,
785
820
  draggable: false,
786
821
  resizable: false,
787
822
  scalable: false,
788
823
  rotatable: false,
789
824
  warpable: false,
790
825
  origin: false,
791
- keepRatio: false,
826
+ keepRatio: this.block.keepRatio,
792
827
  snappable: true,
793
- snapHorizontal: true,
794
- snapVertical: true,
795
- snapCenter: true,
796
- snapElement: true,
797
828
  edge: false,
798
829
  throttleDrag: 1,
799
830
  throttleScale: 0.01,
800
831
  throttleRotate: 1,
801
832
  throttleResize: 1,
802
833
  });
803
- this._service.registerBlock(this);
804
- this._moveable
834
+ this.moveable
805
835
  .on('clip', function (e) {
806
836
  _this.block.clipPath = e.clipStyle;
807
837
  e.target.style.clipPath = e.clipStyle;
808
838
  _this._triggerChanged();
809
839
  });
810
- this._moveable.on('dragStart', function (_a) {
840
+ this.moveable.on('dragStart', function (_a) {
811
841
  var target = _a.target, clientX = _a.clientX, clientY = _a.clientY;
812
842
  _this.editable = false;
813
843
  }).on('drag', function (_a) {
@@ -818,9 +848,10 @@
818
848
  _this.block.left = _this.pxToIn(left);
819
849
  _this._triggerChanged();
820
850
  });
821
- this._moveable.on('resizeStart', function (_a) {
851
+ this.moveable.on('resizeStart', function (_a) {
822
852
  var target = _a.target, clientX = _a.clientX, clientY = _a.clientY;
823
853
  _this.editable = false;
854
+ _this.zoompan.disable();
824
855
  }).on('resize', function (_a) {
825
856
  var target = _a.target, width = _a.width, height = _a.height, dist = _a.dist, delta = _a.delta, direction = _a.direction;
826
857
  width = _this.pxToIn(width);
@@ -851,9 +882,11 @@
851
882
  target.style.left = _this.block.left + _this.unit;
852
883
  _this._setTransform();
853
884
  _this._triggerChanged();
885
+ _this.zoompan.enable();
854
886
  });
855
- this._moveable.on('rotateStart', function (_a) {
887
+ this.moveable.on('rotateStart', function (_a) {
856
888
  var target = _a.target, clientX = _a.clientX, clientY = _a.clientY;
889
+ _this.zoompan.disable();
857
890
  _this.editable = false;
858
891
  _this._rotateStart = _this.block.rotate || 0;
859
892
  }).on('rotate', function (_a) {
@@ -861,54 +894,53 @@
861
894
  _this.block.rotate = _this._rotateStart + rotate;
862
895
  _this.el.style.transform = transform;
863
896
  _this._triggerChanged();
897
+ _this.zoompan.enable();
864
898
  });
865
899
  };
866
- FsBlockComponent.prototype.pxToIn = function (px) {
867
- return this.round(px / 96, 2);
868
- };
869
- FsBlockComponent.prototype.round = function (value, decimals) {
870
- return parseFloat(value.toFixed(decimals));
871
- };
872
- FsBlockComponent.prototype.deselect = function () {
873
- this.transformable = false;
874
- this.editable = false;
875
- };
876
- FsBlockComponent.prototype.deselectContent = function () {
877
- if (window.getSelection) {
878
- if (window.getSelection().empty) {
879
- window.getSelection().empty();
900
+ FsBlockComponent.prototype._initEvents = function () {
901
+ var _this = this;
902
+ rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
903
+ .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
904
+ _this.block.content = event.target.innerHTML;
905
+ _this._triggerChanged();
906
+ });
907
+ rxjs.fromEvent(this.el, 'mousedown')
908
+ .pipe(operators.takeUntil(this._destroy$), operators.filter(function () { return !_this.block.readonly; })).subscribe(function (event) {
909
+ _this.zoompan.disable();
910
+ if (_this.editable) {
911
+ if (_this.contentElement.nativeElement.isSameNode(event.target)) {
912
+ event.preventDefault();
913
+ event.stopImmediatePropagation();
914
+ event.stopPropagation();
915
+ }
880
916
  }
881
- else if (window.getSelection().removeAllRanges) {
882
- window.getSelection().removeAllRanges();
917
+ else {
918
+ _this._blockEditor.selectedBlock = _this.block;
883
919
  }
884
- }
885
- };
886
- FsBlockComponent.prototype.selectAll = function () {
887
- var range = document.createRange();
888
- range.selectNodeContents(this.contentEditable.nativeElement);
889
- var sel = window.getSelection();
890
- sel.removeAllRanges();
891
- sel.addRange(range);
892
- };
893
- FsBlockComponent.prototype.ngOnDestroy = function () {
894
- this._destroy$.next();
895
- this._destroy$.complete();
896
- };
897
- FsBlockComponent.prototype._setTransform = function (transforms) {
898
- if (transforms === void 0) { transforms = []; }
899
- transforms = transforms !== null && transforms !== void 0 ? transforms : [];
900
- if (this.block.rotate) {
901
- transforms.push("rotate(" + this.block.rotate + "deg)");
902
- }
903
- this.el.style.transform = transforms.join(' ');
904
- };
905
- FsBlockComponent.prototype._triggerChanged = function () {
906
- this.changed.emit(this.block);
920
+ });
921
+ rxjs.fromEvent(this.el, 'mouseup')
922
+ .pipe(operators.takeUntil(this._destroy$), operators.filter(function () { return !_this.block.readonly; })).subscribe(function () {
923
+ _this.zoompan.enable();
924
+ });
925
+ rxjs.fromEvent(this.el, 'dblclick')
926
+ .pipe(operators.filter(function () { return (!_this.editable); }), operators.takeUntil(this._destroy$))
927
+ .subscribe(function (event) {
928
+ if (_this.block.readonly) {
929
+ event.preventDefault();
930
+ }
931
+ else {
932
+ _this.editable = true;
933
+ _this._cdRef.markForCheck();
934
+ setTimeout(function () {
935
+ _this.selectAll();
936
+ });
937
+ }
938
+ });
907
939
  };
908
940
  return FsBlockComponent;
909
941
  }());
910
942
  FsBlockComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
911
- FsBlockComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html" }, outputs: { changed: "changed" }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n #element\n class=\"block\"\n [ngClass]=\"{ editable: editable, readonly: block.readonly }\">\n <div\n #contentElement\n class=\"content\"\n [style.zIndex]=\"block.index\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + unit : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + unit : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + unit : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + unit : ''\"\n [style.padding]=\"block.padding ? block.padding + unit : ''\"\n [style.clipPath]=\"block.clipPath\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + unit : ''\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <img [src]=\"block.imageUrl\" *ngIf=\"block.imageUrl\">\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n", styles: [".block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.block .content-editable{outline:none;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:1px dashed #c5c5c5;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i7__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
943
+ FsBlockComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [ngClass]=\"{ editable: editable, readonly: block.readonly }\">\n <div\n #contentElement\n class=\"content\"\n [style.zIndex]=\"block.index\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + unit : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + unit : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + unit : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + unit : ''\"\n [style.padding]=\"block.padding ? block.padding + unit : ''\"\n [style.clipPath]=\"block.clipPath\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + unit : ''\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <img [src]=\"block.imageUrl\">\n </ng-container>\n <img [src]=\"block.imageUrl\" *ngIf=\"block.imageUrl\">\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block .content-editable{outline:none;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:1px dashed #c5c5c5;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i9__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
912
944
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
913
945
  type: i0.Component,
914
946
  args: [{
@@ -930,8 +962,8 @@
930
962
  type: i0.Input
931
963
  }], html: [{
932
964
  type: i0.Input
933
- }], changed: [{
934
- type: i0.Output
965
+ }], zoompan: [{
966
+ type: i0.Input
935
967
  }] } });
936
968
 
937
969
  var FsBlockEditorSidebarPanelDirective = /** @class */ (function () {
@@ -954,42 +986,29 @@
954
986
  type: i0.Input
955
987
  }] } });
956
988
 
957
- var FsBlockEditorMarginDirective = /** @class */ (function () {
958
- function FsBlockEditorMarginDirective(_elementRef) {
959
- this._elementRef = _elementRef;
960
- }
961
- Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
962
- get: function () {
963
- return this._elementRef.nativeElement;
964
- },
965
- enumerable: false,
966
- configurable: true
967
- });
968
- return FsBlockEditorMarginDirective;
969
- }());
970
- 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 });
971
- FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
972
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
973
- type: i0.Directive,
974
- args: [{
975
- selector: '[fsBlockEditorMargin]'
976
- }]
977
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
989
+ var BlockTypes = [
990
+ { value: exports.BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4' },
991
+ { value: exports.BlockType.ShortText, name: 'Short Text', icon: 'short_text' },
992
+ { value: exports.BlockType.LongText, name: 'Long Text', icon: 'subject' },
993
+ { value: exports.BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked' },
994
+ { value: exports.BlockType.Checkbox, name: 'Checkbox', icon: 'check_box' },
995
+ { value: exports.BlockType.Date, name: 'Date', icon: 'calendar_today' },
996
+ { value: exports.BlockType.Signature, name: 'Signature', icon: 'draw' },
997
+ { value: exports.BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*' },
998
+ { value: exports.BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf' },
999
+ ];
978
1000
 
979
1001
  var SidebarComponent = /** @class */ (function () {
980
- function SidebarComponent(_el, _service, _cdRef) {
1002
+ function SidebarComponent(_el, _blockEditor, _cdRef, _prompt) {
981
1003
  this._el = _el;
982
- this._service = _service;
1004
+ this._blockEditor = _blockEditor;
983
1005
  this._cdRef = _cdRef;
1006
+ this._prompt = _prompt;
1007
+ this.BlockTypes = BlockTypes;
1008
+ this.blockTypeNames = common.index(BlockTypes, 'value', 'name');
1009
+ this.BlockType = exports.BlockType;
984
1010
  this._destroy$ = new rxjs.Subject();
985
1011
  }
986
- Object.defineProperty(SidebarComponent.prototype, "changeDetector", {
987
- get: function () {
988
- return this._cdRef;
989
- },
990
- enumerable: false,
991
- configurable: true
992
- });
993
1012
  Object.defineProperty(SidebarComponent.prototype, "el", {
994
1013
  get: function () {
995
1014
  return this._el.nativeElement;
@@ -999,233 +1018,155 @@
999
1018
  });
1000
1019
  SidebarComponent.prototype.ngOnInit = function () {
1001
1020
  var _this = this;
1002
- this._service.selectedBlockComponents$
1021
+ this._blockEditor.selectedBlocks$
1003
1022
  .pipe(operators.takeUntil(this._destroy$))
1004
1023
  .subscribe(function (blocks) {
1005
1024
  _this.clippable = false;
1006
- _this.block = blocks[0] ? blocks[0].block : null;
1007
- _this.changeDetector.markForCheck();
1008
- if (_this.config.blocksSelected) {
1009
- _this.config.blocksSelected(blocks.map(function (block) { return block.block; }));
1010
- }
1025
+ _this.block = blocks[0] ? blocks[0] : null;
1026
+ _this._cdRef.markForCheck();
1027
+ });
1028
+ this._blockEditor.blockChanged$
1029
+ .pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
1030
+ .subscribe(function () {
1031
+ _this._cdRef.markForCheck();
1011
1032
  });
1012
1033
  };
1013
1034
  SidebarComponent.prototype.verticalAlignClick = function (value) {
1014
- this._service.selectedBlockComponents.forEach(function (block) {
1015
- block.verticalAlign = value;
1016
- });
1035
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
1017
1036
  };
1018
1037
  SidebarComponent.prototype.boldClick = function () {
1019
- this._service.selectedBlockComponents.forEach(function (block) {
1020
- block.bold = !block.bold;
1021
- });
1038
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
1022
1039
  };
1023
1040
  SidebarComponent.prototype.fontColorChange = function (value) {
1024
- this._service.selectedBlockComponents.forEach(function (block) {
1025
- block.fontColor = value;
1026
- });
1041
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
1027
1042
  };
1028
1043
  SidebarComponent.prototype.lineHeightChange = function (value) {
1029
- var _this = this;
1030
- this._service.selectedBlockComponents.forEach(function (block) {
1031
- if (_this.validNumeric(value)) {
1032
- block.lineHeight = value || null;
1033
- }
1034
- });
1044
+ value = this.validNumeric(value) ? value : null;
1045
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'lineHeight');
1035
1046
  };
1036
1047
  SidebarComponent.prototype.fontSizeChange = function (value) {
1037
- var _this = this;
1038
- this._service.selectedBlockComponents.forEach(function (block) {
1039
- if (_this.validNumeric(value)) {
1040
- block.fontSize = value || null;
1041
- }
1042
- });
1048
+ value = this.validNumeric(value) ? value : null;
1049
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontSize');
1043
1050
  };
1044
1051
  SidebarComponent.prototype.borderWidthChange = function (value) {
1045
- var _this = this;
1046
- this._service.selectedBlockComponents.forEach(function (block) {
1047
- if (_this.validNumeric(value)) {
1048
- block.borderWidth = value || null;
1049
- }
1050
- });
1052
+ value = this.validNumeric(value) ? value : null;
1053
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderWidth');
1051
1054
  };
1052
1055
  SidebarComponent.prototype.italicClick = function () {
1053
- this._service.selectedBlockComponents.forEach(function (block) {
1054
- block.italic = !block.italic;
1055
- });
1056
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
1056
1057
  };
1057
1058
  SidebarComponent.prototype.underlineClick = function () {
1058
- this._service.selectedBlockComponents.forEach(function (block) {
1059
- block.underline = !block.underline;
1060
- });
1059
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
1061
1060
  };
1062
1061
  SidebarComponent.prototype.backgroundColorChange = function (value) {
1063
- this._service.selectedBlockComponents.forEach(function (block) {
1064
- block.backgroundColor = value;
1065
- });
1062
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
1066
1063
  };
1067
1064
  SidebarComponent.prototype.widthChange = function (value) {
1068
- var _this = this;
1069
- this._service.selectedBlockComponents.forEach(function (block) {
1070
- if (_this.validNumeric(value)) {
1071
- block.width = value;
1072
- }
1073
- });
1065
+ value = this.validNumeric(value) ? value : null;
1066
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'width');
1074
1067
  };
1075
1068
  SidebarComponent.prototype.heightChange = function (value) {
1076
- var _this = this;
1077
- this._service.selectedBlockComponents.forEach(function (block) {
1078
- if (_this.validNumeric(value)) {
1079
- block.height = value;
1080
- }
1081
- });
1069
+ value = this.validNumeric(value) ? value : null;
1070
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'height');
1082
1071
  };
1083
1072
  SidebarComponent.prototype.topChange = function (value) {
1084
- var _this = this;
1085
- this._service.selectedBlockComponents.forEach(function (block) {
1086
- if (_this.validNumeric(value)) {
1087
- block.top = value;
1088
- }
1089
- });
1073
+ value = this.validNumeric(value) ? value : null;
1074
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'top');
1090
1075
  };
1091
1076
  SidebarComponent.prototype.leftChange = function (value) {
1092
- var _this = this;
1093
- this._service.selectedBlockComponents.forEach(function (block) {
1094
- if (_this.validNumeric(value)) {
1095
- block.left = value;
1096
- }
1097
- });
1077
+ value = this.validNumeric(value) ? value : null;
1078
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'left');
1098
1079
  };
1099
1080
  SidebarComponent.prototype.rotateChange = function (value) {
1100
- var _this = this;
1101
- this._service.selectedBlockComponents.forEach(function (block) {
1102
- if (_this.validNumeric(value)) {
1103
- block.rotate = value;
1104
- }
1105
- });
1081
+ value = this.validNumeric(value) ? value : null;
1082
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'rotate');
1106
1083
  };
1107
1084
  SidebarComponent.prototype.paddingChange = function (name, value) {
1108
- var _this = this;
1109
- this._service.selectedBlockComponents.forEach(function (block) {
1110
- if (_this.validNumeric(value)) {
1111
- block.padding(name, value || null);
1112
- }
1113
- });
1085
+ value = this.validNumeric(value) ? value : null;
1086
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'padding');
1114
1087
  };
1115
1088
  SidebarComponent.prototype.paddingAllChange = function (value) {
1116
- var _this = this;
1117
- this._service.selectedBlockComponents.forEach(function (block) {
1118
- if (_this.validNumeric(value)) {
1119
- block.paddingAll = value;
1120
- }
1121
- });
1089
+ value = this.validNumeric(value) ? value : null;
1090
+ this.block.paddingTop = value;
1091
+ this.block.paddingLeft = value;
1092
+ this.block.paddingBottom = value;
1093
+ this.block.paddingRight = value;
1094
+ this.paddingChange('top', value);
1095
+ this.paddingChange('left', value);
1096
+ this.paddingChange('right', value);
1097
+ this.paddingChange('bottom', value);
1122
1098
  };
1123
1099
  SidebarComponent.prototype.borderColorChange = function (value) {
1124
- this._service.selectedBlockComponents.forEach(function (block) {
1125
- block.borderColor = value;
1126
- });
1100
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
1101
+ };
1102
+ SidebarComponent.prototype.toggleKeepRatio = function () {
1103
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
1127
1104
  };
1128
1105
  SidebarComponent.prototype.horizontalAlignClick = function (value) {
1129
- this._service.selectedBlockComponents.forEach(function (block) {
1130
- block.horizontalAlign = value;
1131
- });
1106
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
1132
1107
  };
1133
- SidebarComponent.prototype.shapeRound = function (value) {
1134
- this._service.selectedBlockComponents.forEach(function (block) {
1135
- block.shapeRound(value, block.block[value] === 'round' ? 'square' : 'round');
1136
- });
1108
+ SidebarComponent.prototype.shapeRound = function (name) {
1109
+ var value = this.block[name] === 'round' ? 'square' : 'round';
1110
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1137
1111
  };
1138
1112
  SidebarComponent.prototype.imageRemove = function () {
1139
- this._service.selectedBlockComponents.forEach(function (block) {
1140
- block.imageUrl = null;
1141
- });
1113
+ this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
1142
1114
  };
1143
1115
  SidebarComponent.prototype.imageClip = function () {
1144
- var _this = this;
1145
1116
  this.clippable = !this.clippable;
1146
- this._service.selectedBlockComponents.forEach(function (block) {
1147
- block.clippable = _this.clippable;
1148
- });
1117
+ this._blockEditor.selectedBlockComponentChangeProperty(this.clippable, 'clippable');
1149
1118
  };
1150
1119
  SidebarComponent.prototype.shapeRadiusChange = function (value) {
1151
- this._service.selectedBlockComponents.forEach(function (block) {
1152
- block.shapeRadius = value;
1153
- });
1120
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'shapeRadius');
1154
1121
  };
1155
- SidebarComponent.prototype.fileSelect = function (fsFile) {
1122
+ SidebarComponent.prototype.blockChangeProperty = function (value, name) {
1123
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
1124
+ };
1125
+ SidebarComponent.prototype.imageSelect = function (fsFile) {
1156
1126
  var _this = this;
1157
- if (this.config.fileUpload) {
1158
- this.config.fileUpload(fsFile.file)
1127
+ if (this.config.imageUpload) {
1128
+ this.config.imageUpload(fsFile.file)
1159
1129
  .subscribe(function (value) {
1160
- _this._service.selectedBlockComponents.forEach(function (block) {
1161
- block.imageUrl = value;
1162
- });
1130
+ _this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
1163
1131
  });
1164
1132
  }
1165
1133
  };
1166
1134
  SidebarComponent.prototype.blockRemoveClick = function () {
1167
1135
  var _this = this;
1168
- if (this.config.blocksRemoved) {
1169
- this.config.blocksRemoved(this._service.selectedBlocks)
1170
- .pipe(operators.takeUntil(this._destroy$))
1136
+ if (this.config.blocksRemove) {
1137
+ this._prompt.confirm({
1138
+ title: 'Confirm',
1139
+ template: 'Are you sure your would like to delete this block?',
1140
+ })
1141
+ .pipe(operators.switchMap(function () { return _this.config.blocksRemove(_this._blockEditor.selectedBlocks); }), operators.takeUntil(this._destroy$))
1171
1142
  .subscribe(function () {
1172
- _this._service.selectedBlocks.forEach(function (block) {
1173
- _this._service.removeBlock(block);
1174
- });
1175
- _this._service.selectedBlockComponents = [];
1176
- });
1177
- }
1178
- };
1179
- SidebarComponent.prototype.blockAddClick = function () {
1180
- var _this = this;
1181
- var width = (this.config.width * .333).toFixed(2);
1182
- var height = (this.config.height * .333).toFixed(2);
1183
- var reference = common.guid();
1184
- var block = {
1185
- type: 'text',
1186
- reference: reference,
1187
- top: height,
1188
- left: width,
1189
- width: width,
1190
- height: height,
1191
- };
1192
- if (this.config.blockAdded) {
1193
- this.config.blockAdded(block)
1194
- .pipe(operators.takeUntil(this._destroy$))
1195
- .subscribe(function (block) {
1196
- _this.addBlock(block);
1197
- _this.changeDetector.markForCheck();
1198
- _this.blockAdded
1199
- .pipe(operators.take(1), operators.takeUntil(_this._destroy$))
1200
- .subscribe(function (blockComponent) {
1201
- _this._service.selectedBlockComponents = [blockComponent];
1202
- });
1143
+ _this._blockEditor.removeSelectedBlocks();
1203
1144
  });
1204
1145
  }
1205
1146
  };
1206
- SidebarComponent.prototype.addBlock = function (block) {
1207
- this._service.addBlock(block);
1208
- this._updateIndexes();
1209
- };
1210
- SidebarComponent.prototype._updateIndexes = function () {
1211
- var _this = this;
1212
- var sort = this.blocks.slice().sort(function (a, b) {
1213
- return a.index > b.index ? 1 : -1;
1147
+ SidebarComponent.prototype.blockUpload = function (blockType, fsFile) {
1148
+ var block = this._blockEditor.sanitizeNewBlock({
1149
+ type: blockType,
1214
1150
  });
1215
- sort.forEach(function (block, index) {
1216
- _this.blocks.find(function (item) {
1217
- return block.reference === item.reference;
1218
- }).index = index;
1151
+ this._blockEditor.blockUpload(block, fsFile);
1152
+ };
1153
+ SidebarComponent.prototype.blockAdd = function (type) {
1154
+ if (type === exports.BlockType.Pdf || type === exports.BlockType.Image) {
1155
+ return;
1156
+ }
1157
+ var block = this._blockEditor.sanitizeNewBlock({
1158
+ type: type,
1219
1159
  });
1160
+ this._blockEditor.blockAdd(block);
1220
1161
  };
1221
1162
  SidebarComponent.prototype.layerMove = function (direction) {
1222
1163
  var _this = this;
1223
- this._service.blockComponents.forEach(function (blockComponent) {
1224
- if (_this._service.isSelectedBlock(blockComponent)) {
1164
+ this._blockEditor.blockComponents.forEach(function (blockComponent) {
1165
+ if (_this._blockEditor.isSelectedBlock(blockComponent)) {
1225
1166
  blockComponent.block.index + (999 * direction);
1226
1167
  }
1227
1168
  });
1228
- var sorted = this._service.blockComponents.sort(function (a, b) {
1169
+ var sorted = this._blockEditor.blockComponents.sort(function (a, b) {
1229
1170
  return a.index > b.index ? 1 : -1;
1230
1171
  });
1231
1172
  sorted.forEach(function (item, index) {
@@ -1243,7 +1184,7 @@
1243
1184
  this.layerMove(-1);
1244
1185
  };
1245
1186
  SidebarComponent.prototype.getBlock = function (reference) {
1246
- return this._service.blocks.find(function (block) {
1187
+ return this._blockEditor.blocks.find(function (block) {
1247
1188
  return block.reference === reference;
1248
1189
  });
1249
1190
  };
@@ -1264,8 +1205,8 @@
1264
1205
  };
1265
1206
  return SidebarComponent;
1266
1207
  }());
1267
- SidebarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1268
- SidebarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks", blockAdded: "blockAdded" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0__namespace, template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockAddClick()\">\n <mat-icon>add</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n </div>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"fileSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n", styles: [".sidebar{width:285px;font-size:14px;height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .mat-form-field-prefix,.sidebar .sidebar-row ::ng-deep .field-label{color:#a5a5a5;font-size:11px;margin-right:2px}.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.6);top:-6px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px;border-bottom:1px solid #dadada}.sidebar .sidebar-panel.info-panel .sidebar-row{justify-content:space-evenly}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.info-panel .sidebar-row >{margin:0}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}\n"], components: [{ type: i2__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i3__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i5__namespace.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }, { type: i6__namespace.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i9__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i9__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i9__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4__namespace.MatPrefix, selector: "[matPrefix]" }, { type: i7__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1208
+ SidebarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }, { token: i0__namespace.ChangeDetectorRef }, { token: i2__namespace.FsPrompt }], target: i0__namespace.ɵɵFactoryTarget.Component });
1209
+ SidebarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0__namespace, template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Add</div>\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container> \n <ng-container *ngSwitchDefault>\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [accept]=\"blockType.accept\">\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </fs-file>\n </ng-template>\n\n <ng-template #addButton>\n <button \n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n </ng-template>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n <div class=\"sidebar-panel form-field-panel\">\n <div class=\"sidebar-label\">{{blockTypeNames[block.type]}} Field</div>\n <div class=\"sidebar-row\">\n\n <mat-form-field class=\"form-field-padless full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless full-width\">\n <input\n matInput\n [ngModel]=\"block.format\"\n name=\"format\"\n placeholder=\"Format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n \n <mat-form-field class=\"form-field-padless full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless full-width\">\n <mat-label>Index</mat-label>\n <input\n matInput\n [(ngModel)]=\"block.index\"\n name=\"index\"\n (ngModelChange)=\"blockChangeProperty($event, 'index')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox \n name=\"required\" \n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"block.type !== BlockType.Pdf\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"imageSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n", styles: [".sidebar{width:285px;font-size:14px;height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}\n"], components: [{ type: i3__namespace.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i4__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i5__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7__namespace.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i8__namespace.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }], directives: [{ type: i9__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i9__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i10__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i12__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i12__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i12__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6__namespace.MatPrefix, selector: "[matPrefix]" }, { type: i11__namespace.MatTextareaAutosize, selector: "textarea[mat-autosize], textarea[matTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "matAutosizeMinRows", "matAutosizeMaxRows", "mat-autosize", "matTextareaAutosize"], exportAs: ["matTextareaAutosize"] }, { type: i6__namespace.MatLabel, selector: "mat-label" }, { type: i9__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1269
1210
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SidebarComponent, decorators: [{
1270
1211
  type: i0.Component,
1271
1212
  args: [{
@@ -1274,55 +1215,80 @@
1274
1215
  styleUrls: ['sidebar.component.scss'],
1275
1216
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1276
1217
  }]
1277
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { sidebarPanels: [{
1218
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace.FsPrompt }]; }, propDecorators: { sidebarPanels: [{
1278
1219
  type: i0.ContentChildren,
1279
1220
  args: [FsBlockEditorSidebarPanelDirective]
1280
1221
  }], config: [{
1281
1222
  type: i0.Input
1282
1223
  }], blocks: [{
1283
1224
  type: i0.Input
1284
- }], blockAdded: [{
1285
- type: i0.Input
1286
1225
  }] } });
1287
1226
 
1288
- var FsBlockEditorComponent = /** @class */ (function () {
1289
- function FsBlockEditorComponent(_el, _service, _cdRef, _differs) {
1227
+ var FsBlockEditorMarginDirective = /** @class */ (function () {
1228
+ function FsBlockEditorMarginDirective(_elementRef) {
1229
+ this._elementRef = _elementRef;
1230
+ }
1231
+ Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
1232
+ get: function () {
1233
+ return this._elementRef.nativeElement;
1234
+ },
1235
+ enumerable: false,
1236
+ configurable: true
1237
+ });
1238
+ return FsBlockEditorMarginDirective;
1239
+ }());
1240
+ FsBlockEditorMarginDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1241
+ FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
1242
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
1243
+ type: i0.Directive,
1244
+ args: [{
1245
+ selector: '[fsBlockEditorMargin]'
1246
+ }]
1247
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
1248
+
1249
+ var ArtboardComponent = /** @class */ (function () {
1250
+ function ArtboardComponent(_el, _blockEditor, _cdRef, _differs) {
1290
1251
  this._el = _el;
1291
- this._service = _service;
1252
+ this._blockEditor = _blockEditor;
1292
1253
  this._cdRef = _cdRef;
1293
1254
  this._differs = _differs;
1294
- this.blockAdded = new i0.EventEmitter();
1295
- this.blockRemoved = new i0.EventEmitter();
1255
+ this.blocks = [];
1296
1256
  this._destroy$ = new rxjs.Subject();
1297
1257
  this._differ = _differs.find([]).create(null);
1298
1258
  }
1299
- Object.defineProperty(FsBlockEditorComponent.prototype, "el", {
1259
+ Object.defineProperty(ArtboardComponent.prototype, "el", {
1300
1260
  get: function () {
1301
1261
  return this._el.nativeElement;
1302
1262
  },
1303
1263
  enumerable: false,
1304
1264
  configurable: true
1305
1265
  });
1306
- FsBlockEditorComponent.prototype.ngOnInit = function () {
1266
+ ArtboardComponent.prototype.ngOnInit = function () {
1307
1267
  var _this = this;
1308
1268
  this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1309
- this._service.registerContainer(this.artboard.nativeElement);
1310
- this._service.registerMargin(this.marginContainer.nativeElement);
1311
- this._service.blocks = this.config.blocks;
1312
- this._service.config = this.config;
1313
- this._service.blocks$
1269
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
1270
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
1271
+ this._blockEditor.blocks$
1314
1272
  .pipe(operators.takeUntil(this._destroy$))
1315
1273
  .subscribe(function (blocks) {
1316
1274
  _this.blocks = blocks;
1275
+ _this._cdRef.markForCheck();
1276
+ });
1277
+ this._blockEditor.blockAdded$
1278
+ .pipe(operators.delay(300), operators.takeUntil(this._destroy$))
1279
+ .subscribe(function (block) {
1280
+ _this._blockEditor.selectedBlocks = [block];
1281
+ _this._cdRef.markForCheck();
1317
1282
  });
1318
1283
  rxjs.fromEvent(window, 'keydown')
1319
1284
  .pipe(operators.takeUntil(this._destroy$), operators.filter(function (event) {
1320
- return !!event.key.match(/^Arrow/) && !!_this._service.selectedBlockComponents.length;
1285
+ return !!event.key.match(/^Arrow/) && !!_this._blockEditor.selectedBlocks.length;
1321
1286
  }))
1322
1287
  .subscribe(function (event) {
1323
1288
  event.preventDefault();
1324
1289
  var inchPixel = 1 / 100;
1325
- _this._service.selectedBlockComponents.forEach(function (blockComponent) {
1290
+ _this._blockEditor.selectedComponentBlocks
1291
+ .forEach(function (blockComponent) {
1326
1292
  switch (event.key) {
1327
1293
  case 'ArrowUp':
1328
1294
  blockComponent.top = blockComponent.block.top - inchPixel;
@@ -1340,46 +1306,111 @@
1340
1306
  });
1341
1307
  });
1342
1308
  };
1343
- FsBlockEditorComponent.prototype.artboardClick = function (event) {
1344
- if (event.target.isSameNode(this.artboard.nativeElement) ||
1345
- event.target.isSameNode(this.artboardContainer.nativeElement)) {
1346
- this._service.selectedBlockComponents.forEach(function (block) {
1347
- block.deselect();
1348
- block.markForCheck();
1349
- });
1350
- this._service.selectedBlockComponents = [];
1351
- }
1352
- };
1353
- FsBlockEditorComponent.prototype.blockChanged = function (block) {
1354
- this.sidebar.changeDetector.markForCheck();
1309
+ ArtboardComponent.prototype.blockChanged = function (block) {
1355
1310
  if (this.config.blockChanged) {
1356
1311
  this.config.blockChanged(block);
1357
1312
  }
1358
1313
  };
1359
- FsBlockEditorComponent.prototype.ngAfterViewInit = function () {
1314
+ ArtboardComponent.prototype.ngAfterViewInit = function () {
1315
+ // this.blockComponents.changes
1316
+ // .pipe(
1317
+ // takeUntil(this._destroy$),
1318
+ // )
1319
+ // .subscribe((changes) => {
1320
+ // const changeDiff = this._differ.diff(changes);
1321
+ // if (changeDiff) {
1322
+ // changeDiff.forEachAddedItem((change) => {
1323
+ // //this.blockAdded.emit(change.item);
1324
+ // });
1325
+ // changeDiff.forEachRemovedItem((change) => {
1326
+ // //this.blockRemoved.emit(change.item);
1327
+ // });
1328
+ // }
1329
+ // });
1330
+ };
1331
+ ArtboardComponent.prototype.ngOnDestroy = function () {
1332
+ this._destroy$.next();
1333
+ this._destroy$.complete();
1334
+ };
1335
+ return ArtboardComponent;
1336
+ }());
1337
+ ArtboardComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.IterableDiffers }], target: i0__namespace.ɵɵFactoryTarget.Component });
1338
+ ArtboardComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ArtboardComponent, selector: "app-artboard", inputs: { config: "config", zoompan: "zoompan" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "artboard", first: true, predicate: ["artboard"], descendants: true, static: true }, { propertyName: "marginContainer", first: true, predicate: ["marginContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "blockComponents", predicate: FsBlockComponent, descendants: true }, { propertyName: "margins", predicate: FsBlockEditorMarginDirective, descendants: true }], ngImport: i0__namespace, template: "<div\n #artboard\n class=\"artboard mat-elevation-z4 deselectable\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks\"\n [zoompan]=\"zoompan\"\n [block]=\"block\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\">\n </div>\n</div> \n\n", styles: [".artboard{position:relative;display:inline-flex}.artboard .margin-container{position:absolute;z-index:-1}.artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.artboard .margin.margin-top,.artboard .margin.margin-bottom{width:100%;border-top-width:1px}.artboard .margin.margin-left,.artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html", "zoompan"] }], directives: [{ type: i9__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1339
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ArtboardComponent, decorators: [{
1340
+ type: i0.Component,
1341
+ args: [{
1342
+ selector: 'app-artboard',
1343
+ templateUrl: 'artboard.component.html',
1344
+ styleUrls: ['artboard.component.scss'],
1345
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1346
+ }]
1347
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
1348
+ type: i0.ContentChildren,
1349
+ args: [FsBlockEditorSidebarPanelDirective]
1350
+ }], blockComponents: [{
1351
+ type: i0.ViewChildren,
1352
+ args: [FsBlockComponent]
1353
+ }], artboard: [{
1354
+ type: i0.ViewChild,
1355
+ args: ['artboard', { static: true }]
1356
+ }], marginContainer: [{
1357
+ type: i0.ViewChild,
1358
+ args: ['marginContainer', { static: true }]
1359
+ }], margins: [{
1360
+ type: i0.ViewChildren,
1361
+ args: [FsBlockEditorMarginDirective]
1362
+ }], sidebar: [{
1363
+ type: i0.ViewChild,
1364
+ args: [SidebarComponent, { static: true }]
1365
+ }], config: [{
1366
+ type: i0.Input
1367
+ }], zoompan: [{
1368
+ type: i0.Input
1369
+ }] } });
1370
+
1371
+ var FsBlockEditorComponent = /** @class */ (function () {
1372
+ function FsBlockEditorComponent(_el, _blockEditor) {
1373
+ this._el = _el;
1374
+ this._blockEditor = _blockEditor;
1375
+ this._destroy$ = new rxjs.Subject();
1376
+ }
1377
+ Object.defineProperty(FsBlockEditorComponent.prototype, "el", {
1378
+ get: function () {
1379
+ return this._el.nativeElement;
1380
+ },
1381
+ enumerable: false,
1382
+ configurable: true
1383
+ });
1384
+ FsBlockEditorComponent.prototype.ngOnInit = function () {
1360
1385
  var _this = this;
1361
- this.blockComponents.changes.subscribe(function (changes) {
1362
- var changeDiff = _this._differ.diff(changes);
1363
- if (changeDiff) {
1364
- changeDiff.forEachAddedItem(function (change) {
1365
- _this.blockAdded.emit(change.item);
1366
- });
1367
- changeDiff.forEachRemovedItem(function (change) {
1368
- _this.blockRemoved.emit(change.item);
1369
- });
1370
- }
1386
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
1387
+ this._blockEditor.blocks = this.config.blocks;
1388
+ this._blockEditor.config = this.config;
1389
+ this._blockEditor.blocks$
1390
+ .pipe(operators.takeUntil(this._destroy$))
1391
+ .subscribe(function (blocks) {
1392
+ _this.blocks = blocks;
1393
+ });
1394
+ setTimeout(function () {
1395
+ _this.zoompan.center(_this.artboard.nativeElement, { vertical: false });
1371
1396
  });
1372
1397
  };
1398
+ FsBlockEditorComponent.prototype.artboardClick = function (event) {
1399
+ if (event.target.classList.contains('deselectable')) {
1400
+ this.zoompan.enable();
1401
+ this._blockEditor.selectedBlocks = [];
1402
+ }
1403
+ };
1373
1404
  FsBlockEditorComponent.prototype.ngOnDestroy = function () {
1374
1405
  this._destroy$.next();
1375
1406
  this._destroy$.complete();
1376
1407
  };
1377
1408
  return FsBlockEditorComponent;
1378
1409
  }());
1379
- FsBlockEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.IterableDiffers }], target: i0__namespace.ɵɵFactoryTarget.Component });
1380
- FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, outputs: { blockAdded: "blockAdded", blockRemoved: "blockRemoved" }, providers: [
1410
+ FsBlockEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1411
+ FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
1381
1412
  BlockEditorService,
1382
- ], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "artboard", first: true, predicate: ["artboard"], descendants: true, static: true }, { propertyName: "marginContainer", first: true, predicate: ["marginContainer"], descendants: true, static: true }, { propertyName: "artboardContainer", first: true, predicate: ["artboardContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "blockComponents", predicate: FsBlockComponent, descendants: true }, { propertyName: "margins", predicate: FsBlockEditorMarginDirective, descendants: true }], ngImport: i0__namespace, template: "<div class=\"editor-container\">\n <div\n #artboardContainer\n class=\"artboard-container\"\n (click)=\"artboardClick($event)\">\n <div\n #artboard\n class=\"artboard mat-elevation-z2\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks; trackBy\"\n [block]=\"block\"\n (changed)=\"blockChanged($event)\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\"></div>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n [blockAdded]=\"blockAdded\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative}.editor-container .artboard-container{display:flex;flex-grow:1;justify-content:center;padding:25px;overflow:auto;min-width:0}.editor-container .artboard-container .artboard{position:relative}.editor-container .artboard-container .artboard .margin-container{position:absolute;z-index:-1}.editor-container .artboard-container .artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.editor-container .artboard-container .artboard .margin.margin-top,.editor-container .artboard-container .artboard .margin.margin-bottom{width:100%;border-top-width:1px}.editor-container .artboard-container .artboard .margin.margin-left,.editor-container .artboard-container .artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html"], outputs: ["changed"] }, { type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks", "blockAdded"] }], directives: [{ type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1413
+ ], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "zoompan", first: true, predicate: i2$1.FsZoomPanComponent, descendants: true, static: true }, { propertyName: "artboardContainer", first: true, predicate: ["artboardContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "artboard", first: true, predicate: ArtboardComponent, descendants: true, read: i0.ElementRef }], ngImport: i0__namespace, template: "<div class=\"editor-container deselectable\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\"\n (mousedown)=\"artboardClick($event)\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0}.editor-container .zoom-pan-container{flex:1}\n"], components: [{ type: i2__namespace$1.FsZoomPanComponent, selector: "fs-zoom-pan", inputs: ["zoomMax", "zoomMin", "zoomDefault", "top", "left"], outputs: ["moved", "zoomed"] }, { type: ArtboardComponent, selector: "app-artboard", inputs: ["config", "zoompan"] }, { type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks"] }], directives: [{ type: i2__namespace$1.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1383
1414
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, decorators: [{
1384
1415
  type: i0.Component,
1385
1416
  args: [{
@@ -1391,33 +1422,23 @@
1391
1422
  BlockEditorService,
1392
1423
  ]
1393
1424
  }]
1394
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
1425
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
1395
1426
  type: i0.ContentChildren,
1396
1427
  args: [FsBlockEditorSidebarPanelDirective]
1397
- }], blockComponents: [{
1398
- type: i0.ViewChildren,
1399
- args: [FsBlockComponent]
1400
- }], artboard: [{
1428
+ }], zoompan: [{
1401
1429
  type: i0.ViewChild,
1402
- args: ['artboard', { static: true }]
1403
- }], marginContainer: [{
1404
- type: i0.ViewChild,
1405
- args: ['marginContainer', { static: true }]
1406
- }], margins: [{
1407
- type: i0.ViewChildren,
1408
- args: [FsBlockEditorMarginDirective]
1430
+ args: [i2$1.FsZoomPanComponent, { static: true }]
1409
1431
  }], artboardContainer: [{
1410
1432
  type: i0.ViewChild,
1411
1433
  args: ['artboardContainer', { static: true }]
1412
1434
  }], sidebar: [{
1413
1435
  type: i0.ViewChild,
1414
1436
  args: [SidebarComponent, { static: true }]
1437
+ }], artboard: [{
1438
+ type: i0.ViewChild,
1439
+ args: [ArtboardComponent, { read: i0.ElementRef }]
1415
1440
  }], config: [{
1416
1441
  type: i0.Input
1417
- }], blockAdded: [{
1418
- type: i0.Output
1419
- }], blockRemoved: [{
1420
- type: i0.Output
1421
1442
  }] } });
1422
1443
 
1423
1444
  var FsBlockEditorModule = /** @class */ (function () {
@@ -1435,38 +1456,51 @@
1435
1456
  FsBlockEditorComponent,
1436
1457
  FsBlockEditorSidebarPanelDirective,
1437
1458
  FsBlockEditorMarginDirective,
1438
- SidebarComponent], imports: [i7.CommonModule,
1439
- i9.FormsModule,
1440
- i3.MatIconModule,
1441
- i2.MatButtonModule,
1442
- i8.MatInputModule,
1443
- i4.MatFormFieldModule,
1444
- i6.FsFileModule,
1445
- i5.FsColorPickerModule], exports: [FsBlockComponent,
1459
+ SidebarComponent,
1460
+ ArtboardComponent], imports: [i9.CommonModule,
1461
+ i12.FormsModule,
1462
+ i5.MatIconModule,
1463
+ i4.MatButtonModule,
1464
+ i11.MatInputModule,
1465
+ i6.MatFormFieldModule,
1466
+ i7.MatCheckboxModule,
1467
+ i10.MatTooltipModule,
1468
+ i3.FsFileModule,
1469
+ i8.FsColorPickerModule,
1470
+ menu.FsMenuModule,
1471
+ i2$1.FsZoomPanModule], exports: [FsBlockComponent,
1446
1472
  FsBlockEditorComponent,
1447
1473
  FsBlockEditorSidebarPanelDirective] });
1448
1474
  FsBlockEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, imports: [[
1449
- i7.CommonModule,
1450
- i9.FormsModule,
1451
- i3.MatIconModule,
1452
- i2.MatButtonModule,
1453
- i8.MatInputModule,
1454
- i4.MatFormFieldModule,
1455
- i6.FsFileModule,
1456
- i5.FsColorPickerModule,
1475
+ i9.CommonModule,
1476
+ i12.FormsModule,
1477
+ i5.MatIconModule,
1478
+ i4.MatButtonModule,
1479
+ i11.MatInputModule,
1480
+ i6.MatFormFieldModule,
1481
+ i7.MatCheckboxModule,
1482
+ i10.MatTooltipModule,
1483
+ i3.FsFileModule,
1484
+ i8.FsColorPickerModule,
1485
+ menu.FsMenuModule,
1486
+ i2$1.FsZoomPanModule,
1457
1487
  ]] });
1458
1488
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorModule, decorators: [{
1459
1489
  type: i0.NgModule,
1460
1490
  args: [{
1461
1491
  imports: [
1462
- i7.CommonModule,
1463
- i9.FormsModule,
1464
- i3.MatIconModule,
1465
- i2.MatButtonModule,
1466
- i8.MatInputModule,
1467
- i4.MatFormFieldModule,
1468
- i6.FsFileModule,
1469
- i5.FsColorPickerModule,
1492
+ i9.CommonModule,
1493
+ i12.FormsModule,
1494
+ i5.MatIconModule,
1495
+ i4.MatButtonModule,
1496
+ i11.MatInputModule,
1497
+ i6.MatFormFieldModule,
1498
+ i7.MatCheckboxModule,
1499
+ i10.MatTooltipModule,
1500
+ i3.FsFileModule,
1501
+ i8.FsColorPickerModule,
1502
+ menu.FsMenuModule,
1503
+ i2$1.FsZoomPanModule,
1470
1504
  ],
1471
1505
  exports: [
1472
1506
  FsBlockComponent,
@@ -1479,18 +1513,16 @@
1479
1513
  FsBlockEditorSidebarPanelDirective,
1480
1514
  FsBlockEditorMarginDirective,
1481
1515
  SidebarComponent,
1516
+ ArtboardComponent,
1482
1517
  ],
1483
1518
  }]
1484
1519
  }] });
1485
1520
 
1486
- /*
1487
- * Public API Surface of fs-menu
1488
- */
1489
-
1490
1521
  /**
1491
1522
  * Generated bundle index. Do not edit.
1492
1523
  */
1493
1524
 
1525
+ exports.BlockTypes = BlockTypes;
1494
1526
  exports.FsBlockComponent = FsBlockComponent;
1495
1527
  exports.FsBlockEditorComponent = FsBlockEditorComponent;
1496
1528
  exports.FsBlockEditorModule = FsBlockEditorModule;