All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.internal.ActionAccesses.kt Maven / Gradle / Ivy

There is a newer version: 0.23.0
Show newest version
package io.kform.internal

/** Access to the value/state tree. */
internal class AccessValueStateTree(override val accessType: ActionAccessType) : ActionAccess {
    override fun conflictsWith(access: ActionAccess) = access is AccessValueStateTree
}

/** Accesses the validation state of a value and allows access to its cached issues. */
internal class AccessValidationState(override val accessType: ActionAccessType) : ActionAccess {
    override fun conflictsWith(access: ActionAccess) = access is AccessValidationState
}

/**
 * Access the validation states within the state of a value. A [statefulValidationIndex] of `null`
 * represents access to the validation states of all validations; a specific index represents access
 * to the validation state of the stateful validation with the provided index.
 */
internal class AccessStatefulValidationDeferredState(
    override val accessType: ActionAccessType,
    private val statefulValidationIndex: Int? = null
) : ActionAccess {
    override fun conflictsWith(access: ActionAccess) =
        access is AccessStatefulValidationDeferredState &&
            (statefulValidationIndex == null ||
                access.statefulValidationIndex == null ||
                statefulValidationIndex == access.statefulValidationIndex)
}

/** Access the dirty status within the state of a value. */
internal class AccessIsDirty(override val accessType: ActionAccessType) : ActionAccess {
    override fun conflictsWith(access: ActionAccess) = access is AccessIsDirty
}

/** Access the touched status within the state of a value. */
internal class AccessIsTouched(override val accessType: ActionAccessType) : ActionAccess {
    override fun conflictsWith(access: ActionAccess) = access is AccessIsTouched
}

/** Access the number of descendants displaying issues (both errors and warnings). */
internal class AccessDescendantsDisplayingIssues(override val accessType: ActionAccessType) :
    ActionAccess {
    override fun conflictsWith(access: ActionAccess) = access is AccessDescendantsDisplayingIssues
}

/** Access the external context. */
internal class AccessExternalContext(override val accessType: ActionAccessType) : ActionAccess {
    override fun conflictsWith(access: ActionAccess): Boolean = access is AccessExternalContext
}

/** Access the validation daemon. */
internal class AccessValidationDaemon(override val accessType: ActionAccessType) : ActionAccess {
    override fun conflictsWith(access: ActionAccess): Boolean = access is AccessValidationDaemon
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy