|
@@ -19,18 +19,18 @@ public abstract class DynamicGridEditorColumn<TEntity, TEditor, TGridColumn, TTr
|
|
|
|
|
|
public List<string> ExtraColumns { get; } = new();
|
|
|
|
|
|
- public string? MappingName => Definition?.ColumnName.Replace('.', '_');
|
|
|
+ public string MappingName => Definition.ColumnName.Replace('.', '_');
|
|
|
|
|
|
- public string? TreeMappingName => $"[{Definition?.ColumnName}]";
|
|
|
+ public string TreeMappingName => $"[{Definition.ColumnName}]";
|
|
|
|
|
|
- public Func<BaseObject>? GetEntity { get; set; }
|
|
|
+ public Func<BaseObject?>? GetEntity { get; set; }
|
|
|
|
|
|
public void DoEntityChanged(string columnname, Dictionary<string,object?> changes)
|
|
|
{
|
|
|
EntityChanged?.Invoke(this, new DynamicColumnEntityChangedEventArgs(columnname, changes));
|
|
|
}
|
|
|
|
|
|
- public event DynamicColumnEntityChangedEvent EntityChanged;
|
|
|
+ public event DynamicColumnEntityChangedEvent? EntityChanged;
|
|
|
|
|
|
public TGridColumn CreateGridColumn()
|
|
|
{
|
|
@@ -81,21 +81,17 @@ public abstract class DynamicGridEditorColumn<TEntity, TEditor, TGridColumn, TTr
|
|
|
Definition = definition;
|
|
|
}
|
|
|
|
|
|
- public DynamicGridColumn? Definition { get; set; }
|
|
|
+ public DynamicGridColumn Definition { get; set; }
|
|
|
|
|
|
- public virtual GridSummaryColumn? Summary() => null;
|
|
|
+ public virtual IDynamicGridSummary? Summary() => null;
|
|
|
|
|
|
public TEditor? Editor
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- if (Definition != null)
|
|
|
- {
|
|
|
- if (Definition?.Editor is not TEditor result)
|
|
|
- result = CoreUtils.GetProperty<TEntity>(Definition.ColumnName)?.GetEditor() as TEditor;
|
|
|
- return result;
|
|
|
- }
|
|
|
- return null;
|
|
|
+ if (Definition.Editor is not TEditor result)
|
|
|
+ result = CoreUtils.GetProperty<TEntity>(Definition.ColumnName)?.GetEditor() as TEditor;
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -108,40 +104,40 @@ public abstract class DynamicGridEditorColumn<TEntity, TEditor, TGridColumn, TTr
|
|
|
column.MappingName = TreeMappingName;
|
|
|
}
|
|
|
|
|
|
- protected TextAlignment GetTextAlignment(TEditor editor) => Definition?.Alignment == Alignment.NotSet
|
|
|
+ protected TextAlignment GetTextAlignment(TEditor editor) => Definition.Alignment == Alignment.NotSet
|
|
|
? editor is NumericEditor ? TextAlignment.Right : TextAlignment.Left
|
|
|
- : Definition?.Alignment == Alignment.BottomLeft ||
|
|
|
- Definition?.Alignment == Alignment.MiddleLeft ||
|
|
|
- Definition?.Alignment == Alignment.TopLeft
|
|
|
+ : Definition.Alignment == Alignment.BottomLeft ||
|
|
|
+ Definition.Alignment == Alignment.MiddleLeft ||
|
|
|
+ Definition.Alignment == Alignment.TopLeft
|
|
|
? TextAlignment.Left
|
|
|
- : Definition?.Alignment == Alignment.BottomCenter ||
|
|
|
- Definition?.Alignment == Alignment.MiddleCenter ||
|
|
|
- Definition?.Alignment == Alignment.TopCenter
|
|
|
+ : Definition.Alignment == Alignment.BottomCenter ||
|
|
|
+ Definition.Alignment == Alignment.MiddleCenter ||
|
|
|
+ Definition.Alignment == Alignment.TopCenter
|
|
|
? TextAlignment.Center
|
|
|
: TextAlignment.Right;
|
|
|
|
|
|
|
|
|
- protected HorizontalAlignment GetHorizontalAlignment(TEditor editor) => Definition?.Alignment == Alignment.NotSet
|
|
|
+ protected HorizontalAlignment GetHorizontalAlignment(TEditor editor) => Definition.Alignment == Alignment.NotSet
|
|
|
? editor is NumericEditor ? HorizontalAlignment.Right : HorizontalAlignment.Left
|
|
|
- : Definition?.Alignment == Alignment.BottomLeft ||
|
|
|
- Definition?.Alignment == Alignment.MiddleLeft ||
|
|
|
- Definition?.Alignment == Alignment.TopLeft
|
|
|
+ : Definition.Alignment == Alignment.BottomLeft ||
|
|
|
+ Definition.Alignment == Alignment.MiddleLeft ||
|
|
|
+ Definition.Alignment == Alignment.TopLeft
|
|
|
? HorizontalAlignment.Left
|
|
|
- : Definition?.Alignment == Alignment.BottomCenter ||
|
|
|
- Definition?.Alignment == Alignment.MiddleCenter ||
|
|
|
- Definition?.Alignment == Alignment.TopCenter
|
|
|
+ : Definition.Alignment == Alignment.BottomCenter ||
|
|
|
+ Definition.Alignment == Alignment.MiddleCenter ||
|
|
|
+ Definition.Alignment == Alignment.TopCenter
|
|
|
? HorizontalAlignment.Center
|
|
|
: HorizontalAlignment.Right;
|
|
|
|
|
|
- protected VerticalAlignment GetVerticalAlignment(TEditor editor) => Definition?.Alignment == Alignment.NotSet
|
|
|
+ protected VerticalAlignment GetVerticalAlignment(TEditor editor) => Definition.Alignment == Alignment.NotSet
|
|
|
? VerticalAlignment.Center
|
|
|
- : Definition?.Alignment == Alignment.TopLeft ||
|
|
|
- Definition?.Alignment == Alignment.TopCenter ||
|
|
|
- Definition?.Alignment == Alignment.TopRight
|
|
|
+ : Definition.Alignment == Alignment.TopLeft ||
|
|
|
+ Definition.Alignment == Alignment.TopCenter ||
|
|
|
+ Definition.Alignment == Alignment.TopRight
|
|
|
? VerticalAlignment.Top
|
|
|
- : Definition?.Alignment == Alignment.MiddleLeft ||
|
|
|
- Definition?.Alignment == Alignment.MiddleCenter ||
|
|
|
- Definition?.Alignment == Alignment.MiddleRight
|
|
|
+ : Definition.Alignment == Alignment.MiddleLeft ||
|
|
|
+ Definition.Alignment == Alignment.MiddleCenter ||
|
|
|
+ Definition.Alignment == Alignment.MiddleRight
|
|
|
? VerticalAlignment.Center
|
|
|
: VerticalAlignment.Bottom;
|
|
|
|
|
@@ -155,8 +151,8 @@ public abstract class DynamicGridEditorColumn<TEntity, TEditor, TGridColumn, TTr
|
|
|
column.ColumnSizer =
|
|
|
GridLengthUnitType
|
|
|
.None; //column.Width != 0 ? GridLengthUnitType.None : GridLengthUnitType.AutoWithLastColumnFill;
|
|
|
- column.HeaderText = string.IsNullOrWhiteSpace(Definition?.Caption)
|
|
|
- ? Definition?.ColumnName
|
|
|
+ column.HeaderText = string.IsNullOrWhiteSpace(Definition.Caption)
|
|
|
+ ? Definition.ColumnName
|
|
|
: Definition.Caption;
|
|
|
|
|
|
column.TextAlignment = GetTextAlignment(editor);
|
|
@@ -171,8 +167,8 @@ public abstract class DynamicGridEditorColumn<TEntity, TEditor, TGridColumn, TTr
|
|
|
column.Width = column.Width; // != 0 ? column.Width : double.NaN;
|
|
|
|
|
|
column.ColumnSizer = TreeColumnSizer.None;
|
|
|
- column.HeaderText = string.IsNullOrWhiteSpace(Definition?.Caption)
|
|
|
- ? Definition?.ColumnName
|
|
|
+ column.HeaderText = string.IsNullOrWhiteSpace(Definition.Caption)
|
|
|
+ ? Definition.ColumnName
|
|
|
: Definition.Caption;
|
|
|
|
|
|
column.TextAlignment = GetTextAlignment(editor);
|