ngx-smz-ui 3.4.21 → 3.5.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 (28) hide show
  1. package/bundles/ngx-smz-ui.umd.js +200 -56
  2. package/bundles/ngx-smz-ui.umd.js.map +1 -1
  3. package/esm2015/lib/builders/common/smz-conditional-builder.js +35 -0
  4. package/esm2015/lib/builders/smz-dialogs/dialog-builder.js +4 -4
  5. package/esm2015/lib/builders/smz-documents/document-base-cell.js +4 -2
  6. package/esm2015/lib/builders/smz-documents/document-builder.js +35 -2
  7. package/esm2015/lib/builders/smz-documents/document-content.js +4 -2
  8. package/esm2015/lib/builders/smz-documents/document-viewer.js +48 -0
  9. package/esm2015/lib/modules/smz-dialogs/features/document-content/document-content.component.js +1 -1
  10. package/esm2015/lib/modules/smz-documents/features/document-viewer/document-viewer.component.js +8 -28
  11. package/esm2015/lib/modules/smz-documents/models/smz-document-config.js +1 -1
  12. package/esm2015/lib/modules/smz-documents/models/smz-document-viewer.js +2 -0
  13. package/esm2015/lib/modules/smz-documents/models/smz-document.js +1 -1
  14. package/esm2015/lib/modules/smz-documents/services/smz-documents.service.js +38 -6
  15. package/fesm2015/ngx-smz-ui.js +165 -40
  16. package/fesm2015/ngx-smz-ui.js.map +1 -1
  17. package/lib/builders/common/smz-conditional-builder.d.ts +8 -0
  18. package/lib/builders/smz-dialogs/dialog-builder.d.ts +4 -2
  19. package/lib/builders/smz-documents/document-base-cell.d.ts +2 -1
  20. package/lib/builders/smz-documents/document-builder.d.ts +4 -1
  21. package/lib/builders/smz-documents/document-content.d.ts +2 -1
  22. package/lib/builders/smz-documents/document-viewer.d.ts +17 -0
  23. package/lib/modules/smz-documents/features/document-viewer/document-viewer.component.d.ts +3 -8
  24. package/lib/modules/smz-documents/models/smz-document-config.d.ts +4 -0
  25. package/lib/modules/smz-documents/models/smz-document-viewer.d.ts +25 -0
  26. package/lib/modules/smz-documents/models/smz-document.d.ts +2 -0
  27. package/lib/modules/smz-documents/services/smz-documents.service.d.ts +13 -2
  28. package/package.json +1 -1
@@ -9263,15 +9263,47 @@
9263
9263
  ApplicationActions.SetLogApplicationAreaAndExtraData = SetLogApplicationAreaAndExtraData;
9264
9264
  })(exports.ApplicationActions || (exports.ApplicationActions = {}));
9265
9265
 
9266
- var INITIAL_ZOOM$1 = 1;
9266
+ var INITIAL_ZOOM = 1;
9267
9267
  var SmzDocumentsService = /** @class */ (function () {
9268
- function SmzDocumentsService() {
9269
- this.zoom = INITIAL_ZOOM$1;
9270
- this.zoom = INITIAL_ZOOM$1;
9268
+ function SmzDocumentsService(store) {
9269
+ this.store = store;
9270
+ this.zoom = INITIAL_ZOOM;
9271
+ this.filename = 'sample';
9272
+ this.zoom = INITIAL_ZOOM;
9271
9273
  this.showDownloadControl = true;
9272
9274
  this.showExportControl = true;
9273
9275
  }
9276
+ SmzDocumentsService.prototype.setZoom = function (zoom) {
9277
+ this.zoom = zoom;
9278
+ };
9279
+ SmzDocumentsService.prototype.setFilename = function (filename) {
9280
+ this.filename = filename;
9281
+ };
9282
+ SmzDocumentsService.prototype.setState = function (state) {
9283
+ this.state = state;
9284
+ };
9285
+ SmzDocumentsService.prototype.generate = function (action, element) {
9286
+ var _this = this;
9287
+ this.store.dispatch(new exports.ApplicationActions.StartGlobalLoading());
9288
+ setTimeout(function () {
9289
+ _this.generatePdf(action, element, _this.state).then(function () {
9290
+ _this.store.dispatch(new exports.ApplicationActions.StopGlobalLoading());
9291
+ });
9292
+ }, 0);
9293
+ };
9294
+ SmzDocumentsService.prototype.moreZoom = function () {
9295
+ var next = this.zoom + this.state.viewer.zoom.variation;
9296
+ this.setZoom(next <= this.state.viewer.zoom.max ? next : this.state.viewer.zoom.max);
9297
+ };
9298
+ SmzDocumentsService.prototype.lessZoom = function () {
9299
+ var next = this.zoom - this.state.viewer.zoom.variation;
9300
+ this.setZoom(next >= this.state.viewer.zoom.min ? next : this.state.viewer.zoom.min);
9301
+ };
9302
+ SmzDocumentsService.prototype.restoreZoom = function () {
9303
+ this.setZoom(this.state.viewer.zoom.initial);
9304
+ };
9274
9305
  SmzDocumentsService.prototype.generatePdf = function (action, element, state) {
9306
+ var _this = this;
9275
9307
  return new Promise(function (resolve) {
9276
9308
  var docOptions = {
9277
9309
  orientation: 'portrait',
@@ -9303,13 +9335,13 @@
9303
9335
  doc.html(element.nativeElement, options).then(function () {
9304
9336
  switch (action) {
9305
9337
  case 'open': {
9306
- doc.output('dataurlnewwindow', { filename: 'teste.pdf' });
9338
+ doc.output('dataurlnewwindow', { filename: _this.filename + ".pdf" });
9307
9339
  resolve('Resolved');
9308
9340
  break;
9309
9341
  }
9310
9342
  // case 'print': this.pdfMakeService.pdfMake.createPdf(document).print(); break;
9311
9343
  case 'download': {
9312
- var saving = doc.save('teste.pdf', { returnPromise: true });
9344
+ var saving = doc.save(_this.filename + ".pdf", { returnPromise: true });
9313
9345
  saving.then(function () {
9314
9346
  resolve('Resolved');
9315
9347
  });
@@ -9321,18 +9353,14 @@
9321
9353
  };
9322
9354
  return SmzDocumentsService;
9323
9355
  }());
9324
- SmzDocumentsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentsService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
9356
+ SmzDocumentsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentsService, deps: [{ token: i1__namespace$4.Store }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
9325
9357
  SmzDocumentsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentsService, providedIn: 'root' });
9326
9358
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentsService, decorators: [{
9327
9359
  type: i0.Injectable,
9328
9360
  args: [{ providedIn: 'root' }]
9329
- }], ctorParameters: function () { return []; } });
9361
+ }], ctorParameters: function () { return [{ type: i1__namespace$4.Store }]; } });
9330
9362
 
9331
9363
  var moment$1 = moment___namespace;
9332
- var MAX_ZOOM = 2.5;
9333
- var MIN_ZOOM = 1;
9334
- var ZOOM_VARIATION = MAX_ZOOM / 5;
9335
- var INITIAL_ZOOM = MIN_ZOOM;
9336
9364
  var SmzDocumentViewerComponent = /** @class */ (function () {
9337
9365
  function SmzDocumentViewerComponent(el, documentService, location, cdf, store, renderer) {
9338
9366
  this.el = el;
@@ -9341,41 +9369,25 @@
9341
9369
  this.cdf = cdf;
9342
9370
  this.store = store;
9343
9371
  this.renderer = renderer;
9344
- this.maxZoom = MAX_ZOOM;
9345
- this.minZoom = MIN_ZOOM;
9346
9372
  this.now = moment$1().format('MMMM Do YYYY, h:mm:ss a');
9347
9373
  }
9348
9374
  SmzDocumentViewerComponent.prototype.ngOnInit = function () {
9375
+ this.documentService.setZoom(this.state.viewer.zoom.initial);
9376
+ this.documentService.setFilename(this.state.viewer.filename);
9377
+ this.documentService.setState(this.state);
9349
9378
  };
9350
9379
  SmzDocumentViewerComponent.prototype.ngAfterViewInit = function () {
9351
9380
  };
9352
- SmzDocumentViewerComponent.prototype.generate = function (action, element) {
9353
- var _this = this;
9354
- this.store.dispatch(new exports.ApplicationActions.StartGlobalLoading());
9355
- setTimeout(function () {
9356
- _this.documentService.generatePdf(action, element, _this.state).then(function () {
9357
- _this.store.dispatch(new exports.ApplicationActions.StopGlobalLoading());
9358
- });
9359
- }, 0);
9360
- };
9361
- SmzDocumentViewerComponent.prototype.moreZoom = function () {
9362
- var next = this.documentService.zoom + ZOOM_VARIATION;
9363
- this.documentService.zoom = next <= MAX_ZOOM ? next : MAX_ZOOM;
9364
- };
9365
- SmzDocumentViewerComponent.prototype.lessZoom = function () {
9366
- var next = this.documentService.zoom - ZOOM_VARIATION;
9367
- this.documentService.zoom = next >= MIN_ZOOM ? next : MIN_ZOOM;
9368
- };
9369
- SmzDocumentViewerComponent.prototype.restoreZoom = function () {
9370
- this.documentService.zoom = INITIAL_ZOOM;
9371
- };
9372
9381
  SmzDocumentViewerComponent.prototype.goBack = function () {
9373
9382
  this.location.back();
9374
9383
  };
9384
+ SmzDocumentViewerComponent.prototype.ngOnDestroy = function () {
9385
+ this.documentService.setState(null);
9386
+ };
9375
9387
  return SmzDocumentViewerComponent;
9376
9388
  }());
9377
9389
  SmzDocumentViewerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentViewerComponent, deps: [{ token: i0__namespace.ElementRef }, { token: SmzDocumentsService }, { token: i1__namespace.Location }, { token: i0__namespace.ChangeDetectorRef }, { token: i1__namespace$4.Store }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Component });
9378
- SmzDocumentViewerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.5", type: SmzDocumentViewerComponent, selector: "document-viewer", inputs: { state: "state" }, viewQueries: [{ propertyName: "paperElement", first: true, predicate: ["paper"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div class=\"p-grid p-nogutter p-align-center p-justify-start p-flex-column gap-2\">\n\n <div class=\"p-grid p-nogutter p-align-start p-justify-start gap-2\">\n <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"ZOOM -\" (click)=\"lessZoom()\"></button>\n <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"100%\" (click)=\"restoreZoom()\"></button>\n <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"ZOOM +\" (click)=\"moreZoom()\"></button>\n\n <button pButton type=\"button\" class=\"p-button p-button-success\" label=\"OPEN\" [disabled]=\"true\" (click)=\"generate('open', paperElement)\"></button>\n <button pButton type=\"button\" class=\"p-button p-button-success\" label=\"PRINT\" [disabled]=\"true\" (click)=\"generate('print', paperElement)\"></button>\n <button pButton type=\"button\" class=\"p-button p-button-success\" label=\"DOWNLOAD\" (click)=\"generate('download', paperElement)\"></button>\n </div>\n\n <div class=\"pager\" [ngStyle]=\"{ 'transform': 'scale(' + documentService.zoom + ')' }\">\n <div #paper [ngStyle]=\"{ 'font-family': state.globals.font.family }\">\n <ng-content select=\"header\"></ng-content>\n <ng-content select=\"content\"></ng-content>\n </div>\n </div>\n\n</div>", styles: [".pager{width:595.276pt;background:white;transform-origin:top center;transition:transform .1s ease-in-out;padding:20px;margin-top:0;margin-left:auto;margin-right:auto;box-shadow:0 5.8px 5.8px #0000000e,0 16.2px 16.2px #00000014,0 38.9px 38.9px #0000001b,0 129px 129px #00000029;border:1px #fff solid}.footer-container{position:absolute;bottom:calc(.5 * 28.346px);right:calc(.8 * 28.346px);font-size:\"0.8px\"}.sticky-header{position:absolute}\n"], directives: [{ type: i6__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i1__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.Default, encapsulation: i0__namespace.ViewEncapsulation.None });
9390
+ SmzDocumentViewerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.5", type: SmzDocumentViewerComponent, selector: "document-viewer", inputs: { state: "state" }, viewQueries: [{ propertyName: "paperElement", first: true, predicate: ["paper"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div class=\"p-grid p-nogutter p-align-center p-justify-start p-flex-column gap-2\" [ngClass]=\"state.viewer.container.styleClass\">\n\n <div class=\"p-grid p-nogutter p-align-start p-justify-start gap-2\">\n\n <ng-container *ngIf=\"state.viewer.zoom.isEnabled\">\n <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"ZOOM -\" (click)=\"documentService.lessZoom()\"></button>\n <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"100%\" (click)=\"documentService.restoreZoom()\"></button>\n <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"ZOOM +\" (click)=\"documentService.moreZoom()\"></button>\n </ng-container>\n\n <button *ngIf=\"state.viewer.open.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" label=\"OPEN\" (click)=\"documentService.generate('open', paperElement)\"></button>\n <button *ngIf=\"state.viewer.print.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" label=\"PRINT\" (click)=\"documentService.generate('print', paperElement)\"></button>\n <button *ngIf=\"state.viewer.download.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" label=\"DOWNLOAD\" (click)=\"documentService.generate('download', paperElement)\"></button>\n </div>\n\n <div class=\"pager\" [ngClass]=\"state.viewer.paper.styleClass\"[ngStyle]=\"{ 'transform': 'scale(' + documentService.zoom + ')' }\">\n <div #paper [ngStyle]=\"{ 'font-family': state.globals.font.family }\">\n <ng-content select=\"header\"></ng-content>\n <ng-content select=\"content\"></ng-content>\n </div>\n </div>\n\n</div>", styles: [".pager{width:595.276pt;transform-origin:top center;transition:transform .1s ease-in-out;margin-top:0;margin-left:auto;margin-right:auto}.footer-container{position:absolute;bottom:calc(.5 * 28.346px);right:calc(.8 * 28.346px);font-size:\"0.8px\"}.sticky-header{position:absolute}\n"], directives: [{ type: i1__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i1__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.Default, encapsulation: i0__namespace.ViewEncapsulation.None });
9379
9391
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentViewerComponent, decorators: [{
9380
9392
  type: i0.Component,
9381
9393
  args: [{
@@ -12708,7 +12720,7 @@
12708
12720
  return this;
12709
12721
  };
12710
12722
  SmzDialogBuilder.prototype.table = function (items$, state) {
12711
- var data = { items$: items$, state: state }; // any = SmzDialogTable
12723
+ var data = { items$: items$, state: state };
12712
12724
  var feature = {
12713
12725
  type: 'table',
12714
12726
  data: data
@@ -12716,8 +12728,8 @@
12716
12728
  this._state.features.push(feature);
12717
12729
  return this;
12718
12730
  };
12719
- SmzDialogBuilder.prototype.document = function (items$, state) {
12720
- var data = { items$: items$, state: state }; // any = SmzDialogTable
12731
+ SmzDialogBuilder.prototype.document = function (state) {
12732
+ var data = { state: state };
12721
12733
  var feature = {
12722
12734
  type: 'document',
12723
12735
  data: data
@@ -23705,12 +23717,54 @@
23705
23717
  * Public API Surface of ngx-rbk-utils
23706
23718
  */
23707
23719
 
23708
- var SmzDocumentBaseCellBuilder = /** @class */ (function () {
23720
+ var SmzConditionalBuilder = /** @class */ (function () {
23721
+ function SmzConditionalBuilder() {
23722
+ }
23723
+ SmzConditionalBuilder.prototype.if = function (condition) {
23724
+ if (this._currentConditionMethod != null)
23725
+ throw new Error("You cannot call more than one condition method at the same time.");
23726
+ // Registrando flag de method condicional em execução
23727
+ this._currentConditionMethod = 'if';
23728
+ // Se a condição for nula
23729
+ if (!condition) {
23730
+ // Preparar modelo de backup para o endif retornar dados originais descartando todos os dados feitos pelos builders entre o IF e o ENDIF
23731
+ this.backup = cloneDeep__default["default"](this.that);
23732
+ }
23733
+ return this.that;
23734
+ };
23735
+ Object.defineProperty(SmzConditionalBuilder.prototype, "endIf", {
23736
+ get: function () {
23737
+ if (this._currentConditionMethod == null)
23738
+ throw new Error("You cannot call endIf without calling a condition method first.");
23739
+ if (this.backup != null) {
23740
+ // Pegando modelo original sem as alterações feitas
23741
+ var newThat = this.backup;
23742
+ // Limpando cache
23743
+ this.backup = null;
23744
+ this._currentConditionMethod = null;
23745
+ // Retornando backup sem as alterações
23746
+ return newThat;
23747
+ }
23748
+ else {
23749
+ // Retornando modelo com as alterações
23750
+ return this.that;
23751
+ }
23752
+ },
23753
+ enumerable: false,
23754
+ configurable: true
23755
+ });
23756
+ return SmzConditionalBuilder;
23757
+ }());
23758
+
23759
+ var SmzDocumentBaseCellBuilder = /** @class */ (function (_super) {
23760
+ __extends(SmzDocumentBaseCellBuilder, _super);
23709
23761
  function SmzDocumentBaseCellBuilder(_rowBuilder, _cell, _data, _documentBuilder) {
23710
- this._rowBuilder = _rowBuilder;
23711
- this._cell = _cell;
23712
- this._data = _data;
23713
- this._documentBuilder = _documentBuilder;
23762
+ var _this = _super.call(this) || this;
23763
+ _this._rowBuilder = _rowBuilder;
23764
+ _this._cell = _cell;
23765
+ _this._data = _data;
23766
+ _this._documentBuilder = _documentBuilder;
23767
+ return _this;
23714
23768
  }
23715
23769
  SmzDocumentBaseCellBuilder.prototype.setRowspan = function (rowsCount) {
23716
23770
  this._cell.rowspan = rowsCount;
@@ -23736,7 +23790,7 @@
23736
23790
  configurable: true
23737
23791
  });
23738
23792
  return SmzDocumentBaseCellBuilder;
23739
- }());
23793
+ }(SmzConditionalBuilder));
23740
23794
 
23741
23795
  var SmzCellTitleBuilder = /** @class */ (function (_super) {
23742
23796
  __extends(SmzCellTitleBuilder, _super);
@@ -24162,10 +24216,13 @@
24162
24216
  return SmzCellTableColumnBuilder;
24163
24217
  }());
24164
24218
 
24165
- var SmzDocumentContentBuilder = /** @class */ (function () {
24219
+ var SmzDocumentContentBuilder = /** @class */ (function (_super) {
24220
+ __extends(SmzDocumentContentBuilder, _super);
24166
24221
  function SmzDocumentContentBuilder(_documentBuilder, _content) {
24167
- this._documentBuilder = _documentBuilder;
24168
- this._content = _content;
24222
+ var _this = _super.call(this) || this;
24223
+ _this._documentBuilder = _documentBuilder;
24224
+ _this._content = _content;
24225
+ return _this;
24169
24226
  }
24170
24227
  SmzDocumentContentBuilder.prototype.row = function () {
24171
24228
  var row = { id: angular2Uuid.UUID.UUID(), cells: [] };
@@ -24180,7 +24237,7 @@
24180
24237
  configurable: true
24181
24238
  });
24182
24239
  return SmzDocumentContentBuilder;
24183
- }());
24240
+ }(SmzConditionalBuilder));
24184
24241
  var SmzDocumentRowBuilder = /** @class */ (function () {
24185
24242
  function SmzDocumentRowBuilder(_contentBuilder, _row, _documentBuilder, _content) {
24186
24243
  this._contentBuilder = _contentBuilder;
@@ -24268,14 +24325,70 @@
24268
24325
  return SmzDocumentRowBuilder;
24269
24326
  }());
24270
24327
 
24328
+ var SmzDocumentViewerBuilder = /** @class */ (function (_super) {
24329
+ __extends(SmzDocumentViewerBuilder, _super);
24330
+ function SmzDocumentViewerBuilder(_documentBuilder, _viewer) {
24331
+ var _this = _super.call(this) || this;
24332
+ _this._documentBuilder = _documentBuilder;
24333
+ _this._viewer = _viewer;
24334
+ return _this;
24335
+ }
24336
+ SmzDocumentViewerBuilder.prototype.setFilename = function (filename) {
24337
+ this._viewer.filename = filename;
24338
+ return this;
24339
+ };
24340
+ SmzDocumentViewerBuilder.prototype.overrideContainerStyles = function (styleClass) {
24341
+ this._viewer.container.styleClass = styleClass;
24342
+ return this;
24343
+ };
24344
+ SmzDocumentViewerBuilder.prototype.overridePaperStyles = function (styleClass) {
24345
+ this._viewer.paper.styleClass = styleClass;
24346
+ return this;
24347
+ };
24348
+ SmzDocumentViewerBuilder.prototype.setZoom = function (initial, min, max, variation) {
24349
+ this._viewer.zoom.isEnabled = true;
24350
+ this._viewer.zoom.min = min !== null && min !== void 0 ? min : initial;
24351
+ this._viewer.zoom.max = max !== null && max !== void 0 ? max : initial;
24352
+ this._viewer.zoom.initial = initial;
24353
+ this._viewer.zoom.variation = variation !== null && variation !== void 0 ? variation : initial;
24354
+ return this;
24355
+ };
24356
+ SmzDocumentViewerBuilder.prototype.disableZoomControls = function () {
24357
+ this._viewer.zoom.isEnabled = false;
24358
+ return this;
24359
+ };
24360
+ SmzDocumentViewerBuilder.prototype.allowOpen = function () {
24361
+ this._viewer.open.isEnabled = true;
24362
+ return this;
24363
+ };
24364
+ SmzDocumentViewerBuilder.prototype.allowPrint = function () {
24365
+ this._viewer.print.isEnabled = true;
24366
+ return this;
24367
+ };
24368
+ SmzDocumentViewerBuilder.prototype.allowDownload = function () {
24369
+ this._viewer.download.isEnabled = true;
24370
+ return this;
24371
+ };
24372
+ Object.defineProperty(SmzDocumentViewerBuilder.prototype, "document", {
24373
+ get: function () {
24374
+ return this._documentBuilder;
24375
+ },
24376
+ enumerable: false,
24377
+ configurable: true
24378
+ });
24379
+ return SmzDocumentViewerBuilder;
24380
+ }(SmzConditionalBuilder));
24381
+
24271
24382
  var pixelCmFactor = 28.346;
24272
- var SmzDocumentBuilder = /** @class */ (function () {
24383
+ var SmzDocumentBuilder = /** @class */ (function (_super) {
24384
+ __extends(SmzDocumentBuilder, _super);
24273
24385
  function SmzDocumentBuilder(state) {
24274
24386
  if (state === void 0) { state = null; }
24275
- this.defaultConfig = GlobalInjector$2.instance.get(NgxRbkUtilsConfig);
24276
- this._colsCount = 0;
24277
- this._isHeaderHeightUpdated = false;
24278
- this._state = {
24387
+ var _this = _super.call(this) || this;
24388
+ _this.defaultConfig = GlobalInjector$2.instance.get(NgxRbkUtilsConfig);
24389
+ _this._colsCount = 0;
24390
+ _this._isHeaderHeightUpdated = false;
24391
+ _this._state = {
24279
24392
  isDebug: false,
24280
24393
  header: null,
24281
24394
  content: null,
@@ -24298,12 +24411,38 @@
24298
24411
  text: null,
24299
24412
  showPrintHour: true,
24300
24413
  showPageNumbers: true
24414
+ },
24415
+ viewer: {
24416
+ filename: 'sample',
24417
+ zoom: {
24418
+ isEnabled: true,
24419
+ min: 1,
24420
+ max: 2.5,
24421
+ initial: 1,
24422
+ variation: 2.5 / 5
24423
+ },
24424
+ open: {
24425
+ isEnabled: false
24426
+ },
24427
+ print: {
24428
+ isEnabled: false
24429
+ },
24430
+ download: {
24431
+ isEnabled: false
24432
+ },
24433
+ container: {
24434
+ styleClass: null
24435
+ },
24436
+ paper: {
24437
+ styleClass: null
24438
+ }
24301
24439
  }
24302
24440
  };
24303
24441
  if (state != null) {
24304
- this._state = state;
24442
+ _this._state = state;
24305
24443
  }
24306
- this.applyConfig();
24444
+ _this.applyConfig();
24445
+ return _this;
24307
24446
  }
24308
24447
  SmzDocumentBuilder.prototype.applyConfig = function () {
24309
24448
  if (this.defaultConfig.documents == null || this.defaultConfig.documents.defaultStyles == null) {
@@ -24312,6 +24451,8 @@
24312
24451
  var config = cloneDeep__default["default"](this.defaultConfig.documents.defaultStyles);
24313
24452
  this._state.config = config;
24314
24453
  this._state.globals = config.globals;
24454
+ this._state.viewer.container.styleClass = config.viewer.container;
24455
+ this._state.viewer.paper.styleClass = config.viewer.paper;
24315
24456
  var marginCm = config.paper.marginCm;
24316
24457
  var globalHeaderHeightCm = config.paper.headerHeightCm ? config.paper.headerHeightCm + "cm" : null;
24317
24458
  this.applyMargin('cm', globalHeaderHeightCm, null, marginCm.left, marginCm.right, marginCm.top, marginCm.bottom);
@@ -24343,6 +24484,9 @@
24343
24484
  this._state.config = newConfig;
24344
24485
  return this;
24345
24486
  };
24487
+ SmzDocumentBuilder.prototype.viewer = function () {
24488
+ return new SmzDocumentViewerBuilder(this, this._state.viewer);
24489
+ };
24346
24490
  SmzDocumentBuilder.prototype.content = function () {
24347
24491
  if (this._state.content == null)
24348
24492
  this._state.content = { type: 'content', rows: [], cellStyles: '' };
@@ -24410,7 +24554,7 @@
24410
24554
  return this._state;
24411
24555
  };
24412
24556
  return SmzDocumentBuilder;
24413
- }());
24557
+ }(SmzConditionalBuilder));
24414
24558
  function normalizeColspan(rows, row, totalColsCount) {
24415
24559
  var debug = false; // row.cells.findIndex(x => (x.data as any)?.text?.value === 'COMPRADOR') !== -1;
24416
24560
  var currentIndex = rows.findIndex(function (x) { return x.id === row.id; });