当前位置: 首页>>代码示例>>Scala>>正文


Scala ReactNode类代码示例

本文整理汇总了Scala中japgolly.scalajs.react.ReactNode的典型用法代码示例。如果您正苦于以下问题:Scala ReactNode类的具体用法?Scala ReactNode怎么用?Scala ReactNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ReactNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: formData

//设置package包名称以及导入依赖的类
package postgresweb.components.base

import io.circe._
import io.circe.generic.auto._
import io.circe.parser._
import io.circe.syntax._
import io.circe.scalajs._
import japgolly.scalajs.react.{React, ReactComponentU_, ReactElement, ReactNode}
import postgresweb.models.{JSONSchemaUI, JSONSchema}

import scala.scalajs._



@js.native
trait SchemaFormState extends js.Object{
  def formData: js.Any
}


case class SchemaFormNative(
                             schema:String,
                             uiSchema:Option[JSONSchemaUI] = None,
                             formData:Option[js.Any] = None,
                             onChange:Option[() => Unit] = None,
                             onError:Option[() => Unit] = None,
                             onSubmit:Option[SchemaFormState => Unit] = None,
                             schemaField:Option[() => Unit] = None,
                             titleField:Option[() => Unit] = None
  )  {



   def apply(childs: ReactNode*) = {

    val p = js.Dynamic.literal()
      p.updateDynamic("schema")(js.JSON.parse(schema)) //fix to avoid undefined fields
      uiSchema.foreach(ui => p.updateDynamic("uiSchema")(ui.asJsAny))
      formData.foreach(fd => p.updateDynamic("formData")(fd))
      onChange.foreach(oc => p.updateDynamic("onChange")(oc))
      onError.foreach(oe => p.updateDynamic("onError")(oe))
      onSubmit.foreach(os => p.updateDynamic("onSubmit")(os))
      schemaField.foreach(sf => p.updateDynamic("SchemaField")(sf))
      titleField.foreach(tf => p.updateDynamic("TitleField")(tf))


     js.Dynamic.global.console.log(p)


      val component = React.asInstanceOf[js.Dynamic].createElement(js.Dynamic.global.JSONSchemaForm,p,childs.toJsArray)
      js.Dynamic.global.console.log(component)
      component.asInstanceOf[ReactComponentU_]
    }
  } 
开发者ID:minettiandrea,项目名称:postgres-web,代码行数:55,代码来源:SchemaFormNative.scala

示例2: AceEditor

//设置package包名称以及导入依赖的类
package spatutorial.client.components

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}
import macros.JSMacro

import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
import scala.scalajs.js.{UndefOr, _}

@js.native
@JSName("ReactAce")
object AceEditor extends js.Object

case class AceEditorGenerated(mode : UndefOr[String] = undefined,
                              theme : UndefOr[String] = undefined,
                              name : UndefOr[String] = undefined,
                              height : UndefOr[String] = undefined,
                              fontSize: UndefOr[Int] = undefined,
                              value: UndefOr[String] = undefined
                             ) {
  def toJS = {
    val p = js.Dynamic.literal()
    mode.foreach(v => p.updateDynamic("mode")(v))
    theme.foreach(v => p.updateDynamic("theme")(v))
    name.foreach(v => p.updateDynamic("name")(v))
    height.foreach(v => p.updateDynamic("height")(v))
    fontSize.foreach(v => p.updateDynamic("fontSize")(v))
    value.foreach(v => p.updateDynamic("value")(v))
    p
  }

  def apply(children: js.UndefOr[ReactNode] = js.undefined) = {

    val props = JSMacro[AceEditorGenerated](this)
    val f = React.asInstanceOf[js.Dynamic].createFactory(AceEditor)
    f(props, children).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:wrotki,项目名称:spacommander,代码行数:39,代码来源:AceEditorGenerated.scala

示例3: propOne

//设置package包名称以及导入依赖的类
package spatutorial.client.components

import japgolly.scalajs.react.vdom.prefix_<^.<
import japgolly.scalajs.react.{BackendScope, Callback, JsComponentM, JsComponentType, JsComponentU, ReactComponentB, ReactComponentU_, ReactNode}
import org.scalajs.dom.raw.HTMLElement

import scala.scalajs.js
import scala.scalajs.js._
import scala.scalajs.js.annotation.JSName

@js.native
trait SampleReactComponentProps extends js.Object {
  def propOne: String = js.native
  def propRwo: String = js.native
}

@js.native
@JSName("SampleReactComponent")
class SampleReactComponent(props: SampleReactComponentProps) extends JsComponentU[SampleReactComponentProps, js.Object, HTMLElement]

object SampleReactComponentProps {
  def apply(propOne: String,
            propTwo: String): SampleReactComponentProps = {
    js.Dynamic.literal(
      propOne = propOne,
      propYwo = propTwo
    ).asInstanceOf[SampleReactComponentProps]
  }
}

object SampleReactComponent {

  //  ,^.style("width: 500; height: 500")
  val component = ReactComponentB[SampleReactComponentProps]("SampleReactComponent")
    .render_P(p => new SampleReactComponent(p))
    .build

  //  val component = ReactComponentB[AceProps]("AceEditor")
  //    //.render(p => new AceEditor(p))
  //    .render_P(p => new AceEditor(p))
  //    .build

  def apply(props: SampleReactComponentProps, children: ReactNode*) = component(props, children: _*)

  def apply() = component

} 
开发者ID:wrotki,项目名称:spacommander,代码行数:48,代码来源:SampleReactComponent.scala

示例4: Switch

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object, |}


case class Switch(checked: js.UndefOr[Boolean] = js.undefined,
                  defaultChecked: js.UndefOr[Boolean] = js.undefined,
                  onChange: js.UndefOr[(Boolean) => CallbackTo[Unit]] = js.undefined,
                  checkedChildren: js.UndefOr[String | ReactNode] = js.undefined,
                  unCheckedChildren: js.UndefOr[String | ReactNode] = js.undefined,
                  size: js.UndefOr[Switch.Size] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    checked.foreach { x =>
      p.updateDynamic("checked")(x)
    }
    defaultChecked.foreach { x =>
      p.updateDynamic("defaultChecked")(x)
    }
    onChange.foreach { x =>
      p.updateDynamic("onChange")(
        (v1: Boolean) => x(v1).runNow()
      )
    }
    checkedChildren.foreach { x =>
      p.updateDynamic("checkedChildren")(x.asInstanceOf[js.Any])
    }
    unCheckedChildren.foreach { x =>
      p.updateDynamic("unCheckedChildren")(x.asInstanceOf[js.Any])
    }
    size.foreach { x =>
      p.updateDynamic("size")(x.id)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Switch)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
}

object Switch {
  sealed abstract class Size(val id: String)

  object Size {
    case object Default extends Size("default")
    case object Small   extends Size("small")
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:55,代码来源:Switch.scala

示例5: Item

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js.{Dynamic, Object, |}
import scala.scalajs.js


  case class Item(color: js.UndefOr[String] = js.undefined, dot: js.UndefOr[String | ReactNode] = js.undefined) {
    def toJS: Object with Dynamic = {
      val p = js.Dynamic.literal()
      color.foreach { x =>
        p.updateDynamic("color")(x)
      }
      dot.foreach { x =>
        p.updateDynamic("dot")(x.asInstanceOf[js.Any])
      }
      p
    }

    def apply(children: ReactNode*): ReactComponentU_ = {
      val f =
        React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Timeline.Item)
      f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
    }
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:28,代码来源:Timeline.scala

示例6: Affix

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Affix(offsetTop: js.UndefOr[Int] = js.undefined,
                 offsetBottom: js.UndefOr[Int] = js.undefined,
                 onChange: js.UndefOr[Boolean => CallbackTo[Unit]] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    offsetTop.foreach { x =>
      p.updateDynamic("offsetTop")(x)
    }
    offsetBottom.foreach { x =>
      p.updateDynamic("offsetBottom")(x)
    }
    onChange.foreach { x =>
      p.updateDynamic("onChange")(
        (v1: Boolean) => x(v1).runNow()
      )
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Affix)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:34,代码来源:Affix.scala

示例7: Rate

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Rate(count: js.UndefOr[Double] = js.undefined,
                value: js.UndefOr[Double] = js.undefined,
                defaultValue: js.UndefOr[Double] = js.undefined,
                onChange: js.UndefOr[Double => CallbackTo[Unit]] = js.undefined,
                allowHalf: js.UndefOr[Boolean] = js.undefined,
                disabled: js.UndefOr[Boolean] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    count.foreach { x =>
      p.updateDynamic("count")(x)
    }
    value.foreach { x =>
      p.updateDynamic("value")(x)
    }
    defaultValue.foreach { x =>
      p.updateDynamic("defaultValue")(x)
    }
    onChange.foreach { x =>
      p.updateDynamic("onChange")(
        (v1: Double) => x(v1).runNow()
      )
    }
    allowHalf.foreach { x =>
      p.updateDynamic("allowHalf")(x)
    }
    disabled.foreach { x =>
      p.updateDynamic("disabled")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Rate)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:46,代码来源:Rate.scala

示例8: Group

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}
import org.scalajs.dom.Event

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


  case class Group(onChange: js.UndefOr[Event => CallbackTo[Unit]] = js.undefined,
                   value: js.UndefOr[String] = js.undefined,
                   defaultValue: js.UndefOr[String] = js.undefined,
                   size: js.UndefOr[Size] = js.undefined) {
    def toJS: Object with Dynamic = {
      val p = js.Dynamic.literal()
      onChange.foreach { x =>
        p.updateDynamic("onChange")(
          (v1: Event) => x(v1).runNow()
        )
      }
      value.foreach { x =>
        p.updateDynamic("value")(x)
      }
      defaultValue.foreach { x =>
        p.updateDynamic("defaultValue")(x)
      }
      size.foreach { x =>
        p.updateDynamic("size")(x.id)
      }
      p
    }

    def apply(children: ReactNode*): ReactComponentU_ = {
      val f =
        React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Radio.Group)
      f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
    }
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:40,代码来源:Radio.scala

示例9: Badge

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Badge(count: js.UndefOr[Int] = js.undefined,
                 overflowCount: js.UndefOr[Int] = js.undefined,
                 dot: js.UndefOr[Boolean] = js.undefined,
                 status: js.UndefOr[Badge.Status] = js.undefined,
                 text: js.UndefOr[String] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    count.foreach { x =>
      p.updateDynamic("count")(x)
    }
    overflowCount.foreach { x =>
      p.updateDynamic("overflowCount")(x)
    }
    dot.foreach { x =>
      p.updateDynamic("dot")(x)
    }
    status.foreach { x =>
      p.updateDynamic("status")(x.id)
    }
    text.foreach { x =>
      p.updateDynamic("text")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Badge)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
}

object Badge {
  sealed abstract class Status(val id: String)

  object Status {
    case object Success    extends Status("success")
    case object Processing extends Status("processing")
    case object Default    extends Status("default")
    case object Error      extends Status("error")
    case object Warning    extends Status("warning")
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:52,代码来源:Badge.scala

示例10: Checkbox

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}
import org.scalajs.dom.Event

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Checkbox(checked: js.UndefOr[Boolean] = js.undefined,
                    defaultChecked: js.UndefOr[Boolean] = js.undefined,
                    onChange: js.UndefOr[(Event) => CallbackTo[Unit]] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    checked.foreach { x =>
      p.updateDynamic("checked")(x)
    }
    defaultChecked.foreach { x =>
      p.updateDynamic("defaultChecked")(x)
    }
    onChange.foreach { x =>
      p.updateDynamic("onChange")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Checkbox)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:33,代码来源:Checkbox.scala

示例11: Icon

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Icon(`type`: String, spin: js.UndefOr[Boolean] = js.undefined) {

  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    p.updateDynamic("type")(`type`)
    spin.foreach { x =>
      p.updateDynamic("spin")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Icon)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }

} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:27,代码来源:Icon.scala

示例12: Popover

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object, |}


case class Popover(title: js.UndefOr[String | ReactNode] = js.undefined,
                   content: js.UndefOr[String | ReactNode] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    title.foreach { x =>
      p.updateDynamic("title")(x.asInstanceOf[js.Any])
    }
    content.foreach { x =>
      p.updateDynamic("content")(x.asInstanceOf[js.Any])
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Popover)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:28,代码来源:Popover.scala

示例13: Col

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object, |}


case class Col(span: js.UndefOr[Double] = js.undefined,
               order: js.UndefOr[Double] = js.undefined,
               offset: js.UndefOr[Double] = js.undefined,
               push: js.UndefOr[Double] = js.undefined,
               pull: js.UndefOr[Double] = js.undefined,
               xs: js.UndefOr[Double | js.Dictionary[js.Any]] = js.undefined,
               sm: js.UndefOr[Double | js.Dictionary[js.Any]] = js.undefined,
               md: js.UndefOr[Double | js.Dictionary[js.Any]] = js.undefined,
               lg: js.UndefOr[Double | js.Dictionary[js.Any]] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    span.foreach { x =>
      p.updateDynamic("span")(x)
    }
    order.foreach { x =>
      p.updateDynamic("order")(x)
    }
    offset.foreach { x =>
      p.updateDynamic("offset")(x)
    }
    push.foreach { x =>
      p.updateDynamic("push")(x)
    }
    pull.foreach { x =>
      p.updateDynamic("pull")(x)
    }
    xs.foreach { x =>
      p.updateDynamic("xs")(x.asInstanceOf[js.Any])
    }
    sm.foreach { x =>
      p.updateDynamic("sm")(x.asInstanceOf[js.Any])
    }
    md.foreach { x =>
      p.updateDynamic("md")(x.asInstanceOf[js.Any])
    }
    lg.foreach { x =>
      p.updateDynamic("lg")(x.asInstanceOf[js.Any])
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Col)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:56,代码来源:Col.scala

示例14: Spin

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Spin(size: js.UndefOr[Size] = js.undefined,
                spinning: js.UndefOr[Boolean] = js.undefined,
                tip: js.UndefOr[String] = js.undefined,
                delay: js.UndefOr[Int] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    size.foreach { x =>
      p.updateDynamic("size")(x.id)
    }
    spinning.foreach { x =>
      p.updateDynamic("spinning")(x)
    }
    tip.foreach { x =>
      p.updateDynamic("tip")(x)
    }
    delay.foreach { x =>
      p.updateDynamic("delay")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Spin)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:36,代码来源:Spin.scala

示例15: Row

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Row(gutter: js.UndefOr[Double] = js.undefined,
               `type`: js.UndefOr[Row.Type] = js.undefined,
               align: js.UndefOr[Row.Align] = js.undefined,
               justify: js.UndefOr[Row.Justify] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    gutter.foreach { x =>
      p.updateDynamic("gutter")(x)
    }
    `type`.foreach { x =>
      p.updateDynamic("type")(x.id)
    }
    `align`.foreach { x =>
      p.updateDynamic("align")(x.id)
    }
    `justify`.foreach { x =>
      p.updateDynamic("justify")(x.id)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Row)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
}

object Row {
  sealed abstract class Type(val id: String)

  object Type {
    case object Flex extends Type("flex")
  }

  sealed abstract class Align(val id: String)

  object Align {
    case object Top    extends Align("top")
    case object Middle extends Align("middle")
    case object Bottom extends Align("bottom")
  }

  sealed abstract class Justify(val id: String)

  object Justify {
    case object Start        extends Justify("start")
    case object End          extends Justify("end")
    case object Center       extends Justify("center")
    case object SpaceAround  extends Justify("space-around")
    case object SpaceBetween extends Justify("space-between")
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:62,代码来源:Row.scala


注:本文中的japgolly.scalajs.react.ReactNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。