ReadonlyallowIf true, unicode values in the cleaned values will be allowed. Otherwise unicode values will try to be transliterated.
ReadonlycontextAlign with the default flags that can be assumed when pulling from Python.
ReadonlyformattersAn array of formatter entries with a regex (pattern or pattern & flags array) and an optional replace value.
Locale code, used to provide a more specific cleaned value.
Cache the compiled regex for performance.
ReadonlytrimIf true, value will be trimmed in all clean methods before being processed by that method.
und (undetermined) locale as per ISO 639-2
StaticblessingsStaticoutletsStatictargetsStaticvaluesStaticshouldAllow for a comparison value to be provided so that a dispatched event can be prevented. This provides a way for other events to interact with this controller to block further updates if a value is not in sync. By default it will compare to the slugify method, this can be overridden by providing either a Stimulus param value on the element or the event's detail.
Compares the provided strings, ensuring the values are the same.
Formats the source value based on supplied formatters and formatting options. Runs as part of the prepare method on methods called (when used as Stimulus actions) or can be used directly as a standalone action.
Run the format method when the formatters change to ensure that the regex cache is populated with the latest values and that the formatters are valid.
Optionalformatters: FormatterEntry[]Get a compiled regular expression from the cache or create a new one.
Returns the element's value as is, without any modifications. Useful for identity fields or when no cleaning is required but the event is needed or comparison is required to always pass.
If the locale is not provided, attempt to find the most suitable target locale:
und (undetermined) as per ISO 639-2This only makes a difference when using the urlify method and where there are
overlapping characters that need to be downcoded but are not in the desired order by default.
Prepares the value before being processed by an action method. If runFormat is true, it will run the format method on the value.
Basic slugify of a string, updates the controlled element's value or can be used to simply return the transformed value. If a custom event with detail.value is provided, that value will be used instead of the field's value.
Advanced slugify of a string, updates the controlled element's value or can be used to simply return the transformed value.
The urlify (Django port) function performs extra processing on the string & is more suitable for creating a slug from the title, rather than sanitizing manually. If the urlify util returns an empty string it will fall back to the slugify method.
If a custom event with detail.value is provided, that value will be used instead of the field's value.
Staticafter
Adds ability to clean values of an input element with methods such as
format,slugifyorurlify.Example: - Using the slugify method
Example: - Using the urlify method (registered as w-slug)
Example: - Using the format method with custom formatters