Scala lib for generating javascript widgets
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ace/src/main/scala/scaladget/ace
bootstrapnative/src/main/scala/scaladget/bootstrapnative
bootstrapslider/src/main/scala/scaladget/bootstrapslider
demo/src/main
lunr/src/main/scala/scaladget/lunr
project
svg/src/main/scala/scaladget/svg
tools/src/main/scala/scaladget/tools
.gitignore
LICENSE
README.md
build.sbt
version.sbt

README.md

scaladget

Scaladget provides a scala facades of some famous javascript libraries. It relies on the scala-js project. Among them:

Usage

Just add this to your dependencies:

  libraryDependencies += "fr.iscpif.scaladget" %%% "bootstrapnative" % scaladgetVersion
  libraryDependencies += "fr.iscpif.scaladget" %%% "ace" % scaladgetVersion
  libraryDependencies += "fr.iscpif.scaladget" %%% "bootstrapslider" % scaladgetVersion
  libraryDependencies += "fr.iscpif.scaladget" %%% "lunr" % scaladgetVersion

Current version : 1.0.2

All the facades are intensively used in the OpenMOLE project.

Bootstrap-native library

Demo

The boostrap-native facade (based on https://thednp.github.io/bootstrap.native/) renders transparent the use of buttons, forms, modals, tables, collapsers, selectors etc...

Imports:

import scaladget.bootstrapnative.bsn._

Here is an example of bootstrap modal dialog creation in full scala:

    import scalatags.JsDom.tags
    
    // Create the Modal dialog
    val modalDialog: ModalDialog =
      ModalDialog(
        onopen = ()=> println("OPEN"),
        onclose = ()=> println("CLOSE")
      )

    // Append header, body, footer elements
    modalDialog header div("Header")
    modalDialog footer buttonGroup()(
      ModalDialog.closeButton(modalDialog, btn_info, "OK"),
      ModalDialog.closeButton(modalDialog, btn_default, "Cancel")
    )

    // Build the dialog and the modal dialog
    tags.span(
      modalDialog.dialog,
      button("Modal !", onclick := {() => modalDialog.show}, btn_primary, marginLeft := 5),
      tags.span(glyph_settings, paddingLeft := 5, pointer, onclick := {()=> modalDialog.show})

modal

And here an example for a dynamic collapser:

buttonIcon("Trigger !", btn_primary).expandOnclick(panel("My text in detail")(width := 400))

trigger

triggered

Find more examples on the: API Demo Here is an example of scaladget intensive use in the OpenMOLE project

Bootstrap-slider library

See rendering in the API Demo

bootstrapslider

SVG rendering

A SVG API for rendering typed path in SVG is provided. it is compatible with scalatags. See a simple example here

svg

An example using the scaladget SVG tool and reactive library scala.rx can be found in this demo. It reproduces this D3 flowchart.

flowchart