@po-ui/ng-components 20.2.0 → 20.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5608,6 +5608,7 @@ var PoCheckboxSize;
5608
5608
  *
5609
5609
  */
5610
5610
  class PoCheckboxBaseComponent {
5611
+ cd;
5611
5612
  // Propriedade interna que define se o ícone de ajuda adicional terá cursor clicável (evento) ou padrão (tooltip).
5612
5613
  additionalHelpEventTrigger;
5613
5614
  /**
@@ -5737,6 +5738,9 @@ class PoCheckboxBaseComponent {
5737
5738
  get size() {
5738
5739
  return this._size ?? getDefaultSizeFn(PoCheckboxSize);
5739
5740
  }
5741
+ constructor(cd) {
5742
+ this.cd = cd;
5743
+ }
5740
5744
  changeValue() {
5741
5745
  if (this.propagateChange) {
5742
5746
  this.propagateChange(this.checkboxValue);
@@ -5753,6 +5757,7 @@ class PoCheckboxBaseComponent {
5753
5757
  // Usada para interceptar os estados de habilitado via forms api
5754
5758
  setDisabledState(isDisabled) {
5755
5759
  this.disabled = isDisabled;
5760
+ this.cd.markForCheck();
5756
5761
  }
5757
5762
  registerOnChange(fn) {
5758
5763
  this.propagateChange = fn;
@@ -5765,12 +5770,12 @@ class PoCheckboxBaseComponent {
5765
5770
  this.changeModelValue(value);
5766
5771
  }
5767
5772
  }
5768
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoCheckboxBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
5773
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoCheckboxBaseComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
5769
5774
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.0.7", type: PoCheckboxBaseComponent, isStandalone: true, inputs: { additionalHelpEventTrigger: "additionalHelpEventTrigger", additionalHelpTooltip: ["p-additional-help-tooltip", "additionalHelpTooltip"], appendBox: ["p-append-in-body", "appendBox", convertToBoolean], help: ["p-help", "help"], name: "name", autoFocus: ["p-auto-focus", "autoFocus", convertToBoolean], label: ["p-label", "label"], checkboxValue: ["p-checkboxValue", "checkboxValue"], checkBoxRequired: ["p-required", "checkBoxRequired", convertToBoolean], disabladTabindex: ["p-disabled-tabindex", "disabladTabindex", convertToBoolean], disabled: ["p-disabled", "disabled"], size: ["p-size", "size"] }, outputs: { additionalHelp: "p-additional-help", blur: "p-blur", change: "p-change", keydown: "p-keydown" }, ngImport: i0 });
5770
5775
  }
5771
5776
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoCheckboxBaseComponent, decorators: [{
5772
5777
  type: Directive
5773
- }], propDecorators: { additionalHelpEventTrigger: [{
5778
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { additionalHelpEventTrigger: [{
5774
5779
  type: Input
5775
5780
  }], additionalHelpTooltip: [{
5776
5781
  type: Input,
@@ -6118,12 +6123,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
6118
6123
  * </example>
6119
6124
  */
6120
6125
  class PoCheckboxComponent extends PoCheckboxBaseComponent {
6121
- changeDetector = inject(ChangeDetectorRef);
6126
+ changeDetector;
6122
6127
  _iconToken;
6123
6128
  checkboxLabel;
6124
6129
  constructor() {
6125
6130
  const value = inject(ICONS_DICTIONARY, { optional: true });
6126
- super();
6131
+ const changeDetector = inject(ChangeDetectorRef);
6132
+ super(changeDetector);
6133
+ this.changeDetector = changeDetector;
6127
6134
  this._iconToken = value ?? AnimaliaIconDictionary;
6128
6135
  }
6129
6136
  /**
@@ -13142,6 +13149,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
13142
13149
  }] } });
13143
13150
 
13144
13151
  class PoFieldModel {
13152
+ cd;
13145
13153
  // Propriedade interna que define se o ícone de ajuda adicional terá cursor clicável (evento) ou padrão (tooltip).
13146
13154
  additionalHelpEventTrigger;
13147
13155
  /**
@@ -13212,11 +13220,14 @@ class PoFieldModel {
13212
13220
  value;
13213
13221
  onTouched;
13214
13222
  propagateChange;
13215
- constructor() { }
13223
+ constructor(cd) {
13224
+ this.cd = cd;
13225
+ }
13216
13226
  // Função implementada do ControlValueAccessor
13217
13227
  // Usada para interceptar os estados de habilitado via forms api
13218
13228
  setDisabledState(isDisabled) {
13219
13229
  this.disabled = isDisabled;
13230
+ this.cd?.markForCheck();
13220
13231
  }
13221
13232
  registerOnChange(fn) {
13222
13233
  this.propagateChange = fn;
@@ -13275,12 +13286,12 @@ class PoFieldModel {
13275
13286
  this.propagateChange(value);
13276
13287
  }
13277
13288
  }
13278
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoFieldModel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
13289
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoFieldModel, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
13279
13290
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.0.7", type: PoFieldModel, isStandalone: true, inputs: { additionalHelpEventTrigger: "additionalHelpEventTrigger", additionalHelpTooltip: ["p-additional-help-tooltip", "additionalHelpTooltip"], appendBox: ["p-append-in-body", "appendBox", convertToBoolean], label: ["p-label", "label"], name: "name", help: ["p-help", "help"], disabled: ["p-disabled", "disabled", convertToBoolean] }, outputs: { additionalHelp: "p-additional-help", change: "p-change", keydown: "p-keydown" }, ngImport: i0 });
13280
13291
  }
13281
13292
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoFieldModel, decorators: [{
13282
13293
  type: Directive
13283
- }], ctorParameters: () => [], propDecorators: { additionalHelpEventTrigger: [{
13294
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { additionalHelpEventTrigger: [{
13284
13295
  type: Input
13285
13296
  }], additionalHelpTooltip: [{
13286
13297
  type: Input,
@@ -14763,6 +14774,7 @@ class PoDatepickerBaseComponent {
14763
14774
  // Usada para interceptar os estados de habilitado via forms api
14764
14775
  setDisabledState(isDisabled) {
14765
14776
  this.disabled = isDisabled;
14777
+ this.cd.markForCheck();
14766
14778
  }
14767
14779
  // Função implementada do ControlValueAccessor
14768
14780
  // Usada para interceptar as mudanças e não atualizar automaticamente o Model
@@ -26198,6 +26210,7 @@ class PoComboBaseComponent {
26198
26210
  // Usada para interceptar os estados de habilitado via forms api
26199
26211
  setDisabledState(isDisabled) {
26200
26212
  this.disabled = isDisabled;
26213
+ this.changeDetector.markForCheck();
26201
26214
  }
26202
26215
  registerOnChange(fn) {
26203
26216
  this.onModelChange = fn;
@@ -27050,7 +27063,6 @@ class PoComboComponent extends PoComboBaseComponent {
27050
27063
  // Esconde Content do Combo quando for clicado fora
27051
27064
  this.controlComboVisibility(false);
27052
27065
  this.verifyValidOption();
27053
- // caso for changeOnEnter deve limpar o selectedView para reinicia-lo
27054
27066
  this.selectedView = this.changeOnEnter && !this.selectedValue ? undefined : this.selectedView;
27055
27067
  }
27056
27068
  else {
@@ -27213,7 +27225,6 @@ class PoComboComponent extends PoComboBaseComponent {
27213
27225
  setScrollingControl() {
27214
27226
  return this.infiniteScroll ? true : false;
27215
27227
  }
27216
- // Define o foco no item apropriado do listbox.
27217
27228
  focusItem() {
27218
27229
  this.poListbox?.listboxItemList?.nativeElement.focus();
27219
27230
  setTimeout(() => {
@@ -27235,7 +27246,6 @@ class PoComboComponent extends PoComboBaseComponent {
27235
27246
  event?.preventDefault();
27236
27247
  this.inputEl.nativeElement.focus();
27237
27248
  }
27238
- // Determina se o tab deve abrir o listbox.
27239
27249
  shouldHandleTab(event) {
27240
27250
  return this.comboOpen && this.appendBox && !event.shiftKey;
27241
27251
  }
@@ -27776,6 +27786,7 @@ class PoDatepickerRangeBaseComponent {
27776
27786
  // Usada para interceptar os estados de habilitado via forms api
27777
27787
  setDisabledState(isDisabled) {
27778
27788
  this.disabled = isDisabled;
27789
+ this.changeDetector.markForCheck();
27779
27790
  }
27780
27791
  // Função implementada do ControlValueAccessor
27781
27792
  // Usada para interceptar as mudanças e não atualizar automaticamente o Model
@@ -35985,6 +35996,7 @@ const poUploadMinFileSize = 0;
35985
35996
  */
35986
35997
  class PoUploadBaseComponent {
35987
35998
  uploadService;
35999
+ cd;
35988
36000
  // Propriedade interna que define se o ícone de ajuda adicional terá cursor clicável (evento) ou padrão (tooltip).
35989
36001
  additionalHelpEventTrigger;
35990
36002
  /**
@@ -36507,14 +36519,16 @@ class PoUploadBaseComponent {
36507
36519
  get size() {
36508
36520
  return this._size ?? getDefaultSizeFn(PoFieldSize);
36509
36521
  }
36510
- constructor(uploadService, languageService) {
36522
+ constructor(uploadService, languageService, cd) {
36511
36523
  this.uploadService = uploadService;
36524
+ this.cd = cd;
36512
36525
  this.language = languageService.getShortLanguage();
36513
36526
  }
36514
36527
  // Função implementada do ControlValueAccessor
36515
36528
  // Usada para interceptar os estados de habilitado via forms api
36516
36529
  setDisabledState(isDisabled) {
36517
36530
  this.disabled = isDisabled;
36531
+ this.cd.markForCheck();
36518
36532
  }
36519
36533
  registerOnChange(fn) {
36520
36534
  this.onModelChange = fn;
@@ -36636,12 +36650,12 @@ class PoUploadBaseComponent {
36636
36650
  }
36637
36651
  return files;
36638
36652
  }
36639
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoUploadBaseComponent, deps: [{ token: PoUploadService }, { token: PoLanguageService }], target: i0.ɵɵFactoryTarget.Directive });
36653
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoUploadBaseComponent, deps: [{ token: PoUploadService }, { token: PoLanguageService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
36640
36654
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.0.7", type: PoUploadBaseComponent, isStandalone: true, inputs: { additionalHelpEventTrigger: "additionalHelpEventTrigger", additionalHelpTooltip: ["p-additional-help-tooltip", "additionalHelpTooltip"], appendBox: ["p-append-in-body", "appendBox", convertToBoolean], autoFocus: ["p-auto-focus", "autoFocus", convertToBoolean], dragDropHeight: ["p-drag-drop-height", "dragDropHeight"], label: ["p-label", "label"], help: ["p-help", "help"], url: ["p-url", "url"], name: "name", autoUpload: ["p-auto-upload", "autoUpload"], disabledRemoveFile: ["p-disabled-remove-file", "disabledRemoveFile", convertToBoolean], optional: ["p-optional", "optional"], headers: ["p-headers", "headers"], requiredUrl: ["p-required-url", "requiredUrl", convertToBoolean], customAction: ["p-custom-action", "customAction"], directory: ["p-directory", "directory"], dragDrop: ["p-drag-drop", "dragDrop"], hideRestrictionsInfo: ["p-hide-restrictions-info", "hideRestrictionsInfo"], hideSelectButton: ["p-hide-select-button", "hideSelectButton"], hideSendButton: ["p-hide-send-button", "hideSendButton"], literals: ["p-literals", "literals"], fileRestrictions: ["p-restrictions", "fileRestrictions"], formField: ["p-form-field", "formField"], disabled: ["p-disabled", "disabled"], isMultiple: ["p-multiple", "isMultiple"], required: ["p-required", "required"], showRequired: ["p-show-required", "showRequired"], size: ["p-size", "size"] }, outputs: { additionalHelp: "p-additional-help", customActionClick: "p-custom-action-click", keydown: "p-keydown", onUpload: "p-upload", onError: "p-error", onSuccess: "p-success", ngModelChange: "ngModelChange" }, host: { properties: { "attr.p-required-url": "this.requiredUrl" } }, ngImport: i0 });
36641
36655
  }
36642
36656
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PoUploadBaseComponent, decorators: [{
36643
36657
  type: Directive
36644
- }], ctorParameters: () => [{ type: PoUploadService }, { type: PoLanguageService }], propDecorators: { additionalHelpEventTrigger: [{
36658
+ }], ctorParameters: () => [{ type: PoUploadService }, { type: PoLanguageService }, { type: i0.ChangeDetectorRef }], propDecorators: { additionalHelpEventTrigger: [{
36645
36659
  type: Input
36646
36660
  }], additionalHelpTooltip: [{
36647
36661
  type: Input,
@@ -37191,7 +37205,6 @@ class PoUploadComponent extends PoUploadBaseComponent {
37191
37205
  renderer = inject(Renderer2);
37192
37206
  i18nPipe = inject(PoI18nPipe);
37193
37207
  notification = inject(PoNotificationService);
37194
- cd = inject(ChangeDetectorRef);
37195
37208
  inputFile;
37196
37209
  poUploadDragDropComponent;
37197
37210
  uploadButton;
@@ -37216,7 +37229,8 @@ class PoUploadComponent extends PoUploadBaseComponent {
37216
37229
  constructor() {
37217
37230
  const uploadService = inject(PoUploadService);
37218
37231
  const languageService = inject(PoLanguageService);
37219
- super(uploadService, languageService);
37232
+ const cd = inject(ChangeDetectorRef);
37233
+ super(uploadService, languageService, cd);
37220
37234
  }
37221
37235
  get displayDragDrop() {
37222
37236
  return this.dragDrop && !isMobile();
@@ -37323,7 +37337,6 @@ class PoUploadComponent extends PoUploadBaseComponent {
37323
37337
  }
37324
37338
  return false;
37325
37339
  }
37326
- // retorna se o status do arquivo é diferente de enviado
37327
37340
  isAllowCancelEvent(status) {
37328
37341
  return status !== PoUploadStatus.Uploaded;
37329
37342
  }
@@ -37332,7 +37345,6 @@ class PoUploadComponent extends PoUploadBaseComponent {
37332
37345
  this.showAdditionalHelp();
37333
37346
  }
37334
37347
  }
37335
- // Função disparada ao selecionar algum arquivo.
37336
37348
  onFileChange(event) {
37337
37349
  // necessário este tratamento quando para IE, pois nele o change é disparado quando o campo é limpado também
37338
37350
  if (this.calledByCleanInputValue) {
@@ -37351,7 +37363,6 @@ class PoUploadComponent extends PoUploadBaseComponent {
37351
37363
  this.keydown.emit(event);
37352
37364
  }
37353
37365
  }
37354
- // Remove o arquivo passado por parâmetro da lista dos arquivos correntes.
37355
37366
  removeFile(file) {
37356
37367
  const index = this.currentFiles.indexOf(file);
37357
37368
  this.currentFiles.splice(index, 1);
@@ -37425,7 +37436,6 @@ class PoUploadComponent extends PoUploadBaseComponent {
37425
37436
  showAdditionalHelpIcon() {
37426
37437
  return !!this.additionalHelpTooltip || this.isAdditionalHelpEventTriggered();
37427
37438
  }
37428
- // Caso o componente estiver no modo AutoUpload, o arquivo também será removido da lista.
37429
37439
  stopUpload(file) {
37430
37440
  this.uploadService.stopRequestByFile(file, () => {
37431
37441
  if (this.autoUpload) {
@@ -37440,7 +37450,6 @@ class PoUploadComponent extends PoUploadBaseComponent {
37440
37450
  trackByFn(index, file) {
37441
37451
  return file.uid;
37442
37452
  }
37443
- // Envia os arquivos passados por parâmetro, exceto os que já foram enviados ao serviço.
37444
37453
  uploadFiles(files) {
37445
37454
  const filesFiltered = files.filter(file => file.status !== PoUploadStatus.Uploaded);
37446
37455
  this.uploadService.upload(this.url, filesFiltered, this.headers, this.onUpload, (file, percent) => {
@@ -37473,18 +37482,15 @@ class PoUploadComponent extends PoUploadBaseComponent {
37473
37482
  isUploadButtonFocused() {
37474
37483
  return document.activeElement === this.uploadButton.buttonElement.nativeElement;
37475
37484
  }
37476
- // função disparada na resposta do sucesso ou error
37477
37485
  responseHandler(file, status) {
37478
37486
  file.status = status;
37479
37487
  file.percent = 100;
37480
37488
  this.cd.markForCheck();
37481
37489
  }
37482
- // método responsável por setar os argumentos do i18nPipe de acordo com a restrição.
37483
37490
  setPipeArguments(literalAttributes, literalArguments) {
37484
37491
  const pipeArguments = this.i18nPipe.transform(this.literals[literalAttributes], literalArguments);
37485
37492
  this.notification.information(pipeArguments);
37486
37493
  }
37487
- // Função disparada ao parar um envio de arquivo.
37488
37494
  stopUploadHandler(file) {
37489
37495
  file.status = PoUploadStatus.None;
37490
37496
  file.percent = 0;
@@ -37497,18 +37503,15 @@ class PoUploadComponent extends PoUploadBaseComponent {
37497
37503
  this.uploadFiles(this.currentFiles);
37498
37504
  }
37499
37505
  }
37500
- // Atualiza o ngModel para os arquivos passados por parâmetro.
37501
37506
  updateModel(files) {
37502
37507
  const modelFiles = this.mapCleanUploadFiles(files);
37503
37508
  this.onModelChange ? this.onModelChange(modelFiles) : this.ngModelChange.emit(modelFiles);
37504
37509
  }
37505
- // Função disparada enquanto o arquivo está sendo enviado ao serviço.
37506
37510
  uploadingHandler(file, percent) {
37507
37511
  file.status = PoUploadStatus.Uploading;
37508
37512
  file.percent = percent;
37509
37513
  this.cd.markForCheck();
37510
37514
  }
37511
- // retorna os objetos do array sem as propriedades: percent e displayName
37512
37515
  mapCleanUploadFiles(files) {
37513
37516
  const mapedByUploadFile = progressFile => {
37514
37517
  const { percent, displayName, ...uploadFile } = progressFile;
@@ -38410,7 +38413,7 @@ class PoFieldValidateModel extends PoFieldModel {
38410
38413
  hasValidatorRequired = false;
38411
38414
  onValidatorChange;
38412
38415
  constructor(changeDetector) {
38413
- super();
38416
+ super(changeDetector);
38414
38417
  this.changeDetector = changeDetector;
38415
38418
  }
38416
38419
  validate(abstractControl) {
@@ -50810,13 +50813,13 @@ class PoContextTabsComponent extends PoTabsComponent {
50810
50813
  }
50811
50814
  if (!currentTab) {
50812
50815
  this.initialTabsWidth.push({ id: tab.nativeElement.id, width: tab.nativeElement.offsetWidth });
50813
- if (index > quantityTabs - 1) {
50816
+ if (index > quantityTabs) {
50814
50817
  tab.nativeElement.style.display = 'none';
50815
50818
  tab.nativeElement.hidden = true;
50816
50819
  }
50817
50820
  this.tabsChildren['_results'] = this.tabsChildren['_results'].filter(item => !item.removed);
50818
50821
  }
50819
- if (tab.nativeElement.hidden && index <= quantityTabs - 1)
50822
+ if (tab.nativeElement.hidden && index <= quantityTabs)
50820
50823
  return;
50821
50824
  index++;
50822
50825
  });
@@ -54841,11 +54844,15 @@ const NO_MESSAGE_HEADER_PARAM = 'X-PO-No-Message';
54841
54844
  *
54842
54845
  * ## Configuração
54843
54846
  *
54844
- * Para o correto funcionamento do interceptor `po-http-interceptor`, deve ser importado o `BrowserAnimationsModule` no
54845
- * módulo principal da sua aplicação. Além disso, é necessário configurar o `HttpClient` para utilizar os interceptors
54846
- * registrados no Dependency Injection (DI) por meio da função `provideHttpClient(withInterceptorsFromDi())`.
54847
+ * Para o correto funcionamento do interceptor `po-http-interceptor`, deve ser importado o `BrowserAnimationsModule` na
54848
+ * aplicação. Além disso, é necessário configurar o `HttpClient` para utilizar os interceptors registrados via Dependency
54849
+ * Injection (DI) por meio da função `provideHttpClient(withInterceptorsFromDi())`.
54850
+ *
54851
+ * ### 1) NgModule
54852
+ *
54853
+ * No módulo principal da aplicação (geralmente `AppModule`), importe o `BrowserAnimationsModule` e configure o `HttpClient`,
54854
+ * como no exemplo abaixo:
54847
54855
  *
54848
- * Módulo da aplicação:
54849
54856
  * ```
54850
54857
  * import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
54851
54858
  * import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
@@ -54875,6 +54882,32 @@ const NO_MESSAGE_HEADER_PARAM = 'X-PO-No-Message';
54875
54882
  * Ao importar o módulo `PoModule` na aplicação, o `po-http-interceptor` é automaticamente configurado sem a necessidade
54876
54883
  * de qualquer configuração extra.
54877
54884
  *
54885
+ * ### 2) Standalone
54886
+ *
54887
+ * No arquivo contendo a configuração da aplicação (geralmente `src/app/app.config.ts`), adicione os providers e configure o `HttpClient`,
54888
+ * como no exemplo abaixo:
54889
+ *
54890
+ * ```
54891
+ * import { ApplicationConfig, importProvidersFrom } from '@angular/core';
54892
+ * import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
54893
+ * import { provideAnimations } from '@angular/platform-browser/animations';
54894
+ * import { PoHttpInterceptorModule } from '@po-ui/ng-components';
54895
+ *
54896
+ * export const appConfig: ApplicationConfig = {
54897
+ * providers: [
54898
+ * ...
54899
+ * provideAnimations(),
54900
+ * provideHttpClient(withInterceptorsFromDi()),
54901
+ * importProvidersFrom([
54902
+ * PoHttpInterceptorModule
54903
+ * ]),
54904
+ * ...
54905
+ * ]
54906
+ * };
54907
+ * ```
54908
+ *
54909
+ * ## Como usar
54910
+ *
54878
54911
  * Ao realizar requisições utilize o `HttpClient`, conforme exemplo abaixo:
54879
54912
  *
54880
54913
  * ```
@@ -54898,8 +54931,6 @@ const NO_MESSAGE_HEADER_PARAM = 'X-PO-No-Message';
54898
54931
  * }
54899
54932
  * ```
54900
54933
  *
54901
- * ## Como usar
54902
- *
54903
54934
  * Para exibir as noticações é necessário informar a mensagem no retorno da requisição. A estrutura da mensagem
54904
54935
  * é feita com base no status da resposta, conforme será apresentado nos próximos tópicos.
54905
54936
  *
@@ -55203,9 +55234,63 @@ const screenLock = 'X-PO-Screen-Lock';
55203
55234
  * ```
55204
55235
  * > Após a validação no interceptor, o parâmetro será removido do cabeçalho da requisição.
55205
55236
  *
55237
+ * ## Configuração
55238
+ *
55239
+ * É necessário configurar o `HttpClient` para utilizar os interceptors registrados via Dependency Injection (DI)
55240
+ * por meio da função `provideHttpClient(withInterceptorsFromDi())`.
55241
+ *
55242
+ * ### 1) NgModule
55243
+ *
55244
+ * ```
55245
+ * import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
55246
+ * import { PoModule } from '@po-ui/ng-components';
55247
+ * ...
55248
+ *
55249
+ * @NgModule({
55250
+ * imports: [
55251
+ * ...
55252
+ * PoModule
55253
+ * ],
55254
+ * declarations: [
55255
+ * AppComponent,
55256
+ * ...
55257
+ * ],
55258
+ * providers: [
55259
+ * provideHttpClient(withInterceptorsFromDi()),
55260
+ * ...
55261
+ * ],
55262
+ * bootstrap: [AppComponent]
55263
+ * })
55264
+ * export class AppModule { }
55265
+ * ```
55266
+ *
55206
55267
  * Ao importar o módulo `PoModule` na aplicação, o `po-http-request-interceptor` é automaticamente configurado sem a necessidade
55207
55268
  * de qualquer configuração extra.
55208
55269
  *
55270
+ * ### 2) Standalone
55271
+ *
55272
+ * No arquivo contendo a configuração da aplicação (geralmente `src/app/app.config.ts`), adicione os providers e configure o `HttpClient`,
55273
+ * como no exemplo abaixo:
55274
+ *
55275
+ * ```
55276
+ * import { ApplicationConfig, importProvidersFrom } from '@angular/core';
55277
+ * import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
55278
+ * import { provideAnimations } from '@angular/platform-browser/animations';
55279
+ * import { PoHttpRequestModule } from '@po-ui/ng-components';
55280
+ *
55281
+ * export const appConfig: ApplicationConfig = {
55282
+ * providers: [
55283
+ * ...
55284
+ * provideHttpClient(withInterceptorsFromDi()),
55285
+ * importProvidersFrom([
55286
+ * PoHttpRequestModule
55287
+ * ]),
55288
+ * ...
55289
+ * ]
55290
+ * };
55291
+ * ```
55292
+ *
55293
+ * ## Como usar
55209
55294
  *
55210
55295
  * Segue abaixo um exemplo de uso:
55211
55296
  *