Compare commits
1 Commits
v3.3.1
...
archive/v3
| Author | SHA1 | Date | |
|---|---|---|---|
| b27800bfdf |
42
.idea/.idea.HopFrame/.idea/workspace.xml
generated
42
.idea/.idea.HopFrame/.idea/workspace.xml
generated
@@ -12,9 +12,22 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="0648788e-7696-4e60-bf12-5d5601f33d8c" name="Changes" comment="">
|
<list default="true" id="0648788e-7696-4e60-bf12-5d5601f33d8c" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Services/Implementations/ContextExplorer.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Services/Implementations/ContextExplorer.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Config/HopFrameConfig.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Config/HopFrameConfig.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Config/PropertyConfig.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Config/PropertyConfig.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Config/TableConfig.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Config/TableConfig.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Repositories/IHopFrameRepository.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Repositories/IHopFrameRepository.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/testing/HopFrame.Testing/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/testing/HopFrame.Testing/Program.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Annotations/EventHandlerAttribute.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Annotations/EventHandlerAttribute.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/EntryEvent.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/EntryEvent.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/HopFrameEventArgs.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/HopFrameEventArgs.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/PageChangeEvent.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/PageChangeEvent.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/ReloadEvent.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/ReloadEvent.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/SearchEvent.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/SearchEvent.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/TableInitializedEvent.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/TableInitializedEvent.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/ValidationEvent.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/ValidationEvent.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/ServiceCollectionExtensions.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/ServiceCollectionExtensions.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Services/ISearchSuggestionProvider.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Services/ISearchSuggestionProvider.cs" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -280,15 +293,8 @@
|
|||||||
<workItem from="1768753475773" duration="455000" />
|
<workItem from="1768753475773" duration="455000" />
|
||||||
<workItem from="1768753946559" duration="690000" />
|
<workItem from="1768753946559" duration="690000" />
|
||||||
<workItem from="1768756619311" duration="94000" />
|
<workItem from="1768756619311" duration="94000" />
|
||||||
<workItem from="1768847832546" duration="758000" />
|
<workItem from="1768847832546" duration="1238000" />
|
||||||
</task>
|
<workItem from="1769196883500" duration="5779000" />
|
||||||
<task id="LOCAL-00019" summary="Added web module tests">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1737298835225</created>
|
|
||||||
<option name="number" value="00019" />
|
|
||||||
<option name="presentableId" value="LOCAL-00019" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1737298835225</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00020" summary="Tested login functionality">
|
<task id="LOCAL-00020" summary="Tested login functionality">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -674,7 +680,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1768848267710</updated>
|
<updated>1768848267710</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="68" />
|
<task id="LOCAL-00068" summary="Added ability to use ignored tables in relation picker">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1768848702981</created>
|
||||||
|
<option name="number" value="00068" />
|
||||||
|
<option name="presentableId" value="LOCAL-00068" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1768848702981</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="69" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -715,7 +729,6 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
||||||
<MESSAGE value="Added basic export and import feature" />
|
|
||||||
<MESSAGE value="Finished converter plugin" />
|
<MESSAGE value="Finished converter plugin" />
|
||||||
<MESSAGE value="Patched CI" />
|
<MESSAGE value="Patched CI" />
|
||||||
<MESSAGE value="Prepared CI for v3.2.0" />
|
<MESSAGE value="Prepared CI for v3.2.0" />
|
||||||
@@ -740,6 +753,7 @@
|
|||||||
<MESSAGE value="Code cleanup + new pipeline setup" />
|
<MESSAGE value="Code cleanup + new pipeline setup" />
|
||||||
<MESSAGE value="Fixed #38" />
|
<MESSAGE value="Fixed #38" />
|
||||||
<MESSAGE value="Fixed #37" />
|
<MESSAGE value="Fixed #37" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Fixed #37" />
|
<MESSAGE value="Added ability to use ignored tables in relation picker" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Added ability to use ignored tables in relation picker" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -24,6 +24,10 @@ public sealed class HopFrameConfigurator(HopFrameConfig config, IServiceCollecti
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public HopFrameConfig InnerConfig { get; } = config;
|
public HopFrameConfig InnerConfig { get; } = config;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="ServiceCollection"/> of the application.
|
||||||
|
/// WARNING: Only use this during application building phase
|
||||||
|
/// </summary>
|
||||||
public IServiceCollection ServiceCollection { get; } = collection;
|
public IServiceCollection ServiceCollection { get; } = collection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ public class PropertyConfig(PropertyInfo info, TableConfig table, int nthPropert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public sealed class VirtualPropertyConfig(TableConfig table, int nthProperty) : PropertyConfig(GetDummyProperty(), table, nthProperty) {
|
public sealed class VirtualPropertyConfig(TableConfig table, int nthProperty) : PropertyConfig(GetDummyProperty(), table, nthProperty) {
|
||||||
|
|
||||||
public string? DummyProperty { get; set; } = null;
|
public string? DummyProperty { get; set; } = null;
|
||||||
|
|
||||||
public Func<object, string, IServiceProvider, Task>? VirtualParser { get; set; }
|
public Func<object, string, IServiceProvider, Task>? VirtualParser { get; set; }
|
||||||
@@ -69,6 +71,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the title displayed in the table header and edit dialog
|
/// Sets the title displayed in the table header and edit dialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="displayName">The new name of the property</param>
|
||||||
public PropertyConfigurator<TProp> SetDisplayName(string displayName) {
|
public PropertyConfigurator<TProp> SetDisplayName(string displayName) {
|
||||||
InnerConfig.Name = displayName;
|
InnerConfig.Name = displayName;
|
||||||
return this;
|
return this;
|
||||||
@@ -77,6 +80,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the property should appear in the table, if not the property is also set to be not searchable
|
/// Determines if the property should appear in the table, if not the property is also set to be not searchable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="list">The toggle for the option</param>
|
||||||
/// <seealso cref="IsSearchable"/>
|
/// <seealso cref="IsSearchable"/>
|
||||||
public PropertyConfigurator<TProp> List(bool list) {
|
public PropertyConfigurator<TProp> List(bool list) {
|
||||||
InnerConfig.List = list;
|
InnerConfig.List = list;
|
||||||
@@ -87,6 +91,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the table can be sorted by the property
|
/// Determines if the table can be sorted by the property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="sortable">The toggle for the option</param>
|
||||||
public PropertyConfigurator<TProp> IsSortable(bool sortable) {
|
public PropertyConfigurator<TProp> IsSortable(bool sortable) {
|
||||||
InnerConfig.Sortable = sortable;
|
InnerConfig.Sortable = sortable;
|
||||||
return this;
|
return this;
|
||||||
@@ -95,6 +100,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the property get taken into account for search results
|
/// Determines if the property get taken into account for search results
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="searchable">The toggle for the option</param>
|
||||||
public PropertyConfigurator<TProp> IsSearchable(bool searchable) {
|
public PropertyConfigurator<TProp> IsSearchable(bool searchable) {
|
||||||
InnerConfig.Searchable = searchable;
|
InnerConfig.Searchable = searchable;
|
||||||
return this;
|
return this;
|
||||||
@@ -103,6 +109,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the value that should be displayed instead of the string representation of the type
|
/// Determines if the value that should be displayed instead of the string representation of the type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="propertyExpression">The expression that points at the property that should be used</param>
|
||||||
public PropertyConfigurator<TProp> SetDisplayedProperty<TInnerProp>(Expression<Func<TProp, TInnerProp>> propertyExpression) {
|
public PropertyConfigurator<TProp> SetDisplayedProperty<TInnerProp>(Expression<Func<TProp, TInnerProp>> propertyExpression) {
|
||||||
InnerConfig.DisplayedProperty = TableConfigurator<TProp>.GetPropertyInfo(propertyExpression);
|
InnerConfig.DisplayedProperty = TableConfigurator<TProp>.GetPropertyInfo(propertyExpression);
|
||||||
return this;
|
return this;
|
||||||
@@ -111,6 +118,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the value that's displayed in the admin ui
|
/// Determines the value that's displayed in the admin ui
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="formatter">The function that formats the given entity</param>
|
||||||
/// <seealso cref="SetDisplayedProperty{TInnerProp}"/>
|
/// <seealso cref="SetDisplayedProperty{TInnerProp}"/>
|
||||||
public PropertyConfigurator<TProp> Format(Func<TProp, IServiceProvider, string> formatter) {
|
public PropertyConfigurator<TProp> Format(Func<TProp, IServiceProvider, string> formatter) {
|
||||||
InnerConfig.Formatter = (obj, provider) => Task.FromResult(formatter.Invoke((TProp)obj, provider));
|
InnerConfig.Formatter = (obj, provider) => Task.FromResult(formatter.Invoke((TProp)obj, provider));
|
||||||
@@ -126,6 +134,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the value that's displayed for each entry in the list
|
/// Determines the value that's displayed for each entry in the list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="formatter">The function that formats each given element</param>
|
||||||
public PropertyConfigurator<TProp> FormatEach<TInnerProp>(Func<TInnerProp, IServiceProvider, string> formatter) {
|
public PropertyConfigurator<TProp> FormatEach<TInnerProp>(Func<TInnerProp, IServiceProvider, string> formatter) {
|
||||||
InnerConfig.EnumerableFormatter = (obj, provider) => Task.FromResult(formatter.Invoke((TInnerProp)obj, provider));
|
InnerConfig.EnumerableFormatter = (obj, provider) => Task.FromResult(formatter.Invoke((TInnerProp)obj, provider));
|
||||||
return this;
|
return this;
|
||||||
@@ -140,6 +149,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the function used for parsing the value provided in the editor dialog to the actual property value
|
/// Determines the function used for parsing the value provided in the editor dialog to the actual property value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="parser">The function that converts the user input to the desired type</param>
|
||||||
public PropertyConfigurator<TProp> SetParser(Func<string, IServiceProvider, TProp> parser) {
|
public PropertyConfigurator<TProp> SetParser(Func<string, IServiceProvider, TProp> parser) {
|
||||||
InnerConfig.Parser = (str, provider) => Task.FromResult<object>(parser.Invoke(str, provider)!);
|
InnerConfig.Parser = (str, provider) => Task.FromResult<object>(parser.Invoke(str, provider)!);
|
||||||
return this;
|
return this;
|
||||||
@@ -154,6 +164,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the value can be edited in the admin ui. If true, the value can still be initially set, but not modified
|
/// Determines if the value can be edited in the admin ui. If true, the value can still be initially set, but not modified
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="editable">The toggle for the option</param>
|
||||||
/// <seealso cref="SetCreatable"/>
|
/// <seealso cref="SetCreatable"/>
|
||||||
public PropertyConfigurator<TProp> SetEditable(bool editable) {
|
public PropertyConfigurator<TProp> SetEditable(bool editable) {
|
||||||
InnerConfig.Editable = editable;
|
InnerConfig.Editable = editable;
|
||||||
@@ -163,6 +174,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the initial value can be edited in the admin ui. If true the value will not be visible in the create dialog
|
/// Determines if the initial value can be edited in the admin ui. If true the value will not be visible in the create dialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="creatable">The toggle for the option</param>
|
||||||
/// <seealso cref="SetEditable"/>
|
/// <seealso cref="SetEditable"/>
|
||||||
public PropertyConfigurator<TProp> SetCreatable(bool creatable) {
|
public PropertyConfigurator<TProp> SetCreatable(bool creatable) {
|
||||||
InnerConfig.Creatable = creatable;
|
InnerConfig.Creatable = creatable;
|
||||||
@@ -172,6 +184,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the value should be displayed in the admin ui (useful for secrets like passwords etc.)
|
/// Determines if the value should be displayed in the admin ui (useful for secrets like passwords etc.)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="display">The toggle for the option</param>
|
||||||
public PropertyConfigurator<TProp> DisplayValue(bool display) {
|
public PropertyConfigurator<TProp> DisplayValue(bool display) {
|
||||||
InnerConfig.DisplayValue = display;
|
InnerConfig.DisplayValue = display;
|
||||||
return this;
|
return this;
|
||||||
@@ -180,6 +193,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the admin ui should use a text area for modifying the value
|
/// Determines if the admin ui should use a text area for modifying the value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="textField">The toggle for the option</param>
|
||||||
/// <seealso cref="SetTextAreaRows"/>
|
/// <seealso cref="SetTextAreaRows"/>
|
||||||
public PropertyConfigurator<TProp> IsTextArea(bool textField) {
|
public PropertyConfigurator<TProp> IsTextArea(bool textField) {
|
||||||
InnerConfig.TextArea = textField;
|
InnerConfig.TextArea = textField;
|
||||||
@@ -189,6 +203,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the initial size of the text area field
|
/// Determines the initial size of the text area field
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="rows">The number of rows (height) the text area field should have</param>
|
||||||
/// <seealso cref="IsTextArea"/>
|
/// <seealso cref="IsTextArea"/>
|
||||||
public PropertyConfigurator<TProp> SetTextAreaRows(int rows) {
|
public PropertyConfigurator<TProp> SetTextAreaRows(int rows) {
|
||||||
InnerConfig.TextAreaRows = rows;
|
InnerConfig.TextAreaRows = rows;
|
||||||
@@ -198,14 +213,18 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the validator used for the property value before saving
|
/// Determines the validator used for the property value before saving
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="validator">
|
||||||
|
/// The function that validates the given input.
|
||||||
|
///
|
||||||
|
/// It takes in the parsed property and an <see cref="IServiceProvider"/>
|
||||||
|
/// and returns an error list. If the list is empty, the property passes the check.
|
||||||
|
/// </param>
|
||||||
public PropertyConfigurator<TProp> SetValidator(Func<TProp?, IServiceProvider, IEnumerable<string>> validator) {
|
public PropertyConfigurator<TProp> SetValidator(Func<TProp?, IServiceProvider, IEnumerable<string>> validator) {
|
||||||
InnerConfig.Validator = (obj, provider) => Task.FromResult(validator.Invoke((TProp?)obj, provider));
|
InnerConfig.Validator = (obj, provider) => Task.FromResult(validator.Invoke((TProp?)obj, provider));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc cref="SetValidator(System.Func{TProp?,System.IServiceProvider,System.Collections.Generic.IEnumerable{string}})"/>
|
||||||
/// Determines the validator used for the property value before saving
|
|
||||||
/// </summary>
|
|
||||||
public PropertyConfigurator<TProp> SetValidator(Func<TProp?, IServiceProvider, Task<IEnumerable<string>>> validator) {
|
public PropertyConfigurator<TProp> SetValidator(Func<TProp?, IServiceProvider, Task<IEnumerable<string>>> validator) {
|
||||||
InnerConfig.Validator = (obj, provider) => validator.Invoke((TProp?)obj, provider);
|
InnerConfig.Validator = (obj, provider) => validator.Invoke((TProp?)obj, provider);
|
||||||
return this;
|
return this;
|
||||||
@@ -214,6 +233,7 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the order index for the property in the admin ui
|
/// Determines the order index for the property in the admin ui
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="index">The value for the option</param>
|
||||||
/// <seealso cref="TableConfigurator{TModel}.SetOrderIndex"/>
|
/// <seealso cref="TableConfigurator{TModel}.SetOrderIndex"/>
|
||||||
public PropertyConfigurator<TProp> SetOrderIndex(int index) {
|
public PropertyConfigurator<TProp> SetOrderIndex(int index) {
|
||||||
InnerConfig.Order = index;
|
InnerConfig.Order = index;
|
||||||
@@ -242,10 +262,12 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public sealed class VirtualPropertyConfigurator<TModel>(VirtualPropertyConfig config) : PropertyConfigurator<string>(config) {
|
public sealed class VirtualPropertyConfigurator<TModel>(VirtualPropertyConfig config) : PropertyConfigurator<string>(config) {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the function used for parsing the value provided in the editor dialog to the actual model value
|
/// Determines the function used for parsing the value provided in the editor dialog to the actual model value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="parser">The function that takes in the parent object and the user input and applies all necessary changes</param>
|
||||||
public VirtualPropertyConfigurator<TModel> SetVirtualParser(Action<TModel, string, IServiceProvider> parser) {
|
public VirtualPropertyConfigurator<TModel> SetVirtualParser(Action<TModel, string, IServiceProvider> parser) {
|
||||||
var cfg = InnerConfig as VirtualPropertyConfig;
|
var cfg = InnerConfig as VirtualPropertyConfig;
|
||||||
|
|
||||||
@@ -256,8 +278,8 @@ public sealed class VirtualPropertyConfigurator<TModel>(VirtualPropertyConfig co
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="SetVirtualParser{TModel}(System.Action{TModel,string,System.IServiceProvider})"/>
|
/// <inheritdoc cref="SetVirtualParser(System.Action{TModel, System.String, System.IServiceProvider})" />
|
||||||
public VirtualPropertyConfigurator<TModel> SetVirtualParser(Func<TModel, string, IServiceProvider, Task> parser) {
|
public VirtualPropertyConfigurator<TModel> SetVirtualParser(Func<TModel, string, IServiceProvider, Task> parser) {
|
||||||
var cfg = InnerConfig as VirtualPropertyConfig;
|
var cfg = InnerConfig as VirtualPropertyConfig;
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the table should be ignored in the admin ui
|
/// Determines if the table should be ignored in the admin ui
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="ignore">The toggle for the option</param>
|
||||||
public TableConfigurator<TModel> Ignore(bool ignore = true) {
|
public TableConfigurator<TModel> Ignore(bool ignore = true) {
|
||||||
InnerConfig.Ignored = ignore;
|
InnerConfig.Ignored = ignore;
|
||||||
return this;
|
return this;
|
||||||
@@ -70,6 +71,7 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if search suggestions should be displayed in the ui (Advanced Search)
|
/// Determines if search suggestions should be displayed in the ui (Advanced Search)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="show">The toggle for the option</param>
|
||||||
public TableConfigurator<TModel> ShowSearchSuggestions(bool show = true) {
|
public TableConfigurator<TModel> ShowSearchSuggestions(bool show = true) {
|
||||||
InnerConfig.ShowSearchSuggestions = show;
|
InnerConfig.ShowSearchSuggestions = show;
|
||||||
return this;
|
return this;
|
||||||
@@ -144,6 +146,7 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the name for the table used in the admin ui and url for the table page
|
/// Determines the name for the table used in the admin ui and url for the table page
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="name">The value for the option</param>
|
||||||
public TableConfigurator<TModel> SetDisplayName(string name) {
|
public TableConfigurator<TModel> SetDisplayName(string name) {
|
||||||
InnerConfig.DisplayName = name;
|
InnerConfig.DisplayName = name;
|
||||||
return this;
|
return this;
|
||||||
@@ -152,6 +155,7 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the description displayed in the admin ui
|
/// Determines the description displayed in the admin ui
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="description">The value for the option</param>
|
||||||
public TableConfigurator<TModel> SetDescription(string description) {
|
public TableConfigurator<TModel> SetDescription(string description) {
|
||||||
InnerConfig.Description = description;
|
InnerConfig.Description = description;
|
||||||
return this;
|
return this;
|
||||||
@@ -160,6 +164,7 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the order index for the table in the admin ui
|
/// Determines the order index for the table in the admin ui
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="index">The value for the option</param>
|
||||||
/// <seealso cref="PropertyConfigurator{TProp}.SetOrderIndex"/>
|
/// <seealso cref="PropertyConfigurator{TProp}.SetOrderIndex"/>
|
||||||
public TableConfigurator<TModel> SetOrderIndex(int index) {
|
public TableConfigurator<TModel> SetOrderIndex(int index) {
|
||||||
InnerConfig.Order = index;
|
InnerConfig.Order = index;
|
||||||
@@ -169,6 +174,8 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the policy needed by a user in order to view the table
|
/// Determines the policy needed by a user in order to view the table
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="policy">The value for the option</param>
|
||||||
|
/// <seealso cref="SetCombinedPolicy"/>
|
||||||
public TableConfigurator<TModel> SetViewPolicy(string policy) {
|
public TableConfigurator<TModel> SetViewPolicy(string policy) {
|
||||||
InnerConfig.ViewPolicy = policy;
|
InnerConfig.ViewPolicy = policy;
|
||||||
return this;
|
return this;
|
||||||
@@ -177,6 +184,8 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the policy needed by a user in order to edit the entries
|
/// Determines the policy needed by a user in order to edit the entries
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="policy">The value for the option</param>
|
||||||
|
/// <seealso cref="SetCombinedPolicy"/>
|
||||||
public TableConfigurator<TModel> SetUpdatePolicy(string policy) {
|
public TableConfigurator<TModel> SetUpdatePolicy(string policy) {
|
||||||
InnerConfig.UpdatePolicy = policy;
|
InnerConfig.UpdatePolicy = policy;
|
||||||
return this;
|
return this;
|
||||||
@@ -185,6 +194,8 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the policy needed by a user in order to create entries
|
/// Determines the policy needed by a user in order to create entries
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="policy">The value for the option</param>
|
||||||
|
/// <seealso cref="SetCombinedPolicy"/>
|
||||||
public TableConfigurator<TModel> SetCreatePolicy(string policy) {
|
public TableConfigurator<TModel> SetCreatePolicy(string policy) {
|
||||||
InnerConfig.CreatePolicy = policy;
|
InnerConfig.CreatePolicy = policy;
|
||||||
return this;
|
return this;
|
||||||
@@ -193,11 +204,25 @@ public sealed class TableConfigurator<TModel>(TableConfig config) {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the policy needed by a user in order to delete entries
|
/// Determines the policy needed by a user in order to delete entries
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="policy">The value for the option</param>
|
||||||
|
/// <seealso cref="SetCombinedPolicy"/>
|
||||||
public TableConfigurator<TModel> SetDeletePolicy(string policy) {
|
public TableConfigurator<TModel> SetDeletePolicy(string policy) {
|
||||||
InnerConfig.DeletePolicy = policy;
|
InnerConfig.DeletePolicy = policy;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the view, update, create and delete policies to the same value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="policy">The value for the options</param>
|
||||||
|
public TableConfigurator<TModel> SetCombinedPolicy(string policy) {
|
||||||
|
InnerConfig.ViewPolicy = policy;
|
||||||
|
InnerConfig.UpdatePolicy = policy;
|
||||||
|
InnerConfig.CreatePolicy = policy;
|
||||||
|
InnerConfig.DeletePolicy = policy;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a callback handler of the provided type
|
/// Adds a callback handler of the provided type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,24 +1,78 @@
|
|||||||
namespace HopFrame.Core.Repositories;
|
namespace HopFrame.Core.Repositories;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The middleware used to access data for custom repositories
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TModel">The type of the entity that is managed by this repository</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key of the entity that is managed by this repository</typeparam>
|
||||||
public interface IHopFrameRepository<TModel, in TKey> where TModel : class {
|
public interface IHopFrameRepository<TModel, in TKey> where TModel : class {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets used to load all entities of the current page to display
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="page">The page the user is currently on (starts at 0)</param>
|
||||||
|
/// <param name="perPage">The maximum number of elements that should be returned</param>
|
||||||
|
/// <returns>The entries for the requested page</returns>
|
||||||
Task<IEnumerable<TModel>> LoadPage(int page, int perPage);
|
Task<IEnumerable<TModel>> LoadPage(int page, int perPage);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets used to filter the entries by the entered search term
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchTerm">The search text that was entered by the user</param>
|
||||||
|
/// <param name="page">The page the user is currently on (starts at 0)</param>
|
||||||
|
/// <param name="perPage">The maximum number of elements that should be returned</param>
|
||||||
|
/// <returns>A list of the filtered entries on the current page with the total number of pages</returns>
|
||||||
|
/// <seealso cref="SearchResult{TModel}"/>
|
||||||
Task<SearchResult<TModel>> Search(string searchTerm, int page, int perPage);
|
Task<SearchResult<TModel>> Search(string searchTerm, int page, int perPage);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets used to determine the total number of pages
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="perPage">The maximum number of elements per page</param>
|
||||||
|
/// <returns>The total number of pages</returns>
|
||||||
Task<int> GetTotalPageCount(int perPage);
|
Task<int> GetTotalPageCount(int perPage);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets used when an entry is created through the UI
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The entry that needs to be saved</param>
|
||||||
Task CreateItem(TModel item);
|
Task CreateItem(TModel item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets used when an entry is modified through the UI
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The modified entry that needs to be saved</param>
|
||||||
Task EditItem(TModel item);
|
Task EditItem(TModel item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets used when an entry is deleted through the UI
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The entry that should be deleted</param>
|
||||||
Task DeleteItem(TModel item);
|
Task DeleteItem(TModel item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets used to receive information about a specific entry from the dataset
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The primary key of the desired entry</param>
|
||||||
|
/// <returns>Either the entry if one is found or <c>null</c></returns>
|
||||||
Task<TModel?> GetOne(TKey key);
|
Task<TModel?> GetOne(TKey key);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The object that is passed to the UI to display the search results
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="items">The found entries on the current page</param>
|
||||||
|
/// <param name="pageCount">The total number of pages that the search contains</param>
|
||||||
|
/// <typeparam name="TModel">The type of the entity</typeparam>
|
||||||
public readonly struct SearchResult<TModel>(IEnumerable<TModel> items, int pageCount) {
|
public readonly struct SearchResult<TModel>(IEnumerable<TModel> items, int pageCount) {
|
||||||
|
/// <summary>
|
||||||
|
/// The found entries on the current page
|
||||||
|
/// </summary>
|
||||||
public IEnumerable<TModel> Items { get; init; } = items;
|
public IEnumerable<TModel> Items { get; init; } = items;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total number of pages that the search contains
|
||||||
|
/// </summary>
|
||||||
public int PageCount { get; init; } = pageCount;
|
public int PageCount { get; init; } = pageCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
Sortable="@property.Sortable"/>
|
Sortable="@property.Sortable"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (DisplayActions && (_hasDeletePolicy || _hasUpdatePolicy)) {
|
@if (DisplayActions && (_hasDeletePolicy || _hasUpdatePolicy || _pluginButtons.Where(pb => pb.IsForTable(_config)).Any(pb => pb.Position == PluginButtonPosition.OnEntry))) {
|
||||||
<TemplateColumn Title="Actions" Align="@Align.End" Style="min-height: 44px; min-width: max-content">
|
<TemplateColumn Title="Actions" Align="@Align.End" Style="min-height: 44px; min-width: max-content">
|
||||||
@foreach (var button in _pluginButtons.Where(pb => pb.IsForTable(_config)).Where(pb => pb.Position == PluginButtonPosition.OnEntry)) {
|
@foreach (var button in _pluginButtons.Where(pb => pb.IsForTable(_config)).Where(pb => pb.Position == PluginButtonPosition.OnEntry)) {
|
||||||
<FluentButton OnClick="@(() => button.Handler.Invoke(context, _config!))">
|
<FluentButton OnClick="@(() => button.Handler.Invoke(context, _config!))">
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace HopFrame.Web.Plugins.Annotations;
|
namespace HopFrame.Web.Plugins.Annotations;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates, that the method is a handler for an event
|
||||||
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
public class EventHandlerAttribute : Attribute;
|
public class EventHandlerAttribute : Attribute;
|
||||||
|
|||||||
@@ -2,17 +2,42 @@
|
|||||||
|
|
||||||
namespace HopFrame.Web.Plugins.Events;
|
namespace HopFrame.Web.Plugins.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised before an entry should be deleted
|
||||||
|
/// </summary>
|
||||||
public sealed class DeleteEntryEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
public sealed class DeleteEntryEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// The entry that is about to be deleted
|
||||||
|
/// </summary>
|
||||||
public required object Entity { get; init; }
|
public required object Entity { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised before a new entry gets saved to the dataset
|
||||||
|
/// </summary>
|
||||||
public sealed class CreateEntryEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender);
|
public sealed class CreateEntryEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised before any changes are saved to the dataset
|
||||||
|
/// </summary>
|
||||||
public sealed class UpdateEntryEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
public sealed class UpdateEntryEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// The entry that is about to be updated
|
||||||
|
/// </summary>
|
||||||
public required object Entity { get; init; }
|
public required object Entity { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when an entity is selected or deselected in the relation picker dialog
|
||||||
|
/// </summary>
|
||||||
public sealed class SelectEntryEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
public sealed class SelectEntryEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// The entry that is being selected
|
||||||
|
/// </summary>
|
||||||
public required object Entity { get; init; }
|
public required object Entity { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the entry is selected (true) or deselected (false)
|
||||||
|
/// </summary>
|
||||||
public required bool Selected { get; set; }
|
public required bool Selected { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,24 +4,47 @@ using HopFrame.Web.Components.Pages;
|
|||||||
|
|
||||||
namespace HopFrame.Web.Plugins.Events;
|
namespace HopFrame.Web.Plugins.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The base event with parameters for every event
|
||||||
|
/// </summary>
|
||||||
public abstract class HopFrameEventArgs(object internalSender) {
|
public abstract class HopFrameEventArgs(object internalSender) {
|
||||||
internal object InternalSender { get; } = internalSender;
|
internal object InternalSender { get; } = internalSender;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the event got canceled by any event handler
|
||||||
|
/// </summary>
|
||||||
public bool IsCanceled { get; protected set; }
|
public bool IsCanceled { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if the action that is about to be executed should be canceled
|
||||||
|
/// </summary>
|
||||||
public void SetCancelled(bool canceled) => IsCanceled = canceled;
|
public void SetCancelled(bool canceled) => IsCanceled = canceled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public abstract class HopFrameEventArgs<TSender>(TSender sender) : HopFrameEventArgs(sender) where TSender : class {
|
public abstract class HopFrameEventArgs<TSender>(TSender sender) : HopFrameEventArgs(sender) where TSender : class {
|
||||||
|
/// <summary>
|
||||||
|
/// The element that raised the event
|
||||||
|
/// </summary>
|
||||||
public TSender Sender => (TSender)InternalSender;
|
public TSender Sender => (TSender)InternalSender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class HopFrameTablePageEventArgs(HopFrameTablePage sender)
|
/// <summary>
|
||||||
: HopFrameEventArgs<HopFrameTablePage>(sender) {
|
/// The base event with parameters for every event raised by a <see cref="HopFrameTablePage"/>
|
||||||
|
/// </summary>
|
||||||
|
public abstract class HopFrameTablePageEventArgs(HopFrameTablePage sender) : HopFrameEventArgs<HopFrameTablePage>(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// The configuration of the table page that raised the event
|
||||||
|
/// </summary>
|
||||||
public required TableConfig Table { get; init; }
|
public required TableConfig Table { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class HopFrameEditorEventArgs(HopFrameEditor sender)
|
/// <summary>
|
||||||
: HopFrameEventArgs<HopFrameEditor>(sender) {
|
/// The base event with parameters for every event raised by a <see cref="HopFrameEditor"/>
|
||||||
|
/// </summary>
|
||||||
|
public abstract class HopFrameEditorEventArgs(HopFrameEditor sender) : HopFrameEventArgs<HopFrameEditor>(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// The configuration of the parent table of the editor that raised the event
|
||||||
|
/// </summary>
|
||||||
public required TableConfig Table { get; init; }
|
public required TableConfig Table { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,22 @@
|
|||||||
|
|
||||||
namespace HopFrame.Web.Plugins.Events;
|
namespace HopFrame.Web.Plugins.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when the user is about to change the page he is currently on
|
||||||
|
/// </summary>
|
||||||
public sealed class PageChangeEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
public sealed class PageChangeEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// The page he is currently on
|
||||||
|
/// </summary>
|
||||||
public required int CurrentPage { get; init; }
|
public required int CurrentPage { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total number of pages his table can currently display
|
||||||
|
/// </summary>
|
||||||
public required int TotalPages { get; init; }
|
public required int TotalPages { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The new page he tries to access
|
||||||
|
/// </summary>
|
||||||
public required int NewPage { get; set; }
|
public required int NewPage { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace HopFrame.Web.Plugins.Events;
|
namespace HopFrame.Web.Plugins.Events;
|
||||||
|
|
||||||
public sealed class ReloadEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
/// <summary>
|
||||||
|
/// Raised before the table is about to reload its data
|
||||||
}
|
/// </summary>
|
||||||
|
public sealed class ReloadEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender);
|
||||||
@@ -3,9 +3,21 @@ using HopFrame.Web.Components.Pages;
|
|||||||
|
|
||||||
namespace HopFrame.Web.Plugins.Events;
|
namespace HopFrame.Web.Plugins.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised before the search results are loaded
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
public sealed class SearchEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
public sealed class SearchEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// The search term the user entered
|
||||||
|
/// </summary>
|
||||||
public required string SearchTerm { get; set; }
|
public required string SearchTerm { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The page the user is currently on
|
||||||
|
/// </summary>
|
||||||
public required int CurrentPage { get; init; }
|
public required int CurrentPage { get; init; }
|
||||||
|
|
||||||
internal IEnumerable<object>? SearchResult { get; set; }
|
internal IEnumerable<object>? SearchResult { get; set; }
|
||||||
internal int TotalPages { get; set; }
|
internal int TotalPages { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,28 @@ using Microsoft.FluentUI.AspNetCore.Components;
|
|||||||
|
|
||||||
namespace HopFrame.Web.Plugins.Events;
|
namespace HopFrame.Web.Plugins.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when a table is initialized
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// List of all buttons added by the plugins
|
||||||
|
/// </summary>
|
||||||
public List<PluginButton> PluginButtons { get; } = new();
|
public List<PluginButton> PluginButtons { get; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles for the native buttons on the page
|
||||||
|
/// </summary>
|
||||||
public DefaultButtonToggles DefaultButtons { get; set; } = new();
|
public DefaultButtonToggles DefaultButtons { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a custom button to the top bar of the page
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title">The text displayed on the button</param>
|
||||||
|
/// <param name="callback">The function that is invoked when the button is pressed</param>
|
||||||
|
/// <param name="pushRight">Determines if the button should be displayed on the right</param>
|
||||||
|
/// <param name="icon">Optional: The icon displayed next to the title</param>
|
||||||
public void AddPageButton(string title, Func<Task> callback, bool pushRight = false, IconInfo? icon = null) {
|
public void AddPageButton(string title, Func<Task> callback, bool pushRight = false, IconInfo? icon = null) {
|
||||||
PluginButtons.Add(new() {
|
PluginButtons.Add(new() {
|
||||||
Title = title,
|
Title = title,
|
||||||
@@ -16,7 +34,8 @@ public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePage
|
|||||||
Handler = (_, _) => callback.Invoke()
|
Handler = (_, _) => callback.Invoke()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="AddPageButton(string,System.Func{System.Threading.Tasks.Task},bool,Microsoft.FluentUI.AspNetCore.Components.IconInfo?)"/>
|
||||||
public void AddPageButton(string title, Action callback, bool pushRight = false, IconInfo? icon = null) {
|
public void AddPageButton(string title, Action callback, bool pushRight = false, IconInfo? icon = null) {
|
||||||
AddPageButton(title, () => {
|
AddPageButton(title, () => {
|
||||||
callback.Invoke();
|
callback.Invoke();
|
||||||
@@ -24,6 +43,11 @@ public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePage
|
|||||||
}, pushRight, icon);
|
}, pushRight, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a custom button to the Actions column next to every entry
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="icon">The icon displayed in the button</param>
|
||||||
|
/// <param name="callback">The function that is invoked when the button is pressed</param>
|
||||||
public void AddEntityButton(IconInfo icon, Func<object, TableConfig, Task> callback) {
|
public void AddEntityButton(IconInfo icon, Func<object, TableConfig, Task> callback) {
|
||||||
PluginButtons.Add(new() {
|
PluginButtons.Add(new() {
|
||||||
Icon = icon,
|
Icon = icon,
|
||||||
@@ -32,6 +56,7 @@ public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePage
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="AddEntityButton(IconInfo,System.Func{object,TableConfig,System.Threading.Tasks.Task})"/>
|
||||||
public void AddEntityButton(IconInfo icon, Action<object, TableConfig> callback) {
|
public void AddEntityButton(IconInfo icon, Action<object, TableConfig> callback) {
|
||||||
AddEntityButton(icon, (obj, cfg) => {
|
AddEntityButton(icon, (obj, cfg) => {
|
||||||
callback.Invoke(obj, cfg);
|
callback.Invoke(obj, cfg);
|
||||||
@@ -39,6 +64,8 @@ public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePage
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <typeparam name="TEntity">The entity type of the table that should display this button</typeparam>
|
||||||
|
/// <inheritdoc cref="AddEntityButton(IconInfo,System.Func{object,TableConfig,System.Threading.Tasks.Task})"/>
|
||||||
public void AddEntityButton<TEntity>(IconInfo icon, Func<TEntity, TableConfig, Task> callback) {
|
public void AddEntityButton<TEntity>(IconInfo icon, Func<TEntity, TableConfig, Task> callback) {
|
||||||
PluginButtons.Add(new() {
|
PluginButtons.Add(new() {
|
||||||
Icon = icon,
|
Icon = icon,
|
||||||
@@ -48,6 +75,8 @@ public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePage
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <typeparam name="TEntity">The entity type of the table that should display this button</typeparam>
|
||||||
|
/// <inheritdoc cref="AddEntityButton(IconInfo,System.Func{object,TableConfig,System.Threading.Tasks.Task})"/>
|
||||||
public void AddEntityButton<TEntity>(IconInfo icon, Action<TEntity, TableConfig> callback) {
|
public void AddEntityButton<TEntity>(IconInfo icon, Action<TEntity, TableConfig> callback) {
|
||||||
AddEntityButton<TEntity>(icon, (obj, cfg) => {
|
AddEntityButton<TEntity>(icon, (obj, cfg) => {
|
||||||
callback.Invoke(obj, cfg);
|
callback.Invoke(obj, cfg);
|
||||||
@@ -55,6 +84,8 @@ public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePage
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <typeparam name="TEntity">The entity type of the table that should display this button</typeparam>
|
||||||
|
/// <inheritdoc cref="AddPageButton(string,System.Func{System.Threading.Tasks.Task},bool,Microsoft.FluentUI.AspNetCore.Components.IconInfo?)"/>
|
||||||
public void AddPageButton<TEntity>(string title, Func<Task> callback, bool pushRight = false, IconInfo? icon = null) {
|
public void AddPageButton<TEntity>(string title, Func<Task> callback, bool pushRight = false, IconInfo? icon = null) {
|
||||||
PluginButtons.Add(new() {
|
PluginButtons.Add(new() {
|
||||||
Title = title,
|
Title = title,
|
||||||
@@ -65,6 +96,8 @@ public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePage
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <typeparam name="TEntity">The entity type of the table that should display this button</typeparam>
|
||||||
|
/// <inheritdoc cref="AddPageButton(string,System.Func{System.Threading.Tasks.Task},bool,Microsoft.FluentUI.AspNetCore.Components.IconInfo?)"/>
|
||||||
public void AddPageButton<TEntity>(string title, Action callback, bool pushRight = false, IconInfo? icon = null) {
|
public void AddPageButton<TEntity>(string title, Action callback, bool pushRight = false, IconInfo? icon = null) {
|
||||||
AddPageButton<TEntity>(title, () => {
|
AddPageButton<TEntity>(title, () => {
|
||||||
callback.Invoke();
|
callback.Invoke();
|
||||||
@@ -73,11 +106,33 @@ public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A wrapper object containing all information about a custom button
|
||||||
|
/// </summary>
|
||||||
public struct PluginButton {
|
public struct PluginButton {
|
||||||
|
/// <summary>
|
||||||
|
/// The position of the button
|
||||||
|
/// </summary>
|
||||||
public PluginButtonPosition Position { get; set; }
|
public PluginButtonPosition Position { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The function that is invoked when the button is pressed
|
||||||
|
/// </summary>
|
||||||
public Func<object, TableConfig, Task> Handler { get; set; }
|
public Func<object, TableConfig, Task> Handler { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The text on the button if supported
|
||||||
|
/// </summary>
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The icon displayed on the button
|
||||||
|
/// </summary>
|
||||||
public IconInfo? Icon { get; set; }
|
public IconInfo? Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity type of the table that should display this button
|
||||||
|
/// </summary>
|
||||||
public Type? TableFilter { get; set; }
|
public Type? TableFilter { get; set; }
|
||||||
|
|
||||||
internal bool IsForTable(TableConfig? config) {
|
internal bool IsForTable(TableConfig? config) {
|
||||||
@@ -87,12 +142,18 @@ public struct PluginButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All available positions for a custom button
|
||||||
|
/// </summary>
|
||||||
public enum PluginButtonPosition {
|
public enum PluginButtonPosition {
|
||||||
TopLeft = 0,
|
TopLeft = 0,
|
||||||
TopRight = 1,
|
TopRight = 1,
|
||||||
OnEntry = 2
|
OnEntry = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles for the native buttons on the page
|
||||||
|
/// </summary>
|
||||||
public struct DefaultButtonToggles() {
|
public struct DefaultButtonToggles() {
|
||||||
public bool ShowRefreshButton { get; set; } = true;
|
public bool ShowRefreshButton { get; set; } = true;
|
||||||
public bool ShowAddEntityButton { get; set; } = true;
|
public bool ShowAddEntityButton { get; set; } = true;
|
||||||
|
|||||||
@@ -3,7 +3,17 @@ using HopFrame.Web.Components.Dialogs;
|
|||||||
|
|
||||||
namespace HopFrame.Web.Plugins.Events;
|
namespace HopFrame.Web.Plugins.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when a property in the editor is validated
|
||||||
|
/// </summary>
|
||||||
public sealed class ValidationEvent(HopFrameEditor sender) : HopFrameEditorEventArgs(sender) {
|
public sealed class ValidationEvent(HopFrameEditor sender) : HopFrameEditorEventArgs(sender) {
|
||||||
|
/// <summary>
|
||||||
|
/// All errors found by the validators. Can be modified to display more (or less) errors
|
||||||
|
/// </summary>
|
||||||
public required IList<string> Errors { get; init; }
|
public required IList<string> Errors { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The property that is validated
|
||||||
|
/// </summary>
|
||||||
public required PropertyConfig Property { get; init; }
|
public required PropertyConfig Property { get; init; }
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ public static class ServiceCollectionExtensions {
|
|||||||
/// Adds the HopFrame admin ui endpoints
|
/// Adds the HopFrame admin ui endpoints
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="AddHopFramePages"/>
|
/// <seealso cref="AddHopFramePages"/>
|
||||||
[Obsolete($"Use '{nameof(AddHopFramePages)}' instead")]
|
[Obsolete($"Use {nameof(AddHopFramePages)} instead")]
|
||||||
public static RazorComponentsEndpointConventionBuilder MapHopFramePages(this RazorComponentsEndpointConventionBuilder builder) {
|
public static RazorComponentsEndpointConventionBuilder MapHopFramePages(this RazorComponentsEndpointConventionBuilder builder) {
|
||||||
return AddHopFramePages(builder);
|
return AddHopFramePages(builder);
|
||||||
}
|
}
|
||||||
@@ -74,6 +74,9 @@ public static class ServiceCollectionExtensions {
|
|||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the HopFrame admin ui endpoints
|
||||||
|
/// </summary>
|
||||||
public static WebApplication MapHopFrame(this WebApplication app) {
|
public static WebApplication MapHopFrame(this WebApplication app) {
|
||||||
app.UseAntiforgery();
|
app.UseAntiforgery();
|
||||||
app.MapStaticAssets();
|
app.MapStaticAssets();
|
||||||
|
|||||||
@@ -2,10 +2,26 @@
|
|||||||
|
|
||||||
namespace HopFrame.Web.Services;
|
namespace HopFrame.Web.Services;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Accessor for the advanced search suggestion feature
|
||||||
|
/// </summary>
|
||||||
public interface ISearchSuggestionProvider {
|
public interface ISearchSuggestionProvider {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates a list of search suggestions based on the current search term
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="table">The current table for context</param>
|
||||||
|
/// <param name="searchText">The partial input by the user</param>
|
||||||
|
/// <returns></returns>
|
||||||
public IEnumerable<string> GenerateSearchSuggestions(TableConfig table, string searchText);
|
public IEnumerable<string> GenerateSearchSuggestions(TableConfig table, string searchText);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates the new search term by appending the generated text of the selected suggestion
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="table">The current table for context</param>
|
||||||
|
/// <param name="searchText">The partial input by the user</param>
|
||||||
|
/// <param name="selectedSuggestion">The suggestion that was selected</param>
|
||||||
|
/// <returns></returns>
|
||||||
public string CompleteSearchSuggestion(TableConfig table, string searchText, string selectedSuggestion);
|
public string CompleteSearchSuggestion(TableConfig table, string searchText, string selectedSuggestion);
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user