Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| edb6d0ab49 | |||
| 8bbbd1d7dc |
64 changed files with 268 additions and 181 deletions
|
|
@ -4,3 +4,8 @@ plugins {
|
||||||
alias(libs.plugins.android.library) apply false
|
alias(libs.plugins.android.library) apply false
|
||||||
alias(libs.plugins.kotlin.compose) apply false
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
version = "0.1.0"
|
||||||
|
group = "de.thetadev.formconductor"
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.library")
|
id("com.android.library")
|
||||||
alias(libs.plugins.kotlin.compose)
|
alias(libs.plugins.kotlin.compose)
|
||||||
|
`maven-publish`
|
||||||
}
|
}
|
||||||
android {
|
android {
|
||||||
namespace = "me.naingaungluu.formconductor.composeui"
|
namespace = "de.thetadev.formconductor.composeui"
|
||||||
compileSdk = 37
|
compileSdk = 37
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
|
@ -49,3 +50,15 @@ dependencies {
|
||||||
api(libs.androidx.compose.ui)
|
api(libs.androidx.compose.ui)
|
||||||
api(libs.androidx.compose.runtime)
|
api(libs.androidx.compose.runtime)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply(from = "$rootDir/scripts/publish-root.gradle.kts")
|
||||||
|
afterEvaluate {
|
||||||
|
configure<PublishingExtension> {
|
||||||
|
publications {
|
||||||
|
register<MavenPublication>("release") {
|
||||||
|
artifactId = "compose-ui"
|
||||||
|
from(components["release"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,25 @@
|
||||||
-keepclassmembers class * extends me.naingaungluu.formconductor.validation.rules.ValidationRule {
|
-keepclassmembers class * extends de.thetadev.formconductor.validation.rules.ValidationRule {
|
||||||
<methods>;
|
<methods>;
|
||||||
public static <fields>;
|
public static <fields>;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Keep classes and properties annotated with @Form
|
# Keep classes and properties annotated with @Form
|
||||||
-if @me.naingaungluu.formconductor.annotations.Form class **
|
-if @de.thetadev.formconductor.annotations.Form class **
|
||||||
-keepclassmembers,allowobfuscation,allowoptimization class <1> {
|
-keepclassmembers,allowobfuscation,allowoptimization class <1> {
|
||||||
<init>(...);
|
<init>(...);
|
||||||
<fields>;
|
<fields>;
|
||||||
}
|
}
|
||||||
|
|
||||||
# keep all the classes referenced in the @Form class
|
# keep all the classes referenced in the @Form class
|
||||||
-if @me.naingaungluu.formconductor.annotations.Form class ** {
|
-if @de.thetadev.formconductor.annotations.Form class ** {
|
||||||
** *;
|
** *;
|
||||||
}
|
}
|
||||||
-keep,allowoptimization,allowshrinking class <1> {
|
-keep,allowoptimization,allowshrinking class <1> {
|
||||||
<init>(...);
|
<init>(...);
|
||||||
<fields>;
|
<fields>;
|
||||||
}
|
}
|
||||||
-keep @me.naingaungluu.formconductor.annotations.Form class * { *; }
|
-keep @de.thetadev.formconductor.annotations.Form class * { *; }
|
||||||
-keep class me.naingaungluu.formconductor.** { *; }
|
-keep class de.thetadev.formconductor.** { *; }
|
||||||
|
|
||||||
# Keep kotlin.Metadata annotations to maintain metadata on kept items
|
# Keep kotlin.Metadata annotations to maintain metadata on kept items
|
||||||
-keepattributes *Annotation*,Signature,InnerClasses
|
-keepattributes *Annotation*,Signature,InnerClasses
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package me.naingaungluu.formconductor.composeui
|
package de.thetadev.formconductor.composeui
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.derivedStateOf
|
import androidx.compose.runtime.derivedStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import me.naingaungluu.formconductor.Form
|
import de.thetadev.formconductor.Form
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
import me.naingaungluu.formconductor.FormImpl
|
import de.thetadev.formconductor.FormImpl
|
||||||
import me.naingaungluu.formconductor.composeui.scope.FormFieldScope
|
import de.thetadev.formconductor.composeui.scope.FormFieldScope
|
||||||
import me.naingaungluu.formconductor.composeui.scope.FormFieldScopeImpl
|
import de.thetadev.formconductor.composeui.scope.FormFieldScopeImpl
|
||||||
import me.naingaungluu.formconductor.composeui.scope.FormScope
|
import de.thetadev.formconductor.composeui.scope.FormScope
|
||||||
import me.naingaungluu.formconductor.composeui.scope.FormScopeImpl
|
import de.thetadev.formconductor.composeui.scope.FormScopeImpl
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package me.naingaungluu.formconductor.composeui.scope
|
package de.thetadev.formconductor.composeui.scope
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scope interface for FormField objects
|
* A scope interface for FormField objects
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package me.naingaungluu.formconductor.composeui.scope
|
package de.thetadev.formconductor.composeui.scope
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
|
|
||||||
internal class FormFieldScopeImpl<V>(
|
internal class FormFieldScopeImpl<V>(
|
||||||
private val formField: FormField<V>
|
private val formField: FormField<V>
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package me.naingaungluu.formconductor.composeui.scope
|
package de.thetadev.formconductor.composeui.scope
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
import me.naingaungluu.formconductor.FormResult
|
import de.thetadev.formconductor.FormResult
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package me.naingaungluu.formconductor.composeui.scope
|
package de.thetadev.formconductor.composeui.scope
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
import me.naingaungluu.formconductor.FormImpl
|
import de.thetadev.formconductor.FormImpl
|
||||||
import me.naingaungluu.formconductor.FormResult
|
import de.thetadev.formconductor.FormResult
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
internal class FormScopeImpl<T : Any>(
|
internal class FormScopeImpl<T : Any>(
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("java-library")
|
id("java-library")
|
||||||
alias(libs.plugins.jetbrains.kotlin.jvm)
|
alias(libs.plugins.jetbrains.kotlin.jvm)
|
||||||
|
`maven-publish`
|
||||||
}
|
}
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
|
@ -16,3 +17,15 @@ dependencies {
|
||||||
implementation(libs.kotlin.reflect)
|
implementation(libs.kotlin.reflect)
|
||||||
implementation(libs.kotlinx.coroutines.core)
|
implementation(libs.kotlinx.coroutines.core)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply(from = "$rootDir/scripts/publish-root.gradle.kts")
|
||||||
|
afterEvaluate {
|
||||||
|
configure<PublishingExtension> {
|
||||||
|
publications {
|
||||||
|
register<MavenPublication>("java") {
|
||||||
|
artifactId = "core"
|
||||||
|
from(components["java"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor
|
package de.thetadev.formconductor
|
||||||
|
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor
|
package de.thetadev.formconductor
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.ValidationRule
|
import de.thetadev.formconductor.validation.rules.ValidationRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns after a field validation as a result
|
* Returns after a field validation as a result
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor
|
package de.thetadev.formconductor
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor
|
package de.thetadev.formconductor
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package me.naingaungluu.formconductor
|
package de.thetadev.formconductor
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import me.naingaungluu.formconductor.validation.optionalFlags.OptionalFlag
|
import de.thetadev.formconductor.validation.optionalFlags.OptionalFlag
|
||||||
import me.naingaungluu.formconductor.validation.rules.OptionalRule
|
import de.thetadev.formconductor.validation.rules.OptionalRule
|
||||||
import me.naingaungluu.formconductor.validation.validators.FieldValidator
|
import de.thetadev.formconductor.validation.validators.FieldValidator
|
||||||
import me.naingaungluu.formconductor.validation.validators.StatelessFieldValidator
|
import de.thetadev.formconductor.validation.validators.StatelessFieldValidator
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
package me.naingaungluu.formconductor
|
package de.thetadev.formconductor
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.asSharedFlow
|
import kotlinx.coroutines.flow.asSharedFlow
|
||||||
import kotlinx.coroutines.flow.combine
|
import kotlinx.coroutines.flow.combine
|
||||||
import me.naingaungluu.formconductor.builder.FormFieldFactory
|
import de.thetadev.formconductor.builder.FormFieldFactory
|
||||||
import me.naingaungluu.formconductor.syntax.AnnotationSyntaxProcessor
|
import de.thetadev.formconductor.syntax.AnnotationSyntaxProcessor
|
||||||
import me.naingaungluu.formconductor.syntax.SyntaxProcessor
|
import de.thetadev.formconductor.syntax.SyntaxProcessor
|
||||||
import me.naingaungluu.formconductor.syntax.SyntaxResult
|
import de.thetadev.formconductor.syntax.SyntaxResult
|
||||||
import me.naingaungluu.formconductor.syntax.getErrorMessage
|
import de.thetadev.formconductor.syntax.getErrorMessage
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KMutableProperty
|
import kotlin.reflect.KMutableProperty
|
||||||
import kotlin.reflect.KParameter
|
import kotlin.reflect.KParameter
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor
|
package de.thetadev.formconductor
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.ValidationRule
|
import de.thetadev.formconductor.validation.rules.ValidationRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form result object with multiple states
|
* Form result object with multiple states
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.CollateralValidationRule
|
import de.thetadev.formconductor.validation.rules.CollateralValidationRule
|
||||||
|
|
||||||
@Target(AnnotationTarget.PROPERTY)
|
@Target(AnnotationTarget.PROPERTY)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.OptionalStateRule
|
import de.thetadev.formconductor.validation.rules.OptionalStateRule
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@Target(AnnotationTarget.PROPERTY)
|
@Target(AnnotationTarget.PROPERTY)
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.EmailAddressRule
|
import de.thetadev.formconductor.validation.rules.EmailAddressRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property Annotation for [EmailAddressRule]
|
* Property Annotation for [EmailAddressRule]
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.ValidationRule
|
import de.thetadev.formconductor.validation.rules.ValidationRule
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
internal class AnyFieldType
|
internal class AnyFieldType
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.FloatRangeRule
|
import de.thetadev.formconductor.validation.rules.FloatRangeRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property Annotation for [FloatRangeRule]
|
* Property Annotation for [FloatRangeRule]
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.IntegerRangeRule
|
import de.thetadev.formconductor.validation.rules.IntegerRangeRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property Annotation for [IntegerRangeRule]
|
* Property Annotation for [IntegerRangeRule]
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.IsCheckedRule
|
import de.thetadev.formconductor.validation.rules.IsCheckedRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property Annotation for [IsCheckedRule]
|
* Property Annotation for [IsCheckedRule]
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.MaxLengthRule
|
import de.thetadev.formconductor.validation.rules.MaxLengthRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property Annotation for [MaxLengthRule]
|
* Property Annotation for [MaxLengthRule]
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.MinLengthRule
|
import de.thetadev.formconductor.validation.rules.MinLengthRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property Annotation for [MinLengthRule]
|
* Property Annotation for [MinLengthRule]
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.OptionalRule
|
import de.thetadev.formconductor.validation.rules.OptionalRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property Annotation for [OptionalRule]
|
* Property Annotation for [OptionalRule]
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.annotations
|
package de.thetadev.formconductor.annotations
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.validation.rules.OptionalRule
|
import de.thetadev.formconductor.validation.rules.OptionalRule
|
||||||
import me.naingaungluu.formconductor.validation.rules.WebUrlRule
|
import de.thetadev.formconductor.validation.rules.WebUrlRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property Annotation for [WebUrlRule]
|
* Property Annotation for [WebUrlRule]
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package me.naingaungluu.formconductor.builder
|
package de.thetadev.formconductor.builder
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.Form
|
import de.thetadev.formconductor.Form
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
import me.naingaungluu.formconductor.FormImpl
|
import de.thetadev.formconductor.FormImpl
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package me.naingaungluu.formconductor.builder
|
package de.thetadev.formconductor.builder
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
import me.naingaungluu.formconductor.FormResult
|
import de.thetadev.formconductor.FormResult
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
interface FormBuilderScope<T : Any> {
|
interface FormBuilderScope<T : Any> {
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package me.naingaungluu.formconductor.builder
|
package de.thetadev.formconductor.builder
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
import me.naingaungluu.formconductor.FormImpl
|
import de.thetadev.formconductor.FormImpl
|
||||||
import me.naingaungluu.formconductor.FormResult
|
import de.thetadev.formconductor.FormResult
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
class FormBuilderScopeImpl<T : Any>(
|
class FormBuilderScopeImpl<T : Any>(
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.builder
|
package de.thetadev.formconductor.builder
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
|
|
||||||
interface FormFieldBuilderScope<V> {
|
interface FormFieldBuilderScope<V> {
|
||||||
val state: StateFlow<V>
|
val state: StateFlow<V>
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package me.naingaungluu.formconductor.builder
|
package de.thetadev.formconductor.builder
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
|
|
||||||
class FormFieldBuilderScopeImpl<V>(
|
class FormFieldBuilderScopeImpl<V>(
|
||||||
private val formField: FormField<V>
|
private val formField: FormField<V>
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package me.naingaungluu.formconductor.builder
|
package de.thetadev.formconductor.builder
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.CollectableFormData
|
import de.thetadev.formconductor.CollectableFormData
|
||||||
import me.naingaungluu.formconductor.FormField
|
import de.thetadev.formconductor.FormField
|
||||||
import me.naingaungluu.formconductor.FormFieldImpl
|
import de.thetadev.formconductor.FormFieldImpl
|
||||||
import me.naingaungluu.formconductor.annotations.DynamicOptional
|
import de.thetadev.formconductor.annotations.DynamicOptional
|
||||||
import me.naingaungluu.formconductor.utils.getEvaluatorInstance
|
import de.thetadev.formconductor.utils.getEvaluatorInstance
|
||||||
import me.naingaungluu.formconductor.utils.isFieldOptional
|
import de.thetadev.formconductor.utils.isFieldOptional
|
||||||
import me.naingaungluu.formconductor.utils.validationAnnotations
|
import de.thetadev.formconductor.utils.validationAnnotations
|
||||||
import me.naingaungluu.formconductor.validation.optionalFlags.DefaultOptionalFlag
|
import de.thetadev.formconductor.validation.optionalFlags.DefaultOptionalFlag
|
||||||
import me.naingaungluu.formconductor.validation.optionalFlags.OptionalFlag
|
import de.thetadev.formconductor.validation.optionalFlags.OptionalFlag
|
||||||
import me.naingaungluu.formconductor.validation.optionalFlags.RuleBasedOptionalFlag
|
import de.thetadev.formconductor.validation.optionalFlags.RuleBasedOptionalFlag
|
||||||
import me.naingaungluu.formconductor.validation.validators.FieldValidator
|
import de.thetadev.formconductor.validation.validators.FieldValidator
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
import kotlin.reflect.full.findAnnotations
|
import kotlin.reflect.full.findAnnotations
|
||||||
import kotlin.reflect.full.hasAnnotation
|
import kotlin.reflect.full.hasAnnotation
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package me.naingaungluu.formconductor.builder
|
package de.thetadev.formconductor.builder
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.CollectableFormData
|
import de.thetadev.formconductor.CollectableFormData
|
||||||
import me.naingaungluu.formconductor.annotations.FieldValidation
|
import de.thetadev.formconductor.annotations.FieldValidation
|
||||||
import me.naingaungluu.formconductor.utils.getFieldValidationData
|
import de.thetadev.formconductor.utils.getFieldValidationData
|
||||||
import me.naingaungluu.formconductor.validation.rules.CollateralValidationRule
|
import de.thetadev.formconductor.validation.rules.CollateralValidationRule
|
||||||
import me.naingaungluu.formconductor.validation.rules.StateBasedValidationRule
|
import de.thetadev.formconductor.validation.rules.StateBasedValidationRule
|
||||||
import me.naingaungluu.formconductor.validation.rules.StatelessValidationRule
|
import de.thetadev.formconductor.validation.rules.StatelessValidationRule
|
||||||
import me.naingaungluu.formconductor.validation.validators.CollateralFieldValidator
|
import de.thetadev.formconductor.validation.validators.CollateralFieldValidator
|
||||||
import me.naingaungluu.formconductor.validation.validators.FieldValidator
|
import de.thetadev.formconductor.validation.validators.FieldValidator
|
||||||
import me.naingaungluu.formconductor.validation.validators.StateBasedFieldValidator
|
import de.thetadev.formconductor.validation.validators.StateBasedFieldValidator
|
||||||
import me.naingaungluu.formconductor.validation.validators.StatelessFieldValidator
|
import de.thetadev.formconductor.validation.validators.StatelessFieldValidator
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
internal class FormFieldValidatorFactory<T : Any>(
|
internal class FormFieldValidatorFactory<T : Any>(
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.syntax
|
package de.thetadev.formconductor.syntax
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.annotations.AnyFieldType
|
import de.thetadev.formconductor.annotations.AnyFieldType
|
||||||
import me.naingaungluu.formconductor.annotations.FieldValidation
|
import de.thetadev.formconductor.annotations.FieldValidation
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
import kotlin.reflect.full.findAnnotation
|
import kotlin.reflect.full.findAnnotation
|
||||||
import kotlin.reflect.full.hasAnnotation
|
import kotlin.reflect.full.hasAnnotation
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor.syntax
|
package de.thetadev.formconductor.syntax
|
||||||
|
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor.syntax
|
package de.thetadev.formconductor.syntax
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Result types for Syntax Processor
|
* Result types for Syntax Processor
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor.syntax
|
package de.thetadev.formconductor.syntax
|
||||||
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package me.naingaungluu.formconductor.utils
|
package de.thetadev.formconductor.utils
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.annotations.DynamicOptional
|
import de.thetadev.formconductor.annotations.DynamicOptional
|
||||||
import me.naingaungluu.formconductor.annotations.FieldValidation
|
import de.thetadev.formconductor.annotations.FieldValidation
|
||||||
import me.naingaungluu.formconductor.annotations.OptionalField
|
import de.thetadev.formconductor.annotations.OptionalField
|
||||||
import me.naingaungluu.formconductor.validation.rules.OptionalStateRule
|
import de.thetadev.formconductor.validation.rules.OptionalStateRule
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
import kotlin.reflect.full.findAnnotation
|
import kotlin.reflect.full.findAnnotation
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor.validation.optionalFlags
|
package de.thetadev.formconductor.validation.optionalFlags
|
||||||
|
|
||||||
class DefaultOptionalFlag(
|
class DefaultOptionalFlag(
|
||||||
private val isOptional: Boolean
|
private val isOptional: Boolean
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package de.thetadev.formconductor.validation.optionalFlags
|
||||||
|
|
||||||
|
interface OptionalFlag {
|
||||||
|
fun evaluate(): Boolean
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.validation.optionalFlags
|
package de.thetadev.formconductor.validation.optionalFlags
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.CollectableFormData
|
import de.thetadev.formconductor.CollectableFormData
|
||||||
import me.naingaungluu.formconductor.validation.rules.OptionalStateRule
|
import de.thetadev.formconductor.validation.rules.OptionalStateRule
|
||||||
|
|
||||||
internal class RuleBasedOptionalFlag<T: Any>(
|
internal class RuleBasedOptionalFlag<T: Any>(
|
||||||
private val formState: CollectableFormData<T>,
|
private val formState: CollectableFormData<T>,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule that triggers validation of the entire form when this value is updated.
|
* Validation Rule that triggers validation of the entire form when this value is updated.
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.annotations.EmailAddress
|
import de.thetadev.formconductor.annotations.EmailAddress
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule for Email Addresses
|
* Validation Rule for Email Addresses
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.annotations.FloatRange
|
import de.thetadev.formconductor.annotations.FloatRange
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule for Ranged Float Values
|
* Validation Rule for Ranged Float Values
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.annotations.FloatRange
|
import de.thetadev.formconductor.annotations.FloatRange
|
||||||
import me.naingaungluu.formconductor.annotations.IntegerRange
|
import de.thetadev.formconductor.annotations.IntegerRange
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule for Ranged Integer Values
|
* Validation Rule for Ranged Integer Values
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.annotations.IsChecked
|
import de.thetadev.formconductor.annotations.IsChecked
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule for Checkboxes
|
* Validation Rule for Checkboxes
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.annotations.MaxLength
|
import de.thetadev.formconductor.annotations.MaxLength
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule for String Lengths
|
* Validation Rule for String Lengths
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.annotations.MaxLength
|
import de.thetadev.formconductor.annotations.MaxLength
|
||||||
import me.naingaungluu.formconductor.annotations.MinLength
|
import de.thetadev.formconductor.annotations.MinLength
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule for String Lengths
|
* Validation Rule for String Lengths
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.annotations.OptionalField
|
import de.thetadev.formconductor.annotations.OptionalField
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule for Optional Fields
|
* Validation Rule for Optional Fields
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
interface OptionalStateRule<T> {
|
interface OptionalStateRule<T> {
|
||||||
fun isOptional(state: T): Boolean
|
fun isOptional(state: T): Boolean
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
|
|
||||||
interface StateBasedValidationRule<V, A : Annotation, T : Any> : ValidationRule {
|
interface StateBasedValidationRule<V, A : Annotation, T : Any> : ValidationRule {
|
||||||
fun validate(value: V, options: A, formState: T): FieldResult
|
fun validate(value: V, options: A, formState: T): FieldResult
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stateless Validation Rule interface
|
* Stateless Validation Rule interface
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
|
interface ValidationRule
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
package de.thetadev.formconductor.validation.rules
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.annotations.MaxLength
|
import de.thetadev.formconductor.annotations.MaxLength
|
||||||
import me.naingaungluu.formconductor.annotations.MinLength
|
import de.thetadev.formconductor.annotations.MinLength
|
||||||
import me.naingaungluu.formconductor.annotations.WebUrl
|
import de.thetadev.formconductor.annotations.WebUrl
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation Rule for String Lengths
|
* Validation Rule for String Lengths
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.validation.validators
|
package de.thetadev.formconductor.validation.validators
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.CollectableFormData
|
import de.thetadev.formconductor.CollectableFormData
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
internal class CollateralFieldValidator<T : Any>(
|
internal class CollateralFieldValidator<T : Any>(
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package de.thetadev.formconductor.validation.validators
|
||||||
|
|
||||||
|
import de.thetadev.formconductor.FieldResult
|
||||||
|
|
||||||
|
internal interface FieldValidator<V> {
|
||||||
|
fun validate(input: V): FieldResult
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package me.naingaungluu.formconductor.validation.validators
|
package de.thetadev.formconductor.validation.validators
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.CollectableFormData
|
import de.thetadev.formconductor.CollectableFormData
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.validation.rules.StateBasedValidationRule
|
import de.thetadev.formconductor.validation.rules.StateBasedValidationRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a wrapper class for a [StateBasedValidationRule] instance.
|
* This is a wrapper class for a [StateBasedValidationRule] instance.
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package me.naingaungluu.formconductor.validation.validators
|
package de.thetadev.formconductor.validation.validators
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
import de.thetadev.formconductor.FieldResult
|
||||||
import me.naingaungluu.formconductor.validation.rules.StatelessValidationRule
|
import de.thetadev.formconductor.validation.rules.StatelessValidationRule
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper class or proxy that passes the annotation object as options to the validation rule
|
* A wrapper class or proxy that passes the annotation object as options to the validation rule
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
package me.naingaungluu.formconductor.validation.optionalFlags
|
|
||||||
|
|
||||||
interface OptionalFlag {
|
|
||||||
fun evaluate(): Boolean
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
package me.naingaungluu.formconductor.validation.rules
|
|
||||||
|
|
||||||
interface ValidationRule
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
package me.naingaungluu.formconductor.validation.validators
|
|
||||||
|
|
||||||
import me.naingaungluu.formconductor.FieldResult
|
|
||||||
|
|
||||||
internal interface FieldValidator<V> {
|
|
||||||
fun validate(input: V): FieldResult
|
|
||||||
}
|
|
||||||
56
scripts/publish-root.gradle.kts
Normal file
56
scripts/publish-root.gradle.kts
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
configure<JavaPluginExtension> {
|
||||||
|
withSourcesJar()
|
||||||
|
withJavadocJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<PublishingExtension> {
|
||||||
|
publications.withType<MavenPublication>().configureEach {
|
||||||
|
group = project.group
|
||||||
|
version = project.version.toString()
|
||||||
|
|
||||||
|
pom {
|
||||||
|
name = artifactId
|
||||||
|
description = "Declarative form validation library for Jetpack Compose"
|
||||||
|
url = "https://code.thetadev.de/ThetaDev/formconductor"
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name = "MIT"
|
||||||
|
url = "https://opensource.org/licenses/MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
connection = "scm:git@code.thetadev.de/ThetaDev/formconductor.git"
|
||||||
|
url = "https://code.thetadev.de/ThetaDev/formconductor"
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id = "NaingAungLuu"
|
||||||
|
name = "Naing Aung Luu"
|
||||||
|
email = "naingaunglu01@gmail.com"
|
||||||
|
url = "https://github.com/NaingAungLuu"
|
||||||
|
}
|
||||||
|
developer {
|
||||||
|
id = "ThetaDev"
|
||||||
|
name = "ThetaDev"
|
||||||
|
url = "https://thetadev.de"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "ThetaDev"
|
||||||
|
url = uri("https://code.thetadev.de/api/packages/ThetaDev/maven")
|
||||||
|
|
||||||
|
credentials(HttpHeaderCredentials::class) {
|
||||||
|
name = "Authorization"
|
||||||
|
value = "token ${System.getenv("FORGEJO_TOKEN")}"
|
||||||
|
}
|
||||||
|
|
||||||
|
authentication {
|
||||||
|
create<HttpHeaderAuthentication>("header")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue