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

View File

@ -44,15 +44,4 @@ internal sealed class AssistantSwitch : AssistantComponentBase
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(
required: ["Name", "Label", "LabelOn", "LabelOff", "Value"],
optional: ["UserPrompt", "Class", "Style"]
optional: ["UserPrompt"]
),
[AssistantComponentType.HEADING] = new(
required: ["Text", "Level"],