Add include on form element

This commit is contained in:
2017-08-01 19:30:32 +02:00
parent 154fa0cc26
commit 30c360e4cc
5 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="komp" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.version="0.0.3-SNAPSHOT" type="JAVA_MODULE" version="4">
<module external.linked.project.id="komp" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.version="0.0.5-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../..">

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="komp:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.type="sourceSet" external.system.module.version="0.0.3-SNAPSHOT" type="JAVA_MODULE" version="4">
<module external.linked.project.id="komp:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.type="sourceSet" external.system.module.version="0.0.5-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="2" platform="JavaScript " useProjectSettings="false">

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="komp:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.type="sourceSet" external.system.module.version="0.0.3-SNAPSHOT" type="JAVA_MODULE" version="4">
<module external.linked.project.id="komp:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.type="sourceSet" external.system.module.version="0.0.5-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="2" platform="JavaScript " useProjectSettings="false">

View File

@@ -1,5 +1,5 @@
group 'nl.astraeus'
version '0.0.4-SNAPSHOT'
version '0.0.5-SNAPSHOT'
apply plugin: 'kotlin2js'
apply plugin: 'idea'

View File

@@ -1,6 +1,7 @@
package nl.astraeus.komp
import kotlinx.html.DIV
import kotlinx.html.FORM
import kotlinx.html.TagConsumer
import kotlinx.html.dom.create
import org.w3c.dom.HTMLElement
@@ -13,6 +14,13 @@ fun DIV.include(component: Komponent) {
Komponent.define(result, component)
}
fun FORM.include(component: Komponent) {
val result = component.render(this.consumer as TagConsumer<HTMLElement>)
component.element = result
Komponent.define(result, component)
}
abstract class Komponent {
var element: HTMLElement? = null
var rendered = false