diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbb3faaf1..2020aeb6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,8 +35,7 @@ jobs: timeout-minutes: 60 steps: - name: Install sbt - if: contains(runner.os, 'macos') - run: brew install sbt + uses: sbt/setup-sbt@v1 - name: Checkout current branch (full) uses: actions/checkout@v4 @@ -103,8 +102,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Install sbt - if: contains(runner.os, 'macos') - run: brew install sbt + uses: sbt/setup-sbt@v1 - name: Checkout current branch (full) uses: actions/checkout@v4 diff --git a/.scalafmt-common.conf b/.scalafmt-common.conf index 0d8610d06..18e403eef 100644 --- a/.scalafmt-common.conf +++ b/.scalafmt-common.conf @@ -4,7 +4,7 @@ # this file by hand! Instead, if you wish to make changes, you should # make a PR to sbt-lucuma. -version = "3.8.0" +version = "3.8.3" style = default runner.dialect = scala3 diff --git a/beautiful-dnd-demo/src/main/scala/lucuma/react/beautifuldnd/demo/BeautifulDnDDemo.scala b/beautiful-dnd-demo/src/main/scala/lucuma/react/beautifuldnd/demo/BeautifulDnDDemo.scala index b90ecc895..4aadf4c7c 100644 --- a/beautiful-dnd-demo/src/main/scala/lucuma/react/beautifuldnd/demo/BeautifulDnDDemo.scala +++ b/beautiful-dnd-demo/src/main/scala/lucuma/react/beautifuldnd/demo/BeautifulDnDDemo.scala @@ -25,7 +25,7 @@ object BeautifulDnDDemo { final case class State(list: List[Item] = getItems(10)) implicit object CallbackMonoid extends Monoid[Callback] { - def empty: Callback = Callback.empty + def empty: Callback = Callback.empty def combine(x: Callback, y: Callback): Callback = x *> y } diff --git a/common/src/main/scala/lucuma/react/common/jsComponents.scala b/common/src/main/scala/lucuma/react/common/jsComponents.scala index 492fad7ec..09b47b00a 100644 --- a/common/src/main/scala/lucuma/react/common/jsComponents.scala +++ b/common/src/main/scala/lucuma/react/common/jsComponents.scala @@ -195,10 +195,10 @@ trait GenericJsComponentC[P <: js.Object, CT[-p, +u] <: CtorType[p, u], U, A] { newComponent: Js.Component[P, Null, CT] ): GenericJsComponentC[P, CT, U, A] = new GenericJsComponentC[P, CT, U, A] { - override protected def cprops: P = self.cprops - override val children = self.children + override protected def cprops: P = self.cprops + override val children = self.children override def withChildren(children: CtorType.ChildrenArgs): A = self.withChildren(children) - override protected val component = newComponent + override protected val component = newComponent } def withRef(ref: Ref.Handle[Js.RawMounted[P, Null]]): GenericJsComponentC[P, CT, U, A] = @@ -241,7 +241,7 @@ trait GenericJsComponentA[P <: js.Object, CT[-p, +u] <: CtorType[p, u], U, A] override protected def cprops: P = self.cprops override val modifiers: Seq[japgolly.scalajs.react.vdom.TagMod] = self.modifiers override protected val component = newComponent - override def addModifiers(modifiers: Seq[TagMod]): A = self.addModifiers(modifiers) + override def addModifiers(modifiers: Seq[TagMod]): A = self.addModifiers(modifiers) } def withRef(ref: Ref.Handle[Js.RawMounted[P, Null]]): GenericJsComponentA[P, CT, U, A] = @@ -287,7 +287,7 @@ trait GenericJsComponentAC[P <: js.Object, CT[-p, +u] <: CtorType[p, u], U, A] override protected def cprops: P = self.cprops override val modifiers: Seq[japgolly.scalajs.react.vdom.TagMod] = self.modifiers override protected val component = newComponent - override def addModifiers(modifiers: Seq[TagMod]): A = self.addModifiers(modifiers) + override def addModifiers(modifiers: Seq[TagMod]): A = self.addModifiers(modifiers) } def withRef(ref: Ref.Handle[Js.RawMounted[P, Null]]): GenericJsComponentAC[P, CT, U, A] = @@ -362,10 +362,10 @@ trait GenericJsComponentCF[P <: js.Object, CT[-p, +u] <: CtorType[p, u], U, A, F newComponent: Js.ComponentWithFacade[P, Null, F, CT] ): GenericJsComponentCF[P, CT, U, A, F] = new GenericJsComponentCF[P, CT, U, A, F] { - override protected def cprops: P = self.cprops - override val children = self.children + override protected def cprops: P = self.cprops + override val children = self.children override def withChildren(children: CtorType.ChildrenArgs): A = self.withChildren(children) - override protected val component = newComponent + override protected val component = newComponent } def withRef( @@ -400,7 +400,7 @@ trait GenericJsComponentAF[P <: js.Object, CT[-p, +u] <: CtorType[p, u], U, A, F override protected def cprops: P = self.cprops override val modifiers: Seq[japgolly.scalajs.react.vdom.TagMod] = self.modifiers override protected val component = newComponent - override def addModifiers(modifiers: Seq[TagMod]): A = self.addModifiers(modifiers) + override def addModifiers(modifiers: Seq[TagMod]): A = self.addModifiers(modifiers) } def withRef( @@ -438,7 +438,7 @@ trait GenericJsComponentACF[P <: js.Object, CT[-p, +u] <: CtorType[p, u], U, A, override protected def cprops: P = self.cprops override val modifiers: Seq[japgolly.scalajs.react.vdom.TagMod] = self.modifiers override protected val component = newComponent - override def addModifiers(modifiers: Seq[TagMod]): A = self.addModifiers(modifiers) + override def addModifiers(modifiers: Seq[TagMod]): A = self.addModifiers(modifiers) } def withRef( diff --git a/font-awesome/src/main/scala/lucuma/react/fa/CounterLayer.scala b/font-awesome/src/main/scala/lucuma/react/fa/CounterLayer.scala index 4f09e31fe..7eb6c1fe4 100644 --- a/font-awesome/src/main/scala/lucuma/react/fa/CounterLayer.scala +++ b/font-awesome/src/main/scala/lucuma/react/fa/CounterLayer.scala @@ -38,7 +38,7 @@ case class CounterLayer( ) extends ReactFnProps(CounterLayer.component) with IconProps: def apply(mods: TagMod*): CounterLayer = copy(modifiers = modifiers ++ mods) - override def faClasses: Css = super.faClasses // For some reason this is necessary (?!?!?) + override def faClasses: Css = super.faClasses // For some reason this is necessary (?!?!?) def addClass(value: Css) = copy(clazz = clazz |+| value) def withClass(value: Css) = copy(clazz = value) diff --git a/font-awesome/src/main/scala/lucuma/react/fa/FontAwesomeIcon.scala b/font-awesome/src/main/scala/lucuma/react/fa/FontAwesomeIcon.scala index b9c62b48a..3d317228e 100644 --- a/font-awesome/src/main/scala/lucuma/react/fa/FontAwesomeIcon.scala +++ b/font-awesome/src/main/scala/lucuma/react/fa/FontAwesomeIcon.scala @@ -42,7 +42,7 @@ case class FontAwesomeIcon( ) extends ReactFnProps(FontAwesomeIcon.component) with IconProps: def apply(mods: TagMod*): FontAwesomeIcon = copy(modifiers = modifiers ++ mods) - override def faClasses: Css = super.faClasses // For some reason this is necessary (?!?!?) + override def faClasses: Css = super.faClasses // For some reason this is necessary (?!?!?) def addClass(value: Css) = copy(clazz = clazz |+| value) def withClass(value: Css) = copy(clazz = value) diff --git a/font-awesome/src/main/scala/lucuma/react/fa/TextLayer.scala b/font-awesome/src/main/scala/lucuma/react/fa/TextLayer.scala index 27869224f..8a1e0cb51 100644 --- a/font-awesome/src/main/scala/lucuma/react/fa/TextLayer.scala +++ b/font-awesome/src/main/scala/lucuma/react/fa/TextLayer.scala @@ -40,7 +40,7 @@ case class TextLayer( ) extends ReactFnProps(TextLayer.component) with IconProps: def apply(mods: TagMod*): TextLayer = copy(modifiers = modifiers ++ mods) - override def faClasses: Css = super.faClasses // For some reason this is necessary (?!?!?) + override def faClasses: Css = super.faClasses // For some reason this is necessary (?!?!?) def addClass(value: Css) = copy(clazz = clazz |+| value) def withClass(value: Css) = copy(clazz = value) diff --git a/font-awesome/src/main/scala/lucuma/react/fa/facade.scala b/font-awesome/src/main/scala/lucuma/react/fa/facade.scala index 34c26e24b..670c5078d 100644 --- a/font-awesome/src/main/scala/lucuma/react/fa/facade.scala +++ b/font-awesome/src/main/scala/lucuma/react/fa/facade.scala @@ -176,8 +176,8 @@ trait Counter extends FontawesomeObject @js.native @JSImport("@fortawesome/fontawesome-svg-core", JSImport.Namespace) object FontAwesome extends js.Object: - def library: Library = js.native - def text(content: String, params: js.UndefOr[TextParams] = js.undefined): Text = js.native + def library: Library = js.native + def text(content: String, params: js.UndefOr[TextParams] = js.undefined): Text = js.native def counter( content: String | Float | Double | Int | Short | Byte, params: js.UndefOr[CounterParams] diff --git a/grid-layout/src/main/scala/lucuma/react/gridlayout/ReactGridLayout.scala b/grid-layout/src/main/scala/lucuma/react/gridlayout/ReactGridLayout.scala index 9e2dcbfe3..e767f130c 100644 --- a/grid-layout/src/main/scala/lucuma/react/gridlayout/ReactGridLayout.scala +++ b/grid-layout/src/main/scala/lucuma/react/gridlayout/ReactGridLayout.scala @@ -49,8 +49,8 @@ final case class ReactGridLayout( onDrop: DropCallback = (_, _, _) => Callback.empty, override val modifiers: Seq[TagMod] = Seq.empty ) extends GenericComponentPAC[ReactGridLayout.ReactGridLayoutProps, ReactGridLayout] { - override def cprops = ReactGridLayout.props(this) - override protected val component = ReactGridLayout.component + override def cprops = ReactGridLayout.props(this) + override protected val component = ReactGridLayout.component override def addModifiers(modifiers: Seq[TagMod]) = copy(modifiers = this.modifiers ++ modifiers) } diff --git a/grid-layout/src/main/scala/lucuma/react/gridlayout/ResponsiveReactGridLayout.scala b/grid-layout/src/main/scala/lucuma/react/gridlayout/ResponsiveReactGridLayout.scala index c44e72619..aa697e36c 100644 --- a/grid-layout/src/main/scala/lucuma/react/gridlayout/ResponsiveReactGridLayout.scala +++ b/grid-layout/src/main/scala/lucuma/react/gridlayout/ResponsiveReactGridLayout.scala @@ -54,8 +54,8 @@ final case class ResponsiveReactGridLayout( ResponsiveReactGridLayout.ResponsiveReactGridLayoutProps, ResponsiveReactGridLayout ] { - override def cprops = ResponsiveReactGridLayout.props(this) - override protected val component = ResponsiveReactGridLayout.component + override def cprops = ResponsiveReactGridLayout.props(this) + override protected val component = ResponsiveReactGridLayout.component override def addModifiers(modifiers: Seq[TagMod]) = copy(modifiers = this.modifiers ++ modifiers) } diff --git a/markdown/src/main/scala/lucuma/react/markdown/ReactMarkdown.scala b/markdown/src/main/scala/lucuma/react/markdown/ReactMarkdown.scala index 5b96676d0..5666c6b14 100644 --- a/markdown/src/main/scala/lucuma/react/markdown/ReactMarkdown.scala +++ b/markdown/src/main/scala/lucuma/react/markdown/ReactMarkdown.scala @@ -67,8 +67,8 @@ case class ReactMarkdown( rehypePlugins: js.UndefOr[List[RehypePlugin]] = js.undefined, override val modifiers: Seq[TagMod] = Seq.empty ) extends GenericFnComponentPA[ReactMarkdown.Props, ReactMarkdown] { - override protected def cprops = ReactMarkdown.props(this) - override protected val component = ReactMarkdown.component + override protected def cprops = ReactMarkdown.props(this) + override protected val component = ReactMarkdown.component override def addModifiers(modifiers: Seq[TagMod]) = copy(modifiers = this.modifiers ++ modifiers) } diff --git a/prime-react/src/main/scala/lucuma/react/primereact/AccordionTab.scala b/prime-react/src/main/scala/lucuma/react/primereact/AccordionTab.scala index f7d1fd3f4..0a49b2c2e 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/AccordionTab.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/AccordionTab.scala @@ -20,8 +20,8 @@ case class AccordionTab( contentClass: js.UndefOr[Css] = js.undefined, override val modifiers: Seq[TagMod] = Seq.empty ) extends GenericFnComponentPAC[AccordionTab.AccordionTabProps, AccordionTab] { - override protected def cprops = AccordionTab.props(this) - override protected val component = AccordionTab.component + override protected def cprops = AccordionTab.props(this) + override protected val component = AccordionTab.component override def addModifiers(modifiers: Seq[TagMod]) = copy(modifiers = this.modifiers ++ modifiers) def apply(mods: TagMod*) = addModifiers(mods) } diff --git a/prime-react/src/main/scala/lucuma/react/primereact/ConfirmDialog.scala b/prime-react/src/main/scala/lucuma/react/primereact/ConfirmDialog.scala index 7b37ac55d..16e752a33 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/ConfirmDialog.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/ConfirmDialog.scala @@ -46,32 +46,32 @@ object ConfirmDialog { accept: js.UndefOr[Callback] = js.undefined, reject: js.UndefOr[Callback] = js.undefined ): Callback = - Callback { - val props = ConfirmDialogProps() - message.foreach(v => props.setMessage(v.rawNode)) - icon.foreach(v => props.setIcon(v.toPrime)) - // header not in the ST facade - header.foreach(v => StObject.set(props, "header", v.rawNode)) - footer.foreach(v => props.setFooter(v.rawNode)) - acceptLabel.foreach(v => props.setAcceptLabel(v)) - rejectLabel.foreach(v => props.setRejectLabel(v)) - acceptIcon.foreach(v => props.setAcceptIcon(v.toPrime)) - rejectIcon.foreach(v => props.setRejectIcon(v.toPrime)) - acceptClass.foreach(v => props.setAcceptClassName(v.htmlClass)) - rejectClass.foreach(v => props.setRejectClassName(v.htmlClass)) - clazz.foreach(v => props.setClassName(v.htmlClass)) + Callback { + val props = ConfirmDialogProps() + message.foreach(v => props.setMessage(v.rawNode)) + icon.foreach(v => props.setIcon(v.toPrime)) + // header not in the ST facade + header.foreach(v => StObject.set(props, "header", v.rawNode)) + footer.foreach(v => props.setFooter(v.rawNode)) + acceptLabel.foreach(v => props.setAcceptLabel(v)) + rejectLabel.foreach(v => props.setRejectLabel(v)) + acceptIcon.foreach(v => props.setAcceptIcon(v.toPrime)) + rejectIcon.foreach(v => props.setRejectIcon(v.toPrime)) + acceptClass.foreach(v => props.setAcceptClassName(v.htmlClass)) + rejectClass.foreach(v => props.setRejectClassName(v.htmlClass)) + clazz.foreach(v => props.setClassName(v.htmlClass)) - // position not in the ST facade, either - position.foreach(v => StObject.set(props, "position", v.value)) - onHide.foreach(v => props.setOnHide(s => v(ConfirmDialogHideParm.fromString(s)))) - accept.foreach(v => props.setAccept(v)) - reject.foreach(v => props.setReject(v)) + // position not in the ST facade, either + position.foreach(v => StObject.set(props, "position", v.value)) + onHide.foreach(v => props.setOnHide(s => v(ConfirmDialogHideParm.fromString(s)))) + accept.foreach(v => props.setAccept(v)) + reject.foreach(v => props.setReject(v)) - rawConfirmDialog(props) - } - // In case this ever starts working as advertised, remove the Callback wrapper above - // and uncomment the line below. - // ConfirmDialogReturn(Callback(rawReturn.show()), Callback(rawReturn.hide())) + rawConfirmDialog(props) + } + // In case this ever starts working as advertised, remove the Callback wrapper above + // and uncomment the line below. + // ConfirmDialogReturn(Callback(rawReturn.show()), Callback(rawReturn.hide())) private val component = ScalaFnComponent[ConfirmDialog] { props => CConfirmDialog() diff --git a/prime-react/src/main/scala/lucuma/react/primereact/Messages.scala b/prime-react/src/main/scala/lucuma/react/primereact/Messages.scala index e7c7ae3cc..d92b1c65c 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/Messages.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/Messages.scala @@ -34,7 +34,7 @@ case class Messages( override protected val component = Messages.component override def addModifiers(modifiers: Seq[TagMod]): Messages = copy(modifiers = this.modifiers ++ modifiers) - def withMods(mods: TagMod*) = addModifiers(mods) + def withMods(mods: TagMod*) = addModifiers(mods) object Messages { @js.native @@ -46,7 +46,7 @@ object Messages { def show(message: js.Array[MessageItem]): Unit = js.native def replace(message: js.Array[MessageItem]): Unit = js.native def remove(message: MessageItem): Unit = js.native - def clear(): Unit = js.native + def clear(): Unit = js.native } @js.native diff --git a/prime-react/src/main/scala/lucuma/react/primereact/OverlayPanel.scala b/prime-react/src/main/scala/lucuma/react/primereact/OverlayPanel.scala index b7e541d4e..16fd4bf69 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/OverlayPanel.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/OverlayPanel.scala @@ -54,8 +54,8 @@ object OverlayPanel { @js.native trait Facade extends js.Object { - def show(event: ReactEvent): Unit = js.native - def hide: Unit = js.native + def show(event: ReactEvent): Unit = js.native + def hide: Unit = js.native def toggle(event: ReactEvent): Unit = js.native } diff --git a/prime-react/src/main/scala/lucuma/react/primereact/SelectButton.scala b/prime-react/src/main/scala/lucuma/react/primereact/SelectButton.scala index 799a5a7fe..5e55730d0 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/SelectButton.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/SelectButton.scala @@ -34,7 +34,7 @@ case class SelectButton[A]( def apply(mods: TagMod*) = addModifiers(mods) override def getter: js.UndefOr[Int] = optionsWithIndex.indexOfOption(value).orUndefined - override def valueFinder(i: Any): A = selectItemFinder(i).value + override def valueFinder(i: Any): A = selectItemFinder(i).value override val multiple: js.UndefOr[Boolean] = false override val unselectable: js.UndefOr[Boolean] = false diff --git a/prime-react/src/main/scala/lucuma/react/primereact/SelectItem.scala b/prime-react/src/main/scala/lucuma/react/primereact/SelectItem.scala index 74428cd8e..883d62fdb 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/SelectItem.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/SelectItem.scala @@ -34,7 +34,7 @@ object SelectItem { // We're using the index of the options for the CSelectValue so comparisons can // be made via Eq rather than let javascript do the comparisons. extension [A: Eq](options: List[(SelectItem[A], Int)]) - def indexOfOption(a: A): Option[Int] = options.find(_._1.value === a).map(_._2) + def indexOfOption(a: A): Option[Int] = options.find(_._1.value === a).map(_._2) def findByIndexOption(index: Int): Option[A] = findSelectItemByIndexOption(index).map(_.value) def findSelectItemByIndexOption(index: Int): Option[SelectItem[A]] = diff --git a/prime-react/src/main/scala/lucuma/react/primereact/SplitterPanel.scala b/prime-react/src/main/scala/lucuma/react/primereact/SplitterPanel.scala index 118caab9c..0fceaebf4 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/SplitterPanel.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/SplitterPanel.scala @@ -19,8 +19,8 @@ case class SplitterPanel( clazz: js.UndefOr[Css] = js.undefined, override val modifiers: Seq[TagMod] = Seq.empty ) extends GenericFnComponentPAC[SplitterPanel.SplitterPanelProps, SplitterPanel] { - override protected def cprops = SplitterPanel.props(this) - override protected val component = SplitterPanel.component + override protected def cprops = SplitterPanel.props(this) + override protected val component = SplitterPanel.component override def addModifiers(modifiers: Seq[TagMod]) = copy(modifiers = this.modifiers ++ modifiers) def apply(mods: TagMod*) = addModifiers(mods) } diff --git a/prime-react/src/main/scala/lucuma/react/primereact/TabPanel.scala b/prime-react/src/main/scala/lucuma/react/primereact/TabPanel.scala index ecf27df91..2d995a972 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/TabPanel.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/TabPanel.scala @@ -25,8 +25,8 @@ case class TabPanel( contentClass: js.UndefOr[Css] = js.undefined, override val modifiers: Seq[TagMod] = Seq.empty ) extends GenericFnComponentPAC[TabPanel.TabPanelProps, TabPanel] { - override protected def cprops = TabPanel.props(this) - override protected val component = TabPanel.component + override protected def cprops = TabPanel.props(this) + override protected val component = TabPanel.component override def addModifiers(modifiers: Seq[TagMod]) = copy(modifiers = this.modifiers ++ modifiers) def apply(mods: TagMod*) = addModifiers(mods) } diff --git a/prime-react/src/main/scala/lucuma/react/primereact/Toast.scala b/prime-react/src/main/scala/lucuma/react/primereact/Toast.scala index 2cccf81e4..cdc602302 100644 --- a/prime-react/src/main/scala/lucuma/react/primereact/Toast.scala +++ b/prime-react/src/main/scala/lucuma/react/primereact/Toast.scala @@ -59,7 +59,7 @@ object Toast { def show(message: js.Array[MessageItem]): Unit = js.native def replace(message: js.Array[MessageItem]): Unit = js.native def remove(message: MessageItem): Unit = js.native - def clear(): Unit = js.native + def clear(): Unit = js.native } @js.native diff --git a/project/plugins.sbt b/project/plugins.sbt index 5824948b5..dc5744f28 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -val sbtLucumaVersion = "0.12.1" +val sbtLucumaVersion = "0.12.1" addSbtPlugin("edu.gemini" % "sbt-lucuma-lib" % sbtLucumaVersion) addSbtPlugin("com.armanbilge" % "sbt-scalajs-importmap" % "0.1.1") diff --git a/resizable/src/main/scala/lucuma/react/resizable/Resizable.scala b/resizable/src/main/scala/lucuma/react/resizable/Resizable.scala index cd10c2804..052454155 100644 --- a/resizable/src/main/scala/lucuma/react/resizable/Resizable.scala +++ b/resizable/src/main/scala/lucuma/react/resizable/Resizable.scala @@ -41,8 +41,8 @@ final case class Resizable( width: Double, override val modifiers: Seq[TagMod] = Seq.empty ) extends GenericComponentPAC[Resizable.Props, Resizable] { - override protected def cprops = Resizable.props(this) - override protected val component = Resizable.component + override protected def cprops = Resizable.props(this) + override protected val component = Resizable.component override def addModifiers(modifiers: Seq[TagMod]) = copy(modifiers = this.modifiers ++ modifiers) } diff --git a/tanstack-table/src/main/scala/lucuma/react/SizePx.scala b/tanstack-table/src/main/scala/lucuma/react/SizePx.scala index fc8682bf1..8f4fc241f 100644 --- a/tanstack-table/src/main/scala/lucuma/react/SizePx.scala +++ b/tanstack-table/src/main/scala/lucuma/react/SizePx.scala @@ -9,5 +9,5 @@ opaque type SizePx = Int object SizePx: inline def apply(value: Int): SizePx = value extension (opaqueValue: SizePx) - inline def value: Int = opaqueValue + inline def value: Int = opaqueValue inline def modify(f: Endo[Int]): SizePx = f(opaqueValue) diff --git a/tanstack-table/src/main/scala/lucuma/react/table/Column.scala b/tanstack-table/src/main/scala/lucuma/react/table/Column.scala index 20230b222..4e2836f4a 100644 --- a/tanstack-table/src/main/scala/lucuma/react/table/Column.scala +++ b/tanstack-table/src/main/scala/lucuma/react/table/Column.scala @@ -43,37 +43,37 @@ case class Column[T, A, TM, CM] private[table] ( def getToggleVisibilityHandler(): SyntheticEvent[dom.Node] => Callback = e => Callback(toJs.getToggleVisibilityHandler()(e)) def toggleVisibility(): Callback = Callback(toJs.toggleVisibility()) - def toggleVisibility(value: Boolean): Callback = Callback(toJs.toggleVisibility(value)) + def toggleVisibility(value: Boolean): Callback = Callback(toJs.toggleVisibility(value)) // Sorting - def clearSorting(): Callback = Callback(toJs.clearSorting()) - def getAutoSortDir(): SortDirection = + def clearSorting(): Callback = Callback(toJs.clearSorting()) + def getAutoSortDir(): SortDirection = SortDirection.fromDescending(toJs.getAutoSortDir() == raw.tanstackTableCoreStrings.desc) - def getAutoSortingFn(): SortingFn[T, TM] = + def getAutoSortingFn(): SortingFn[T, TM] = (rowA, rowB, colId) => toJs.getAutoSortingFn()(rowA.toJs, rowB.toJs, colId.value).toInt - def getCanMultiSort(): Boolean = toJs.getCanMultiSort() - def getCanSort(): Boolean = toJs.getCanSort() - def getFirstSortDir(): SortDirection = SortDirection.fromDescending( + def getCanMultiSort(): Boolean = toJs.getCanMultiSort() + def getCanSort(): Boolean = toJs.getCanSort() + def getFirstSortDir(): SortDirection = SortDirection.fromDescending( toJs.getFirstSortDir() == raw.tanstackTableCoreStrings.desc ) - def getIsSorted(): Option[SortDirection] = + def getIsSorted(): Option[SortDirection] = Some(toJs.getIsSorted()) .filterNot(_ == raw.tanstackTableCoreBooleans.`false`) .map(dir => SortDirection.fromDescending(dir == raw.tanstackTableCoreStrings.desc)) - def getNextSortingOrder(): Option[SortDirection] = + def getNextSortingOrder(): Option[SortDirection] = Some(toJs.getNextSortingOrder()) .filterNot(_ == raw.tanstackTableCoreBooleans.`false`) .map(dir => SortDirection.fromDescending(dir == raw.tanstackTableCoreStrings.desc)) - def getSortIndex(): Int = toJs.getSortIndex().toInt - def getSortingFn(): SortingFn[T, TM] = + def getSortIndex(): Int = toJs.getSortIndex().toInt + def getSortingFn(): SortingFn[T, TM] = (rowA, rowB, colId) => toJs.getSortingFn()(rowA.toJs, rowB.toJs, colId.value).toInt - def getToggleSortingHandler(): Option[SyntheticEvent[dom.Node] => Callback] = + def getToggleSortingHandler(): Option[SyntheticEvent[dom.Node] => Callback] = toJs.getToggleSortingHandler().toOption.map(fn => e => Callback(fn(e))) - def toggleSorting(): Callback = Callback(toJs.toggleSorting()) - def toggleSorting(dir: SortDirection): Callback = Callback(toJs.toggleSorting(dir.toDescending)) - def toggleSorting(dir: SortDirection, isMulti: Boolean): Callback = + def toggleSorting(): Callback = Callback(toJs.toggleSorting()) + def toggleSorting(dir: SortDirection): Callback = Callback(toJs.toggleSorting(dir.toDescending)) + def toggleSorting(dir: SortDirection, isMulti: Boolean): Callback = Callback(toJs.toggleSorting(dir.toDescending, isMulti)) - def toggleSorting(isMulti: Boolean): Callback = Callback(toJs.toggleSorting((), isMulti)) + def toggleSorting(isMulti: Boolean): Callback = Callback(toJs.toggleSorting((), isMulti)) // Column Sizing def getCanResize(): Boolean = toJs.getCanResize() @@ -84,11 +84,11 @@ case class Column[T, A, TM, CM] private[table] ( def resetSize(): Callback = Callback(toJs.resetSize()) // Column Pinning - def getCanPin(): Boolean = toJs.getCanPin() - def getPinnedIndex(): Int = toJs.getPinnedIndex().toInt - def getIsPinned(): Option[ColumnPinningPosition] = + def getCanPin(): Boolean = toJs.getCanPin() + def getPinnedIndex(): Int = toJs.getPinnedIndex().toInt + def getIsPinned(): Option[ColumnPinningPosition] = ColumnPinningPosition.fromJs(toJs.getIsPinned()) def pin(position: ColumnPinningPosition): Callback = Callback(toJs.pin(position.toJs)) - def unpin(): Callback = Callback( + def unpin(): Callback = Callback( toJs.pin(raw.buildLibFeaturesColumnPinningMod.ColumnPinningPosition.`false`) ) diff --git a/tanstack-table/src/main/scala/lucuma/react/table/HTMLTableRenderer.scala b/tanstack-table/src/main/scala/lucuma/react/table/HTMLTableRenderer.scala index b700c962b..ebf33ecda 100644 --- a/tanstack-table/src/main/scala/lucuma/react/table/HTMLTableRenderer.scala +++ b/tanstack-table/src/main/scala/lucuma/react/table/HTMLTableRenderer.scala @@ -215,7 +215,7 @@ trait HTMLTableRenderer[T]: ) ) .toTagMod - ), + ) ) .toTagMod )( diff --git a/tanstack-table/src/main/scala/lucuma/react/table/Header.scala b/tanstack-table/src/main/scala/lucuma/react/table/Header.scala index ea544997f..340cb92ad 100644 --- a/tanstack-table/src/main/scala/lucuma/react/table/Header.scala +++ b/tanstack-table/src/main/scala/lucuma/react/table/Header.scala @@ -154,5 +154,5 @@ case class Header[T, A, TM, CM] private[table] ( * @link * [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) */ - def getStart(): Double = toJs.getStart() + def getStart(): Double = toJs.getStart() def getStart(position: ColumnPinningPosition): Double = toJs.getStart(position.toJs) diff --git a/tanstack-table/src/main/scala/lucuma/react/table/Row.scala b/tanstack-table/src/main/scala/lucuma/react/table/Row.scala index 71e9c3abb..24e6f2bef 100644 --- a/tanstack-table/src/main/scala/lucuma/react/table/Row.scala +++ b/tanstack-table/src/main/scala/lucuma/react/table/Row.scala @@ -20,7 +20,7 @@ case class Row[T, TM] private[table] (private[table] val toJs: raw.buildLibTypes lazy val subRows: List[Row[T, TM]] = toJs.subRows.toList.map(Row(_)) def getAllCells(): List[Cell[T, Any, TM, Any]] = toJs.getAllCells().toList.map(Cell(_)) def getLeafRows(): List[Row[T, TM]] = toJs.getLeafRows().toList.map(Row(_)) - def getValue[V](columnId: ColumnId): V = toJs.getValue(columnId.value) + def getValue[V](columnId: ColumnId): V = toJs.getValue(columnId.value) // Visibility def getVisibleCells(): List[Cell[T, Any, TM, Any]] = toJs.getVisibleCells().toList.map(Cell(_)) @@ -48,20 +48,20 @@ case class Row[T, TM] private[table] (private[table] val toJs: raw.buildLibTypes def getToggleSelectedHandler(): SyntheticEvent[dom.Node] => Callback = e => Callback(toJs.getToggleSelectedHandler()(e)) def toggleSelected(): Callback = Callback(toJs.toggleSelected()) - def toggleSelected(value: Boolean): Callback = Callback(toJs.toggleSelected(value)) + def toggleSelected(value: Boolean): Callback = Callback(toJs.toggleSelected(value)) // Expanded Rows - def getCanExpand(): Boolean = toJs.getCanExpand() - def getIsExpanded(): Boolean = toJs.getIsExpanded() - def getToggleExpandedHandler(): Callback = Callback(toJs.getToggleExpandedHandler()()) - def toggleExpanded(): Callback = Callback(toJs.toggleExpanded()) + def getCanExpand(): Boolean = toJs.getCanExpand() + def getIsExpanded(): Boolean = toJs.getIsExpanded() + def getToggleExpandedHandler(): Callback = Callback(toJs.getToggleExpandedHandler()()) + def toggleExpanded(): Callback = Callback(toJs.toggleExpanded()) def toggleExpanded(expanded: Boolean): Callback = Callback(toJs.toggleExpanded(expanded)) // Row Pinning def pin(position: RowPinningPosition): Callback = Callback(toJs.pin(position.toJs)) - def unpin(): Callback = Callback( + def unpin(): Callback = Callback( toJs.pin(raw.buildLibFeaturesRowPinningMod.RowPinningPosition.`false`) ) - def getCanPin(): Boolean = toJs.getCanPin() - def getIsPinned(): Option[RowPinningPosition] = RowPinningPosition.fromJs(toJs.getIsPinned()) - def getPinnedIndex(): Int = toJs.getPinnedIndex().toInt + def getCanPin(): Boolean = toJs.getCanPin() + def getIsPinned(): Option[RowPinningPosition] = RowPinningPosition.fromJs(toJs.getIsPinned()) + def getPinnedIndex(): Int = toJs.getPinnedIndex().toInt diff --git a/tanstack-table/src/main/scala/lucuma/react/table/Sorting.scala b/tanstack-table/src/main/scala/lucuma/react/table/Sorting.scala index f8b5db8c3..15d43b16e 100644 --- a/tanstack-table/src/main/scala/lucuma/react/table/Sorting.scala +++ b/tanstack-table/src/main/scala/lucuma/react/table/Sorting.scala @@ -12,7 +12,7 @@ import scalajs.js.JSConverters.* opaque type Sorting = List[ColumnSort] object Sorting: - inline def apply(value: List[ColumnSort]): Sorting = value + inline def apply(value: List[ColumnSort]): Sorting = value inline def apply(values: (ColumnId, SortDirection)*): Sorting = values.toList.map(ColumnSort.apply.tupled) protected[table] def fromJs( diff --git a/tanstack-table/src/main/scala/lucuma/react/table/Table.scala b/tanstack-table/src/main/scala/lucuma/react/table/Table.scala index 29b460387..9365b5a7e 100644 --- a/tanstack-table/src/main/scala/lucuma/react/table/Table.scala +++ b/tanstack-table/src/main/scala/lucuma/react/table/Table.scala @@ -15,23 +15,23 @@ import scalajs.js.JSConverters.* // Missing: ColumnOrder, Filters, Grouping, Pagination case class Table[T, TM] private[table] (private[table] val toJs: raw.buildLibTypesMod.Table[T]): - def getAllColumns(): List[Column[T, Any, TM, Any]] = toJs.getAllColumns().toList.map(Column(_)) - def getAllFlatColumns(): List[Column[T, Any, TM, Any]] = + def getAllColumns(): List[Column[T, Any, TM, Any]] = toJs.getAllColumns().toList.map(Column(_)) + def getAllFlatColumns(): List[Column[T, Any, TM, Any]] = toJs.getAllFlatColumns().toList.map(Column(_)) - def getAllLeafColumns(): List[Column[T, Any, TM, Any]] = + def getAllLeafColumns(): List[Column[T, Any, TM, Any]] = toJs.getAllLeafColumns().toList.map(Column(_)) - def getColumn(columnId: String): Option[Column[T, Any, TM, Any]] = + def getColumn(columnId: String): Option[Column[T, Any, TM, Any]] = toJs.getColumn(columnId).toOption.map(Column(_)) - def getCoreRowModel(): RowModel[T, TM] = RowModel(toJs.getCoreRowModel()) - def getRow(id: String): Row[T, TM] = Row(toJs.getRow(id)) - def getRowModel(): RowModel[T, TM] = RowModel(toJs.getRowModel()) - def getState(): TableState = TableState(toJs.getState()) - lazy val initialState: TableState = TableState(toJs.initialState) - lazy val options: TableOptions[T, TM] = + def getCoreRowModel(): RowModel[T, TM] = RowModel(toJs.getCoreRowModel()) + def getRow(id: String): Row[T, TM] = Row(toJs.getRow(id)) + def getRowModel(): RowModel[T, TM] = RowModel(toJs.getRowModel()) + def getState(): TableState = TableState(toJs.getState()) + lazy val initialState: TableState = TableState(toJs.initialState) + lazy val options: TableOptions[T, TM] = TableOptions.fromJs(toJs.options.asInstanceOf[TableOptionsJs[T, TM]]) - def reset(): Callback = Callback(toJs.reset()) - def setState(value: TableState): Callback = Callback(toJs.setState(value.toJs)) - def modState(f: Endo[TableState]): Callback = + def reset(): Callback = Callback(toJs.reset()) + def setState(value: TableState): Callback = Callback(toJs.setState(value.toJs)) + def modState(f: Endo[TableState]): Callback = Callback(toJs.setState(rawState => f(TableState(rawState)).toJs)) // Headers @@ -69,26 +69,26 @@ case class Table[T, TM] private[table] (private[table] val toJs: raw.buildLibTyp Callback(toJs.toggleAllColumnsVisible(value)) // Sorting - def getPreSortedRowModel(): RowModel[T, TM] = RowModel(toJs.getPreSortedRowModel()) - def getSortedRowModel(): RowModel[T, TM] = RowModel(toJs.getSortedRowModel()) - def resetSorting(): Callback = Callback(toJs.resetSorting()) + def getPreSortedRowModel(): RowModel[T, TM] = RowModel(toJs.getPreSortedRowModel()) + def getSortedRowModel(): RowModel[T, TM] = RowModel(toJs.getSortedRowModel()) + def resetSorting(): Callback = Callback(toJs.resetSorting()) def resetSorting(defaultState: Boolean): Callback = Callback(toJs.resetSorting(defaultState)) def setSorting(value: Sorting): Callback = Callback(toJs.setSorting(value.toJs)) - def modSorting(f: Endo[Sorting]): Callback = + def modSorting(f: Endo[Sorting]): Callback = Callback(toJs.setSorting(v => f(Sorting.fromJs(v)).toJs)) // ColumnSizing - def getCenterTotalSize(): SizePx = SizePx(toJs.getCenterTotalSize().toInt) - def getLeftTotalSize(): SizePx = SizePx(toJs.getLeftTotalSize().toInt) - def getRightTotalSize(): SizePx = SizePx(toJs.getRightTotalSize().toInt) - def getTotalSize(): SizePx = SizePx(toJs.getTotalSize().toInt) - def resetColumnSizing(): Callback = Callback(toJs.resetColumnSizing()) - def resetColumnSizing(defaultState: Boolean): Callback = + def getCenterTotalSize(): SizePx = SizePx(toJs.getCenterTotalSize().toInt) + def getLeftTotalSize(): SizePx = SizePx(toJs.getLeftTotalSize().toInt) + def getRightTotalSize(): SizePx = SizePx(toJs.getRightTotalSize().toInt) + def getTotalSize(): SizePx = SizePx(toJs.getTotalSize().toInt) + def resetColumnSizing(): Callback = Callback(toJs.resetColumnSizing()) + def resetColumnSizing(defaultState: Boolean): Callback = Callback(toJs.resetColumnSizing(defaultState)) - def resetHeaderSizeInfo(): Callback = Callback(toJs.resetHeaderSizeInfo()) - def resetHeaderSizeInfo(defaultState: Boolean): Callback = + def resetHeaderSizeInfo(): Callback = Callback(toJs.resetHeaderSizeInfo()) + def resetHeaderSizeInfo(defaultState: Boolean): Callback = Callback(toJs.resetHeaderSizeInfo(defaultState)) - def setColumnSizing(value: ColumnSizing): Callback = Callback(toJs.setColumnSizing(value.toJs)) + def setColumnSizing(value: ColumnSizing): Callback = Callback(toJs.setColumnSizing(value.toJs)) def modColumnSizing(f: Endo[ColumnSizing]): Callback = Callback(toJs.setColumnSizing(v => f(ColumnSizing.fromJs(v)).toJs)) def setColumnSizingInfo(value: ColumnSizingInfo): Callback = @@ -106,12 +106,12 @@ case class Table[T, TM] private[table] (private[table] val toJs: raw.buildLibTyp def getToggleAllRowsExpandedHandler(): SyntheticEvent[dom.Node] => Callback = e => Callback(toJs.getToggleAllRowsExpandedHandler()(e)) def resetExpanded(): Callback = Callback(toJs.resetExpanded()) - def resetExpanded(defaultState: Boolean): Callback = Callback(toJs.resetExpanded(defaultState)) - def setExpanded(value: Expanded): Callback = Callback(toJs.setExpanded(value.toJs)) - def modExpanded(f: Endo[Expanded]): Callback = + def resetExpanded(defaultState: Boolean): Callback = Callback(toJs.resetExpanded(defaultState)) + def setExpanded(value: Expanded): Callback = Callback(toJs.setExpanded(value.toJs)) + def modExpanded(f: Endo[Expanded]): Callback = Callback(toJs.setExpanded(v => f(Expanded.fromJs(v)).toJs)) - def toggleAllRowsExpanded(): Callback = Callback(toJs.toggleAllRowsExpanded()) - def toggleAllRowsExpanded(expanded: Boolean): Callback = + def toggleAllRowsExpanded(): Callback = Callback(toJs.toggleAllRowsExpanded()) + def toggleAllRowsExpanded(expanded: Boolean): Callback = Callback(toJs.toggleAllRowsExpanded(expanded)) // RowSelection @@ -130,18 +130,18 @@ case class Table[T, TM] private[table] (private[table] val toJs: raw.buildLibTyp def resetRowSelection(): Callback = Callback(toJs.resetRowSelection()) def resetRowSelection(defaultState: Boolean): Callback = Callback(toJs.resetRowSelection(defaultState)) - def setRowSelection(value: RowSelection): Callback = Callback(toJs.setRowSelection(value.toJs)) - def modRowSelection(f: Endo[RowSelection]): Callback = + def setRowSelection(value: RowSelection): Callback = Callback(toJs.setRowSelection(value.toJs)) + def modRowSelection(f: Endo[RowSelection]): Callback = Callback(toJs.setRowSelection(v => f(RowSelection.fromJs(v)).toJs)) - def toggleAllPageRowsSelected(): Callback = Callback(toJs.toggleAllPageRowsSelected()) - def toggleAllPageRowsSelected(value: Boolean): Callback = + def toggleAllPageRowsSelected(): Callback = Callback(toJs.toggleAllPageRowsSelected()) + def toggleAllPageRowsSelected(value: Boolean): Callback = Callback(toJs.toggleAllPageRowsSelected(value)) - def toggleAllRowsSelected(): Callback = Callback(toJs.toggleAllRowsSelected()) - def toggleAllRowsSelected(value: Boolean): Callback = + def toggleAllRowsSelected(): Callback = Callback(toJs.toggleAllRowsSelected()) + def toggleAllRowsSelected(value: Boolean): Callback = Callback(toJs.toggleAllRowsSelected(value)) // Column Pinning - def setColumnPinning(value: ColumnPinning): Callback = Callback(toJs.setColumnPinning(value.toJs)) + def setColumnPinning(value: ColumnPinning): Callback = Callback(toJs.setColumnPinning(value.toJs)) def modColumnPinning(f: Endo[ColumnPinning]): Callback = Callback(toJs.setColumnPinning(v => f(ColumnPinning.fromJs(v)).toJs)) def resetColumnPinning(): Callback = Callback(toJs.resetColumnPinning()) @@ -175,19 +175,19 @@ case class Table[T, TM] private[table] (private[table] val toJs: raw.buildLibTyp def getRightLeafHeaders(): List[Header[T, Any, TM, Any]] = toJs.getRightLeafHeaders().toList.map(Header(_)) // Row Pinning - def setRowPinning(value: RowPinning): Callback = Callback(toJs.setRowPinning(value.toJs)) - def modRowPinning(f: Endo[RowPinning]): Callback = Callback: + def setRowPinning(value: RowPinning): Callback = Callback(toJs.setRowPinning(value.toJs)) + def modRowPinning(f: Endo[RowPinning]): Callback = Callback: toJs.setRowPinning(v => f(RowPinning.fromJs(v)).toJs) - def resetRowPinning(): Callback = Callback(toJs.resetRowPinning()) - def resetRowPinning(defaultState: Boolean): Callback = Callback( + def resetRowPinning(): Callback = Callback(toJs.resetRowPinning()) + def resetRowPinning(defaultState: Boolean): Callback = Callback( toJs.resetRowPinning(defaultState) ) - def getIsSomeRowsPinned(): Boolean = toJs.getIsSomeRowsPinned() - def getIsSomeRowsPinned(position: RowPinningPosition): Boolean = + def getIsSomeRowsPinned(): Boolean = toJs.getIsSomeRowsPinned() + def getIsSomeRowsPinned(position: RowPinningPosition): Boolean = toJs.getIsSomeRowsPinned(position.toJs) - def getTopRows(): List[Row[T, TM]] = + def getTopRows(): List[Row[T, TM]] = toJs.getTopRows().toList.map(Row(_)) - def getBottomRows(): List[Row[T, TM]] = + def getBottomRows(): List[Row[T, TM]] = toJs.getBottomRows().toList.map(Row(_)) - def getCenterRows(): List[Row[T, TM]] = + def getCenterRows(): List[Row[T, TM]] = toJs.getCenterRows().toList.map(Row(_))