@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.
Files changed (17) hide show
  1. package/README.md +11 -3
  2. package/fesm2022/solidpepper-solidpepper-soliddesigner-iframe-modal.component-CJ4Uve9q.mjs +152 -0
  3. package/fesm2022/solidpepper-solidpepper-soliddesigner-iframe-modal.component-CJ4Uve9q.mjs.map +1 -0
  4. package/fesm2022/{solidpepper-solidpepper-soliddesigner-image-utils-1wqPuqMD.mjs → solidpepper-solidpepper-soliddesigner-image-utils-BZ877qA2.mjs} +2 -2
  5. package/fesm2022/{solidpepper-solidpepper-soliddesigner-image-utils-1wqPuqMD.mjs.map → solidpepper-solidpepper-soliddesigner-image-utils-BZ877qA2.mjs.map} +1 -1
  6. package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CSVxODUW.mjs +771 -0
  7. package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CSVxODUW.mjs.map +1 -0
  8. package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DNuvMIlh.mjs +59166 -0
  9. package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DNuvMIlh.mjs.map +1 -0
  10. package/fesm2022/solidpepper-solidpepper-soliddesigner.mjs +2 -1
  11. package/fesm2022/solidpepper-solidpepper-soliddesigner.mjs.map +1 -1
  12. package/index.d.ts +767 -90
  13. package/package.json +6 -3
  14. package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-DLRf7wT0.mjs +0 -641
  15. package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-DLRf7wT0.mjs.map +0 -1
  16. package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DFi3bVIe.mjs +0 -43070
  17. package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DFi3bVIe.mjs.map +0 -1
@@ -1,641 +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 } from '@ngx-translate/core';
6
- import { a as SaveService, A as AppParamsService, b as AssetsService, M as ModalService, P as PageContextMenuComponent, C as ConfirmDeleteModalComponent } from './solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DFi3bVIe.mjs';
7
-
8
- class PageGridItemComponent {
9
- constructor() {
10
- this.isCurrent = false;
11
- this.selectPage = new EventEmitter();
12
- this.dragStarted = new EventEmitter();
13
- this.dropped = new EventEmitter();
14
- this.contextMenuEvent = new EventEmitter();
15
- this.dragOver = false;
16
- this.dropSide = null;
17
- this.saveService = inject(SaveService);
18
- this.cacheBuster = '';
19
- effect(() => {
20
- const pulse = this.saveService.saveSuccessPulse();
21
- const pulseCount = typeof pulse === 'object' ? pulse.count : pulse;
22
- if (this.isCurrent && pulseCount > 0) {
23
- this.cacheBuster = `t=${pulseCount}`;
24
- }
25
- });
26
- }
27
- get displayImageUrl() {
28
- if (!this.cacheBuster || !this.imageUrl) {
29
- return this.imageUrl;
30
- }
31
- const separator = this.imageUrl.includes('?') ? '&' : '?';
32
- return `${this.imageUrl}${separator}${this.cacheBuster}`;
33
- }
34
- onDragStart(event) {
35
- this.dragStarted.emit(this.index);
36
- if (event.dataTransfer) {
37
- event.dataTransfer.effectAllowed = 'move';
38
- }
39
- }
40
- onDragOver(event) {
41
- event.preventDefault();
42
- this.dragOver = true;
43
- const rect = event.currentTarget.getBoundingClientRect();
44
- const midX = rect.left + rect.width / 2;
45
- this.dropSide = event.clientX < midX ? 'before' : 'after';
46
- }
47
- onDrop(event) {
48
- event.preventDefault();
49
- if (this.dropSide) {
50
- this.dropped.emit({ targetIndex: this.index, side: this.dropSide });
51
- }
52
- this.onDragEnd();
53
- }
54
- onDragLeave() {
55
- this.dragOver = false;
56
- this.dropSide = null;
57
- }
58
- onDragEnd() {
59
- this.dragOver = false;
60
- this.dropSide = null;
61
- }
62
- onContextMenu(event) {
63
- event.preventDefault();
64
- event.stopPropagation();
65
- this.contextMenuEvent.emit({ event, index: this.index });
66
- }
67
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
68
- 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" }, outputs: { selectPage: "selectPage", dragStarted: "dragStarted", dropped: "dropped", contextMenuEvent: "contextMenuEvent" }, ngImport: i0, template: `
69
- <div
70
- class="page-grid-item"
71
- [class.current]="isCurrent"
72
- [class.drag-before]="dragOver && dropSide === 'before'"
73
- [class.drag-after]="dragOver && dropSide === 'after'"
74
- draggable="true"
75
- (dragstart)="onDragStart($event)"
76
- (dragover)="onDragOver($event)"
77
- (dragleave)="onDragLeave()"
78
- (drop)="onDrop($event)"
79
- (dragend)="onDragEnd()"
80
- (click)="selectPage.emit(index)"
81
- (contextmenu)="onContextMenu($event)"
82
- >
83
- <img
84
- [src]="displayImageUrl"
85
- class="page-image"
86
- alt="Page Thumbnail"
87
- loading="lazy"
88
- />
89
- <span class="page-number">{{ index + 1 }}</span>
90
- </div>
91
- `, 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:var(--active)}.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:var(--active);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 }] }); }
92
- }
93
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridItemComponent, decorators: [{
94
- type: Component,
95
- args: [{ selector: 'app-page-grid-item', standalone: true, imports: [CommonModule, TranslateModule], template: `
96
- <div
97
- class="page-grid-item"
98
- [class.current]="isCurrent"
99
- [class.drag-before]="dragOver && dropSide === 'before'"
100
- [class.drag-after]="dragOver && dropSide === 'after'"
101
- draggable="true"
102
- (dragstart)="onDragStart($event)"
103
- (dragover)="onDragOver($event)"
104
- (dragleave)="onDragLeave()"
105
- (drop)="onDrop($event)"
106
- (dragend)="onDragEnd()"
107
- (click)="selectPage.emit(index)"
108
- (contextmenu)="onContextMenu($event)"
109
- >
110
- <img
111
- [src]="displayImageUrl"
112
- class="page-image"
113
- alt="Page Thumbnail"
114
- loading="lazy"
115
- />
116
- <span class="page-number">{{ index + 1 }}</span>
117
- </div>
118
- `, 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:var(--active)}.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:var(--active);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"] }]
119
- }], ctorParameters: () => [], propDecorators: { index: [{
120
- type: Input,
121
- args: [{ required: true }]
122
- }], imageUrl: [{
123
- type: Input,
124
- args: [{ required: true }]
125
- }], isCurrent: [{
126
- type: Input
127
- }], selectPage: [{
128
- type: Output
129
- }], dragStarted: [{
130
- type: Output
131
- }], dropped: [{
132
- type: Output
133
- }], contextMenuEvent: [{
134
- type: Output
135
- }] } });
136
-
137
- class PageGridModalComponent {
138
- constructor() {
139
- this.appParams = inject(AppParamsService);
140
- this.assetsService = inject(AssetsService);
141
- this.modalService = inject(ModalService);
142
- this.saveService = inject(SaveService);
143
- this.isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
144
- this.pages = signal([], ...(ngDevMode ? [{ debugName: "pages" }] : []));
145
- this.currentPageIndex = computed(() => {
146
- const guid = this.appParams.pageGuid();
147
- const pages = this.pages();
148
- return pages.findIndex((p) => p.documentPageGuid === guid);
149
- }, ...(ngDevMode ? [{ debugName: "currentPageIndex" }] : []));
150
- this.pageSpreads = computed(() => {
151
- const pagesList = this.pages();
152
- const items = [{ isFake: true }];
153
- pagesList.forEach((p, i) => {
154
- items.push({ ...p, index: i });
155
- });
156
- const chunks = [];
157
- for (let i = 0; i < items.length; i += 2) {
158
- chunks.push(items.slice(i, i + 2));
159
- }
160
- return chunks;
161
- }, ...(ngDevMode ? [{ debugName: "pageSpreads" }] : []));
162
- this.pageCacheBusters = signal({}, ...(ngDevMode ? [{ debugName: "pageCacheBusters" }] : []));
163
- this.sessionBuster = `s=${Date.now()}`;
164
- this.pageImageUrls = computed(() => {
165
- const busters = this.pageCacheBusters();
166
- return this.pages().map((p) => {
167
- const baseUrl = p.publicationTemplateThumbnail || p.publicationTemplateUrl;
168
- if (!baseUrl)
169
- return '';
170
- const guid = p.documentPageGuid;
171
- const buster = busters[guid] || this.sessionBuster;
172
- const separator = baseUrl.includes('?') ? '&' : '?';
173
- return `${baseUrl}${separator}${buster}`;
174
- });
175
- }, ...(ngDevMode ? [{ debugName: "pageImageUrls" }] : []));
176
- this.dragSourceIndex = null;
177
- this.contextMenuVisible = false;
178
- this.contextMenuPosition = { x: 0, y: 0 };
179
- this.contextMenuPageIndex = null;
180
- // Delete confirmation state
181
- this.showDeleteConfirm = signal(false, ...(ngDevMode ? [{ debugName: "showDeleteConfirm" }] : []));
182
- this.deleteIndex = null;
183
- effect(() => {
184
- const params = this.appParams.params();
185
- const docData = params.documentData;
186
- if (docData && Array.isArray(docData)) {
187
- this.pages.set([...docData]);
188
- }
189
- });
190
- effect(() => {
191
- const pulse = this.saveService.saveSuccessPulse();
192
- const pulseCount = typeof pulse === 'object' ? pulse.count : pulse;
193
- const currentPage = this.pages()[this.currentPageIndex()];
194
- if (currentPage && pulseCount > 0) {
195
- const activeGuid = currentPage.documentPageGuid;
196
- this.pageCacheBusters.update((map) => ({
197
- ...map,
198
- [activeGuid]: `t=${pulseCount}`,
199
- }));
200
- }
201
- });
202
- }
203
- ngOnInit() { }
204
- addPage() {
205
- const guid = this.appParams.guid;
206
- if (!guid)
207
- return;
208
- this.isLoading.set(true);
209
- this.assetsService.addDocumentPage(guid).subscribe((newPage) => {
210
- if (newPage) {
211
- this.refreshPages();
212
- }
213
- else {
214
- this.isLoading.set(false);
215
- }
216
- });
217
- }
218
- addPageBefore(index) {
219
- const guid = this.appParams.guid;
220
- if (!guid)
221
- return;
222
- this.isLoading.set(true);
223
- this.assetsService
224
- .addDocumentPage(guid, index + 1)
225
- .subscribe((newPage) => {
226
- if (newPage) {
227
- this.refreshPages();
228
- }
229
- else {
230
- this.isLoading.set(false);
231
- }
232
- });
233
- }
234
- addPageAfter(index) {
235
- const guid = this.appParams.guid;
236
- if (!guid)
237
- return;
238
- this.isLoading.set(true);
239
- this.assetsService
240
- .addDocumentPage(guid, index + 2)
241
- .subscribe((newPage) => {
242
- if (newPage) {
243
- this.refreshPages();
244
- }
245
- else {
246
- this.isLoading.set(false);
247
- }
248
- });
249
- }
250
- duplicatePage(index) {
251
- const guid = this.appParams.guid;
252
- const page = this.pages()[index];
253
- if (!guid || !page)
254
- return;
255
- this.isLoading.set(true);
256
- this.assetsService
257
- .duplicateDocumentPage(guid, page.documentPageGuid)
258
- .subscribe((newPage) => {
259
- if (newPage) {
260
- this.refreshPages();
261
- }
262
- else {
263
- this.isLoading.set(false);
264
- }
265
- });
266
- }
267
- deletePage(index) {
268
- this.deleteIndex = index;
269
- this.showDeleteConfirm.set(true);
270
- }
271
- confirmDelete() {
272
- if (this.deleteIndex === null)
273
- return;
274
- const index = this.deleteIndex;
275
- const page = this.pages()[index];
276
- const guid = this.appParams.guid;
277
- if (!guid || !page) {
278
- this.cancelDelete();
279
- return;
280
- }
281
- this.isLoading.set(true);
282
- this.assetsService
283
- .deleteDocumentPage(guid, page.documentPageGuid)
284
- .subscribe((result) => {
285
- if (result) {
286
- this.refreshPages();
287
- }
288
- else {
289
- this.isLoading.set(false);
290
- }
291
- });
292
- this.cancelDelete();
293
- }
294
- cancelDelete() {
295
- this.showDeleteConfirm.set(false);
296
- this.deleteIndex = null;
297
- }
298
- refreshPages() {
299
- const guid = this.appParams.guid;
300
- if (!guid)
301
- return;
302
- this.assetsService.getSVGDocumentPages(guid).subscribe((response) => {
303
- if (response && response.template) {
304
- this.appParams.setParams({ documentData: [...response.template] });
305
- }
306
- this.isLoading.set(false);
307
- });
308
- }
309
- close() {
310
- this.modalService.close();
311
- }
312
- goToPage(index) {
313
- if (this.onPageSelect) {
314
- this.onPageSelect(index);
315
- }
316
- this.close();
317
- }
318
- onDragStart(index) {
319
- this.dragSourceIndex = index;
320
- }
321
- onDrop(data) {
322
- if (this.dragSourceIndex === null)
323
- return;
324
- const source = this.dragSourceIndex;
325
- let actualTargetIndex = data.targetIndex;
326
- if (data.side === 'after') {
327
- actualTargetIndex++;
328
- }
329
- if (actualTargetIndex === source || actualTargetIndex === source + 1) {
330
- this.dragSourceIndex = null;
331
- return;
332
- }
333
- const guid = this.appParams.guid;
334
- if (!guid)
335
- return;
336
- const previousPages = this.pages();
337
- const draggedPage = previousPages[source];
338
- if (!draggedPage)
339
- return;
340
- const draggedPageGuid = draggedPage.documentPageGuid;
341
- let insertionIndex = actualTargetIndex;
342
- if (source < actualTargetIndex) {
343
- insertionIndex--;
344
- }
345
- const newPageIdForApi = insertionIndex + 1;
346
- // Optimistic reorder
347
- this.pages.update((p) => {
348
- const copy = [...p];
349
- const [moved] = copy.splice(source, 1);
350
- copy.splice(insertionIndex, 0, moved);
351
- return copy;
352
- });
353
- this.isLoading.set(true);
354
- this.assetsService
355
- .moveDocumentPage(guid, draggedPageGuid, newPageIdForApi)
356
- .subscribe({
357
- next: (result) => {
358
- if (result) {
359
- this.refreshPages();
360
- }
361
- else {
362
- this.pages.set(previousPages);
363
- this.isLoading.set(false);
364
- }
365
- },
366
- error: () => {
367
- this.pages.set(previousPages);
368
- this.isLoading.set(false);
369
- },
370
- });
371
- this.dragSourceIndex = null;
372
- }
373
- onPageContextMenu(data) {
374
- this.contextMenuPosition = { x: data.event.clientX, y: data.event.clientY };
375
- this.contextMenuPageIndex = data.index;
376
- this.contextMenuVisible = true;
377
- }
378
- onContextMenuAction(event) {
379
- switch (event.action) {
380
- case 'open':
381
- this.goToPage(event.index);
382
- break;
383
- case 'insert-before':
384
- this.addPageBefore(event.index);
385
- break;
386
- case 'insert-after':
387
- this.addPageAfter(event.index);
388
- break;
389
- case 'duplicate':
390
- this.duplicatePage(event.index);
391
- break;
392
- case 'delete':
393
- this.deletePage(event.index);
394
- break;
395
- }
396
- this.contextMenuVisible = false;
397
- }
398
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
399
- 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: `
400
- <div id="page-grid-backdrop" (click)="close()">
401
- <div id="page-grid" (click)="$event.stopPropagation()">
402
- <div id="page-grid-title">
403
- <span id="icon-page-grid" class="icon">
404
- <svg
405
- width="24"
406
- height="24"
407
- viewBox="0 0 24 24"
408
- fill="none"
409
- xmlns="http://www.w3.org/2000/svg"
410
- >
411
- <rect x="3" y="3" width="5" height="5" fill="var(--white)" />
412
- <rect x="9.5" y="3" width="5" height="5" fill="var(--white)" />
413
- <rect x="16" y="3" width="5" height="5" fill="var(--white)" />
414
- <rect x="3" y="9.5" width="5" height="5" fill="var(--white)" />
415
- <rect x="9.5" y="9.5" width="5" height="5" fill="var(--white)" />
416
- <rect x="16" y="9.5" width="5" height="5" fill="var(--white)" />
417
- <rect x="3" y="16" width="5" height="5" fill="var(--white)" />
418
- <rect x="9.5" y="16" width="5" height="5" fill="var(--white)" />
419
- <rect x="16" y="16" width="5" height="5" fill="var(--white)" />
420
- </svg>
421
- </span>
422
- <span id="title-page-grid">{{
423
- 'GLOBAL.PAGES.GRID_VIEW' | translate
424
- }}</span>
425
- <button id="close-page-grid" class="close-btn" (click)="close()">
426
- ×
427
- </button>
428
- </div>
429
-
430
- <div class="page-grid-content">
431
- @for (spread of pageSpreads(); track spread; let sIndex = $index) {
432
- <div class="page-spread">
433
- @for (item of spread; track item) {
434
- @if (item.isFake) {
435
- <div class="page-grid-fake-item"></div>
436
- } @else {
437
- <app-page-grid-item
438
- [index]="item.index"
439
- [imageUrl]="pageImageUrls()[item.index]"
440
- [isCurrent]="item.index === currentPageIndex()"
441
- (selectPage)="goToPage($event)"
442
- (dragStarted)="onDragStart($event)"
443
- (dropped)="onDrop($event)"
444
- (contextMenuEvent)="onPageContextMenu($event)"
445
- ></app-page-grid-item>
446
- }
447
- }
448
- </div>
449
- }
450
-
451
- <!-- Add page card -->
452
- <div class="page-grid-item-add" (click)="addPage()">
453
- <div class="page-grid-item-add-page">
454
- <svg
455
- width="48"
456
- height="48"
457
- viewBox="0 0 24 24"
458
- fill="none"
459
- xmlns="http://www.w3.org/2000/svg"
460
- >
461
- <line
462
- x1="12"
463
- y1="5"
464
- x2="12"
465
- y2="19"
466
- stroke="var(--gray-1)"
467
- stroke-width="2"
468
- stroke-linecap="round"
469
- />
470
- <line
471
- x1="5"
472
- y1="12"
473
- x2="19"
474
- y2="12"
475
- stroke="var(--gray-1)"
476
- stroke-width="2"
477
- stroke-linecap="round"
478
- />
479
- </svg>
480
- </div>
481
- <span class="page-number">{{
482
- 'GLOBAL.PAGES.ADD_PAGE' | translate
483
- }}</span>
484
- </div>
485
- </div>
486
- </div>
487
-
488
- <!-- Full screen loader -->
489
- @if (isLoading()) {
490
- <div class="page-grid-loader">
491
- <div class="spinner"></div>
492
- </div>
493
- }
494
- </div>
495
-
496
- <app-page-context-menu
497
- [visible]="contextMenuVisible"
498
- [position]="contextMenuPosition"
499
- [pageIndex]="contextMenuPageIndex"
500
- [isCurrentPage]="contextMenuPageIndex === currentPageIndex()"
501
- (action)="onContextMenuAction($event)"
502
- (closeMenu)="contextMenuVisible = false"
503
- ></app-page-context-menu>
504
-
505
- <!-- Delete Confirmation Modal -->
506
- @if (showDeleteConfirm()) {
507
- <app-confirm-delete-modal
508
- (confirm)="confirmDelete()"
509
- (cancel)="cancelDelete()"
510
- ></app-confirm-delete-modal>
511
- }
512
- `, 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}#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"], outputs: ["selectPage", "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: ["message"], outputs: ["confirm", "cancel"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
513
- }
514
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PageGridModalComponent, decorators: [{
515
- type: Component,
516
- args: [{ selector: 'app-page-grid-modal', standalone: true, imports: [
517
- CommonModule,
518
- TranslateModule,
519
- PageGridItemComponent,
520
- PageContextMenuComponent,
521
- ConfirmDeleteModalComponent,
522
- ], template: `
523
- <div id="page-grid-backdrop" (click)="close()">
524
- <div id="page-grid" (click)="$event.stopPropagation()">
525
- <div id="page-grid-title">
526
- <span id="icon-page-grid" class="icon">
527
- <svg
528
- width="24"
529
- height="24"
530
- viewBox="0 0 24 24"
531
- fill="none"
532
- xmlns="http://www.w3.org/2000/svg"
533
- >
534
- <rect x="3" y="3" width="5" height="5" fill="var(--white)" />
535
- <rect x="9.5" y="3" width="5" height="5" fill="var(--white)" />
536
- <rect x="16" y="3" width="5" height="5" fill="var(--white)" />
537
- <rect x="3" y="9.5" width="5" height="5" fill="var(--white)" />
538
- <rect x="9.5" y="9.5" width="5" height="5" fill="var(--white)" />
539
- <rect x="16" y="9.5" width="5" height="5" fill="var(--white)" />
540
- <rect x="3" y="16" width="5" height="5" fill="var(--white)" />
541
- <rect x="9.5" y="16" width="5" height="5" fill="var(--white)" />
542
- <rect x="16" y="16" width="5" height="5" fill="var(--white)" />
543
- </svg>
544
- </span>
545
- <span id="title-page-grid">{{
546
- 'GLOBAL.PAGES.GRID_VIEW' | translate
547
- }}</span>
548
- <button id="close-page-grid" class="close-btn" (click)="close()">
549
- ×
550
- </button>
551
- </div>
552
-
553
- <div class="page-grid-content">
554
- @for (spread of pageSpreads(); track spread; let sIndex = $index) {
555
- <div class="page-spread">
556
- @for (item of spread; track item) {
557
- @if (item.isFake) {
558
- <div class="page-grid-fake-item"></div>
559
- } @else {
560
- <app-page-grid-item
561
- [index]="item.index"
562
- [imageUrl]="pageImageUrls()[item.index]"
563
- [isCurrent]="item.index === currentPageIndex()"
564
- (selectPage)="goToPage($event)"
565
- (dragStarted)="onDragStart($event)"
566
- (dropped)="onDrop($event)"
567
- (contextMenuEvent)="onPageContextMenu($event)"
568
- ></app-page-grid-item>
569
- }
570
- }
571
- </div>
572
- }
573
-
574
- <!-- Add page card -->
575
- <div class="page-grid-item-add" (click)="addPage()">
576
- <div class="page-grid-item-add-page">
577
- <svg
578
- width="48"
579
- height="48"
580
- viewBox="0 0 24 24"
581
- fill="none"
582
- xmlns="http://www.w3.org/2000/svg"
583
- >
584
- <line
585
- x1="12"
586
- y1="5"
587
- x2="12"
588
- y2="19"
589
- stroke="var(--gray-1)"
590
- stroke-width="2"
591
- stroke-linecap="round"
592
- />
593
- <line
594
- x1="5"
595
- y1="12"
596
- x2="19"
597
- y2="12"
598
- stroke="var(--gray-1)"
599
- stroke-width="2"
600
- stroke-linecap="round"
601
- />
602
- </svg>
603
- </div>
604
- <span class="page-number">{{
605
- 'GLOBAL.PAGES.ADD_PAGE' | translate
606
- }}</span>
607
- </div>
608
- </div>
609
- </div>
610
-
611
- <!-- Full screen loader -->
612
- @if (isLoading()) {
613
- <div class="page-grid-loader">
614
- <div class="spinner"></div>
615
- </div>
616
- }
617
- </div>
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
- (confirm)="confirmDelete()"
632
- (cancel)="cancelDelete()"
633
- ></app-confirm-delete-modal>
634
- }
635
- `, 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}#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"] }]
636
- }], ctorParameters: () => [], propDecorators: { onPageSelect: [{
637
- type: Input
638
- }] } });
639
-
640
- export { PageGridModalComponent };
641
- //# sourceMappingURL=solidpepper-solidpepper-soliddesigner-page-grid-modal.component-DLRf7wT0.mjs.map