sf-crud 13.2.50 → 13.2.51
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/fesm2022/sf-crud.mjs
CHANGED
|
@@ -49,6 +49,7 @@ import * as i6$2 from 'sf-simulador';
|
|
|
49
49
|
import { SfSimuladorModule } from 'sf-simulador';
|
|
50
50
|
import * as i6$1 from 'primeng/fluid';
|
|
51
51
|
import { FluidModule } from 'primeng/fluid';
|
|
52
|
+
import * as i2$1 from '@angular/platform-browser';
|
|
52
53
|
import * as i8$1 from 'primeng/textarea';
|
|
53
54
|
import { TextareaModule } from 'primeng/textarea';
|
|
54
55
|
import * as i9$1 from 'primeng/inputmask';
|
|
@@ -69,7 +70,6 @@ import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
|
69
70
|
import { SelectButton } from 'primeng/selectbutton';
|
|
70
71
|
import * as i10$1 from 'sf-pdfsign';
|
|
71
72
|
import { SfPdfsignModule, PDF_GATEWAY_SERVICE } from 'sf-pdfsign';
|
|
72
|
-
import * as i2$1 from '@angular/platform-browser';
|
|
73
73
|
import * as i4$1 from 'sf-ado';
|
|
74
74
|
|
|
75
75
|
const GENERAL_CRUD_SERVICE = new InjectionToken('GENERAL_CRUD_SERVICE');
|
|
@@ -1911,6 +1911,7 @@ class ShemaConfig {
|
|
|
1911
1911
|
|
|
1912
1912
|
class FileUploadComponent {
|
|
1913
1913
|
messageSerice;
|
|
1914
|
+
sanitizer;
|
|
1914
1915
|
limit;
|
|
1915
1916
|
files = [];
|
|
1916
1917
|
loading = false;
|
|
@@ -1922,8 +1923,9 @@ class FileUploadComponent {
|
|
|
1922
1923
|
fileUploader;
|
|
1923
1924
|
newFiles = [];
|
|
1924
1925
|
animationInterval;
|
|
1925
|
-
constructor(messageSerice) {
|
|
1926
|
+
constructor(messageSerice, sanitizer) {
|
|
1926
1927
|
this.messageSerice = messageSerice;
|
|
1928
|
+
this.sanitizer = sanitizer;
|
|
1927
1929
|
window.addEventListener("paste", (e) => {
|
|
1928
1930
|
if (e.clipboardData?.files && e.clipboardData.files.length > 0) {
|
|
1929
1931
|
this.appendFile(e.clipboardData.files[0]);
|
|
@@ -2009,6 +2011,16 @@ class FileUploadComponent {
|
|
|
2009
2011
|
window.open(archivo.url, '_blank');
|
|
2010
2012
|
window.addEventListener('focus', () => URL.revokeObjectURL(archivo.url));
|
|
2011
2013
|
}
|
|
2014
|
+
isImage(file) {
|
|
2015
|
+
const imageExtensions = /\.(jpg|jpeg|png|gif|webp|bmp|svg)(\?.*)?$/i;
|
|
2016
|
+
return imageExtensions.test(file.name) || imageExtensions.test(file.url);
|
|
2017
|
+
}
|
|
2018
|
+
isPdf(file) {
|
|
2019
|
+
return /\.pdf(\?.*)?$/i.test(file.name) || /\.pdf(\?.*)?$/i.test(file.url);
|
|
2020
|
+
}
|
|
2021
|
+
getSafeUrl(url) {
|
|
2022
|
+
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
|
|
2023
|
+
}
|
|
2012
2024
|
startAnimation() {
|
|
2013
2025
|
const button = document.querySelector('.button-upload');
|
|
2014
2026
|
if (button) {
|
|
@@ -2021,13 +2033,13 @@ class FileUploadComponent {
|
|
|
2021
2033
|
button.classList.remove('animate-pulse');
|
|
2022
2034
|
}
|
|
2023
2035
|
}
|
|
2024
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FileUploadComponent, deps: [{ token: i3$1.MessageService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2025
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FileUploadComponent, isStandalone: true, selector: "sf-file-upload", inputs: { limit: "limit", files: "files", loading: "loading", configName: "configName", accept: "accept", referenceImage: "referenceImage" }, outputs: { onUpload: "onUpload", onDeleteFile: "onDeleteFile" }, viewQueries: [{ propertyName: "fileUploader", first: true, predicate: ["fileUpload"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"screen\" #screen>\r\n <div class=\"fileUp\">\r\n <div class=\"botones\">\r\n <input type=\"file\" (change)=\"appendFiles($event)\" class=\"file-input\" #fileUpload multiple>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-plus\" class=\"p-button-info\" (click)=\"fileUpload.click()\"\r\n [disabled]=\"limit == files.length || loading\"></button>\r\n <button *ngIf=\"limit != 1\" pButton pRipple type=\"button\" icon=\"pi pi-upload\" class=\"button-upload p-button-info\"\r\n (click)=\"emitFiles()\" [disabled]=\"files.length == 0 || loading\"></button>\r\n </div>\r\n\r\n <hr>\r\n <div class=\"imgs\">\r\n <div *ngIf=\"referenceImage && files.length === 0\" class=\"reference-image-container\">\r\n <img [src]=\"referenceImage\" alt=\"Referencia del documento\" class=\"reference-image\" />\r\n </div>\r\n <ul>\r\n <li *ngFor=\"let file of files; let i = index\" [
|
|
2036
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FileUploadComponent, deps: [{ token: i3$1.MessageService }, { token: i2$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
2037
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FileUploadComponent, isStandalone: true, selector: "sf-file-upload", inputs: { limit: "limit", files: "files", loading: "loading", configName: "configName", accept: "accept", referenceImage: "referenceImage" }, outputs: { onUpload: "onUpload", onDeleteFile: "onDeleteFile" }, viewQueries: [{ propertyName: "fileUploader", first: true, predicate: ["fileUpload"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"screen\" #screen>\r\n <div class=\"fileUp\">\r\n <div class=\"botones\">\r\n <input type=\"file\" (change)=\"appendFiles($event)\" class=\"file-input\" #fileUpload multiple>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-plus\" class=\"p-button-info\" (click)=\"fileUpload.click()\"\r\n [disabled]=\"limit == files.length || loading\"></button>\r\n <button *ngIf=\"limit != 1\" pButton pRipple type=\"button\" icon=\"pi pi-upload\" class=\"button-upload p-button-info\"\r\n (click)=\"emitFiles()\" [disabled]=\"files.length == 0 || loading\"></button>\r\n </div>\r\n\r\n <hr>\r\n <div class=\"imgs\">\r\n <div *ngIf=\"referenceImage && files.length === 0\" class=\"reference-image-container\">\r\n <img [src]=\"referenceImage\" alt=\"Referencia del documento\" class=\"reference-image\" />\r\n </div>\r\n <ul>\r\n <li *ngFor=\"let file of files; let i = index\" [class.preview-item]=\"isImage(file) || isPdf(file)\">\r\n <ng-container *ngIf=\"isImage(file); else checkPdf\">\r\n <img [src]=\"file.url\" [alt]=\"file.name\" class=\"uploaded-preview\" />\r\n <div class=\"preview-actions\">\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-external-link\" class=\"p-button-rounded\"\r\n (click)=\"openFile(file)\"></button>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-times\" class=\"p-button-rounded p-button-danger\"\r\n (click)=\"dropFile(file)\"></button>\r\n </div>\r\n </ng-container>\r\n <ng-template #checkPdf>\r\n <ng-container *ngIf=\"isPdf(file); else genericFile\">\r\n <iframe [src]=\"getSafeUrl(file.url)\" class=\"pdf-preview\"></iframe>\r\n <div class=\"preview-actions\">\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-external-link\" class=\"p-button-rounded\"\r\n (click)=\"openFile(file)\"></button>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-times\" class=\"p-button-rounded p-button-danger\"\r\n (click)=\"dropFile(file)\"></button>\r\n </div>\r\n </ng-container>\r\n </ng-template>\r\n <ng-template #genericFile>\r\n <p>{{i+1}}. {{file.name}}</p>\r\n <div>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-external-link\" class=\"p-button-rounded\"\r\n (click)=\"openFile(file)\"></button>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-times\" class=\"p-button-rounded p-button-danger\"\r\n (click)=\"dropFile(file)\"></button>\r\n </div>\r\n </ng-template>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["#screen{container-type:inline-size}iframe{width:100%;padding:10px;text-align:center}.fileUp{border:1.5px solid gray;border-radius:5px;text-align:center}.fileUp .imgs{min-height:40px;margin-block:7px;max-height:220px;overflow-y:scroll}.fileUp hr{color:gray;margin:0}.fileUp .imgs ul li{text-decoration:none;display:flex;margin-block:5px;padding-inline:5px}.fileUp .imgs ul{padding-inline-start:30px}.fileUp .imgs ul li div{text-decoration:none;display:grid;grid-template-columns:50% 50%;margin-block:5px;margin-right:5px}.fileUp .botones *{margin-block:7px;margin-inline:10px}.fileUp .imgs ul li p{text-align:left;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis}.fileUp .imgs ul li p,.fileUp .imgs ul li button{margin-block:auto;margin-inline:5px;text-align:left}.fileUp .imgs ul li img,.fileUp .imgs ul li iframe{text-align:center;width:80%;padding-inline:10%}.file-input{display:none}::ng-deep .p-button.p-button-info,.p-buttonset.p-button-info>.p-button,.p-splitbutton.p-button-info>.p-button{background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}@keyframes pulse{0%{transform:scale(1)}50%{transform:scale(1.1)}to{transform:scale(1)}}.animate-pulse{animation:pulse 1.5s infinite}@container (width < 768px){.fileUp .imgs ul li:not(.preview-item){display:grid;grid-template-columns:60% 40%}.uploaded-preview{max-height:100px}}.reference-image-container{display:flex;justify-content:center;padding:.5rem}.reference-image{max-width:100%;max-height:200px;object-fit:contain;opacity:.8;border-radius:4px}.fileUp .imgs ul li.preview-item{flex-direction:column;align-items:center}.uploaded-preview{max-height:150px;object-fit:contain;border-radius:4px}.pdf-preview{width:100%;height:160px;border:none;border-radius:4px}.fileUp .imgs ul li.preview-item .preview-actions{display:flex;justify-content:center;gap:.5rem;margin-top:.25rem}@container (width < 768px){.pdf-preview{height:120px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i7.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }] });
|
|
2026
2038
|
}
|
|
2027
2039
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FileUploadComponent, decorators: [{
|
|
2028
2040
|
type: Component,
|
|
2029
|
-
args: [{ selector: 'sf-file-upload', imports: [CommonModule, InputTextModule, ButtonModule], standalone: true, template: "<div id=\"screen\" #screen>\r\n <div class=\"fileUp\">\r\n <div class=\"botones\">\r\n <input type=\"file\" (change)=\"appendFiles($event)\" class=\"file-input\" #fileUpload multiple>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-plus\" class=\"p-button-info\" (click)=\"fileUpload.click()\"\r\n [disabled]=\"limit == files.length || loading\"></button>\r\n <button *ngIf=\"limit != 1\" pButton pRipple type=\"button\" icon=\"pi pi-upload\" class=\"button-upload p-button-info\"\r\n (click)=\"emitFiles()\" [disabled]=\"files.length == 0 || loading\"></button>\r\n </div>\r\n\r\n <hr>\r\n <div class=\"imgs\">\r\n <div *ngIf=\"referenceImage && files.length === 0\" class=\"reference-image-container\">\r\n <img [src]=\"referenceImage\" alt=\"Referencia del documento\" class=\"reference-image\" />\r\n </div>\r\n <ul>\r\n <li *ngFor=\"let file of files; let i = index\" [
|
|
2030
|
-
}], ctorParameters: () => [{ type: i3$1.MessageService }], propDecorators: { limit: [{
|
|
2041
|
+
args: [{ selector: 'sf-file-upload', imports: [CommonModule, InputTextModule, ButtonModule], standalone: true, template: "<div id=\"screen\" #screen>\r\n <div class=\"fileUp\">\r\n <div class=\"botones\">\r\n <input type=\"file\" (change)=\"appendFiles($event)\" class=\"file-input\" #fileUpload multiple>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-plus\" class=\"p-button-info\" (click)=\"fileUpload.click()\"\r\n [disabled]=\"limit == files.length || loading\"></button>\r\n <button *ngIf=\"limit != 1\" pButton pRipple type=\"button\" icon=\"pi pi-upload\" class=\"button-upload p-button-info\"\r\n (click)=\"emitFiles()\" [disabled]=\"files.length == 0 || loading\"></button>\r\n </div>\r\n\r\n <hr>\r\n <div class=\"imgs\">\r\n <div *ngIf=\"referenceImage && files.length === 0\" class=\"reference-image-container\">\r\n <img [src]=\"referenceImage\" alt=\"Referencia del documento\" class=\"reference-image\" />\r\n </div>\r\n <ul>\r\n <li *ngFor=\"let file of files; let i = index\" [class.preview-item]=\"isImage(file) || isPdf(file)\">\r\n <ng-container *ngIf=\"isImage(file); else checkPdf\">\r\n <img [src]=\"file.url\" [alt]=\"file.name\" class=\"uploaded-preview\" />\r\n <div class=\"preview-actions\">\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-external-link\" class=\"p-button-rounded\"\r\n (click)=\"openFile(file)\"></button>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-times\" class=\"p-button-rounded p-button-danger\"\r\n (click)=\"dropFile(file)\"></button>\r\n </div>\r\n </ng-container>\r\n <ng-template #checkPdf>\r\n <ng-container *ngIf=\"isPdf(file); else genericFile\">\r\n <iframe [src]=\"getSafeUrl(file.url)\" class=\"pdf-preview\"></iframe>\r\n <div class=\"preview-actions\">\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-external-link\" class=\"p-button-rounded\"\r\n (click)=\"openFile(file)\"></button>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-times\" class=\"p-button-rounded p-button-danger\"\r\n (click)=\"dropFile(file)\"></button>\r\n </div>\r\n </ng-container>\r\n </ng-template>\r\n <ng-template #genericFile>\r\n <p>{{i+1}}. {{file.name}}</p>\r\n <div>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-external-link\" class=\"p-button-rounded\"\r\n (click)=\"openFile(file)\"></button>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-times\" class=\"p-button-rounded p-button-danger\"\r\n (click)=\"dropFile(file)\"></button>\r\n </div>\r\n </ng-template>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["#screen{container-type:inline-size}iframe{width:100%;padding:10px;text-align:center}.fileUp{border:1.5px solid gray;border-radius:5px;text-align:center}.fileUp .imgs{min-height:40px;margin-block:7px;max-height:220px;overflow-y:scroll}.fileUp hr{color:gray;margin:0}.fileUp .imgs ul li{text-decoration:none;display:flex;margin-block:5px;padding-inline:5px}.fileUp .imgs ul{padding-inline-start:30px}.fileUp .imgs ul li div{text-decoration:none;display:grid;grid-template-columns:50% 50%;margin-block:5px;margin-right:5px}.fileUp .botones *{margin-block:7px;margin-inline:10px}.fileUp .imgs ul li p{text-align:left;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis}.fileUp .imgs ul li p,.fileUp .imgs ul li button{margin-block:auto;margin-inline:5px;text-align:left}.fileUp .imgs ul li img,.fileUp .imgs ul li iframe{text-align:center;width:80%;padding-inline:10%}.file-input{display:none}::ng-deep .p-button.p-button-info,.p-buttonset.p-button-info>.p-button,.p-splitbutton.p-button-info>.p-button{background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}@keyframes pulse{0%{transform:scale(1)}50%{transform:scale(1.1)}to{transform:scale(1)}}.animate-pulse{animation:pulse 1.5s infinite}@container (width < 768px){.fileUp .imgs ul li:not(.preview-item){display:grid;grid-template-columns:60% 40%}.uploaded-preview{max-height:100px}}.reference-image-container{display:flex;justify-content:center;padding:.5rem}.reference-image{max-width:100%;max-height:200px;object-fit:contain;opacity:.8;border-radius:4px}.fileUp .imgs ul li.preview-item{flex-direction:column;align-items:center}.uploaded-preview{max-height:150px;object-fit:contain;border-radius:4px}.pdf-preview{width:100%;height:160px;border:none;border-radius:4px}.fileUp .imgs ul li.preview-item .preview-actions{display:flex;justify-content:center;gap:.5rem;margin-top:.25rem}@container (width < 768px){.pdf-preview{height:120px}}\n"] }]
|
|
2042
|
+
}], ctorParameters: () => [{ type: i3$1.MessageService }, { type: i2$1.DomSanitizer }], propDecorators: { limit: [{
|
|
2031
2043
|
type: Input
|
|
2032
2044
|
}], files: [{
|
|
2033
2045
|
type: Input
|