aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-01-17 19:29:30 +0100
committerRobert Jaros <rjaros@finn.pl>2018-01-17 19:29:30 +0100
commit31c9d3c4121107974a8419752aa7face5c96f821 (patch)
tree77aaac10c5a120b028c14f53ab74eb5491f4a443 /src/main/kotlin
parent646e82e383850447fd4d10f71ecc0aeab11623e0 (diff)
downloadkvision-31c9d3c4121107974a8419752aa7face5c96f821.tar.gz
kvision-31c9d3c4121107974a8419752aa7face5c96f821.tar.bz2
kvision-31c9d3c4121107974a8419752aa7face5c96f821.zip
Code formatting (Kotlin Style Guide)
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/Showcase.kt101
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Css.kt72
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt11
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Widget.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt12
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt34
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/Form.kt16
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt14
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/HelpBlock.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt12
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt14
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt14
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt12
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Button.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Image.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Link.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/List.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Tag.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt16
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt22
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt24
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt32
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt12
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt10
50 files changed, 411 insertions, 229 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
index d7b76862..51f0213b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
@@ -89,9 +89,11 @@ class Showcase : ApplicationBase() {
val model = observableListOf(Model(true, "Pierwszy"), Model(false, "Drugi"), Model(false, "Trzeci"))
val datac = DataContainer(model, { element, index ->
- CheckBox(value = element.p,
- label = if (element.p) "<b>" + (index + 1) + " " + element.t + "</b>" else element.t,
- rich = true).setEventListener<CheckBox>({
+ CheckBox(
+ value = element.p,
+ label = if (element.p) "<b>" + (index + 1) + " " + element.t + "</b>" else element.t,
+ rich = true
+ ).setEventListener<CheckBox>({
click = {
element.p = self.value
}
@@ -409,12 +411,18 @@ class Showcase : ApplicationBase() {
}*/
root.add(text)
- val textareainput = TextAreaInput(cols = 5, rows = 2, value = "To jest tekst\nTo jest <b>te</b></textarea>kst2").apply {
- placeholder = "..."
- }
+ val textareainput =
+ TextAreaInput(cols = 5, rows = 2, value = "To jest tekst\nTo jest <b>te</b></textarea>kst2").apply {
+ placeholder = "..."
+ }
root.add(textareainput)
- val textarea = TextArea(cols = 5, rows = 2, value = "To jest tekst\nTo jest <b>te</b></textarea>kst2", label = "Pole długie").apply {
+ val textarea = TextArea(
+ cols = 5,
+ rows = 2,
+ value = "To jest tekst\nTo jest <b>te</b></textarea>kst2",
+ label = "Pole długie"
+ ).apply {
placeholder = "..."
}
root.add(textarea)
@@ -447,7 +455,7 @@ class Showcase : ApplicationBase() {
it.getValue()?.matches("^[0-9]+$")
}
add("password", Password(label = "Hasło"), required = true,
- validatorMessage = { "Wprowadź co najmniej 5 znaków" }) {
+ validatorMessage = { "Wprowadź co najmniej 5 znaków" }) {
(it.getValue()?.length ?: 0) >= 5
}
add("textarea", TextArea(label = "Obszar"), required = true)
@@ -455,20 +463,26 @@ class Showcase : ApplicationBase() {
add("data", DateTime(format = "YYYY-MM-DD", label = "Data"), required = true)
add("checkbox", CheckBox(label = "Checkbox")) { it.getValue() }
add("radio", Radio(label = "Radiobutton")) { it.getValue() }
- add("select", Select(options = listOf("a" to "Pierwsza opcja", "b" to "Druga opcja"),
- label = "Wybierz opcje").apply {
+ add("select", Select(
+ options = listOf("a" to "Pierwsza opcja", "b" to "Druga opcja"),
+ label = "Wybierz opcje"
+ ).apply {
// selectWidthType = SELECTWIDTHTYPE.FIT
emptyOption = true
- }, required = true)
+ }, required = true
+ )
add("spinner", Spinner(label = "Spinner"), required = true)
- add("radiogroup", RadioGroup(listOf("o1" to "Pierwsza opcja", "o2" to "Druga opcja"),
- inline = true, label = "Radio group").apply {
+ add("radiogroup", RadioGroup(
+ listOf("o1" to "Pierwsza opcja", "o2" to "Druga opcja"),
+ inline = true, label = "Radio group"
+ ).apply {
setEventListener<RadioGroup> {
change = { e ->
println(self.value)
}
}
- }, required = true)
+ }, required = true
+ )
validator = {
val result = it["text"] == it["textarea"]
@@ -481,7 +495,14 @@ class Showcase : ApplicationBase() {
validatorMessage = { "Pole Tekst i Obszar muszą być takie same!" }
}
root.add(formPanel)
- val spinner = SpinnerInput(15.05, min = -100000, max = 100000, decimals = 4, forceType = FORCETYPE.ROUND, step = 0.0001).apply {
+ val spinner = SpinnerInput(
+ 15.05,
+ min = -100000,
+ max = 100000,
+ decimals = 4,
+ forceType = FORCETYPE.ROUND,
+ step = 0.0001
+ ).apply {
size = INPUTSIZE.LARGE
}
val ttt = TextInput(value = "abc").apply {
@@ -527,9 +548,12 @@ class Showcase : ApplicationBase() {
hiddenBsDropdown = { e -> println("hidden" + e.detail) }
}
- val dd2 = DropDown("Dropdown2", listOf("abc" to "#!/abc", "def" to "#!/def", "xyz" to DISABLED.type,
+ val dd2 = DropDown(
+ "Dropdown2", listOf(
+ "abc" to "#!/abc", "def" to "#!/def", "xyz" to DISABLED.type,
"Header" to HEADER.type, "Separtatorek" to SEPARATOR.type
- ), "flag").apply { dropup = true }
+ ), "flag"
+ ).apply { dropup = true }
root.add(dd2)
dd2.setEventListener<DropDown> {
hideBsDropdown = { e -> println("hide" + e.detail) }
@@ -564,14 +588,20 @@ class Showcase : ApplicationBase() {
split.add(tabs)
val split2 = SplitPanel(DIRECTION.HORIZONTAL)
- val t1 = Tag(TAG.DIV, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor. Suspendisse vel fermentum purus, vel ornare tellus. Vivamus dictum, risus non viverra venenatis, magna mi pharetra purus, nec dignissim risus tortor a sem. Donec tincidunt dui ut eros laoreet consectetur. Nam dapibus vestibulum sem, eget accumsan ex vestibulum ac. Curabitur ac mi sit amet eros sodales dictum. Sed at felis at nunc aliquam finibus. Vestibulum lorem nulla, dictum ac libero non, mattis dictum nisl. Aenean semper lorem turpis. Praesent pellentesque ligula est, viverra molestie leo imperdiet ut. Nam vitae hendrerit justo. Nullam tincidunt et nibh ac volutpat. Aliquam vulputate mi aliquam fermentum rhoncus.\n" +
- "\n" +
- "Proin porttitor diam id massa eleifend aliquet. Morbi nec erat porttitor, placerat lorem et, dignissim lectus. Cras ultricies posuere arcu, et pharetra dui laoreet in. Sed nec ipsum in sapien vestibulum maximus eu id nunc. Ut finibus aliquam nisi id vehicula. Phasellus sodales lobortis orci, non interdum risus dignissim quis. Proin bibendum consectetur diam nec mattis. Suspendisse dictum vulputate metus at tincidunt.")
+ val t1 = Tag(
+ TAG.DIV,
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor. Suspendisse vel fermentum purus, vel ornare tellus. Vivamus dictum, risus non viverra venenatis, magna mi pharetra purus, nec dignissim risus tortor a sem. Donec tincidunt dui ut eros laoreet consectetur. Nam dapibus vestibulum sem, eget accumsan ex vestibulum ac. Curabitur ac mi sit amet eros sodales dictum. Sed at felis at nunc aliquam finibus. Vestibulum lorem nulla, dictum ac libero non, mattis dictum nisl. Aenean semper lorem turpis. Praesent pellentesque ligula est, viverra molestie leo imperdiet ut. Nam vitae hendrerit justo. Nullam tincidunt et nibh ac volutpat. Aliquam vulputate mi aliquam fermentum rhoncus.\n" +
+ "\n" +
+ "Proin porttitor diam id massa eleifend aliquet. Morbi nec erat porttitor, placerat lorem et, dignissim lectus. Cras ultricies posuere arcu, et pharetra dui laoreet in. Sed nec ipsum in sapien vestibulum maximus eu id nunc. Ut finibus aliquam nisi id vehicula. Phasellus sodales lobortis orci, non interdum risus dignissim quis. Proin bibendum consectetur diam nec mattis. Suspendisse dictum vulputate metus at tincidunt."
+ )
t1.padding = 5.px()
split2.add(t1)
- val t2 = Tag(TAG.DIV, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor. Suspendisse vel fermentum purus, vel ornare tellus. Vivamus dictum, risus non viverra venenatis, magna mi pharetra purus, nec dignissim risus tortor a sem. Donec tincidunt dui ut eros laoreet consectetur. Nam dapibus vestibulum sem, eget accumsan ex vestibulum ac. Curabitur ac mi sit amet eros sodales dictum. Sed at felis at nunc aliquam finibus. Vestibulum lorem nulla, dictum ac libero non, mattis dictum nisl. Aenean semper lorem turpis. Praesent pellentesque ligula est, viverra molestie leo imperdiet ut. Nam vitae hendrerit justo. Nullam tincidunt et nibh ac volutpat. Aliquam vulputate mi aliquam fermentum rhoncus.\n" +
- "\n" +
- "Proin porttitor diam id massa eleifend aliquet. Morbi nec erat porttitor, placerat lorem et, dignissim lectus. Cras ultricies posuere arcu, et pharetra dui laoreet in. Sed nec ipsum in sapien vestibulum maximus eu id nunc. Ut finibus aliquam nisi id vehicula. Phasellus sodales lobortis orci, non interdum risus dignissim quis. Proin bibendum consectetur diam nec mattis. Suspendisse dictum vulputate metus at tincidunt.")
+ val t2 = Tag(
+ TAG.DIV,
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor. Suspendisse vel fermentum purus, vel ornare tellus. Vivamus dictum, risus non viverra venenatis, magna mi pharetra purus, nec dignissim risus tortor a sem. Donec tincidunt dui ut eros laoreet consectetur. Nam dapibus vestibulum sem, eget accumsan ex vestibulum ac. Curabitur ac mi sit amet eros sodales dictum. Sed at felis at nunc aliquam finibus. Vestibulum lorem nulla, dictum ac libero non, mattis dictum nisl. Aenean semper lorem turpis. Praesent pellentesque ligula est, viverra molestie leo imperdiet ut. Nam vitae hendrerit justo. Nullam tincidunt et nibh ac volutpat. Aliquam vulputate mi aliquam fermentum rhoncus.\n" +
+ "\n" +
+ "Proin porttitor diam id massa eleifend aliquet. Morbi nec erat porttitor, placerat lorem et, dignissim lectus. Cras ultricies posuere arcu, et pharetra dui laoreet in. Sed nec ipsum in sapien vestibulum maximus eu id nunc. Ut finibus aliquam nisi id vehicula. Phasellus sodales lobortis orci, non interdum risus dignissim quis. Proin bibendum consectetur diam nec mattis. Suspendisse dictum vulputate metus at tincidunt."
+ )
t2.padding = 10.px()
split2.add(t2)
split.add(split2)
@@ -596,8 +626,12 @@ class Showcase : ApplicationBase() {
val del = Tag(TAG.DEL, "To jest deleted")
root.add(del)
- val list = ListTag(LIST.DL_HORIZ, listOf("abc", "de<b>fdasdasdasddasd</b>tdasdas", "Dasdsada",
- "dasdasdads"), true)
+ val list = ListTag(
+ LIST.DL_HORIZ, listOf(
+ "abc", "de<b>fdasdasdasddasd</b>tdasdas", "Dasdsada",
+ "dasdasdads"
+ ), true
+ )
root.add(list)
val list2 = ListTag(LIST.OL, null)
@@ -642,8 +676,10 @@ class Showcase : ApplicationBase() {
root.add(vPanel)
val grid3 = GridPanel(templateColumns = "1fr 1fr 1fr")
- grid3.background = Background(0xCCCCCC, Img("kotlin.png"), 50.perc(), 50.perc(), size = BGSIZE.CONTAIN,
- repeat = BGREPEAT.NOREPEAT, attachment = BGATTACH.FIXED)
+ grid3.background = Background(
+ 0xCCCCCC, Img("kotlin.png"), 50.perc(), 50.perc(), size = BGSIZE.CONTAIN,
+ repeat = BGREPEAT.NOREPEAT, attachment = BGATTACH.FIXED
+ )
grid3.add(Label("hh1"))
grid3.add(Label("hh2"))
grid3.add(Label("hh3"))
@@ -669,7 +705,10 @@ class Showcase : ApplicationBase() {
// root.add(dock)
val pa = HPanel(alignItems = FLEXALIGNITEMS.FLEXEND)
- pa.add(Label("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor. Suspendisse vel fermentum purus, vel ornare tellus. Vivamus dictum, risus non viverra venenatis, magna mi pharetra purus, nec dignissim risus tortor a sem. Donec tincidunt dui ut eros laoreet consectetur. Nam dapibus vestibulum sem, eget accumsan ex vestibulum ac. Curabitur ac mi sit amet eros sodales dictum. Sed at felis at nunc aliquam finibus. Vestibulum lorem nulla, dictum ac libero non, mattis dictum nisl. Aenean semper lorem turpis. Praesent pellentesque ligula est, viverra molestie leo imperdiet ut. Nam vitae hendrerit justo. Nullam tincidunt et nibh ac volutpat. Aliquam vulputate mi aliquam fermentum rhoncus."), 3)
+ pa.add(
+ Label("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor. Suspendisse vel fermentum purus, vel ornare tellus. Vivamus dictum, risus non viverra venenatis, magna mi pharetra purus, nec dignissim risus tortor a sem. Donec tincidunt dui ut eros laoreet consectetur. Nam dapibus vestibulum sem, eget accumsan ex vestibulum ac. Curabitur ac mi sit amet eros sodales dictum. Sed at felis at nunc aliquam finibus. Vestibulum lorem nulla, dictum ac libero non, mattis dictum nisl. Aenean semper lorem turpis. Praesent pellentesque ligula est, viverra molestie leo imperdiet ut. Nam vitae hendrerit justo. Nullam tincidunt et nibh ac volutpat. Aliquam vulputate mi aliquam fermentum rhoncus."),
+ 3
+ )
pa.add(Image(Img("kotlin.png")), 1)
pa.add(dock, 2, alignSelf = FLEXALIGNITEMS.FLEXSTART)
dock.width = 400.px()
@@ -751,9 +790,9 @@ class Showcase : ApplicationBase() {
println("init routing")
routing.on({ _ -> println("root") })
- .on("/abc", { _ -> println("abc") })
- .on("/test", { _ -> println("test") })
- .resolve()
+ .on("/abc", { _ -> println("abc") })
+ .on("/test", { _ -> println("test") })
+ .resolve()
// jQuery(document).off(".data-api")
// routing.on(RegExp("/abc/def/(.*)/(.*)/(.*)"), { x,y,z,u,v -> println(x) })
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
index a645ac83..f533ebdd 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
@@ -211,11 +211,15 @@ enum class BGCLIP(val clip: String) {
CONTENT("content-box")
}
-class Border private constructor(private val width: CssSize? = null, private val style: BORDERSTYLE? = null,
- private val color: String? = null) {
+class Border private constructor(
+ private val width: CssSize? = null, private val style: BORDERSTYLE? = null,
+ private val color: String? = null
+) {
constructor(width: CssSize? = null, style: BORDERSTYLE? = null) : this(width, style, null)
- constructor(width: CssSize? = null, style: BORDERSTYLE? = null, color: Int) : this(width, style,
- "#" + color.toHexString())
+ constructor(width: CssSize? = null, style: BORDERSTYLE? = null, color: Int) : this(
+ width, style,
+ "#" + color.toHexString()
+ )
constructor(width: CssSize? = null, style: BORDERSTYLE? = null, color: COLOR) : this(width, style, color.color)
@@ -236,31 +240,45 @@ class Color private constructor(private val color: String? = null) {
}
}
-class Background private constructor(private val color: String? = null, private val image: ResString? = null,
- private val positionX: CssSize? = null, private val positionY: CssSize? = null,
- private val sizeX: CssSize? = null, private val sizeY: CssSize? = null,
- private val size: BGSIZE? = null, private val repeat: BGREPEAT? = null,
- private val origin: BGORIGIN? = null, private val clip: BGCLIP? = null,
- private val attachment: BGATTACH? = null) {
- constructor(image: ResString? = null, positionX: CssSize? = null, positionY: CssSize? = null,
- sizeX: CssSize? = null, sizeY: CssSize? = null, size: BGSIZE? = null,
- repeat: BGREPEAT? = null, origin: BGORIGIN? = null, clip: BGCLIP? = null,
- attachment: BGATTACH? = null) : this(null,
- image, positionX, positionY, sizeX, sizeY, size, repeat, origin, clip, attachment)
+class Background private constructor(
+ private val color: String? = null, private val image: ResString? = null,
+ private val positionX: CssSize? = null, private val positionY: CssSize? = null,
+ private val sizeX: CssSize? = null, private val sizeY: CssSize? = null,
+ private val size: BGSIZE? = null, private val repeat: BGREPEAT? = null,
+ private val origin: BGORIGIN? = null, private val clip: BGCLIP? = null,
+ private val attachment: BGATTACH? = null
+) {
+ constructor(
+ image: ResString? = null, positionX: CssSize? = null, positionY: CssSize? = null,
+ sizeX: CssSize? = null, sizeY: CssSize? = null, size: BGSIZE? = null,
+ repeat: BGREPEAT? = null, origin: BGORIGIN? = null, clip: BGCLIP? = null,
+ attachment: BGATTACH? = null
+ ) : this(
+ null,
+ image, positionX, positionY, sizeX, sizeY, size, repeat, origin, clip, attachment
+ )
- constructor(color: Int, image: ResString? = null, positionX: CssSize? = null,
- positionY: CssSize? = null,
- sizeX: CssSize? = null, sizeY: CssSize? = null, size: BGSIZE? = null,
- repeat: BGREPEAT? = null, origin: BGORIGIN? = null, clip: BGCLIP? = null,
- attachment: BGATTACH? = null) : this("#" +
- color.toHexString(), image, positionX, positionY, sizeX, sizeY, size, repeat, origin, clip,
- attachment)
+ constructor(
+ color: Int, image: ResString? = null, positionX: CssSize? = null,
+ positionY: CssSize? = null,
+ sizeX: CssSize? = null, sizeY: CssSize? = null, size: BGSIZE? = null,
+ repeat: BGREPEAT? = null, origin: BGORIGIN? = null, clip: BGCLIP? = null,
+ attachment: BGATTACH? = null
+ ) : this(
+ "#" +
+ color.toHexString(), image, positionX, positionY, sizeX, sizeY, size, repeat, origin, clip,
+ attachment
+ )
- constructor(color: COLOR, image: ResString? = null, positionX: CssSize? = null,
- positionY: CssSize? = null, sizeX: CssSize? = null, sizeY: CssSize? = null,
- size: BGSIZE? = null, repeat: BGREPEAT? = null, origin: BGORIGIN? = null, clip: BGCLIP? = null,
- attachment: BGATTACH? = null) : this(color.color, image,
- positionX, positionY, sizeX, sizeY, size, repeat, origin, clip, attachment)
+ constructor(
+ color: COLOR, image: ResString? = null, positionX: CssSize? = null,
+ positionY: CssSize? = null, sizeX: CssSize? = null, sizeY: CssSize? = null,
+ size: BGSIZE? = null, repeat: BGREPEAT? = null, origin: BGORIGIN? = null, clip: BGCLIP? = null,
+ attachment: BGATTACH? = null
+ ) : this(
+ color.color, image,
+ positionX, positionY, sizeX, sizeY, size, repeat, origin, clip, attachment
+ )
fun asString(): String {
val img = image?.let {
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt b/src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt
index 6739192d..4cd50550 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/KVManager.kt
@@ -26,7 +26,8 @@ object KVManager {
private val bootstrapSelectI18n = require("./js/bootstrap-select-i18n.min.js")
private val bootstrapSelectAjaxCss = require("ajax-bootstrap-select/dist/css/ajax-bootstrap-select.min.css")
private val bootstrapSelectAjax = require("ajax-bootstrap-select/dist/js/ajax-bootstrap-select.min.js")
- private val bootstrapSelectAjaxI18n = require("ajax-bootstrap-select/dist/js/locale/ajax-bootstrap-select.pl-PL.min.js")
+ private val bootstrapSelectAjaxI18n =
+ require("ajax-bootstrap-select/dist/js/locale/ajax-bootstrap-select.pl-PL.min.js")
private val trixCss = require("trix/dist/trix.css")
private val trix = require("trix")
private val bootstrapDateTimePickerCss = require("bootstrap-datetime-picker/css/bootstrap-datetimepicker.min.css")
@@ -35,8 +36,12 @@ object KVManager {
private val bootstrapTouchspin = require("bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js")
internal val fecha = require("fecha")
- private val sdPatch = Snabbdom.init(arrayOf(classModule, attributesModule, propsModule, styleModule,
- eventListenersModule, datasetModule))
+ private val sdPatch = Snabbdom.init(
+ arrayOf(
+ classModule, attributesModule, propsModule, styleModule,
+ eventListenersModule, datasetModule
+ )
+ )
private val sdVirtualize = require("snabbdom-virtualize/strings").default
private val styleCss = require("./css/style.css")
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
index 8a7dfd15..28b0a076 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
@@ -349,8 +349,10 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent() {
return this.parent?.getRoot()
}
- protected open fun createLabelWithIcon(label: String, icon: String? = null,
- image: ResString? = null): Array<out Any> {
+ protected open fun createLabelWithIcon(
+ label: String, icon: String? = null,
+ image: ResString? = null
+ ): Array<out Any> {
return if (icon != null) {
if (icon.startsWith("fa-")) {
arrayOf(KVManager.virtualize("<i class='fa $icon fa-lg'></i>"), " " + label)
diff --git a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
index 019ee414..4dbceaea 100644
--- a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
@@ -2,15 +2,17 @@ package pl.treksoft.kvision.data
import com.github.snabbdom.VNode
import com.lightningkite.kotlin.observable.list.ObservableList
-import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Component
+import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.panel.VPanel
-class DataContainer<M : DataComponent, C : Widget>(val model: ObservableList<M>,
- private val binding: (M, Int) -> C,
- private val child: Container = VPanel()) :
- Widget(setOf()), Container, DataUpdatable {
+class DataContainer<M : DataComponent, C : Widget>(
+ val model: ObservableList<M>,
+ private val binding: (M, Int) -> C,
+ private val child: Container = VPanel()
+) :
+ Widget(setOf()), Container, DataUpdatable {
override var visible
get() = child.visible
diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
index 880cb436..53d722b1 100644
--- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
@@ -21,9 +21,11 @@ enum class DD(val type: String) {
SEPARATOR("DD#SEPARATOR")
}
-open class DropDown(text: String, elements: List<StringPair>? = null, icon: String? = null,
- style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT, disabled: Boolean = false,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class DropDown(
+ text: String, elements: List<StringPair>? = null, icon: String? = null,
+ style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT, disabled: Boolean = false,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var text
get() = button.text
set(value) {
@@ -71,8 +73,10 @@ open class DropDown(text: String, elements: List<StringPair>? = null, icon: Stri
}
private val idc = "kv_dropdown_" + counter
- internal val button: DropDownButton = DropDownButton(idc, text, icon, style,
- disabled, setOf("dropdown"))
+ internal val button: DropDownButton = DropDownButton(
+ idc, text, icon, style,
+ disabled, setOf("dropdown")
+ )
internal val list: DropDownListTag = DropDownListTag(idc, setOf("dropdown-menu"))
init {
@@ -172,22 +176,28 @@ open class DropDown(text: String, elements: List<StringPair>? = null, icon: Stri
}
}
-open class DropDownButton(id: String, text: String, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT,
- disabled: Boolean = false, classes: Set<String> = setOf()) :
- Button(text, icon, style, disabled, classes) {
+open class DropDownButton(
+ id: String, text: String, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT,
+ disabled: Boolean = false, classes: Set<String> = setOf()
+) :
+ Button(text, icon, style, disabled, classes) {
init {
this.id = id
}
override fun getSnAttrs(): List<StringPair> {
- return super.getSnAttrs() + listOf("data-toggle" to "dropdown", "aria-haspopup" to "true",
- "aria-expanded" to "false")
+ return super.getSnAttrs() + listOf(
+ "data-toggle" to "dropdown", "aria-haspopup" to "true",
+ "aria-expanded" to "false"
+ )
}
}
-open class DropDownListTag(private val ariaId: String, classes: Set<String> = setOf()) : ListTag(LIST.UL, null,
- false, classes) {
+open class DropDownListTag(private val ariaId: String, classes: Set<String> = setOf()) : ListTag(
+ LIST.UL, null,
+ false, classes
+) {
override fun getSnAttrs(): List<StringPair> {
return super.getSnAttrs() + listOf("aria-labelledby" to ariaId)
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt b/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt
index 9e9671ed..a28245d6 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt
@@ -4,9 +4,13 @@ import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
import pl.treksoft.kvision.snabbdom.StringPair
-open class FieldLabel(internal val forId: String, text: String? = null, rich: Boolean = false,
- classes: Set<String> = setOf("control-label")) : Tag(TAG.LABEL,
- text, rich, classes = classes) {
+open class FieldLabel(
+ internal val forId: String, text: String? = null, rich: Boolean = false,
+ classes: Set<String> = setOf("control-label")
+) : Tag(
+ TAG.LABEL,
+ text, rich, classes = classes
+) {
override fun getSnAttrs(): List<StringPair> {
return super.getSnAttrs() + ("for" to forId)
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/Form.kt b/src/main/kotlin/pl/treksoft/kvision/form/Form.kt
index 337152e3..91773bb6 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/Form.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/Form.kt
@@ -2,9 +2,11 @@ package pl.treksoft.kvision.form
import kotlin.js.Date
-data class FieldParams<in F : FormControl>(val required: Boolean = false,
- val validatorMessage: ((F) -> String?)? = null,
- val validator: ((F) -> Boolean?)? = null)
+data class FieldParams<in F : FormControl>(
+ val required: Boolean = false,
+ val validatorMessage: ((F) -> String?)? = null,
+ val validator: ((F) -> Boolean?)? = null
+)
open class Form<K>(private val panel: FormPanel<K>? = null, private val modelFactory: (Map<String, Any?>) -> K) {
@@ -13,9 +15,11 @@ open class Form<K>(private val panel: FormPanel<K>? = null, private val modelFac
internal var validatorMessage: ((Form<K>) -> String?)? = null
internal var validator: ((Form<K>) -> Boolean?)? = null
- open fun <C : FormControl> add(key: String, control: C, required: Boolean = false,
- validatorMessage: ((C) -> String?)? = null,
- validator: ((C) -> Boolean?)? = null): Form<K> {
+ open fun <C : FormControl> add(
+ key: String, control: C, required: Boolean = false,
+ validatorMessage: ((C) -> String?)? = null,
+ validator: ((C) -> Boolean?)? = null
+ ): Form<K> {
this.fields.put(key, control)
this.fieldsParams.put(key, FieldParams(required, validatorMessage, validator))
return this
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
index 65015f3f..31ab3ced 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
@@ -13,8 +13,10 @@ enum class FORMTYPE(val formType: String) {
HORIZONTAL("form-horizontal")
}
-open class FormPanel<K>(private val type: FORMTYPE? = null, classes: Set<String> = setOf(),
- modelFactory: (Map<String, Any?>) -> K) : SimplePanel(classes) {
+open class FormPanel<K>(
+ private val type: FORMTYPE? = null, classes: Set<String> = setOf(),
+ modelFactory: (Map<String, Any?>) -> K
+) : SimplePanel(classes) {
var validatorMessage
get() = form.validatorMessage
@@ -58,9 +60,11 @@ open class FormPanel<K>(private val type: FORMTYPE? = null, classes: Set<String>
return cl
}
- open fun <C : FormControl> add(key: String, control: C, required: Boolean = false,
- validatorMessage: ((C) -> String?)? = null,
- validator: ((C) -> Boolean?)? = null): FormPanel<K> {
+ open fun <C : FormControl> add(
+ key: String, control: C, required: Boolean = false,
+ validatorMessage: ((C) -> String?)? = null,
+ validator: ((C) -> Boolean?)? = null
+ ): FormPanel<K> {
if (type == FORMTYPE.HORIZONTAL) {
if (control is CheckBox || control is Radio) {
control.addCssClass("col-sm-offset-2")
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/HelpBlock.kt b/src/main/kotlin/pl/treksoft/kvision/form/HelpBlock.kt
index 44b2e7b0..dcfd185e 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/HelpBlock.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/HelpBlock.kt
@@ -3,5 +3,7 @@ package pl.treksoft.kvision.form
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
-open class HelpBlock(text: String? = null, rich: Boolean = false) : Tag(TAG.SPAN, text, rich,
- classes = setOf("help-block", "small"))
+open class HelpBlock(text: String? = null, rich: Boolean = false) : Tag(
+ TAG.SPAN, text, rich,
+ classes = setOf("help-block", "small")
+)
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt
index 62403f8a..4faee7e7 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt
@@ -17,8 +17,10 @@ enum class CHECKBOXSTYLE(val className: String) {
DANGER("checkbox-danger"),
}
-open class CheckBox(value: Boolean = false, label: String? = null,
- rich: Boolean = false) : SimplePanel(setOf("checkbox")), BoolFormControl {
+open class CheckBox(
+ value: Boolean = false, label: String? = null,
+ rich: Boolean = false
+) : SimplePanel(setOf("checkbox")), BoolFormControl {
override var value
get() = input.value
@@ -72,8 +74,10 @@ open class CheckBox(value: Boolean = false, label: String? = null,
}
private val idc = "kv_form_checkbox_" + counter
- final override val input: CheckInput = CheckInput(CHECKINPUTTYPE.CHECKBOX, value,
- setOf("styled")).apply { id = idc }
+ final override val input: CheckInput = CheckInput(
+ CHECKINPUTTYPE.CHECKBOX, value,
+ setOf("styled")
+ ).apply { id = idc }
final override val flabel: FieldLabel = FieldLabel(idc, label, rich, classes = setOf())
final override val validationInfo: HelpBlock = HelpBlock().apply { visible = false }
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt
index a2ebd06d..a3ccd126 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt
@@ -11,8 +11,10 @@ enum class CHECKINPUTTYPE(val type: String) {
RADIO("radio")
}
-open class CheckInput(type: CHECKINPUTTYPE = CHECKINPUTTYPE.CHECKBOX, value: Boolean = false,
- classes: Set<String> = setOf()) : Widget(classes) {
+open class CheckInput(
+ type: CHECKINPUTTYPE = CHECKINPUTTYPE.CHECKBOX, value: Boolean = false,
+ classes: Set<String> = setOf()
+) : Widget(classes) {
init {
this.setInternalEventListener<CheckInput> {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
index 696e2264..1ec63f60 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
@@ -17,8 +17,10 @@ enum class RADIOSTYLE(val className: String) {
DANGER("radio-danger"),
}
-open class Radio(value: Boolean = false, extraValue: String? = null, label: String? = null,
- rich: Boolean = false) : SimplePanel(), BoolFormControl {
+open class Radio(
+ value: Boolean = false, extraValue: String? = null, label: String? = null,
+ rich: Boolean = false
+) : SimplePanel(), BoolFormControl {
override var value
get() = input.value
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt
index df99dedf..fdf0e6a9 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt
@@ -10,9 +10,11 @@ import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.snabbdom.StringBoolPair
import pl.treksoft.kvision.snabbdom.StringPair
-open class RadioGroup(options: List<StringPair>? = null, value: String? = null, inline: Boolean = false,
- label: String? = null,
- rich: Boolean = false) : SimplePanel(setOf("form-group")), StringFormControl {
+open class RadioGroup(
+ options: List<StringPair>? = null, value: String? = null, inline: Boolean = false,
+ label: String? = null,
+ rich: Boolean = false
+) : SimplePanel(setOf("form-group")), StringFormControl {
internal var options = options
set(value) {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt
index d86e6899..0cff73db 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt
@@ -17,12 +17,14 @@ enum class DataType(val type: String) {
SCRIPT("script")
}
-data class AjaxOptions(val url: String, val processData: (dynamic) -> dynamic,
- val processParams: dynamic = null, val httpType: HttpType = HttpType.GET,
- val dataType: DataType = DataType.JSON, val minLength: Int = 0,
- val cache: Boolean = true, val clearOnEmpty: Boolean = true, val clearOnError: Boolean = true,
- val emptyRequest: Boolean = false, val preserveSelected: Boolean = true,
- val requestDelay: Int = AJAX_REQUEST_DELAY, val restoreOnError: Boolean = false)
+data class AjaxOptions(
+ val url: String, val processData: (dynamic) -> dynamic,
+ val processParams: dynamic = null, val httpType: HttpType = HttpType.GET,
+ val dataType: DataType = DataType.JSON, val minLength: Int = 0,
+ val cache: Boolean = true, val clearOnEmpty: Boolean = true, val clearOnError: Boolean = true,
+ val emptyRequest: Boolean = false, val preserveSelected: Boolean = true,
+ val requestDelay: Int = AJAX_REQUEST_DELAY, val restoreOnError: Boolean = false
+)
fun AjaxOptions.toJs(emptyOption: Boolean): dynamic {
val procData = { data: dynamic ->
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
index 2d750683..5f10191f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
@@ -11,9 +11,11 @@ import pl.treksoft.kvision.snabbdom.StringBoolPair
import pl.treksoft.kvision.snabbdom.StringPair
@Suppress("TooManyFunctions")
-open class Select(options: List<StringPair>? = null, value: String? = null,
- multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
- rich: Boolean = false) : SimplePanel(setOf("form-group")), StringFormControl {
+open class Select(
+ options: List<StringPair>? = null, value: String? = null,
+ multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
+ rich: Boolean = false
+) : SimplePanel(setOf("form-group")), StringFormControl {
var options
get() = input.options
@@ -102,8 +104,10 @@ open class Select(options: List<StringPair>? = null, value: String? = null,
}
private val idc = "kv_form_select_" + counter
- final override val input: SelectInput = SelectInput(options, value, multiple, ajaxOptions,
- setOf("form-control")).apply { id = idc }
+ final override val input: SelectInput = SelectInput(
+ options, value, multiple, ajaxOptions,
+ setOf("form-control")
+ ).apply { id = idc }
final override val flabel: FieldLabel = FieldLabel(idc, label, rich)
final override val validationInfo: HelpBlock = HelpBlock().apply { visible = false }
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
index 2dcbe99b..9e35fb6b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
@@ -1,9 +1,9 @@
package pl.treksoft.kvision.form.select
import com.github.snabbdom.VNode
+import pl.treksoft.kvision.core.Component
import pl.treksoft.kvision.core.CssSize
import pl.treksoft.kvision.core.KVManager.KVNULL
-import pl.treksoft.kvision.core.Component
import pl.treksoft.kvision.form.INPUTSIZE
import pl.treksoft.kvision.html.BUTTONSTYLE
import pl.treksoft.kvision.panel.SimplePanel
@@ -17,9 +17,11 @@ enum class SELECTWIDTHTYPE(val value: String) {
}
@Suppress("TooManyFunctions")
-open class SelectInput(options: List<StringPair>? = null, value: String? = null,
- multiple: Boolean = false, ajaxOptions: AjaxOptions? = null,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class SelectInput(
+ options: List<StringPair>? = null, value: String? = null,
+ multiple: Boolean = false, ajaxOptions: AjaxOptions? = null,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
internal var options = options
set(value) {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
index 38a578fe..cfd2be19 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
@@ -4,8 +4,10 @@ import com.github.snabbdom.VNode
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.snabbdom.StringPair
-open class SelectOptGroup(label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
- disabled: Boolean = false, classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class SelectOptGroup(
+ label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
+ disabled: Boolean = false, classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var label: String = label
set(value) {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
index 3ff44c61..020d8f4b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
@@ -4,9 +4,11 @@ import com.github.snabbdom.VNode
import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.snabbdom.StringPair
-open class SelectOption(value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
- divider: Boolean = false, disabled: Boolean = false,
- classes: Set<String> = setOf()) : Widget(classes) {
+open class SelectOption(
+ value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
+ divider: Boolean = false, disabled: Boolean = false,
+ classes: Set<String> = setOf()
+) : Widget(classes) {
var value: String? = value
set(value) {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
index c6084fa8..5e2c460b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
@@ -8,10 +8,12 @@ import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.snabbdom.SnOn
import pl.treksoft.kvision.snabbdom.StringBoolPair
-open class Spinner(value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX, step: Double = DEFAULT_STEP,
- decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
- forceType: FORCETYPE = FORCETYPE.NONE, label: String? = null,
- rich: Boolean = false) : SimplePanel(setOf("form-group")), NumberFormControl {
+open class Spinner(
+ value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX, step: Double = DEFAULT_STEP,
+ decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
+ forceType: FORCETYPE = FORCETYPE.NONE, label: String? = null,
+ rich: Boolean = false
+) : SimplePanel(setOf("form-group")), NumberFormControl {
override var value
get() = input.value
@@ -91,7 +93,7 @@ open class Spinner(value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX,
protected val idc = "kv_form_spinner_" + counter
final override val input: SpinnerInput = SpinnerInput(value, min, max, step, decimals, buttonsType, forceType)
- .apply { id = idc }
+ .apply { id = idc }
final override val flabel: FieldLabel = FieldLabel(idc, label, rich)
final override val validationInfo: HelpBlock = HelpBlock().apply { visible = false }
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
index b7d0f959..139a8ba9 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
@@ -25,10 +25,12 @@ const val DEFAULT_STEP = 1.0
const val DEFAULT_MAX = 100
@Suppress("TooManyFunctions")
-open class SpinnerInput(value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX, step: Double = DEFAULT_STEP,
- decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
- forceType: FORCETYPE = FORCETYPE.NONE,
- classes: Set<String> = setOf()) : Widget(classes + "form-control") {
+open class SpinnerInput(
+ value: Number? = null, min: Int = 0, max: Int = DEFAULT_MAX, step: Double = DEFAULT_STEP,
+ decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
+ forceType: FORCETYPE = FORCETYPE.NONE,
+ classes: Set<String> = setOf()
+) : Widget(classes + "form-control") {
init {
this.addSurroundingCssClass("input-group")
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt
index 8dd2a241..48b8d201 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt
@@ -9,7 +9,7 @@ import pl.treksoft.kvision.snabbdom.SnOn
import pl.treksoft.kvision.snabbdom.StringBoolPair
abstract class AbstractText(label: String? = null, rich: Boolean = false) :
- SimplePanel(setOf("form-group")), StringFormControl {
+ SimplePanel(setOf("form-group")), StringFormControl {
override var value
get() = input.value
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt
index 88614774..85cf6cf7 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt
@@ -6,8 +6,10 @@ import pl.treksoft.kvision.form.INPUTSIZE
import pl.treksoft.kvision.snabbdom.StringBoolPair
import pl.treksoft.kvision.snabbdom.StringPair
-abstract class AbstractTextInput(value: String? = null,
- classes: Set<String> = setOf()) : Widget(classes) {
+abstract class AbstractTextInput(
+ value: String? = null,
+ classes: Set<String> = setOf()
+) : Widget(classes) {
init {
this.setInternalEventListener<AbstractTextInput> {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt
index c5b8e622..cbdd7adf 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt
@@ -1,4 +1,6 @@
package pl.treksoft.kvision.form.text
-open class Password(value: String? = null, label: String? = null, rich: Boolean = false) : Text(TEXTINPUTTYPE.PASSWORD,
- value, label, rich)
+open class Password(value: String? = null, label: String? = null, rich: Boolean = false) : Text(
+ TEXTINPUTTYPE.PASSWORD,
+ value, label, rich
+)
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
index 280c017d..6e1f8929 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
@@ -1,7 +1,9 @@
package pl.treksoft.kvision.form.text
-open class RichText(value: String? = null,
- label: String? = null, rich: Boolean = false) : AbstractText(label, rich) {
+open class RichText(
+ value: String? = null,
+ label: String? = null, rich: Boolean = false
+) : AbstractText(label, rich) {
var inputHeight
get() = input.height
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
index 5f791c94..c96bc371 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
@@ -6,7 +6,7 @@ import pl.treksoft.kvision.snabbdom.StringPair
import kotlin.browser.document
open class RichTextInput(value: String? = null, classes: Set<String> = setOf()) :
- AbstractTextInput(value, classes + "form-control" + "trix-control") {
+ AbstractTextInput(value, classes + "form-control" + "trix-control") {
private var trixId: String? = null
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt
index db3233ba..a17c1b5d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt
@@ -1,8 +1,10 @@
package pl.treksoft.kvision.form.text
-open class Text(type: TEXTINPUTTYPE = TEXTINPUTTYPE.TEXT, value: String? = null,
- label: String? = null, rich: Boolean = false) : AbstractText(label, rich) {
+open class Text(
+ type: TEXTINPUTTYPE = TEXTINPUTTYPE.TEXT, value: String? = null,
+ label: String? = null, rich: Boolean = false
+) : AbstractText(label, rich) {
var type
get() = input.type
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt
index 181298ac..e45d990d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt
@@ -1,7 +1,9 @@
package pl.treksoft.kvision.form.text
-open class TextArea(cols: Int? = null, rows: Int? = null, value: String? = null,
- label: String? = null, rich: Boolean = false) : AbstractText(label, rich) {
+open class TextArea(
+ cols: Int? = null, rows: Int? = null, value: String? = null,
+ label: String? = null, rich: Boolean = false
+) : AbstractText(label, rich) {
var cols
get() = input.cols
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt
index 2b5ff31d..01b531fb 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt
@@ -4,7 +4,7 @@ import com.github.snabbdom.VNode
import pl.treksoft.kvision.snabbdom.StringPair
open class TextAreaInput(cols: Int? = null, rows: Int? = null, value: String? = null, classes: Set<String> = setOf()) :
- AbstractTextInput(value, classes + "form-control") {
+ AbstractTextInput(value, classes + "form-control") {
var cols: Int? = cols
set(value) {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt
index 3cd86e04..d735c82e 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt
@@ -9,7 +9,7 @@ enum class TEXTINPUTTYPE(val type: String) {
}
open class TextInput(type: TEXTINPUTTYPE = TEXTINPUTTYPE.TEXT, value: String? = null, classes: Set<String> = setOf()) :
- AbstractTextInput(value, classes + "form-control") {
+ AbstractTextInput(value, classes + "form-control") {
var type: TEXTINPUTTYPE = type
set(value) {
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt b/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
index 892467b7..db9fdeb1 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
@@ -9,8 +9,10 @@ import pl.treksoft.kvision.snabbdom.SnOn
import pl.treksoft.kvision.snabbdom.StringBoolPair
import kotlin.js.Date
-open class DateTime(value: Date? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
- rich: Boolean = false) : SimplePanel(setOf("form-group")), DateFormControl {
+open class DateTime(
+ value: Date? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
+ rich: Boolean = false
+) : SimplePanel(setOf("form-group")), DateFormControl {
override var value
get() = input.value
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
index 8db66834..a7aa758b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
@@ -14,8 +14,10 @@ const val DEFAULT_MINUTE_STEP = 5
const val MAX_VIEW = 4
@Suppress("TooManyFunctions")
-open class DateTimeInput(value: Date? = null, format: String = "YYYY-MM-DD HH:mm",
- classes: Set<String> = setOf()) : Widget(classes + "form-control") {
+open class DateTimeInput(
+ value: Date? = null, format: String = "YYYY-MM-DD HH:mm",
+ classes: Set<String> = setOf()
+) : Widget(classes + "form-control") {
init {
@@ -221,8 +223,8 @@ open class DateTimeInput(value: Date? = null, format: String = "YYYY-MM-DD HH:mm
companion object {
private fun String.toDatePickerFormat(): String {
return this.replace("YY", "yy").replace("m", "i").replace("MMMM", "{----}").replace("MMM", "{---}")
- .replace("M", "m").replace("{----}", "MM").replace("{---}", "M").replace("H", "{-}")
- .replace("h", "H").replace("{-}", "h").replace("D", "d").replace("a", "p").replace("A", "P")
+ .replace("M", "m").replace("{----}", "MM").replace("{---}", "M").replace("H", "{-}")
+ .replace("h", "H").replace("{-}", "h").replace("D", "d").replace("a", "p").replace("A", "P")
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
index d14ce66e..ec0fd881 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
@@ -22,8 +22,10 @@ enum class BUTTONSIZE(val className: String) {
XSMALL("btn-xs")
}
-open class Button(text: String, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT,
- disabled: Boolean = false, classes: Set<String> = setOf()) : Widget(classes) {
+open class Button(
+ text: String, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT,
+ disabled: Boolean = false, classes: Set<String> = setOf()
+) : Widget(classes) {
var text = text
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
index 7097bdab..913735ef 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
@@ -12,8 +12,10 @@ enum class IMAGESHAPE(val className: String) {
THUMBNAIL("img-thumbnail")
}
-open class Image(src: ResString, alt: String? = null, responsive: Boolean = false, shape: IMAGESHAPE? = null,
- centered: Boolean = false, classes: Set<String> = setOf()) : Widget(classes) {
+open class Image(
+ src: ResString, alt: String? = null, responsive: Boolean = false, shape: IMAGESHAPE? = null,
+ centered: Boolean = false, classes: Set<String> = setOf()
+) : Widget(classes) {
internal var src = src
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Link.kt b/src/main/kotlin/pl/treksoft/kvision/html/Link.kt
index f103323b..c61e8a79 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Link.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Link.kt
@@ -1,12 +1,14 @@
package pl.treksoft.kvision.html
import com.github.snabbdom.VNode
-import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.core.ResString
+import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.snabbdom.StringPair
-open class Link(label: String, url: String, icon: String? = null, image: ResString? = null,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class Link(
+ label: String, url: String, icon: String? = null, image: ResString? = null,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
private var label = label
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/List.kt b/src/main/kotlin/pl/treksoft/kvision/html/List.kt
index 40ebc50b..eb006a33 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/List.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/List.kt
@@ -2,8 +2,8 @@ package pl.treksoft.kvision.html
import com.github.snabbdom.VNode
import com.github.snabbdom.h
-import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.core.KVManager
+import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.snabbdom.StringBoolPair
enum class LIST(val tagName: String) {
@@ -15,8 +15,10 @@ enum class LIST(val tagName: String) {
DL_HORIZ("dl")
}
-open class ListTag(type: LIST, elements: List<String>? = null, rich: Boolean = false,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class ListTag(
+ type: LIST, elements: List<String>? = null, rich: Boolean = false,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var type = type
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
index 71856627..ff22e440 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
@@ -1,8 +1,8 @@
package pl.treksoft.kvision.html
import com.github.snabbdom.VNode
-import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.core.KVManager
+import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.snabbdom.StringBoolPair
@Suppress("EnumNaming")
@@ -49,8 +49,10 @@ enum class ALIGN(val className: String) {
NOWRAP("text-nowrap")
}
-open class Tag(type: TAG, text: String? = null, rich: Boolean = false, align: ALIGN? = null,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class Tag(
+ type: TAG, text: String? = null, rich: Boolean = false, align: ALIGN? = null,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var type = type
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
index 39268ffa..5b8932cb 100644
--- a/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
@@ -7,9 +7,11 @@ import pl.treksoft.kvision.html.Button
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
-open class Alert(caption: String? = null, text: String? = null, rich: Boolean = false,
- align: ALIGN? = null, size: MODALSIZE? = null, animation: Boolean = true,
- private val callback: (() -> Unit)? = null) : Modal(caption, true, size, animation) {
+open class Alert(
+ caption: String? = null, text: String? = null, rich: Boolean = false,
+ align: ALIGN? = null, size: MODALSIZE? = null, animation: Boolean = true,
+ private val callback: (() -> Unit)? = null
+) : Modal(caption, true, size, animation) {
var text
get() = content.text
set(value) {
@@ -47,9 +49,11 @@ open class Alert(caption: String? = null, text: String? = null, rich: Boolean =
companion object {
@Suppress("LongParameterList")
- fun show(caption: String? = null, text: String? = null, rich: Boolean = false,
- align: ALIGN? = null, size: MODALSIZE? = null, animation: Boolean = true,
- callback: (() -> Unit)? = null) {
+ fun show(
+ caption: String? = null, text: String? = null, rich: Boolean = false,
+ align: ALIGN? = null, size: MODALSIZE? = null, animation: Boolean = true,
+ callback: (() -> Unit)? = null
+ ) {
Alert(caption, text, rich, align, size, animation, callback).show()
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt
index 90766854..05550f34 100644
--- a/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt
@@ -6,11 +6,13 @@ import pl.treksoft.kvision.html.Button
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
-open class Confirm(caption: String? = null, text: String? = null, rich: Boolean = false,
- align: ALIGN? = null, size: MODALSIZE? = null, animation: Boolean = true,
- cancelVisible: Boolean = false,
- private val noCallback: (() -> Unit)? = null,
- private val yesCallback: (() -> Unit)? = null) : Modal(caption, false, size, animation, false) {
+open class Confirm(
+ caption: String? = null, text: String? = null, rich: Boolean = false,
+ align: ALIGN? = null, size: MODALSIZE? = null, animation: Boolean = true,
+ cancelVisible: Boolean = false,
+ private val noCallback: (() -> Unit)? = null,
+ private val yesCallback: (() -> Unit)? = null
+) : Modal(caption, false, size, animation, false) {
var text
get() = content.text
set(value) {
@@ -74,10 +76,12 @@ open class Confirm(caption: String? = null, text: String? = null, rich: Boolean
companion object {
@Suppress("LongParameterList")
- fun show(caption: String? = null, text: String? = null, rich: Boolean = false,
- align: ALIGN? = null, size: MODALSIZE? = null, animation: Boolean = true,
- cancelVisible: Boolean = false,
- noCallback: (() -> Unit)? = null, yesCallback: (() -> Unit)? = null) {
+ fun show(
+ caption: String? = null, text: String? = null, rich: Boolean = false,
+ align: ALIGN? = null, size: MODALSIZE? = null, animation: Boolean = true,
+ cancelVisible: Boolean = false,
+ noCallback: (() -> Unit)? = null, yesCallback: (() -> Unit)? = null
+ ) {
Confirm(caption, text, rich, align, size, animation, cancelVisible, noCallback, yesCallback).show()
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
index 08d56f4c..2c83077a 100644
--- a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
@@ -19,9 +19,11 @@ enum class MODALSIZE(val className: String) {
}
@Suppress("TooManyFunctions")
-open class Modal(caption: String? = null, closeButton: Boolean = true,
- size: MODALSIZE? = null, animation: Boolean = true, private val escape: Boolean = true,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class Modal(
+ caption: String? = null, closeButton: Boolean = true,
+ size: MODALSIZE? = null, animation: Boolean = true, private val escape: Boolean = true,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
private var caption
get() = captionTag.text
set(value) {
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt
index 376e34b9..e9670c1a 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt
@@ -17,8 +17,10 @@ open class DockPanel(classes: Set<String> = setOf()) : SimplePanel(classes = cla
protected var up: Component? = null
protected var down: Component? = null
- protected val mainContainer = FlexPanel(direction = FLEXDIR.COLUMN, justify = FLEXJUSTIFY.SPACEBETWEEN,
- alignItems = FLEXALIGNITEMS.STRETCH)
+ protected val mainContainer = FlexPanel(
+ direction = FLEXDIR.COLUMN, justify = FLEXJUSTIFY.SPACEBETWEEN,
+ alignItems = FLEXALIGNITEMS.STRETCH
+ )
protected val subContainer = FlexPanel(justify = FLEXJUSTIFY.SPACEBETWEEN, alignItems = FLEXALIGNITEMS.CENTER)
init {
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt
index 80eddb23..86f1abc9 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt
@@ -43,9 +43,11 @@ enum class FLEXALIGNCONTENT(val alignContent: String) {
STRETCH("stretch")
}
-open class FlexPanel(direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify: FLEXJUSTIFY? = null,
- alignItems: FLEXALIGNITEMS? = null, alignContent: FLEXALIGNCONTENT? = null,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class FlexPanel(
+ direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify: FLEXJUSTIFY? = null,
+ alignItems: FLEXALIGNITEMS? = null, alignContent: FLEXALIGNCONTENT? = null,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var direction = direction
set(value) {
field = value
@@ -73,8 +75,10 @@ open class FlexPanel(direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify
}
@Suppress("LongParameterList")
- fun add(child: Component, order: Int? = null, grow: Int? = null, shrink: Int? = null,
- basis: Int? = null, alignSelf: FLEXALIGNITEMS? = null, classes: Set<String> = setOf()): FlexPanel {
+ fun add(
+ child: Component, order: Int? = null, grow: Int? = null, shrink: Int? = null,
+ basis: Int? = null, alignSelf: FLEXALIGNITEMS? = null, classes: Set<String> = setOf()
+ ): FlexPanel {
addInternal(FlexWrapper(child, order, grow, shrink, basis, alignSelf, classes))
return this
}
@@ -128,10 +132,12 @@ open class FlexPanel(direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify
}
}
-class FlexWrapper(delegate: Component, private val order: Int? = null, private val grow: Int? = null,
- private val shrink: Int? = null, private val basis: Int? = null,
- private val alignSelf: FLEXALIGNITEMS? = null,
- classes: Set<String> = setOf()) : WidgetWrapper(delegate, classes) {
+class FlexWrapper(
+ delegate: Component, private val order: Int? = null, private val grow: Int? = null,
+ private val shrink: Int? = null, private val basis: Int? = null,
+ private val alignSelf: FLEXALIGNITEMS? = null,
+ classes: Set<String> = setOf()
+) : WidgetWrapper(delegate, classes) {
override fun getSnStyle(): List<StringPair> {
val snstyle = super.getSnStyle().toMutableList()
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt
index dac5867c..3b226102 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt
@@ -45,11 +45,13 @@ enum class GRIDFLOW(val flow: String) {
COLUMNDENSE("column dense")
}
-open class GridPanel(autoColumns: String? = null, autoRows: String? = null, autoFlow: GRIDFLOW? = null,
- templateColumns: String? = null, templateRows: String? = null, templateAreas: List<String>? = null,
- columnGap: Int? = null, rowGap: Int? = null, justifyItems: GRIDJUSTIFY? = null,
- alignItems: GRIDALIGN? = null, justifyContent: GRIDJUSTIFYCONTENT? = null,
- alignContent: GRIDALIGNCONTENT? = null, classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class GridPanel(
+ autoColumns: String? = null, autoRows: String? = null, autoFlow: GRIDFLOW? = null,
+ templateColumns: String? = null, templateRows: String? = null, templateAreas: List<String>? = null,
+ columnGap: Int? = null, rowGap: Int? = null, justifyItems: GRIDJUSTIFY? = null,
+ alignItems: GRIDALIGN? = null, justifyContent: GRIDJUSTIFYCONTENT? = null,
+ alignContent: GRIDALIGNCONTENT? = null, classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var autoColumns = autoColumns
set(value) {
field = value
@@ -112,9 +114,11 @@ open class GridPanel(autoColumns: String? = null, autoRows: String? = null, auto
}
@Suppress("LongParameterList")
- fun add(child: Component, columnStart: Int? = null, rowStart: Int? = null,
- columnEnd: String? = null, rowEnd: String? = null, area: String? = null, justifySelf: GRIDJUSTIFY? = null,
- alignSelf: GRIDALIGN? = null, classes: Set<String> = setOf()): GridPanel {
+ fun add(
+ child: Component, columnStart: Int? = null, rowStart: Int? = null,
+ columnEnd: String? = null, rowEnd: String? = null, area: String? = null, justifySelf: GRIDJUSTIFY? = null,
+ alignSelf: GRIDALIGN? = null, classes: Set<String> = setOf()
+ ): GridPanel {
addInternal(GridWrapper(child, columnStart, rowStart, columnEnd, rowEnd, area, justifySelf, alignSelf, classes))
return this
}
@@ -190,11 +194,13 @@ open class GridPanel(autoColumns: String? = null, autoRows: String? = null, auto
}
}
-class GridWrapper(delegate: Component, private val columnStart: Int? = null, private val rowStart: Int? = null,
- private val columnEnd: String? = null, private val rowEnd: String? = null,
- private val area: String? = null, private val justifySelf: GRIDJUSTIFY? = null,
- private val alignSelf: GRIDALIGN? = null,
- classes: Set<String> = setOf()) : WidgetWrapper(delegate, classes) {
+class GridWrapper(
+ delegate: Component, private val columnStart: Int? = null, private val rowStart: Int? = null,
+ private val columnEnd: String? = null, private val rowEnd: String? = null,
+ private val area: String? = null, private val justifySelf: GRIDJUSTIFY? = null,
+ private val alignSelf: GRIDALIGN? = null,
+ classes: Set<String> = setOf()
+) : WidgetWrapper(delegate, classes) {
override fun getSnStyle(): List<StringPair> {
val snstyle = super.getSnStyle().toMutableList()
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
index c9317374..93d60f1d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
@@ -1,5 +1,9 @@
package pl.treksoft.kvision.panel
-open class HPanel(justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null,
- classes: Set<String> = setOf()) : FlexPanel(null,
- null, justify, alignItems, null, classes)
+open class HPanel(
+ justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null,
+ classes: Set<String> = setOf()
+) : FlexPanel(
+ null,
+ null, justify, alignItems, null, classes
+)
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
index 88d70a64..740a208f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
@@ -17,9 +17,11 @@ const val MAX_COLUMNS = 12
internal data class WidgetParam(val widget: Component, val size: Int, val offset: Int)
-open class ResponsiveGridPanel(private val gridsize: GRIDSIZE = GRIDSIZE.MD,
- private var rows: Int = 0, private var cols: Int = 0, align: ALIGN? = null,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class ResponsiveGridPanel(
+ private val gridsize: GRIDSIZE = GRIDSIZE.MD,
+ private var rows: Int = 0, private var cols: Int = 0, align: ALIGN? = null,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
protected var align = align
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
index 90362127..51c42a06 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
@@ -1,8 +1,8 @@
package pl.treksoft.kvision.panel
import com.github.snabbdom.VNode
-import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Component
+import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Widget
open class SimplePanel(classes: Set<String> = setOf()) : Widget(classes), Container {
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
index b8c9c580..4f06a38f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
@@ -13,8 +13,10 @@ enum class DIRECTION(val dir: String) {
VERTICAL("vertical")
}
-open class SplitPanel(private val direction: DIRECTION = DIRECTION.VERTICAL,
- classes: Set<String> = setOf()) : SimplePanel(classes + ("splitpanel-" + direction.dir)) {
+open class SplitPanel(
+ private val direction: DIRECTION = DIRECTION.VERTICAL,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes + ("splitpanel-" + direction.dir)) {
@Suppress("LeakingThis")
internal val splitter = Splitter(this, direction)
@@ -56,8 +58,10 @@ open class SplitPanel(private val direction: DIRECTION = DIRECTION.VERTICAL,
}
}
-class Splitter(private val splitPanel: SplitPanel, direction: DIRECTION) : Tag(TAG.DIV,
- classes = setOf("splitter-" + direction.dir)) {
+class Splitter(private val splitPanel: SplitPanel, direction: DIRECTION) : Tag(
+ TAG.DIV,
+ classes = setOf("splitter-" + direction.dir)
+) {
private val idc = "kv_splitter_" + counter
init {
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
index 55bd2cca..1d4b1b68 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
@@ -3,8 +3,10 @@ package pl.treksoft.kvision.panel
import com.github.snabbdom.VNode
import pl.treksoft.kvision.core.Component
-open class StackPanel(private val activateLast: Boolean = true,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class StackPanel(
+ private val activateLast: Boolean = true,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var activeIndex = -1
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
index e60d9480..72063be0 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
@@ -25,8 +25,10 @@ open class TabPanel : SimplePanel(setOf()) {
this.addInternal(content)
}
- open fun addTab(title: String, panel: Component, icon: String? = null,
- image: ResString? = null): TabPanel {
+ open fun addTab(
+ title: String, panel: Component, icon: String? = null,
+ image: ResString? = null
+ ): TabPanel {
val tag = Tag(TAG.LI)
tag.role = "presentation"
tag.add(Link(title, "#", icon, image))
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
index 42e33637..883d9d75 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
@@ -1,5 +1,9 @@
package pl.treksoft.kvision.panel
-open class VPanel(justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null,
- classes: Set<String> = setOf()) : FlexPanel(FLEXDIR.COLUMN,
- null, justify, alignItems, null, classes)
+open class VPanel(
+ justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null,
+ classes: Set<String> = setOf()
+) : FlexPanel(
+ FLEXDIR.COLUMN,
+ null, justify, alignItems, null, classes
+)