mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 00:08:51 -05:00
Integrates validators into drawers pipeline
This commit is contained in:
parent
5845f1758a
commit
801b793124
@ -36,11 +36,6 @@ namespace TriInspector.Elements
|
|||||||
element = drawer.CreateElementInternal(property, element);
|
element = drawer.CreateElementInternal(property, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property.HasValidators)
|
|
||||||
{
|
|
||||||
AddChild(new TriPropertyValidationResultElement(property));
|
|
||||||
}
|
|
||||||
|
|
||||||
AddChild(element);
|
AddChild(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
{
|
{
|
||||||
public const int System = -9999;
|
public const int System = -9999;
|
||||||
public const int Inspector = -2000;
|
public const int Inspector = -2000;
|
||||||
|
public const int Validator = -1500;
|
||||||
public const int Decorator = -1000;
|
public const int Decorator = -1000;
|
||||||
public const int Drawer = 0;
|
public const int Drawer = 0;
|
||||||
public const int Fallback = 9999;
|
public const int Fallback = 9999;
|
||||||
|
@ -152,6 +152,14 @@ namespace TriInspector
|
|||||||
_drawersBackingField = Enumerable.Empty<TriCustomDrawer>()
|
_drawersBackingField = Enumerable.Empty<TriCustomDrawer>()
|
||||||
.Concat(TriDrawersUtilities.CreateValueDrawersFor(FieldType))
|
.Concat(TriDrawersUtilities.CreateValueDrawersFor(FieldType))
|
||||||
.Concat(TriDrawersUtilities.CreateAttributeDrawersFor(Attributes))
|
.Concat(TriDrawersUtilities.CreateAttributeDrawersFor(Attributes))
|
||||||
|
.Concat(new[]
|
||||||
|
{
|
||||||
|
new ValidatorsDrawer
|
||||||
|
{
|
||||||
|
Order = TriDrawerOrder.Validator,
|
||||||
|
ApplyOnArrayElement = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
.Where(it => CanApplyOn(this, it.ApplyOnArrayElement))
|
.Where(it => CanApplyOn(this, it.ApplyOnArrayElement))
|
||||||
.OrderBy(it => it.Order)
|
.OrderBy(it => it.Order)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
20
Editor/ValidatorsDrawer.cs
Normal file
20
Editor/ValidatorsDrawer.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using TriInspector.Elements;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
internal class ValidatorsDrawer : TriCustomDrawer
|
||||||
|
{
|
||||||
|
public override TriElement CreateElementInternal(TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
if (!property.HasValidators)
|
||||||
|
{
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
var element = new TriElement();
|
||||||
|
element.AddChild(new TriPropertyValidationResultElement(property));
|
||||||
|
element.AddChild(next);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/ValidatorsDrawer.cs.meta
Normal file
3
Editor/ValidatorsDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 70da4f7e93ab42ffa7b39c465d2d33e1
|
||||||
|
timeCreated: 1652969657
|
Loading…
Reference in New Issue
Block a user