File

feature-libs/product-configurator/rulebased/components/conflict-suggestion/configurator-conflict-suggestion.component.ts

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector cx-configurator-conflict-suggestion
templateUrl ./configurator-conflict-suggestion.component.html

Index

Properties
Methods
Inputs
HostBindings

Constructor

constructor()

Inputs

attribute
Type : Configurator.Attribute
currentGroup
Type : Configurator.Group
suggestionNumber
Type : number

HostBindings

tabindex
Type : string
Default value : '0'

Methods

displayConflictSuggestion
displayConflictSuggestion(group: Configurator.Group)

Verifies whether the conflict suggestion should be displayed for the current group.

Parameters :
Name Type Optional Description
group Configurator.Group No
  • Current group
Returns : boolean
  • 'True' if the conflict description should be displayed, otherwise 'false'.

Properties

attribute
Type : Configurator.Attribute
Decorators :
@Input()
currentGroup
Type : Configurator.Group
Decorators :
@Input()
groupType
Default value : Configurator.GroupType
suggestionNumber
Type : number
Decorators :
@Input()
tabindex
Type : string
Default value : '0'
Decorators :
@HostBinding('tabindex')
import {
  ChangeDetectionStrategy,
  Component,
  HostBinding,
  Input,
} from '@angular/core';
import { Configurator } from '../../core/model/configurator.model';

@Component({
  selector: 'cx-configurator-conflict-suggestion',
  templateUrl: './configurator-conflict-suggestion.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ConfiguratorConflictSuggestionComponent {
  @Input() currentGroup: Configurator.Group;
  @Input() attribute: Configurator.Attribute;
  @Input() suggestionNumber: number;

  groupType = Configurator.GroupType;

  @HostBinding('tabindex') tabindex = '0';

  constructor() {}

  /**
   * Verifies whether the conflict suggestion should be displayed for the current group.
   *
   * @param {Configurator.Group} group - Current group
   * @return {boolean} - 'True' if the conflict description should be displayed, otherwise 'false'.
   */
  displayConflictSuggestion(group: Configurator.Group): boolean {
    return group.groupType === Configurator.GroupType.CONFLICT_GROUP &&
      group.attributes
      ? group.attributes?.length > 1
      : false;
  }
}
<ng-container *ngIf="displayConflictSuggestion(currentGroup)">
  <div class="cx-title">
    {{
      'configurator.conflict.suggestionTitle'
        | cxTranslate: { number: suggestionNumber + 1 }
    }}
  </div>
  {{
    'configurator.conflict.suggestionText'
      | cxTranslate: { attribute: attribute.label }
  }}
</ng-container>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""