// #region Imports
// #endregion
const requiredAttribute = 'required';
/**
 * Validator that requires the control have a non-empty value.
 *
 * State:
 * * valueMissing
 *
 * @public
 * @param control
 * @returns null if the validation check passes, otherwise an object containing information.
 */
export function requiredValidator(element) {
    // print a waring if the `required` attribute is not set
    if (!element.hasAttribute(requiredAttribute)) {
        console.warn(`[RequiredValidator]: The '${requiredAttribute}' attribute of '${element.tagName.toLowerCase()}' is missing in the inner form field element.`);
    }
    // adopt to native attribute element
    // if (requiredAttribute in element) {
    //     RendererServiceLocator.current.setAttribute(element, requiredAttribute);
    // }
    return element.value == null || ((typeof element.value === 'string' || Array.isArray(element.value)) && element.value.length === 0)
        ? { valueMissing: true }
        : null;
}
//# sourceMappingURL=RequiredElementValidatorFn.js.map