@solidpepper/solidpepper-soliddesigner 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{solidpepper-solidpepper-soliddesigner-iframe-modal.component-DRdUzn0b.mjs → solidpepper-solidpepper-soliddesigner-iframe-modal.component-CJ4Uve9q.mjs} +2 -2
- package/fesm2022/{solidpepper-solidpepper-soliddesigner-iframe-modal.component-DRdUzn0b.mjs.map → solidpepper-solidpepper-soliddesigner-iframe-modal.component-CJ4Uve9q.mjs.map} +1 -1
- package/fesm2022/{solidpepper-solidpepper-soliddesigner-image-utils-DvchiNMO.mjs → solidpepper-solidpepper-soliddesigner-image-utils-BZ877qA2.mjs} +2 -2
- package/fesm2022/{solidpepper-solidpepper-soliddesigner-image-utils-DvchiNMO.mjs.map → solidpepper-solidpepper-soliddesigner-image-utils-BZ877qA2.mjs.map} +1 -1
- package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CSVxODUW.mjs +771 -0
- package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CSVxODUW.mjs.map +1 -0
- package/fesm2022/{solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DbfRWWk5.mjs → solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DNuvMIlh.mjs} +2020 -1272
- package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DNuvMIlh.mjs.map +1 -0
- package/fesm2022/solidpepper-solidpepper-soliddesigner.mjs +1 -1
- package/index.d.ts +15 -10
- package/package.json +1 -1
- package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CzgWwiAm.mjs +0 -851
- package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CzgWwiAm.mjs.map +0 -1
- package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DbfRWWk5.mjs.map +0 -1
package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CzgWwiAm.mjs
DELETED
|
@@ -1,851 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, inject, effect, Output, Input, Component, signal, computed } from '@angular/core';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
-
import * as i2 from '@ngx-translate/core';
|
|
5
|
-
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
6
|
-
import { from, concatMap, toArray } from 'rxjs';
|
|
7
|
-
import { S as SaveService, A as AppParamsService, a as AssetsService, M as ModalService, P as PageContextMenuComponent, C as ConfirmDeleteModalComponent } from './solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DbfRWWk5.mjs';
|
|
8
|
-
|
|
9
|
-
class PageGridItemComponent {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.isCurrent = false;
|
|
12
|
-
this.isSelected = false;
|
|
13
|
-
this.selectPage = new EventEmitter();
|
|
14
|
-
this.toggleSelect = new EventEmitter();
|
|
15
|
-
this.dragStarted = new EventEmitter();
|
|
16
|
-
this.dropped = new EventEmitter();
|
|
17
|
-
this.contextMenuEvent = new EventEmitter();
|
|
18
|
-
this.dragOver = false;
|
|
19
|
-
this.dropSide = null;
|
|
20
|
-
this.saveService = inject(SaveService);
|
|
21
|
-
this.cacheBuster = '';
|
|
22
|
-
effect(() => {
|
|
23
|
-
const pulse = this.saveService.saveSuccessPulse();
|
|
24
|
-
const pulseCount = typeof pulse === 'object' ? pulse.count : pulse;
|
|
25
|
-
if (this.isCurrent && pulseCount > 0) {
|
|
26
|
-
this.cacheBuster = `t=${pulseCount}`;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
get displayImageUrl() {
|
|
31
|
-
if (!this.cacheBuster || !this.imageUrl) {
|
|
32
|
-
return this.imageUrl;
|
|
33
|
-
}
|
|
34
|
-
const separator = this.imageUrl.includes('?') ? '&' : '?';
|
|
35
|
-
return `${this.imageUrl}${separator}${this.cacheBuster}`;
|
|
36
|
-
}
|
|
37
|
-
onDragStart(event) {
|
|
38
|
-
this.dragStarted.emit(this.index);
|
|
39
|
-
if (event.dataTransfer) {
|
|
40
|
-
event.dataTransfer.effectAllowed = 'move';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
onDragOver(event) {
|
|
44
|
-
event.preventDefault();
|
|
45
|
-
this.dragOver = true;
|
|
46
|
-
const rect = event.currentTarget.getBoundingClientRect();
|
|
47
|
-
const midX = rect.left + rect.width / 2;
|
|
48
|
-
this.dropSide = event.clientX < midX ? 'before' : 'after';
|
|
49
|
-
}
|
|
50
|
-
onDrop(event) {
|
|
51
|
-
event.preventDefault();
|
|
52
|
-
if (this.dropSide) {
|
|
53
|
-
this.dropped.emit({ targetIndex: this.index, side: this.dropSide });
|
|
54
|
-
}
|
|
55
|
-
this.onDragEnd();
|
|
56
|
-
}
|
|
57
|
-
onDragLeave() {
|
|
58
|
-
this.dragOver = false;
|
|
59
|
-
this.dropSide = null;
|
|
60
|
-
}
|
|
61
|
-
onDragEnd() {
|
|
62
|
-
this.dragOver = false;
|
|
63
|
-
this.dropSide = null;
|
|
64
|
-
}
|
|
65
|
-
onCheckboxChange(event) {
|
|
66
|
-
event.stopPropagation();
|
|
67
|
-
this.toggleSelect.emit(this.index);
|
|
68
|
-
}
|
|
69
|
-
onContextMenu(event) {
|
|
70
|
-
event.preventDefault();
|
|
71
|
-
event.stopPropagation();
|
|
72
|
-
this.contextMenuEvent.emit({ event, index: this.index });
|
|
73
|
-
}
|
|
74
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
75
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: PageGridItemComponent, isStandalone: true, selector: "app-page-grid-item", inputs: { index: "index", imageUrl: "imageUrl", isCurrent: "isCurrent", isSelected: "isSelected" }, outputs: { selectPage: "selectPage", toggleSelect: "toggleSelect", dragStarted: "dragStarted", dropped: "dropped", contextMenuEvent: "contextMenuEvent" }, ngImport: i0, template: `
|
|
76
|
-
<div
|
|
77
|
-
class="page-grid-item"
|
|
78
|
-
[class.current]="isCurrent"
|
|
79
|
-
[class.selected]="isSelected"
|
|
80
|
-
[class.drag-before]="dragOver && dropSide === 'before'"
|
|
81
|
-
[class.drag-after]="dragOver && dropSide === 'after'"
|
|
82
|
-
draggable="true"
|
|
83
|
-
(dragstart)="onDragStart($event)"
|
|
84
|
-
(dragover)="onDragOver($event)"
|
|
85
|
-
(dragleave)="onDragLeave()"
|
|
86
|
-
(drop)="onDrop($event)"
|
|
87
|
-
(dragend)="onDragEnd()"
|
|
88
|
-
(click)="selectPage.emit(index)"
|
|
89
|
-
(contextmenu)="onContextMenu($event)"
|
|
90
|
-
>
|
|
91
|
-
<div
|
|
92
|
-
class="page-select-checkbox-container"
|
|
93
|
-
(click)="$event.stopPropagation()"
|
|
94
|
-
>
|
|
95
|
-
<input
|
|
96
|
-
type="checkbox"
|
|
97
|
-
class="page-select-checkbox"
|
|
98
|
-
[checked]="isSelected"
|
|
99
|
-
(change)="onCheckboxChange($event)"
|
|
100
|
-
(click)="$event.stopPropagation()"
|
|
101
|
-
/>
|
|
102
|
-
</div>
|
|
103
|
-
<img
|
|
104
|
-
[src]="displayImageUrl"
|
|
105
|
-
class="page-image"
|
|
106
|
-
alt="Page Thumbnail"
|
|
107
|
-
loading="lazy"
|
|
108
|
-
/>
|
|
109
|
-
<span class="page-number">{{ index + 1 }}</span>
|
|
110
|
-
</div>
|
|
111
|
-
`, isInline: true, styles: [":host{display:block}.page-grid-item{background-color:var(--gray-4);border-radius:var(--radius-xs);padding:var(--spacing-xs) 0;display:flex;flex-direction:column;gap:var(--spacing-xs);width:144px;height:220px;border:1px solid var(--gray-3);align-items:center;cursor:move;margin:0;position:relative;transition:transform .2s,background-color .2s;box-sizing:border-box}.page-grid-item:hover{transform:scale(1.05);background-color:var(--gray-3)}.page-grid-item.current{border-color:oklch(var(--p))}.page-grid-item.selected{border-color:var(--active)!important;box-shadow:0 0 0 2px oklch(var(--p))}.page-select-checkbox-container{position:absolute;top:6px;left:6px;z-index:10;display:flex;align-items:center;justify-content:center}.page-select-checkbox{width:18px;height:18px;cursor:pointer;accent-color:oklch(var(--p));margin:0}.page-image{background-color:#fff;border-radius:0;pointer-events:none;height:calc(100% - 2 * var(--spacing-xs) - 15px);width:auto;max-width:100%;object-fit:contain}.page-number{font-size:10px;color:var(--white)}.page-grid-item:before,.page-grid-item:after{content:\"\";position:absolute;top:0;bottom:0;width:4px;background:oklch(var(--p));z-index:100;opacity:0;transition:opacity .2s;border-radius:2px}.page-grid-item.drag-before:before{left:-4px;opacity:1}.page-grid-item.drag-after:after{right:-4px;opacity:1}:host:nth-child(odd) .page-grid-item{margin:0!important;border-right:0!important;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:2px 0 5px #0003}:host:nth-child(odd) .page-image{margin-left:auto;background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e %3cline x1='100%25' y1='0' x2='100%25' y2='20' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='26' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='34' x2='100%25' y2='54' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='60' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='68' x2='100%25' y2='88' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='64' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='102' x2='100%25' y2='122' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='128' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='136' x2='100%25' y2='156' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='162' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='170' x2='100%25' y2='190' stroke='%234f4f59' stroke-width='1.5'/%3e %3cline x1='0' y1='0' x2='100%25' y2='0' stroke='black' stroke-width='2'/%3e %3cline x1='0' y1='0' x2='0' y2='100%25' stroke='black' stroke-width='2'/%3e %3cline x1='0' y1='100%25' x2='100%25' y2='100%25' stroke='black' stroke-width='2'/%3e %3c/svg%3e\");border-right:0}:host:nth-child(2n) .page-grid-item{margin:0!important;border-left:0!important;border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:-2px 0 5px #0003}:host:nth-child(2n) .page-image{margin-right:auto;background-image:url(\"data:image/svg+xml, %3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e %3cline x1='0' y1='0' x2='0' y2='20' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='26' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='34' x2='0' y2='54' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='60' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='68' x2='0' y2='88' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='94' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='102' x2='0' y2='122' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='128' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='136' x2='0' y2='156' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='162' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='170' x2='0' y2='190' stroke='%234f4f59' stroke-width='1.5'/%3e %3cline x1='0' y1='0' x2='100%25' y2='0' stroke='black' stroke-width='2'/%3e %3cline x1='100%25' y1='0' x2='100%25' y2='100%25' stroke='black' stroke-width='2'/%3e %3cline x1='0' y1='100%25' x2='100%25' y2='100%25' stroke='black' stroke-width='2'/%3e %3c/svg%3e\");border-left:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }] }); }
|
|
112
|
-
}
|
|
113
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridItemComponent, decorators: [{
|
|
114
|
-
type: Component,
|
|
115
|
-
args: [{ selector: 'app-page-grid-item', standalone: true, imports: [CommonModule, TranslateModule], template: `
|
|
116
|
-
<div
|
|
117
|
-
class="page-grid-item"
|
|
118
|
-
[class.current]="isCurrent"
|
|
119
|
-
[class.selected]="isSelected"
|
|
120
|
-
[class.drag-before]="dragOver && dropSide === 'before'"
|
|
121
|
-
[class.drag-after]="dragOver && dropSide === 'after'"
|
|
122
|
-
draggable="true"
|
|
123
|
-
(dragstart)="onDragStart($event)"
|
|
124
|
-
(dragover)="onDragOver($event)"
|
|
125
|
-
(dragleave)="onDragLeave()"
|
|
126
|
-
(drop)="onDrop($event)"
|
|
127
|
-
(dragend)="onDragEnd()"
|
|
128
|
-
(click)="selectPage.emit(index)"
|
|
129
|
-
(contextmenu)="onContextMenu($event)"
|
|
130
|
-
>
|
|
131
|
-
<div
|
|
132
|
-
class="page-select-checkbox-container"
|
|
133
|
-
(click)="$event.stopPropagation()"
|
|
134
|
-
>
|
|
135
|
-
<input
|
|
136
|
-
type="checkbox"
|
|
137
|
-
class="page-select-checkbox"
|
|
138
|
-
[checked]="isSelected"
|
|
139
|
-
(change)="onCheckboxChange($event)"
|
|
140
|
-
(click)="$event.stopPropagation()"
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
<img
|
|
144
|
-
[src]="displayImageUrl"
|
|
145
|
-
class="page-image"
|
|
146
|
-
alt="Page Thumbnail"
|
|
147
|
-
loading="lazy"
|
|
148
|
-
/>
|
|
149
|
-
<span class="page-number">{{ index + 1 }}</span>
|
|
150
|
-
</div>
|
|
151
|
-
`, styles: [":host{display:block}.page-grid-item{background-color:var(--gray-4);border-radius:var(--radius-xs);padding:var(--spacing-xs) 0;display:flex;flex-direction:column;gap:var(--spacing-xs);width:144px;height:220px;border:1px solid var(--gray-3);align-items:center;cursor:move;margin:0;position:relative;transition:transform .2s,background-color .2s;box-sizing:border-box}.page-grid-item:hover{transform:scale(1.05);background-color:var(--gray-3)}.page-grid-item.current{border-color:oklch(var(--p))}.page-grid-item.selected{border-color:var(--active)!important;box-shadow:0 0 0 2px oklch(var(--p))}.page-select-checkbox-container{position:absolute;top:6px;left:6px;z-index:10;display:flex;align-items:center;justify-content:center}.page-select-checkbox{width:18px;height:18px;cursor:pointer;accent-color:oklch(var(--p));margin:0}.page-image{background-color:#fff;border-radius:0;pointer-events:none;height:calc(100% - 2 * var(--spacing-xs) - 15px);width:auto;max-width:100%;object-fit:contain}.page-number{font-size:10px;color:var(--white)}.page-grid-item:before,.page-grid-item:after{content:\"\";position:absolute;top:0;bottom:0;width:4px;background:oklch(var(--p));z-index:100;opacity:0;transition:opacity .2s;border-radius:2px}.page-grid-item.drag-before:before{left:-4px;opacity:1}.page-grid-item.drag-after:after{right:-4px;opacity:1}:host:nth-child(odd) .page-grid-item{margin:0!important;border-right:0!important;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:2px 0 5px #0003}:host:nth-child(odd) .page-image{margin-left:auto;background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e %3cline x1='100%25' y1='0' x2='100%25' y2='20' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='26' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='34' x2='100%25' y2='54' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='60' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='68' x2='100%25' y2='88' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='64' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='102' x2='100%25' y2='122' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='128' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='136' x2='100%25' y2='156' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='100%25' cy='162' r='3' fill='%234f4f59'/%3e %3cline x1='100%25' y1='170' x2='100%25' y2='190' stroke='%234f4f59' stroke-width='1.5'/%3e %3cline x1='0' y1='0' x2='100%25' y2='0' stroke='black' stroke-width='2'/%3e %3cline x1='0' y1='0' x2='0' y2='100%25' stroke='black' stroke-width='2'/%3e %3cline x1='0' y1='100%25' x2='100%25' y2='100%25' stroke='black' stroke-width='2'/%3e %3c/svg%3e\");border-right:0}:host:nth-child(2n) .page-grid-item{margin:0!important;border-left:0!important;border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:-2px 0 5px #0003}:host:nth-child(2n) .page-image{margin-right:auto;background-image:url(\"data:image/svg+xml, %3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e %3cline x1='0' y1='0' x2='0' y2='20' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='26' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='34' x2='0' y2='54' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='60' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='68' x2='0' y2='88' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='94' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='102' x2='0' y2='122' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='128' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='136' x2='0' y2='156' stroke='%234f4f59' stroke-width='1.5'/%3e %3ccircle cx='0' cy='162' r='3' fill='%234f4f59'/%3e %3cline x1='0' y1='170' x2='0' y2='190' stroke='%234f4f59' stroke-width='1.5'/%3e %3cline x1='0' y1='0' x2='100%25' y2='0' stroke='black' stroke-width='2'/%3e %3cline x1='100%25' y1='0' x2='100%25' y2='100%25' stroke='black' stroke-width='2'/%3e %3cline x1='0' y1='100%25' x2='100%25' y2='100%25' stroke='black' stroke-width='2'/%3e %3c/svg%3e\");border-left:0}\n"] }]
|
|
152
|
-
}], ctorParameters: () => [], propDecorators: { index: [{
|
|
153
|
-
type: Input,
|
|
154
|
-
args: [{ required: true }]
|
|
155
|
-
}], imageUrl: [{
|
|
156
|
-
type: Input,
|
|
157
|
-
args: [{ required: true }]
|
|
158
|
-
}], isCurrent: [{
|
|
159
|
-
type: Input
|
|
160
|
-
}], isSelected: [{
|
|
161
|
-
type: Input
|
|
162
|
-
}], selectPage: [{
|
|
163
|
-
type: Output
|
|
164
|
-
}], toggleSelect: [{
|
|
165
|
-
type: Output
|
|
166
|
-
}], dragStarted: [{
|
|
167
|
-
type: Output
|
|
168
|
-
}], dropped: [{
|
|
169
|
-
type: Output
|
|
170
|
-
}], contextMenuEvent: [{
|
|
171
|
-
type: Output
|
|
172
|
-
}] } });
|
|
173
|
-
|
|
174
|
-
class PageGridModalComponent {
|
|
175
|
-
constructor() {
|
|
176
|
-
this.appParams = inject(AppParamsService);
|
|
177
|
-
this.assetsService = inject(AssetsService);
|
|
178
|
-
this.modalService = inject(ModalService);
|
|
179
|
-
this.saveService = inject(SaveService);
|
|
180
|
-
this.translate = inject(TranslateService);
|
|
181
|
-
this.isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
182
|
-
this.pages = signal([], ...(ngDevMode ? [{ debugName: "pages" }] : []));
|
|
183
|
-
this.currentPageIndex = computed(() => {
|
|
184
|
-
const guid = this.appParams.pageGuid();
|
|
185
|
-
const pages = this.pages();
|
|
186
|
-
return pages.findIndex((p) => p.documentPageGuid === guid);
|
|
187
|
-
}, ...(ngDevMode ? [{ debugName: "currentPageIndex" }] : []));
|
|
188
|
-
this.selectedPageIndices = signal(new Set(), ...(ngDevMode ? [{ debugName: "selectedPageIndices" }] : []));
|
|
189
|
-
this.selectedCount = computed(() => this.selectedPageIndices().size, ...(ngDevMode ? [{ debugName: "selectedCount" }] : []));
|
|
190
|
-
this.canDeleteSelected = computed(() => {
|
|
191
|
-
const count = this.selectedCount();
|
|
192
|
-
return count > 0 && count < this.pages().length;
|
|
193
|
-
}, ...(ngDevMode ? [{ debugName: "canDeleteSelected" }] : []));
|
|
194
|
-
this.pageSpreads = computed(() => {
|
|
195
|
-
const pagesList = this.pages();
|
|
196
|
-
const items = [{ isFake: true }];
|
|
197
|
-
pagesList.forEach((p, i) => {
|
|
198
|
-
items.push({ ...p, index: i });
|
|
199
|
-
});
|
|
200
|
-
const chunks = [];
|
|
201
|
-
for (let i = 0; i < items.length; i += 2) {
|
|
202
|
-
chunks.push(items.slice(i, i + 2));
|
|
203
|
-
}
|
|
204
|
-
return chunks;
|
|
205
|
-
}, ...(ngDevMode ? [{ debugName: "pageSpreads" }] : []));
|
|
206
|
-
this.pageCacheBusters = signal({}, ...(ngDevMode ? [{ debugName: "pageCacheBusters" }] : []));
|
|
207
|
-
this.sessionBuster = `s=${Date.now()}`;
|
|
208
|
-
this.pageImageUrls = computed(() => {
|
|
209
|
-
const busters = this.pageCacheBusters();
|
|
210
|
-
return this.pages().map((p) => {
|
|
211
|
-
const baseUrl = p.publicationTemplateThumbnail || p.publicationTemplateUrl;
|
|
212
|
-
if (!baseUrl)
|
|
213
|
-
return '';
|
|
214
|
-
const guid = p.documentPageGuid;
|
|
215
|
-
const buster = busters[guid] || this.sessionBuster;
|
|
216
|
-
const separator = baseUrl.includes('?') ? '&' : '?';
|
|
217
|
-
return `${baseUrl}${separator}${buster}`;
|
|
218
|
-
});
|
|
219
|
-
}, ...(ngDevMode ? [{ debugName: "pageImageUrls" }] : []));
|
|
220
|
-
this.dragSourceIndex = null;
|
|
221
|
-
this.contextMenuVisible = false;
|
|
222
|
-
this.contextMenuPosition = { x: 0, y: 0 };
|
|
223
|
-
this.contextMenuPageIndex = null;
|
|
224
|
-
// Delete confirmation state
|
|
225
|
-
this.showDeleteConfirm = signal(false, ...(ngDevMode ? [{ debugName: "showDeleteConfirm" }] : []));
|
|
226
|
-
this.isBatchDelete = signal(false, ...(ngDevMode ? [{ debugName: "isBatchDelete" }] : []));
|
|
227
|
-
this.deleteIndex = null;
|
|
228
|
-
this.deleteModalTitle = computed(() => {
|
|
229
|
-
return this.isBatchDelete()
|
|
230
|
-
? this.translate.instant('GLOBAL.PAGES.DELETE_MULTIPLE_CONFIRM_TITLE')
|
|
231
|
-
: this.translate.instant('GLOBAL.PAGES.DELETE_CONFIRM_TITLE');
|
|
232
|
-
}, ...(ngDevMode ? [{ debugName: "deleteModalTitle" }] : []));
|
|
233
|
-
this.deleteModalMessage = computed(() => {
|
|
234
|
-
return this.isBatchDelete()
|
|
235
|
-
? this.translate.instant('GLOBAL.PAGES.DELETE_MULTIPLE_CONFIRM_MSG', {
|
|
236
|
-
count: this.selectedCount(),
|
|
237
|
-
})
|
|
238
|
-
: this.translate.instant('GLOBAL.PAGES.DELETE_CONFIRM_MSG');
|
|
239
|
-
}, ...(ngDevMode ? [{ debugName: "deleteModalMessage" }] : []));
|
|
240
|
-
effect(() => {
|
|
241
|
-
const params = this.appParams.params();
|
|
242
|
-
const docData = params.documentData;
|
|
243
|
-
if (docData && Array.isArray(docData)) {
|
|
244
|
-
this.pages.set([...docData]);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
effect(() => {
|
|
248
|
-
const pulse = this.saveService.saveSuccessPulse();
|
|
249
|
-
const pulseCount = typeof pulse === 'object' ? pulse.count : pulse;
|
|
250
|
-
const currentPage = this.pages()[this.currentPageIndex()];
|
|
251
|
-
if (currentPage && pulseCount > 0) {
|
|
252
|
-
const activeGuid = currentPage.documentPageGuid;
|
|
253
|
-
this.pageCacheBusters.update((map) => ({
|
|
254
|
-
...map,
|
|
255
|
-
[activeGuid]: `t=${pulseCount}`,
|
|
256
|
-
}));
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
ngOnInit() { }
|
|
261
|
-
togglePageSelection(index) {
|
|
262
|
-
this.selectedPageIndices.update((set) => {
|
|
263
|
-
const next = new Set(set);
|
|
264
|
-
if (next.has(index)) {
|
|
265
|
-
next.delete(index);
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
next.add(index);
|
|
269
|
-
}
|
|
270
|
-
return next;
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
deselectAll() {
|
|
274
|
-
this.selectedPageIndices.set(new Set());
|
|
275
|
-
}
|
|
276
|
-
deleteSelectedPages() {
|
|
277
|
-
if (!this.canDeleteSelected())
|
|
278
|
-
return;
|
|
279
|
-
this.isBatchDelete.set(true);
|
|
280
|
-
this.showDeleteConfirm.set(true);
|
|
281
|
-
}
|
|
282
|
-
addPage() {
|
|
283
|
-
const guid = this.appParams.guid;
|
|
284
|
-
if (!guid)
|
|
285
|
-
return;
|
|
286
|
-
this.isLoading.set(true);
|
|
287
|
-
this.assetsService.addDocumentPage(guid).subscribe((newPage) => {
|
|
288
|
-
if (newPage) {
|
|
289
|
-
this.refreshPages();
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
this.isLoading.set(false);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
addPageBefore(index) {
|
|
297
|
-
const guid = this.appParams.guid;
|
|
298
|
-
if (!guid)
|
|
299
|
-
return;
|
|
300
|
-
this.isLoading.set(true);
|
|
301
|
-
this.assetsService
|
|
302
|
-
.addDocumentPage(guid, index + 1)
|
|
303
|
-
.subscribe((newPage) => {
|
|
304
|
-
if (newPage) {
|
|
305
|
-
this.refreshPages();
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
this.isLoading.set(false);
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
addPageAfter(index) {
|
|
313
|
-
const guid = this.appParams.guid;
|
|
314
|
-
if (!guid)
|
|
315
|
-
return;
|
|
316
|
-
this.isLoading.set(true);
|
|
317
|
-
this.assetsService
|
|
318
|
-
.addDocumentPage(guid, index + 2)
|
|
319
|
-
.subscribe((newPage) => {
|
|
320
|
-
if (newPage) {
|
|
321
|
-
this.refreshPages();
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
this.isLoading.set(false);
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
duplicatePage(index) {
|
|
329
|
-
const guid = this.appParams.guid;
|
|
330
|
-
const page = this.pages()[index];
|
|
331
|
-
if (!guid || !page)
|
|
332
|
-
return;
|
|
333
|
-
this.isLoading.set(true);
|
|
334
|
-
this.assetsService
|
|
335
|
-
.duplicateDocumentPage(guid, page.documentPageGuid)
|
|
336
|
-
.subscribe((newPage) => {
|
|
337
|
-
if (newPage) {
|
|
338
|
-
this.refreshPages();
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
this.isLoading.set(false);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
deletePage(index) {
|
|
346
|
-
this.isBatchDelete.set(false);
|
|
347
|
-
this.deleteIndex = index;
|
|
348
|
-
this.showDeleteConfirm.set(true);
|
|
349
|
-
}
|
|
350
|
-
confirmDelete() {
|
|
351
|
-
const guid = this.appParams.guid;
|
|
352
|
-
if (!guid) {
|
|
353
|
-
this.cancelDelete();
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
if (this.isBatchDelete()) {
|
|
357
|
-
if (!this.canDeleteSelected()) {
|
|
358
|
-
this.cancelDelete();
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
const pagesList = this.pages();
|
|
362
|
-
const guidsToDelete = Array.from(this.selectedPageIndices())
|
|
363
|
-
.map((i) => pagesList[i]?.documentPageGuid)
|
|
364
|
-
.filter((g) => !!g);
|
|
365
|
-
if (guidsToDelete.length === 0) {
|
|
366
|
-
this.cancelDelete();
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
this.isLoading.set(true);
|
|
370
|
-
from(guidsToDelete)
|
|
371
|
-
.pipe(concatMap((pageGuid) => this.assetsService.deleteDocumentPage(guid, pageGuid)), toArray())
|
|
372
|
-
.subscribe({
|
|
373
|
-
next: () => {
|
|
374
|
-
this.selectedPageIndices.set(new Set());
|
|
375
|
-
this.refreshPages();
|
|
376
|
-
},
|
|
377
|
-
error: () => {
|
|
378
|
-
this.isLoading.set(false);
|
|
379
|
-
},
|
|
380
|
-
});
|
|
381
|
-
this.cancelDelete();
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
if (this.deleteIndex === null)
|
|
385
|
-
return;
|
|
386
|
-
const index = this.deleteIndex;
|
|
387
|
-
const page = this.pages()[index];
|
|
388
|
-
if (!page) {
|
|
389
|
-
this.cancelDelete();
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
this.isLoading.set(true);
|
|
393
|
-
this.assetsService
|
|
394
|
-
.deleteDocumentPage(guid, page.documentPageGuid)
|
|
395
|
-
.subscribe((result) => {
|
|
396
|
-
if (result) {
|
|
397
|
-
this.selectedPageIndices.update((set) => {
|
|
398
|
-
const next = new Set(set);
|
|
399
|
-
next.delete(index);
|
|
400
|
-
return next;
|
|
401
|
-
});
|
|
402
|
-
this.refreshPages();
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
this.isLoading.set(false);
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
this.cancelDelete();
|
|
409
|
-
}
|
|
410
|
-
cancelDelete() {
|
|
411
|
-
this.showDeleteConfirm.set(false);
|
|
412
|
-
this.deleteIndex = null;
|
|
413
|
-
this.isBatchDelete.set(false);
|
|
414
|
-
}
|
|
415
|
-
refreshPages() {
|
|
416
|
-
const guid = this.appParams.guid;
|
|
417
|
-
if (!guid)
|
|
418
|
-
return;
|
|
419
|
-
this.assetsService.getSVGDocumentPages(guid).subscribe((response) => {
|
|
420
|
-
if (response && response.template) {
|
|
421
|
-
this.appParams.setParams({ documentData: [...response.template] });
|
|
422
|
-
}
|
|
423
|
-
this.selectedPageIndices.set(new Set());
|
|
424
|
-
this.isLoading.set(false);
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
close() {
|
|
428
|
-
this.modalService.close();
|
|
429
|
-
}
|
|
430
|
-
goToPage(index) {
|
|
431
|
-
if (this.onPageSelect) {
|
|
432
|
-
this.onPageSelect(index);
|
|
433
|
-
}
|
|
434
|
-
this.close();
|
|
435
|
-
}
|
|
436
|
-
onDragStart(index) {
|
|
437
|
-
this.dragSourceIndex = index;
|
|
438
|
-
}
|
|
439
|
-
onDrop(data) {
|
|
440
|
-
if (this.dragSourceIndex === null)
|
|
441
|
-
return;
|
|
442
|
-
const source = this.dragSourceIndex;
|
|
443
|
-
let actualTargetIndex = data.targetIndex;
|
|
444
|
-
if (data.side === 'after') {
|
|
445
|
-
actualTargetIndex++;
|
|
446
|
-
}
|
|
447
|
-
if (actualTargetIndex === source || actualTargetIndex === source + 1) {
|
|
448
|
-
this.dragSourceIndex = null;
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
const guid = this.appParams.guid;
|
|
452
|
-
if (!guid)
|
|
453
|
-
return;
|
|
454
|
-
const previousPages = this.pages();
|
|
455
|
-
const draggedPage = previousPages[source];
|
|
456
|
-
if (!draggedPage)
|
|
457
|
-
return;
|
|
458
|
-
const draggedPageGuid = draggedPage.documentPageGuid;
|
|
459
|
-
let insertionIndex = actualTargetIndex;
|
|
460
|
-
if (source < actualTargetIndex) {
|
|
461
|
-
insertionIndex--;
|
|
462
|
-
}
|
|
463
|
-
const newPageIdForApi = insertionIndex + 1;
|
|
464
|
-
// Optimistic reorder
|
|
465
|
-
this.pages.update((p) => {
|
|
466
|
-
const copy = [...p];
|
|
467
|
-
const [moved] = copy.splice(source, 1);
|
|
468
|
-
copy.splice(insertionIndex, 0, moved);
|
|
469
|
-
return copy;
|
|
470
|
-
});
|
|
471
|
-
this.isLoading.set(true);
|
|
472
|
-
this.assetsService
|
|
473
|
-
.moveDocumentPage(guid, draggedPageGuid, newPageIdForApi)
|
|
474
|
-
.subscribe({
|
|
475
|
-
next: (result) => {
|
|
476
|
-
if (result) {
|
|
477
|
-
this.refreshPages();
|
|
478
|
-
}
|
|
479
|
-
else {
|
|
480
|
-
this.pages.set(previousPages);
|
|
481
|
-
this.isLoading.set(false);
|
|
482
|
-
}
|
|
483
|
-
},
|
|
484
|
-
error: () => {
|
|
485
|
-
this.pages.set(previousPages);
|
|
486
|
-
this.isLoading.set(false);
|
|
487
|
-
},
|
|
488
|
-
});
|
|
489
|
-
this.dragSourceIndex = null;
|
|
490
|
-
}
|
|
491
|
-
onPageContextMenu(data) {
|
|
492
|
-
this.contextMenuPosition = { x: data.event.clientX, y: data.event.clientY };
|
|
493
|
-
this.contextMenuPageIndex = data.index;
|
|
494
|
-
this.contextMenuVisible = true;
|
|
495
|
-
}
|
|
496
|
-
onContextMenuAction(event) {
|
|
497
|
-
switch (event.action) {
|
|
498
|
-
case 'open':
|
|
499
|
-
this.goToPage(event.index);
|
|
500
|
-
break;
|
|
501
|
-
case 'insert-before':
|
|
502
|
-
this.addPageBefore(event.index);
|
|
503
|
-
break;
|
|
504
|
-
case 'insert-after':
|
|
505
|
-
this.addPageAfter(event.index);
|
|
506
|
-
break;
|
|
507
|
-
case 'duplicate':
|
|
508
|
-
this.duplicatePage(event.index);
|
|
509
|
-
break;
|
|
510
|
-
case 'delete':
|
|
511
|
-
this.deletePage(event.index);
|
|
512
|
-
break;
|
|
513
|
-
}
|
|
514
|
-
this.contextMenuVisible = false;
|
|
515
|
-
}
|
|
516
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
517
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: PageGridModalComponent, isStandalone: true, selector: "app-page-grid-modal", inputs: { onPageSelect: "onPageSelect" }, ngImport: i0, template: `
|
|
518
|
-
<div id="page-grid-backdrop" (click)="close()">
|
|
519
|
-
<div id="page-grid" (click)="$event.stopPropagation()">
|
|
520
|
-
<div id="page-grid-title">
|
|
521
|
-
<span id="icon-page-grid" class="icon">
|
|
522
|
-
<svg
|
|
523
|
-
width="24"
|
|
524
|
-
height="24"
|
|
525
|
-
viewBox="0 0 24 24"
|
|
526
|
-
fill="none"
|
|
527
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
528
|
-
>
|
|
529
|
-
<rect x="3" y="3" width="5" height="5" fill="var(--white)" />
|
|
530
|
-
<rect x="9.5" y="3" width="5" height="5" fill="var(--white)" />
|
|
531
|
-
<rect x="16" y="3" width="5" height="5" fill="var(--white)" />
|
|
532
|
-
<rect x="3" y="9.5" width="5" height="5" fill="var(--white)" />
|
|
533
|
-
<rect x="9.5" y="9.5" width="5" height="5" fill="var(--white)" />
|
|
534
|
-
<rect x="16" y="9.5" width="5" height="5" fill="var(--white)" />
|
|
535
|
-
<rect x="3" y="16" width="5" height="5" fill="var(--white)" />
|
|
536
|
-
<rect x="9.5" y="16" width="5" height="5" fill="var(--white)" />
|
|
537
|
-
<rect x="16" y="16" width="5" height="5" fill="var(--white)" />
|
|
538
|
-
</svg>
|
|
539
|
-
</span>
|
|
540
|
-
<span id="title-page-grid">{{
|
|
541
|
-
'GLOBAL.PAGES.GRID_VIEW' | translate
|
|
542
|
-
}}</span>
|
|
543
|
-
|
|
544
|
-
@if (selectedCount() > 0) {
|
|
545
|
-
<div class="page-grid-selection-toolbar">
|
|
546
|
-
<span class="selection-count-badge">
|
|
547
|
-
{{ 'GLOBAL.PAGES.SELECTED_COUNT' | translate: { count: selectedCount() } }}
|
|
548
|
-
</span>
|
|
549
|
-
<button
|
|
550
|
-
type="button"
|
|
551
|
-
class="selection-action-btn deselect-btn"
|
|
552
|
-
[title]="'GLOBAL.PAGES.DESELECT_ALL' | translate"
|
|
553
|
-
(click)="deselectAll()"
|
|
554
|
-
>
|
|
555
|
-
{{ 'GLOBAL.PAGES.DESELECT_ALL' | translate }}
|
|
556
|
-
</button>
|
|
557
|
-
@if (canDeleteSelected()) {
|
|
558
|
-
<button
|
|
559
|
-
type="button"
|
|
560
|
-
class="selection-action-btn delete-btn"
|
|
561
|
-
[title]="'GLOBAL.PAGES.DELETE_SELECTED' | translate"
|
|
562
|
-
(click)="deleteSelectedPages()"
|
|
563
|
-
>
|
|
564
|
-
<svg
|
|
565
|
-
width="14"
|
|
566
|
-
height="14"
|
|
567
|
-
viewBox="0 0 24 24"
|
|
568
|
-
fill="none"
|
|
569
|
-
stroke="currentColor"
|
|
570
|
-
stroke-width="2"
|
|
571
|
-
stroke-linecap="round"
|
|
572
|
-
stroke-linejoin="round"
|
|
573
|
-
>
|
|
574
|
-
<polyline points="3 6 5 6 21 6"></polyline>
|
|
575
|
-
<path
|
|
576
|
-
d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
|
|
577
|
-
></path>
|
|
578
|
-
</svg>
|
|
579
|
-
{{ 'GLOBAL.PAGES.DELETE_SELECTED' | translate }}
|
|
580
|
-
</button>
|
|
581
|
-
}
|
|
582
|
-
</div>
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
<button id="close-page-grid" class="close-btn" (click)="close()">
|
|
586
|
-
×
|
|
587
|
-
</button>
|
|
588
|
-
</div>
|
|
589
|
-
|
|
590
|
-
<div class="page-grid-content">
|
|
591
|
-
@for (spread of pageSpreads(); track spread; let sIndex = $index) {
|
|
592
|
-
<div class="page-spread">
|
|
593
|
-
@for (item of spread; track item) {
|
|
594
|
-
@if (item.isFake) {
|
|
595
|
-
<div class="page-grid-fake-item"></div>
|
|
596
|
-
} @else {
|
|
597
|
-
<app-page-grid-item
|
|
598
|
-
[index]="item.index"
|
|
599
|
-
[imageUrl]="pageImageUrls()[item.index]"
|
|
600
|
-
[isCurrent]="item.index === currentPageIndex()"
|
|
601
|
-
[isSelected]="selectedPageIndices().has(item.index)"
|
|
602
|
-
(toggleSelect)="togglePageSelection($event)"
|
|
603
|
-
(selectPage)="goToPage($event)"
|
|
604
|
-
(dragStarted)="onDragStart($event)"
|
|
605
|
-
(dropped)="onDrop($event)"
|
|
606
|
-
(contextMenuEvent)="onPageContextMenu($event)"
|
|
607
|
-
></app-page-grid-item>
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
</div>
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
<!-- Add page card -->
|
|
614
|
-
<div class="page-grid-item-add" (click)="addPage()">
|
|
615
|
-
<div class="page-grid-item-add-page">
|
|
616
|
-
<svg
|
|
617
|
-
width="48"
|
|
618
|
-
height="48"
|
|
619
|
-
viewBox="0 0 24 24"
|
|
620
|
-
fill="none"
|
|
621
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
622
|
-
>
|
|
623
|
-
<line
|
|
624
|
-
x1="12"
|
|
625
|
-
y1="5"
|
|
626
|
-
x2="12"
|
|
627
|
-
y2="19"
|
|
628
|
-
stroke="var(--gray-1)"
|
|
629
|
-
stroke-width="2"
|
|
630
|
-
stroke-linecap="round"
|
|
631
|
-
/>
|
|
632
|
-
<line
|
|
633
|
-
x1="5"
|
|
634
|
-
y1="12"
|
|
635
|
-
x2="19"
|
|
636
|
-
y2="12"
|
|
637
|
-
stroke="var(--gray-1)"
|
|
638
|
-
stroke-width="2"
|
|
639
|
-
stroke-linecap="round"
|
|
640
|
-
/>
|
|
641
|
-
</svg>
|
|
642
|
-
</div>
|
|
643
|
-
<span class="page-number">{{
|
|
644
|
-
'GLOBAL.PAGES.ADD_PAGE' | translate
|
|
645
|
-
}}</span>
|
|
646
|
-
</div>
|
|
647
|
-
</div>
|
|
648
|
-
</div>
|
|
649
|
-
|
|
650
|
-
<!-- Full screen loader -->
|
|
651
|
-
@if (isLoading()) {
|
|
652
|
-
<div class="page-grid-loader">
|
|
653
|
-
<div class="spinner"></div>
|
|
654
|
-
</div>
|
|
655
|
-
}
|
|
656
|
-
</div>
|
|
657
|
-
|
|
658
|
-
<app-page-context-menu
|
|
659
|
-
[visible]="contextMenuVisible"
|
|
660
|
-
[position]="contextMenuPosition"
|
|
661
|
-
[pageIndex]="contextMenuPageIndex"
|
|
662
|
-
[isCurrentPage]="contextMenuPageIndex === currentPageIndex()"
|
|
663
|
-
(action)="onContextMenuAction($event)"
|
|
664
|
-
(closeMenu)="contextMenuVisible = false"
|
|
665
|
-
></app-page-context-menu>
|
|
666
|
-
|
|
667
|
-
<!-- Delete Confirmation Modal -->
|
|
668
|
-
@if (showDeleteConfirm()) {
|
|
669
|
-
<app-confirm-delete-modal
|
|
670
|
-
[title]="deleteModalTitle()"
|
|
671
|
-
[message]="deleteModalMessage()"
|
|
672
|
-
(confirm)="confirmDelete()"
|
|
673
|
-
(cancel)="cancelDelete()"
|
|
674
|
-
></app-confirm-delete-modal>
|
|
675
|
-
}
|
|
676
|
-
`, isInline: true, styles: ["#page-grid-backdrop{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#000000b3;z-index:2000;display:flex;justify-content:center;align-items:center}#page-grid{position:absolute;top:var(--spacing-s);left:var(--spacing-s);right:var(--spacing-s);bottom:var(--spacing-s);width:calc(100vw - 2 * var(--spacing-s));height:calc(100vh - 2 * var(--spacing-s));background-color:var(--gray-5);border-radius:var(--radius-s);padding:0 20px;display:flex;flex-direction:column;opacity:1;transition:opacity .5s ease;pointer-events:auto;overflow-y:auto;box-sizing:border-box}#page-grid-title{display:flex;align-items:center;width:100%;padding-top:var(--spacing-s);flex-shrink:0}#page-grid-title #icon-page-grid{background:var(--gray-3);border-radius:50%;width:32px;height:32px;display:flex;align-items:center;justify-content:center}#page-grid-title #title-page-grid{font-size:var(--font-size-medium);font-weight:var(--font-weight-bold);color:var(--white);margin-top:var(--spacing-s);margin-bottom:var(--spacing-xs);margin-left:var(--spacing-xs)!important}.page-grid-selection-toolbar{display:flex;align-items:center;gap:var(--spacing-s);margin-left:var(--spacing-m);background:var(--gray-4);padding:4px 12px;border-radius:var(--radius-s);border:1px solid var(--gray-3)}.selection-count-badge{font-size:13px;font-weight:var(--font-weight-medium);color:var(--white);white-space:nowrap}.selection-action-btn{background:transparent;border:1px solid var(--gray-2);color:var(--white);padding:4px 10px;border-radius:var(--radius-xs);font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:background-color .2s,border-color .2s;white-space:nowrap}.selection-action-btn:hover{background-color:var(--gray-3)}.selection-action-btn.delete-btn{background-color:var(--error);border-color:var(--error);color:#fff}.selection-action-btn.delete-btn:hover{opacity:.9}#close-page-grid{margin-left:auto;background:none;border:none;font-size:32px;cursor:pointer;color:var(--white)}.page-grid-content{display:flex;flex-wrap:wrap;justify-content:center;padding-bottom:40px;gap:var(--spacing-m)}.page-spread{display:flex;flex-direction:row;align-items:flex-end}.page-grid-content>*{margin-bottom:var(--spacing-s)}.page-grid-fake-item{background-color:var(--gray-4);border-radius:var(--radius-xs);border-top-right-radius:0;border-bottom-right-radius:0;padding:var(--spacing-xs);display:flex;flex-direction:column;gap:var(--spacing-xs);width:144px;height:220px;border:1px solid var(--gray-3);border-right:0;align-items:center;margin:0;box-sizing:border-box;box-shadow:2px 0 5px #0003}.page-grid-item-add{background-color:var(--gray-3);border-radius:var(--radius-xs);padding:var(--spacing-xs);display:flex;flex-direction:column;gap:var(--spacing-xs);width:144px;height:220px;border:none;align-items:center;cursor:pointer;margin:var(--spacing-s) 0;box-sizing:border-box;transition:transform .2s,background-color .2s}.page-grid-item-add:hover{transform:scale(1.05);background-color:var(--gray-2)}.page-grid-item-add-page{display:flex;align-content:center;flex-direction:column;justify-content:center;align-items:center;width:120px;height:180px;background:#fff;border:2px solid black;box-sizing:border-box;min-width:130px;min-height:186px}.page-number{font-size:10px;color:var(--white);text-align:center}.page-grid-loader{position:absolute;inset:0;background:#0006;display:flex;justify-content:center;align-items:center;z-index:3000;border-radius:var(--radius-s)}.spinner{width:40px;height:40px;border:4px solid rgba(255,255,255,.3);border-top:4px solid var(--white);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: PageGridItemComponent, selector: "app-page-grid-item", inputs: ["index", "imageUrl", "isCurrent", "isSelected"], outputs: ["selectPage", "toggleSelect", "dragStarted", "dropped", "contextMenuEvent"] }, { kind: "component", type: PageContextMenuComponent, selector: "app-page-context-menu", inputs: ["visible", "position", "pageIndex", "isCurrentPage"], outputs: ["action", "closeMenu"] }, { kind: "component", type: ConfirmDeleteModalComponent, selector: "app-confirm-delete-modal", inputs: ["title", "message"], outputs: ["confirm", "cancel"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
677
|
-
}
|
|
678
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridModalComponent, decorators: [{
|
|
679
|
-
type: Component,
|
|
680
|
-
args: [{ selector: 'app-page-grid-modal', standalone: true, imports: [
|
|
681
|
-
CommonModule,
|
|
682
|
-
TranslateModule,
|
|
683
|
-
PageGridItemComponent,
|
|
684
|
-
PageContextMenuComponent,
|
|
685
|
-
ConfirmDeleteModalComponent,
|
|
686
|
-
], template: `
|
|
687
|
-
<div id="page-grid-backdrop" (click)="close()">
|
|
688
|
-
<div id="page-grid" (click)="$event.stopPropagation()">
|
|
689
|
-
<div id="page-grid-title">
|
|
690
|
-
<span id="icon-page-grid" class="icon">
|
|
691
|
-
<svg
|
|
692
|
-
width="24"
|
|
693
|
-
height="24"
|
|
694
|
-
viewBox="0 0 24 24"
|
|
695
|
-
fill="none"
|
|
696
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
697
|
-
>
|
|
698
|
-
<rect x="3" y="3" width="5" height="5" fill="var(--white)" />
|
|
699
|
-
<rect x="9.5" y="3" width="5" height="5" fill="var(--white)" />
|
|
700
|
-
<rect x="16" y="3" width="5" height="5" fill="var(--white)" />
|
|
701
|
-
<rect x="3" y="9.5" width="5" height="5" fill="var(--white)" />
|
|
702
|
-
<rect x="9.5" y="9.5" width="5" height="5" fill="var(--white)" />
|
|
703
|
-
<rect x="16" y="9.5" width="5" height="5" fill="var(--white)" />
|
|
704
|
-
<rect x="3" y="16" width="5" height="5" fill="var(--white)" />
|
|
705
|
-
<rect x="9.5" y="16" width="5" height="5" fill="var(--white)" />
|
|
706
|
-
<rect x="16" y="16" width="5" height="5" fill="var(--white)" />
|
|
707
|
-
</svg>
|
|
708
|
-
</span>
|
|
709
|
-
<span id="title-page-grid">{{
|
|
710
|
-
'GLOBAL.PAGES.GRID_VIEW' | translate
|
|
711
|
-
}}</span>
|
|
712
|
-
|
|
713
|
-
@if (selectedCount() > 0) {
|
|
714
|
-
<div class="page-grid-selection-toolbar">
|
|
715
|
-
<span class="selection-count-badge">
|
|
716
|
-
{{ 'GLOBAL.PAGES.SELECTED_COUNT' | translate: { count: selectedCount() } }}
|
|
717
|
-
</span>
|
|
718
|
-
<button
|
|
719
|
-
type="button"
|
|
720
|
-
class="selection-action-btn deselect-btn"
|
|
721
|
-
[title]="'GLOBAL.PAGES.DESELECT_ALL' | translate"
|
|
722
|
-
(click)="deselectAll()"
|
|
723
|
-
>
|
|
724
|
-
{{ 'GLOBAL.PAGES.DESELECT_ALL' | translate }}
|
|
725
|
-
</button>
|
|
726
|
-
@if (canDeleteSelected()) {
|
|
727
|
-
<button
|
|
728
|
-
type="button"
|
|
729
|
-
class="selection-action-btn delete-btn"
|
|
730
|
-
[title]="'GLOBAL.PAGES.DELETE_SELECTED' | translate"
|
|
731
|
-
(click)="deleteSelectedPages()"
|
|
732
|
-
>
|
|
733
|
-
<svg
|
|
734
|
-
width="14"
|
|
735
|
-
height="14"
|
|
736
|
-
viewBox="0 0 24 24"
|
|
737
|
-
fill="none"
|
|
738
|
-
stroke="currentColor"
|
|
739
|
-
stroke-width="2"
|
|
740
|
-
stroke-linecap="round"
|
|
741
|
-
stroke-linejoin="round"
|
|
742
|
-
>
|
|
743
|
-
<polyline points="3 6 5 6 21 6"></polyline>
|
|
744
|
-
<path
|
|
745
|
-
d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
|
|
746
|
-
></path>
|
|
747
|
-
</svg>
|
|
748
|
-
{{ 'GLOBAL.PAGES.DELETE_SELECTED' | translate }}
|
|
749
|
-
</button>
|
|
750
|
-
}
|
|
751
|
-
</div>
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
<button id="close-page-grid" class="close-btn" (click)="close()">
|
|
755
|
-
×
|
|
756
|
-
</button>
|
|
757
|
-
</div>
|
|
758
|
-
|
|
759
|
-
<div class="page-grid-content">
|
|
760
|
-
@for (spread of pageSpreads(); track spread; let sIndex = $index) {
|
|
761
|
-
<div class="page-spread">
|
|
762
|
-
@for (item of spread; track item) {
|
|
763
|
-
@if (item.isFake) {
|
|
764
|
-
<div class="page-grid-fake-item"></div>
|
|
765
|
-
} @else {
|
|
766
|
-
<app-page-grid-item
|
|
767
|
-
[index]="item.index"
|
|
768
|
-
[imageUrl]="pageImageUrls()[item.index]"
|
|
769
|
-
[isCurrent]="item.index === currentPageIndex()"
|
|
770
|
-
[isSelected]="selectedPageIndices().has(item.index)"
|
|
771
|
-
(toggleSelect)="togglePageSelection($event)"
|
|
772
|
-
(selectPage)="goToPage($event)"
|
|
773
|
-
(dragStarted)="onDragStart($event)"
|
|
774
|
-
(dropped)="onDrop($event)"
|
|
775
|
-
(contextMenuEvent)="onPageContextMenu($event)"
|
|
776
|
-
></app-page-grid-item>
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
</div>
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
<!-- Add page card -->
|
|
783
|
-
<div class="page-grid-item-add" (click)="addPage()">
|
|
784
|
-
<div class="page-grid-item-add-page">
|
|
785
|
-
<svg
|
|
786
|
-
width="48"
|
|
787
|
-
height="48"
|
|
788
|
-
viewBox="0 0 24 24"
|
|
789
|
-
fill="none"
|
|
790
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
791
|
-
>
|
|
792
|
-
<line
|
|
793
|
-
x1="12"
|
|
794
|
-
y1="5"
|
|
795
|
-
x2="12"
|
|
796
|
-
y2="19"
|
|
797
|
-
stroke="var(--gray-1)"
|
|
798
|
-
stroke-width="2"
|
|
799
|
-
stroke-linecap="round"
|
|
800
|
-
/>
|
|
801
|
-
<line
|
|
802
|
-
x1="5"
|
|
803
|
-
y1="12"
|
|
804
|
-
x2="19"
|
|
805
|
-
y2="12"
|
|
806
|
-
stroke="var(--gray-1)"
|
|
807
|
-
stroke-width="2"
|
|
808
|
-
stroke-linecap="round"
|
|
809
|
-
/>
|
|
810
|
-
</svg>
|
|
811
|
-
</div>
|
|
812
|
-
<span class="page-number">{{
|
|
813
|
-
'GLOBAL.PAGES.ADD_PAGE' | translate
|
|
814
|
-
}}</span>
|
|
815
|
-
</div>
|
|
816
|
-
</div>
|
|
817
|
-
</div>
|
|
818
|
-
|
|
819
|
-
<!-- Full screen loader -->
|
|
820
|
-
@if (isLoading()) {
|
|
821
|
-
<div class="page-grid-loader">
|
|
822
|
-
<div class="spinner"></div>
|
|
823
|
-
</div>
|
|
824
|
-
}
|
|
825
|
-
</div>
|
|
826
|
-
|
|
827
|
-
<app-page-context-menu
|
|
828
|
-
[visible]="contextMenuVisible"
|
|
829
|
-
[position]="contextMenuPosition"
|
|
830
|
-
[pageIndex]="contextMenuPageIndex"
|
|
831
|
-
[isCurrentPage]="contextMenuPageIndex === currentPageIndex()"
|
|
832
|
-
(action)="onContextMenuAction($event)"
|
|
833
|
-
(closeMenu)="contextMenuVisible = false"
|
|
834
|
-
></app-page-context-menu>
|
|
835
|
-
|
|
836
|
-
<!-- Delete Confirmation Modal -->
|
|
837
|
-
@if (showDeleteConfirm()) {
|
|
838
|
-
<app-confirm-delete-modal
|
|
839
|
-
[title]="deleteModalTitle()"
|
|
840
|
-
[message]="deleteModalMessage()"
|
|
841
|
-
(confirm)="confirmDelete()"
|
|
842
|
-
(cancel)="cancelDelete()"
|
|
843
|
-
></app-confirm-delete-modal>
|
|
844
|
-
}
|
|
845
|
-
`, styles: ["#page-grid-backdrop{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#000000b3;z-index:2000;display:flex;justify-content:center;align-items:center}#page-grid{position:absolute;top:var(--spacing-s);left:var(--spacing-s);right:var(--spacing-s);bottom:var(--spacing-s);width:calc(100vw - 2 * var(--spacing-s));height:calc(100vh - 2 * var(--spacing-s));background-color:var(--gray-5);border-radius:var(--radius-s);padding:0 20px;display:flex;flex-direction:column;opacity:1;transition:opacity .5s ease;pointer-events:auto;overflow-y:auto;box-sizing:border-box}#page-grid-title{display:flex;align-items:center;width:100%;padding-top:var(--spacing-s);flex-shrink:0}#page-grid-title #icon-page-grid{background:var(--gray-3);border-radius:50%;width:32px;height:32px;display:flex;align-items:center;justify-content:center}#page-grid-title #title-page-grid{font-size:var(--font-size-medium);font-weight:var(--font-weight-bold);color:var(--white);margin-top:var(--spacing-s);margin-bottom:var(--spacing-xs);margin-left:var(--spacing-xs)!important}.page-grid-selection-toolbar{display:flex;align-items:center;gap:var(--spacing-s);margin-left:var(--spacing-m);background:var(--gray-4);padding:4px 12px;border-radius:var(--radius-s);border:1px solid var(--gray-3)}.selection-count-badge{font-size:13px;font-weight:var(--font-weight-medium);color:var(--white);white-space:nowrap}.selection-action-btn{background:transparent;border:1px solid var(--gray-2);color:var(--white);padding:4px 10px;border-radius:var(--radius-xs);font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:background-color .2s,border-color .2s;white-space:nowrap}.selection-action-btn:hover{background-color:var(--gray-3)}.selection-action-btn.delete-btn{background-color:var(--error);border-color:var(--error);color:#fff}.selection-action-btn.delete-btn:hover{opacity:.9}#close-page-grid{margin-left:auto;background:none;border:none;font-size:32px;cursor:pointer;color:var(--white)}.page-grid-content{display:flex;flex-wrap:wrap;justify-content:center;padding-bottom:40px;gap:var(--spacing-m)}.page-spread{display:flex;flex-direction:row;align-items:flex-end}.page-grid-content>*{margin-bottom:var(--spacing-s)}.page-grid-fake-item{background-color:var(--gray-4);border-radius:var(--radius-xs);border-top-right-radius:0;border-bottom-right-radius:0;padding:var(--spacing-xs);display:flex;flex-direction:column;gap:var(--spacing-xs);width:144px;height:220px;border:1px solid var(--gray-3);border-right:0;align-items:center;margin:0;box-sizing:border-box;box-shadow:2px 0 5px #0003}.page-grid-item-add{background-color:var(--gray-3);border-radius:var(--radius-xs);padding:var(--spacing-xs);display:flex;flex-direction:column;gap:var(--spacing-xs);width:144px;height:220px;border:none;align-items:center;cursor:pointer;margin:var(--spacing-s) 0;box-sizing:border-box;transition:transform .2s,background-color .2s}.page-grid-item-add:hover{transform:scale(1.05);background-color:var(--gray-2)}.page-grid-item-add-page{display:flex;align-content:center;flex-direction:column;justify-content:center;align-items:center;width:120px;height:180px;background:#fff;border:2px solid black;box-sizing:border-box;min-width:130px;min-height:186px}.page-number{font-size:10px;color:var(--white);text-align:center}.page-grid-loader{position:absolute;inset:0;background:#0006;display:flex;justify-content:center;align-items:center;z-index:3000;border-radius:var(--radius-s)}.spinner{width:40px;height:40px;border:4px solid rgba(255,255,255,.3);border-top:4px solid var(--white);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
|
846
|
-
}], ctorParameters: () => [], propDecorators: { onPageSelect: [{
|
|
847
|
-
type: Input
|
|
848
|
-
}] } });
|
|
849
|
-
|
|
850
|
-
export { PageGridModalComponent };
|
|
851
|
-
//# sourceMappingURL=solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CzgWwiAm.mjs.map
|