update form control type name to match
This commit is contained in:
@@ -27,7 +27,7 @@ type FlagTypes =
|
|||||||
| 'valid';
|
| 'valid';
|
||||||
|
|
||||||
// Acceptable as an internal interface/type, BUT if exposed externally this should be turned into a public interface in a separate file.
|
// Acceptable as an internal interface/type, BUT if exposed externally this should be turned into a public interface in a separate file.
|
||||||
interface UmbFormControlValidationConfig {
|
interface UmbFormControlValidatorConfig {
|
||||||
flagKey: FlagTypes;
|
flagKey: FlagTypes;
|
||||||
getMessageMethod: () => string;
|
getMessageMethod: () => string;
|
||||||
checkMethod: () => boolean;
|
checkMethod: () => boolean;
|
||||||
@@ -35,7 +35,7 @@ interface UmbFormControlValidationConfig {
|
|||||||
|
|
||||||
export interface UmbFormControlMixinInterface<ValueType, DefaultValueType> extends HTMLElement {
|
export interface UmbFormControlMixinInterface<ValueType, DefaultValueType> extends HTMLElement {
|
||||||
addValidator: (flagKey: FlagTypes, getMessageMethod: () => string, checkMethod: () => boolean) => void;
|
addValidator: (flagKey: FlagTypes, getMessageMethod: () => string, checkMethod: () => boolean) => void;
|
||||||
removeValidator: (obj: UmbFormControlValidationConfig) => void;
|
removeValidator: (obj: UmbFormControlValidatorConfig) => void;
|
||||||
//static formAssociated: boolean;
|
//static formAssociated: boolean;
|
||||||
//protected getFormElement(): HTMLElement | undefined | null; // allows for null as it makes it simpler to just implement a querySelector as that might return null. [NL]
|
//protected getFormElement(): HTMLElement | undefined | null; // allows for null as it makes it simpler to just implement a querySelector as that might return null. [NL]
|
||||||
focusFirstInvalidElement(): void;
|
focusFirstInvalidElement(): void;
|
||||||
@@ -57,7 +57,7 @@ export declare abstract class UmbFormControlMixinElement<ValueType, DefaultValue
|
|||||||
protected _internals: ElementInternals;
|
protected _internals: ElementInternals;
|
||||||
protected _runValidators(): void;
|
protected _runValidators(): void;
|
||||||
addValidator: (flagKey: FlagTypes, getMessageMethod: () => string, checkMethod: () => boolean) => void;
|
addValidator: (flagKey: FlagTypes, getMessageMethod: () => string, checkMethod: () => boolean) => void;
|
||||||
removeValidator: (obj: UmbFormControlValidationConfig) => void;
|
removeValidator: (obj: UmbFormControlValidatorConfig) => void;
|
||||||
protected addFormControlElement(element: UmbNativeFormControlElement): void;
|
protected addFormControlElement(element: UmbNativeFormControlElement): void;
|
||||||
|
|
||||||
//static formAssociated: boolean;
|
//static formAssociated: boolean;
|
||||||
@@ -138,7 +138,7 @@ export const UmbFormControlMixin = <
|
|||||||
#value: ValueType | DefaultValueType = defaultValue;
|
#value: ValueType | DefaultValueType = defaultValue;
|
||||||
protected _internals: ElementInternals;
|
protected _internals: ElementInternals;
|
||||||
#form: HTMLFormElement | null = null;
|
#form: HTMLFormElement | null = null;
|
||||||
#validators: UmbFormControlValidationConfig[] = [];
|
#validators: UmbFormControlValidatorConfig[] = [];
|
||||||
#formCtrlElements: UmbNativeFormControlElement[] = [];
|
#formCtrlElements: UmbNativeFormControlElement[] = [];
|
||||||
|
|
||||||
constructor(...args: any[]) {
|
constructor(...args: any[]) {
|
||||||
@@ -208,7 +208,7 @@ export const UmbFormControlMixin = <
|
|||||||
flagKey: FlagTypes,
|
flagKey: FlagTypes,
|
||||||
getMessageMethod: () => string,
|
getMessageMethod: () => string,
|
||||||
checkMethod: () => boolean,
|
checkMethod: () => boolean,
|
||||||
): UmbFormControlValidationConfig {
|
): UmbFormControlValidatorConfig {
|
||||||
const validator = {
|
const validator = {
|
||||||
flagKey: flagKey,
|
flagKey: flagKey,
|
||||||
getMessageMethod: getMessageMethod,
|
getMessageMethod: getMessageMethod,
|
||||||
@@ -221,9 +221,9 @@ export const UmbFormControlMixin = <
|
|||||||
/**
|
/**
|
||||||
* Remove validation from this form control.
|
* Remove validation from this form control.
|
||||||
* @method removeValidator
|
* @method removeValidator
|
||||||
* @param {UmbFormControlValidationConfig} validator - The specific validation configuration to remove.
|
* @param {UmbFormControlValidatorConfig} validator - The specific validation configuration to remove.
|
||||||
*/
|
*/
|
||||||
removeValidator(validator: UmbFormControlValidationConfig) {
|
removeValidator(validator: UmbFormControlValidatorConfig) {
|
||||||
const index = this.#validators.indexOf(validator);
|
const index = this.#validators.indexOf(validator);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.#validators.splice(index, 1);
|
this.#validators.splice(index, 1);
|
||||||
@@ -251,7 +251,7 @@ export const UmbFormControlMixin = <
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _customValidityObject?: UmbFormControlValidationConfig;
|
private _customValidityObject?: UmbFormControlValidatorConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method setCustomValidity
|
* @method setCustomValidity
|
||||||
|
|||||||
Reference in New Issue
Block a user