@firestitch/block-editor 12.3.21 → 12.3.23
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.
- package/app/components/artboard/artboard.component.d.ts +4 -4
- package/app/components/block/block.component.d.ts +5 -3
- package/app/components/layers-reorder-dialog/layers-reorder-dialog.component.d.ts +3 -2
- package/app/interfaces/block.d.ts +3 -0
- package/app/services/block-editor.service.d.ts +3 -3
- package/app/services/blocks-store.service.d.ts +3 -1
- package/bundles/firestitch-block-editor.umd.js +163 -130
- package/bundles/firestitch-block-editor.umd.js.map +1 -1
- package/esm2015/app/components/artboard/artboard.component.js +12 -11
- package/esm2015/app/components/block/block.component.js +48 -27
- package/esm2015/app/components/layers-reorder-dialog/layers-reorder-dialog.component.js +6 -6
- package/esm2015/app/components/sidebar/sidebar.component.js +13 -12
- package/esm2015/app/interfaces/block.js +1 -1
- package/esm2015/app/services/block-editor.service.js +15 -25
- package/esm2015/app/services/blocks-store.service.js +19 -11
- package/fesm2015/firestitch-block-editor.js +139 -119
- package/fesm2015/firestitch-block-editor.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/input'), require('@angular/cdk/drag-drop'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/select'), require('@angular/material/tooltip'), require('@firestitch/colorpicker'), require('@firestitch/dialog'), require('@firestitch/file'), require('@firestitch/menu'), require('@firestitch/zoom-pan'), require('@firestitch/autocomplete'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@firestitch/block-editor', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/input', '@angular/cdk/drag-drop', '@angular/material/button', '@angular/material/checkbox', '@angular/material/form-field', '@angular/material/icon', '@angular/material/list', '@angular/material/select', '@angular/material/tooltip', '@firestitch/colorpicker', '@firestitch/dialog', '@firestitch/file', '@firestitch/menu', '@firestitch/zoom-pan', '@firestitch/autocomplete', 'rxjs', 'rxjs/operators', '@angular/common/http', 'moveable', '@angular/material/dialog', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch["block-editor"] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.input, global.ng.cdk.dragDrop, global.ng.material.button, global.ng.material.checkbox, global.ng.material.formField, global.ng.material.icon, global.ng.material.list, global.ng.material.select, global.ng.material.tooltip, global.i12, global.i2, global.i3$1, global.menu, global.i2$2, global.i10, global.rxjs, global.rxjs.operators, global.ng.common.http, global.Moveable, global.ng.material.dialog, global.
|
|
5
|
-
})(this, (function (exports, i13, i0, i16, i15, i7, i6, i9, i6$1, i3, i4, i7$1, i14, i12, i2, i3$1, menu, i2$2, i10, rxjs, operators, i1, Moveable, i1$1,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/input'), require('@angular/cdk/drag-drop'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/select'), require('@angular/material/tooltip'), require('@firestitch/colorpicker'), require('@firestitch/dialog'), require('@firestitch/file'), require('@firestitch/menu'), require('@firestitch/zoom-pan'), require('@firestitch/autocomplete'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http'), require('@firestitch/common'), require('moveable'), require('@angular/material/dialog'), require('@angular/material/divider'), require('@firestitch/api'), require('@firestitch/prompt'), require('@angular/material/core'), require('@angular/cdk/text-field')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@firestitch/block-editor', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/input', '@angular/cdk/drag-drop', '@angular/material/button', '@angular/material/checkbox', '@angular/material/form-field', '@angular/material/icon', '@angular/material/list', '@angular/material/select', '@angular/material/tooltip', '@firestitch/colorpicker', '@firestitch/dialog', '@firestitch/file', '@firestitch/menu', '@firestitch/zoom-pan', '@firestitch/autocomplete', 'rxjs', 'rxjs/operators', '@angular/common/http', '@firestitch/common', 'moveable', '@angular/material/dialog', '@angular/material/divider', '@firestitch/api', '@firestitch/prompt', '@angular/material/core', '@angular/cdk/text-field'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch["block-editor"] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.input, global.ng.cdk.dragDrop, global.ng.material.button, global.ng.material.checkbox, global.ng.material.formField, global.ng.material.icon, global.ng.material.list, global.ng.material.select, global.ng.material.tooltip, global.i12, global.i2, global.i3$1, global.menu, global.i2$2, global.i10, global.rxjs, global.rxjs.operators, global.ng.common.http, global.common, global.Moveable, global.ng.material.dialog, global.ng.material.divider, global.i1$2, global.i2$1, global.ng.material.core, global.ng.cdk.textField));
|
|
5
|
+
})(this, (function (exports, i13, i0, i16, i15, i7, i6, i9, i6$1, i3, i4, i7$1, i14, i12, i2, i3$1, menu, i2$2, i10, rxjs, operators, i1, common, Moveable, i1$1, i5, i1$2, i2$1, i8, i17) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -113,6 +113,48 @@
|
|
|
113
113
|
type: i0.Input
|
|
114
114
|
}] } });
|
|
115
115
|
|
|
116
|
+
var FsBlockEditorMarginDirective = /** @class */ (function () {
|
|
117
|
+
function FsBlockEditorMarginDirective(_elementRef) {
|
|
118
|
+
this._elementRef = _elementRef;
|
|
119
|
+
}
|
|
120
|
+
Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
|
|
121
|
+
get: function () {
|
|
122
|
+
return this._elementRef.nativeElement;
|
|
123
|
+
},
|
|
124
|
+
enumerable: false,
|
|
125
|
+
configurable: true
|
|
126
|
+
});
|
|
127
|
+
return FsBlockEditorMarginDirective;
|
|
128
|
+
}());
|
|
129
|
+
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 });
|
|
130
|
+
FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
|
|
131
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
|
|
132
|
+
type: i0.Directive,
|
|
133
|
+
args: [{
|
|
134
|
+
selector: '[fsBlockEditorMargin]'
|
|
135
|
+
}]
|
|
136
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
|
|
137
|
+
|
|
138
|
+
var FsBlockEditorSidebarPanelDirective = /** @class */ (function () {
|
|
139
|
+
function FsBlockEditorSidebarPanelDirective(templateRef) {
|
|
140
|
+
this.templateRef = templateRef;
|
|
141
|
+
this.show = true;
|
|
142
|
+
}
|
|
143
|
+
return FsBlockEditorSidebarPanelDirective;
|
|
144
|
+
}());
|
|
145
|
+
FsBlockEditorSidebarPanelDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0__namespace.TemplateRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
146
|
+
FsBlockEditorSidebarPanelDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0__namespace });
|
|
147
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, decorators: [{
|
|
148
|
+
type: i0.Directive,
|
|
149
|
+
args: [{
|
|
150
|
+
selector: '[fsBlockEditorSidebarPanel]'
|
|
151
|
+
}]
|
|
152
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }]; }, propDecorators: { label: [{
|
|
153
|
+
type: i0.Input
|
|
154
|
+
}], show: [{
|
|
155
|
+
type: i0.Input
|
|
156
|
+
}] } });
|
|
157
|
+
|
|
116
158
|
exports.BlockType = void 0;
|
|
117
159
|
(function (BlockType) {
|
|
118
160
|
BlockType["Rectangle"] = "rectangle";
|
|
@@ -153,18 +195,18 @@
|
|
|
153
195
|
this._init(_dialogData);
|
|
154
196
|
}
|
|
155
197
|
LayersReorderDialogComponent.prototype.swapItems = function (event) {
|
|
156
|
-
i7.moveItemInArray(this.
|
|
198
|
+
i7.moveItemInArray(this.blocks, event.previousIndex, event.currentIndex);
|
|
157
199
|
};
|
|
158
200
|
LayersReorderDialogComponent.prototype.done = function () {
|
|
159
|
-
this._dialogRef.close(this.
|
|
201
|
+
this._dialogRef.close(this.blocks);
|
|
160
202
|
};
|
|
161
203
|
LayersReorderDialogComponent.prototype._init = function (data) {
|
|
162
|
-
this.
|
|
204
|
+
this.blocks = data.blocks;
|
|
163
205
|
};
|
|
164
206
|
return LayersReorderDialogComponent;
|
|
165
207
|
}());
|
|
166
208
|
LayersReorderDialogComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LayersReorderDialogComponent, deps: [{ token: i1$1.MAT_DIALOG_DATA }, { token: i1__namespace$1.MatDialogRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
167
|
-
LayersReorderDialogComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LayersReorderDialogComponent, selector: "ng-component", ngImport: i0__namespace, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder
|
|
209
|
+
LayersReorderDialogComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LayersReorderDialogComponent, selector: "ng-component", ngImport: i0__namespace, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder Blocks</h1>\n <mat-dialog-content>\n <mat-list cdkDropList (cdkDropListDropped)=\"swapItems($event)\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let block of blocks\">\n <mat-list-item cdkDrag cdkDragLockAxis=\"y\">\n <mat-icon cdkDragHandle>drag_handle</mat-icon>\n <mat-icon>\n {{ blockTypeIcons[block.type] }}\n </mat-icon>\n <span class=\"block-label\">\n {{ block.label || block.content || 'No Content'}} \n </span>\n </mat-list-item>\n <mat-divider></mat-divider>\n </ng-container>\n </mat-list>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button color=\"primary\" (click)=\"done()\">Done</button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: ["h1{display:flex}.mat-icon{margin-right:20px}.block-label{min-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:1000px}.cdk-drag-preview{display:flex;padding-left:15px!important;background:#fff;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-preview ::ng-deep .mat-list-item-content{display:flex;flex-direction:row;align-items:center;font-size:16px}.cdk-drag-handle{cursor:grab}.cdk-drag-placeholder{opacity:.2}\n"], components: [{ type: i2__namespace.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i3__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4__namespace.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i5__namespace.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i4__namespace.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i6__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1__namespace$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1__namespace$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i7__namespace.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i13__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i7__namespace.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1__namespace$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
168
210
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LayersReorderDialogComponent, decorators: [{
|
|
169
211
|
type: i0.Component,
|
|
170
212
|
args: [{
|
|
@@ -502,6 +544,7 @@
|
|
|
502
544
|
EventType["Add"] = "add";
|
|
503
545
|
EventType["Change"] = "change";
|
|
504
546
|
EventType["Remove"] = "remove";
|
|
547
|
+
EventType["Update"] = "update";
|
|
505
548
|
})(EventType || (EventType = {}));
|
|
506
549
|
var BlocksStore = /** @class */ (function () {
|
|
507
550
|
function BlocksStore() {
|
|
@@ -552,6 +595,20 @@
|
|
|
552
595
|
enumerable: false,
|
|
553
596
|
configurable: true
|
|
554
597
|
});
|
|
598
|
+
Object.defineProperty(BlocksStore.prototype, "blockUpdated$", {
|
|
599
|
+
get: function () {
|
|
600
|
+
return this._eventBus$
|
|
601
|
+
.pipe(operators.filter(function (_k) {
|
|
602
|
+
var type = _k.type;
|
|
603
|
+
return type === EventType.Update;
|
|
604
|
+
}), operators.map(function (_k) {
|
|
605
|
+
var value = _k.value;
|
|
606
|
+
return value;
|
|
607
|
+
}));
|
|
608
|
+
},
|
|
609
|
+
enumerable: false,
|
|
610
|
+
configurable: true
|
|
611
|
+
});
|
|
555
612
|
Object.defineProperty(BlocksStore.prototype, "blockRemoved$", {
|
|
556
613
|
get: function () {
|
|
557
614
|
return this._eventBus$
|
|
@@ -604,12 +661,13 @@
|
|
|
604
661
|
BlocksStore.prototype.blockUpload = function (block, fsFile) {
|
|
605
662
|
var _this = this;
|
|
606
663
|
if (!this._config.blockUpload) {
|
|
607
|
-
|
|
608
|
-
return;
|
|
664
|
+
return rxjs.throwError('[BlockEditor] Config "blockUpload" is not defined');
|
|
609
665
|
}
|
|
610
666
|
var existing = this.blockExists(block);
|
|
611
|
-
|
|
612
|
-
|
|
667
|
+
if (!existing) {
|
|
668
|
+
block = this._createBlock(block);
|
|
669
|
+
}
|
|
670
|
+
return rxjs.from(fsFile.imageInfo)
|
|
613
671
|
.pipe(operators.switchMap(function (imageInfo) {
|
|
614
672
|
if (!existing && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.height) && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.width)) {
|
|
615
673
|
var ratio = imageInfo.height / imageInfo.width;
|
|
@@ -617,19 +675,21 @@
|
|
|
617
675
|
block.height = block.width * ratio;
|
|
618
676
|
}
|
|
619
677
|
return _this._config.blockUpload(block, fsFile.file);
|
|
620
|
-
}), operators.
|
|
621
|
-
.subscribe(function (newBlock) {
|
|
678
|
+
}), operators.tap(function (newBlock) {
|
|
622
679
|
if (existing) {
|
|
623
|
-
_this.
|
|
680
|
+
_this.blockUpdate(Object.assign(Object.assign({}, block), newBlock));
|
|
624
681
|
}
|
|
625
682
|
else {
|
|
626
683
|
_this._appendBlock(newBlock);
|
|
627
684
|
}
|
|
628
|
-
});
|
|
685
|
+
}), operators.takeUntil(this._destroy$));
|
|
629
686
|
};
|
|
630
687
|
BlocksStore.prototype.blockChange = function (block) {
|
|
631
688
|
this._dispatchEvent(EventType.Change, block);
|
|
632
689
|
};
|
|
690
|
+
BlocksStore.prototype.blockUpdate = function (block) {
|
|
691
|
+
this._dispatchEvent(EventType.Update, block);
|
|
692
|
+
};
|
|
633
693
|
BlocksStore.prototype.blockRemove = function (targetBlocks) {
|
|
634
694
|
var _this = this;
|
|
635
695
|
var blocks = this.blocks;
|
|
@@ -739,15 +799,6 @@
|
|
|
739
799
|
enumerable: false,
|
|
740
800
|
configurable: true
|
|
741
801
|
});
|
|
742
|
-
Object.defineProperty(BlockEditorService.prototype, "selectedComponentBlocks", {
|
|
743
|
-
get: function () {
|
|
744
|
-
var _this = this;
|
|
745
|
-
return this.blockComponents
|
|
746
|
-
.filter(function (blockComponent) { return _this.selectedBlocks.indexOf(blockComponent.block) !== -1; });
|
|
747
|
-
},
|
|
748
|
-
enumerable: false,
|
|
749
|
-
configurable: true
|
|
750
|
-
});
|
|
751
802
|
BlockEditorService.prototype.init = function (config) {
|
|
752
803
|
this.config = config;
|
|
753
804
|
this._store.init(Object.assign({}, this.config));
|
|
@@ -756,7 +807,7 @@
|
|
|
756
807
|
this._store.blockAdd(block);
|
|
757
808
|
};
|
|
758
809
|
BlockEditorService.prototype.blockUpload = function (block, fsFile) {
|
|
759
|
-
this._store.blockUpload(block, fsFile);
|
|
810
|
+
return this._store.blockUpload(block, fsFile);
|
|
760
811
|
};
|
|
761
812
|
BlockEditorService.prototype.blockRemove = function (block) {
|
|
762
813
|
this._store.blockRemove(block);
|
|
@@ -783,6 +834,13 @@
|
|
|
783
834
|
enumerable: false,
|
|
784
835
|
configurable: true
|
|
785
836
|
});
|
|
837
|
+
Object.defineProperty(BlockEditorService.prototype, "blockUpdated$", {
|
|
838
|
+
get: function () {
|
|
839
|
+
return this._store.blockUpdated$;
|
|
840
|
+
},
|
|
841
|
+
enumerable: false,
|
|
842
|
+
configurable: true
|
|
843
|
+
});
|
|
786
844
|
Object.defineProperty(BlockEditorService.prototype, "blockClippable$", {
|
|
787
845
|
get: function () {
|
|
788
846
|
return this._blockClippable$;
|
|
@@ -829,7 +887,7 @@
|
|
|
829
887
|
this._store.blockChange(block);
|
|
830
888
|
};
|
|
831
889
|
BlockEditorService.prototype.isSelectedBlock = function (block) {
|
|
832
|
-
return this.selectedBlocks.indexOf(block
|
|
890
|
+
return this.selectedBlocks.indexOf(block) !== -1;
|
|
833
891
|
};
|
|
834
892
|
BlockEditorService.prototype.indexOf = function (block) {
|
|
835
893
|
return this.blocks.map(function (e) { return e.guid; }).indexOf(block.guid);
|
|
@@ -861,15 +919,6 @@
|
|
|
861
919
|
return this._selectedBlocks$.getValue();
|
|
862
920
|
},
|
|
863
921
|
set: function (blocks) {
|
|
864
|
-
this.blockComponents
|
|
865
|
-
.forEach(function (blockComponent) {
|
|
866
|
-
if (blocks.indexOf(blockComponent.block) !== -1) {
|
|
867
|
-
blockComponent.select();
|
|
868
|
-
}
|
|
869
|
-
else {
|
|
870
|
-
blockComponent.deselect();
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
922
|
this._selectedBlocks$.next(blocks);
|
|
874
923
|
if (this.config.blocksSelected) {
|
|
875
924
|
this.config.blocksSelected(blocks);
|
|
@@ -907,23 +956,23 @@
|
|
|
907
956
|
};
|
|
908
957
|
BlockEditorService.prototype.openReorderDialog = function () {
|
|
909
958
|
var _this = this;
|
|
910
|
-
var
|
|
911
|
-
.sort(function (
|
|
959
|
+
var blocks = this.blocks
|
|
960
|
+
.sort(function (blockA, blockB) { return (blockA.index - blockB.index); })
|
|
912
961
|
.reverse();
|
|
913
962
|
this._dialog
|
|
914
963
|
.open(LayersReorderDialogComponent, {
|
|
915
964
|
data: {
|
|
916
|
-
|
|
965
|
+
blocks: blocks,
|
|
917
966
|
}
|
|
918
967
|
})
|
|
919
968
|
.afterClosed()
|
|
920
|
-
.pipe(operators.filter(function (
|
|
921
|
-
.subscribe(function (
|
|
922
|
-
|
|
969
|
+
.pipe(operators.filter(function (blocks) { return !!blocks; }), operators.takeUntil(this._destroy$))
|
|
970
|
+
.subscribe(function (blocks) {
|
|
971
|
+
blocks
|
|
923
972
|
.reverse()
|
|
924
|
-
.forEach(function (
|
|
925
|
-
|
|
926
|
-
_this._store.blockChange(
|
|
973
|
+
.forEach(function (block, index) {
|
|
974
|
+
block.index = index;
|
|
975
|
+
_this._store.blockChange(block);
|
|
927
976
|
_this._store.updateTabIndex(index);
|
|
928
977
|
});
|
|
929
978
|
});
|
|
@@ -968,6 +1017,23 @@
|
|
|
968
1017
|
this._transformable = false;
|
|
969
1018
|
this._destroy$ = new rxjs.Subject();
|
|
970
1019
|
}
|
|
1020
|
+
Object.defineProperty(FsBlockComponent.prototype, "block", {
|
|
1021
|
+
get: function () {
|
|
1022
|
+
return this._block;
|
|
1023
|
+
},
|
|
1024
|
+
set: function (block) {
|
|
1025
|
+
this._block = block;
|
|
1026
|
+
this._block.resizable = !this.hasType([exports.BlockType.Checkbox, exports.BlockType.RadioButton]);
|
|
1027
|
+
this._block.rotatable = !this.hasType([exports.BlockType.Checkbox, exports.BlockType.RadioButton]);
|
|
1028
|
+
this._block.scalable = !this.hasType([exports.BlockType.Checkbox, exports.BlockType.RadioButton]);
|
|
1029
|
+
if (this.moveable) {
|
|
1030
|
+
this._updateMoveable();
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
enumerable: false,
|
|
1034
|
+
configurable: true
|
|
1035
|
+
});
|
|
1036
|
+
;
|
|
971
1037
|
Object.defineProperty(FsBlockComponent.prototype, "el", {
|
|
972
1038
|
get: function () {
|
|
973
1039
|
return this.element.nativeElement;
|
|
@@ -982,6 +1048,9 @@
|
|
|
982
1048
|
enumerable: false,
|
|
983
1049
|
configurable: true
|
|
984
1050
|
});
|
|
1051
|
+
FsBlockComponent.prototype.hasType = function (types) {
|
|
1052
|
+
return types.includes(this.block.type);
|
|
1053
|
+
};
|
|
985
1054
|
Object.defineProperty(FsBlockComponent.prototype, "editable", {
|
|
986
1055
|
get: function () {
|
|
987
1056
|
return this._editable;
|
|
@@ -1135,13 +1204,8 @@
|
|
|
1135
1204
|
return this._transformable;
|
|
1136
1205
|
},
|
|
1137
1206
|
set: function (value) {
|
|
1138
|
-
if (this.block.lock) {
|
|
1139
|
-
value = false;
|
|
1140
|
-
}
|
|
1141
1207
|
this._transformable = value;
|
|
1142
|
-
this.
|
|
1143
|
-
this.moveable.rotatable = value;
|
|
1144
|
-
this.moveable.scalable = value;
|
|
1208
|
+
this._updateMoveable();
|
|
1145
1209
|
},
|
|
1146
1210
|
enumerable: false,
|
|
1147
1211
|
configurable: true
|
|
@@ -1178,9 +1242,10 @@
|
|
|
1178
1242
|
this.block.shadowOpacity = this.block.shadowOpacity || 100;
|
|
1179
1243
|
this._initFonts();
|
|
1180
1244
|
this._blockEditor.selectedBlocks$
|
|
1181
|
-
.pipe(operators.takeUntil(this._destroy$))
|
|
1245
|
+
.pipe(operators.skip(1), operators.takeUntil(this._destroy$))
|
|
1182
1246
|
.subscribe(function (blocks) {
|
|
1183
1247
|
_this.selected = blocks.includes(_this.block);
|
|
1248
|
+
_this.transformable = true;
|
|
1184
1249
|
_this._cdRef.markForCheck();
|
|
1185
1250
|
});
|
|
1186
1251
|
this._blockEditor.blockClippable$
|
|
@@ -1194,12 +1259,16 @@
|
|
|
1194
1259
|
.subscribe(function () {
|
|
1195
1260
|
_this._cdRef.markForCheck();
|
|
1196
1261
|
});
|
|
1262
|
+
this._blockEditor.blockUpdated$
|
|
1263
|
+
.pipe(operators.filter(function (block) { return block.guid === _this.block.guid; }), operators.takeUntil(this._destroy$))
|
|
1264
|
+
.subscribe(function (block) {
|
|
1265
|
+
_this.block = block;
|
|
1266
|
+
_this._cdRef.markForCheck();
|
|
1267
|
+
});
|
|
1197
1268
|
this._blockEditor.blockChanged$
|
|
1198
|
-
.pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
|
|
1269
|
+
.pipe(operators.filter(function (block) { return block.guid === _this.block.guid; }), operators.takeUntil(this._destroy$))
|
|
1199
1270
|
.subscribe(function (block) {
|
|
1200
|
-
_this.
|
|
1201
|
-
_this.rotate = _this.block.rotate;
|
|
1202
|
-
_this._updateMoveable();
|
|
1271
|
+
_this.block = block;
|
|
1203
1272
|
_this._cdRef.markForCheck();
|
|
1204
1273
|
});
|
|
1205
1274
|
};
|
|
@@ -1224,9 +1293,6 @@
|
|
|
1224
1293
|
FsBlockComponent.prototype.round = function (value, decimals) {
|
|
1225
1294
|
return parseFloat(value.toFixed(decimals));
|
|
1226
1295
|
};
|
|
1227
|
-
FsBlockComponent.prototype.select = function () {
|
|
1228
|
-
this.transformable = true;
|
|
1229
|
-
};
|
|
1230
1296
|
FsBlockComponent.prototype.deselect = function () {
|
|
1231
1297
|
this.editable = false;
|
|
1232
1298
|
this.clippable = false;
|
|
@@ -1246,7 +1312,7 @@
|
|
|
1246
1312
|
}
|
|
1247
1313
|
}
|
|
1248
1314
|
};
|
|
1249
|
-
FsBlockComponent.prototype.
|
|
1315
|
+
FsBlockComponent.prototype.selectTextAll = function () {
|
|
1250
1316
|
var range = document.createRange();
|
|
1251
1317
|
range.selectNodeContents(this.contentEditable.nativeElement);
|
|
1252
1318
|
var sel = window.getSelection();
|
|
@@ -1273,11 +1339,12 @@
|
|
|
1273
1339
|
.filter(function (el) { return !el.isSameNode(_this.el); });
|
|
1274
1340
|
};
|
|
1275
1341
|
FsBlockComponent.prototype._updateMoveable = function () {
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1342
|
+
var value = !this.block.lock && this.selected;
|
|
1343
|
+
this.keepRatio = this.block.keepRatio;
|
|
1344
|
+
this.rotate = this.block.rotate;
|
|
1345
|
+
this.moveable.resizable = this.block.resizable && value;
|
|
1346
|
+
this.moveable.rotatable = this.block.rotatable && value;
|
|
1347
|
+
this.moveable.scalable = this.block.scalable && value;
|
|
1281
1348
|
};
|
|
1282
1349
|
FsBlockComponent.prototype._initMoveable = function () {
|
|
1283
1350
|
var _this = this;
|
|
@@ -1439,8 +1506,14 @@
|
|
|
1439
1506
|
_this._triggerChanged();
|
|
1440
1507
|
});
|
|
1441
1508
|
rxjs.fromEvent(this.el, 'mousedown')
|
|
1442
|
-
.pipe(operators.takeUntil(this._destroy$))
|
|
1443
|
-
|
|
1509
|
+
.pipe(operators.takeUntil(this._destroy$))
|
|
1510
|
+
.subscribe(function (event) {
|
|
1511
|
+
if (_this.block.lock) {
|
|
1512
|
+
event.preventDefault();
|
|
1513
|
+
event.stopImmediatePropagation();
|
|
1514
|
+
event.stopPropagation();
|
|
1515
|
+
}
|
|
1516
|
+
else {
|
|
1444
1517
|
_this.zoompan.disable();
|
|
1445
1518
|
}
|
|
1446
1519
|
if (!_this.moveable.clippable) {
|
|
@@ -1470,7 +1543,7 @@
|
|
|
1470
1543
|
_this.editable = true;
|
|
1471
1544
|
_this._cdRef.markForCheck();
|
|
1472
1545
|
setTimeout(function () {
|
|
1473
|
-
_this.
|
|
1546
|
+
_this.selectTextAll();
|
|
1474
1547
|
});
|
|
1475
1548
|
}
|
|
1476
1549
|
});
|
|
@@ -1483,7 +1556,7 @@
|
|
|
1483
1556
|
return FsBlockComponent;
|
|
1484
1557
|
}());
|
|
1485
1558
|
FsBlockComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: GoogleFontService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1486
|
-
FsBlockComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { properties: { "class.transforming": "this.transformating" } }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [style.top]=\"styleTop\"\n [style.left]=\"styleLeft\"\n [style.width]=\"styleWidth\"\n [style.height]=\"styleHeight\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required,\n lock: block.lock,\n selected: selected\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'in' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'in' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'in' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'in' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.boxShadow]=\"styleBoxShadow\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngIf=\"block.imageUrl && ((block.imageUrl | createImageUrl) | async) as src\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"src\">\n </ng-container>\n\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n <div class=\"outline\"></div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none;cursor:pointer;box-sizing:border-box}.block.selected{border-color:#31a2ff95}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block.block-radiobutton{border-radius:50%}.block.required{background-color:#f7adaa}.block .content-editable{outline:none;position:relative;
|
|
1559
|
+
FsBlockComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { properties: { "class.transforming": "this.transformating" } }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [style.top]=\"styleTop\"\n [style.left]=\"styleLeft\"\n [style.width]=\"styleWidth\"\n [style.height]=\"styleHeight\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required,\n lock: block.lock,\n selected: selected\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'in' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'in' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'in' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'in' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.boxShadow]=\"styleBoxShadow\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngIf=\"block.imageUrl && ((block.imageUrl | createImageUrl) | async) as src\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"src\">\n </ng-container>\n\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n <div class=\"outline\"></div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none;cursor:pointer;box-sizing:border-box}.block.selected{border-color:#31a2ff95}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block.block-radiobutton{border-radius:50%}.block.required{background-color:#f7adaa}.block .content-editable{outline:none;position:relative;height:100%;width:100%;z-index:100}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:0px solid transparent;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}.block.selected .outline,.block:hover .outline{border:1px solid rgba(68,170,255,.7);position:absolute;top:0;left:0;bottom:0;right:0;-webkit-user-select:none;user-select:none}.block.selected.lock .outline,.block:hover.lock .outline{border-color:#e4181866;border-style:dashed}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i13__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i13__namespace.AsyncPipe, "createImageUrl": CreateImageUrlPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1487
1560
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
|
|
1488
1561
|
type: i0.Component,
|
|
1489
1562
|
args: [{
|
|
@@ -1502,7 +1575,8 @@
|
|
|
1502
1575
|
type: i0.ViewChild,
|
|
1503
1576
|
args: ['contentEditable', { static: true }]
|
|
1504
1577
|
}], block: [{
|
|
1505
|
-
type: i0.Input
|
|
1578
|
+
type: i0.Input,
|
|
1579
|
+
args: ['block']
|
|
1506
1580
|
}], html: [{
|
|
1507
1581
|
type: i0.Input
|
|
1508
1582
|
}], zoompan: [{
|
|
@@ -1512,48 +1586,6 @@
|
|
|
1512
1586
|
args: ['class.transforming']
|
|
1513
1587
|
}] } });
|
|
1514
1588
|
|
|
1515
|
-
var FsBlockEditorSidebarPanelDirective = /** @class */ (function () {
|
|
1516
|
-
function FsBlockEditorSidebarPanelDirective(templateRef) {
|
|
1517
|
-
this.templateRef = templateRef;
|
|
1518
|
-
this.show = true;
|
|
1519
|
-
}
|
|
1520
|
-
return FsBlockEditorSidebarPanelDirective;
|
|
1521
|
-
}());
|
|
1522
|
-
FsBlockEditorSidebarPanelDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0__namespace.TemplateRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1523
|
-
FsBlockEditorSidebarPanelDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0__namespace });
|
|
1524
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorSidebarPanelDirective, decorators: [{
|
|
1525
|
-
type: i0.Directive,
|
|
1526
|
-
args: [{
|
|
1527
|
-
selector: '[fsBlockEditorSidebarPanel]'
|
|
1528
|
-
}]
|
|
1529
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }]; }, propDecorators: { label: [{
|
|
1530
|
-
type: i0.Input
|
|
1531
|
-
}], show: [{
|
|
1532
|
-
type: i0.Input
|
|
1533
|
-
}] } });
|
|
1534
|
-
|
|
1535
|
-
var FsBlockEditorMarginDirective = /** @class */ (function () {
|
|
1536
|
-
function FsBlockEditorMarginDirective(_elementRef) {
|
|
1537
|
-
this._elementRef = _elementRef;
|
|
1538
|
-
}
|
|
1539
|
-
Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
|
|
1540
|
-
get: function () {
|
|
1541
|
-
return this._elementRef.nativeElement;
|
|
1542
|
-
},
|
|
1543
|
-
enumerable: false,
|
|
1544
|
-
configurable: true
|
|
1545
|
-
});
|
|
1546
|
-
return FsBlockEditorMarginDirective;
|
|
1547
|
-
}());
|
|
1548
|
-
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 });
|
|
1549
|
-
FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
|
|
1550
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
|
|
1551
|
-
type: i0.Directive,
|
|
1552
|
-
args: [{
|
|
1553
|
-
selector: '[fsBlockEditorMargin]'
|
|
1554
|
-
}]
|
|
1555
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
|
|
1556
|
-
|
|
1557
1589
|
var BlockFormats = [
|
|
1558
1590
|
{ value: BlockFormat.Number, name: 'Number', blockTypes: [exports.BlockType.ShortText, exports.BlockType.LongText] },
|
|
1559
1591
|
{ value: BlockFormat.Currency, name: 'Currency', blockTypes: [exports.BlockType.ShortText, exports.BlockType.LongText] },
|
|
@@ -1700,8 +1732,9 @@
|
|
|
1700
1732
|
}
|
|
1701
1733
|
};
|
|
1702
1734
|
SidebarComponent.prototype.blockUpload = function (block, fsFile) {
|
|
1703
|
-
this._blockEditor
|
|
1704
|
-
.
|
|
1735
|
+
this._blockEditor.blockUpload(block, fsFile)
|
|
1736
|
+
.subscribe(function (newBlock) {
|
|
1737
|
+
});
|
|
1705
1738
|
};
|
|
1706
1739
|
SidebarComponent.prototype.blockAdd = function (type) {
|
|
1707
1740
|
if (type === exports.BlockType.Pdf || type === exports.BlockType.Image) {
|
|
@@ -1717,20 +1750,20 @@
|
|
|
1717
1750
|
};
|
|
1718
1751
|
SidebarComponent.prototype.layerMove = function (direction) {
|
|
1719
1752
|
var _this = this;
|
|
1720
|
-
this._blockEditor.
|
|
1721
|
-
if (_this._blockEditor.isSelectedBlock(
|
|
1722
|
-
|
|
1753
|
+
this._blockEditor.blocks.forEach(function (block) {
|
|
1754
|
+
if (_this._blockEditor.isSelectedBlock(block)) {
|
|
1755
|
+
block.index += (999 * direction);
|
|
1723
1756
|
}
|
|
1724
1757
|
});
|
|
1725
|
-
var sorted = this._blockEditor.
|
|
1726
|
-
return a.
|
|
1758
|
+
var sorted = this._blockEditor.blocks.sort(function (a, b) {
|
|
1759
|
+
return a.index > b.index ? 1 : -1;
|
|
1727
1760
|
});
|
|
1728
|
-
sorted.forEach(function (
|
|
1729
|
-
|
|
1730
|
-
|
|
1761
|
+
sorted.forEach(function (block, index) {
|
|
1762
|
+
block.index = index;
|
|
1763
|
+
_this._blockEditor.blockChange(block);
|
|
1731
1764
|
});
|
|
1732
1765
|
if (this.config.blocksLevelChanged) {
|
|
1733
|
-
this.config.blocksLevelChanged(sorted.map(function (
|
|
1766
|
+
this.config.blocksLevelChanged(sorted.map(function (block) { return block; }));
|
|
1734
1767
|
}
|
|
1735
1768
|
};
|
|
1736
1769
|
SidebarComponent.prototype.layerUp = function () {
|
|
@@ -1831,23 +1864,23 @@
|
|
|
1831
1864
|
.subscribe(function (event) {
|
|
1832
1865
|
event.preventDefault();
|
|
1833
1866
|
var inchPixel = 1 / 100;
|
|
1834
|
-
_this._blockEditor.
|
|
1835
|
-
.forEach(function (
|
|
1867
|
+
_this._blockEditor.selectedBlocks
|
|
1868
|
+
.forEach(function (block) {
|
|
1836
1869
|
switch (event.key) {
|
|
1837
1870
|
case 'ArrowUp':
|
|
1838
|
-
|
|
1871
|
+
block.top = common.round(block.top - inchPixel, 2);
|
|
1839
1872
|
break;
|
|
1840
1873
|
case 'ArrowDown':
|
|
1841
|
-
|
|
1874
|
+
block.top = common.round(block.top + inchPixel, 2);
|
|
1842
1875
|
break;
|
|
1843
1876
|
case 'ArrowLeft':
|
|
1844
|
-
|
|
1877
|
+
block.left = common.round(block.left - inchPixel, 2);
|
|
1845
1878
|
break;
|
|
1846
1879
|
case 'ArrowRight':
|
|
1847
|
-
|
|
1880
|
+
block.left = common.round(block.left + inchPixel, 2);
|
|
1848
1881
|
break;
|
|
1849
1882
|
}
|
|
1850
|
-
_this._blockEditor.blockChange(
|
|
1883
|
+
_this._blockEditor.blockChange(block);
|
|
1851
1884
|
});
|
|
1852
1885
|
});
|
|
1853
1886
|
};
|