Class BaseMask
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
public abstract class BaseMask : IMask
- Inheritance
-
BaseMask
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseMask()
protected BaseMask()
Fields
_delimiters
protected HashSet<char> _delimiters
Field Value
_initialized
protected bool _initialized
Field Value
_maskChars
protected MaskChar[] _maskChars
Field Value
- MaskChar[]
_maskDict
protected Dictionary<char, MaskChar> _maskDict
Field Value
Properties
AllowOnlyDelimiters
Allow showing a text consisting only of delimiters
public bool AllowOnlyDelimiters { get; set; }
Property Value
CaretPos
The current caret position
public int CaretPos { get; set; }
Property Value
Mask
The mask defining the structure of the accepted input. The mask format depends on the implementation.
public string Mask { get; protected set; }
Property Value
MaskChars
The mask chars define the meaning of single mask characters such as 'a', '0'
public MaskChar[] MaskChars { get; set; }
Property Value
- MaskChar[]
Selection
The currently selected sub-section of the Text
public (int, int)? Selection { get; set; }
Property Value
Text
The current text as it is displayed in the component
public string Text { get; protected set; }
Property Value
Methods
Backspace()
Implements the effect of the Backspace key at the current cursor position
public abstract void Backspace()
Clear()
Reset the mask as if the whole textfield was cleared
public void Clear()
ConsolidateCaret(string, int)
Performs simple border checks and corrections to the caret position
protected static int ConsolidateCaret(string text, int caretPos)
Parameters
Returns
ConsolidateSelection()
Performs simple border checks and corrections to the selection and removes zero-width selections
protected void ConsolidateSelection()
Delete()
Implements the effect of the Del key at the current cursor position
public abstract void Delete()
DeleteSelection(bool)
protected abstract void DeleteSelection(bool align)
Parameters
align
bool
GetCleanText()
Get the Text without delimiters or placeholders. Depends on the implementation entirely. Clean text will usually be used for the Value property of a mask field.
public virtual string GetCleanText()
Returns
Init()
Initialize all internal data structures. Can be called multiple times, will initialize only once. To re-initialize set _initialized to false.
protected void Init()
InitInternals()
protected virtual void InitInternals()
Insert(string)
Implements user input at the current caret position (single key strokes or pasting longer text)
public abstract void Insert(string input)
Parameters
input
string
IsDelimiter(char)
protected virtual bool IsDelimiter(char maskChar)
Parameters
maskChar
char
Returns
Refresh()
Re-applies parameters (i.e. after they changed) without loosing internal state such as Text, CaretPos and Selection
protected virtual void Refresh()
SetText(string)
Overwrite the mask text from the outside without losing caret position
public void SetText(string text)
Parameters
text
string
ToString()
Prints a representation of the input including markers for caret and selection Used heavily by the tests
public override string ToString()
Returns
UpdateFrom(IMask)
public virtual void UpdateFrom(IMask o)
Parameters
o
IMask
UpdateText(string)
Update Text from the inside
protected virtual void UpdateText(string text)
Parameters
text
string