File

feature-libs/product-configurator/textfield/components/input-field-readonly/configurator-textfield-input-field-readonly.component.ts

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector cx-configurator-textfield-input-field-readonly
templateUrl ./configurator-textfield-input-field-readonly.component.html

Index

Properties
Methods
Inputs

Inputs

attribute
Type : ConfiguratorTextfield.ConfigurationInfo

Methods

getIdLabel
getIdLabel(attribute: ConfiguratorTextfield.ConfigurationInfo)

Compiles an ID for the attribute label by using the label from the backend and a prefix 'label'

Parameters :
Name Type Optional Description
attribute ConfiguratorTextfield.ConfigurationInfo No

Textfield configurator attribute. Carries the attribute label information from the backend

Returns : string

ID

Protected getLabelForIdGeneration
getLabelForIdGeneration(attribute: ConfiguratorTextfield.ConfigurationInfo)
Parameters :
Name Type Optional
attribute ConfiguratorTextfield.ConfigurationInfo No
Returns : string

Properties

attribute
Type : ConfiguratorTextfield.ConfigurationInfo
Decorators :
@Input()
PREFIX_TEXTFIELD
Type : string
Default value : 'cx-configurator-textfield'
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';

import { ConfiguratorTextfield } from '../../core/model/configurator-textfield.model';

@Component({
  selector: 'cx-configurator-textfield-input-field-readonly',
  templateUrl: './configurator-textfield-input-field-readonly.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ConfiguratorTextfieldInputFieldReadonlyComponent {
  PREFIX_TEXTFIELD = 'cx-configurator-textfield';

  @Input() attribute: ConfiguratorTextfield.ConfigurationInfo;

  /**
   * Compiles an ID for the attribute label by using the label from the backend and a prefix 'label'
   * @param {ConfiguratorTextfield.ConfigurationInfo} attribute Textfield configurator attribute. Carries the attribute label information from the backend
   * @returns {string} ID
   */
  getIdLabel(attribute: ConfiguratorTextfield.ConfigurationInfo): string {
    return (
      this.PREFIX_TEXTFIELD + 'label' + this.getLabelForIdGeneration(attribute)
    );
  }

  protected getLabelForIdGeneration(
    attribute: ConfiguratorTextfield.ConfigurationInfo
  ): string {
    //replace white spaces with an empty string
    return attribute.configurationLabel.replace(/\s/g, '');
  }
}
<label
  id="{{ getIdLabel(attribute) }}"
  [attr.aria-label]="attribute.configurationLabel"
  >{{ attribute.configurationLabel }}</label
>
<div attr.aria-labelledby="{{ getIdLabel(attribute) }}">
  {{ attribute.configurationValue }}
</div>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""