You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
2 months ago
|
|
||
|
namespace AV.UITK
|
||
|
{
|
||
|
public partial class FluentElement<T>
|
||
|
{
|
||
|
public FluentElement<T> Name(string name)
|
||
|
{
|
||
|
x.name = NamePokaYoke(name);
|
||
|
return x;
|
||
|
}
|
||
|
|
||
|
public bool HasClass(string className)
|
||
|
{
|
||
|
return x.ClassListContains(ClassPokaYoke(className));
|
||
|
}
|
||
|
public FluentElement<T> AddClass(params string[] classes)
|
||
|
{
|
||
|
foreach (var className in classes)
|
||
|
x.AddToClassList(ClassPokaYoke(className));
|
||
|
|
||
|
return x;
|
||
|
}
|
||
|
public FluentElement<T> RemoveClass(params string[] classes)
|
||
|
{
|
||
|
foreach (var className in classes)
|
||
|
x.RemoveFromClassList(ClassPokaYoke(className));
|
||
|
|
||
|
return x;
|
||
|
}
|
||
|
public FluentElement<T> EnableClass(string className, bool enable)
|
||
|
{
|
||
|
x.EnableInClassList(ClassPokaYoke(className), enable);
|
||
|
return x;
|
||
|
}
|
||
|
|
||
|
|
||
|
string NamePokaYoke(string name)
|
||
|
{
|
||
|
if (name.StartsWith("#"))
|
||
|
return name.Remove(0, 1);
|
||
|
return name;
|
||
|
}
|
||
|
string ClassPokaYoke(string className)
|
||
|
{
|
||
|
if (className.StartsWith("."))
|
||
|
return className.Remove(0, 1);
|
||
|
return className;
|
||
|
}
|
||
|
}
|
||
|
}
|