Add 'exists_in_submissions' and 'does_not_exist_in_submissions' valid… (#725)

* Add 'exists_in_submissions' and 'does_not_exist_in_submissions' validation conditions

- Implement new validation conditions in FormLogicConditionChecker to check for existing submissions.
- Update open_filters.json and client-side filters to include the new conditions.
- Enhance FormLogicTest with test cases for the new validation conditions.
- Modify UI components to support the new logic conditions in form validation.

* Fix FormLogicConditionChecker

* Improve custom_validation_only

* fix test

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2025-03-25 16:20:59 +05:30
committed by GitHub
parent 2c746437c9
commit fba2207e0f
7 changed files with 329 additions and 8 deletions

View File

@@ -14,6 +14,7 @@
v-model="validation.conditions"
class="mt-1 border-t border rounded-md"
:form="form"
:custom-validation="true"
/>
</div>

View File

@@ -36,6 +36,7 @@ export default {
components: {},
props: {
modelValue: { type: Object, required: true },
customValidation: { type: Boolean, default: false },
},
emits: ['update:modelValue'],
@@ -102,14 +103,14 @@ export default {
return componentData
},
operators() {
return Object.keys(
this.available_filters[this.property.type].comparators,
).map((key) => {
return {
value: key,
name: this.optionFilterNames(key),
}
})
return Object.entries(this.available_filters[this.property.type].comparators)
.filter(([key, value]) => this.customValidation || (!this.customValidation && !value.custom_validation_only))
.map(([key]) => {
return {
value: key,
name: this.optionFilterNames(key),
}
})
},
needsInput() {
const operator = this.selectedOperator()

View File

@@ -61,6 +61,7 @@ export default {
props: {
form: { type: Object, required: true },
modelValue: { type: Object, required: false },
customValidation: { type: Boolean, default: false },
},
emits: ['update:modelValue'],
@@ -79,12 +80,19 @@ export default {
.map((property) => {
const workspaceId = this.form.workspace_id
const formSlug = this.form.slug
const customValidation = this.customValidation
return {
identifier: property.id,
name: property.name,
component: (function () {
return defineComponent({
extends: ColumnCondition,
props: {
customValidation: {
type: Boolean,
default: customValidation
}
},
computed: {
property() {
return property