wrapped used internal components without Class and Style properties with divs to apply classes and style

This commit is contained in:
krut_ni 2026-02-24 17:44:04 +01:00
parent 6ad7aba58e
commit 9ae3fcaed9
No known key found for this signature in database
GPG Key ID: A5C0151B4DDB172C
3 changed files with 18 additions and 31 deletions

View File

@ -35,21 +35,21 @@
case AssistantComponentType.WEB_CONTENT_READER: case AssistantComponentType.WEB_CONTENT_READER:
if (component is AssistantWebContentReader webContent && this.webContentFields.TryGetValue(webContent.Name, out var webState)) if (component is AssistantWebContentReader webContent && this.webContentFields.TryGetValue(webContent.Name, out var webState))
{ {
<ReadWebContent @bind-Content="@webState.Content" <div class="@webContent.Class" style="@webContent.Style">
ProviderSettings="@this.providerSettings" <ReadWebContent @bind-Content="@webState.Content"
@bind-AgentIsRunning="@webState.AgentIsRunning" ProviderSettings="@this.providerSettings"
@bind-Preselect="@webState.Preselect" @bind-AgentIsRunning="@webState.AgentIsRunning"
@bind-PreselectContentCleanerAgent="@webState.PreselectContentCleanerAgent" @bind-Preselect="@webState.Preselect"
Class="@webContent.Class" @bind-PreselectContentCleanerAgent="@webState.PreselectContentCleanerAgent"/>
Style="@webContent.Style" /> </div>
} }
break; break;
case AssistantComponentType.FILE_CONTENT_READER: case AssistantComponentType.FILE_CONTENT_READER:
if (component is AssistantFileContentReader fileContent && this.fileContentFields.TryGetValue(fileContent.Name, out var fileState)) if (component is AssistantFileContentReader fileContent && this.fileContentFields.TryGetValue(fileContent.Name, out var fileState))
{ {
<ReadFileContent @bind-FileContent="@fileState.Content" <div class="@fileContent.Class" style="@fileContent.Style">
Class="@fileContent.Class" <ReadFileContent @bind-FileContent="@fileState.Content" />
Style="@fileContent.Style" /> </div>
} }
break; break;
@ -68,26 +68,24 @@
case AssistantComponentType.PROVIDER_SELECTION: case AssistantComponentType.PROVIDER_SELECTION:
if (component is AssistantProviderSelection providerSelection) if (component is AssistantProviderSelection providerSelection)
{ {
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider" <div class="@providerSelection.Class" style="@providerSelection.Class">
Class="@providerSelection.Class" <ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider" />
Style="@providerSelection.Style"/> </div>
} }
break; break;
case AssistantComponentType.PROFILE_SELECTION: case AssistantComponentType.PROFILE_SELECTION:
if (component is AssistantProfileSelection profileSelection) if (component is AssistantProfileSelection profileSelection)
{ {
var selection = profileSelection; var selection = profileSelection;
<ProfileFormSelection Validation="@((Profile profile) => this.ValidateProfileSelection(selection, profile))" @bind-Profile="@this.currentProfile" <div class="@selection.Class" style="@selection.Style">
Class="@selection.Class" <ProfileFormSelection Validation="@((Profile profile) => this.ValidateProfileSelection(selection, profile))" @bind-Profile="@this.currentProfile" />
Style="@selection.Style"/> </div>
} }
break; break;
case AssistantComponentType.SWITCH: case AssistantComponentType.SWITCH:
if (component is AssistantSwitch assistantSwitch) if (component is AssistantSwitch assistantSwitch)
{ {
<MudTextSwitch Label="@assistantSwitch.Label" @bind-Value="@this.switchFields[assistantSwitch.Name]" LabelOn="@assistantSwitch.LabelOn" LabelOff="@assistantSwitch.LabelOff" <MudTextSwitch Label="@assistantSwitch.Label" @bind-Value="@this.switchFields[assistantSwitch.Name]" LabelOn="@assistantSwitch.LabelOn" LabelOff="@assistantSwitch.LabelOff" />
Class="@assistantSwitch.Class"
Style="@this.GetOptionalStyle(assistantSwitch.Style)" />
} }
break; break;
case AssistantComponentType.HEADING: case AssistantComponentType.HEADING:

View File

@ -44,15 +44,4 @@ internal sealed class AssistantSwitch : AssistantComponentBase
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.LabelOff), value); set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.LabelOff), value);
} }
public string Class
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Class));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Class), value);
}
public string Style
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Style));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Style), value);
}
} }

View File

@ -31,7 +31,7 @@ public static class ComponentPropSpecs
), ),
[AssistantComponentType.SWITCH] = new( [AssistantComponentType.SWITCH] = new(
required: ["Name", "Label", "LabelOn", "LabelOff", "Value"], required: ["Name", "Label", "LabelOn", "LabelOff", "Value"],
optional: ["UserPrompt", "Class", "Style"] optional: ["UserPrompt"]
), ),
[AssistantComponentType.HEADING] = new( [AssistantComponentType.HEADING] = new(
required: ["Text", "Level"], required: ["Text", "Level"],