@solidpepper/solidpepper-soliddesigner 0.2.32 → 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/README.md +11 -3
- package/fesm2022/solidpepper-solidpepper-soliddesigner-iframe-modal.component-CJ4Uve9q.mjs +152 -0
- package/fesm2022/solidpepper-solidpepper-soliddesigner-iframe-modal.component-CJ4Uve9q.mjs.map +1 -0
- package/fesm2022/{solidpepper-solidpepper-soliddesigner-image-utils-1wqPuqMD.mjs → solidpepper-solidpepper-soliddesigner-image-utils-BZ877qA2.mjs} +2 -2
- package/fesm2022/{solidpepper-solidpepper-soliddesigner-image-utils-1wqPuqMD.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-DNuvMIlh.mjs +59166 -0
- package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DNuvMIlh.mjs.map +1 -0
- package/fesm2022/solidpepper-solidpepper-soliddesigner.mjs +2 -1
- package/fesm2022/solidpepper-solidpepper-soliddesigner.mjs.map +1 -1
- package/index.d.ts +767 -90
- package/package.json +6 -3
- package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-DLRf7wT0.mjs +0 -641
- package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-DLRf7wT0.mjs.map +0 -1
- package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DFi3bVIe.mjs +0 -43070
- package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DFi3bVIe.mjs.map +0 -1
|
@@ -0,0 +1,771 @@
|
|
|
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 { spIconGrid, spIconPlus, spIconTrash, spIconClose, SpIconComponent } from '@solidpepper/solidpepper-icons';
|
|
8
|
+
import { SpCheckboxComponent, SpButtonComponent, SpBadgeComponent, SpFloatingWindowComponent, SpIconButtonComponent } from '@solidpepper/solidpepper-component';
|
|
9
|
+
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-DNuvMIlh.mjs';
|
|
10
|
+
|
|
11
|
+
class PageGridItemComponent {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.isCurrent = false;
|
|
14
|
+
this.isSelected = false;
|
|
15
|
+
this.selectPage = new EventEmitter();
|
|
16
|
+
this.toggleSelect = new EventEmitter();
|
|
17
|
+
this.dragStarted = new EventEmitter();
|
|
18
|
+
this.dropped = new EventEmitter();
|
|
19
|
+
this.contextMenuEvent = new EventEmitter();
|
|
20
|
+
this.dragOver = false;
|
|
21
|
+
this.dropSide = null;
|
|
22
|
+
this.saveService = inject(SaveService);
|
|
23
|
+
this.cacheBuster = '';
|
|
24
|
+
effect(() => {
|
|
25
|
+
const pulse = this.saveService.saveSuccessPulse();
|
|
26
|
+
const pulseCount = typeof pulse === 'object' ? pulse.count : pulse;
|
|
27
|
+
if (this.isCurrent && pulseCount > 0) {
|
|
28
|
+
this.cacheBuster = `t=${pulseCount}`;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
get displayImageUrl() {
|
|
33
|
+
if (!this.cacheBuster || !this.imageUrl) {
|
|
34
|
+
return this.imageUrl;
|
|
35
|
+
}
|
|
36
|
+
const separator = this.imageUrl.includes('?') ? '&' : '?';
|
|
37
|
+
return `${this.imageUrl}${separator}${this.cacheBuster}`;
|
|
38
|
+
}
|
|
39
|
+
onDragStart(event) {
|
|
40
|
+
this.dragStarted.emit(this.index);
|
|
41
|
+
if (event.dataTransfer) {
|
|
42
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
onDragOver(event) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
this.dragOver = true;
|
|
48
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
49
|
+
const midX = rect.left + rect.width / 2;
|
|
50
|
+
this.dropSide = event.clientX < midX ? 'before' : 'after';
|
|
51
|
+
}
|
|
52
|
+
onDrop(event) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
if (this.dropSide) {
|
|
55
|
+
this.dropped.emit({ targetIndex: this.index, side: this.dropSide });
|
|
56
|
+
}
|
|
57
|
+
this.onDragEnd();
|
|
58
|
+
}
|
|
59
|
+
onDragLeave() {
|
|
60
|
+
this.dragOver = false;
|
|
61
|
+
this.dropSide = null;
|
|
62
|
+
}
|
|
63
|
+
onDragEnd() {
|
|
64
|
+
this.dragOver = false;
|
|
65
|
+
this.dropSide = null;
|
|
66
|
+
}
|
|
67
|
+
onCheckboxCheckedChange(checked) {
|
|
68
|
+
this.toggleSelect.emit(this.index);
|
|
69
|
+
}
|
|
70
|
+
onCheckboxChange(event) {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
this.toggleSelect.emit(this.index);
|
|
73
|
+
}
|
|
74
|
+
onContextMenu(event) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
event.stopPropagation();
|
|
77
|
+
this.contextMenuEvent.emit({ event, index: this.index });
|
|
78
|
+
}
|
|
79
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
80
|
+
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: `
|
|
81
|
+
<div
|
|
82
|
+
class="page-grid-item"
|
|
83
|
+
[class.current]="isCurrent"
|
|
84
|
+
[class.selected]="isSelected"
|
|
85
|
+
[class.drag-before]="dragOver && dropSide === 'before'"
|
|
86
|
+
[class.drag-after]="dragOver && dropSide === 'after'"
|
|
87
|
+
draggable="true"
|
|
88
|
+
(dragstart)="onDragStart($event)"
|
|
89
|
+
(dragover)="onDragOver($event)"
|
|
90
|
+
(dragleave)="onDragLeave()"
|
|
91
|
+
(drop)="onDrop($event)"
|
|
92
|
+
(dragend)="onDragEnd()"
|
|
93
|
+
(click)="selectPage.emit(index)"
|
|
94
|
+
(contextmenu)="onContextMenu($event)"
|
|
95
|
+
>
|
|
96
|
+
<div
|
|
97
|
+
class="page-select-checkbox-container"
|
|
98
|
+
(click)="$event.stopPropagation()"
|
|
99
|
+
>
|
|
100
|
+
<sp-checkbox
|
|
101
|
+
[checked]="isSelected"
|
|
102
|
+
size="sm"
|
|
103
|
+
(checkedChange)="onCheckboxCheckedChange($event)"
|
|
104
|
+
(click)="$event.stopPropagation()"
|
|
105
|
+
></sp-checkbox>
|
|
106
|
+
</div>
|
|
107
|
+
<img
|
|
108
|
+
[src]="displayImageUrl"
|
|
109
|
+
class="page-image"
|
|
110
|
+
alt="Page Thumbnail"
|
|
111
|
+
loading="lazy"
|
|
112
|
+
/>
|
|
113
|
+
<span class="page-number">{{ index + 1 }}</span>
|
|
114
|
+
</div>
|
|
115
|
+
`, isInline: true, styles: [":host{display:block}.page-grid-item{background-color:oklch(var(--b2));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 oklch(var(--b3));align-items:center;cursor:move;margin:0;position:relative;transition:transform .2s,background-color .2s,border-color .2s;box-sizing:border-box}.page-grid-item:hover{transform:scale(1.05);background-color:oklch(var(--b3))}.page-grid-item.current{border-color:oklch(var(--p))}.page-grid-item.selected{border-color:oklch(var(--p))!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-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:oklch(var(--bc))}.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 }, { kind: "component", type: SpCheckboxComponent, selector: "sp-checkbox", inputs: ["checked", "disabled", "label", "size"], outputs: ["checkedChange", "changed"] }] }); }
|
|
116
|
+
}
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridItemComponent, decorators: [{
|
|
118
|
+
type: Component,
|
|
119
|
+
args: [{ selector: 'app-page-grid-item', standalone: true, imports: [CommonModule, TranslateModule, SpCheckboxComponent], template: `
|
|
120
|
+
<div
|
|
121
|
+
class="page-grid-item"
|
|
122
|
+
[class.current]="isCurrent"
|
|
123
|
+
[class.selected]="isSelected"
|
|
124
|
+
[class.drag-before]="dragOver && dropSide === 'before'"
|
|
125
|
+
[class.drag-after]="dragOver && dropSide === 'after'"
|
|
126
|
+
draggable="true"
|
|
127
|
+
(dragstart)="onDragStart($event)"
|
|
128
|
+
(dragover)="onDragOver($event)"
|
|
129
|
+
(dragleave)="onDragLeave()"
|
|
130
|
+
(drop)="onDrop($event)"
|
|
131
|
+
(dragend)="onDragEnd()"
|
|
132
|
+
(click)="selectPage.emit(index)"
|
|
133
|
+
(contextmenu)="onContextMenu($event)"
|
|
134
|
+
>
|
|
135
|
+
<div
|
|
136
|
+
class="page-select-checkbox-container"
|
|
137
|
+
(click)="$event.stopPropagation()"
|
|
138
|
+
>
|
|
139
|
+
<sp-checkbox
|
|
140
|
+
[checked]="isSelected"
|
|
141
|
+
size="sm"
|
|
142
|
+
(checkedChange)="onCheckboxCheckedChange($event)"
|
|
143
|
+
(click)="$event.stopPropagation()"
|
|
144
|
+
></sp-checkbox>
|
|
145
|
+
</div>
|
|
146
|
+
<img
|
|
147
|
+
[src]="displayImageUrl"
|
|
148
|
+
class="page-image"
|
|
149
|
+
alt="Page Thumbnail"
|
|
150
|
+
loading="lazy"
|
|
151
|
+
/>
|
|
152
|
+
<span class="page-number">{{ index + 1 }}</span>
|
|
153
|
+
</div>
|
|
154
|
+
`, styles: [":host{display:block}.page-grid-item{background-color:oklch(var(--b2));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 oklch(var(--b3));align-items:center;cursor:move;margin:0;position:relative;transition:transform .2s,background-color .2s,border-color .2s;box-sizing:border-box}.page-grid-item:hover{transform:scale(1.05);background-color:oklch(var(--b3))}.page-grid-item.current{border-color:oklch(var(--p))}.page-grid-item.selected{border-color:oklch(var(--p))!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-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:oklch(var(--bc))}.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"] }]
|
|
155
|
+
}], ctorParameters: () => [], propDecorators: { index: [{
|
|
156
|
+
type: Input,
|
|
157
|
+
args: [{ required: true }]
|
|
158
|
+
}], imageUrl: [{
|
|
159
|
+
type: Input,
|
|
160
|
+
args: [{ required: true }]
|
|
161
|
+
}], isCurrent: [{
|
|
162
|
+
type: Input
|
|
163
|
+
}], isSelected: [{
|
|
164
|
+
type: Input
|
|
165
|
+
}], selectPage: [{
|
|
166
|
+
type: Output
|
|
167
|
+
}], toggleSelect: [{
|
|
168
|
+
type: Output
|
|
169
|
+
}], dragStarted: [{
|
|
170
|
+
type: Output
|
|
171
|
+
}], dropped: [{
|
|
172
|
+
type: Output
|
|
173
|
+
}], contextMenuEvent: [{
|
|
174
|
+
type: Output
|
|
175
|
+
}] } });
|
|
176
|
+
|
|
177
|
+
class PageGridModalComponent {
|
|
178
|
+
constructor() {
|
|
179
|
+
this.appParams = inject(AppParamsService);
|
|
180
|
+
this.assetsService = inject(AssetsService);
|
|
181
|
+
this.modalService = inject(ModalService);
|
|
182
|
+
this.saveService = inject(SaveService);
|
|
183
|
+
this.translate = inject(TranslateService);
|
|
184
|
+
this.spIconGrid = spIconGrid;
|
|
185
|
+
this.spIconPlus = spIconPlus;
|
|
186
|
+
this.spIconTrash = spIconTrash;
|
|
187
|
+
this.spIconClose = spIconClose;
|
|
188
|
+
this.isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
189
|
+
this.pages = signal([], ...(ngDevMode ? [{ debugName: "pages" }] : []));
|
|
190
|
+
this.currentPageIndex = computed(() => {
|
|
191
|
+
const guid = this.appParams.pageGuid();
|
|
192
|
+
const pages = this.pages();
|
|
193
|
+
return pages.findIndex((p) => p.documentPageGuid === guid);
|
|
194
|
+
}, ...(ngDevMode ? [{ debugName: "currentPageIndex" }] : []));
|
|
195
|
+
this.selectedPageIndices = signal(new Set(), ...(ngDevMode ? [{ debugName: "selectedPageIndices" }] : []));
|
|
196
|
+
this.selectedCount = computed(() => this.selectedPageIndices().size, ...(ngDevMode ? [{ debugName: "selectedCount" }] : []));
|
|
197
|
+
this.canDeleteSelected = computed(() => {
|
|
198
|
+
const count = this.selectedCount();
|
|
199
|
+
return count > 0 && count < this.pages().length;
|
|
200
|
+
}, ...(ngDevMode ? [{ debugName: "canDeleteSelected" }] : []));
|
|
201
|
+
this.pageSpreads = computed(() => {
|
|
202
|
+
const pagesList = this.pages();
|
|
203
|
+
const items = [{ isFake: true }];
|
|
204
|
+
pagesList.forEach((p, i) => {
|
|
205
|
+
items.push({ ...p, index: i });
|
|
206
|
+
});
|
|
207
|
+
const chunks = [];
|
|
208
|
+
for (let i = 0; i < items.length; i += 2) {
|
|
209
|
+
chunks.push(items.slice(i, i + 2));
|
|
210
|
+
}
|
|
211
|
+
return chunks;
|
|
212
|
+
}, ...(ngDevMode ? [{ debugName: "pageSpreads" }] : []));
|
|
213
|
+
this.pageCacheBusters = signal({}, ...(ngDevMode ? [{ debugName: "pageCacheBusters" }] : []));
|
|
214
|
+
this.sessionBuster = `s=${Date.now()}`;
|
|
215
|
+
this.pageImageUrls = computed(() => {
|
|
216
|
+
const busters = this.pageCacheBusters();
|
|
217
|
+
return this.pages().map((p) => {
|
|
218
|
+
const baseUrl = p.publicationTemplateThumbnail || p.publicationTemplateUrl;
|
|
219
|
+
if (!baseUrl)
|
|
220
|
+
return '';
|
|
221
|
+
const guid = p.documentPageGuid;
|
|
222
|
+
const buster = busters[guid] || this.sessionBuster;
|
|
223
|
+
const separator = baseUrl.includes('?') ? '&' : '?';
|
|
224
|
+
return `${baseUrl}${separator}${buster}`;
|
|
225
|
+
});
|
|
226
|
+
}, ...(ngDevMode ? [{ debugName: "pageImageUrls" }] : []));
|
|
227
|
+
this.dragSourceIndex = null;
|
|
228
|
+
this.contextMenuVisible = false;
|
|
229
|
+
this.contextMenuPosition = { x: 0, y: 0 };
|
|
230
|
+
this.contextMenuPageIndex = null;
|
|
231
|
+
// Delete confirmation state
|
|
232
|
+
this.showDeleteConfirm = signal(false, ...(ngDevMode ? [{ debugName: "showDeleteConfirm" }] : []));
|
|
233
|
+
this.isBatchDelete = signal(false, ...(ngDevMode ? [{ debugName: "isBatchDelete" }] : []));
|
|
234
|
+
this.deleteIndex = null;
|
|
235
|
+
this.deleteModalTitle = computed(() => {
|
|
236
|
+
return this.isBatchDelete()
|
|
237
|
+
? this.translate.instant('GLOBAL.PAGES.DELETE_MULTIPLE_CONFIRM_TITLE')
|
|
238
|
+
: this.translate.instant('GLOBAL.PAGES.DELETE_CONFIRM_TITLE');
|
|
239
|
+
}, ...(ngDevMode ? [{ debugName: "deleteModalTitle" }] : []));
|
|
240
|
+
this.deleteModalMessage = computed(() => {
|
|
241
|
+
return this.isBatchDelete()
|
|
242
|
+
? this.translate.instant('GLOBAL.PAGES.DELETE_MULTIPLE_CONFIRM_MSG', {
|
|
243
|
+
count: this.selectedCount(),
|
|
244
|
+
})
|
|
245
|
+
: this.translate.instant('GLOBAL.PAGES.DELETE_CONFIRM_MSG');
|
|
246
|
+
}, ...(ngDevMode ? [{ debugName: "deleteModalMessage" }] : []));
|
|
247
|
+
effect(() => {
|
|
248
|
+
const params = this.appParams.params();
|
|
249
|
+
const docData = params.documentData;
|
|
250
|
+
if (docData && Array.isArray(docData)) {
|
|
251
|
+
this.pages.set([...docData]);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
effect(() => {
|
|
255
|
+
const pulse = this.saveService.saveSuccessPulse();
|
|
256
|
+
const pulseCount = typeof pulse === 'object' ? pulse.count : pulse;
|
|
257
|
+
const currentPage = this.pages()[this.currentPageIndex()];
|
|
258
|
+
if (currentPage && pulseCount > 0) {
|
|
259
|
+
const activeGuid = currentPage.documentPageGuid;
|
|
260
|
+
this.pageCacheBusters.update((map) => ({
|
|
261
|
+
...map,
|
|
262
|
+
[activeGuid]: `t=${pulseCount}`,
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
ngOnInit() { }
|
|
268
|
+
togglePageSelection(index) {
|
|
269
|
+
this.selectedPageIndices.update((set) => {
|
|
270
|
+
const next = new Set(set);
|
|
271
|
+
if (next.has(index)) {
|
|
272
|
+
next.delete(index);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
next.add(index);
|
|
276
|
+
}
|
|
277
|
+
return next;
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
deselectAll() {
|
|
281
|
+
this.selectedPageIndices.set(new Set());
|
|
282
|
+
}
|
|
283
|
+
deleteSelectedPages() {
|
|
284
|
+
if (!this.canDeleteSelected())
|
|
285
|
+
return;
|
|
286
|
+
this.isBatchDelete.set(true);
|
|
287
|
+
this.showDeleteConfirm.set(true);
|
|
288
|
+
}
|
|
289
|
+
addPage() {
|
|
290
|
+
const guid = this.appParams.guid;
|
|
291
|
+
if (!guid)
|
|
292
|
+
return;
|
|
293
|
+
this.isLoading.set(true);
|
|
294
|
+
this.assetsService.addDocumentPage(guid).subscribe((newPage) => {
|
|
295
|
+
if (newPage) {
|
|
296
|
+
this.refreshPages();
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
this.isLoading.set(false);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
addPageBefore(index) {
|
|
304
|
+
const guid = this.appParams.guid;
|
|
305
|
+
if (!guid)
|
|
306
|
+
return;
|
|
307
|
+
this.isLoading.set(true);
|
|
308
|
+
this.assetsService
|
|
309
|
+
.addDocumentPage(guid, index + 1)
|
|
310
|
+
.subscribe((newPage) => {
|
|
311
|
+
if (newPage) {
|
|
312
|
+
this.refreshPages();
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
this.isLoading.set(false);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
addPageAfter(index) {
|
|
320
|
+
const guid = this.appParams.guid;
|
|
321
|
+
if (!guid)
|
|
322
|
+
return;
|
|
323
|
+
this.isLoading.set(true);
|
|
324
|
+
this.assetsService
|
|
325
|
+
.addDocumentPage(guid, index + 2)
|
|
326
|
+
.subscribe((newPage) => {
|
|
327
|
+
if (newPage) {
|
|
328
|
+
this.refreshPages();
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
this.isLoading.set(false);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
duplicatePage(index) {
|
|
336
|
+
const guid = this.appParams.guid;
|
|
337
|
+
const page = this.pages()[index];
|
|
338
|
+
if (!guid || !page)
|
|
339
|
+
return;
|
|
340
|
+
this.isLoading.set(true);
|
|
341
|
+
this.assetsService
|
|
342
|
+
.duplicateDocumentPage(guid, page.documentPageGuid)
|
|
343
|
+
.subscribe((newPage) => {
|
|
344
|
+
if (newPage) {
|
|
345
|
+
this.refreshPages();
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
this.isLoading.set(false);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
deletePage(index) {
|
|
353
|
+
this.isBatchDelete.set(false);
|
|
354
|
+
this.deleteIndex = index;
|
|
355
|
+
this.showDeleteConfirm.set(true);
|
|
356
|
+
}
|
|
357
|
+
confirmDelete() {
|
|
358
|
+
const guid = this.appParams.guid;
|
|
359
|
+
if (!guid) {
|
|
360
|
+
this.cancelDelete();
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (this.isBatchDelete()) {
|
|
364
|
+
if (!this.canDeleteSelected()) {
|
|
365
|
+
this.cancelDelete();
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const pagesList = this.pages();
|
|
369
|
+
const guidsToDelete = Array.from(this.selectedPageIndices())
|
|
370
|
+
.map((i) => pagesList[i]?.documentPageGuid)
|
|
371
|
+
.filter((g) => !!g);
|
|
372
|
+
if (guidsToDelete.length === 0) {
|
|
373
|
+
this.cancelDelete();
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
this.isLoading.set(true);
|
|
377
|
+
from(guidsToDelete)
|
|
378
|
+
.pipe(concatMap((pageGuid) => this.assetsService.deleteDocumentPage(guid, pageGuid)), toArray())
|
|
379
|
+
.subscribe({
|
|
380
|
+
next: () => {
|
|
381
|
+
this.selectedPageIndices.set(new Set());
|
|
382
|
+
this.refreshPages();
|
|
383
|
+
},
|
|
384
|
+
error: () => {
|
|
385
|
+
this.isLoading.set(false);
|
|
386
|
+
},
|
|
387
|
+
});
|
|
388
|
+
this.cancelDelete();
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (this.deleteIndex === null)
|
|
392
|
+
return;
|
|
393
|
+
const index = this.deleteIndex;
|
|
394
|
+
const page = this.pages()[index];
|
|
395
|
+
if (!page) {
|
|
396
|
+
this.cancelDelete();
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
this.isLoading.set(true);
|
|
400
|
+
this.assetsService
|
|
401
|
+
.deleteDocumentPage(guid, page.documentPageGuid)
|
|
402
|
+
.subscribe((result) => {
|
|
403
|
+
if (result) {
|
|
404
|
+
this.selectedPageIndices.update((set) => {
|
|
405
|
+
const next = new Set(set);
|
|
406
|
+
next.delete(index);
|
|
407
|
+
return next;
|
|
408
|
+
});
|
|
409
|
+
this.refreshPages();
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
this.isLoading.set(false);
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
this.cancelDelete();
|
|
416
|
+
}
|
|
417
|
+
cancelDelete() {
|
|
418
|
+
this.showDeleteConfirm.set(false);
|
|
419
|
+
this.deleteIndex = null;
|
|
420
|
+
this.isBatchDelete.set(false);
|
|
421
|
+
}
|
|
422
|
+
refreshPages() {
|
|
423
|
+
const guid = this.appParams.guid;
|
|
424
|
+
if (!guid)
|
|
425
|
+
return;
|
|
426
|
+
this.assetsService.getSVGDocumentPages(guid).subscribe((response) => {
|
|
427
|
+
if (response && response.template) {
|
|
428
|
+
this.appParams.setParams({ documentData: [...response.template] });
|
|
429
|
+
}
|
|
430
|
+
this.selectedPageIndices.set(new Set());
|
|
431
|
+
this.isLoading.set(false);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
close() {
|
|
435
|
+
this.modalService.close();
|
|
436
|
+
}
|
|
437
|
+
goToPage(index) {
|
|
438
|
+
if (this.onPageSelect) {
|
|
439
|
+
this.onPageSelect(index);
|
|
440
|
+
}
|
|
441
|
+
this.close();
|
|
442
|
+
}
|
|
443
|
+
onDragStart(index) {
|
|
444
|
+
this.dragSourceIndex = index;
|
|
445
|
+
}
|
|
446
|
+
onDrop(data) {
|
|
447
|
+
if (this.dragSourceIndex === null)
|
|
448
|
+
return;
|
|
449
|
+
const source = this.dragSourceIndex;
|
|
450
|
+
let actualTargetIndex = data.targetIndex;
|
|
451
|
+
if (data.side === 'after') {
|
|
452
|
+
actualTargetIndex++;
|
|
453
|
+
}
|
|
454
|
+
if (actualTargetIndex === source || actualTargetIndex === source + 1) {
|
|
455
|
+
this.dragSourceIndex = null;
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
const guid = this.appParams.guid;
|
|
459
|
+
if (!guid)
|
|
460
|
+
return;
|
|
461
|
+
const previousPages = this.pages();
|
|
462
|
+
const draggedPage = previousPages[source];
|
|
463
|
+
if (!draggedPage)
|
|
464
|
+
return;
|
|
465
|
+
const draggedPageGuid = draggedPage.documentPageGuid;
|
|
466
|
+
let insertionIndex = actualTargetIndex;
|
|
467
|
+
if (source < actualTargetIndex) {
|
|
468
|
+
insertionIndex--;
|
|
469
|
+
}
|
|
470
|
+
const newPageIdForApi = insertionIndex + 1;
|
|
471
|
+
// Optimistic reorder
|
|
472
|
+
this.pages.update((p) => {
|
|
473
|
+
const copy = [...p];
|
|
474
|
+
const [moved] = copy.splice(source, 1);
|
|
475
|
+
copy.splice(insertionIndex, 0, moved);
|
|
476
|
+
return copy;
|
|
477
|
+
});
|
|
478
|
+
this.isLoading.set(true);
|
|
479
|
+
this.assetsService
|
|
480
|
+
.moveDocumentPage(guid, draggedPageGuid, newPageIdForApi)
|
|
481
|
+
.subscribe({
|
|
482
|
+
next: (result) => {
|
|
483
|
+
if (result) {
|
|
484
|
+
this.refreshPages();
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
this.pages.set(previousPages);
|
|
488
|
+
this.isLoading.set(false);
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
error: () => {
|
|
492
|
+
this.pages.set(previousPages);
|
|
493
|
+
this.isLoading.set(false);
|
|
494
|
+
},
|
|
495
|
+
});
|
|
496
|
+
this.dragSourceIndex = null;
|
|
497
|
+
}
|
|
498
|
+
onPageContextMenu(data) {
|
|
499
|
+
this.contextMenuPosition = { x: data.event.clientX, y: data.event.clientY };
|
|
500
|
+
this.contextMenuPageIndex = data.index;
|
|
501
|
+
this.contextMenuVisible = true;
|
|
502
|
+
}
|
|
503
|
+
onContextMenuAction(event) {
|
|
504
|
+
switch (event.action) {
|
|
505
|
+
case 'open':
|
|
506
|
+
this.goToPage(event.index);
|
|
507
|
+
break;
|
|
508
|
+
case 'insert-before':
|
|
509
|
+
this.addPageBefore(event.index);
|
|
510
|
+
break;
|
|
511
|
+
case 'insert-after':
|
|
512
|
+
this.addPageAfter(event.index);
|
|
513
|
+
break;
|
|
514
|
+
case 'duplicate':
|
|
515
|
+
this.duplicatePage(event.index);
|
|
516
|
+
break;
|
|
517
|
+
case 'delete':
|
|
518
|
+
this.deletePage(event.index);
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
this.contextMenuVisible = false;
|
|
522
|
+
}
|
|
523
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
524
|
+
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: `
|
|
525
|
+
<sp-floating-window
|
|
526
|
+
[title]="'GLOBAL.PAGES.GRID_VIEW' | translate"
|
|
527
|
+
[icon]="spIconGrid"
|
|
528
|
+
[isOpen]="true"
|
|
529
|
+
[initialWidth]="820"
|
|
530
|
+
[initialHeight]="560"
|
|
531
|
+
[minWidth]="400"
|
|
532
|
+
[minHeight]="300"
|
|
533
|
+
[centerOnOpen]="true"
|
|
534
|
+
[maximizable]="true"
|
|
535
|
+
[zIndex]="2000"
|
|
536
|
+
(closed)="close()"
|
|
537
|
+
>
|
|
538
|
+
<!-- Scrollable content area inside floating window body -->
|
|
539
|
+
<div class="page-grid-scroll-container">
|
|
540
|
+
<div class="page-grid-content">
|
|
541
|
+
@for (spread of pageSpreads(); track spread; let sIndex = $index) {
|
|
542
|
+
<div class="page-spread">
|
|
543
|
+
@for (item of spread; track item) {
|
|
544
|
+
@if (item.isFake) {
|
|
545
|
+
<div class="page-grid-fake-item"></div>
|
|
546
|
+
} @else {
|
|
547
|
+
<app-page-grid-item
|
|
548
|
+
[index]="item.index"
|
|
549
|
+
[imageUrl]="pageImageUrls()[item.index]"
|
|
550
|
+
[isCurrent]="item.index === currentPageIndex()"
|
|
551
|
+
[isSelected]="selectedPageIndices().has(item.index)"
|
|
552
|
+
(toggleSelect)="togglePageSelection($event)"
|
|
553
|
+
(selectPage)="goToPage($event)"
|
|
554
|
+
(dragStarted)="onDragStart($event)"
|
|
555
|
+
(dropped)="onDrop($event)"
|
|
556
|
+
(contextMenuEvent)="onPageContextMenu($event)"
|
|
557
|
+
></app-page-grid-item>
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
</div>
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
<!-- Add page card -->
|
|
564
|
+
<div class="page-grid-item-add" (click)="addPage()">
|
|
565
|
+
<div class="page-grid-item-add-page">
|
|
566
|
+
<sp-icon [icon]="spIconPlus" [size]="32" class="text-base-content/60"></sp-icon>
|
|
567
|
+
</div>
|
|
568
|
+
<span class="page-number">{{
|
|
569
|
+
'GLOBAL.PAGES.ADD_PAGE' | translate
|
|
570
|
+
}}</span>
|
|
571
|
+
</div>
|
|
572
|
+
</div>
|
|
573
|
+
</div>
|
|
574
|
+
|
|
575
|
+
<!-- Selection action bar docked at the bottom of the window -->
|
|
576
|
+
@if (selectedCount() > 0) {
|
|
577
|
+
<div class="page-grid-selection-bar">
|
|
578
|
+
<div class="selection-bar-left">
|
|
579
|
+
<sp-badge variant="primary" size="xs">
|
|
580
|
+
{{
|
|
581
|
+
'GLOBAL.PAGES.SELECTED_COUNT'
|
|
582
|
+
| translate: { count: selectedCount() }
|
|
583
|
+
}}
|
|
584
|
+
</sp-badge>
|
|
585
|
+
<sp-button
|
|
586
|
+
variant="secondary"
|
|
587
|
+
size="xs"
|
|
588
|
+
[tooltip]="'GLOBAL.PAGES.DESELECT_ALL' | translate"
|
|
589
|
+
(clicked)="deselectAll()"
|
|
590
|
+
>
|
|
591
|
+
{{ 'GLOBAL.PAGES.DESELECT_ALL' | translate }}
|
|
592
|
+
</sp-button>
|
|
593
|
+
</div>
|
|
594
|
+
|
|
595
|
+
<div class="selection-bar-right">
|
|
596
|
+
@if (canDeleteSelected()) {
|
|
597
|
+
<sp-button
|
|
598
|
+
variant="danger"
|
|
599
|
+
size="xs"
|
|
600
|
+
[tooltip]="'GLOBAL.PAGES.DELETE_SELECTED' | translate"
|
|
601
|
+
(clicked)="deleteSelectedPages()"
|
|
602
|
+
>
|
|
603
|
+
<sp-icon prefix [icon]="spIconTrash" [size]="13"></sp-icon>
|
|
604
|
+
{{ 'GLOBAL.PAGES.DELETE_SELECTED' | translate }}
|
|
605
|
+
</sp-button>
|
|
606
|
+
}
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
<!-- Loading overlay inside floating window -->
|
|
612
|
+
@if (isLoading()) {
|
|
613
|
+
<div class="page-grid-loader">
|
|
614
|
+
<span class="loading loading-spinner loading-lg text-primary"></span>
|
|
615
|
+
</div>
|
|
616
|
+
}
|
|
617
|
+
</sp-floating-window>
|
|
618
|
+
|
|
619
|
+
<app-page-context-menu
|
|
620
|
+
[visible]="contextMenuVisible"
|
|
621
|
+
[position]="contextMenuPosition"
|
|
622
|
+
[pageIndex]="contextMenuPageIndex"
|
|
623
|
+
[isCurrentPage]="contextMenuPageIndex === currentPageIndex()"
|
|
624
|
+
(action)="onContextMenuAction($event)"
|
|
625
|
+
(closeMenu)="contextMenuVisible = false"
|
|
626
|
+
></app-page-context-menu>
|
|
627
|
+
|
|
628
|
+
<!-- Delete Confirmation Modal -->
|
|
629
|
+
@if (showDeleteConfirm()) {
|
|
630
|
+
<app-confirm-delete-modal
|
|
631
|
+
[title]="deleteModalTitle()"
|
|
632
|
+
[message]="deleteModalMessage()"
|
|
633
|
+
(confirm)="confirmDelete()"
|
|
634
|
+
(cancel)="cancelDelete()"
|
|
635
|
+
></app-confirm-delete-modal>
|
|
636
|
+
}
|
|
637
|
+
`, isInline: true, styles: [":host{display:contents}.page-grid-selection-bar{display:flex;align-items:center;justify-content:space-between;padding:8px 16px;background-color:oklch(var(--b3));border-top:1px solid oklch(var(--b3));flex-shrink:0;-webkit-user-select:none;user-select:none;box-sizing:border-box}.selection-bar-left,.selection-bar-right{display:flex;align-items:center;gap:8px}.page-grid-scroll-container{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:16px 20px 32px}.page-grid-content{display:flex;flex-wrap:wrap;justify-content:center;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:oklch(var(--b2));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 oklch(var(--b3));border-right:0;align-items:center;margin:0;box-sizing:border-box;box-shadow:2px 0 5px #0003}.page-grid-item-add{background-color:oklch(var(--b2));border-radius:var(--radius-xs);padding:var(--spacing-xs);display:flex;flex-direction:column;gap:var(--spacing-xs);width:144px;height:220px;border:1px dashed oklch(var(--b3));align-items:center;cursor:pointer;margin:var(--spacing-s) 0;box-sizing:border-box;transition:transform .2s,background-color .2s,border-color .2s}.page-grid-item-add:hover{transform:scale(1.05);background-color:oklch(var(--b1));border-color:oklch(var(--p))}.page-grid-item-add-page{display:flex;align-content:center;flex-direction:column;justify-content:center;align-items:center;width:120px;height:180px;background:oklch(var(--b1));border:1px dashed oklch(var(--b3));box-sizing:border-box;min-width:130px;min-height:186px;border-radius:var(--radius-xs)}.page-number{font-size:10px;color:oklch(var(--bc));text-align:center}.page-grid-loader{position:absolute;inset:0;background:#00000073;display:flex;justify-content:center;align-items:center;z-index:3000;border-radius:inherit}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: SpIconComponent, selector: "sp-icon", inputs: ["icon", "name", "size", "color", "fill", "strokeWidth", "class", "ariaLabel"] }, { kind: "component", type: SpButtonComponent, selector: "sp-button", inputs: ["variant", "size", "type", "disabled", "loading", "active", "tooltip", "customClass", "fullWidth", "showTextWhileLoading"], outputs: ["clicked"] }, { kind: "component", type: SpBadgeComponent, selector: "sp-badge", inputs: ["variant", "size", "dot", "roundedFull", "customClass"] }, { kind: "component", type: SpFloatingWindowComponent, selector: "sp-floating-window", inputs: ["title", "icon", "maximizable", "startMaximized", "initialX", "initialY", "initialWidth", "initialHeight", "minWidth", "minHeight", "zIndex", "centerOnOpen", "isOpen"], outputs: ["closed", "positionChange", "sizeChange", "maximizedChange"] }, { 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" }] }); }
|
|
638
|
+
}
|
|
639
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridModalComponent, decorators: [{
|
|
640
|
+
type: Component,
|
|
641
|
+
args: [{ selector: 'app-page-grid-modal', standalone: true, imports: [
|
|
642
|
+
CommonModule,
|
|
643
|
+
TranslateModule,
|
|
644
|
+
SpIconComponent,
|
|
645
|
+
SpButtonComponent,
|
|
646
|
+
SpIconButtonComponent,
|
|
647
|
+
SpBadgeComponent,
|
|
648
|
+
SpFloatingWindowComponent,
|
|
649
|
+
PageGridItemComponent,
|
|
650
|
+
PageContextMenuComponent,
|
|
651
|
+
ConfirmDeleteModalComponent,
|
|
652
|
+
], template: `
|
|
653
|
+
<sp-floating-window
|
|
654
|
+
[title]="'GLOBAL.PAGES.GRID_VIEW' | translate"
|
|
655
|
+
[icon]="spIconGrid"
|
|
656
|
+
[isOpen]="true"
|
|
657
|
+
[initialWidth]="820"
|
|
658
|
+
[initialHeight]="560"
|
|
659
|
+
[minWidth]="400"
|
|
660
|
+
[minHeight]="300"
|
|
661
|
+
[centerOnOpen]="true"
|
|
662
|
+
[maximizable]="true"
|
|
663
|
+
[zIndex]="2000"
|
|
664
|
+
(closed)="close()"
|
|
665
|
+
>
|
|
666
|
+
<!-- Scrollable content area inside floating window body -->
|
|
667
|
+
<div class="page-grid-scroll-container">
|
|
668
|
+
<div class="page-grid-content">
|
|
669
|
+
@for (spread of pageSpreads(); track spread; let sIndex = $index) {
|
|
670
|
+
<div class="page-spread">
|
|
671
|
+
@for (item of spread; track item) {
|
|
672
|
+
@if (item.isFake) {
|
|
673
|
+
<div class="page-grid-fake-item"></div>
|
|
674
|
+
} @else {
|
|
675
|
+
<app-page-grid-item
|
|
676
|
+
[index]="item.index"
|
|
677
|
+
[imageUrl]="pageImageUrls()[item.index]"
|
|
678
|
+
[isCurrent]="item.index === currentPageIndex()"
|
|
679
|
+
[isSelected]="selectedPageIndices().has(item.index)"
|
|
680
|
+
(toggleSelect)="togglePageSelection($event)"
|
|
681
|
+
(selectPage)="goToPage($event)"
|
|
682
|
+
(dragStarted)="onDragStart($event)"
|
|
683
|
+
(dropped)="onDrop($event)"
|
|
684
|
+
(contextMenuEvent)="onPageContextMenu($event)"
|
|
685
|
+
></app-page-grid-item>
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
</div>
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
<!-- Add page card -->
|
|
692
|
+
<div class="page-grid-item-add" (click)="addPage()">
|
|
693
|
+
<div class="page-grid-item-add-page">
|
|
694
|
+
<sp-icon [icon]="spIconPlus" [size]="32" class="text-base-content/60"></sp-icon>
|
|
695
|
+
</div>
|
|
696
|
+
<span class="page-number">{{
|
|
697
|
+
'GLOBAL.PAGES.ADD_PAGE' | translate
|
|
698
|
+
}}</span>
|
|
699
|
+
</div>
|
|
700
|
+
</div>
|
|
701
|
+
</div>
|
|
702
|
+
|
|
703
|
+
<!-- Selection action bar docked at the bottom of the window -->
|
|
704
|
+
@if (selectedCount() > 0) {
|
|
705
|
+
<div class="page-grid-selection-bar">
|
|
706
|
+
<div class="selection-bar-left">
|
|
707
|
+
<sp-badge variant="primary" size="xs">
|
|
708
|
+
{{
|
|
709
|
+
'GLOBAL.PAGES.SELECTED_COUNT'
|
|
710
|
+
| translate: { count: selectedCount() }
|
|
711
|
+
}}
|
|
712
|
+
</sp-badge>
|
|
713
|
+
<sp-button
|
|
714
|
+
variant="secondary"
|
|
715
|
+
size="xs"
|
|
716
|
+
[tooltip]="'GLOBAL.PAGES.DESELECT_ALL' | translate"
|
|
717
|
+
(clicked)="deselectAll()"
|
|
718
|
+
>
|
|
719
|
+
{{ 'GLOBAL.PAGES.DESELECT_ALL' | translate }}
|
|
720
|
+
</sp-button>
|
|
721
|
+
</div>
|
|
722
|
+
|
|
723
|
+
<div class="selection-bar-right">
|
|
724
|
+
@if (canDeleteSelected()) {
|
|
725
|
+
<sp-button
|
|
726
|
+
variant="danger"
|
|
727
|
+
size="xs"
|
|
728
|
+
[tooltip]="'GLOBAL.PAGES.DELETE_SELECTED' | translate"
|
|
729
|
+
(clicked)="deleteSelectedPages()"
|
|
730
|
+
>
|
|
731
|
+
<sp-icon prefix [icon]="spIconTrash" [size]="13"></sp-icon>
|
|
732
|
+
{{ 'GLOBAL.PAGES.DELETE_SELECTED' | translate }}
|
|
733
|
+
</sp-button>
|
|
734
|
+
}
|
|
735
|
+
</div>
|
|
736
|
+
</div>
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
<!-- Loading overlay inside floating window -->
|
|
740
|
+
@if (isLoading()) {
|
|
741
|
+
<div class="page-grid-loader">
|
|
742
|
+
<span class="loading loading-spinner loading-lg text-primary"></span>
|
|
743
|
+
</div>
|
|
744
|
+
}
|
|
745
|
+
</sp-floating-window>
|
|
746
|
+
|
|
747
|
+
<app-page-context-menu
|
|
748
|
+
[visible]="contextMenuVisible"
|
|
749
|
+
[position]="contextMenuPosition"
|
|
750
|
+
[pageIndex]="contextMenuPageIndex"
|
|
751
|
+
[isCurrentPage]="contextMenuPageIndex === currentPageIndex()"
|
|
752
|
+
(action)="onContextMenuAction($event)"
|
|
753
|
+
(closeMenu)="contextMenuVisible = false"
|
|
754
|
+
></app-page-context-menu>
|
|
755
|
+
|
|
756
|
+
<!-- Delete Confirmation Modal -->
|
|
757
|
+
@if (showDeleteConfirm()) {
|
|
758
|
+
<app-confirm-delete-modal
|
|
759
|
+
[title]="deleteModalTitle()"
|
|
760
|
+
[message]="deleteModalMessage()"
|
|
761
|
+
(confirm)="confirmDelete()"
|
|
762
|
+
(cancel)="cancelDelete()"
|
|
763
|
+
></app-confirm-delete-modal>
|
|
764
|
+
}
|
|
765
|
+
`, styles: [":host{display:contents}.page-grid-selection-bar{display:flex;align-items:center;justify-content:space-between;padding:8px 16px;background-color:oklch(var(--b3));border-top:1px solid oklch(var(--b3));flex-shrink:0;-webkit-user-select:none;user-select:none;box-sizing:border-box}.selection-bar-left,.selection-bar-right{display:flex;align-items:center;gap:8px}.page-grid-scroll-container{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:16px 20px 32px}.page-grid-content{display:flex;flex-wrap:wrap;justify-content:center;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:oklch(var(--b2));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 oklch(var(--b3));border-right:0;align-items:center;margin:0;box-sizing:border-box;box-shadow:2px 0 5px #0003}.page-grid-item-add{background-color:oklch(var(--b2));border-radius:var(--radius-xs);padding:var(--spacing-xs);display:flex;flex-direction:column;gap:var(--spacing-xs);width:144px;height:220px;border:1px dashed oklch(var(--b3));align-items:center;cursor:pointer;margin:var(--spacing-s) 0;box-sizing:border-box;transition:transform .2s,background-color .2s,border-color .2s}.page-grid-item-add:hover{transform:scale(1.05);background-color:oklch(var(--b1));border-color:oklch(var(--p))}.page-grid-item-add-page{display:flex;align-content:center;flex-direction:column;justify-content:center;align-items:center;width:120px;height:180px;background:oklch(var(--b1));border:1px dashed oklch(var(--b3));box-sizing:border-box;min-width:130px;min-height:186px;border-radius:var(--radius-xs)}.page-number{font-size:10px;color:oklch(var(--bc));text-align:center}.page-grid-loader{position:absolute;inset:0;background:#00000073;display:flex;justify-content:center;align-items:center;z-index:3000;border-radius:inherit}\n"] }]
|
|
766
|
+
}], ctorParameters: () => [], propDecorators: { onPageSelect: [{
|
|
767
|
+
type: Input
|
|
768
|
+
}] } });
|
|
769
|
+
|
|
770
|
+
export { PageGridModalComponent };
|
|
771
|
+
//# sourceMappingURL=solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CSVxODUW.mjs.map
|