@solidpepper/solidpepper-solidgeneration 0.1.7 → 0.1.8

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/index.d.ts CHANGED
@@ -1,3 +1,11 @@
1
+ import * as _solidpepper_solidpepper_service from '@solidpepper/solidpepper-service';
2
+ import { PublicationTemplate, PublicationsService, DamAssetsService, DocumentsService, PublicationPage, PublicationData, GenerationService, PricesTaxService, AttributesService, TemplatesService, PublicationsTemplatesService, NotificationServiceService, Template } from '@solidpepper/solidpepper-service';
3
+ import { HttpClient } from '@angular/common/http';
4
+ import { ToastrService } from 'ngx-toastr';
5
+ import { TranslateService } from '@ngx-translate/core';
6
+ import { DomSanitizer } from '@angular/platform-browser';
7
+ import * as i0 from '@angular/core';
8
+
1
9
  declare enum SourceData {
2
10
  All = 1,
3
11
  Publication = 2,
@@ -12,6 +20,7 @@ declare enum TypeDatasheet {
12
20
  }
13
21
  declare class DataSheet {
14
22
  previewId: number;
23
+ versionName: string | null;
15
24
  sourceData: SourceData;
16
25
  typeOfDataSheet: TypeDatasheet;
17
26
  language: string;
@@ -52,15 +61,16 @@ declare class DataSheet {
52
61
  backgroundVariation: boolean;
53
62
  backgroundVariationColor: string;
54
63
  hideEmptyCells: boolean;
55
- publicationTemplateTemplateId: number;
64
+ publicationTemplateTemplateGuid: string | null;
65
+ productSheetGuid: string | null;
56
66
  currentWidth: number;
57
67
  lastGabaritHeight: number;
58
68
  pricesListCurrency: string;
59
- gabarits: never[];
60
- defaultGabaritGuid: null;
61
- backgrounds: never[];
62
- defaultBackgroundGuid: null;
63
- marketing: never[];
69
+ gabarits: PublicationTemplate[];
70
+ defaultGabaritGuid: string | null;
71
+ backgrounds: PublicationTemplate[];
72
+ defaultBackgroundGuid: string | null;
73
+ marketing: PublicationTemplate[];
64
74
  preview: boolean;
65
75
  imageFastPreview: boolean;
66
76
  bleedMargin: boolean;
@@ -120,6 +130,7 @@ declare class DataSheetSVG {
120
130
  sectionId: string;
121
131
  svg: string;
122
132
  }[] | null>;
133
+ private getBlockDimensionsAndMargins;
123
134
  private GenerateProductBlock;
124
135
  GenerateOnlyProductBlock(publicationTemplateString: any, publicationTemplateVariantTableSetting: any, templateGuid: string, publicationTemplateGuid: string, productData: any, xStart?: number, yStart?: number, keepAttributes?: boolean): Promise<{
125
136
  groupString: string;
@@ -128,6 +139,8 @@ declare class DataSheetSVG {
128
139
  } | null>;
129
140
  LoadAttributesIfEmpty(): Promise<void>;
130
141
  RemoveUnwantedSVGTags(svgContent: string): string;
142
+ private getAttributeFromSvg;
143
+ private wrapTemplateGroup;
131
144
  CleanMissingFilters(svgContent: string): string;
132
145
  RemoveUnwantedSVGTagsOld(svgContent: string): string;
133
146
  ChangeAllIdsGroup(tplGroup: any, count: number): any;
@@ -137,7 +150,7 @@ declare class DataSheetSVG {
137
150
  ChangeAllYBisOld(tplGroup: any, blockHeight: number): any;
138
151
  CleanHtmlAttributesBeforeParsing(html: string): string;
139
152
  NormalizeHTML(str: string): string;
140
- GetAllTags(svgString?: string): Element[] | null;
153
+ GetAllTags(svgString?: string | null): Element[] | null;
141
154
  CleanDuplicateViewBox(svgString: string): string;
142
155
  SetAllInfos(element: any): any;
143
156
  parseCellTemplates(td: HTMLElement): {
@@ -182,13 +195,14 @@ declare class DataSheetSVG {
182
195
  GetSvgGroupToReplace(svg: any): any;
183
196
  delay(ms?: number): Promise<unknown>;
184
197
  ReplaceFieldsTemplateSVG(jRowSku: any, tpl: any, allTags: any, allBlocksHeight?: number, nbBlockInRow?: number, keepAttributes?: boolean): Promise<any>;
198
+ optimizeTextElement(foEl: any, tpl?: string): void;
185
199
  optimizeProductTable(foEl: any, tpl?: string): {
186
200
  width: number;
187
201
  height: number;
188
202
  };
189
203
  deleteBlock(svg: any): Promise<any>;
190
204
  deleteLine(svg: any): Promise<any>;
191
- getBackgroundSectionForPreview(section: any): any;
205
+ getBackgroundSectionForPreview(section: any): _solidpepper_solidpepper_service.PublicationTemplate;
192
206
  getMarketingSectionForPreview(section: any): any;
193
207
  getCleanedSVGString(svg: string, soft?: boolean): Promise<string | undefined>;
194
208
  selfCloseImgTags(svg: string): string;
@@ -208,8 +222,9 @@ declare class DataSheetSVG {
208
222
  GetTagUrl(tag: any, jRowSku: any, keepAttributes?: boolean): string | null;
209
223
  addCuttingLine(): string;
210
224
  createLineSVG(x0: number, y0: number, x1: number, y1: number): string;
211
- keepOnlySideRegex(svg: string, sideToKeep: string): string;
225
+ keepOnlySideRegex(svg: string | null, sideToKeep: string): string | null;
212
226
  applyTextTransform(val: any, transform: string | null): any;
227
+ resolveAnchors(domSVG: Document, originalTpl: string): void;
213
228
  }
214
229
 
215
230
  declare class DataSheetSingleton {
@@ -218,12 +233,118 @@ declare class DataSheetSingleton {
218
233
  fields: any[];
219
234
  token: string;
220
235
  apiUrl: string;
236
+ instanceId: number;
237
+ gabarits: {
238
+ [templateGuid: string]: PublicationTemplate[];
239
+ };
240
+ backgrounds: {
241
+ [templateGuid: string]: PublicationTemplate[];
242
+ };
243
+ marketing: {
244
+ [templateGuid: string]: PublicationTemplate[];
245
+ };
221
246
  private constructor();
222
247
  static getInstance(): DataSheetSingleton;
248
+ getGabarits(templateGuid: string): PublicationTemplate[] | null;
249
+ setGabarits(templateGuid: string, list: PublicationTemplate[]): void;
250
+ getBackgrounds(templateGuid: string): PublicationTemplate[] | null;
251
+ setBackgrounds(templateGuid: string, list: PublicationTemplate[]): void;
252
+ getMarketing(templateGuid: string): PublicationTemplate[] | null;
253
+ setMarketing(templateGuid: string, list: PublicationTemplate[]): void;
254
+ clearTemplatesCache(templateGuid?: string): void;
223
255
  private getAttributesByType;
224
256
  private getFields;
225
257
  loadAttributes(): Promise<any[]>;
226
258
  destroy(): void;
227
259
  }
228
260
 
229
- export { DataSheet, DataSheetSVG, DataSheetSingleton, SourceData, TypeDatasheet };
261
+ declare class DataSheetSku {
262
+ publicationsService?: PublicationsService;
263
+ DataSheetSVG: DataSheetSVG;
264
+ DataSheet: DataSheet;
265
+ languagePreviewSelected: string;
266
+ publication: any;
267
+ sectionActiveObject: any;
268
+ skusSection: any[];
269
+ skusSectionPreview: any[];
270
+ constructor(dataSheetSVG: DataSheetSVG, dataSheet: DataSheet);
271
+ setPublicationsService(publicationsService: PublicationsService): Promise<void>;
272
+ GenerateAllInOneExportFile(sourceId: any, option1PerPage: any, displayModeVariant: any, multiColumns?: boolean): Promise<any>;
273
+ }
274
+
275
+ declare class DataSheetPublication {
276
+ publicationsService?: PublicationsService;
277
+ damAssetsService?: DamAssetsService;
278
+ documentsService?: DocumentsService;
279
+ DataSheetSVG: DataSheetSVG;
280
+ DataSheet: DataSheet;
281
+ languagePreviewSelected: string;
282
+ publication: any;
283
+ sectionActiveObject: PublicationPage | null;
284
+ skusSection: PublicationData[];
285
+ skusSectionPreview: PublicationData[];
286
+ constructor(dataSheetSVG: DataSheetSVG, dataSheet: DataSheet, publication?: any, sectionActiveObject?: PublicationPage | null, skusSection?: PublicationData[]);
287
+ setPublicationsService(publicationsService: PublicationsService): Promise<void>;
288
+ setDamAssetsService(damAssetsService: DamAssetsService): Promise<void>;
289
+ setDocumentsService(documentsService: DocumentsService): Promise<void>;
290
+ GenerateAllInOneExportFile(sourceId: any, option1PerPage: any, displayModeVariant: any, multiColumns?: boolean): Promise<any>;
291
+ }
292
+
293
+ declare class DataSheetController {
294
+ private readonly http;
295
+ private readonly _generationService;
296
+ private readonly _publicationsService;
297
+ private readonly _priceListService;
298
+ private readonly _attributes;
299
+ private readonly _templates;
300
+ private readonly _publicationsTemplates;
301
+ private readonly _toastr;
302
+ private readonly _notificationService;
303
+ private readonly tr;
304
+ private readonly sanitizer;
305
+ private readonly _damAssets;
306
+ private readonly _documents;
307
+ generations: any[];
308
+ numGenerations: number;
309
+ pricesListAvailable: never[];
310
+ translate: any;
311
+ datasheetPreview: DataSheet | null;
312
+ currentPreviewId: number;
313
+ constructor(http: HttpClient, _generationService: GenerationService, _publicationsService: PublicationsService, _priceListService: PricesTaxService, _attributes: AttributesService, _templates: TemplatesService, _publicationsTemplates: PublicationsTemplatesService, _toastr: ToastrService, _notificationService: NotificationServiceService, tr: TranslateService, sanitizer: DomSanitizer, _damAssets: DamAssetsService, _documents: DocumentsService);
314
+ GenerateSVG(request: any): Promise<any>;
315
+ forceArialFont(svgString: string): string;
316
+ getPricesListAvailable(datasheet: DataSheet): Promise<DataSheet>;
317
+ getTemplateInfo(templateGuid: string): Promise<Template | null>;
318
+ updateGabaritsList(templateGuid: string, forceRefresh?: boolean): Promise<PublicationTemplate[]>;
319
+ updateBackgroundsList(templateGuid: string, forceRefresh?: boolean): Promise<PublicationTemplate[]>;
320
+ updateMarketingList(templateGuid: string, forceRefresh?: boolean): Promise<PublicationTemplate[]>;
321
+ loadGabaritsSvg(gabarits: PublicationTemplate[]): Promise<PublicationTemplate[]>;
322
+ loadBackgroundsSvg(backgrounds: PublicationTemplate[]): Promise<PublicationTemplate[]>;
323
+ loadMarketingSvg(marketing: PublicationTemplate[]): Promise<PublicationTemplate[]>;
324
+ static ɵfac: i0.ɵɵFactoryDeclaration<DataSheetController, never>;
325
+ static ɵprov: i0.ɵɵInjectableDeclaration<DataSheetController>;
326
+ }
327
+
328
+ interface BlockPreview {
329
+ x: number;
330
+ y: number;
331
+ width: number;
332
+ height: number;
333
+ }
334
+ interface SimulationResult {
335
+ blocksPerRow: number;
336
+ blocksPerColumn: number;
337
+ blocks: BlockPreview[];
338
+ }
339
+ /**
340
+ * Calculates the size (width or height) of a product block when layed out in a grid.
341
+ */
342
+ declare function calculateBlockDimension(pageSize: number, pageMarginStart: number, pageMarginEnd: number, gap: number, blocksCount: number, isWidth?: boolean): number;
343
+ /**
344
+ * Simulates a product block grid layout and returns coordinates of each block.
345
+ * Coordinates and fitting logic match the physical page constraints, respecting margins.
346
+ */
347
+ declare function simulateProductBlocks(pageWidth: number, pageHeight: number, pageMarginTop: number, pageMarginBottom: number, pageMarginLeft: number, pageMarginRight: number, blockWidth: number, blockHeight: number, verticalGap: number, horizontalGap: number): SimulationResult;
348
+
349
+ export { DataSheet, DataSheetController, DataSheetPublication, DataSheetSVG, DataSheetSingleton, DataSheetSku, SourceData, TypeDatasheet, calculateBlockDimension, simulateProductBlocks };
350
+ export type { BlockPreview, SimulationResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidpepper/solidpepper-solidgeneration",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Solidpepper - generation service",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^20.1.6",