ngx-smz-ui 3.4.23 → 3.5.0
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/bundles/ngx-smz-ui.umd.js +105 -17
- package/bundles/ngx-smz-ui.umd.js.map +1 -1
- package/esm2015/lib/builders/smz-documents/document-builder.js +32 -1
- package/esm2015/lib/builders/smz-documents/document-viewer.js +48 -0
- package/esm2015/lib/modules/smz-documents/features/document-viewer/document-viewer.component.js +9 -13
- package/esm2015/lib/modules/smz-documents/models/smz-document-config.js +1 -1
- package/esm2015/lib/modules/smz-documents/models/smz-document-viewer.js +2 -0
- package/esm2015/lib/modules/smz-documents/models/smz-document.js +1 -1
- package/esm2015/lib/modules/smz-documents/services/smz-documents.service.js +10 -3
- package/fesm2015/ngx-smz-ui.js +97 -17
- package/fesm2015/ngx-smz-ui.js.map +1 -1
- package/lib/builders/smz-documents/document-builder.d.ts +2 -0
- package/lib/builders/smz-documents/document-viewer.d.ts +17 -0
- package/lib/modules/smz-documents/features/document-viewer/document-viewer.component.d.ts +0 -2
- package/lib/modules/smz-documents/models/smz-document-config.d.ts +4 -0
- package/lib/modules/smz-documents/models/smz-document-viewer.d.ts +25 -0
- package/lib/modules/smz-documents/models/smz-document.d.ts +2 -0
- package/lib/modules/smz-documents/services/smz-documents.service.d.ts +3 -0
- package/package.json +1 -1
|
@@ -9263,15 +9263,23 @@
|
|
|
9263
9263
|
ApplicationActions.SetLogApplicationAreaAndExtraData = SetLogApplicationAreaAndExtraData;
|
|
9264
9264
|
})(exports.ApplicationActions || (exports.ApplicationActions = {}));
|
|
9265
9265
|
|
|
9266
|
-
var INITIAL_ZOOM
|
|
9266
|
+
var INITIAL_ZOOM = 1;
|
|
9267
9267
|
var SmzDocumentsService = /** @class */ (function () {
|
|
9268
9268
|
function SmzDocumentsService() {
|
|
9269
|
-
this.zoom = INITIAL_ZOOM
|
|
9270
|
-
this.
|
|
9269
|
+
this.zoom = INITIAL_ZOOM;
|
|
9270
|
+
this.filename = 'sample';
|
|
9271
|
+
this.zoom = INITIAL_ZOOM;
|
|
9271
9272
|
this.showDownloadControl = true;
|
|
9272
9273
|
this.showExportControl = true;
|
|
9273
9274
|
}
|
|
9275
|
+
SmzDocumentsService.prototype.setZoom = function (zoom) {
|
|
9276
|
+
this.zoom = zoom;
|
|
9277
|
+
};
|
|
9278
|
+
SmzDocumentsService.prototype.setFilename = function (filename) {
|
|
9279
|
+
this.filename = filename;
|
|
9280
|
+
};
|
|
9274
9281
|
SmzDocumentsService.prototype.generatePdf = function (action, element, state) {
|
|
9282
|
+
var _this = this;
|
|
9275
9283
|
return new Promise(function (resolve) {
|
|
9276
9284
|
var docOptions = {
|
|
9277
9285
|
orientation: 'portrait',
|
|
@@ -9303,13 +9311,13 @@
|
|
|
9303
9311
|
doc.html(element.nativeElement, options).then(function () {
|
|
9304
9312
|
switch (action) {
|
|
9305
9313
|
case 'open': {
|
|
9306
|
-
doc.output('dataurlnewwindow', { filename:
|
|
9314
|
+
doc.output('dataurlnewwindow', { filename: _this.filename + ".pdf" });
|
|
9307
9315
|
resolve('Resolved');
|
|
9308
9316
|
break;
|
|
9309
9317
|
}
|
|
9310
9318
|
// case 'print': this.pdfMakeService.pdfMake.createPdf(document).print(); break;
|
|
9311
9319
|
case 'download': {
|
|
9312
|
-
var saving = doc.save(
|
|
9320
|
+
var saving = doc.save(_this.filename + ".pdf", { returnPromise: true });
|
|
9313
9321
|
saving.then(function () {
|
|
9314
9322
|
resolve('Resolved');
|
|
9315
9323
|
});
|
|
@@ -9329,10 +9337,6 @@
|
|
|
9329
9337
|
}], ctorParameters: function () { return []; } });
|
|
9330
9338
|
|
|
9331
9339
|
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
9340
|
var SmzDocumentViewerComponent = /** @class */ (function () {
|
|
9337
9341
|
function SmzDocumentViewerComponent(el, documentService, location, cdf, store, renderer) {
|
|
9338
9342
|
this.el = el;
|
|
@@ -9341,11 +9345,11 @@
|
|
|
9341
9345
|
this.cdf = cdf;
|
|
9342
9346
|
this.store = store;
|
|
9343
9347
|
this.renderer = renderer;
|
|
9344
|
-
this.maxZoom = MAX_ZOOM;
|
|
9345
|
-
this.minZoom = MIN_ZOOM;
|
|
9346
9348
|
this.now = moment$1().format('MMMM Do YYYY, h:mm:ss a');
|
|
9347
9349
|
}
|
|
9348
9350
|
SmzDocumentViewerComponent.prototype.ngOnInit = function () {
|
|
9351
|
+
this.documentService.setZoom(this.state.viewer.zoom.initial);
|
|
9352
|
+
this.documentService.setFilename(this.state.viewer.filename);
|
|
9349
9353
|
};
|
|
9350
9354
|
SmzDocumentViewerComponent.prototype.ngAfterViewInit = function () {
|
|
9351
9355
|
};
|
|
@@ -9359,15 +9363,15 @@
|
|
|
9359
9363
|
}, 0);
|
|
9360
9364
|
};
|
|
9361
9365
|
SmzDocumentViewerComponent.prototype.moreZoom = function () {
|
|
9362
|
-
var next = this.documentService.zoom +
|
|
9363
|
-
this.documentService.
|
|
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);
|
|
9364
9368
|
};
|
|
9365
9369
|
SmzDocumentViewerComponent.prototype.lessZoom = function () {
|
|
9366
|
-
var next = this.documentService.zoom -
|
|
9367
|
-
this.documentService.
|
|
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);
|
|
9368
9372
|
};
|
|
9369
9373
|
SmzDocumentViewerComponent.prototype.restoreZoom = function () {
|
|
9370
|
-
this.documentService.zoom
|
|
9374
|
+
this.documentService.setZoom(this.state.viewer.zoom.initial);
|
|
9371
9375
|
};
|
|
9372
9376
|
SmzDocumentViewerComponent.prototype.goBack = function () {
|
|
9373
9377
|
this.location.back();
|
|
@@ -9375,7 +9379,7 @@
|
|
|
9375
9379
|
return SmzDocumentViewerComponent;
|
|
9376
9380
|
}());
|
|
9377
9381
|
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
|
|
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 });
|
|
9379
9383
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: SmzDocumentViewerComponent, decorators: [{
|
|
9380
9384
|
type: i0.Component,
|
|
9381
9385
|
args: [{
|
|
@@ -24313,6 +24317,60 @@
|
|
|
24313
24317
|
return SmzDocumentRowBuilder;
|
|
24314
24318
|
}());
|
|
24315
24319
|
|
|
24320
|
+
var SmzDocumentViewerBuilder = /** @class */ (function (_super) {
|
|
24321
|
+
__extends(SmzDocumentViewerBuilder, _super);
|
|
24322
|
+
function SmzDocumentViewerBuilder(_documentBuilder, _viewer) {
|
|
24323
|
+
var _this = _super.call(this) || this;
|
|
24324
|
+
_this._documentBuilder = _documentBuilder;
|
|
24325
|
+
_this._viewer = _viewer;
|
|
24326
|
+
return _this;
|
|
24327
|
+
}
|
|
24328
|
+
SmzDocumentViewerBuilder.prototype.setFilename = function (filename) {
|
|
24329
|
+
this._viewer.filename = filename;
|
|
24330
|
+
return this;
|
|
24331
|
+
};
|
|
24332
|
+
SmzDocumentViewerBuilder.prototype.overrideContainerStyles = function (styleClass) {
|
|
24333
|
+
this._viewer.container.styleClass = styleClass;
|
|
24334
|
+
return this;
|
|
24335
|
+
};
|
|
24336
|
+
SmzDocumentViewerBuilder.prototype.overridePaperStyles = function (styleClass) {
|
|
24337
|
+
this._viewer.paper.styleClass = styleClass;
|
|
24338
|
+
return this;
|
|
24339
|
+
};
|
|
24340
|
+
SmzDocumentViewerBuilder.prototype.setZoom = function (initial, min, max, variation) {
|
|
24341
|
+
this._viewer.zoom.isEnabled = true;
|
|
24342
|
+
this._viewer.zoom.min = min !== null && min !== void 0 ? min : initial;
|
|
24343
|
+
this._viewer.zoom.max = max !== null && max !== void 0 ? max : initial;
|
|
24344
|
+
this._viewer.zoom.initial = initial;
|
|
24345
|
+
this._viewer.zoom.variation = variation !== null && variation !== void 0 ? variation : initial;
|
|
24346
|
+
return this;
|
|
24347
|
+
};
|
|
24348
|
+
SmzDocumentViewerBuilder.prototype.disableZoomControls = function () {
|
|
24349
|
+
this._viewer.zoom.isEnabled = false;
|
|
24350
|
+
return this;
|
|
24351
|
+
};
|
|
24352
|
+
SmzDocumentViewerBuilder.prototype.allowOpen = function () {
|
|
24353
|
+
this._viewer.open.isEnabled = true;
|
|
24354
|
+
return this;
|
|
24355
|
+
};
|
|
24356
|
+
SmzDocumentViewerBuilder.prototype.allowPrint = function () {
|
|
24357
|
+
this._viewer.print.isEnabled = true;
|
|
24358
|
+
return this;
|
|
24359
|
+
};
|
|
24360
|
+
SmzDocumentViewerBuilder.prototype.allowDownload = function () {
|
|
24361
|
+
this._viewer.download.isEnabled = true;
|
|
24362
|
+
return this;
|
|
24363
|
+
};
|
|
24364
|
+
Object.defineProperty(SmzDocumentViewerBuilder.prototype, "document", {
|
|
24365
|
+
get: function () {
|
|
24366
|
+
return this._documentBuilder;
|
|
24367
|
+
},
|
|
24368
|
+
enumerable: false,
|
|
24369
|
+
configurable: true
|
|
24370
|
+
});
|
|
24371
|
+
return SmzDocumentViewerBuilder;
|
|
24372
|
+
}(SmzConditionalBuilder));
|
|
24373
|
+
|
|
24316
24374
|
var pixelCmFactor = 28.346;
|
|
24317
24375
|
var SmzDocumentBuilder = /** @class */ (function (_super) {
|
|
24318
24376
|
__extends(SmzDocumentBuilder, _super);
|
|
@@ -24345,6 +24403,31 @@
|
|
|
24345
24403
|
text: null,
|
|
24346
24404
|
showPrintHour: true,
|
|
24347
24405
|
showPageNumbers: true
|
|
24406
|
+
},
|
|
24407
|
+
viewer: {
|
|
24408
|
+
filename: 'sample',
|
|
24409
|
+
zoom: {
|
|
24410
|
+
isEnabled: true,
|
|
24411
|
+
min: 1,
|
|
24412
|
+
max: 2.5,
|
|
24413
|
+
initial: 1,
|
|
24414
|
+
variation: 2.5 / 5
|
|
24415
|
+
},
|
|
24416
|
+
open: {
|
|
24417
|
+
isEnabled: false
|
|
24418
|
+
},
|
|
24419
|
+
print: {
|
|
24420
|
+
isEnabled: false
|
|
24421
|
+
},
|
|
24422
|
+
download: {
|
|
24423
|
+
isEnabled: false
|
|
24424
|
+
},
|
|
24425
|
+
container: {
|
|
24426
|
+
styleClass: null
|
|
24427
|
+
},
|
|
24428
|
+
paper: {
|
|
24429
|
+
styleClass: null
|
|
24430
|
+
}
|
|
24348
24431
|
}
|
|
24349
24432
|
};
|
|
24350
24433
|
if (state != null) {
|
|
@@ -24360,6 +24443,8 @@
|
|
|
24360
24443
|
var config = cloneDeep__default["default"](this.defaultConfig.documents.defaultStyles);
|
|
24361
24444
|
this._state.config = config;
|
|
24362
24445
|
this._state.globals = config.globals;
|
|
24446
|
+
this._state.viewer.container.styleClass = config.viewer.container;
|
|
24447
|
+
this._state.viewer.paper.styleClass = config.viewer.paper;
|
|
24363
24448
|
var marginCm = config.paper.marginCm;
|
|
24364
24449
|
var globalHeaderHeightCm = config.paper.headerHeightCm ? config.paper.headerHeightCm + "cm" : null;
|
|
24365
24450
|
this.applyMargin('cm', globalHeaderHeightCm, null, marginCm.left, marginCm.right, marginCm.top, marginCm.bottom);
|
|
@@ -24391,6 +24476,9 @@
|
|
|
24391
24476
|
this._state.config = newConfig;
|
|
24392
24477
|
return this;
|
|
24393
24478
|
};
|
|
24479
|
+
SmzDocumentBuilder.prototype.viewer = function () {
|
|
24480
|
+
return new SmzDocumentViewerBuilder(this, this._state.viewer);
|
|
24481
|
+
};
|
|
24394
24482
|
SmzDocumentBuilder.prototype.content = function () {
|
|
24395
24483
|
if (this._state.content == null)
|
|
24396
24484
|
this._state.content = { type: 'content', rows: [], cellStyles: '' };
|