@po-ui/ng-components 21.0.0 → 21.1.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.
@@ -6658,7 +6658,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImpor
6658
6658
 
6659
6659
  const PO_POPOVER_DEFAULT_POSITION = 'right';
6660
6660
  const PO_POPOVER_DEFAULT_TRIGGER = 'click';
6661
- const PO_POPOVER_TRIGGERS = ['click', 'hover'];
6661
+ const PO_POPOVER_TRIGGERS = ['click', 'hover', 'function'];
6662
6662
  /**
6663
6663
  * @description
6664
6664
  *
@@ -6739,6 +6739,8 @@ class PoPopoverBaseComponent {
6739
6739
  title;
6740
6740
  /** Evento disparado ao fechar o popover. */
6741
6741
  closePopover = new EventEmitter();
6742
+ /** Evento disparado ao abrir o popover. */
6743
+ openPopover = new EventEmitter();
6742
6744
  // Controla se o popover fica oculto ou visível, por padrão é oculto.
6743
6745
  isHidden = true;
6744
6746
  clickoutListener;
@@ -6803,6 +6805,7 @@ class PoPopoverBaseComponent {
6803
6805
  * Valores válidos:
6804
6806
  * - `click`: Abre ao clicar no componente alvo.
6805
6807
  * - `hover`: Abre ao passar o mouse sobre o componente alvo.
6808
+ * - `function`: Abre através de funções públicas do componente.
6806
6809
  *
6807
6810
  * @default click
6808
6811
  * @optional
@@ -6826,7 +6829,7 @@ class PoPopoverBaseComponent {
6826
6829
  */
6827
6830
  customClasses = input(undefined, { ...(ngDevMode ? { debugName: "customClasses" } : {}), alias: 'p-custom-classes' });
6828
6831
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoPopoverBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6829
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.9", 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 });
6832
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.9", 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 });
6830
6833
  }
6831
6834
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoPopoverBaseComponent, decorators: [{
6832
6835
  type: Component,
@@ -6847,6 +6850,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImpor
6847
6850
  }], closePopover: [{
6848
6851
  type: Output,
6849
6852
  args: ['p-close']
6853
+ }], openPopover: [{
6854
+ type: Output,
6855
+ args: ['p-open']
6850
6856
  }], hideArrow: [{
6851
6857
  type: Input,
6852
6858
  args: ['p-hide-arrow']
@@ -6934,6 +6940,9 @@ class PoPopoverComponent extends PoPopoverBaseComponent {
6934
6940
  close() {
6935
6941
  this.isHidden = true;
6936
6942
  this.closePopover.emit();
6943
+ if (this.trigger === 'function' && this.clickoutListener) {
6944
+ this.clickoutListener();
6945
+ }
6937
6946
  this.cd.detectChanges();
6938
6947
  }
6939
6948
  debounceResize() {
@@ -6950,8 +6959,14 @@ class PoPopoverComponent extends PoPopoverBaseComponent {
6950
6959
  this.setElementsControlPosition();
6951
6960
  this.setPopoverPosition();
6952
6961
  this.setOpacity(1);
6962
+ this.openPopover.emit();
6953
6963
  this.cd.detectChanges();
6954
6964
  });
6965
+ if (this.trigger === 'function') {
6966
+ this.clickoutListener = this.renderer.listen('document', 'click', (event) => {
6967
+ this.togglePopup(event);
6968
+ });
6969
+ }
6955
6970
  this.cd.detectChanges();
6956
6971
  }
6957
6972
  ensurePopoverPosition() {
@@ -6982,7 +6997,7 @@ class PoPopoverComponent extends PoPopoverBaseComponent {
6982
6997
  this.close();
6983
6998
  });
6984
6999
  }
6985
- else {
7000
+ else if (this.trigger === 'click') {
6986
7001
  this.clickoutListener = this.renderer.listen('document', 'click', (event) => {
6987
7002
  this.togglePopup(event);
6988
7003
  });
@@ -7010,7 +7025,7 @@ class PoPopoverComponent extends PoPopoverBaseComponent {
7010
7025
  this.close();
7011
7026
  }
7012
7027
  }
7013
- else if (this.targetElement?.contains(event.target)) {
7028
+ else if (this.targetElement?.contains(event.target) && this.trigger !== 'function') {
7014
7029
  this.popoverElement.nativeElement.hidden ? this.open() : this.close();
7015
7030
  }
7016
7031
  }
@@ -7211,8 +7226,6 @@ class PoHelperComponent extends PoHelperBaseComponent {
7211
7226
  }
7212
7227
  ngAfterViewInit() {
7213
7228
  PoHelperComponent.instances.push(this);
7214
- this.boundFocusIn = this.closePopoverOnFocusOut.bind(this);
7215
- window.addEventListener('focusin', this.boundFocusIn, true);
7216
7229
  queueMicrotask(() => {
7217
7230
  this.setPopoverPositionByScreen();
7218
7231
  });
@@ -7236,9 +7249,7 @@ class PoHelperComponent extends PoHelperBaseComponent {
7236
7249
  }
7237
7250
  ngOnDestroy() {
7238
7251
  PoHelperComponent.instances = PoHelperComponent.instances.filter(i => i !== this);
7239
- if (this.boundFocusIn) {
7240
- window.removeEventListener('focusin', this.boundFocusIn, true);
7241
- }
7252
+ this.handleClose();
7242
7253
  }
7243
7254
  openHelperPopover() {
7244
7255
  requestAnimationFrame(() => {
@@ -7246,6 +7257,9 @@ class PoHelperComponent extends PoHelperBaseComponent {
7246
7257
  (this.helper()['content'] || typeof this.helper() === 'string' || this.helper()['title'])) {
7247
7258
  this.popover.open();
7248
7259
  }
7260
+ else {
7261
+ this.popover.close();
7262
+ }
7249
7263
  });
7250
7264
  }
7251
7265
  helperIsVisible() {
@@ -7337,12 +7351,21 @@ class PoHelperComponent extends PoHelperBaseComponent {
7337
7351
  const literals = this.poHelperLiterals[lang] || this.poHelperLiterals['en'];
7338
7352
  return literals[type];
7339
7353
  }
7354
+ handleOpen() {
7355
+ this.boundFocusIn = this.closePopoverOnFocusOut.bind(this);
7356
+ window.addEventListener('focusin', this.boundFocusIn, true);
7357
+ }
7358
+ handleClose() {
7359
+ if (this.boundFocusIn) {
7360
+ window.removeEventListener('focusin', this.boundFocusIn, true);
7361
+ }
7362
+ }
7340
7363
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoHelperComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
7341
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.9", 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" }] });
7364
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.9", 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" }] });
7342
7365
  }
7343
7366
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoHelperComponent, decorators: [{
7344
7367
  type: Component,
7345
- 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" }]
7368
+ 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" }]
7346
7369
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { target: [{
7347
7370
  type: ViewChild,
7348
7371
  args: ['target', { read: ElementRef, static: true }]
@@ -7809,13 +7832,6 @@ class PoCheckboxComponent extends PoCheckboxBaseComponent {
7809
7832
  if (this.autoFocus) {
7810
7833
  this.focus();
7811
7834
  }
7812
- if (this.checkboxLabel?.nativeElement?.closest('.components-form-custom-template')) {
7813
- setTimeout(() => {
7814
- if (this.checkboxLabel?.nativeElement?.classList?.contains('enable-append-box')) {
7815
- this.appendBox = true;
7816
- }
7817
- }, 300);
7818
- }
7819
7835
  }
7820
7836
  ngOnChanges(changes) {
7821
7837
  if (changes.label || changes.additionalHelpTooltip || changes.helper || changes.size) {
@@ -16843,13 +16859,6 @@ class PoDatepickerComponent extends PoDatepickerBaseComponent {
16843
16859
  this.focus();
16844
16860
  }
16845
16861
  this.renderer.setAttribute(this.iconDatepicker.buttonElement.nativeElement, 'aria-label', this.literals.open);
16846
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
16847
- setTimeout(() => {
16848
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
16849
- this.appendBox = true;
16850
- }
16851
- }, 300);
16852
- }
16853
16862
  }
16854
16863
  ngOnChanges(changes) {
16855
16864
  if (changes.label) {
@@ -21768,13 +21777,6 @@ class PoSwitchComponent extends PoFieldModel {
21768
21777
  }
21769
21778
  ngAfterViewInit() {
21770
21779
  this.setControl();
21771
- if (this.switchContainer?.nativeElement?.closest('.components-form-custom-template')) {
21772
- setTimeout(() => {
21773
- if (this.switchContainer?.nativeElement?.classList?.contains('enable-append-box')) {
21774
- this.appendBox = true;
21775
- }
21776
- }, 300);
21777
- }
21778
21780
  }
21779
21781
  setControl() {
21780
21782
  const ngControl = this.injector.get(NgControl, null, this.injectOptions);
@@ -27844,11 +27846,13 @@ class PoComboBaseComponent {
27844
27846
  }
27845
27847
  // Recebe as alterações do model
27846
27848
  writeValue(value) {
27849
+ const originalValue = value;
27847
27850
  value = this.getValueWrite(value);
27848
27851
  this.fromWriteValue = true;
27849
27852
  if (validValue(value) && !this.service && this.comboOptionsList && this.comboOptionsList.length) {
27850
27853
  const option = this.getOptionFromValue(value, this.comboOptionsList);
27851
27854
  this.updateSelectedValue(option);
27855
+ this.normalizeModelIfNeeded(originalValue, option);
27852
27856
  this.comboOptionsList = this.comboOptionsList.map((option) => {
27853
27857
  if (this.isEqual(option[this.dynamicValue], value)) {
27854
27858
  return { ...option, selected: true };
@@ -27888,14 +27892,15 @@ class PoComboBaseComponent {
27888
27892
  if (!this.hasValidatorRequired && this.fieldErrorMessage && abstractControl.hasValidator(Validators.required)) {
27889
27893
  this.hasValidatorRequired = true;
27890
27894
  }
27891
- if (PoValidators.requiredFailed(this.required || this.hasValidatorRequired, this.disabled, abstractControl.value)) {
27895
+ let valueToValidate = abstractControl.value;
27896
+ if (this.controlValueWithLabel && valueToValidate && typeof valueToValidate === 'object') {
27897
+ valueToValidate = valueToValidate.value;
27898
+ }
27899
+ if (PoValidators.requiredFailed(this.required || this.hasValidatorRequired, this.disabled, valueToValidate)) {
27892
27900
  this.changeDetector.markForCheck();
27893
- return {
27894
- required: {
27895
- valid: false
27896
- }
27897
- };
27901
+ return { required: { valid: false } };
27898
27902
  }
27903
+ return {};
27899
27904
  }
27900
27905
  clear(value) {
27901
27906
  this.callModelChange(value);
@@ -27958,20 +27963,32 @@ class PoComboBaseComponent {
27958
27963
  }
27959
27964
  getValueUpdate(data, selectedOption) {
27960
27965
  const { [this.dynamicValue]: value, [this.dynamicLabel]: label } = selectedOption || {};
27961
- if (this.controlValueWithLabel && value) {
27962
- return {
27963
- value,
27964
- label
27965
- };
27966
+ if (this.controlValueWithLabel && value !== null && value !== undefined) {
27967
+ return { value, label };
27966
27968
  }
27967
27969
  return data;
27968
27970
  }
27969
27971
  getValueWrite(data) {
27970
- if (this.controlValueWithLabel && data?.value) {
27972
+ if (this.controlValueWithLabel && data?.value !== null && data?.value !== undefined) {
27971
27973
  return data?.value;
27972
27974
  }
27973
27975
  return data;
27974
27976
  }
27977
+ normalizeModelIfNeeded(originalValue, option) {
27978
+ if (!this.controlValueWithLabel) {
27979
+ return;
27980
+ }
27981
+ const isPrimitive = typeof originalValue === 'number' || typeof originalValue === 'string';
27982
+ if (!isPrimitive || !option) {
27983
+ return;
27984
+ }
27985
+ const value = option[this.dynamicValue];
27986
+ const label = option[this.dynamicLabel];
27987
+ if (value === null) {
27988
+ return;
27989
+ }
27990
+ this.callModelChange({ value, label });
27991
+ }
27975
27992
  hasDuplicatedOption(options, currentOption, accumulatedGroupOptions) {
27976
27993
  if (accumulatedGroupOptions) {
27977
27994
  return accumulatedGroupOptions.some(option => option[this.dynamicLabel] === currentOption);
@@ -28390,13 +28407,6 @@ class PoComboComponent extends PoComboBaseComponent {
28390
28407
  this.focus();
28391
28408
  }
28392
28409
  this.setContainerWidth();
28393
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
28394
- setTimeout(() => {
28395
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
28396
- this.appendBox = true;
28397
- }
28398
- }, 300);
28399
- }
28400
28410
  }
28401
28411
  ngOnChanges(changes) {
28402
28412
  if (changes.debounceTime) {
@@ -31341,13 +31351,6 @@ class PoDecimalComponent extends PoInputBaseComponent {
31341
31351
  }
31342
31352
  ngAfterViewInit() {
31343
31353
  this.verifyAutoFocus();
31344
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
31345
- setTimeout(() => {
31346
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
31347
- this.appendBox = true;
31348
- }
31349
- }, 300);
31350
- }
31351
31354
  }
31352
31355
  ngOnDestroy() {
31353
31356
  this.subscriptionValidator?.unsubscribe();
@@ -31859,13 +31862,6 @@ class PoInputGeneric extends PoInputBaseComponent {
31859
31862
  }
31860
31863
  afterViewInit() {
31861
31864
  this.verifyAutoFocus();
31862
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
31863
- setTimeout(() => {
31864
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
31865
- this.appendBox = true;
31866
- }
31867
- }, 300);
31868
- }
31869
31865
  }
31870
31866
  ngOnDestroy() {
31871
31867
  this.subscriptionValidator?.unsubscribe();
@@ -36183,7 +36179,11 @@ class PoMultiselectBaseComponent {
36183
36179
  this.updateVisibleItems();
36184
36180
  }
36185
36181
  writeValue(values) {
36186
- values = this.getValueWrite(values) || [];
36182
+ values = this.getValueWrite(values);
36183
+ if (values !== null && values !== undefined && !Array.isArray(values)) {
36184
+ values = [values];
36185
+ }
36186
+ values = values ?? [];
36187
36187
  if (this.service && values.length) {
36188
36188
  this.getObjectsByValuesSubscription = this.service.getObjectsByValues(values).subscribe(options => {
36189
36189
  this.updateSelectedOptions(options);
@@ -36219,9 +36219,15 @@ class PoMultiselectBaseComponent {
36219
36219
  return this.getValuesFromOptions(selectedOptions);
36220
36220
  }
36221
36221
  getValueWrite(data) {
36222
- if (this.controlValueWithLabel && data?.length && data.every(x => x?.value !== undefined)) {
36222
+ if (!this.controlValueWithLabel || data == null) {
36223
+ return data;
36224
+ }
36225
+ if (Array.isArray(data) && data.every(item => item?.value !== undefined)) {
36223
36226
  return data.map(option => option.value);
36224
36227
  }
36228
+ if (data?.value !== undefined) {
36229
+ return data.value;
36230
+ }
36225
36231
  return data;
36226
36232
  }
36227
36233
  setLabelsAndValuesOptions() {
@@ -36711,13 +36717,6 @@ class PoMultiselectComponent extends PoMultiselectBaseComponent {
36711
36717
  this.focus();
36712
36718
  }
36713
36719
  this.initialized = true;
36714
- if (this.inputElement?.nativeElement?.closest('.components-form-custom-template')) {
36715
- setTimeout(() => {
36716
- if (this.inputElement?.nativeElement?.classList?.contains('enable-append-box')) {
36717
- this.appendBox = true;
36718
- }
36719
- }, 300);
36720
- }
36721
36720
  }
36722
36721
  ngOnChanges(changes) {
36723
36722
  if (changes.label) {
@@ -37454,15 +37453,6 @@ class PoNumberComponent extends PoNumberBaseComponent {
37454
37453
  onWheel(event) {
37455
37454
  event.preventDefault();
37456
37455
  }
37457
- ngAfterViewInit() {
37458
- if (this.inputEl?.nativeElement?.closest('.components-form-custom-template')) {
37459
- setTimeout(() => {
37460
- if (this.inputEl?.nativeElement?.classList?.contains('enable-append-box')) {
37461
- this.appendBox = true;
37462
- }
37463
- }, 300);
37464
- }
37465
- }
37466
37456
  ngOnChanges(changes) {
37467
37457
  if (changes.label) {
37468
37458
  this.displayAdditionalHelp = false;
@@ -42005,15 +41995,6 @@ class PoSelectComponent extends PoFieldValidateModel {
42005
41995
  this.options = changes.options.currentValue;
42006
41996
  }
42007
41997
  }
42008
- ngAfterViewInit() {
42009
- if (this.selectElement?.nativeElement?.closest('.components-form-custom-template')) {
42010
- setTimeout(() => {
42011
- if (this.selectElement?.nativeElement?.classList?.contains('enable-append-box')) {
42012
- this.appendBox = true;
42013
- }
42014
- }, 300);
42015
- }
42016
- }
42017
41998
  /**
42018
41999
  * Função que atribui foco ao componente.
42019
42000
  *
@@ -42163,8 +42144,11 @@ class PoSelectComponent extends PoFieldValidateModel {
42163
42144
  return option[this.fieldValue];
42164
42145
  }
42165
42146
  getValueWrite(data) {
42166
- if (this.controlValueWithLabel && data?.value) {
42167
- return data?.value;
42147
+ if (!this.controlValueWithLabel || data == null) {
42148
+ return data;
42149
+ }
42150
+ if (data?.value !== undefined) {
42151
+ return data.value;
42168
42152
  }
42169
42153
  return data;
42170
42154
  }