// Copyright (c) MudBlazor 2021
// MudBlazor licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Connected
{
public interface IMask
{
///
/// The mask defining the structure of the accepted input.
/// Its format depends on the implementation.
///
string Mask { get; }
///
/// The current text as it is displayed in the component
///
string Text { get; }
///
/// 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.
///
string GetCleanText() => Text;
///
/// The current caret position
///
int CaretPos { get; set; }
///
/// The currently selected sub-section of the Text
///
(int, int)? Selection { get; set; }
///
/// Implements user input at the current caret position (single key strokes or pasting longer text)
///
///
void Insert(string input);
///
/// Implements the effect of the Del key at the current cursor position
///
void Delete();
///
/// Implements the effect of the Backspace key at the current cursor position
///
void Backspace();
///
/// Reset the mask as if the whole textfield was cleared
///
void Clear();
///
/// Overwrite the mask text without losing caret position
///
///
void SetText(string text);
///
/// Copy config from other mask but preserve own state.
///
///
void UpdateFrom(IMask other);
}
}