You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -743,6 +743,53 @@ These components automatically:
743
743
- Enable/disable based on update permissions
744
744
- Show/hide based on read permissions
745
745
746
+
#### PrivilegeForm Component
747
+
748
+
The `PrivilegeForm` component extends the standard `EditForm` to provide privilege-aware form functionality. It automatically cascades privilege form state to child components, allowing you to set default privilege settings at the form level while maintaining the ability for individual components to override specific values.
-**Cascading Defaults**: Set privilege parameters once at the form level instead of repeating them on every input
789
+
-**Flexible Overrides**: Individual components can override any of the cascaded values when needed
790
+
-**Standard EditForm**: Maintains all functionality of the base `EditForm` component including validation
791
+
-**Clean Markup**: Reduces repetitive code and makes forms easier to maintain
792
+
746
793
### PrivilegeInputText HTML Output Example
747
794
748
795
Below is an example of the `PrivilegeInputText` component and its corresponding HTML output for various states based on the `PrivilegeContext` results:
/// <item>If the privilege context is <c>null</c> (loading): <see cref="Loading"/> template is rendered.</item>
22
-
/// <item>If the privilege context is loaded and <see cref="Loaded"/> is specified: <see cref="Loaded"/> template is rendered.</item>
23
-
/// <item>If the privilege context is loaded and <see cref="Loaded"/> is not specified: <see cref="ChildContent"/> is rendered.</item>
22
+
/// <item><description>If the privilege context is <c>null</c> (loading): <see cref="Loading"/> template is rendered.</description></item>
23
+
/// <item><description>If the privilege context is loaded and <see cref="Loaded"/> is specified: <see cref="Loaded"/> template is rendered.</description></item>
24
+
/// <item><description>If the privilege context is loaded and <see cref="Loaded"/> is not specified: <see cref="ChildContent"/> is rendered.</description></item>
24
25
/// </list>
25
-
/// </para>
26
26
/// <para>
27
27
/// The component provides the loaded <see cref="PrivilegeContext"/> as a cascading value to all child components,
28
28
/// enabling privilege-aware components throughout the component tree.
@@ -102,16 +189,16 @@ public class PrivilegeContextView : ComponentBase
102
189
/// <remarks>
103
190
/// <para>
104
191
/// The rendering logic follows this precedence:
192
+
/// </para>
105
193
/// <list type="number">
106
-
/// <item>Wraps all content in a <see cref="CascadingValue{TValue}"/> with the current <see cref="PrivilegeContext"/>.</item>
107
-
/// <item>If <see cref="PrivilegeContext"/> is <c>null</c>: Renders <see cref="Loading"/> content.</item>
108
-
/// <item>If <see cref="PrivilegeContext"/> is loaded and <see cref="Loaded"/> is specified: Renders <see cref="Loaded"/> content.</item>
109
-
/// <item>If <see cref="PrivilegeContext"/> is loaded and <see cref="Loaded"/> is not specified: Renders <see cref="ChildContent"/>.</item>
194
+
/// <item><description>Wraps all content in a <see cref="CascadingValue{TValue}"/> with the current <see cref="PrivilegeContext"/>.</description></item>
195
+
/// <item><description>If <see cref="PrivilegeContext"/> is <c>null</c>: Renders <see cref="Loading"/> content.</description></item>
196
+
/// <item><description>If <see cref="PrivilegeContext"/> is loaded and <see cref="Loaded"/> is specified: Renders <see cref="Loaded"/> content.</description></item>
197
+
/// <item><description>If <see cref="PrivilegeContext"/> is loaded and <see cref="Loaded"/> is not specified: Renders <see cref="ChildContent"/>.</description></item>
110
198
/// </list>
111
-
/// </para>
112
199
/// <para>
113
200
/// The cascading value enables any child components that declare a <c>[CascadingParameter] PrivilegeContext</c>
114
-
/// to automatically receive the loaded privilege context.
201
+
/// to automatically receive the loaded privilege context without requiring explicit parameter passing.
/// A <see cref="RenderFragment"/> that renders the appropriate content based on whether the
142
245
/// <see cref="PrivilegeContext"/> is loaded and which templates are available.
143
246
/// </returns>
247
+
/// <remarks>
248
+
/// <para>
249
+
/// This method implements the content selection logic for the component:
250
+
/// </para>
251
+
/// <list type="bullet">
252
+
/// <item><description><strong>Loading state:</strong> When <see cref="PrivilegeContext"/> is <c>null</c>, renders the <see cref="Loading"/> template</description></item>
253
+
/// <item><description><strong>Loaded with explicit template:</strong> When <see cref="PrivilegeContext"/> is available and <see cref="Loaded"/> is specified, renders the <see cref="Loaded"/> template</description></item>
254
+
/// <item><description><strong>Loaded with default content:</strong> When <see cref="PrivilegeContext"/> is available and no <see cref="Loaded"/> template is specified, renders the <see cref="ChildContent"/></description></item>
255
+
/// </list>
256
+
/// <para>
257
+
/// The returned render fragment is executed within the context of the cascading value, ensuring that
258
+
/// all rendered content has access to the privilege context for authorization decisions.
0 commit comments