-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update password field rendering in UI5WidgetFactory
- Loading branch information
Showing
2 changed files
with
17 additions
and
16 deletions.
There are no files selected for viewing
19 changes: 3 additions & 16 deletions
19
examples/client/src/main/scala/samples/model/LoginPassword.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
package samples.model | ||
|
||
import dev.cheleb.scalamigen.Form | ||
import com.raquo.laminar.api.L.* | ||
import dev.cheleb.scalamigen.WidgetFactory | ||
|
||
import dev.cheleb.scalamigen.secretForm | ||
|
||
opaque type Password = String | ||
|
||
object Password: | ||
def apply(password: String): Password = password | ||
given Form[Password] with | ||
override def render( | ||
variable: Var[Password], | ||
syncParent: () => Unit, | ||
values: List[Password] = List.empty | ||
)(using factory: WidgetFactory): HtmlElement = | ||
factory.renderSecret | ||
.amend( | ||
value <-- variable.signal, | ||
onInput.mapToValue --> { v => | ||
variable.set(v) | ||
syncParent() | ||
} | ||
) | ||
given Form[Password] = secretForm(apply) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters