StringComponent
Creates form input for strings. Based on the input values different kinds of inputs will be generated.
Implements ControlValueAccessor so it can be used within Angular forms.
Example :
<!-- string input validating input to be between 5 and 10 characters -->
<yuv-string [minLength]="5" [maxLength]="10"></yuv-string><yuv-string [regex]="[0-9]*">
<yuv-string [rows]="10">
Component Metadata
Section titled “Component Metadata”Selector: yuv-string
Standalone: Yes
Implements: ControlValueAccessor, AfterViewInit, OnInit, OnDestroy
Inputs
Section titled “Inputs”Type: number
Setting rows to more than 1 will generate a textarea instead of an input tag and apply the rows property to it
autofocus
Section titled “autofocus”Type: any
Default Value: false
Enable autofucus for the input (default: false)
classifications
Section titled “classifications”Type: string[], string[] | undefined
Default Value: [], \{ transform: (value) => value ?? [] \}
Additional semantics for the form element. Possible values are email (validates and creates a link to send an email once there is a valid email address) and url (validates and creates a link to an URL typed into the form element).
maxLength
Section titled “maxLength”Type: number | undefined
Default Value: undefined
Maximum number of characters
minLength
Section titled “minLength”Type: number | undefined
Default Value: undefined
Minimal number of characters
multiselect
Section titled “multiselect”Type: any
Default Value: false
Indicator that multiple strings could be inserted, they will be rendered as chips (default: false).
readonly
Section titled “readonly”Type: any
Default Value: false
Will prevent the input from being changed (default: false)
Type: string | undefined
Default Value: undefined
Regular expression to validate the input value against
situation
Section titled “situation”Type: string | undefined
Default Value: undefined
Possibles values are EDIT (default),SEARCH,CREATE. In search situation validation of the form element will be turned off, so you are able to enter search terms that do not meet the elements validators.
disabled
Section titled “disabled”Type: BooleanInput
placeholder
Section titled “placeholder”Type: string
required
Section titled “required”Type: BooleanInput
Properties
Section titled “Properties”classifiytionIcons
Section titled “classifiytionIcons”Type: object
Default Value: \{ email: 'email', url: 'language', phone: 'call' \}
classifyLink
Section titled “classifyLink”Type: unknown
Default Value: computed(() => \{ const classifications = this.classifications(); if (!classifications.length) return undefined; const link = this.#classificationLinks.find((entry) => classifications.includes(entry.classification)); return link && \{ ...link, isUrl: link.classification === Classification.STRING_URL \}; \})
Link configuration of the first matching classification, extended by what the template needs.
Type: unknown
Default Value: new FormControl<string | string[] | undefined>(undefined)
formatedValue
Section titled “formatedValue”Type: FormattedMailTo
linkHref
Section titled “linkHref”Type: unknown
Default Value: computed(() => \{ const link = this.classifyLink(); const value = this.#formattedValue(); if (!link || value === undefined) return ''; if (!link.isUrl) return link.hrefPrefix + value; // A url link addresses exactly one location, so multi valued fields render the plain icon. return Utils.toAbsoluteUrl(Array.isArray(value) ? (value.length === 1 ? value[0] : '') : value); \})
Href of the classification link, empty whenever the current value cannot be linked.
linkLabelValue
Section titled “linkLabelValue”Type: unknown
Default Value: computed(() => \{ const link = this.classifyLink(); if (!link) return ''; if (link.isUrl) return this.linkHref(); const formattedValue = this.#formattedValue(); return typeof formattedValue === 'string' ? formattedValue : ''; \})
Value interpolated into the link’s aria-label: the resolved URL, or the plain address.
maxEntryCountIfInvalid
Section titled “maxEntryCountIfInvalid”Type: number
ngControl
Section titled “ngControl”Type: unknown
Default Value: injectNgControl(this)
propagateChange
Section titled “propagateChange”Type: unknown
Default Value: () => \{...\}
separatorKeysCodes
Section titled “separatorKeysCodes”Type: unknown
Default Value: [ENTER, COMMA] as const
urlSchemeHint
Section titled “urlSchemeHint”Type: unknown
Default Value: computed(() => \{ if (!this.classifyLink()?.isUrl) return false; const value = this.value; const entries = Array.isArray(value) ? value : [value]; return entries.some((entry) => Utils.isValidUrl(entry) && !Utils.hasUrlScheme(entry)); \})
Whether opening the link would complete a scheme-less address with http://.
Type: unknown
Default Value: false
validationErrors
Section titled “validationErrors”Type: literal type[]
Default Value: []
autofilled
Section titled “autofilled”Type: boolean
controlType
Section titled “controlType”Type: string
disableAutomaticLabeling
Section titled “disableAutomaticLabeling”Type: boolean
stateChanges
Section titled “stateChanges”Type: unknown
Default Value: new Subject<void>()
userAriaDescribedBy
Section titled “userAriaDescribedBy”Type: string
Methods
Section titled “Methods”chipsAdd
Section titled “chipsAdd”chipsAdd(event: MatChipInputEvent): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| event | MatChipInputEvent |
chipsEdit
Section titled “chipsEdit”chipsEdit(v: string, event: MatChipEditedEvent): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| v | string | |
| event | MatChipEditedEvent |
chipsRemove
Section titled “chipsRemove”chipsRemove(v: string): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| v | string |
onBlur
Section titled “onBlur”onBlur(): voidregisterOnChange
Section titled “registerOnChange”registerOnChange(fn: any): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| fn | any |
registerOnTouched
Section titled “registerOnTouched”registerOnTouched(): voidsetDisabledState
Section titled “setDisabledState”setDisabledState(isDisabled: boolean): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| isDisabled | boolean |
writeValue
Section titled “writeValue”writeValue(value: string | string[]): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| value | string | string[] |
onContainerClick
Section titled “onContainerClick”onContainerClick(event: MouseEvent): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| event | MouseEvent |
onFocusIn
Section titled “onFocusIn”onFocusIn(): voidonFocusout
Section titled “onFocusout”onFocusout(): voidonNgOnDestroy
Section titled “onNgOnDestroy”onNgOnDestroy(): voidsetDescribedByIds
Section titled “setDescribedByIds”setDescribedByIds(ids: string[]): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| ids | string[] |