ngx-smz-ui 3.5.0 → 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.
@@ -9265,7 +9265,8 @@
9265
9265
 
9266
9266
  var INITIAL_ZOOM = 1;
9267
9267
  var SmzDocumentsService = /** @class */ (function () {
9268
- function SmzDocumentsService() {
9268
+ function SmzDocumentsService(store) {
9269
+ this.store = store;
9269
9270
  this.zoom = INITIAL_ZOOM;
9270
9271
  this.filename = 'sample';
9271
9272
  this.zoom = INITIAL_ZOOM;
@@ -9278,6 +9279,29 @@
9278
9279
  SmzDocumentsService.prototype.setFilename = function (filename) {
9279
9280
  this.filename = filename;
9280
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
+ };
9281
9305
  SmzDocumentsService.prototype.generatePdf = function (action, element, state) {
9282
9306
  var _this = this;
9283
9307
  return new Promise(function (resolve) {
@@ -9329,12 +9353,12 @@
9329
9353
  };
9330
9354
  return SmzDocumentsService;
9331
9355
  }());
9332
- 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 });
9333
9357
  SmzDocumentsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentsService, providedIn: 'root' });
9334
9358
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentsService, decorators: [{
9335
9359
  type: i0.Injectable,
9336
9360
  args: [{ providedIn: 'root' }]
9337
- }], ctorParameters: function () { return []; } });
9361
+ }], ctorParameters: function () { return [{ type: i1__namespace$4.Store }]; } });
9338
9362
 
9339
9363
  var moment$1 = moment___namespace;
9340
9364
  var SmzDocumentViewerComponent = /** @class */ (function () {
@@ -9350,36 +9374,20 @@
9350
9374
  SmzDocumentViewerComponent.prototype.ngOnInit = function () {
9351
9375
  this.documentService.setZoom(this.state.viewer.zoom.initial);
9352
9376
  this.documentService.setFilename(this.state.viewer.filename);
9377
+ this.documentService.setState(this.state);
9353
9378
  };
9354
9379
  SmzDocumentViewerComponent.prototype.ngAfterViewInit = function () {
9355
9380
  };
9356
- SmzDocumentViewerComponent.prototype.generate = function (action, element) {
9357
- var _this = this;
9358
- this.store.dispatch(new exports.ApplicationActions.StartGlobalLoading());
9359
- setTimeout(function () {
9360
- _this.documentService.generatePdf(action, element, _this.state).then(function () {
9361
- _this.store.dispatch(new exports.ApplicationActions.StopGlobalLoading());
9362
- });
9363
- }, 0);
9364
- };
9365
- SmzDocumentViewerComponent.prototype.moreZoom = function () {
9366
- var next = this.documentService.zoom + this.state.viewer.zoom.variation;
9367
- this.documentService.setZoom(next <= this.state.viewer.zoom.max ? next : this.state.viewer.zoom.max);
9368
- };
9369
- SmzDocumentViewerComponent.prototype.lessZoom = function () {
9370
- var next = this.documentService.zoom - this.state.viewer.zoom.variation;
9371
- this.documentService.setZoom(next >= this.state.viewer.zoom.min ? next : this.state.viewer.zoom.min);
9372
- };
9373
- SmzDocumentViewerComponent.prototype.restoreZoom = function () {
9374
- this.documentService.setZoom(this.state.viewer.zoom.initial);
9375
- };
9376
9381
  SmzDocumentViewerComponent.prototype.goBack = function () {
9377
9382
  this.location.back();
9378
9383
  };
9384
+ SmzDocumentViewerComponent.prototype.ngOnDestroy = function () {
9385
+ this.documentService.setState(null);
9386
+ };
9379
9387
  return SmzDocumentViewerComponent;
9380
9388
  }());
9381
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 });
9382
- 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)=\"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 </ng-container>\n\n <button *ngIf=\"state.viewer.open.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" label=\"OPEN\" (click)=\"generate('open', paperElement)\"></button>\n <button *ngIf=\"state.viewer.print.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" label=\"PRINT\" (click)=\"generate('print', paperElement)\"></button>\n <button *ngIf=\"state.viewer.download.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" label=\"DOWNLOAD\" (click)=\"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 });
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 });
9383
9391
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentViewerComponent, decorators: [{
9384
9392
  type: i0.Component,
9385
9393
  args: [{