Skip to content

Commit

Permalink
feat(ui5-tooling-modules): adds support for mapped valueStateText
Browse files Browse the repository at this point in the history
  • Loading branch information
Thodd committed Nov 28, 2024
1 parent f1c8d03 commit bd366f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,14 @@ class RegistryEntry {
if (ui5metadata.properties["valueState"]) {
// there will not be an aggregation in UI5, but rather a string mapped property!
delete ui5metadata.aggregations["valueStateMessage"];
ui5metadata.properties["valueStateMessage"] = {
name: "valueStateMessage",
ui5metadata.properties["valueStateText"] = {
name: "valueStateText",
type: "string",
defaultValue: `""`,
mapping: {
type: "slot",
slotName: "valueStateMessage",
// "mapping.to" describes the result in the webc DOM
to: "div",
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
<VBox alignItems="Center" justifyContent="Center" height="100%">
<webc:Label text="The Input's valueStateMessage is mapped from 'valueStateMessage' property to a slot." />
<webc:Label text="The 'valueState' property's type is 'sap.ui.core.ValueState', which is automatically mapped to the correct web component values." />
<webc:Input placeholder="infos in valueStateMessage" valueState="Information" valueStateMessage="This is an info message. Extra long text used as an info message.">
<webc:Input placeholder="infos in valueStateMessage" valueState="Information" valueStateText="This is an info message. Extra long text used as an info message.">
<!-- TODO: Why do SuggestionItems not have the '@ui5/webcomponents.IInputSuggestionItem' interface? -->
<!-- TODO: Setting showSuggestions="true" leads to a strange error about "i18n" packages...? -->
<!--<webc:SuggestionItem text="Cozy" />
<webc:SuggestionItem text="Compact" />
<webc:SuggestionItem text="Condensed" />-->
</webc:Input>
<webc:Input placeholder="Warning! Here be dragons!" valueState="Warning" valueStateMessage="This is an warning message. Dragons are super dangerous." />
<webc:Input placeholder="HUGE success! 🎉" valueState="Success" valueStateMessage="This is invisible, since success does not show a special message." />
<webc:Input placeholder="Oh no. Something is wrong!" valueState="Error" valueStateMessage="This is an error message. Please fix your input, it does not compute." />
<webc:Input placeholder="Warning! Here be dragons!" valueState="Warning" valueStateText="This is an warning message. Dragons are super dangerous." />
<webc:Input placeholder="HUGE success! 🎉" valueState="Success" valueStateText="This is invisible, since success does not show a special message." />
<webc:Input placeholder="Oh no. Something is wrong!" valueState="Error" valueStateText="This is an error message. Please fix your input, it does not compute." />
<webc:Input placeholder="No valueState here." valueState="None" valueStateText="Nothing to be done." />
</VBox>
</webc:Panel>
</content>
Expand Down

0 comments on commit bd366f4

Please sign in to comment.