sf-crud 13.2.54 → 13.2.55
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
|
@@ -2019,8 +2019,7 @@ class FileUploadComponent {
|
|
|
2019
2019
|
return /\.pdf(\?.*)?$/i.test(file.name) || /\.pdf(\?.*)?$/i.test(file.url);
|
|
2020
2020
|
}
|
|
2021
2021
|
getSafeUrl(url) {
|
|
2022
|
-
|
|
2023
|
-
return this.sanitizer.bypassSecurityTrustResourceUrl(pdfUrl);
|
|
2022
|
+
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
|
|
2024
2023
|
}
|
|
2025
2024
|
startAnimation() {
|
|
2026
2025
|
const button = document.querySelector('.button-upload');
|
|
@@ -2035,11 +2034,11 @@ class FileUploadComponent {
|
|
|
2035
2034
|
}
|
|
2036
2035
|
}
|
|
2037
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 });
|
|
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\"
|
|
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"] }] });
|
|
2039
2038
|
}
|
|
2040
2039
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FileUploadComponent, decorators: [{
|
|
2041
2040
|
type: Component,
|
|
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\"
|
|
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"] }]
|
|
2043
2042
|
}], ctorParameters: () => [{ type: i3$1.MessageService }, { type: i2$1.DomSanitizer }], propDecorators: { limit: [{
|
|
2044
2043
|
type: Input
|
|
2045
2044
|
}], files: [{
|
|
@@ -2316,11 +2315,15 @@ class ControlComponent {
|
|
|
2316
2315
|
}
|
|
2317
2316
|
return null;
|
|
2318
2317
|
}
|
|
2319
|
-
loadDefaultValues() {
|
|
2318
|
+
async loadDefaultValues() {
|
|
2320
2319
|
if (this.control?.config && (this.control.subtype == 'dropdown' || this.control.subtype == 'multiselect' || this.control.subtype == 'group'))
|
|
2321
2320
|
this.loadDataFromService();
|
|
2322
|
-
if (this.control?.subtype == 'autocomplete' || this.control?.subtype === 'autocompleteCustom')
|
|
2323
|
-
this.extracValueFromControlBusqueda();
|
|
2321
|
+
if (this.control?.subtype == 'autocomplete' || this.control?.subtype === 'autocompleteCustom') {
|
|
2322
|
+
await this.extracValueFromControlBusqueda();
|
|
2323
|
+
if (this.control.dependency && this.tempValue) {
|
|
2324
|
+
this.sendDependencyValue(this.tempValue);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2324
2327
|
if (this.value && this.control.type == 'date') {
|
|
2325
2328
|
this.instanceDate();
|
|
2326
2329
|
}
|
|
@@ -2526,23 +2529,26 @@ class ControlComponent {
|
|
|
2526
2529
|
this.cdr.detectChanges();
|
|
2527
2530
|
});
|
|
2528
2531
|
}
|
|
2529
|
-
extracValueFromControlBusqueda() {
|
|
2532
|
+
async extracValueFromControlBusqueda() {
|
|
2530
2533
|
const op = this.control.config;
|
|
2531
2534
|
let url = this.crudService.getURL(op, undefined, undefined, this.context);
|
|
2532
2535
|
url = url.replace('@query', this.value);
|
|
2533
|
-
|
|
2534
|
-
.
|
|
2536
|
+
try {
|
|
2537
|
+
const res = await this.generalService.genericRequest(this.control.config.method, url);
|
|
2535
2538
|
if (res.data?.length == 1 && res.data[0][this.control.field]) {
|
|
2536
2539
|
this.tempValue = res.data[0];
|
|
2537
2540
|
this.value = res.data[0][this.control.field];
|
|
2538
2541
|
}
|
|
2539
|
-
else
|
|
2542
|
+
else {
|
|
2540
2543
|
this.setDefaultValue();
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
catch {
|
|
2544
2547
|
this.setDefaultValue();
|
|
2545
|
-
}
|
|
2548
|
+
}
|
|
2549
|
+
finally {
|
|
2550
|
+
this.cdr.detectChanges();
|
|
2551
|
+
}
|
|
2546
2552
|
}
|
|
2547
2553
|
onUpload(event) {
|
|
2548
2554
|
this.uploadingFiles = true;
|
|
@@ -2710,13 +2716,6 @@ class ControlComponent {
|
|
|
2710
2716
|
this.sendValueFromObject({ value: match });
|
|
2711
2717
|
this.tempValue = match;
|
|
2712
2718
|
this.cdr.detectChanges();
|
|
2713
|
-
return;
|
|
2714
|
-
}
|
|
2715
|
-
if (this.dataFromService?.length === 1) {
|
|
2716
|
-
const singleResult = this.dataFromService[0];
|
|
2717
|
-
this.sendValueFromObject({ value: singleResult });
|
|
2718
|
-
this.tempValue = singleResult;
|
|
2719
|
-
this.cdr.detectChanges();
|
|
2720
2719
|
}
|
|
2721
2720
|
}
|
|
2722
2721
|
sendDependencyValue(data) {
|