Add SupportReadOnlyMode to editor
This commit is contained in:
@@ -68,4 +68,11 @@ public class ContentPropertyBasic
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
public IDataEditor? PropertyEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used internally during model mapping
|
||||
/// </summary>
|
||||
[DataMember(Name = "supportsReadOnly")]
|
||||
[ReadOnly(true)]
|
||||
public bool SupportsReadOnly { get; set; }
|
||||
}
|
||||
|
||||
@@ -40,7 +40,4 @@ public class ContentPropertyDisplay : ContentPropertyBasic
|
||||
|
||||
[DataMember(Name = "readonly")]
|
||||
public bool Readonly { get; set; }
|
||||
|
||||
[DataMember(Name = "supportsReadOnly")]
|
||||
public bool SupportsReadOnly { get; set; }
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ internal class ContentPropertyBasicMapper<TDestination>
|
||||
dest.Alias = property.Alias;
|
||||
dest.PropertyEditor = editor;
|
||||
dest.Editor = editor.Alias;
|
||||
dest.SupportsReadOnly = editor.SupportsReadOnly;
|
||||
dest.DataTypeKey = property.PropertyType!.DataTypeKey;
|
||||
|
||||
// if there's a set of property aliases specified, we will check if the current property's value should be mapped.
|
||||
|
||||
@@ -117,8 +117,6 @@ public class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper<IMember>
|
||||
prop.IsSensitive = true;
|
||||
// mark this property as readonly so that it does not post any data
|
||||
prop.Readonly = true;
|
||||
// this is readonly so support read-only mode
|
||||
prop.SupportsReadOnly = true;
|
||||
// replace this editor with a sensitive value
|
||||
prop.View = "sensitivevalue";
|
||||
// clear the value
|
||||
@@ -235,7 +233,6 @@ public class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper<IMember>
|
||||
View = "boolean",
|
||||
IsSensitive = true,
|
||||
Readonly = false,
|
||||
SupportsReadOnly = true,
|
||||
},
|
||||
|
||||
new()
|
||||
@@ -246,7 +243,6 @@ public class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper<IMember>
|
||||
View = "boolean",
|
||||
IsSensitive = true,
|
||||
Readonly = !member.IsLockedOut, // IMember.IsLockedOut can't be set to true, so make it readonly when that's the case (you can only unlock)
|
||||
SupportsReadOnly = true,
|
||||
},
|
||||
|
||||
new()
|
||||
@@ -287,7 +283,6 @@ public class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper<IMember>
|
||||
property.Value = null;
|
||||
property.View = "sensitivevalue";
|
||||
property.Readonly = true;
|
||||
property.SupportsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,10 @@ public class DataEditor : IDataEditor
|
||||
[DataMember(Name = "alias", IsRequired = true)]
|
||||
public string Alias { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataMember(Name = "supportsReadOnly", IsRequired = true)]
|
||||
public bool SupportsReadOnly { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[IgnoreDataMember]
|
||||
public EditorType Type { get; }
|
||||
|
||||
@@ -14,6 +14,8 @@ public interface IDataEditor : IDiscoverable
|
||||
/// </summary>
|
||||
string Alias { get; }
|
||||
|
||||
bool SupportsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the editor.
|
||||
/// </summary>
|
||||
|
||||
@@ -43,6 +43,7 @@ public class TextboxPropertyEditor : DataEditor
|
||||
{
|
||||
_ioHelper = ioHelper;
|
||||
_editorConfigurationParser = editorConfigurationParser;
|
||||
SupportsReadOnly = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user