@sapphire-ion/framework 1.2.47 → 1.2.48

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.
@@ -2426,16 +2426,16 @@ class StorageService {
2426
2426
  const Download = this.currentlyDownloading.find(p => p.file == file);
2427
2427
  return Download ? Download.progress : 0;
2428
2428
  }
2429
- StartDownload(file, params, post = false) {
2429
+ StartDownload(file, params, post = false, fileName = null) {
2430
2430
  if (!this.currentlyDownloading.find(p => p.file == file)) {
2431
2431
  const download = new Download(file);
2432
2432
  this.currentlyDownloading.push(download);
2433
- this.HandleDownload(download, params, post);
2433
+ this.HandleDownload(download, params, post, fileName);
2434
2434
  return download;
2435
2435
  }
2436
2436
  return this.currentlyDownloading.find(p => p.file == file);
2437
2437
  }
2438
- HandleDownload(download, params, post = false) {
2438
+ HandleDownload(download, params, post = false, fileName = null) {
2439
2439
  var request = this.GetFile(download.file, params, post);
2440
2440
  const requestProgess = new BehaviorSubject(null);
2441
2441
  download.requestProgess = requestProgess;
@@ -2446,7 +2446,7 @@ class StorageService {
2446
2446
  requestProgess.next(download.progress);
2447
2447
  }
2448
2448
  else if (event.type === HttpEventType.Response) {
2449
- DownloadFile(event, download.file);
2449
+ DownloadFile(event, download.file, fileName);
2450
2450
  this.currentlyDownloading.splice(this.currentlyDownloading.indexOf(download), 1);
2451
2451
  requestProgess.complete();
2452
2452
  }
@@ -2574,13 +2574,16 @@ class Download {
2574
2574
  this.progress = 0.00001;
2575
2575
  }
2576
2576
  }
2577
- function DownloadFile(data, fileUrl) {
2577
+ function DownloadFile(data, fileUrl, fileName = null) {
2578
2578
  const downloadedFile = new Blob([data.body], { type: data.body.type });
2579
2579
  var fileURL = URL.createObjectURL(downloadedFile);
2580
2580
  const linkElement = document.createElement("a");
2581
2581
  linkElement.setAttribute("href", fileURL);
2582
2582
  linkElement.setAttribute("target", "_blank");
2583
2583
  linkElement.setAttribute("download", StorageService.SanitizeFileName(fileUrl));
2584
+ if (fileName) {
2585
+ linkElement.setAttribute("download", fileName);
2586
+ }
2584
2587
  let me = new MouseEvent("click", {
2585
2588
  view: window,
2586
2589
  bubbles: true,
@@ -2781,6 +2784,7 @@ class DownloadButtonComponent {
2781
2784
  this.configuration = new InputFileConfiguration();
2782
2785
  this.customLabel = false;
2783
2786
  this.label = "";
2787
+ this.fileName = null;
2784
2788
  this.guid = "";
2785
2789
  this.lstFiles = computed(() => {
2786
2790
  if (typeof (this.value()) == "string") {
@@ -2807,7 +2811,7 @@ class DownloadButtonComponent {
2807
2811
  }
2808
2812
  writeValue(value) { this.value.set(value); }
2809
2813
  Download(value) {
2810
- this.storageService.StartDownload(value, this.params, this.post);
2814
+ this.storageService.StartDownload(value, this.params, this.post, this.fileName);
2811
2815
  }
2812
2816
  Sanitize(v) {
2813
2817
  return StorageService.SanitizeFileName(v);
@@ -2828,7 +2832,7 @@ class DownloadButtonComponent {
2828
2832
  return this.lstLoading.indexOf(path) != -1;
2829
2833
  }
2830
2834
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DownloadButtonComponent, deps: [{ token: StorageService }, { token: i0.ElementRef }, { token: ApiUrlProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
2831
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: DownloadButtonComponent, selector: "download-button", inputs: { expand: { classPropertyName: "expand", publicName: "expand", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: false, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: false, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, post: { classPropertyName: "post", publicName: "post", isSignal: false, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: false, isRequired: false, transformFunction: null }, customLabel: { classPropertyName: "customLabel", publicName: "customLabel", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: InputProviderFactory.GetProviders(DownloadButtonComponent), ngImport: i0, template: "@if(lstFiles().length == 0){\r\n <ion-button [color]=\"color\" fill=\"outline\" [disabled]=\"true\" [size]=\"size\"> \r\n <ion-icon name=\"close-circle\" slot=\"start\"></ion-icon> \r\n <ion-label> Sem arquivos... </ion-label>\r\n </ion-button>\r\n}\r\n@else if(lstFiles().length == 1){\r\n <ion-button [color]=\"color\" *ngVar=\"storageService.GetProgress(lstFiles()[0]) as val\" class=\"relative block {{expand == 'block' ? 'size-full' : ''}}\" [disabled]=\"val != 0 || disabled\" (click)=\"Download(lstFiles()[0])\" fill=\"outline\" [size]=\"size\"> \r\n <ion-icon name=\"download\" slot=\"start\"></ion-icon> \r\n <ion-label> {{customLabel ? label : Sanitize(lstFiles()[0])}} </ion-label>\r\n <div class=\"absolute size-full h-[calc(100%+var(--padding-top)+var(--padding-bottom))] w-[calc(100%+var(--padding-end)+var(--padding-start))]\">\r\n <loading [type]=\"3\" [loading]=\"val != 0\"></loading>\r\n <div class=\"size-full flex flex-row-reverse relative\">\r\n <ion-progress-bar class=\"absolute bottom-0 left-0 w-full h-1 default-transition\" [ngClass]=\"{'-translate-y-4 opacity-0': (!val || val == 0)}\" [value]=\"val\"></ion-progress-bar>\r\n </div>\r\n </div>\r\n </ion-button>\r\n}\r\n@else{\r\n <ion-button [color]=\"color\" [id]=\"guid\" fill=\"outline\" [size]=\"size\"> \r\n <ion-icon name=\"download\" slot=\"start\"></ion-icon> \r\n <ion-label> {{lstFiles().length}} Arquivos </ion-label>\r\n </ion-button>\r\n\r\n <ion-popover [trigger]=\"guid\" [keepContentsMounted]=\"true\" triggerAction=\"click\">\r\n <ng-template>\r\n <ion-content class=\"p-0 bg-transparent\">\r\n <ion-list>\r\n @for (item of lstFiles(); track item; let i = $index; let l = $last) {\r\n <section *ngVar=\"storageService.GetProgress(item) as val\">\r\n <ion-item style=\"--background: transparent\" lines=\"{{l ? 'none' : 'full'}}\" button [detail]=\"false\">\r\n\r\n <ion-icon name=\"download\" (click)=\"Download(item)\" slot=\"start\"></ion-icon> \r\n @if (ExtensionIsImage(item)) {\r\n <ion-icon [id]=\"guid + '-' + i + '-nested-popover'\" name=\"image\" slot=\"start\"></ion-icon> \r\n }\r\n\r\n <ion-label>{{Sanitize(item)}}</ion-label>\r\n <ion-text *ngIf=\"val != 0\" slot=\"end\" class=\"text-sm\"><b>{{val * 100 | number : '1.2-2'}}%</b></ion-text>\r\n </ion-item>\r\n <ion-progress-bar class=\"h-0 default-transition\" [ngClass]=\"{'h-1': val != 0 }\" [value]=\"val\"></ion-progress-bar>\r\n <ion-popover *ngIf=\"ExtensionIsImage(item)\" side=\"end\" alignment=\"center\" [trigger]=\"guid + '-' + i + '-nested-popover'\" [dismissOnSelect]=\"true\" triggerAction=\"click\">\r\n <ng-template>\r\n <ion-content *ngVar=\"isLoading(item) as isLoading\">\r\n <loading [hidden]=\"!isLoading\"></loading>\r\n <ion-img [hidden]=\"isLoading\" [src]=\"apiUrl + item\" (ionImgWillLoad)=\"SetLoading(item)\" (ionImgDidLoad)=\"SetNotLoading(item)\"></ion-img>\r\n </ion-content>\r\n </ng-template>\r\n </ion-popover>\r\n </section>\r\n }\r\n </ion-list>\r\n </ion-content>\r\n </ng-template>\r\n </ion-popover>\r\n}", styles: ["ion-popover{--width: 30rem }\n"], dependencies: [{ kind: "component", type: i1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i1.IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonImg, selector: "ion-img", inputs: ["alt", "src"] }, { kind: "component", type: i1.IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: i1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i1.IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: i1.IonProgressBar, selector: "ion-progress-bar", inputs: ["buffer", "color", "mode", "reversed", "type", "value"] }, { kind: "component", type: i1.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "component", type: i1.IonPopover, selector: "ion-popover" }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: LoadingComponent, selector: "loading", inputs: ["text", "type", "loading"] }, { kind: "directive", type: NgVarDirective, selector: "[ngVar]", inputs: ["ngVar"] }, { kind: "pipe", type: i1$2.DecimalPipe, name: "number" }] }); }
2835
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: DownloadButtonComponent, selector: "download-button", inputs: { expand: { classPropertyName: "expand", publicName: "expand", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: false, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: false, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, post: { classPropertyName: "post", publicName: "post", isSignal: false, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: false, isRequired: false, transformFunction: null }, customLabel: { classPropertyName: "customLabel", publicName: "customLabel", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, fileName: { classPropertyName: "fileName", publicName: "fileName", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: InputProviderFactory.GetProviders(DownloadButtonComponent), ngImport: i0, template: "@if(lstFiles().length == 0){\r\n <ion-button [color]=\"color\" fill=\"outline\" [disabled]=\"true\" [size]=\"size\"> \r\n <ion-icon name=\"close-circle\" slot=\"start\"></ion-icon> \r\n <ion-label> Sem arquivos... </ion-label>\r\n </ion-button>\r\n}\r\n@else if(lstFiles().length == 1){\r\n <ion-button [color]=\"color\" *ngVar=\"storageService.GetProgress(lstFiles()[0]) as val\" class=\"relative block {{expand == 'block' ? 'size-full' : ''}}\" [disabled]=\"val != 0 || disabled\" (click)=\"Download(lstFiles()[0])\" fill=\"outline\" [size]=\"size\"> \r\n <ion-icon name=\"download\" slot=\"start\"></ion-icon> \r\n <ion-label> {{customLabel ? label : Sanitize(lstFiles()[0])}} </ion-label>\r\n <div class=\"absolute size-full h-[calc(100%+var(--padding-top)+var(--padding-bottom))] w-[calc(100%+var(--padding-end)+var(--padding-start))]\">\r\n <loading [type]=\"3\" [loading]=\"val != 0\"></loading>\r\n <div class=\"size-full flex flex-row-reverse relative\">\r\n <ion-progress-bar class=\"absolute bottom-0 left-0 w-full h-1 default-transition\" [ngClass]=\"{'-translate-y-4 opacity-0': (!val || val == 0)}\" [value]=\"val\"></ion-progress-bar>\r\n </div>\r\n </div>\r\n </ion-button>\r\n}\r\n@else{\r\n <ion-button [color]=\"color\" [id]=\"guid\" fill=\"outline\" [size]=\"size\"> \r\n <ion-icon name=\"download\" slot=\"start\"></ion-icon> \r\n <ion-label> {{lstFiles().length}} Arquivos </ion-label>\r\n </ion-button>\r\n\r\n <ion-popover [trigger]=\"guid\" [keepContentsMounted]=\"true\" triggerAction=\"click\">\r\n <ng-template>\r\n <ion-content class=\"p-0 bg-transparent\">\r\n <ion-list>\r\n @for (item of lstFiles(); track item; let i = $index; let l = $last) {\r\n <section *ngVar=\"storageService.GetProgress(item) as val\">\r\n <ion-item style=\"--background: transparent\" lines=\"{{l ? 'none' : 'full'}}\" button [detail]=\"false\">\r\n\r\n <ion-icon name=\"download\" (click)=\"Download(item)\" slot=\"start\"></ion-icon> \r\n @if (ExtensionIsImage(item)) {\r\n <ion-icon [id]=\"guid + '-' + i + '-nested-popover'\" name=\"image\" slot=\"start\"></ion-icon> \r\n }\r\n\r\n <ion-label>{{Sanitize(item)}}</ion-label>\r\n <ion-text *ngIf=\"val != 0\" slot=\"end\" class=\"text-sm\"><b>{{val * 100 | number : '1.2-2'}}%</b></ion-text>\r\n </ion-item>\r\n <ion-progress-bar class=\"h-0 default-transition\" [ngClass]=\"{'h-1': val != 0 }\" [value]=\"val\"></ion-progress-bar>\r\n <ion-popover *ngIf=\"ExtensionIsImage(item)\" side=\"end\" alignment=\"center\" [trigger]=\"guid + '-' + i + '-nested-popover'\" [dismissOnSelect]=\"true\" triggerAction=\"click\">\r\n <ng-template>\r\n <ion-content *ngVar=\"isLoading(item) as isLoading\">\r\n <loading [hidden]=\"!isLoading\"></loading>\r\n <ion-img [hidden]=\"isLoading\" [src]=\"apiUrl + item\" (ionImgWillLoad)=\"SetLoading(item)\" (ionImgDidLoad)=\"SetNotLoading(item)\"></ion-img>\r\n </ion-content>\r\n </ng-template>\r\n </ion-popover>\r\n </section>\r\n }\r\n </ion-list>\r\n </ion-content>\r\n </ng-template>\r\n </ion-popover>\r\n}", styles: ["ion-popover{--width: 30rem }\n"], dependencies: [{ kind: "component", type: i1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i1.IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonImg, selector: "ion-img", inputs: ["alt", "src"] }, { kind: "component", type: i1.IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: i1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i1.IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: i1.IonProgressBar, selector: "ion-progress-bar", inputs: ["buffer", "color", "mode", "reversed", "type", "value"] }, { kind: "component", type: i1.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "component", type: i1.IonPopover, selector: "ion-popover" }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: LoadingComponent, selector: "loading", inputs: ["text", "type", "loading"] }, { kind: "directive", type: NgVarDirective, selector: "[ngVar]", inputs: ["ngVar"] }, { kind: "pipe", type: i1$2.DecimalPipe, name: "number" }] }); }
2832
2836
  }
2833
2837
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DownloadButtonComponent, decorators: [{
2834
2838
  type: Component,
@@ -2851,6 +2855,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
2851
2855
  type: Input
2852
2856
  }], label: [{
2853
2857
  type: Input
2858
+ }], fileName: [{
2859
+ type: Input
2854
2860
  }] } });
2855
2861
 
2856
2862
  /** Componente de paginação padrão */
@@ -4367,7 +4373,7 @@ class DefaultTableComponent {
4367
4373
  this.ativar.emit(id);
4368
4374
  }
4369
4375
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DefaultTableComponent, deps: [{ token: StorageService }, { token: i2$2.ActivatedRoute }, { token: i2$2.Router }], target: i0.ɵɵFactoryTarget.Component }); }
4370
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: DefaultTableComponent, selector: "default-table", inputs: { acoesTemplate: { classPropertyName: "acoesTemplate", publicName: "acoesTemplate", isSignal: false, isRequired: false, transformFunction: null }, service: { classPropertyName: "service", publicName: "service", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, orderByProperty: { classPropertyName: "orderByProperty", publicName: "orderByProperty", isSignal: true, isRequired: false, transformFunction: null }, ascending: { classPropertyName: "ascending", publicName: "ascending", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, lstTableFields: { classPropertyName: "lstTableFields", publicName: "lstTableFields", isSignal: true, isRequired: false, transformFunction: null }, noFilters: { classPropertyName: "noFilters", publicName: "noFilters", isSignal: true, isRequired: false, transformFunction: null }, columnClass: { classPropertyName: "columnClass", publicName: "columnClass", isSignal: true, isRequired: false, transformFunction: null }, columnStyle: { classPropertyName: "columnStyle", publicName: "columnStyle", isSignal: true, isRequired: false, transformFunction: null }, noPagination: { classPropertyName: "noPagination", publicName: "noPagination", isSignal: true, isRequired: false, transformFunction: null }, itemPath: { classPropertyName: "itemPath", publicName: "itemPath", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { total: "totalChange", limit: "limitChange", page: "pageChange", orderByProperty: "orderByPropertyChange", ascending: "ascendingChange", filter: "filterChange", ativar: "ativar", refresh: "refresh", loading: "loadingChange", items: "itemsChange", lstTableFields: "lstTableFieldsChange", itemClick: "itemClick" }, ngImport: i0, template: "<div class=\"size-full rounded-xl flex flex-col overflow-hidden relative\">\r\n <loading [type]=\"3\" [loading]=\"loading()\"></loading>\r\n <content-block text=\"Sem Dados\" [value]=\"!(items.length != 0 || loading)\"></content-block>\r\n\r\n <div class=\"size-full shrink relative overflow-y-auto\">\r\n <table>\r\n <thead>\r\n <tr>\r\n @if(acoesTemplate){\r\n <th scope=\"col\" class=\"p-2\"> \r\n A\u00E7\u00F5es \r\n </th>\r\n }\r\n\r\n @for (tfa of lstTableFieldsAvailable(); track tfa.tf.index) {\r\n <th scope=\"col\" class=\"p-2\"> \r\n <div class=\"flex gap-2 items-center justify-start th\">\r\n @if(!noFilters()){\r\n <th-filter class=\"!text-base\" style=\"text-transform: none !important\" \r\n *ngIf=\"((tfa.tf.type != InputType.File || (tfa.tf.filter && tfa.tf.disabledChange())) && !noFilters())\"\r\n [field]=\"tfa.tf\"\r\n (change)=\"ChangeFilter()\"\r\n ></th-filter>\r\n }\r\n\r\n {{tfa.tf.header}} \r\n\r\n @if((tfa.tf.type != InputType.File || (tfa.tf.filter && tfa.tf.disabledChange())) && !noFilters()){\r\n <a [ngClass]=\"{ 'bg-light/10 !opacity-100': tfa.ascending || tfa.descending }\"\r\n class=\"order h-4 w-5 relative cursor-pointer rounded-lg opacity-0 default-transition\" \r\n (click)=\"SwitchOrder(tfa.tf)\"\r\n >\r\n <ion-icon \r\n [class.text-primary]=\"tfa.ascending\"\r\n class=\"absolute left-0 top-0\" \r\n name=\"arrow-up\"\r\n ></ion-icon> \r\n <ion-icon \r\n [class.text-primary]=\"tfa.descending\"\r\n class=\"absolute right-0 bottom-0\" \r\n name=\"arrow-down\"\r\n ></ion-icon> \r\n </a>\r\n }\r\n </div>\r\n </th>\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (row of lstRows; track row.id || $index) {\r\n <tr [hidden]=\"loading()\">\r\n @if(acoesTemplate){\r\n <td (click)=\"Redirect(undefined, row.item)\" class=\"whitespace-nowrap py-1 px-3 {{row.acoesClass}}\" [style]=\"row.acoesStyle\" >\r\n <ng-container *ngTemplateOutlet=\"acoesTemplate; context: { $implicit: row.item }\"></ng-container>\r\n </td>\r\n }\r\n\r\n @for (col of row.lstColumns; track col.tf.index) {\r\n <td class=\"{{col.class}} p-2 cursor-pointer\" (click)=\"Redirect(col.tf, row.item)\" [style]=\"'white-space: var(--ion-table-row-wrap);' + col.style\">\r\n @if(col.tf.index == 'ativo') {\r\n <div class=\"size-full flex items-center justify-start\" [routerLink]=\"null\">\r\n <ion-toggle [checked]=\"col.value\" [disabled]=\"loading()\" (ionChange)=\"Ativar(row.id)\" ></ion-toggle>\r\n </div>\r\n }\r\n @else if (col.tf.type == InputType.Bool){\r\n <div class=\"h-full flex items-center justify-start\">\r\n @if(col.tf.configuration.type == 'toggle') {\r\n <ion-toggle [checked]=\"col.value\" [disabled]=\"true\"></ion-toggle>\r\n }\r\n @else {\r\n <ion-checkbox [checked]=\"col.value\" [disabled]=\"true\"></ion-checkbox>\r\n }\r\n </div>\r\n }\r\n @else if (col.tf.type == InputType.File) {\r\n <download-button [(ngModel)]=\"col.value\" [configuration]=\"col.tf.configuration\"></download-button>\r\n }\r\n @else if (col.loading){\r\n <ion-spinner name=\"dots\"></ion-spinner>\r\n } @else {\r\n <span [ngClass]=\"col.class\">{{ col.label }}</span>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n <ng-content select=\"[slot=item-end]\"></ng-content>\r\n }\r\n </tbody>\r\n </table>\r\n </div>\r\n @if(!noPagination()){\r\n <div class=\"shrink-0 z-[100]\">\r\n <default-pagination\r\n [page]=\"page()\"\r\n (pageChange)=\"page.set($event); refresh.emit()\"\r\n [total]=\"total()\"\r\n [limit]=\"limit()\"\r\n [length]=\"items().length\"\r\n [loading]=\"loading()\"\r\n ></default-pagination>\r\n </div>\r\n }\r\n</div>", styles: [".th:hover>.order{opacity:1;background-color:color-mix(in srgb,var(--ion-color-light) 10%,transparent)}\n"], dependencies: [{ kind: "component", type: i1.IonCheckbox, selector: "ion-checkbox", inputs: ["alignment", "checked", "color", "disabled", "errorText", "helperText", "indeterminate", "justify", "labelPlacement", "mode", "name", "required", "value"] }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "component", type: i1.IonToggle, selector: "ion-toggle", inputs: ["alignment", "checked", "color", "disabled", "enableOnOffLabels", "errorText", "helperText", "justify", "labelPlacement", "mode", "name", "required", "value"] }, { kind: "directive", type: i1.BooleanValueAccessor, selector: "ion-checkbox,ion-toggle" }, { kind: "directive", type: i1.RouterLinkDelegate, selector: ":not(a):not(area)[routerLink]" }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DownloadButtonComponent, selector: "download-button", inputs: ["expand", "value", "size", "color", "params", "disabled", "post", "configuration", "customLabel", "label"], outputs: ["valueChange"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: LoadingComponent, selector: "loading", inputs: ["text", "type", "loading"] }, { kind: "component", type: ContentBlockComponent, selector: "content-block", inputs: ["text", "value"] }, { kind: "component", type: DefaultPaginationComponent, selector: "default-pagination", inputs: ["total", "limit", "length", "loading", "page"], outputs: ["pageChange", "change"] }, { kind: "component", type: ThFilterComponent, selector: "th-filter", inputs: ["field"], outputs: ["change"] }] }); }
4376
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: DefaultTableComponent, selector: "default-table", inputs: { acoesTemplate: { classPropertyName: "acoesTemplate", publicName: "acoesTemplate", isSignal: false, isRequired: false, transformFunction: null }, service: { classPropertyName: "service", publicName: "service", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, orderByProperty: { classPropertyName: "orderByProperty", publicName: "orderByProperty", isSignal: true, isRequired: false, transformFunction: null }, ascending: { classPropertyName: "ascending", publicName: "ascending", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, lstTableFields: { classPropertyName: "lstTableFields", publicName: "lstTableFields", isSignal: true, isRequired: false, transformFunction: null }, noFilters: { classPropertyName: "noFilters", publicName: "noFilters", isSignal: true, isRequired: false, transformFunction: null }, columnClass: { classPropertyName: "columnClass", publicName: "columnClass", isSignal: true, isRequired: false, transformFunction: null }, columnStyle: { classPropertyName: "columnStyle", publicName: "columnStyle", isSignal: true, isRequired: false, transformFunction: null }, noPagination: { classPropertyName: "noPagination", publicName: "noPagination", isSignal: true, isRequired: false, transformFunction: null }, itemPath: { classPropertyName: "itemPath", publicName: "itemPath", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { total: "totalChange", limit: "limitChange", page: "pageChange", orderByProperty: "orderByPropertyChange", ascending: "ascendingChange", filter: "filterChange", ativar: "ativar", refresh: "refresh", loading: "loadingChange", items: "itemsChange", lstTableFields: "lstTableFieldsChange", itemClick: "itemClick" }, ngImport: i0, template: "<div class=\"size-full rounded-xl flex flex-col overflow-hidden relative\">\r\n <loading [type]=\"3\" [loading]=\"loading()\"></loading>\r\n <content-block text=\"Sem Dados\" [value]=\"!(items.length != 0 || loading)\"></content-block>\r\n\r\n <div class=\"size-full shrink relative overflow-y-auto\">\r\n <table>\r\n <thead>\r\n <tr>\r\n @if(acoesTemplate){\r\n <th scope=\"col\" class=\"p-2\"> \r\n A\u00E7\u00F5es \r\n </th>\r\n }\r\n\r\n @for (tfa of lstTableFieldsAvailable(); track tfa.tf.index) {\r\n <th scope=\"col\" class=\"p-2\"> \r\n <div class=\"flex gap-2 items-center justify-start th\">\r\n @if(!noFilters()){\r\n <th-filter class=\"!text-base\" style=\"text-transform: none !important\" \r\n *ngIf=\"((tfa.tf.type != InputType.File || (tfa.tf.filter && tfa.tf.disabledChange())) && !noFilters())\"\r\n [field]=\"tfa.tf\"\r\n (change)=\"ChangeFilter()\"\r\n ></th-filter>\r\n }\r\n\r\n {{tfa.tf.header}} \r\n\r\n @if((tfa.tf.type != InputType.File || (tfa.tf.filter && tfa.tf.disabledChange())) && !noFilters()){\r\n <a [ngClass]=\"{ 'bg-light/10 !opacity-100': tfa.ascending || tfa.descending }\"\r\n class=\"order h-4 w-5 relative cursor-pointer rounded-lg opacity-0 default-transition\" \r\n (click)=\"SwitchOrder(tfa.tf)\"\r\n >\r\n <ion-icon \r\n [class.text-primary]=\"tfa.ascending\"\r\n class=\"absolute left-0 top-0\" \r\n name=\"arrow-up\"\r\n ></ion-icon> \r\n <ion-icon \r\n [class.text-primary]=\"tfa.descending\"\r\n class=\"absolute right-0 bottom-0\" \r\n name=\"arrow-down\"\r\n ></ion-icon> \r\n </a>\r\n }\r\n </div>\r\n </th>\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (row of lstRows; track row.id || $index) {\r\n <tr [hidden]=\"loading()\">\r\n @if(acoesTemplate){\r\n <td (click)=\"Redirect(undefined, row.item)\" class=\"whitespace-nowrap py-1 px-3 {{row.acoesClass}}\" [style]=\"row.acoesStyle\" >\r\n <ng-container *ngTemplateOutlet=\"acoesTemplate; context: { $implicit: row.item }\"></ng-container>\r\n </td>\r\n }\r\n\r\n @for (col of row.lstColumns; track col.tf.index) {\r\n <td class=\"{{col.class}} p-2 cursor-pointer\" (click)=\"Redirect(col.tf, row.item)\" [style]=\"'white-space: var(--ion-table-row-wrap);' + col.style\">\r\n @if(col.tf.index == 'ativo') {\r\n <div class=\"size-full flex items-center justify-start\" [routerLink]=\"null\">\r\n <ion-toggle [checked]=\"col.value\" [disabled]=\"loading()\" (ionChange)=\"Ativar(row.id)\" ></ion-toggle>\r\n </div>\r\n }\r\n @else if (col.tf.type == InputType.Bool){\r\n <div class=\"h-full flex items-center justify-start\">\r\n @if(col.tf.configuration.type == 'toggle') {\r\n <ion-toggle [checked]=\"col.value\" [disabled]=\"true\"></ion-toggle>\r\n }\r\n @else {\r\n <ion-checkbox [checked]=\"col.value\" [disabled]=\"true\"></ion-checkbox>\r\n }\r\n </div>\r\n }\r\n @else if (col.tf.type == InputType.File) {\r\n <download-button [(ngModel)]=\"col.value\" [configuration]=\"col.tf.configuration\"></download-button>\r\n }\r\n @else if (col.loading){\r\n <ion-spinner name=\"dots\"></ion-spinner>\r\n } @else {\r\n <span [ngClass]=\"col.class\">{{ col.label }}</span>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n <ng-content select=\"[slot=item-end]\"></ng-content>\r\n }\r\n </tbody>\r\n </table>\r\n </div>\r\n @if(!noPagination()){\r\n <div class=\"shrink-0 z-[100]\">\r\n <default-pagination\r\n [page]=\"page()\"\r\n (pageChange)=\"page.set($event); refresh.emit()\"\r\n [total]=\"total()\"\r\n [limit]=\"limit()\"\r\n [length]=\"items().length\"\r\n [loading]=\"loading()\"\r\n ></default-pagination>\r\n </div>\r\n }\r\n</div>", styles: [".th:hover>.order{opacity:1;background-color:color-mix(in srgb,var(--ion-color-light) 10%,transparent)}\n"], dependencies: [{ kind: "component", type: i1.IonCheckbox, selector: "ion-checkbox", inputs: ["alignment", "checked", "color", "disabled", "errorText", "helperText", "indeterminate", "justify", "labelPlacement", "mode", "name", "required", "value"] }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "component", type: i1.IonToggle, selector: "ion-toggle", inputs: ["alignment", "checked", "color", "disabled", "enableOnOffLabels", "errorText", "helperText", "justify", "labelPlacement", "mode", "name", "required", "value"] }, { kind: "directive", type: i1.BooleanValueAccessor, selector: "ion-checkbox,ion-toggle" }, { kind: "directive", type: i1.RouterLinkDelegate, selector: ":not(a):not(area)[routerLink]" }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DownloadButtonComponent, selector: "download-button", inputs: ["expand", "value", "size", "color", "params", "disabled", "post", "configuration", "customLabel", "label", "fileName"], outputs: ["valueChange"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: LoadingComponent, selector: "loading", inputs: ["text", "type", "loading"] }, { kind: "component", type: ContentBlockComponent, selector: "content-block", inputs: ["text", "value"] }, { kind: "component", type: DefaultPaginationComponent, selector: "default-pagination", inputs: ["total", "limit", "length", "loading", "page"], outputs: ["pageChange", "change"] }, { kind: "component", type: ThFilterComponent, selector: "th-filter", inputs: ["field"], outputs: ["change"] }] }); }
4371
4377
  }
4372
4378
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DefaultTableComponent, decorators: [{
4373
4379
  type: Component,
@@ -10530,38 +10536,46 @@ class InputTextareaComponent extends CustomInput {
10530
10536
  this.configuration = input(new InputTextAreaConfiguration());
10531
10537
  }
10532
10538
  resize() {
10533
- if (this.configuration().autoGrow) {
10534
- setTimeout(() => {
10535
- const textarea = this.input?.nativeElement;
10536
- if (!textarea)
10537
- return;
10538
- const isFocused = document.activeElement === textarea;
10539
- const selectionStart = textarea.selectionStart;
10540
- const selectionEnd = textarea.selectionEnd;
10541
- // 🔹 Salva posição de rolagem
10542
- const scrollTop = textarea.scrollTop;
10543
- // Redefine altura
10544
- textarea.style.height = 'auto';
10545
- textarea.style.height = `${textarea.scrollHeight}px`;
10546
- // 🔹 Restaura posição de rolagem
10547
- textarea.scrollTop = scrollTop;
10548
- if (isFocused) {
10549
- textarea.focus({ preventScroll: true });
10550
- textarea.setSelectionRange(selectionStart, selectionEnd);
10551
- }
10552
- });
10539
+ if (!this.configuration().autoGrow)
10540
+ return;
10541
+ const textarea = this.input?.nativeElement;
10542
+ if (!textarea)
10543
+ return;
10544
+ const selectionStart = textarea.selectionStart;
10545
+ const selectionEnd = textarea.selectionEnd;
10546
+ // bloqueia rolagem do container pai temporariamente
10547
+ const scrollParent = this.EncontraScroll(textarea);
10548
+ const prevScroll = scrollParent ? scrollParent.scrollTop : 0;
10549
+ // recalcula altura
10550
+ textarea.style.overflow = 'hidden';
10551
+ textarea.style.height = 'auto';
10552
+ textarea.style.height = `${textarea.scrollHeight}px`;
10553
+ // restaura posição do scroll do container
10554
+ if (scrollParent)
10555
+ scrollParent.scrollTop = prevScroll;
10556
+ // mantém posição do cursor sem chamar focus()
10557
+ textarea.setSelectionRange(selectionStart, selectionEnd);
10558
+ }
10559
+ // Encontra o container com scroll (ex: ion-content, div com overflow)
10560
+ EncontraScroll(el) {
10561
+ let parent = el.parentElement;
10562
+ while (parent) {
10563
+ const style = getComputedStyle(parent);
10564
+ if (/(auto|scroll)/.test(style.overflowY))
10565
+ return parent;
10566
+ parent = parent.parentElement;
10553
10567
  }
10568
+ return null;
10554
10569
  }
10555
10570
  onInput() {
10556
- // Só executa se autoGrow for true
10557
10571
  if (this.configuration().autoGrow) {
10558
- this.resize();
10572
+ requestAnimationFrame(() => this.resize());
10559
10573
  }
10560
10574
  }
10561
10575
  writeValue(obj) {
10562
10576
  this.value.set(obj);
10563
10577
  this.runValidation();
10564
- this.resize();
10578
+ requestAnimationFrame(() => this.resize());
10565
10579
  }
10566
10580
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InputTextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10567
10581
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.14", type: InputTextareaComponent, selector: "input-textarea", inputs: { configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "onInput()" } }, providers: [