-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update antd #47
base: master
Are you sure you want to change the base?
Update antd #47
Changes from all commits
498f227
aeadedf
a09118f
69e959a
9de34ef
5b5580b
de73330
9f8289c
8131512
4477a98
b434bea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,9 @@ import slinky.core._ | |
import slinky.core.annotations.react | ||
import slinky.core.facade.Hooks._ | ||
import slinky.core.facade.ReactElement | ||
import slinky.web.html.*.tag | ||
import slinky.web.html._ | ||
import typings.StBuildingComponent.Default | ||
import typings.antDesignIcons.components.AntdIcon | ||
import typings.antDesignIconsSvg.downOutlinedMod.{default => DownOutlinedIcon} | ||
import typings.antDesignIconsSvg.downloadOutlinedMod.{default => DownloadOutlinedIcon} | ||
|
@@ -13,20 +15,21 @@ import typings.antDesignIconsSvg.lockTwoToneMod.{default => LockTwoToneIcon} | |
import typings.antDesignIconsSvg.mailTwoToneMod.{default => MailTwoToneIcon} | ||
import typings.antDesignIconsSvg.shopOutlinedMod.{default => ShopOutlinedIcon} | ||
import typings.antDesignIconsSvg.userOutlinedMod.{default => UserOutlinedIcon} | ||
import typings.antd.antdStrings | ||
import typings.antd.components.{List => AntList, _} | ||
import typings.antd.components.Form.{Form => FormItem} | ||
import typings.antd.components.{List => AntList, _} | ||
import typings.antd.generatePickerMod.RangePickerDateProps | ||
import typings.antd.{antdStrings, mod} | ||
import typings.antd.notificationMod.{ArgsProps, IconType, default => Notification} | ||
import typings.antd.tableInterfaceMod.{ColumnGroupType, ColumnType} | ||
import typings.antd.tooltipMod.{TooltipProps, TooltipPropsWithTitle} | ||
import typings.moment.mod.Moment | ||
import typings.moment.mod.unitOfTime.DurationConstructor | ||
import typings.moment.{mod => moment} | ||
import typings.rcPicker.interfaceMod.{EventValue, RangeValue} | ||
import typings.rcPicker.rangePickerMod.RangeShowTimeObject | ||
import typings.rcSelect.interfaceMod.OptionData | ||
import typings.rcTreeSelect.interfaceMod.DataNode | ||
import typings.rcTreeSelect.strategyUtilMod | ||
import typings.react.mod.CSSProperties | ||
import typings.rcSelect.selectMod | ||
import typings.rcTreeSelect.{strategyUtilMod, treeSelectMod} | ||
import typings.react.mod.{CSSProperties, RefAttributes} | ||
import typings.std.global.console | ||
|
||
import scala.scalajs.js | ||
|
@@ -103,14 +106,14 @@ object CSS extends js.Any | |
) | ||
.columnsVarargs( | ||
ColumnType[TableItem]() | ||
.setTitle("Name") | ||
.setTitle("Name": ReactElement) | ||
.setDataIndex("name") | ||
.setKey("name") | ||
.setRender((_, tableItem, _) => Tag(tableItem.name).build), | ||
ColumnGroupType[TableItem]( | ||
scala.scalajs.js.Array( | ||
ColumnType[TableItem].setTitle("Age").setDataIndex("age").setKey("age"), | ||
ColumnType[TableItem].setTitle("Address").setDataIndex("address").setKey("address") | ||
ColumnType[TableItem].setTitle("Age": ReactElement).setDataIndex("age").setKey("age"), | ||
ColumnType[TableItem].setTitle("Address": ReactElement).setDataIndex("address").setKey("address") | ||
) | ||
).setTitleReactElement("Age & Address") | ||
) | ||
|
@@ -174,11 +177,11 @@ object CSS extends js.Any | |
Select[String] | ||
.defaultValue(selectValue) | ||
.onChange((changedValue, _) => updateSelectValue(changedValue))( | ||
Select.OptGroup.label("Manager")( | ||
Select.OptGroup("Manager")( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess label changed from being optional to mandatory? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly |
||
Select.Option("jack")("Jack"), | ||
Select.Option("lucy")("Lucy") | ||
), | ||
Select.OptGroup.label("Engineer")( | ||
Select.OptGroup("Engineer")( | ||
Select.Option("yiminghe")("Yiminghe") | ||
) | ||
) | ||
|
@@ -202,7 +205,8 @@ object CSS extends js.Any | |
Spin | ||
.size(antdStrings.large) | ||
.spinning(true)( | ||
Alert(message = "Alert message title") | ||
Alert | ||
.message("Alert message title") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vice versa here, message is now optional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
.description("Further details about the context of this alert.") | ||
.`type`(antdStrings.info) | ||
.showIcon(true) | ||
|
@@ -282,13 +286,15 @@ object CSS extends js.Any | |
.filterOption(true) // Filter options by input | ||
.defaultActiveFirstOption(true) // Make first option active - enter to select | ||
.optionsVarargs( | ||
OptionData("Alphabet"), | ||
OptionData("Baguette").set( | ||
"label", | ||
span(AntdIcon(ShopOutlinedIcon), " Baguette") | ||
), // Set label as a ReactElement for customised display | ||
OptionData("Bicycle"), | ||
OptionData("Croissant") | ||
selectMod.DefaultOptionType("Alphabet"), | ||
selectMod | ||
.DefaultOptionType("Baguette") | ||
.set( | ||
"label", | ||
span(AntdIcon(ShopOutlinedIcon), " Baguette") | ||
), // Set label as a ReactElement for customised display | ||
selectMod.DefaultOptionType("Bicycle"), | ||
selectMod.DefaultOptionType("Croissant") | ||
) | ||
.onChange { case (text, _) => setText(text) } | ||
} | ||
|
@@ -410,7 +416,9 @@ object CSS extends js.Any | |
|
||
val renderTooltip = section( | ||
h2("Tooltip"), | ||
Tooltip.TooltipPropsWithTitleRefAttributes(title = ("Tooltip": ReactElement))(span("Hover me")) | ||
Tooltip(TooltipPropsWithTitle("Tooltip": ReactElement).asInstanceOf[TooltipProps with RefAttributes[Any]])( | ||
span("Hover me") | ||
) | ||
) | ||
|
||
val renderTimeline = section( | ||
|
@@ -431,17 +439,22 @@ object CSS extends js.Any | |
) | ||
) | ||
|
||
// Workaround for https://github.com/ScalablyTyped/Converter/issues/470 | ||
def RangePicker[DateType](props: RangePickerDateProps[DateType]) = | ||
new Default[tag.type, mod.DatePicker.RangePicker](js.Array(mod.DatePicker.RangePicker, props)) | ||
|
||
val renderRangePicker = section( | ||
h2("Range Picker"), | ||
DatePicker.PickerBaseProps.RangePicker | ||
.RangePickerDateProps() | ||
.showTime(RangeShowTimeObject[Moment].setFormat("HH:mm")) | ||
.format("YYYY/MM/DD HH:mm") | ||
.value(rangePickerValues) | ||
.onChange { (values: RangeValue[Moment], formatString: js.Tuple2[String, String]) => | ||
console.log(formatString) | ||
updateRangePickerValues(values) | ||
}, | ||
RangePicker( | ||
RangePickerDateProps[Moment]() | ||
.setShowTime(RangeShowTimeObject[Moment].setFormat("HH:mm")) | ||
.setFormat("YYYY/MM/DD HH:mm") | ||
.setValue(rangePickerValues) | ||
.setOnChange { (values: RangeValue[Moment], formatString: js.Tuple2[String, String]) => | ||
console.log(formatString) | ||
updateRangePickerValues(values) | ||
} | ||
), | ||
div(b("Note that moment.js date times are ready to be localized")), | ||
div(s"moment.js current locale: ${moment.apply().locale()}"), | ||
div(s"moment.js duration en_US: ${moment.apply().locale("en_US").fromNow()}"), | ||
|
@@ -453,9 +466,9 @@ object CSS extends js.Any | |
val renderTreeSelect = section( | ||
h2("Multiple and checkable Tree Select"), { | ||
def node(title: String, value: String) = | ||
DataNode().setTitle(title).setValue(value).setKey(value) | ||
treeSelectMod.DefaultOptionType().setTitle(title).setValue(value).setKey(value) | ||
|
||
val data: js.Array[DataNode] = js.Array( | ||
val data: js.Array[treeSelectMod.DefaultOptionType] = js.Array( | ||
node("Node1", "0-0").setChildrenVarargs( | ||
node("Child Node1", "0-0-0") | ||
), | ||
|
@@ -466,7 +479,7 @@ object CSS extends js.Any | |
) | ||
) | ||
|
||
TreeSelect[js.Array[String]] | ||
TreeSelect[js.Array[String], treeSelectMod.DefaultOptionType]() | ||
.value(selectTreeValues) | ||
.onChange((values, _, _) => updateSelectTreeValues(values)) | ||
.treeData(data) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunate side effect of the the union encoding in Scala.js. No double implicit conversions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it have a
.setTitleReactElement
or something like that?