@firestitch/block-editor 12.1.9 → 12.2.2
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 +0 -1
- package/app/components/layers-reorder-dialog/layers-reorder-dialog.component.d.ts +15 -0
- package/app/components/sidebar/sidebar.component.d.ts +4 -3
- package/app/fs-block-editor.module.d.ts +18 -14
- package/app/interfaces/block.d.ts +1 -0
- package/app/services/block-editor.service.d.ts +16 -18
- package/app/services/blocks-store.service.d.ts +34 -0
- package/bundles/firestitch-block-editor.umd.js +389 -212
- package/bundles/firestitch-block-editor.umd.js.map +1 -1
- package/esm2015/app/components/artboard/artboard.component.js +4 -9
- package/esm2015/app/components/block/block.component.js +5 -3
- package/esm2015/app/components/block-editor/block-editor.component.js +5 -3
- package/esm2015/app/components/layers-reorder-dialog/layers-reorder-dialog.component.js +45 -0
- package/esm2015/app/components/sidebar/sidebar.component.js +21 -18
- package/esm2015/app/fs-block-editor.module.js +21 -6
- package/esm2015/app/interfaces/block.js +1 -1
- package/esm2015/app/services/block-editor.service.js +57 -144
- package/esm2015/app/services/blocks-store.service.js +178 -0
- package/fesm2015/firestitch-block-editor.js +332 -199
- package/fesm2015/firestitch-block-editor.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,34 +3,43 @@ import { FormsModule } from '@angular/forms';
|
|
|
3
3
|
import * as i13 from '@angular/material/input';
|
|
4
4
|
import { MatInputModule } from '@angular/material/input';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { Injectable, Component, ChangeDetectionStrategy, ViewChild, Input, HostBinding, Directive, EventEmitter, ContentChildren, Output, ViewChildren, ElementRef, NgModule } from '@angular/core';
|
|
6
|
+
import { Injectable, Component, Inject, ChangeDetectionStrategy, ViewChild, Input, HostBinding, Directive, EventEmitter, ContentChildren, Output, ViewChildren, ElementRef, NgModule } from '@angular/core';
|
|
7
7
|
import * as i11 from '@angular/common';
|
|
8
|
-
import { CommonModule } from '@angular/common';
|
|
9
|
-
import * as
|
|
8
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
9
|
+
import * as i6 from '@angular/material/button';
|
|
10
10
|
import { MatButtonModule } from '@angular/material/button';
|
|
11
|
-
import * as i6 from '@angular/material/form-field';
|
|
11
|
+
import * as i6$1 from '@angular/material/form-field';
|
|
12
12
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
13
|
-
import * as
|
|
13
|
+
import * as i3 from '@angular/material/icon';
|
|
14
14
|
import { MatIconModule } from '@angular/material/icon';
|
|
15
|
+
import * as i9 from '@angular/material/checkbox';
|
|
16
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
17
|
+
import * as i12 from '@angular/material/tooltip';
|
|
18
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
19
|
+
import * as i7$1 from '@angular/material/select';
|
|
20
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
21
|
+
import * as i4 from '@angular/material/list';
|
|
22
|
+
import { MatListModule } from '@angular/material/list';
|
|
23
|
+
import * as i7 from '@angular/cdk/drag-drop';
|
|
24
|
+
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
15
25
|
import * as i10 from '@firestitch/colorpicker';
|
|
16
26
|
import { FsColorPickerModule } from '@firestitch/colorpicker';
|
|
17
|
-
import * as i3 from '@firestitch/file';
|
|
27
|
+
import * as i3$1 from '@firestitch/file';
|
|
18
28
|
import { FsFileModule } from '@firestitch/file';
|
|
19
29
|
import { FsMenuModule } from '@firestitch/menu';
|
|
20
|
-
import * as i2$
|
|
30
|
+
import * as i2$2 from '@firestitch/zoom-pan';
|
|
21
31
|
import { FsZoomPanComponent, FsZoomPanModule } from '@firestitch/zoom-pan';
|
|
22
|
-
import
|
|
32
|
+
import * as i2 from '@firestitch/dialog';
|
|
33
|
+
import { FsDialogModule } from '@firestitch/dialog';
|
|
34
|
+
import { filter, map, groupBy, debounceTime, mergeAll, takeUntil, switchMap, delay } from 'rxjs/operators';
|
|
23
35
|
import Moveable from 'moveable';
|
|
24
36
|
import { Subject, BehaviorSubject, fromEvent } from 'rxjs';
|
|
25
37
|
import { guid, index } from '@firestitch/common';
|
|
26
|
-
import * as
|
|
27
|
-
import
|
|
28
|
-
import
|
|
38
|
+
import * as i1 from '@angular/material/dialog';
|
|
39
|
+
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
40
|
+
import * as i5 from '@angular/material/divider';
|
|
41
|
+
import * as i2$1 from '@firestitch/prompt';
|
|
29
42
|
import * as i8 from '@angular/material/core';
|
|
30
|
-
import * as i9 from '@angular/material/checkbox';
|
|
31
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
32
|
-
import * as i12 from '@angular/material/tooltip';
|
|
33
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
34
43
|
|
|
35
44
|
var BlockType;
|
|
36
45
|
(function (BlockType) {
|
|
@@ -45,6 +54,178 @@ var BlockType;
|
|
|
45
54
|
BlockType["Date"] = "date";
|
|
46
55
|
})(BlockType || (BlockType = {}));
|
|
47
56
|
|
|
57
|
+
var EventType;
|
|
58
|
+
(function (EventType) {
|
|
59
|
+
EventType["Add"] = "add";
|
|
60
|
+
EventType["Change"] = "change";
|
|
61
|
+
EventType["Remove"] = "remove";
|
|
62
|
+
})(EventType || (EventType = {}));
|
|
63
|
+
class BlocksStore {
|
|
64
|
+
constructor() {
|
|
65
|
+
this._lastTabIndex = -1;
|
|
66
|
+
this._eventBus$ = new Subject();
|
|
67
|
+
this._blocks$ = new BehaviorSubject([]);
|
|
68
|
+
this._destroy$ = new Subject();
|
|
69
|
+
}
|
|
70
|
+
get blocks() {
|
|
71
|
+
return [
|
|
72
|
+
...this._blocks$.getValue(),
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
get blocks$() {
|
|
76
|
+
return this._blocks$.asObservable();
|
|
77
|
+
}
|
|
78
|
+
get blockAdded$() {
|
|
79
|
+
return this._eventBus$
|
|
80
|
+
.pipe(filter(({ type }) => type === EventType.Add), map(({ value }) => value));
|
|
81
|
+
}
|
|
82
|
+
get blockChanged$() {
|
|
83
|
+
return this._eventBus$
|
|
84
|
+
.pipe(filter(({ type }) => type === EventType.Change), map(({ value }) => value));
|
|
85
|
+
}
|
|
86
|
+
get blockRemoved$() {
|
|
87
|
+
return this._eventBus$
|
|
88
|
+
.pipe(filter(({ type }) => type === EventType.Remove), map(({ value }) => value));
|
|
89
|
+
}
|
|
90
|
+
ngOnDestroy() {
|
|
91
|
+
this._destroy$.next();
|
|
92
|
+
this._destroy$.complete();
|
|
93
|
+
}
|
|
94
|
+
init(config) {
|
|
95
|
+
this._config = config;
|
|
96
|
+
this._setBlocks(this._config.blocks);
|
|
97
|
+
if (this._config.blockChanged) {
|
|
98
|
+
this.blockChanged$
|
|
99
|
+
.pipe(groupBy((block) => block.guid), map(group => group.pipe(debounceTime(250))), mergeAll())
|
|
100
|
+
.subscribe((block) => {
|
|
101
|
+
this._config.blockChanged(block);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
blockExists(block) {
|
|
106
|
+
const index = this.blocks.findIndex((b) => {
|
|
107
|
+
return b.guid === block.guid;
|
|
108
|
+
});
|
|
109
|
+
return index !== -1;
|
|
110
|
+
}
|
|
111
|
+
blockAdd(block, initBlock = false) {
|
|
112
|
+
if (!this._config.blockAdd) {
|
|
113
|
+
console.warn('[BlockEditor] Config "blockAdd" is not defined');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (initBlock) {
|
|
117
|
+
block = this._createBlock(block);
|
|
118
|
+
}
|
|
119
|
+
this._config.blockAdd(block)
|
|
120
|
+
.pipe(takeUntil(this._destroy$))
|
|
121
|
+
.subscribe((newBlock) => {
|
|
122
|
+
this._appendBlock(newBlock);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
blockUpload(block, fsFile, initBlock = false) {
|
|
126
|
+
if (!this._config.blockUpload) {
|
|
127
|
+
console.warn('[BlockEditor] Config "blockUpload" is not defined');
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (initBlock) {
|
|
131
|
+
block = this._createBlock(block);
|
|
132
|
+
}
|
|
133
|
+
this._config.blockUpload(block, fsFile.file)
|
|
134
|
+
.pipe(takeUntil(this._destroy$))
|
|
135
|
+
.subscribe((newBlock) => {
|
|
136
|
+
this._appendBlock(newBlock);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
blockChange(block) {
|
|
140
|
+
this._dispatchEvent(EventType.Change, block);
|
|
141
|
+
}
|
|
142
|
+
blockRemove(targetBlocks) {
|
|
143
|
+
const blocks = this.blocks;
|
|
144
|
+
if (!Array.isArray(targetBlocks)) {
|
|
145
|
+
targetBlocks = [targetBlocks];
|
|
146
|
+
}
|
|
147
|
+
targetBlocks.forEach((block) => {
|
|
148
|
+
const index = blocks
|
|
149
|
+
.findIndex((b) => b.guid === block.guid);
|
|
150
|
+
if (index !== -1) {
|
|
151
|
+
blocks.splice(index, 1);
|
|
152
|
+
this._dispatchEvent(EventType.Remove, block);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
this._setBlocks(blocks);
|
|
156
|
+
}
|
|
157
|
+
isReordableBlock(block) {
|
|
158
|
+
return [
|
|
159
|
+
BlockType.LongText,
|
|
160
|
+
BlockType.ShortText,
|
|
161
|
+
BlockType.RadioButton,
|
|
162
|
+
BlockType.Checkbox,
|
|
163
|
+
BlockType.Date,
|
|
164
|
+
BlockType.Signature,
|
|
165
|
+
].indexOf(block.type) > -1;
|
|
166
|
+
}
|
|
167
|
+
updateTabIndex(index) {
|
|
168
|
+
this._lastTabIndex = index;
|
|
169
|
+
}
|
|
170
|
+
_setBlocks(blocks) {
|
|
171
|
+
this._blocks$.next([...blocks]);
|
|
172
|
+
blocks
|
|
173
|
+
.filter((b) => this.isReordableBlock(b))
|
|
174
|
+
.forEach((b) => {
|
|
175
|
+
this._lastTabIndex = Math.max(b.tabIndex, this._lastTabIndex);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
_appendBlock(block) {
|
|
179
|
+
const blocks = [
|
|
180
|
+
...this.blocks,
|
|
181
|
+
block,
|
|
182
|
+
];
|
|
183
|
+
this._deduplicateIndexesFor(blocks);
|
|
184
|
+
this._setBlocks(blocks);
|
|
185
|
+
this._dispatchEvent(EventType.Add, block);
|
|
186
|
+
}
|
|
187
|
+
_dispatchEvent(type, value) {
|
|
188
|
+
this._eventBus$.next({
|
|
189
|
+
type,
|
|
190
|
+
value,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
_createBlock(block) {
|
|
194
|
+
const newBlock = Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || guid('xxxxxxxxxxxx') });
|
|
195
|
+
let width = (this._config.width * .333).toFixed(2);
|
|
196
|
+
let height = width / 2;
|
|
197
|
+
if (newBlock.type === BlockType.Rectangle) {
|
|
198
|
+
newBlock.borderColor = '#cccccc';
|
|
199
|
+
newBlock.borderWidth = 1;
|
|
200
|
+
}
|
|
201
|
+
else if (newBlock.type === BlockType.Checkbox || newBlock.type === BlockType.RadioButton) {
|
|
202
|
+
width = .25;
|
|
203
|
+
height = .25;
|
|
204
|
+
newBlock.keepRatio = true;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
width = 2;
|
|
208
|
+
height = .5;
|
|
209
|
+
}
|
|
210
|
+
if (this.isReordableBlock(newBlock)) {
|
|
211
|
+
newBlock.tabIndex = this._lastTabIndex + 1;
|
|
212
|
+
this.updateTabIndex(newBlock.tabIndex);
|
|
213
|
+
}
|
|
214
|
+
return Object.assign({ top: height, left: width, width,
|
|
215
|
+
height }, newBlock);
|
|
216
|
+
}
|
|
217
|
+
_deduplicateIndexesFor(blocks) {
|
|
218
|
+
blocks.forEach((block, index) => {
|
|
219
|
+
block.index = index;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
BlocksStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
224
|
+
BlocksStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore });
|
|
225
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlocksStore, decorators: [{
|
|
226
|
+
type: Injectable
|
|
227
|
+
}] });
|
|
228
|
+
|
|
48
229
|
var BlockFormat;
|
|
49
230
|
(function (BlockFormat) {
|
|
50
231
|
BlockFormat["Date"] = "date";
|
|
@@ -53,26 +234,57 @@ var BlockFormat;
|
|
|
53
234
|
BlockFormat["Number"] = "number";
|
|
54
235
|
})(BlockFormat || (BlockFormat = {}));
|
|
55
236
|
|
|
237
|
+
const BlockTypes = [
|
|
238
|
+
{ value: BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4' },
|
|
239
|
+
{ value: BlockType.ShortText, name: 'Short Text', icon: 'short_text' },
|
|
240
|
+
{ value: BlockType.LongText, name: 'Long Text', icon: 'subject' },
|
|
241
|
+
{ value: BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked' },
|
|
242
|
+
{ value: BlockType.Checkbox, name: 'Checkbox', icon: 'check_box' },
|
|
243
|
+
{ value: BlockType.Date, name: 'Date', icon: 'calendar_today' },
|
|
244
|
+
{ value: BlockType.Signature, name: 'Signature', icon: 'draw' },
|
|
245
|
+
{ value: BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*' },
|
|
246
|
+
{ value: BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf' },
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
class LayersReorderDialogComponent {
|
|
250
|
+
constructor(_dialogData, _dialogRef) {
|
|
251
|
+
this._dialogRef = _dialogRef;
|
|
252
|
+
this.blockTypeIcons = index(BlockTypes, 'value', 'icon');
|
|
253
|
+
this._init(_dialogData);
|
|
254
|
+
}
|
|
255
|
+
swapItems(event) {
|
|
256
|
+
moveItemInArray(this.fields, event.previousIndex, event.currentIndex);
|
|
257
|
+
}
|
|
258
|
+
done() {
|
|
259
|
+
this._dialogRef.close(this.fields);
|
|
260
|
+
}
|
|
261
|
+
_init(data) {
|
|
262
|
+
this.fields = data.fields;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
LayersReorderDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LayersReorderDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
266
|
+
LayersReorderDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LayersReorderDialogComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title><mat-icon>swap_vert</mat-icon> Reorder Fields</h1>\n <mat-dialog-content>\n <mat-list cdkDropList (cdkDropListDropped)=\"swapItems($event)\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let field of fields\">\n <mat-list-item cdkDrag cdkDragLockAxis=\"y\">\n <mat-icon cdkDragHandle>drag_handle</mat-icon>\n <mat-icon>\n {{ blockTypeIcons[field.block.type] }}\n </mat-icon>\n <span class=\"block-label\">\n {{ field.block.label || 'no label' }}\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}.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.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i6.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.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i7.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: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.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.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LayersReorderDialogComponent, decorators: [{
|
|
268
|
+
type: Component,
|
|
269
|
+
args: [{
|
|
270
|
+
templateUrl: './layers-reorder-dialog.component.html',
|
|
271
|
+
styleUrls: [
|
|
272
|
+
'./layers-reorder-dialog.component.scss',
|
|
273
|
+
]
|
|
274
|
+
}]
|
|
275
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
276
|
+
type: Inject,
|
|
277
|
+
args: [MAT_DIALOG_DATA]
|
|
278
|
+
}] }, { type: i1.MatDialogRef }]; } });
|
|
279
|
+
|
|
56
280
|
class BlockEditorService {
|
|
57
|
-
constructor() {
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
60
|
-
this._blockAdded$ = new Subject();
|
|
61
|
-
this._blocks$ = new BehaviorSubject([]);
|
|
281
|
+
constructor(_store, _dialog) {
|
|
282
|
+
this._store = _store;
|
|
283
|
+
this._dialog = _dialog;
|
|
62
284
|
this._selectedBlocks$ = new BehaviorSubject([]);
|
|
63
285
|
this._blockComponents = new Map();
|
|
64
286
|
this._destroy$ = new Subject();
|
|
65
287
|
}
|
|
66
|
-
get elementGuidelines() {
|
|
67
|
-
return [
|
|
68
|
-
...Array.from(this._blockComponents.values())
|
|
69
|
-
.map((block) => {
|
|
70
|
-
return block.el;
|
|
71
|
-
}),
|
|
72
|
-
this.container,
|
|
73
|
-
this.margin,
|
|
74
|
-
];
|
|
75
|
-
}
|
|
76
288
|
get blockComponents() {
|
|
77
289
|
return Array.from(this._blockComponents.values());
|
|
78
290
|
}
|
|
@@ -80,96 +292,43 @@ class BlockEditorService {
|
|
|
80
292
|
return this.blockComponents
|
|
81
293
|
.filter((blockComponent) => this.selectedBlocks.indexOf(blockComponent.block) !== -1);
|
|
82
294
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.pipe(takeUntil(this._destroy$))
|
|
87
|
-
.subscribe((block) => {
|
|
88
|
-
const blocks = [
|
|
89
|
-
...this.blocks,
|
|
90
|
-
block,
|
|
91
|
-
];
|
|
92
|
-
this.blocks = this._updateIndexesFor(blocks);
|
|
93
|
-
this._blockAdded$.next(block);
|
|
94
|
-
if (this.config.blockAdded) {
|
|
95
|
-
this.config.blockAdded(block);
|
|
96
|
-
}
|
|
97
|
-
//this._updateIndexes();
|
|
98
|
-
});
|
|
99
|
-
}
|
|
295
|
+
init(config) {
|
|
296
|
+
this.config = config;
|
|
297
|
+
this._store.init(Object.assign({}, this.config));
|
|
100
298
|
}
|
|
101
|
-
blockAdd(block) {
|
|
102
|
-
|
|
103
|
-
this.config.blockAdd(block)
|
|
104
|
-
.pipe(takeUntil(this._destroy$))
|
|
105
|
-
.subscribe((block) => {
|
|
106
|
-
const blocks = [
|
|
107
|
-
...this.blocks,
|
|
108
|
-
block,
|
|
109
|
-
];
|
|
110
|
-
this.blocks = this._updateIndexesFor(blocks);
|
|
111
|
-
this._blockAdded$.next(block);
|
|
112
|
-
if (this.config.blockAdded) {
|
|
113
|
-
this.config.blockAdded(block);
|
|
114
|
-
}
|
|
115
|
-
//this._updateIndexes();
|
|
116
|
-
});
|
|
117
|
-
}
|
|
299
|
+
blockAdd(block, newBlock = false) {
|
|
300
|
+
this._store.blockAdd(block, newBlock);
|
|
118
301
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
// private _updateIndexes(): void {
|
|
126
|
-
// const sort = this.blocks.slice().sort((a, b) => {
|
|
127
|
-
// return a.index > b.index ? 1 : -1;
|
|
128
|
-
// })
|
|
129
|
-
// sort.forEach((block, index) => {
|
|
130
|
-
// this.blocks.find((item) => {
|
|
131
|
-
// return block.reference === item.reference;
|
|
132
|
-
// }).index = index;
|
|
133
|
-
// });
|
|
134
|
-
// }
|
|
135
|
-
removeBlock(block) {
|
|
136
|
-
const index = this.indexOf(block);
|
|
137
|
-
if (index !== -1) {
|
|
138
|
-
const blocks = this.blocks;
|
|
139
|
-
blocks.splice(index, 1);
|
|
140
|
-
this.blocks = blocks;
|
|
141
|
-
this._blockRemoved$.next(block);
|
|
142
|
-
}
|
|
302
|
+
blockUpload(block, fsFile, newBlock = false) {
|
|
303
|
+
this._store.blockUpload(block, fsFile, false);
|
|
304
|
+
}
|
|
305
|
+
blockRemove(block) {
|
|
306
|
+
this._store.blockRemove(block);
|
|
143
307
|
}
|
|
144
308
|
removeSelectedBlocks() {
|
|
145
|
-
this.selectedBlocks
|
|
146
|
-
|
|
309
|
+
this.selectedBlocks
|
|
310
|
+
.forEach((block) => {
|
|
311
|
+
this.blockRemove(block);
|
|
147
312
|
});
|
|
148
313
|
this.selectedBlocks = [];
|
|
149
314
|
}
|
|
150
315
|
get blocks$() {
|
|
151
|
-
return this.
|
|
316
|
+
return this._store.blocks$;
|
|
152
317
|
}
|
|
153
318
|
get blockChanged$() {
|
|
154
|
-
return this.
|
|
155
|
-
}
|
|
156
|
-
get blockRemoved$() {
|
|
157
|
-
return this._blockRemoved$;
|
|
319
|
+
return this._store.blockChanged$;
|
|
158
320
|
}
|
|
159
321
|
get blockAdded$() {
|
|
160
|
-
return this.
|
|
322
|
+
return this._store.blockAdded$;
|
|
161
323
|
}
|
|
162
|
-
|
|
163
|
-
this.
|
|
164
|
-
if (this.config.blockChanged) {
|
|
165
|
-
this.config.blockChanged(block);
|
|
166
|
-
}
|
|
324
|
+
get blockRemoved$() {
|
|
325
|
+
return this._store.blockRemoved$;
|
|
167
326
|
}
|
|
168
327
|
get blocks() {
|
|
169
|
-
return this.
|
|
328
|
+
return this._store.blocks;
|
|
170
329
|
}
|
|
171
|
-
|
|
172
|
-
this.
|
|
330
|
+
blockChange(block) {
|
|
331
|
+
this._store.blockChange(block);
|
|
173
332
|
}
|
|
174
333
|
isSelectedBlock(block) {
|
|
175
334
|
return this.selectedBlocks.indexOf(block.block) !== -1;
|
|
@@ -178,27 +337,11 @@ class BlockEditorService {
|
|
|
178
337
|
return this.blocks.map((e) => e.guid).indexOf(block.guid);
|
|
179
338
|
}
|
|
180
339
|
selectedBlockComponentChangeProperty(value, name) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (guidIndex !== -1) {
|
|
187
|
-
blocks.splice(index, 1);
|
|
188
|
-
blocks.splice(+value, 0, block);
|
|
189
|
-
block.index = +value;
|
|
190
|
-
this.blockChange(block);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
this._updateIndexesFor(blocks);
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
this.selectedBlocks
|
|
197
|
-
.forEach((block) => {
|
|
198
|
-
block[name] = value;
|
|
199
|
-
this.blockChange(block);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
340
|
+
this.selectedBlocks
|
|
341
|
+
.forEach((block) => {
|
|
342
|
+
block[name] = value;
|
|
343
|
+
this.blockChange(block);
|
|
344
|
+
});
|
|
202
345
|
}
|
|
203
346
|
get selectedBlocks$() {
|
|
204
347
|
return this._selectedBlocks$;
|
|
@@ -242,14 +385,6 @@ class BlockEditorService {
|
|
|
242
385
|
registerBlock(block, blockComponent) {
|
|
243
386
|
this._blockComponents.set(block, blockComponent);
|
|
244
387
|
this.blockComponents.push(block);
|
|
245
|
-
// Disabled for now
|
|
246
|
-
// this.blockComponents.forEach((blockComponent: FsBlockComponent) => {
|
|
247
|
-
// const blocks = this.elementGuidelines
|
|
248
|
-
// .filter((el) => {
|
|
249
|
-
// return !el.isSameNode(blockComponent.el);
|
|
250
|
-
// });
|
|
251
|
-
// blockComponent.elementGuidelines = blocks;
|
|
252
|
-
// });
|
|
253
388
|
}
|
|
254
389
|
unregisterBlock(block) {
|
|
255
390
|
this._blockComponents.delete(block);
|
|
@@ -260,38 +395,37 @@ class BlockEditorService {
|
|
|
260
395
|
registerMargin(margin) {
|
|
261
396
|
this.margin = margin;
|
|
262
397
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || guid('xxxxxxxxxxxx') });
|
|
398
|
+
openReorderDialog() {
|
|
399
|
+
const reordableFields = this.blockComponents
|
|
400
|
+
.filter((blockCmp) => {
|
|
401
|
+
return this._store.isReordableBlock(blockCmp.block);
|
|
402
|
+
});
|
|
403
|
+
this._dialog
|
|
404
|
+
.open(LayersReorderDialogComponent, {
|
|
405
|
+
data: {
|
|
406
|
+
fields: reordableFields,
|
|
407
|
+
}
|
|
408
|
+
})
|
|
409
|
+
.afterClosed()
|
|
410
|
+
.pipe(takeUntil(this._destroy$))
|
|
411
|
+
.subscribe((fields) => {
|
|
412
|
+
fields.forEach((blockCmp, index) => {
|
|
413
|
+
blockCmp.block.tabIndex = index;
|
|
414
|
+
this._store.blockChange(blockCmp.block);
|
|
415
|
+
this._store.updateTabIndex(index);
|
|
416
|
+
});
|
|
417
|
+
});
|
|
284
418
|
}
|
|
285
419
|
ngOnDestroy() {
|
|
286
420
|
this._destroy$.next();
|
|
287
421
|
this._destroy$.complete();
|
|
288
422
|
}
|
|
289
423
|
}
|
|
290
|
-
BlockEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
424
|
+
BlockEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, deps: [{ token: BlocksStore }, { token: i2.FsDialog }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
291
425
|
BlockEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService });
|
|
292
426
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, decorators: [{
|
|
293
427
|
type: Injectable
|
|
294
|
-
}] });
|
|
428
|
+
}], ctorParameters: function () { return [{ type: BlocksStore }, { type: i2.FsDialog }]; } });
|
|
295
429
|
|
|
296
430
|
class FsBlockComponent {
|
|
297
431
|
constructor(_blockEditor, _elementRef, _cdRef) {
|
|
@@ -344,11 +478,13 @@ class FsBlockComponent {
|
|
|
344
478
|
this.moveable.updateRect();
|
|
345
479
|
}
|
|
346
480
|
set top(value) {
|
|
347
|
-
this.
|
|
481
|
+
this.block.top = parseFloat(value);
|
|
482
|
+
this.element.nativeElement.style.top = `${this.block.top}${this.unit}`;
|
|
348
483
|
this.moveable.updateRect();
|
|
349
484
|
}
|
|
350
485
|
set left(value) {
|
|
351
|
-
this.
|
|
486
|
+
this.block.left = parseFloat(value);
|
|
487
|
+
this.element.nativeElement.style.left = `${this.block.left}${this.unit}`;
|
|
352
488
|
this.moveable.updateRect();
|
|
353
489
|
}
|
|
354
490
|
set rotate(value) {
|
|
@@ -619,18 +755,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
619
755
|
type: Input
|
|
620
756
|
}] } });
|
|
621
757
|
|
|
622
|
-
const BlockTypes = [
|
|
623
|
-
{ value: BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4' },
|
|
624
|
-
{ value: BlockType.ShortText, name: 'Short Text', icon: 'short_text' },
|
|
625
|
-
{ value: BlockType.LongText, name: 'Long Text', icon: 'subject' },
|
|
626
|
-
{ value: BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked' },
|
|
627
|
-
{ value: BlockType.Checkbox, name: 'Checkbox', icon: 'check_box' },
|
|
628
|
-
{ value: BlockType.Date, name: 'Date', icon: 'calendar_today' },
|
|
629
|
-
{ value: BlockType.Signature, name: 'Signature', icon: 'draw' },
|
|
630
|
-
{ value: BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*' },
|
|
631
|
-
{ value: BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf' },
|
|
632
|
-
];
|
|
633
|
-
|
|
634
758
|
const BlockFormats = [
|
|
635
759
|
{ value: BlockFormat.Number, name: 'Number', blockTypes: [BlockType.ShortText, BlockType.LongText] },
|
|
636
760
|
{ value: BlockFormat.Currency, name: 'Currency', blockTypes: [BlockType.ShortText, BlockType.LongText] },
|
|
@@ -639,11 +763,12 @@ const BlockFormats = [
|
|
|
639
763
|
];
|
|
640
764
|
|
|
641
765
|
class SidebarComponent {
|
|
642
|
-
constructor(_el, _blockEditor, _cdRef, _prompt) {
|
|
766
|
+
constructor(_el, _blockEditor, _cdRef, _prompt, _document) {
|
|
643
767
|
this._el = _el;
|
|
644
768
|
this._blockEditor = _blockEditor;
|
|
645
769
|
this._cdRef = _cdRef;
|
|
646
770
|
this._prompt = _prompt;
|
|
771
|
+
this._document = _document;
|
|
647
772
|
this.zoomCenter = new EventEmitter();
|
|
648
773
|
this.BlockTypes = BlockTypes;
|
|
649
774
|
this.blockTypeNames = index(BlockTypes, 'value', 'name');
|
|
@@ -782,20 +907,18 @@ class SidebarComponent {
|
|
|
782
907
|
});
|
|
783
908
|
}
|
|
784
909
|
}
|
|
785
|
-
blockUpload(
|
|
786
|
-
|
|
787
|
-
type
|
|
788
|
-
});
|
|
789
|
-
this._blockEditor.blockUpload(block, fsFile);
|
|
910
|
+
blockUpload(type, fsFile) {
|
|
911
|
+
this._blockEditor.blockUpload({
|
|
912
|
+
type,
|
|
913
|
+
}, fsFile, true);
|
|
790
914
|
}
|
|
791
915
|
blockAdd(type) {
|
|
792
916
|
if (type === BlockType.Pdf || type === BlockType.Image) {
|
|
793
917
|
return;
|
|
794
918
|
}
|
|
795
|
-
|
|
919
|
+
this._blockEditor.blockAdd({
|
|
796
920
|
type,
|
|
797
|
-
});
|
|
798
|
-
this._blockEditor.blockAdd(block);
|
|
921
|
+
}, true);
|
|
799
922
|
}
|
|
800
923
|
layerMove(direction) {
|
|
801
924
|
this._blockEditor.blockComponents.forEach((blockComponent) => {
|
|
@@ -820,10 +943,10 @@ class SidebarComponent {
|
|
|
820
943
|
layerDown() {
|
|
821
944
|
this.layerMove(-1);
|
|
822
945
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
946
|
+
reorderLayers() {
|
|
947
|
+
var _a;
|
|
948
|
+
(_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
|
|
949
|
+
this._blockEditor.openReorderDialog();
|
|
827
950
|
}
|
|
828
951
|
inputFocus(event) {
|
|
829
952
|
event.target.select();
|
|
@@ -836,8 +959,8 @@ class SidebarComponent {
|
|
|
836
959
|
return !value || !!String(value).match(/^\d*\.?\d*$/);
|
|
837
960
|
}
|
|
838
961
|
}
|
|
839
|
-
SidebarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i2.FsPrompt }], target: i0.ɵɵFactoryTarget.Component });
|
|
840
|
-
SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, outputs: { zoomCenter: "zoomCenter" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, template: "<div class=\"sidebar\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container> \n <ng-container *ngSwitchDefault>\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [accept]=\"blockType.accept\">\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </fs-file>\n </ng-template>\n\n <ng-template #addButton>\n <button \n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n </ng-template>\n </ng-container>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n matTooltip=\"Reset zoom\"\n (click)=\"zoomCenter.emit()\">\n <mat-icon>crop_free</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\"> \n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date || block.type === BlockType.Signature\">\n <div class=\"sidebar-panel block-form-panel\">\n <div class=\"sidebar-label\">\n <mat-icon>{{blockTypeIcons[block.type]}}</mat-icon>\n {{blockTypeNames[block.type]}}</div>\n <div class=\"sidebar-row\">\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'label')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.Checkbox && block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field \n *ngIf=\"formats.length\"\n class=\"form-field-padless-bottom full-width\">\n <mat-label>Format</mat-label>\n <mat-select\n [(ngModel)]=\"block.format\"\n name=\"format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\n <mat-option [value]=\"null\">\n None\n </mat-option> \n <mat-option\n *ngFor=\"let item of formats\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n \n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Index</mat-label>\n <input\n matInput\n [(ngModel)]=\"block.index\"\n name=\"index\"\n (ngModelChange)=\"blockChangeProperty($event, 'index')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox \n name=\"required\" \n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n\n <mat-checkbox \n name=\"readonly\" \n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockChangeProperty($event, 'readonly')\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"block.type !== BlockType.Pdf\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"imageSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n", styles: [".sidebar{width:285px;font-size:14px;height:100%;overflow:auto;background-color:#fff;padding:0 10px 10px;box-shadow:-1px 1px 4px 3px #0003;z-index:1;position:relative;box-sizing:border-box}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.block-form-panel .sidebar-label{display:flex;align-items:center}.sidebar .sidebar-panel.block-form-panel .sidebar-label mat-icon{transform:scale(.8);color:inherit;margin-left:-5px}.sidebar .sidebar-panel.block-form-panel mat-form-field+mat-form-field{margin-top:12px}.sidebar .sidebar-panel.block-form-panel .form-field-options{margin-top:11px}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox{display:block}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox+mat-checkbox{margin-top:2px}.sidebar .sidebar-panel.info-panel .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:7px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}:host ::ng-deep .mat-form-field-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], components: [{ type: i3.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i4.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.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i8.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i9.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: i10.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }], directives: [{ type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i11.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i11.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i11.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i11.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i12.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13.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: i14.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: i14.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6.MatPrefix, selector: "[matPrefix]" }, { type: i13.MatTextareaAutosize, selector: "textarea[mat-autosize], textarea[matTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "matAutosizeMinRows", "matAutosizeMaxRows", "mat-autosize", "matTextareaAutosize"], exportAs: ["matTextareaAutosize"] }, { type: i6.MatLabel, selector: "mat-label" }, { type: i11.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
962
|
+
SidebarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i2$1.FsPrompt }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
|
|
963
|
+
SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, outputs: { zoomCenter: "zoomCenter" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, template: "<div class=\"sidebar\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [accept]=\"blockType.accept\">\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </fs-file>\n </ng-template>\n\n <ng-template #addButton>\n <button\n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n </ng-template>\n </ng-container>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n matTooltip=\"Reset zoom\"\n (click)=\"zoomCenter.emit()\">\n <mat-icon>crop_free</mat-icon>\n </button>\n <button\n class=\"reorder-layers\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"reorderLayers()\">\n <mat-icon>swap_vert</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date || block.type === BlockType.Signature\">\n <div class=\"sidebar-panel block-form-panel\">\n <div class=\"sidebar-label\">\n <mat-icon>{{blockTypeIcons[block.type]}}</mat-icon>\n {{blockTypeNames[block.type]}}</div>\n <div class=\"sidebar-row\">\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.label\"\n name=\"label\"\n placeholder=\"Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'label')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type !== BlockType.Checkbox && block.type !== BlockType.RadioButton\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field\n *ngIf=\"formats.length\"\n class=\"form-field-padless-bottom full-width\">\n <mat-label>Format</mat-label>\n <mat-select\n [(ngModel)]=\"block.format\"\n name=\"format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\n <mat-option [value]=\"null\">\n None\n </mat-option>\n <mat-option\n *ngFor=\"let item of formats\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless-bottom full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox\n name=\"required\"\n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n\n <mat-checkbox\n name=\"readonly\"\n [(ngModel)]=\"block.readonly\"\n (ngModelChange)=\"blockChangeProperty($event, 'readonly')\">\n Readonly\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"block.type !== BlockType.Pdf\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"imageSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n", styles: [".sidebar{width:285px;font-size:14px;height:100%;overflow:auto;background-color:#fff;padding:0 10px 10px;box-shadow:-1px 1px 4px 3px #0003;z-index:1;position:relative;box-sizing:border-box}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.block-form-panel .sidebar-label{display:flex;align-items:center}.sidebar .sidebar-panel.block-form-panel .sidebar-label mat-icon{transform:scale(.8);color:inherit;margin-left:-5px}.sidebar .sidebar-panel.block-form-panel mat-form-field+mat-form-field{margin-top:12px}.sidebar .sidebar-panel.block-form-panel .form-field-options{margin-top:11px}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox{display:block}.sidebar .sidebar-panel.block-form-panel .form-field-options mat-checkbox+mat-checkbox{margin-top:2px}.sidebar .sidebar-panel.info-panel .sidebar-row+.sidebar-row{margin-top:12px}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:7px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}:host ::ng-deep .mat-form-field-prefix{color:#9e9e9e;margin-right:3px;font-size:85%}\n"], components: [{ type: i3$1.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i6.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.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i8.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i9.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: i10.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }], directives: [{ type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i11.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i11.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i11.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i11.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i12.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13.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: i14.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: i14.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6$1.MatPrefix, selector: "[matPrefix]" }, { type: i13.MatTextareaAutosize, selector: "textarea[mat-autosize], textarea[matTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "matAutosizeMinRows", "matAutosizeMaxRows", "mat-autosize", "matTextareaAutosize"], exportAs: ["matTextareaAutosize"] }, { type: i6$1.MatLabel, selector: "mat-label" }, { type: i11.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
841
964
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, decorators: [{
|
|
842
965
|
type: Component,
|
|
843
966
|
args: [{
|
|
@@ -846,7 +969,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
846
969
|
styleUrls: ['sidebar.component.scss'],
|
|
847
970
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
848
971
|
}]
|
|
849
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i2.FsPrompt }
|
|
972
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i2$1.FsPrompt }, { type: undefined, decorators: [{
|
|
973
|
+
type: Inject,
|
|
974
|
+
args: [DOCUMENT]
|
|
975
|
+
}] }]; }, propDecorators: { sidebarPanels: [{
|
|
850
976
|
type: ContentChildren,
|
|
851
977
|
args: [FsBlockEditorSidebarPanelDirective]
|
|
852
978
|
}], config: [{
|
|
@@ -904,9 +1030,9 @@ class ArtboardComponent {
|
|
|
904
1030
|
this._cdRef.markForCheck();
|
|
905
1031
|
});
|
|
906
1032
|
fromEvent(window, 'keydown')
|
|
907
|
-
.pipe(
|
|
908
|
-
return
|
|
909
|
-
}))
|
|
1033
|
+
.pipe(filter((event) => {
|
|
1034
|
+
return ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].indexOf(event.key) !== -1;
|
|
1035
|
+
}), takeUntil(this._destroy$))
|
|
910
1036
|
.subscribe((event) => {
|
|
911
1037
|
event.preventDefault();
|
|
912
1038
|
const inchPixel = 1 / 100;
|
|
@@ -929,11 +1055,6 @@ class ArtboardComponent {
|
|
|
929
1055
|
});
|
|
930
1056
|
});
|
|
931
1057
|
}
|
|
932
|
-
blockChanged(block) {
|
|
933
|
-
if (this.config.blockChanged) {
|
|
934
|
-
this.config.blockChanged(block);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
1058
|
ngAfterViewInit() {
|
|
938
1059
|
// this.blockComponents.changes
|
|
939
1060
|
// .pipe(
|
|
@@ -1001,8 +1122,7 @@ class FsBlockEditorComponent {
|
|
|
1001
1122
|
}
|
|
1002
1123
|
ngOnInit() {
|
|
1003
1124
|
this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
|
|
1004
|
-
this._blockEditor.
|
|
1005
|
-
this._blockEditor.config = this.config;
|
|
1125
|
+
this._blockEditor.init(this.config);
|
|
1006
1126
|
this._blockEditor.blocks$
|
|
1007
1127
|
.pipe(takeUntil(this._destroy$))
|
|
1008
1128
|
.subscribe((blocks) => {
|
|
@@ -1030,7 +1150,8 @@ class FsBlockEditorComponent {
|
|
|
1030
1150
|
FsBlockEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1031
1151
|
FsBlockEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
|
|
1032
1152
|
BlockEditorService,
|
|
1033
|
-
|
|
1153
|
+
BlocksStore,
|
|
1154
|
+
], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "zoompan", first: true, predicate: 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: ElementRef }], ngImport: i0, template: "<div \n class=\"editor-container deselectable\"\n (mousedown)=\"editorContainerClick($event)\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n class=\"deselectable\"\n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n (zoomCenter)=\"zoomCenter()\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative;height:100%;background:#d8d8d8;overflow:hidden}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0}.editor-container .zoom-pan-container{flex:1}fs-zoom-pan{height:100%}\n"], components: [{ type: i2$2.FsZoomPanComponent, selector: "fs-zoom-pan", inputs: ["zoomMax", "zoomMin", "zoomDefault", "top", "left"], outputs: ["moved", "zoomed"] }, { type: ArtboardComponent, selector: "app-artboard", inputs: ["config", "zoompan"] }, { type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks"], outputs: ["zoomCenter"] }], directives: [{ type: i2$2.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1034
1155
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, decorators: [{
|
|
1035
1156
|
type: Component,
|
|
1036
1157
|
args: [{
|
|
@@ -1040,6 +1161,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1040
1161
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1041
1162
|
providers: [
|
|
1042
1163
|
BlockEditorService,
|
|
1164
|
+
BlocksStore,
|
|
1043
1165
|
]
|
|
1044
1166
|
}]
|
|
1045
1167
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
|
|
@@ -1074,7 +1196,8 @@ FsBlockEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ver
|
|
|
1074
1196
|
FsBlockEditorSidebarPanelDirective,
|
|
1075
1197
|
FsBlockEditorMarginDirective,
|
|
1076
1198
|
SidebarComponent,
|
|
1077
|
-
ArtboardComponent
|
|
1199
|
+
ArtboardComponent,
|
|
1200
|
+
LayersReorderDialogComponent], imports: [CommonModule,
|
|
1078
1201
|
FormsModule,
|
|
1079
1202
|
MatIconModule,
|
|
1080
1203
|
MatButtonModule,
|
|
@@ -1083,10 +1206,13 @@ FsBlockEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ver
|
|
|
1083
1206
|
MatCheckboxModule,
|
|
1084
1207
|
MatTooltipModule,
|
|
1085
1208
|
MatSelectModule,
|
|
1209
|
+
MatListModule,
|
|
1210
|
+
DragDropModule,
|
|
1086
1211
|
FsFileModule,
|
|
1087
1212
|
FsColorPickerModule,
|
|
1088
1213
|
FsMenuModule,
|
|
1089
|
-
FsZoomPanModule
|
|
1214
|
+
FsZoomPanModule,
|
|
1215
|
+
FsDialogModule], exports: [FsBlockComponent,
|
|
1090
1216
|
FsBlockEditorComponent,
|
|
1091
1217
|
FsBlockEditorSidebarPanelDirective] });
|
|
1092
1218
|
FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, imports: [[
|
|
@@ -1099,10 +1225,13 @@ FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
|
|
|
1099
1225
|
MatCheckboxModule,
|
|
1100
1226
|
MatTooltipModule,
|
|
1101
1227
|
MatSelectModule,
|
|
1228
|
+
MatListModule,
|
|
1229
|
+
DragDropModule,
|
|
1102
1230
|
FsFileModule,
|
|
1103
1231
|
FsColorPickerModule,
|
|
1104
1232
|
FsMenuModule,
|
|
1105
1233
|
FsZoomPanModule,
|
|
1234
|
+
FsDialogModule,
|
|
1106
1235
|
]] });
|
|
1107
1236
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, decorators: [{
|
|
1108
1237
|
type: NgModule,
|
|
@@ -1117,10 +1246,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1117
1246
|
MatCheckboxModule,
|
|
1118
1247
|
MatTooltipModule,
|
|
1119
1248
|
MatSelectModule,
|
|
1249
|
+
MatListModule,
|
|
1250
|
+
DragDropModule,
|
|
1120
1251
|
FsFileModule,
|
|
1121
1252
|
FsColorPickerModule,
|
|
1122
1253
|
FsMenuModule,
|
|
1123
1254
|
FsZoomPanModule,
|
|
1255
|
+
FsDialogModule,
|
|
1124
1256
|
],
|
|
1125
1257
|
exports: [
|
|
1126
1258
|
FsBlockComponent,
|
|
@@ -1134,6 +1266,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1134
1266
|
FsBlockEditorMarginDirective,
|
|
1135
1267
|
SidebarComponent,
|
|
1136
1268
|
ArtboardComponent,
|
|
1269
|
+
LayersReorderDialogComponent,
|
|
1137
1270
|
],
|
|
1138
1271
|
}]
|
|
1139
1272
|
}] });
|