sf-crud 13.2.55 → 13.2.57

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.
@@ -2019,7 +2019,8 @@ class FileUploadComponent {
2019
2019
  return /\.pdf(\?.*)?$/i.test(file.name) || /\.pdf(\?.*)?$/i.test(file.url);
2020
2020
  }
2021
2021
  getSafeUrl(url) {
2022
- return this.sanitizer.bypassSecurityTrustResourceUrl(url);
2022
+ const pdfUrl = `${url}#toolbar=0&navpanes=0&scrollbar=0&view=Fit`;
2023
+ return this.sanitizer.bypassSecurityTrustResourceUrl(pdfUrl);
2023
2024
  }
2024
2025
  startAnimation() {
2025
2026
  const button = document.querySelector('.button-upload');
@@ -2034,11 +2035,11 @@ class FileUploadComponent {
2034
2035
  }
2035
2036
  }
2036
2037
  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"] }] });
2038
+ 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\" scrolling=\"no\"></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}.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:not(.preview-item) img,.fileUp .imgs ul li:not(.preview-item) 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%}}.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{width:100%;height:auto;object-fit:contain;border-radius:4px}.pdf-preview{width:100%;height:280px;border:none;border-radius:4px;overflow:hidden}.fileUp .imgs ul li.preview-item .preview-actions{display:flex;justify-content:center;gap:.5rem;margin-top:.25rem}\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"] }] });
2038
2039
  }
2039
2040
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FileUploadComponent, decorators: [{
2040
2041
  type: Component,
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
+ 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\" scrolling=\"no\"></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}.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:not(.preview-item) img,.fileUp .imgs ul li:not(.preview-item) 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%}}.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{width:100%;height:auto;object-fit:contain;border-radius:4px}.pdf-preview{width:100%;height:280px;border:none;border-radius:4px;overflow:hidden}.fileUp .imgs ul li.preview-item .preview-actions{display:flex;justify-content:center;gap:.5rem;margin-top:.25rem}\n"] }]
2042
2043
  }], ctorParameters: () => [{ type: i3$1.MessageService }, { type: i2$1.DomSanitizer }], propDecorators: { limit: [{
2043
2044
  type: Input
2044
2045
  }], files: [{
@@ -2201,6 +2202,7 @@ class ControlComponent {
2201
2202
  isLoading = false;
2202
2203
  dataFromService = [];
2203
2204
  uploadedFiles = [];
2205
+ _loadFilesId = 0;
2204
2206
  displayAdd = false;
2205
2207
  tempValue;
2206
2208
  clicked = false;
@@ -2369,24 +2371,70 @@ class ControlComponent {
2369
2371
  this.value = this.tempValue;
2370
2372
  this.sendValue();
2371
2373
  }
2372
- loadFiles() {
2374
+ async loadFiles() {
2375
+ const runId = ++this._loadFilesId;
2373
2376
  this.isLoading = true;
2374
2377
  this.uploadedFiles = [];
2375
2378
  if (!this.value) {
2376
2379
  this.isLoading = false;
2377
2380
  this.cdr.detectChanges();
2381
+ return;
2378
2382
  }
2379
- else if (this.control.config.namePattern && this.control.type == "string") {
2380
- let urls = this.control.config.separator ? this.value.split(",") : [this.value];
2381
- urls.forEach(url => this.uploadedFiles.push({ url: url, name: this.getNameFile(this.control.config.namePattern, url) }));
2382
- this.isLoading = false;
2383
- this.cdr.detectChanges();
2383
+ const mimeTypes = {
2384
+ pdf: 'application/pdf', jpg: 'image/jpeg', jpeg: 'image/jpeg',
2385
+ png: 'image/png', gif: 'image/gif', bmp: 'image/bmp'
2386
+ };
2387
+ const resolveUrl = async (url) => {
2388
+ try {
2389
+ const res = await fetch(url, { method: 'HEAD' });
2390
+ if (res.ok)
2391
+ return url;
2392
+ const lastSlash = url.lastIndexOf('/');
2393
+ const uploadedUrl = url.substring(0, lastSlash + 1) + 'UPLOADED_' + url.substring(lastSlash + 1);
2394
+ const res2 = await fetch(uploadedUrl, { method: 'HEAD' });
2395
+ if (!res2.ok)
2396
+ return null;
2397
+ const ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
2398
+ const mimeType = mimeTypes[ext] ?? 'application/octet-stream';
2399
+ const content = await fetch(uploadedUrl);
2400
+ const buffer = await content.arrayBuffer();
2401
+ return URL.createObjectURL(new Blob([buffer], { type: mimeType }));
2402
+ }
2403
+ catch {
2404
+ return null;
2405
+ }
2406
+ };
2407
+ if (this.control.config.namePattern && this.control.type == "string") {
2408
+ const urls = this.control.config.separator ? this.value.split(",") : [this.value];
2409
+ const validUrls = [];
2410
+ for (const url of urls) {
2411
+ const resolved = await resolveUrl(url);
2412
+ if (runId !== this._loadFilesId)
2413
+ return;
2414
+ if (resolved !== null) {
2415
+ this.uploadedFiles.push({ url: resolved, name: this.getNameFile(this.control.config.namePattern, url) });
2416
+ validUrls.push(url);
2417
+ }
2418
+ }
2419
+ if (validUrls.length !== urls.length)
2420
+ this.value = validUrls.length > 0 ? validUrls.join(this.control.config?.separator || ',') : null;
2384
2421
  }
2385
2422
  else if (this.control.config.namePattern && this.control.type == "array") {
2386
- this.value.forEach((url) => this.uploadedFiles.push({ url: url, name: this.getNameFile(this.control.config.namePattern, url) }));
2387
- this.isLoading = false;
2388
- this.cdr.detectChanges();
2423
+ const validUrls = [];
2424
+ for (const url of this.value) {
2425
+ const resolved = await resolveUrl(url);
2426
+ if (runId !== this._loadFilesId)
2427
+ return;
2428
+ if (resolved !== null) {
2429
+ this.uploadedFiles.push({ url: resolved, name: this.getNameFile(this.control.config.namePattern, url) });
2430
+ validUrls.push(url);
2431
+ }
2432
+ }
2433
+ if (validUrls.length !== this.value.length)
2434
+ this.value = validUrls.length > 0 ? validUrls : null;
2389
2435
  }
2436
+ this.isLoading = false;
2437
+ this.cdr.detectChanges();
2390
2438
  }
2391
2439
  onDeleteFile(index) {
2392
2440
  if ((!this.control.config?.limit || this.control.config?.limit == 1) && this.control.type == "string")
@@ -2716,6 +2764,13 @@ class ControlComponent {
2716
2764
  this.sendValueFromObject({ value: match });
2717
2765
  this.tempValue = match;
2718
2766
  this.cdr.detectChanges();
2767
+ return;
2768
+ }
2769
+ if (this.dataFromService?.length === 1) {
2770
+ const singleResult = this.dataFromService[0];
2771
+ this.sendValueFromObject({ value: singleResult });
2772
+ this.tempValue = singleResult;
2773
+ this.cdr.detectChanges();
2719
2774
  }
2720
2775
  }
2721
2776
  sendDependencyValue(data) {