@po-ui/ng-components 19.39.0 → 19.39.2

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.
@@ -6771,7 +6771,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
6771
6771
 
6772
6772
  const PO_POPOVER_DEFAULT_POSITION = 'right';
6773
6773
  const PO_POPOVER_DEFAULT_TRIGGER = 'click';
6774
- const PO_POPOVER_TRIGGERS = ['click', 'hover'];
6774
+ const PO_POPOVER_TRIGGERS = ['click', 'hover', 'function'];
6775
6775
  /**
6776
6776
  * @description
6777
6777
  *
@@ -6852,6 +6852,8 @@ class PoPopoverBaseComponent {
6852
6852
  title;
6853
6853
  /** Evento disparado ao fechar o popover. */
6854
6854
  closePopover = new EventEmitter();
6855
+ /** Evento disparado ao abrir o popover. */
6856
+ openPopover = new EventEmitter();
6855
6857
  // Controla se o popover fica oculto ou visível, por padrão é oculto.
6856
6858
  isHidden = true;
6857
6859
  clickoutListener;
@@ -6916,6 +6918,7 @@ class PoPopoverBaseComponent {
6916
6918
  * Valores válidos:
6917
6919
  * - `click`: Abre ao clicar no componente alvo.
6918
6920
  * - `hover`: Abre ao passar o mouse sobre o componente alvo.
6921
+ * - `function`: Abre através de funções públicas do componente.
6919
6922
  *
6920
6923
  * @default click
6921
6924
  * @optional
@@ -6939,7 +6942,7 @@ class PoPopoverBaseComponent {
6939
6942
  */
6940
6943
  customClasses = input(undefined, { alias: 'p-custom-classes' });
6941
6944
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PoPopoverBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6942
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.7", type: PoPopoverBaseComponent, isStandalone: false, selector: "po-popover-base", inputs: { appendBox: { classPropertyName: "appendBox", publicName: "p-append-in-body", isSignal: false, isRequired: false, transformFunction: convertToBoolean }, target: { classPropertyName: "target", publicName: "p-target", isSignal: false, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "p-title", isSignal: false, isRequired: false, transformFunction: null }, hideArrow: { classPropertyName: "hideArrow", publicName: "p-hide-arrow", isSignal: false, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "p-position", isSignal: false, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "p-trigger", isSignal: false, isRequired: false, transformFunction: null }, customClasses: { classPropertyName: "customClasses", publicName: "p-custom-classes", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closePopover: "p-close" }, ngImport: i0, template: '', isInline: true });
6945
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.7", type: PoPopoverBaseComponent, isStandalone: false, selector: "po-popover-base", inputs: { appendBox: { classPropertyName: "appendBox", publicName: "p-append-in-body", isSignal: false, isRequired: false, transformFunction: convertToBoolean }, target: { classPropertyName: "target", publicName: "p-target", isSignal: false, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "p-title", isSignal: false, isRequired: false, transformFunction: null }, hideArrow: { classPropertyName: "hideArrow", publicName: "p-hide-arrow", isSignal: false, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "p-position", isSignal: false, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "p-trigger", isSignal: false, isRequired: false, transformFunction: null }, customClasses: { classPropertyName: "customClasses", publicName: "p-custom-classes", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closePopover: "p-close", openPopover: "p-open" }, ngImport: i0, template: '', isInline: true });
6943
6946
  }
6944
6947
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PoPopoverBaseComponent, decorators: [{
6945
6948
  type: Component,
@@ -6960,6 +6963,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
6960
6963
  }], closePopover: [{
6961
6964
  type: Output,
6962
6965
  args: ['p-close']
6966
+ }], openPopover: [{
6967
+ type: Output,
6968
+ args: ['p-open']
6963
6969
  }], hideArrow: [{
6964
6970
  type: Input,
6965
6971
  args: ['p-hide-arrow']
@@ -7047,6 +7053,9 @@ class PoPopoverComponent extends PoPopoverBaseComponent {
7047
7053
  close() {
7048
7054
  this.isHidden = true;
7049
7055
  this.closePopover.emit();
7056
+ if (this.trigger === 'function' && this.clickoutListener) {
7057
+ this.clickoutListener();
7058
+ }
7050
7059
  this.cd.detectChanges();
7051
7060
  }
7052
7061
  debounceResize() {
@@ -7063,8 +7072,14 @@ class PoPopoverComponent extends PoPopoverBaseComponent {
7063
7072
  this.setElementsControlPosition();
7064
7073
  this.setPopoverPosition();
7065
7074
  this.setOpacity(1);
7075
+ this.openPopover.emit();
7066
7076
  this.cd.detectChanges();
7067
7077
  });
7078
+ if (this.trigger === 'function') {
7079
+ this.clickoutListener = this.renderer.listen('document', 'click', (event) => {
7080
+ this.togglePopup(event);
7081
+ });
7082
+ }
7068
7083
  this.cd.detectChanges();
7069
7084
  }
7070
7085
  ensurePopoverPosition() {
@@ -7095,7 +7110,7 @@ class PoPopoverComponent extends PoPopoverBaseComponent {
7095
7110
  this.close();
7096
7111
  });
7097
7112
  }
7098
- else {
7113
+ else if (this.trigger === 'click') {
7099
7114
  this.clickoutListener = this.renderer.listen('document', 'click', (event) => {
7100
7115
  this.togglePopup(event);
7101
7116
  });
@@ -7123,7 +7138,7 @@ class PoPopoverComponent extends PoPopoverBaseComponent {
7123
7138
  this.close();
7124
7139
  }
7125
7140
  }
7126
- else if (this.targetElement?.contains(event.target)) {
7141
+ else if (this.targetElement?.contains(event.target) && this.trigger !== 'function') {
7127
7142
  this.popoverElement.nativeElement.hidden ? this.open() : this.close();
7128
7143
  }
7129
7144
  }
@@ -7324,8 +7339,6 @@ class PoHelperComponent extends PoHelperBaseComponent {
7324
7339
  }
7325
7340
  ngAfterViewInit() {
7326
7341
  PoHelperComponent.instances.push(this);
7327
- this.boundFocusIn = this.closePopoverOnFocusOut.bind(this);
7328
- window.addEventListener('focusin', this.boundFocusIn, true);
7329
7342
  queueMicrotask(() => {
7330
7343
  this.setPopoverPositionByScreen();
7331
7344
  });
@@ -7349,9 +7362,7 @@ class PoHelperComponent extends PoHelperBaseComponent {
7349
7362
  }
7350
7363
  ngOnDestroy() {
7351
7364
  PoHelperComponent.instances = PoHelperComponent.instances.filter(i => i !== this);
7352
- if (this.boundFocusIn) {
7353
- window.removeEventListener('focusin', this.boundFocusIn, true);
7354
- }
7365
+ this.handleClose();
7355
7366
  }
7356
7367
  openHelperPopover() {
7357
7368
  requestAnimationFrame(() => {
@@ -7359,6 +7370,9 @@ class PoHelperComponent extends PoHelperBaseComponent {
7359
7370
  (this.helper()['content'] || typeof this.helper() === 'string' || this.helper()['title'])) {
7360
7371
  this.popover.open();
7361
7372
  }
7373
+ else {
7374
+ this.popover.close();
7375
+ }
7362
7376
  });
7363
7377
  }
7364
7378
  helperIsVisible() {
@@ -7450,12 +7464,21 @@ class PoHelperComponent extends PoHelperBaseComponent {
7450
7464
  const literals = this.poHelperLiterals[lang] || this.poHelperLiterals['en'];
7451
7465
  return literals[type];
7452
7466
  }
7467
+ handleOpen() {
7468
+ this.boundFocusIn = this.closePopoverOnFocusOut.bind(this);
7469
+ window.addEventListener('focusin', this.boundFocusIn, true);
7470
+ }
7471
+ handleClose() {
7472
+ if (this.boundFocusIn) {
7473
+ window.removeEventListener('focusin', this.boundFocusIn, true);
7474
+ }
7475
+ }
7453
7476
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PoHelperComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
7454
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.7", type: PoHelperComponent, isStandalone: false, selector: "po-helper", viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ElementRef, static: true }, { propertyName: "popover", first: true, predicate: ["popover"], descendants: true }, { propertyName: "poButton", first: true, predicate: PoButtonComponent, descendants: true, read: ElementRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div\n (mouseenter)=\"setPopoverPositionByScreen()\"\n class=\"po-helper-container po-helper-target\"\n [attr.p-size]=\"this.size()\"\n #target\n [attr.tabindex]=\"disabled() ? null : 0\"\n role=\"button\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"!popover.isHidden\"\n [attr.aria-controls]=\"'popover-content-' + id\"\n [attr.aria-describedby]=\"!popover.isHidden ? 'popover-content-' + id : null\"\n [class.po-helper-disabled]=\"disabled()\"\n (keydown)=\"onKeyDown($event)\"\n (click)=\"emitClick($event); popover.ensurePopoverPosition()\"\n>\n <po-icon [p-icon]=\"helper()?.type === 'info' ? 'ICON_INFO' : 'ICON_HELP'\"></po-icon>\n <po-popover\n (click)=\"$event.stopPropagation()\"\n #popover\n [p-position]=\"popoverPosition\"\n [p-target]=\"target\"\n [p-title]=\"helper()?.title\"\n [p-append-in-body]=\"appendBox()\"\n p-custom-classes=\"po-helper-popover\"\n >\n <div [id]=\"'popover-content-' + id\" role=\"dialog\" aria-modal=\"false\" tabindex=\"-1\">\n {{ helper()?.content }}\n @if (helper()?.type === 'help' && helper()?.footerAction) {\n <po-divider></po-divider>\n <po-link\n class=\"po-helper-footer-action-link\"\n (keydown.enter)=\"$event.stopPropagation()\"\n (keydown.space)=\"$event.stopPropagation()\"\n (p-action)=\"helper()?.footerAction?.action()\"\n [p-label]=\"helper()?.footerAction?.label\"\n >\n </po-link>\n }\n </div>\n </po-popover>\n</div>\n", dependencies: [{ kind: "component", type: PoIconComponent, selector: "po-icon", inputs: ["p-icon"] }, { kind: "component", type: PoPopoverComponent, selector: "po-popover" }, { kind: "component", type: PoLinkComponent, selector: "po-link" }, { kind: "component", type: PoDividerComponent, selector: "po-divider" }] });
7477
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.7", type: PoHelperComponent, isStandalone: false, selector: "po-helper", viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ElementRef, static: true }, { propertyName: "popover", first: true, predicate: ["popover"], descendants: true }, { propertyName: "poButton", first: true, predicate: PoButtonComponent, descendants: true, read: ElementRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div\n class=\"po-helper-container po-helper-target\"\n [attr.p-size]=\"this.size()\"\n #target\n [attr.tabindex]=\"disabled() ? null : 0\"\n role=\"button\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"!popover.isHidden\"\n [attr.aria-controls]=\"'popover-content-' + id\"\n [attr.aria-describedby]=\"!popover.isHidden ? 'popover-content-' + id : null\"\n [class.po-helper-disabled]=\"disabled()\"\n (keydown)=\"onKeyDown($event)\"\n (click)=\"openHelperPopover(); emitClick($event); popover.ensurePopoverPosition()\"\n>\n <po-icon [p-icon]=\"helper()?.type === 'info' ? 'ICON_INFO' : 'ICON_HELP'\"></po-icon>\n <po-popover\n #popover\n [p-position]=\"popoverPosition\"\n [p-target]=\"target\"\n [p-title]=\"helper()?.title\"\n [p-append-in-body]=\"appendBox()\"\n p-custom-classes=\"po-helper-popover\"\n p-trigger=\"function\"\n (p-close)=\"handleClose()\"\n (p-open)=\"handleOpen()\"\n >\n <div [id]=\"'popover-content-' + id\" role=\"dialog\" aria-modal=\"false\" tabindex=\"-1\">\n {{ helper()?.content }}\n @if (helper()?.type === 'help' && helper()?.footerAction) {\n <po-divider></po-divider>\n <po-link\n class=\"po-helper-footer-action-link\"\n (keydown.enter)=\"$event.stopPropagation()\"\n (keydown.space)=\"$event.stopPropagation()\"\n (p-action)=\"helper()?.footerAction?.action()\"\n [p-label]=\"helper()?.footerAction?.label\"\n >\n </po-link>\n }\n </div>\n </po-popover>\n</div>\n", dependencies: [{ kind: "component", type: PoIconComponent, selector: "po-icon", inputs: ["p-icon"] }, { kind: "component", type: PoPopoverComponent, selector: "po-popover" }, { kind: "component", type: PoLinkComponent, selector: "po-link" }, { kind: "component", type: PoDividerComponent, selector: "po-divider" }] });
7455
7478
  }
7456
7479
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PoHelperComponent, decorators: [{
7457
7480
  type: Component,
7458
- args: [{ selector: 'po-helper', standalone: false, template: "<div\n (mouseenter)=\"setPopoverPositionByScreen()\"\n class=\"po-helper-container po-helper-target\"\n [attr.p-size]=\"this.size()\"\n #target\n [attr.tabindex]=\"disabled() ? null : 0\"\n role=\"button\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"!popover.isHidden\"\n [attr.aria-controls]=\"'popover-content-' + id\"\n [attr.aria-describedby]=\"!popover.isHidden ? 'popover-content-' + id : null\"\n [class.po-helper-disabled]=\"disabled()\"\n (keydown)=\"onKeyDown($event)\"\n (click)=\"emitClick($event); popover.ensurePopoverPosition()\"\n>\n <po-icon [p-icon]=\"helper()?.type === 'info' ? 'ICON_INFO' : 'ICON_HELP'\"></po-icon>\n <po-popover\n (click)=\"$event.stopPropagation()\"\n #popover\n [p-position]=\"popoverPosition\"\n [p-target]=\"target\"\n [p-title]=\"helper()?.title\"\n [p-append-in-body]=\"appendBox()\"\n p-custom-classes=\"po-helper-popover\"\n >\n <div [id]=\"'popover-content-' + id\" role=\"dialog\" aria-modal=\"false\" tabindex=\"-1\">\n {{ helper()?.content }}\n @if (helper()?.type === 'help' && helper()?.footerAction) {\n <po-divider></po-divider>\n <po-link\n class=\"po-helper-footer-action-link\"\n (keydown.enter)=\"$event.stopPropagation()\"\n (keydown.space)=\"$event.stopPropagation()\"\n (p-action)=\"helper()?.footerAction?.action()\"\n [p-label]=\"helper()?.footerAction?.label\"\n >\n </po-link>\n }\n </div>\n </po-popover>\n</div>\n" }]
7481
+ args: [{ selector: 'po-helper', standalone: false, template: "<div\n class=\"po-helper-container po-helper-target\"\n [attr.p-size]=\"this.size()\"\n #target\n [attr.tabindex]=\"disabled() ? null : 0\"\n role=\"button\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"!popover.isHidden\"\n [attr.aria-controls]=\"'popover-content-' + id\"\n [attr.aria-describedby]=\"!popover.isHidden ? 'popover-content-' + id : null\"\n [class.po-helper-disabled]=\"disabled()\"\n (keydown)=\"onKeyDown($event)\"\n (click)=\"openHelperPopover(); emitClick($event); popover.ensurePopoverPosition()\"\n>\n <po-icon [p-icon]=\"helper()?.type === 'info' ? 'ICON_INFO' : 'ICON_HELP'\"></po-icon>\n <po-popover\n #popover\n [p-position]=\"popoverPosition\"\n [p-target]=\"target\"\n [p-title]=\"helper()?.title\"\n [p-append-in-body]=\"appendBox()\"\n p-custom-classes=\"po-helper-popover\"\n p-trigger=\"function\"\n (p-close)=\"handleClose()\"\n (p-open)=\"handleOpen()\"\n >\n <div [id]=\"'popover-content-' + id\" role=\"dialog\" aria-modal=\"false\" tabindex=\"-1\">\n {{ helper()?.content }}\n @if (helper()?.type === 'help' && helper()?.footerAction) {\n <po-divider></po-divider>\n <po-link\n class=\"po-helper-footer-action-link\"\n (keydown.enter)=\"$event.stopPropagation()\"\n (keydown.space)=\"$event.stopPropagation()\"\n (p-action)=\"helper()?.footerAction?.action()\"\n [p-label]=\"helper()?.footerAction?.label\"\n >\n </po-link>\n }\n </div>\n </po-popover>\n</div>\n" }]
7459
7482
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { target: [{
7460
7483
  type: ViewChild,
7461
7484
  args: ['target', { read: ElementRef, static: true }]
@@ -7925,13 +7948,6 @@ class PoCheckboxComponent extends PoCheckboxBaseComponent {
7925
7948
  if (this.autoFocus) {
7926
7949
  this.focus();
7927
7950
  }
7928
- if (this.checkboxLabel?.nativeElement?.closest('.components-form-custom-template')) {
7929
- setTimeout(() => {
7930
- if (this.checkboxLabel?.nativeElement?.classList?.contains('enable-append-box')) {
7931
- this.appendBox = true;
7932
- }
7933
- }, 300);
7934
- }
7935
7951
  }
7936
7952
  ngOnChanges(changes) {
7937
7953
  if (changes.label || changes.additionalHelpTooltip || changes.helper || changes.size) {
@@ -16957,13 +16973,6 @@ class PoDatepickerComponent extends PoDatepickerBaseComponent {
16957
16973
  this.focus();
16958
16974
  }
16959
16975
  this.renderer.setAttribute(this.iconDatepicker.buttonElement.nativeElement, 'aria-label', this.literals.open);
16960
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
16961
- setTimeout(() => {
16962
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
16963
- this.appendBox = true;
16964
- }
16965
- }, 300);
16966
- }
16967
16976
  }
16968
16977
  ngOnChanges(changes) {
16969
16978
  if (changes.label) {
@@ -21913,13 +21922,6 @@ class PoSwitchComponent extends PoFieldModel {
21913
21922
  }
21914
21923
  ngAfterViewInit() {
21915
21924
  this.setControl();
21916
- if (this.switchContainer?.nativeElement?.closest('.components-form-custom-template')) {
21917
- setTimeout(() => {
21918
- if (this.switchContainer?.nativeElement?.classList?.contains('enable-append-box')) {
21919
- this.appendBox = true;
21920
- }
21921
- }, 300);
21922
- }
21923
21925
  }
21924
21926
  setControl() {
21925
21927
  const ngControl = this.injector.get(NgControl, null, this.injectOptions);
@@ -28009,11 +28011,13 @@ class PoComboBaseComponent {
28009
28011
  }
28010
28012
  // Recebe as alterações do model
28011
28013
  writeValue(value) {
28014
+ const originalValue = value;
28012
28015
  value = this.getValueWrite(value);
28013
28016
  this.fromWriteValue = true;
28014
28017
  if (validValue(value) && !this.service && this.comboOptionsList && this.comboOptionsList.length) {
28015
28018
  const option = this.getOptionFromValue(value, this.comboOptionsList);
28016
28019
  this.updateSelectedValue(option);
28020
+ this.normalizeModelIfNeeded(originalValue, option);
28017
28021
  this.comboOptionsList = this.comboOptionsList.map((option) => {
28018
28022
  if (this.isEqual(option[this.dynamicValue], value)) {
28019
28023
  return { ...option, selected: true };
@@ -28053,14 +28057,15 @@ class PoComboBaseComponent {
28053
28057
  if (!this.hasValidatorRequired && this.fieldErrorMessage && abstractControl.hasValidator(Validators.required)) {
28054
28058
  this.hasValidatorRequired = true;
28055
28059
  }
28056
- if (requiredFailed(this.required || this.hasValidatorRequired, this.disabled, abstractControl.value)) {
28060
+ let valueToValidate = abstractControl.value;
28061
+ if (this.controlValueWithLabel && valueToValidate && typeof valueToValidate === 'object') {
28062
+ valueToValidate = valueToValidate.value;
28063
+ }
28064
+ if (requiredFailed(this.required || this.hasValidatorRequired, this.disabled, valueToValidate)) {
28057
28065
  this.changeDetector.markForCheck();
28058
- return {
28059
- required: {
28060
- valid: false
28061
- }
28062
- };
28066
+ return { required: { valid: false } };
28063
28067
  }
28068
+ return {};
28064
28069
  }
28065
28070
  clear(value) {
28066
28071
  this.callModelChange(value);
@@ -28123,20 +28128,32 @@ class PoComboBaseComponent {
28123
28128
  }
28124
28129
  getValueUpdate(data, selectedOption) {
28125
28130
  const { [this.dynamicValue]: value, [this.dynamicLabel]: label } = selectedOption || {};
28126
- if (this.controlValueWithLabel && value) {
28127
- return {
28128
- value,
28129
- label
28130
- };
28131
+ if (this.controlValueWithLabel && value !== null && value !== undefined) {
28132
+ return { value, label };
28131
28133
  }
28132
28134
  return data;
28133
28135
  }
28134
28136
  getValueWrite(data) {
28135
- if (this.controlValueWithLabel && data?.value) {
28137
+ if (this.controlValueWithLabel && data?.value !== null && data?.value !== undefined) {
28136
28138
  return data?.value;
28137
28139
  }
28138
28140
  return data;
28139
28141
  }
28142
+ normalizeModelIfNeeded(originalValue, option) {
28143
+ if (!this.controlValueWithLabel) {
28144
+ return;
28145
+ }
28146
+ const isPrimitive = typeof originalValue === 'number' || typeof originalValue === 'string';
28147
+ if (!isPrimitive || !option) {
28148
+ return;
28149
+ }
28150
+ const value = option[this.dynamicValue];
28151
+ const label = option[this.dynamicLabel];
28152
+ if (value === null) {
28153
+ return;
28154
+ }
28155
+ this.callModelChange({ value, label });
28156
+ }
28140
28157
  hasDuplicatedOption(options, currentOption, accumulatedGroupOptions) {
28141
28158
  if (accumulatedGroupOptions) {
28142
28159
  return accumulatedGroupOptions.some(option => option[this.dynamicLabel] === currentOption);
@@ -28555,13 +28572,6 @@ class PoComboComponent extends PoComboBaseComponent {
28555
28572
  this.focus();
28556
28573
  }
28557
28574
  this.setContainerWidth();
28558
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
28559
- setTimeout(() => {
28560
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
28561
- this.appendBox = true;
28562
- }
28563
- }, 300);
28564
- }
28565
28575
  }
28566
28576
  ngOnChanges(changes) {
28567
28577
  if (changes.debounceTime) {
@@ -31506,13 +31516,6 @@ class PoDecimalComponent extends PoInputBaseComponent {
31506
31516
  }
31507
31517
  ngAfterViewInit() {
31508
31518
  this.verifyAutoFocus();
31509
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
31510
- setTimeout(() => {
31511
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
31512
- this.appendBox = true;
31513
- }
31514
- }, 300);
31515
- }
31516
31519
  }
31517
31520
  ngOnDestroy() {
31518
31521
  this.subscriptionValidator?.unsubscribe();
@@ -32024,13 +32027,6 @@ class PoInputGeneric extends PoInputBaseComponent {
32024
32027
  }
32025
32028
  afterViewInit() {
32026
32029
  this.verifyAutoFocus();
32027
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
32028
- setTimeout(() => {
32029
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
32030
- this.appendBox = true;
32031
- }
32032
- }, 300);
32033
- }
32034
32030
  }
32035
32031
  ngOnDestroy() {
32036
32032
  this.subscriptionValidator?.unsubscribe();
@@ -36345,7 +36341,11 @@ class PoMultiselectBaseComponent {
36345
36341
  this.updateVisibleItems();
36346
36342
  }
36347
36343
  writeValue(values) {
36348
- values = this.getValueWrite(values) || [];
36344
+ values = this.getValueWrite(values);
36345
+ if (values !== null && values !== undefined && !Array.isArray(values)) {
36346
+ values = [values];
36347
+ }
36348
+ values = values ?? [];
36349
36349
  if (this.service && values.length) {
36350
36350
  this.getObjectsByValuesSubscription = this.service.getObjectsByValues(values).subscribe(options => {
36351
36351
  this.updateSelectedOptions(options);
@@ -36381,9 +36381,15 @@ class PoMultiselectBaseComponent {
36381
36381
  return this.getValuesFromOptions(selectedOptions);
36382
36382
  }
36383
36383
  getValueWrite(data) {
36384
- if (this.controlValueWithLabel && data?.length && data.every(x => x?.value !== undefined)) {
36384
+ if (!this.controlValueWithLabel || data == null) {
36385
+ return data;
36386
+ }
36387
+ if (Array.isArray(data) && data.every(item => item?.value !== undefined)) {
36385
36388
  return data.map(option => option.value);
36386
36389
  }
36390
+ if (data?.value !== undefined) {
36391
+ return data.value;
36392
+ }
36387
36393
  return data;
36388
36394
  }
36389
36395
  setLabelsAndValuesOptions() {
@@ -36873,13 +36879,6 @@ class PoMultiselectComponent extends PoMultiselectBaseComponent {
36873
36879
  this.focus();
36874
36880
  }
36875
36881
  this.initialized = true;
36876
- if (this.inputElement?.nativeElement?.closest('.components-form-custom-template')) {
36877
- setTimeout(() => {
36878
- if (this.inputElement?.nativeElement?.classList?.contains('enable-append-box')) {
36879
- this.appendBox = true;
36880
- }
36881
- }, 300);
36882
- }
36883
36882
  }
36884
36883
  ngOnChanges(changes) {
36885
36884
  if (changes.label) {
@@ -37616,15 +37615,6 @@ class PoNumberComponent extends PoNumberBaseComponent {
37616
37615
  onWheel(event) {
37617
37616
  event.preventDefault();
37618
37617
  }
37619
- ngAfterViewInit() {
37620
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
37621
- setTimeout(() => {
37622
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
37623
- this.appendBox = true;
37624
- }
37625
- }, 300);
37626
- }
37627
- }
37628
37618
  ngOnChanges(changes) {
37629
37619
  if (changes.label) {
37630
37620
  this.displayAdditionalHelp = false;
@@ -42173,15 +42163,6 @@ class PoSelectComponent extends PoFieldValidateModel {
42173
42163
  this.options = changes.options.currentValue;
42174
42164
  }
42175
42165
  }
42176
- ngAfterViewInit() {
42177
- if (this.selectElement?.nativeElement?.closest('.components-form-custom-template')) {
42178
- setTimeout(() => {
42179
- if (this.selectElement?.nativeElement?.classList?.contains('enable-append-box')) {
42180
- this.appendBox = true;
42181
- }
42182
- }, 300);
42183
- }
42184
- }
42185
42166
  /**
42186
42167
  * Função que atribui foco ao componente.
42187
42168
  *
@@ -42331,8 +42312,11 @@ class PoSelectComponent extends PoFieldValidateModel {
42331
42312
  return option[this.fieldValue];
42332
42313
  }
42333
42314
  getValueWrite(data) {
42334
- if (this.controlValueWithLabel && data?.value) {
42335
- return data?.value;
42315
+ if (!this.controlValueWithLabel || data == null) {
42316
+ return data;
42317
+ }
42318
+ if (data?.value !== undefined) {
42319
+ return data.value;
42336
42320
  }
42337
42321
  return data;
42338
42322
  }