Skip to content

Beautiful Open-Source Form Builder

Custom condition editor (#831)

Julien Nahum45038ff16a16
diff --git a/client/components/dashboard/ScrollableContainer.vue b/client/components/dashboard/ScrollableContainer.vue
index d7e24307b..df3f57ee7 100644
--- a/client/components/dashboard/ScrollableContainer.vue
+++ b/client/components/dashboard/ScrollableContainer.vue
@@ -11,17 +11,36 @@
/>
</VTransition>
+ <!-- Left Fade -->
+ <VTransition name="fade">
+ <div
+ v-if="showLeftFade"
+ :class="[
+ 'absolute top-0 left-0 bottom-0 z-10 pointer-events-none',
+ leftFadeClasses
+ ]"
+ />
+ </VTransition>
+
<!-- Scrollable Content -->
<div
ref="scrollContainer"
- :class="[
- 'overflow-y-auto',
- maxHeightClass
- ]"
+ :class="scrollClasses"
>
<slot />
</div>
+ <!-- Right Fade -->
+ <VTransition name="fade">
+ <div
+ v-if="showRightFade"
+ :class="[
+ 'absolute top-0 right-0 bottom-0 z-10 pointer-events-none',
+ rightFadeClasses
+ ]"
+ />
+ </VTransition>
+
<!-- Bottom Fade -->
<VTransition name="fade">
<div
@@ -38,12 +57,22 @@
<script setup>
import VTransition from '@/components/global/transitions/VTransition.vue'
import { useScroll, useResizeObserver } from '@vueuse/core'
+import { watch, nextTick } from 'vue'
const props = defineProps({
maxHeightClass: {
type: String,
default: 'max-h-80'
},
+ maxWidthClass: {
+ type: String,
+ default: ''
+ },
+ direction: {
+ type: String,
+ default: 'vertical', // 'vertical', 'horizontal', 'both'
+ validator: (value) => ['vertical', 'horizontal', 'both'].includes(value)
+ },
topFadeHeight: {
type: String,
default: 'h-8'
@@ -52,22 +81,72 @@ const props = defineProps({
type: String,
default: 'h-8'
},
+ leftFadeWidth: {
+ type: String,
+ default: 'w-8'
+ },
+ rightFadeWidth: {
+ type: String,
+ default: 'w-8'
+ },
fadeClass: {
type: String,
default: 'from-white to-transparent'
+ },
+ scrollTolerance: {
+ type: Number,
+ default: 3 // pixels of tolerance for scroll end detection
}
})
// Scroll fade detection
const scrollContainer = ref(null)
-const { y: scrollY } = useScroll(scrollContainer)
+const { x: scrollX, y: scrollY } = useScroll(scrollContainer)
const contentHeight = ref(0)
const containerHeight = ref(0)
+const contentWidth = ref(0)
+const containerWidth = ref(0)
+
+const showTopFade = computed(() => {
+ return (props.direction === 'vertical' || props.direction === 'both') && scrollY.value > props.scrollTolerance
+})
-const showTopFade = computed(() => scrollY.value > 0)
const showBottomFade = computed(() => {
+ if (!['vertical', 'both'].includes(props.direction)) return false
if (containerHeight.value === 0 || contentHeight.value === 0) return false
- return scrollY.value < contentHeight.value - containerHeight.value - 1 // -1 for subpixel precision
+ return scrollY.value < contentHeight.value - containerHeight.value - props.scrollTolerance
+})
+
+const showLeftFade = computed(() => {
+ return (props.direction === 'horizontal' || props.direction === 'both') && scrollX.value > props.scrollTolerance
+})
+
+const showRightFade = computed(() => {
+ if (!['horizontal', 'both'].includes(props.direction)) return false
+ if (containerWidth.value === 0 || contentWidth.value === 0) return false
+
+ // Get real-time measurements from the actual element for more accuracy
+ const element = scrollContainer.value
+ if (!element) return false
+
+ const realContainerWidth = element.clientWidth // excludes scrollbar, includes padding
+ const realContentWidth = element.scrollWidth
+ const realCurrentScroll = element.scrollLeft
+ const realMaxScroll = realContentWidth - realContainerWidth
+
+ // Calculate distance from end using real measurements
+ const distanceFromEnd = realMaxScroll - realCurrentScroll
+
+ // Use a more generous tolerance and also check if we're very close to the max possible scroll
+ const effectiveTolerance = Math.max(props.scrollTolerance, 3)
+ const isAtEnd = distanceFromEnd <= effectiveTolerance
+
+ // Additional check: if scrollLeft + clientWidth >= scrollWidth (standard end detection)
+ const standardEndCheck = realCurrentScroll + realContainerWidth >= realContentWidth - 1
+
+ const shouldShow = !isAtEnd && !standardEndCheck
+
+ return shouldShow
})
const topFadeClasses = computed(() => {
@@ -78,17 +157,90 @@ const bottomFadeClasses = computed(() => {
return `${props.bottomFadeHeight} bg-gradient-to-t ${props.fadeClass}`
})
+const leftFadeClasses = computed(() => {
+ return `${props.leftFadeWidth} bg-gradient-to-r ${props.fadeClass}`
+})
+
+const rightFadeClasses = computed(() => {
+ return `${props.rightFadeWidth} bg-gradient-to-l ${props.fadeClass}`
+})
+
+const scrollClasses = computed(() => {
+ const classes = []
+
+ if (props.direction === 'vertical') {
+ classes.push('overflow-y-auto', 'overflow-x-hidden')
+ } else if (props.direction === 'horizontal') {
+ classes.push('overflow-x-auto', 'overflow-y-hidden')
+ } else if (props.direction === 'both') {
+ classes.push('overflow-auto')
+ }
+
+ if (props.maxHeightClass) classes.push(props.maxHeightClass)
+ if (props.maxWidthClass) classes.push(props.maxWidthClass)
+
+ return classes
+})
+
// Update content dimensions when container resizes
useResizeObserver(scrollContainer, (entries) => {
const entry = entries[0]
containerHeight.value = entry.contentRect.height
+ containerWidth.value = entry.contentRect.width
if (scrollContainer.value) {
contentHeight.value = scrollContainer.value.scrollHeight
+ contentWidth.value = scrollContainer.value.scrollWidth
}
})
-// Expose container ref for parent components that might need it
+// Force update dimensions - useful for when content changes dynamically
+const updateDimensions = () => {
+ if (scrollContainer.value) {
+ const rect = scrollContainer.value.getBoundingClientRect()
+ containerHeight.value = rect.height
+ containerWidth.value = rect.width
+ contentHeight.value = scrollContainer.value.scrollHeight
+ contentWidth.value = scrollContainer.value.scrollWidth
+ }
+}
+
+// Debug method to check current scroll state
+const debugCurrentState = () => {
+ if (scrollContainer.value) {
+ const element = scrollContainer.value
+ const realContainerWidth = element.clientWidth
+ const realContentWidth = element.scrollWidth
+ const realCurrentScroll = element.scrollLeft
+ const realMaxScroll = realContentWidth - realContainerWidth
+ const distanceFromEnd = realMaxScroll - realCurrentScroll
+ const standardEndCheck = realCurrentScroll + realContainerWidth >= realContentWidth - 1
+
+ return {
+ realContainerWidth,
+ realContentWidth,
+ realCurrentScroll,
+ realMaxScroll,
+ distanceFromEnd,
+ tolerance: props.scrollTolerance,
+ isAtEnd: distanceFromEnd <= Math.max(props.scrollTolerance, 3),
+ standardEndCheck,
+ shouldShowFade: showRightFade.value
+ }
+ }
+ return null
+}
+
+// Watch for content changes that might affect dimensions
+watch([contentWidth, contentHeight], () => {
+ nextTick(() => {
+ updateDimensions()
+ })
+})
+
+// Expose container ref and utility functions for parent components
defineExpose({
- scrollContainer
+ scrollContainer,
+ updateDimensions,
+ debugCurrentState
})
</script>
\ No newline at end of file
diff --git a/client/components/open/forms/components/CustomFieldValidation.vue b/client/components/open/forms/components/CustomFieldValidation.vue
index 48a95e24e..2df4d0cac 100644
--- a/client/components/open/forms/components/CustomFieldValidation.vue
+++ b/client/components/open/forms/components/CustomFieldValidation.vue
@@ -1,55 +1,199 @@
<template>
<div class="py-2 px-4">
- <div class="space-y-4">
- <!-- Step 1: Validation Rules -->
- <div>
- <h3 class="font-medium text-neutral-900 text-sm mb-1">
- Step 1: Set Validation Rules
- </h3>
- <p class="text-neutral-500 text-xs mb-3">
- Add validation rules. The field is <span class="font-semibold">valid if these conditions are met</span>.
- </p>
- <condition-editor
- ref="filter-editor"
- v-model="validation.conditions"
- class="mt-1 border-t border rounded-md"
- :form="form"
- :custom-validation="true"
- />
+ <div class="flex gap-1 border-b pb-2">
+ <UButton
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ icon="i-heroicons-arrow-down-on-square"
+ class="text-neutral-500"
+ @click="showCopyFormModal = true"
+ >
+ Copy from
+ </UButton>
+ <UButton
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ icon="i-heroicons-arrow-up-on-square"
+ class="text-neutral-500"
+ @click="showCopyToModal = true"
+ >
+ Copy to
+ </UButton>
+ <UButton
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ icon="i-mdi-clear-outline"
+ class="text-neutral-500"
+ @click="clearAll"
+ >
+ Clear
+ </UButton>
+ <UButton
+ color="neutral"
+ variant="ghost"
+ class="text-neutral-500"
+ size="xs"
+ icon="i-heroicons-question-mark-circle"
+ @click="openHelpArticle"
+ />
+ </div>
+
+ <!-- Validation Rules Card -->
+ <div class="mt-4">
+ <p class="text-xs font-medium text-gray-600 mb-2">When should this field be valid?</p>
+ <p class="text-neutral-500 text-xs mb-3">
+ Set <span class="font-semibold">rules that make this field valid</span>. If rules aren't met, the field shows an error.
+ </p>
+ <div class="p-3 border border-gray-200 rounded-lg bg-gray-50/50 hover:bg-gray-50 transition-colors">
+ <UPopover
+ :content="{
+ align: 'start',
+ side: 'left',
+ sideOffset: 8
+ }"
+ :ui="{
+ content: 'w-[650px] overflow-auto'
+ }"
+ arrow
+ >
+ <UButton
+ :color="hasConditions ? 'primary' : 'neutral'"
+ :variant="hasConditions ? 'subtle' : 'outline'"
+ :icon="hasConditions ? 'i-heroicons-cog-8-tooth-16-solid' : 'i-heroicons-plus'"
+ size="sm"
+ class="w-full justify-start font-medium hover:bg-white transition-colors"
+ >
+ {{ hasConditions ? `${conditionsCount} rule${conditionsCount > 1 ? 's' : ''}` : 'Add rule' }}
+ </UButton>
+
+ <template #content>
+ <ScrollableContainer
+ ref="scrollableContainer"
+ direction="horizontal"
+ max-width-class="max-w-[650px] p-4"
+ :fade-class="'from-white via-white/80 to-transparent'"
+ class="rounded-lg"
+ left-fade-width="w-4"
+ right-fade-width="w-4"
+ :scroll-tolerance="5"
+ >
+ <condition-editor
+ class="w-full"
+ ref="filter-editor"
+ v-model="validation.conditions"
+ :form="form"
+ :custom-validation="true"
+ />
+ </ScrollableContainer>
+ </template>
+ </UPopover>
</div>
+ </div>
+
+ <!-- Divider Line -->
+ <div class="my-5">
+ <div class="h-px bg-gradient-to-r from-transparent via-gray-300 to-transparent"></div>
+ </div>
- <!-- Step 2: Error Message -->
- <div>
- <h3 class="font-medium text-neutral-900 text-sm mb-1">
- Step 2: Set Error Message
- </h3>
- <p class="text-neutral-500 text-xs mb-2">
- The error message to show <span class="font-semibold">when validation fails</span>.
- </p>
+ <!-- Error Message Card -->
+ <div>
+ <p class="text-xs font-medium text-gray-600 mb-2">What message to show if validation fails?</p>
+ <p class="text-neutral-500 text-xs mb-3">
+ This message appears when <span class="font-semibold">validation rules aren't met</span>.
+ </p>
+ <div class="p-3 border border-gray-200 rounded-lg bg-gray-50/50 hover:bg-gray-50 transition-colors">
<text-input
name="error_message"
:form="field.validation"
label="Error message"
/>
</div>
-
- <UAlert
- icon="i-heroicons-information-circle"
- color="warning"
- variant="subtle"
- size="sm"
- description="Remember to save your form to apply these validation rules."
- />
</div>
+
+ <UAlert
+ icon="i-heroicons-information-circle"
+ color="warning"
+ variant="subtle"
+ size="sm"
+ class="mt-4"
+ description="Save your form to apply changes."
+ />
+
+ <UModal
+ v-model:open="showCopyFormModal"
+ title="Copy validation from another field"
+ :description="`Select another field to copy its validation rules and apply them to '${field.name}'.`"
+ >
+ <template #body>
+ <USelectMenu
+ v-model="copyFrom"
+ :items="copyFromOptions"
+ value-key="value"
+ placeholder="Choose a field..."
+ searchable
+ />
+ </template>
+
+ <template #footer>
+ <UButton
+ color="neutral"
+ variant="outline"
+ label="Close"
+ @click="showCopyFormModal = false"
+ />
+ <UButton
+ color="primary"
+ @click="copyValidation"
+ label="Confirm & Copy"
+ />
+ </template>
+ </UModal>
+
+ <UModal
+ v-model:open="showCopyToModal"
+ title="Copy validation to other fields"
+ :description="`Select other fields to copy the validation rules from '${field.name}' to.`"
+ >
+ <template #body>
+ <USelectMenu
+ v-model="copyTo"
+ :items="copyToOptions"
+ value-key="value"
+ placeholder="Choose fields..."
+ :multiple="true"
+ searchable
+ />
+ </template>
+
+ <template #footer>
+ <UButton
+ color="neutral"
+ variant="outline"
+ label="Close"
+ @click="showCopyToModal = false"
+ />
+ <UButton
+ color="primary"
+ @click="copyValidationToFields"
+ label="Confirm & Copy"
+ />
+ </template>
+ </UModal>
</div>
</template>
<script>
import { default as _has } from "lodash/has"
import ConditionEditor from "./form-logic-components/ConditionEditor.client.vue"
+import ScrollableContainer from "~/components/dashboard/ScrollableContainer.vue"
+import clonedeep from "clone-deep"
+
export default {
name: 'FormValidation',
- components: {ConditionEditor},
+ components: { ConditionEditor, ScrollableContainer },
props: {
field: {
type: Object,
@@ -60,6 +204,14 @@ export default {
required: false
}
},
+
+ setup() {
+ const crisp = useCrisp()
+ return {
+ crisp
+ }
+ },
+
data() {
return {
show: false,
@@ -67,12 +219,50 @@ export default {
conditions: null,
actions: [],
},
- error_message: this.field.validation?.error_message || ''
+ error_message: this.field.validation?.error_message || '',
+ showCopyFormModal: false,
+ copyFrom: null,
+ showCopyToModal: false,
+ copyTo: []
+ }
+ },
+
+ computed: {
+ conditionsCount() {
+ if (this.validation.conditions === null || this.validation.conditions === undefined) return 0
+ // Count the number of rules/conditions recursively
+ return this.countConditions(this.validation.conditions)
+ },
+ hasConditions() {
+ return this.conditionsCount > 0
+ },
+ copyFromOptions() {
+ return this.form.properties
+ .filter((field) => {
+ return (
+ field.id !== this.field.id &&
+ _has(field, "validation") &&
+ field.validation?.error_conditions &&
+ Object.keys(field.validation.error_conditions || {}).length > 0
+ )
+ })
+ .map((field) => {
+ return { label: field.name, value: field.id }
+ })
+ },
+ copyToOptions() {
+ return this.form.properties
+ .filter((field) => {
+ return field.id !== this.field.id
+ })
+ .map((field) => {
+ return { label: field.name, value: field.id }
+ })
}
},
watch: {
- logic: {
+ validation: {
handler() {
this.field.validation.error_conditions = this.validation
},
@@ -92,9 +282,79 @@ export default {
if (!_has(this.field, "validation")) {
this.field.validation = {
error_conditions: this.validation,
- error_message: this.error_message }
+ error_message: this.error_message
+ }
}
},
- methods:{}
+ methods: {
+ countConditions(conditions) {
+ if (!conditions) return 0
+
+ // If it's a group with children
+ if (conditions.children && Array.isArray(conditions.children)) {
+ return conditions.children.reduce((count, child) => {
+ // If child has an identifier, it's a rule
+ if (child.identifier) {
+ return count + 1
+ }
+ // If child has children, it's a nested group - count recursively
+ if (child.children) {
+ return count + this.countConditions(child)
+ }
+ return count
+ }, 0)
+ }
+
+ // If it's a single rule with identifier
+ if (conditions.identifier) {
+ return 1
+ }
+
+ return 0
+ },
+ openHelpArticle() {
+ this.crisp.openHelpdeskArticle('how-to-add-custom-validation-to-a-field-elzuxy')
+ },
+ clearAll() {
+ this.validation.conditions = null
+ if (this.field.validation) {
+ this.field.validation.error_message = ''
+ }
+ },
+ copyValidation() {
+ if (this.copyFrom) {
+ const sourceField = this.form.properties.find((property) => {
+ return property.id === this.copyFrom
+ })
+ if (sourceField && sourceField.validation?.error_conditions) {
+ this.validation = clonedeep(sourceField.validation.error_conditions)
+ if (sourceField.validation.error_message) {
+ this.field.validation.error_message = sourceField.validation.error_message
+ }
+ }
+ }
+ this.showCopyFormModal = false
+ },
+ copyValidationToFields() {
+ if (this.copyTo.length) {
+ this.copyTo.forEach((fieldId) => {
+ const targetField = this.form.properties.find(
+ (property) => property.id === fieldId
+ )
+ if (targetField) {
+ if (!targetField.validation) {
+ targetField.validation = {}
+ }
+ targetField.validation.error_conditions = clonedeep(this.validation)
+ if (this.field.validation?.error_message) {
+ targetField.validation.error_message = this.field.validation.error_message
+ }
+ }
+ })
+ }
+ this.showCopyToModal = false
+ this.copyTo = []
+ }
+ }
}
</script>
diff --git a/client/components/open/forms/components/form-logic-components/ColumnCondition.vue b/client/components/open/forms/components/form-logic-components/ColumnCondition.vue
index 819eac6cd..3dae66d26 100644
--- a/client/components/open/forms/components/form-logic-components/ColumnCondition.vue
+++ b/client/components/open/forms/components/form-logic-components/ColumnCondition.vue
@@ -1,28 +1,35 @@
<template>
<div
v-if="content"
- class="flex flex-wrap"
+ class="flex items-center gap-2"
>
- <div class="w-full font-semibold text-neutral-700 dark:text-neutral-300 mb-2">
- {{ property.name }}
- </div>
- <SelectInput
+ <!-- Operator Selection -->
+ <USelectMenu
v-model="content.operator"
- class="w-full"
- :options="operators"
- :name="'operator_' + property.id"
- placeholder="Comparison operator"
+ class="w-[100px]"
+ :items="operators"
+ value-key="value"
+ placeholder="Operator"
+ size="sm"
+ variant="outline"
+ :search-input="false"
@update:model-value="operatorChanged()"
+ :ui="{
+ content: 'min-w-fit'
+ }"
/>
+ <!-- Value Input (if needed) -->
<template v-if="needsInput">
<component
v-bind="inputComponentData"
:is="inputComponentData.component"
v-model="content.value"
- class="w-full"
+ class="flex-1 min-w-[120px]"
:name="'value_' + property.id"
- placeholder="Filter Value"
+ placeholder="Value"
+ wrapper-class="my-0"
+ margin-bottom=""
@update:model-value="emitInput()"
/>
</template>
@@ -31,18 +38,19 @@
<script>
import OpenFilters from "../../../../../data/open_filters.json"
+import ThemeBuilder from "~/lib/forms/themes/ThemeBuilder.js"
export default {
components: {},
props: {
- modelValue: { type: Object, required: true },
+ modelValue: { type: Object, required: false, default: null },
customValidation: { type: Boolean, default: false },
},
emits: ['update:modelValue'],
data() {
return {
- content: { ...this.modelValue },
+ content: this.modelValue ? { ...this.modelValue } : {},
available_filters: OpenFilters,
hasInput: false,
inputComponent: {
@@ -61,6 +69,11 @@ export default {
phone_number: "TextInput",
matrix: "MatrixInput",
},
+ // Create small-sized theme for all child components
+ smallTheme: new ThemeBuilder('simple', {
+ size: 'xs',
+ borderRadius: 'small'
+ }).getAllComponents()
}
},
@@ -71,6 +84,8 @@ export default {
component: this.inputComponent[this.property.type],
name: this.property.id,
required: true,
+ theme: this.smallTheme,
+ wrapperClass: 'm-0',
}
if (
@@ -108,7 +123,7 @@ export default {
.map(([filterKey]) => {
return {
value: filterKey,
- name: this.optionFilterNames(filterKey),
+ label: this.optionFilterNames(filterKey),
}
})
},
@@ -221,7 +236,7 @@ export default {
this.$emit("update:modelValue", this.castContent(this.content))
},
refreshContent() {
- const modelValue = { ...this.modelValue }
+ const modelValue = this.modelValue ? { ...this.modelValue } : {}
// Migrate legacy checkbox operators
if (this.property.type === 'checkbox') {
@@ -233,7 +248,7 @@ export default {
}
this.content = {
- operator: this.operators[0].value,
+ operator: this.operators[0]?.value,
...modelValue,
property_meta: {
id: this.property.id,
diff --git a/client/components/open/forms/components/form-logic-components/ConditionEditor.client.vue b/client/components/open/forms/components/form-logic-components/ConditionEditor.client.vue
index e737f2752..e6a043e51 100644
--- a/client/components/open/forms/components/form-logic-components/ConditionEditor.client.vue
+++ b/client/components/open/forms/components/form-logic-components/ConditionEditor.client.vue
@@ -3,36 +3,13 @@
ref="error_boundary"
@on-error="handleError"
>
- <query-builder
+ <QueryBuilder
v-model="query"
- :rules="rules"
:config="config"
+ where-text="When"
v-bind="$attrs"
@update:model-value="onChange"
>
- <template #groupOperator="props">
- <div
- class="query-builder-group-slot__group-selection flex items-center px-5 border-b py-1"
- >
- <p class="mr-2 mt-1 font-semibold">
- Operator
- </p>
- <select-input
- wrapper-class="relative mb-0"
- :model-value="props.currentOperator"
- :options="props.operators"
- emit-key="identifier"
- option-key="identifier"
- name="operator-input"
- :help="null"
- margin-bottom=""
- @update:model-value="props.updateCurrentOperator($event)"
- />
- </div>
- </template>
- <template #groupControl="props">
- <group-control-slot :group-ctrl="props" />
- </template>
<template #rule="ruleCtrl">
<component
:is="ruleCtrl.ruleComponent"
@@ -40,20 +17,18 @@
@update:model-value="ruleCtrl.updateRuleData"
/>
</template>
- </query-builder>
+ </QueryBuilder>
</ErrorBoundary>
</template>
<script>
import ErrorBoundary from '~/components/app/ErrorBoundary.vue'
import { defineComponent } from "vue"
-import QueryBuilder from "query-builder-vue-3"
+import QueryBuilder from "~/components/tools/query-builder/QueryBuilder.vue"
import ColumnCondition from "./ColumnCondition.vue"
-import GroupControlSlot from "./GroupControlSlot.vue"
export default {
components: {
- GroupControlSlot,
QueryBuilder,
ColumnCondition,
ErrorBoundary,
@@ -158,4 +133,4 @@ export default {
}
}
</script>
-<style src="query-builder-vue-3/dist/style.css" />
+
diff --git a/client/components/open/forms/components/form-logic-components/FormBlockLogicEditor.vue b/client/components/open/forms/components/form-logic-components/FormBlockLogicEditor.vue
index a2dc621bd..cb6a9a06f 100644
--- a/client/components/open/forms/components/form-logic-components/FormBlockLogicEditor.vue
+++ b/client/components/open/forms/components/form-logic-components/FormBlockLogicEditor.vue
@@ -3,66 +3,119 @@
v-if="logic"
:key="resetKey"
>
- <p class="text-neutral-400 text-xs mb-3">
- Select a field, add some conditions, and finally add some actions.
- </p>
- <div class="relative flex">
- <UButtonGroup size="xs">
- <UButton
- color="neutral"
- variant="subtle"
- icon="i-heroicons-arrow-down-on-square"
- @click="showCopyFormModal = true"
- >
- Copy from
- </UButton>
- <UButton
- color="neutral"
- variant="subtle"
- icon="i-heroicons-arrow-up-on-square"
- @click="showCopyToModal = true"
- >
- Copy to
- </UButton>
+ <div class="flex gap-1 border-b pb-2">
+ <UButton
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ icon="i-heroicons-arrow-down-on-square"
+ class="text-neutral-500"
+ @click="showCopyFormModal = true"
+ >
+ Copy from
+ </UButton>
+ <UButton
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ icon="i-heroicons-arrow-up-on-square"
+ class="text-neutral-500"
+ @click="showCopyToModal = true"
+ >
+ Copy to
+ </UButton>
+ <UButton
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ icon="i-mdi-clear-outline"
+ class="text-neutral-500"
+ @click="clearAll"
+ >
+ Clear
+ </UButton>
+ <UButton
+ color="neutral"
+ variant="ghost"
+ class="text-neutral-500"
+ size="xs"
+ icon="i-heroicons-question-mark-circle"
+ @click="openHelpArticle"
+ />
+ </div>
+
+ <!-- Conditions Card -->
+ <div class="mt-4">
+ <p class="text-xs font-medium text-gray-600 mb-2">When following condition(s) are true</p>
+ <div class="p-3 border border-gray-200 rounded-lg bg-gray-50/50 hover:bg-gray-50 transition-colors">
+ <UPopover
+ :content="{
+ align: 'start',
+ side: 'left',
+ sideOffset: 8
+ }"
+ :ui="{
+ content: 'w-[650px] overflow-auto'
+ }"
+ arrow
+ >
<UButton
- color="neutral"
- variant="subtle"
- icon="i-mdi-clear-outline"
- @click="clearAll"
+ :color="hasConditions ? 'primary' : 'neutral'"
+ :variant="hasConditions ? 'subtle' : 'outline'"
+ :icon="hasConditions ? 'i-heroicons-cog-8-tooth-16-solid' : 'i-heroicons-plus'"
+ size="sm"
+ class="w-full justify-start font-medium hover:bg-white transition-colors"
>
- Clear
+ {{ hasConditions ? `${conditionsCount} rule${conditionsCount > 1 ? 's' : ''}` : 'Add rule' }}
</UButton>
- </UButtonGroup>
+
+ <template #content>
+ <ScrollableContainer
+ ref="scrollableContainer"
+ direction="horizontal"
+ max-width-class="max-w-[650px] p-4"
+ :fade-class="'from-white via-white/80 to-transparent'"
+ class="rounded-lg"
+ left-fade-width="w-4"
+ right-fade-width="w-4"
+ :scroll-tolerance="5"
+ >
+ <condition-editor
+ class="w-full"
+ ref="filter-editor"
+ v-model="logic.conditions"
+ :form="form"
+ />
+ </ScrollableContainer>
+ </template>
+ </UPopover>
+ </div>
</div>
- <h5 class="font-medium text-neutral-700 mt-3">
- 1. Conditions
- </h5>
- <condition-editor
- ref="filter-editor"
- v-model="logic.conditions"
- class="mt-1 border-t border rounded-md"
- :form="form"
- />
+ <!-- Divider Line -->
+ <div class="flex items-center my-5">
+ <div class="flex-1 border-b"></div>
+ <span class="px-4 py-1 text-xs font-medium text-gray-600 bg-white border rounded-full">then</span>
+ <div class="flex-1 border-b"></div>
+ </div>
- <h5 class="font-medium text-neutral-700 mt-3">
- 2. Actions
- </h5>
- <p class="text-neutral-500 text-xs mb-3">
- Action(s) triggered when above conditions are true.
- </p>
- <flat-select-input
- :key="resetKey"
- v-model="logic.actions"
- name="actions"
- :multiple="true"
- class="mt-1"
- placeholder="Actions..."
- :options="actionOptions"
- @update:model-value="onActionInput"
- />
+ <div>
+ <p class="text-xs font-medium text-gray-600 mb-2">Apply the following action(s)</p>
+ <div class="p-3 border border-gray-200 rounded-lg bg-gray-50/50 hover:bg-gray-50 transition-colors">
+ <flat-select-input
+ :key="resetKey"
+ v-model="logic.actions"
+ name="actions"
+ :multiple="true"
+ placeholder="Select actions..."
+ :options="actionOptions"
+ @update:model-value="onActionInput"
+ clearable
+ />
+ </div>
+ </div>
- <p class="text-neutral-500 text-xs mb-3">
+ <p class="text-neutral-400 text-xs mt-2">
Note that hidden fields can never be required.
</p>
@@ -72,14 +125,12 @@
:description="`Select another field/block to copy its logic and apply it to '${field.name}'.`"
>
<template #body>
- <SelectInput
+ <USelectMenu
v-model="copyFrom"
- name="copy_from"
- emit-key="value"
- label="Copy logic from"
+ :items="copyFromOptions"
+ value-key="value"
placeholder="Choose a field/block..."
- :options="copyFromOptions"
- :searchable="copyFromOptions && copyFromOptions.options > 5"
+ searchable
/>
</template>
@@ -104,15 +155,13 @@
:description="`Select other fields to copy the logic from '${field.name}' to.`"
>
<template #body>
- <SelectInput
+ <USelectMenu
v-model="copyTo"
- name="copy_to"
- emit-key="value"
- label="Copy logic to"
+ :items="copyToOptions"
+ value-key="value"
placeholder="Choose fields..."
- :options="copyToOptions"
:multiple="true"
- :searchable="copyToOptions && copyToOptions.length > 5"
+ searchable
/>
</template>
@@ -135,12 +184,13 @@
<script>
import ConditionEditor from "./ConditionEditor.client.vue"
+import ScrollableContainer from "~/components/dashboard/ScrollableContainer.vue"
import clonedeep from "clone-deep"
import { default as _has } from "lodash/has"
export default {
name: "FormBlockLogicEditor",
- components: { ConditionEditor },
+ components: { ConditionEditor, ScrollableContainer },
props: {
field: {
type: Object,
@@ -152,6 +202,13 @@ export default {
},
},
+ setup() {
+ const crisp = useCrisp()
+ return {
+ crisp
+ }
+ },
+
data() {
return {
resetKey: 0,
@@ -167,6 +224,14 @@ export default {
},
computed: {
+ conditionsCount() {
+ if (this.logic.conditions === null || this.logic.conditions === undefined) return 0
+ // Count the number of rules/conditions recursively
+ return this.countConditions(this.logic.conditions)
+ },
+ hasConditions() {
+ return this.conditionsCount > 0
+ },
copyFromOptions() {
return this.form.properties
.filter((field) => {
@@ -178,7 +243,7 @@ export default {
)
})
.map((field) => {
- return { name: field.name, value: field.id }
+ return { label: field.name, value: field.id }
})
},
copyToOptions() {
@@ -187,7 +252,7 @@ export default {
return field.id !== this.field.id
})
.map((field) => {
- return { name: field.name, value: field.id }
+ return { label: field.name, value: field.id }
})
},
actionOptions() {
@@ -265,6 +330,31 @@ export default {
},
methods: {
+ countConditions(conditions) {
+ if (!conditions) return 0
+
+ // If it's a group with children
+ if (conditions.children && Array.isArray(conditions.children)) {
+ return conditions.children.reduce((count, child) => {
+ // If child has an identifier, it's a rule
+ if (child.identifier) {
+ return count + 1
+ }
+ // If child has children, it's a nested group - count recursively
+ if (child.children) {
+ return count + this.countConditions(child)
+ }
+ return count
+ }, 0)
+ }
+
+ // If it's a single rule with identifier
+ if (conditions.identifier) {
+ return 1
+ }
+
+ return 0
+ },
clearAll() {
this.logic.conditions = null
this.logic.actions = []
@@ -298,6 +388,9 @@ export default {
refreshActions() {
this.resetKey++
},
+ openHelpArticle() {
+ this.crisp.openHelpdeskArticle('how-do-i-add-logic-to-my-form-1lmguq5')
+ },
copyLogic() {
if (this.copyFrom) {
const property = this.form.properties.find((property) => {
diff --git a/client/components/open/forms/components/form-logic-components/GroupControlSlot.vue b/client/components/open/forms/components/form-logic-components/GroupControlSlot.vue
index 122da24e0..89c813839 100644
--- a/client/components/open/forms/components/form-logic-components/GroupControlSlot.vue
+++ b/client/components/open/forms/components/form-logic-components/GroupControlSlot.vue
@@ -1,17 +1,13 @@
<template>
<div class="flex flex-wrap px-4 py-1 -ml-1 -mt-1">
- <select-input
+ <USelectMenu
ref="ruleSelect"
v-model="selectedRule"
class="flex-grow ml-1 mr-1 mt-1"
- wrapper-class="relative"
placeholder="Add condition on input field"
- :options="groupCtrl.rules"
- margin-bottom=""
- :searchable="groupCtrl.rules.length > 5"
- emit-key="identifier"
- option-key="identifier"
- name="group-control-slot-rule"
+ :items="groupCtrl.rules"
+ value-key="identifier"
+ searchable
/>
<UButton
class="ml-1 mt-1"
diff --git a/client/components/open/forms/fields/components/MatrixFieldOptions.vue b/client/components/open/forms/fields/components/MatrixFieldOptions.vue
index 44e9f2b2d..79d496f50 100644
--- a/client/components/open/forms/fields/components/MatrixFieldOptions.vue
+++ b/client/components/open/forms/fields/components/MatrixFieldOptions.vue
@@ -31,6 +31,7 @@
<UButton
size="xs"
color="neutral"
+ variant="soft"
icon="i-heroicons-plus"
@click="addMatrixRow"
>
@@ -58,6 +59,7 @@
<UButton
size="xs"
color="neutral"
+ variant="soft"
icon="i-heroicons-plus"
@click="addMatrixColumn"
>
diff --git a/client/components/open/integrations/components/IntegrationWrapper.vue b/client/components/open/integrations/components/IntegrationWrapper.vue
index f60b461eb..30f32bdd9 100644
--- a/client/components/open/integrations/components/IntegrationWrapper.vue
+++ b/client/components/open/integrations/components/IntegrationWrapper.vue
@@ -48,7 +48,7 @@
<condition-editor
ref="filter-editor"
v-model="modelValue.logic"
- class="mt-4 border-t border rounded-md integration-logic"
+ class="mt-4 rounded-md integration-logic"
:form="form"
/>
</collapse>
diff --git a/client/components/tools/query-builder/QueryBuilder.vue b/client/components/tools/query-builder/QueryBuilder.vue
new file mode 100644
index 000000000..98b33e75b
--- /dev/null
+++ b/client/components/tools/query-builder/QueryBuilder.vue
@@ -0,0 +1,57 @@
+<template>
+ <QueryBuilderGroup
+ :config="config"
+ :query="ruleSet"
+ :depth="0"
+ :where-text="whereText"
+ class="flex flex-col"
+ @query-update="updateQuery"
+ >
+ <template v-for="(_, slotName) in $slots" #[slotName]="props">
+ <slot :name="slotName" v-bind="props" />
+ </template>
+ </QueryBuilderGroup>
+</template>
+
+<script setup>
+import QueryBuilderGroup from './QueryBuilderGroup.vue'
+
+const props = defineProps({
+ modelValue: {
+ type: Object,
+ default: null
+ },
+ config: {
+ type: Object,
+ required: true
+ },
+ whereText: {
+ type: String,
+ default: 'Where'
+ }
+})
+
+const emit = defineEmits(['update:modelValue'])
+
+const ruleSet = computed(() => {
+ if (props.modelValue) {
+ return props.modelValue
+ }
+
+ if (props.config.operators.length === 0) {
+ return {
+ operatorIdentifier: '',
+ children: []
+ }
+ }
+
+ return {
+ operatorIdentifier: props.config.operators[0].identifier,
+ children: []
+ }
+})
+
+function updateQuery(newQuery) {
+ emit('update:modelValue', { ...newQuery })
+}
+</script>
\ No newline at end of file
diff --git a/client/components/tools/query-builder/QueryBuilderGroup.vue b/client/components/tools/query-builder/QueryBuilderGroup.vue
new file mode 100644
index 000000000..a0151eb71
--- /dev/null
+++ b/client/components/tools/query-builder/QueryBuilderGroup.vue
@@ -0,0 +1,368 @@
+<template>
+ <div
+ class="flex flex-col gap-2"
+ :class="[
+ depth >= 1 ? 'p-2 rounded-lg border border-gray-400/30 bg-gray-100/20' : ''
+ ]">
+ <!-- Rules and Groups -->
+ <div v-if="children.length > 0" class="flex flex-col gap-1">
+ <template v-for="(child, index) in children" :key="index">
+ <!-- Rule -->
+ <div v-if="child.hasOwnProperty('identifier')" class="flex items-center gap-2">
+ <div class="flex-1">
+ <QueryBuilderRule
+ :config="config"
+ :query="child"
+ :index="index"
+ :selected-operator="props.query.operatorIdentifier"
+ :operator-options="operatorOptions"
+ :where-text="whereText"
+ @query-update="updateRule(index, $event)"
+ @operator-update="updateOperator"
+ >
+ <template v-for="(_, slotName) in $slots" #[slotName]="props">
+ <slot :name="slotName" v-bind="props" />
+ </template>
+ </QueryBuilderRule>
+ </div>
+
+ <UDropdownMenu
+ :items="getRuleMenuItems(index)"
+ :popper="{ placement: 'bottom-end' }"
+ size="sm"
+ >
+ <UButton
+ icon="i-heroicons-ellipsis-horizontal"
+ size="sm"
+ color="neutral"
+ variant="ghost"
+ class="flex-shrink-0"
+ />
+ </UDropdownMenu>
+ </div>
+
+ <!-- Nested Group -->
+ <div v-else-if="child.operatorIdentifier" class="flex items-start gap-2">
+ <!-- Group prefix - same logic as rules -->
+ <div v-if="index === 0" class="flex-shrink-0 text-sm font-medium text-gray-600 w-17 text-right pt-3">
+ {{ whereText }}
+ </div>
+
+ <div v-else-if="index === 1" class="flex-shrink-0 w-17 text-right pt-3">
+ <USelectMenu
+ v-model="selectedOperator"
+ :items="operatorOptions"
+ value-key="value"
+ class="w-full"
+ size="sm"
+ variant="outline"
+ :search-input="false"
+ />
+ </div>
+
+ <div v-else class="flex-shrink-0 text-sm font-medium text-gray-600 w-17 text-right pt-3">
+ {{ operatorOptions.find(op => op.value === selectedOperator)?.label || 'And' }}
+ </div>
+
+ <!-- Group content -->
+ <div class="flex-1">
+ <QueryBuilderGroup
+ :config="config"
+ :query="child"
+ :depth="depth + 1"
+ :where-text="whereText"
+ @query-update="updateGroup(index, $event)"
+ >
+ <template v-for="(_, slotName) in $slots" #[slotName]="props">
+ <slot :name="slotName" v-bind="props" />
+ </template>
+ </QueryBuilderGroup>
+ </div>
+
+ <UDropdownMenu
+ :items="getGroupMenuItems(index)"
+ :popper="{ placement: 'bottom-end' }"
+ size="sm"
+ >
+ <UButton
+ icon="i-heroicons-ellipsis-horizontal"
+ size="sm"
+ color="neutral"
+ variant="ghost"
+ class="flex-shrink-0 mt-3"
+ />
+ </UDropdownMenu>
+ </div>
+ </template>
+ </div>
+
+ <!-- Add Controls - Always visible -->
+ <div class="w-full">
+ <UDropdownMenu
+ :content="{align: 'start'}"
+ :items="addMenuItems"
+ >
+ <UButton
+ label="Add rule"
+ icon="i-heroicons-plus"
+ size="sm"
+ color="neutral"
+ variant="ghost"
+ class="w-full text-gray-700 justify-start"
+ trailing-icon="i-heroicons-chevron-down"
+ />
+ </UDropdownMenu>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import QueryBuilderRule from './QueryBuilderRule.vue'
+
+const props = defineProps({
+ config: {
+ type: Object,
+ required: true
+ },
+ query: {
+ type: Object,
+ required: true
+ },
+ depth: {
+ type: Number,
+ default: 0
+ },
+ whereText: {
+ type: String,
+ default: 'Where'
+ }
+})
+
+const emit = defineEmits(['query-update'])
+
+const addMenuItems = [
+ [
+ {
+ label: 'Add Rule',
+ onClick: () => handleAddRule()
+ },
+ {
+ label: 'Add Rule Group',
+ onClick: () => addGroup()
+ }
+ ]
+]
+
+const selectedOperator = computed({
+ get: () => props.query.operatorIdentifier,
+ set: (operatorIdentifier) => {
+ emit('query-update', {
+ ...props.query,
+ operatorIdentifier
+ })
+ }
+})
+
+const children = computed(() => {
+ return props.query.children || []
+})
+
+const operatorOptions = computed(() => {
+ return props.config.operators.map(op => ({
+ label: op.name,
+ value: op.identifier
+ }))
+})
+
+function addRule(ruleIdentifier = null) {
+ if (!props.config.rules || props.config.rules.length === 0) {
+ console.warn('No rules configured for query builder')
+ return
+ }
+
+ // Default to first available field if no identifier provided
+ const defaultIdentifier = ruleIdentifier || (props.config.rules.length > 0 ? props.config.rules[0].identifier : '')
+ const ruleDefinition = props.config.rules.find(r => r.identifier === defaultIdentifier)
+
+ const newRule = {
+ identifier: defaultIdentifier,
+ value: ruleDefinition?.initialValue || null
+ }
+
+ const newChildren = [...children.value, newRule]
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+
+function updateRule(index, newRuleData) {
+ const newChildren = [...children.value]
+ newChildren[index] = newRuleData
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+
+function removeRule(index) {
+ const newChildren = [...children.value]
+ newChildren.splice(index, 1)
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+
+function addGroup() {
+ // Create an initial rule for the new group (same as addRule logic)
+ const defaultIdentifier = props.config.rules.length > 0 ? props.config.rules[0].identifier : ''
+ const ruleDefinition = props.config.rules.find(r => r.identifier === defaultIdentifier)
+
+ const initialRule = {
+ identifier: defaultIdentifier,
+ value: ruleDefinition?.initialValue || null
+ }
+
+ const newGroup = {
+ operatorIdentifier: props.config.operators[0]?.identifier || 'and',
+ children: [initialRule] // Start with one empty rule
+ }
+
+ const newChildren = [...children.value, newGroup]
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+
+function updateGroup(index, newGroupData) {
+ const newChildren = [...children.value]
+ newChildren[index] = newGroupData
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+
+function handleAddRule() {
+ addRule() // Add empty rule that allows field selection
+}
+
+function updateOperator(newOperator) {
+ emit('query-update', {
+ ...props.query,
+ operatorIdentifier: newOperator
+ })
+}
+
+function getRuleMenuItems(index) {
+ return [
+ [
+ {
+ label: 'Remove',
+ icon: 'i-heroicons-trash',
+ color: 'error',
+ onClick: () => removeRule(index)
+ },
+ {
+ label: 'Duplicate',
+ icon: 'i-heroicons-document-duplicate',
+ onClick: () => duplicateRule(index)
+ },
+ {
+ label: 'Turn into group',
+ icon: 'i-heroicons-arrow-path',
+ onClick: () => turnIntoGroup(index)
+ }
+ ]
+ ]
+}
+
+function getGroupMenuItems(index) {
+ const group = children.value[index]
+ const canTurnIntoRule = group.children && group.children.length === 1
+
+ const items = [
+ {
+ label: 'Remove',
+ icon: 'i-heroicons-trash',
+ color: 'error',
+ onClick: () => removeRule(index)
+ },
+ {
+ label: 'Duplicate',
+ icon: 'i-heroicons-document-duplicate',
+ onClick: () => duplicateGroup(index)
+ }
+ ]
+
+ if (canTurnIntoRule) {
+ items.push({
+ label: 'Turn into rule',
+ icon: 'i-heroicons-arrow-path',
+ onClick: () => turnIntoRule(index)
+ })
+ }
+
+ return [items]
+}
+
+function duplicateRule(index) {
+ const ruleToDuplicate = children.value[index]
+ const newChildren = [...children.value]
+ newChildren.splice(index + 1, 0, { ...ruleToDuplicate })
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+
+function duplicateGroup(index) {
+ const groupToDuplicate = children.value[index]
+ const newChildren = [...children.value]
+ // Deep clone the group to avoid reference issues
+ const duplicatedGroup = JSON.parse(JSON.stringify(groupToDuplicate))
+ newChildren.splice(index + 1, 0, duplicatedGroup)
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+
+function turnIntoGroup(index) {
+ const rule = children.value[index]
+ const newGroup = {
+ operatorIdentifier: props.config.operators[0]?.identifier || 'and',
+ children: [{ ...rule }]
+ }
+
+ const newChildren = [...children.value]
+ newChildren[index] = newGroup
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+
+function turnIntoRule(index) {
+ const group = children.value[index]
+ const rule = group.children[0] // We know there's exactly one rule
+
+ const newChildren = [...children.value]
+ newChildren[index] = { ...rule }
+
+ emit('query-update', {
+ ...props.query,
+ children: newChildren
+ })
+}
+</script>
\ No newline at end of file
diff --git a/client/components/tools/query-builder/QueryBuilderRule.vue b/client/components/tools/query-builder/QueryBuilderRule.vue
new file mode 100644
index 000000000..fdd7b6d5b
--- /dev/null
+++ b/client/components/tools/query-builder/QueryBuilderRule.vue
@@ -0,0 +1,154 @@
+<template>
+ <div class="flex items-center gap-2 flex-1">
+ <!-- AND/OR Logic with consistent width -->
+ <!-- First rule: "Where" text -->
+ <!-- Second rule: operator selector -->
+ <!-- Third+ rules: text-only operator -->
+
+ <div v-if="index === 0" class="flex-shrink-0 text-sm font-medium text-neutral-600 w-17 text-right">
+ {{ whereText }}
+ </div>
+
+ <div v-else-if="index === 1" class="flex-shrink-0 w-17 text-right">
+ <USelectMenu
+ v-model="currentOperator"
+ :items="operatorOptions"
+ value-key="value"
+ class="w-full"
+ size="sm"
+ variant="outline"
+ :search-input="false"
+ />
+ </div>
+
+ <div v-else class="flex-shrink-0 text-sm font-medium text-neutral-600 w-17 text-right">
+ {{ operatorDisplayName }}
+ </div>
+
+ <!-- Field Selector -->
+ <USelectMenu
+ v-model="selectedField"
+ :items="availableFields"
+ value-key="value"
+ placeholder="Select field..."
+ class="min-w-[140px] max-w-[200px]"
+ size="sm"
+ :ui="{
+ content: 'max-w-[400px]'
+ }"
+ searchable
+ />
+
+ <!-- Rule Component (operator + value) - show when field is selected -->
+ <div v-if="selectedField" class="flex-1 flex items-center">
+ <slot
+ name="rule"
+ :rule-component="ruleComponent"
+ :rule-data="ruleData"
+ :rule-identifier="selectedField"
+ :update-rule-data="updateRuleData"
+ >
+ <component
+ v-if="ruleComponent"
+ :is="ruleComponent"
+ :model-value="ruleData"
+ @update:model-value="updateRuleData"
+ />
+ </slot>
+ </div>
+ </div>
+</template>
+
+<script setup>
+const props = defineProps({
+ config: {
+ type: Object,
+ required: true
+ },
+ query: {
+ type: Object,
+ required: true
+ },
+ index: {
+ type: Number,
+ required: true
+ },
+ selectedOperator: {
+ type: String,
+ default: ''
+ },
+ operatorOptions: {
+ type: Array,
+ default: () => []
+ },
+ whereText: {
+ type: String,
+ default: 'Where'
+ }
+})
+
+const emit = defineEmits(['query-update', 'operator-update'])
+
+const ruleDefinition = computed(() => {
+ return props.config.rules.find(rule => rule.identifier === props.query.identifier)
+})
+
+const ruleComponent = computed(() => {
+ return ruleDefinition.value?.component
+})
+
+const availableFields = computed(() => {
+ return props.config.rules.map(rule => ({
+ label: rule.name,
+ value: rule.identifier
+ }))
+})
+
+const selectedField = computed({
+ get: () => props.query.identifier || '',
+ set: (identifier) => {
+ const ruleDefinition = props.config.rules.find(r => r.identifier === identifier)
+ emit('query-update', {
+ ...props.query,
+ identifier,
+ value: ruleDefinition?.initialValue || null
+ })
+ }
+})
+
+// Auto-set first field if no field is selected
+watchEffect(() => {
+ if (!props.query.identifier && props.config.rules.length > 0) {
+ const firstRule = props.config.rules[0]
+ emit('query-update', {
+ ...props.query,
+ identifier: firstRule.identifier,
+ value: firstRule.initialValue || null
+ })
+ }
+})
+
+const ruleData = computed({
+ get: () => props.query.value,
+ set: (value) => {
+ emit('query-update', {
+ ...props.query,
+ value
+ })
+ }
+})
+
+function updateRuleData(newData) {
+ ruleData.value = newData
+}
+
+const currentOperator = computed({
+ get: () => props.selectedOperator,
+ set: (value) => emit('operator-update', value)
+})
+
+const operatorDisplayName = computed(() => {
+ const operator = props.operatorOptions.find(op => op.value === props.selectedOperator)
+ return operator?.label || 'And'
+})
+</script>
\ No newline at end of file
diff --git a/client/lib/forms/themes/ThemeBuilder.js b/client/lib/forms/themes/ThemeBuilder.js
index 1ecbb71e7..ec78f9136 100644
--- a/client/lib/forms/themes/ThemeBuilder.js
+++ b/client/lib/forms/themes/ThemeBuilder.js
@@ -1,7 +1,7 @@
import {twMerge} from 'tailwind-merge'
import {themes} from './form-themes.js'
-export const sizes = ['sm', 'md', 'lg']
+export const sizes = ['xs', 'sm', 'md', 'lg']
class ThemeBuilder {
constructor(theme = 'default', options = {}) {
diff --git a/client/lib/forms/themes/form-themes.js b/client/lib/forms/themes/form-themes.js
index 8139094c9..cba8a8283 100644
--- a/client/lib/forms/themes/form-themes.js
+++ b/client/lib/forms/themes/form-themes.js
@@ -5,27 +5,31 @@
default: {
default: {
wrapper: {
+ xs: 'relative my-0.5',
sm: 'relative my-1',
md: 'relative my-1.5',
lg: 'relative my-1.5',
},
- label: 'text-gray-700 dark:text-gray-300 font-semibold',
+ label: 'text-neutral-700 dark:text-neutral-300 font-semibold',
input:
- 'flex-1 appearance-none border border-gray-300 dark:border-gray-600 w-full bg-white text-gray-700 dark:bg-notion-dark-light dark:text-gray-300 dark:placeholder-gray-500 placeholder-gray-400 shadow-xs focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent',
- help: 'text-gray-500 dark:text-gray-400',
+ 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 shadow-xs focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent',
+ help: 'text-neutral-500',
spacing: {
horizontal: {
+ xs: 'px-2.5',
sm: 'px-2',
md: 'px-4',
lg: 'px-5'
},
vertical: {
+ xs: 'py-1.5',
sm: 'py-1.5',
md: 'py-2',
lg: 'py-3'
}
},
fontSize: {
+ xs: 'text-xs',
sm: 'text-sm',
md: 'text-base',
lg: 'text-lg'
@@ -37,11 +41,11 @@
}
},
ScaleInput: {
- button: 'cursor-pointer text-gray-700 inline-block border-gray-300 grow dark:bg-notion-dark-light dark:text-gray-300 text-center',
+ button: 'cursor-pointer text-neutral-700 inline-block border-neutral-300 grow dark:bg-notion-dark-light dark:text-neutral-300 text-center',
unselectedButton: 'bg-white border'
},
SliderInput: {
- stepLabel: 'text-gray-700 dark:text-gray-300 text-center text-xs'
+ stepLabel: 'text-neutral-700 dark:text-neutral-300 text-center text-xs'
},
Button: {
body: 'transition ease-in duration-200 text-center font-semibold shadow-md focus:outline-hidden focus:ring-2 focus:ring-offset-2 hover:brightness-90'
@@ -51,16 +55,17 @@
},
RichTextAreaInput: {
input:
- 'flex-1 appearance-none border border-gray-300 dark:border-gray-600 w-full bg-white text-gray-700 dark:bg-notion-dark-light dark:text-gray-300 dark:placeholder-gray-500 placeholder-gray-400 shadow-xs text-base focus:outline-hidden focus:ring-1 focus:ring-form/100 focus:border-transparent focus:ring-2'
+ 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 shadow-xs text-base focus:outline-hidden focus:ring-1 focus:ring-form/100 focus:border-transparent focus:ring-2'
},
SelectInput: {
input:
- 'relative w-full flex-1 appearance-none border border-gray-300 dark:border-gray-600 w-full text-gray-700 dark:text-gray-300 dark:placeholder-gray-600 shadow-xs text-base focus:outline-hidden focus:ring-2 focus:border-transparent',
+ 'relative w-full flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full text-neutral-700 dark:text-neutral-300 dark:placeholder-neutral-600 shadow-xs text-base focus:outline-hidden focus:ring-2 focus:border-transparent',
background: 'bg-white dark:bg-notion-dark-light',
chevronGradient: 'bg-gradient-to-r from-transparent to-white dark:to-notion-dark-light',
- dropdown: 'border border-gray-300 dark:border-gray-600',
+ dropdown: 'border border-neutral-300 dark:border-neutral-600',
option: 'rounded-xs',
minHeight: {
+ xs: 'min-h-[16px]',
sm: 'min-h-[20px]',
md: 'min-h-[24px]',
lg: 'min-h-[28px]'
@@ -68,30 +73,35 @@
},
PhoneInput: {
countrySelectWidth: {
+ xs: 'w-[80px]',
sm: 'w-[100px]',
md: 'w-[120px]',
lg: 'w-[120px]'
},
flag: {
+ xs: '-mt-[16px]!',
sm: '-mt-[14px]!',
md: '-mt-[9px]! rounded-xs',
lg: '-mt-[9px]! rounded-xs'
},
flagSize: {
+ xs: 'small',
sm: 'small',
md: 'normal',
lg: 'normal'
},
maxHeight: {
+ xs: 'max-h-[16px]',
sm: 'max-h-[20px]',
md: 'max-h-[24px]',
lg: 'max-h-[28px]'
}
},
FlatSelectInput: {
- option: 'cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-900 flex items-center gap-x-2 border-t first:border-t-0 px-2',
- unselectedIcon: 'text-gray-300 dark:text-gray-600',
+ option: 'cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-900 flex items-center gap-x-2 border-t first:border-t-0 px-2',
+ unselectedIcon: 'text-neutral-300 dark:text-neutral-600',
icon: {
+ xs: 'w-3 h-3',
sm: 'w-4 h-4',
md: 'w-5 h-5',
lg: 'w-6 h-6 mx-1'
@@ -99,7 +109,7 @@
},
DateInput: {
input:
- 'flex-1 appearance-none border border-gray-300 dark:border-gray-600 w-full bg-white text-gray-700 dark:bg-notion-dark-light dark:text-gray-300 dark:placeholder-gray-500 placeholder-gray-400 shadow-xs text-base focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent'
+ 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 shadow-xs text-base focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent'
},
PaymentInput: {
cardContainer: 'transition-all duration-200',
@@ -107,6 +117,7 @@
},
CheckboxInput:{
size: {
+ xs: 'w-3 h-3',
sm: 'w-4 h-4',
md: 'w-5 h-5',
lg: 'w-5 h-5'
@@ -114,16 +125,19 @@
},
SwitchInput:{
containerSize: {
+ xs: 'h-4 w-8 p-0.5',
sm: 'h-5 w-10 p-0.5',
md: 'h-6 w-12 p-1',
lg: 'h-6 w-12 p-1'
},
circleSize: {
+ xs: 'h-3 w-3',
sm: 'h-4 w-4',
md: 'h-4 w-4',
lg: 'h-4 w-4'
},
translatedClass: {
+ xs: 'translate-x-4',
sm: 'translate-x-5',
md: 'translate-x-6',
lg: 'translate-x-6'
@@ -131,6 +145,7 @@
},
RatingInput:{
size: {
+ xs: 'w-4 h-4',
sm: 'w-6 h-6',
md: 'w-8 h-8',
lg: 'w-10 h-10'
@@ -138,8 +153,9 @@
},
fileInput: {
input:
- 'border border-dashed border-gray-300 dark:border-gray-600 p-4 shadow-none',
+ 'border border-dashed border-neutral-300 dark:border-neutral-600 p-4 shadow-none',
minHeight: {
+ xs: 'min-h-20',
sm: 'min-h-28',
md: 'min-h-40',
lg: 'min-h-58'
@@ -149,10 +165,11 @@
dark: 'bg-notion-dark-light'
},
uploadedFile:
- 'border border-gray-300 dark:border-gray-600 bg-white dark:bg-notion-dark-light rounded-lg shadow-xs max-w-10'
+ 'border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-notion-dark-light rounded-lg shadow-xs max-w-10'
},
SignatureInput: {
minHeight: {
+ xs: 'min-h-20',
sm: 'min-h-28',
md: 'min-h-40',
lg: 'min-h-48'
@@ -160,34 +177,38 @@
},
MatrixInput: {
table: 'bg-white dark:bg-notion-dark-light shadow-xs',
- cell: 'border-gray-300 dark:border-gray-600',
- cellHover: 'hover:bg-gray-50 dark:hover:bg-gray-900'
+ cell: 'border-neutral-300 dark:border-neutral-600',
+ cellHover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900'
}
},
simple: {
default: {
wrapper: {
+ xs: 'relative my-0.5',
sm: 'relative my-1',
md: 'relative my-1.5',
lg: 'relative my-1.5',
},
- label: 'text-gray-700 dark:text-gray-300 font-medium',
+ label: 'text-neutral-700 dark:text-neutral-300 font-medium',
input:
- 'flex-1 appearance-none border border-gray-300 dark:border-gray-600 w-full bg-white text-gray-700 dark:bg-notion-dark-light dark:text-gray-300 dark:placeholder-gray-500 placeholder-gray-400 focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent',
- help: 'text-gray-500 dark:text-gray-400',
+ 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent',
+ help: 'text-neutral-500',
spacing: {
horizontal: {
+ xs: 'px-2.5',
sm: 'px-2',
md: 'px-4',
lg: 'px-5'
},
vertical: {
+ xs: 'py-1.5',
sm: 'py-1.5',
md: 'py-2',
lg: 'py-3'
}
},
fontSize: {
+ xs: 'text-xs',
sm: 'text-sm',
md: 'text-base',
lg: 'text-lg'
@@ -199,11 +220,11 @@
}
},
ScaleInput: {
- button: 'flex-1 appearance-none border-gray-300 dark:border-gray-600 w-full bg-gray-50 text-gray-700 dark:bg-notion-dark-light dark:text-gray-300 text-center',
+ button: 'flex-1 appearance-none border-neutral-300 dark:border-neutral-600 w-full bg-neutral-50 text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 text-center',
unselectedButton: 'bg-white border'
},
SliderInput: {
- stepLabel: 'text-gray-700 dark:text-gray-300 text-center text-xs'
+ stepLabel: 'text-neutral-700 dark:text-neutral-300 text-center text-xs'
},
Button: {
body: 'transition ease-in duration-200 text-center font-semibold focus:outline-hidden focus:ring-2 focus:ring-offset-2 hover:brightness-90'
@@ -213,16 +234,17 @@
},
RichTextAreaInput: {
input:
- 'flex-1 appearance-none border border-gray-300 dark:border-gray-600 w-full bg-white text-gray-700 dark:bg-notion-dark-light dark:text-gray-300 dark:placeholder-gray-500 placeholder-gray-400 text-base focus:outline-hidden focus:ring-1 focus:ring-form/100 focus:border-transparent focus:ring-2'
+ 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 text-base focus:outline-hidden focus:ring-1 focus:ring-form/100 focus:border-transparent focus:ring-2'
},
SelectInput: {
input:
- 'relative w-full flex-1 appearance-none border border-gray-300 dark:border-gray-600 w-full text-gray-700 dark:text-gray-300 dark:placeholder-gray-600 text-base focus:outline-hidden focus:ring-2 focus:border-transparent',
+ 'relative w-full flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full text-neutral-700 dark:text-neutral-300 dark:placeholder-neutral-600 text-base focus:outline-hidden focus:ring-2 focus:border-transparent',
background: 'bg-white dark:bg-notion-dark-light',
chevronGradient: 'bg-gradient-to-r from-transparent to-white dark:to-notion-dark-light',
- dropdown: 'border border-gray-300 dark:border-gray-600',
+ dropdown: 'border border-neutral-300 dark:border-neutral-600',
option: 'rounded-xs',
minHeight: {
+ xs: 'min-h-[16px]',
sm: 'min-h-[20px]',
md: 'min-h-[24px]',
lg: 'min-h-[28px]'
@@ -230,37 +252,42 @@
},
PhoneInput: {
countrySelectWidth: {
- sm: 'w-[100px]',
+ xs: 'w-[80px]',
+ sm: 'w-[100px]',
md: 'w-[120px]',
lg: 'w-[120px]'
},
flag: {
- sm: '-mt-[14px]!',
+ xs: '-mt-[16px]!',
+ sm: '-mt-[14px]!',
md: '-mt-[9px]! rounded-xs',
lg: '-mt-[9px]! rounded-xs'
},
flagSize: {
- sm: 'small',
+ xs: 'small',
+ sm: 'small',
md: 'normal',
lg: 'normal'
},
maxHeight: {
- sm: 'max-h-[20px]',
+ xs: 'max-h-[16px]',
+ sm: 'max-h-[20px]',
md: 'max-h-[24px]',
lg: 'max-h-[28px]'
}
},
FlatSelectInput: {
- option: 'cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-900 flex items-center space-x-2 border-t first:border-t-0 px-2',
- unselectedIcon: 'text-gray-300 dark:text-gray-600',
+ option: 'cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-900 flex items-center space-x-2 border-t first:border-t-0 px-2',
+ unselectedIcon: 'text-neutral-300 dark:text-neutral-600',
icon: {
+ xs: 'w-3 h-3',
sm: 'w-4 h-4',
md: 'w-5 h-5',
lg: 'w-6 h-6 mx-1'
}
},
DateInput: {
- input: 'flex-1 appearance-none border border-gray-300 dark:border-gray-600 w-full bg-white text-gray-700 dark:bg-notion-dark-light dark:text-gray-300 placeholder-gray-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent'
+ input: 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 placeholder-neutral-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent'
},
PaymentInput: {
cardContainer: 'transition-all duration-200',
@@ -268,6 +295,7 @@
},
CheckboxInput:{
size: {
+ xs: 'w-3 h-3',
sm: 'w-4 h-4',
md: 'w-5 h-5',
lg: 'w-5 h-5'
@@ -275,11 +303,13 @@
},
SwitchInput:{
containerSize: {
+ xs: 'h-4 w-8',
sm: 'h-5 w-10',
md: 'h-6 w-12',
lg: 'h-6 w-12'
},
circleSize: {
+ xs: 'h-3 w-3',
sm: 'h-4 w-4',
md: 'h-4 w-4',
lg: 'h-4 w-4'
@@ -287,6 +317,7 @@
},
RatingInput:{
size: {
+ xs: 'w-4 h-4',
sm: 'w-6 h-6',
md: 'w-8 h-8',
lg: 'w-10 h-10'
@@ -294,8 +325,9 @@
},
fileInput: {
input:
- 'border border-dashed border-gray-300 dark:border-gray-600 p-4 shadow-none',
+ 'border border-dashed border-neutral-300 dark:border-neutral-600 p-4 shadow-none',
minHeight: {
+ xs: 'min-h-20',
sm: 'min-h-28',
md: 'min-h-40',
lg: 'min-h-48'
@@ -305,10 +337,11 @@
dark: 'bg-notion-dark-light'
},
uploadedFile:
- 'border border-gray-300 dark:border-gray-600 bg-white dark:bg-notion-dark-light shadow-xs max-w-10'
+ 'border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-notion-dark-light shadow-xs max-w-10'
},
SignatureInput: {
minHeight: {
+ xs: 'min-h-20',
sm: 'min-h-28',
md: 'min-h-40',
lg: 'min-h-48'
@@ -316,34 +349,38 @@
},
MatrixInput: {
table: 'bg-white dark:bg-notion-dark-light',
- cell: 'border-gray-300 dark:border-gray-600',
- cellHover: 'hover:bg-gray-50 dark:hover:bg-gray-900'
+ cell: 'border-neutral-300 dark:border-neutral-600',
+ cellHover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900'
}
},
notion: {
default: {
wrapper: {
+ xs: 'relative my-0.5',
sm: 'relative my-1',
md: 'relative my-1.5',
lg: 'relative my-1.5',
},
- label: 'text-gray-900 dark:text-gray-100 mb-1 block mt-4',
+ label: 'text-neutral-900 dark:text-neutral-100 mb-1 block mt-4',
input:
- 'rounded-xs border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-gray-900 dark:text-gray-100 dark:placeholder-gray-500 placeholder-gray-400 focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
- help: 'text-gray-500 dark:text-gray-400',
+ 'rounded-xs border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100 dark:placeholder-neutral-500 placeholder-neutral-400 focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
+ help: 'text-neutral-500',
spacing: {
horizontal: {
+ xs: 'px-2.5',
sm: 'px-2',
md: 'px-4',
lg: 'px-5'
},
vertical: {
+ xs: 'py-1.5',
sm: 'py-1.5',
md: 'py-2',
lg: 'py-3'
}
},
fontSize: {
+ xs: 'text-xs',
sm: 'text-sm',
md: 'text-base',
lg: 'text-lg'
@@ -355,11 +392,11 @@
}
},
ScaleInput: {
- button: 'border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-gray-900 dark:text-gray-100 text-center focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
+ button: 'border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100 text-center focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
unselectedButton: 'bg-notion-input-background dark:bg-notion-dark-light'
},
SliderInput: {
- stepLabel: 'text-gray-700 dark:text-gray-300 text-center text-xs'
+ stepLabel: 'text-neutral-700 dark:text-neutral-300 text-center text-xs'
},
Button: {
body: 'transition ease-in duration-200 text-center font-semibold border border-notion-input-border dark:border-notion-input-borderDark focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent hover:brightness-90'
@@ -369,16 +406,17 @@
},
RichTextAreaInput: {
input:
- 'flex-1 appearance-none border border-notion-input-border dark:border-notion-input-borderDark w-full bg-notion-input-background dark:bg-notion-dark-light text-gray-900 dark:text-gray-100 dark:placeholder-gray-500 placeholder-gray-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
+ 'flex-1 appearance-none border border-notion-input-border dark:border-notion-input-borderDark w-full bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100 dark:placeholder-neutral-500 placeholder-neutral-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
},
SelectInput: {
input:
- 'relative w-full border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
+ 'relative w-full border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
background: 'bg-notion-input-background dark:bg-notion-dark-light',
chevronGradient: 'bg-gradient-to-r from-transparent to-notion-input-background dark:to-notion-dark-light',
dropdown: 'border border-notion-input-border dark:border-notion-input-borderDark',
option: 'rounded-xs',
minHeight: {
+ xs: 'min-h-[16px]',
sm: 'min-h-[20px]',
md: 'min-h-[24px]',
lg: 'min-h-[28px]'
@@ -386,22 +424,26 @@
},
PhoneInput: {
countrySelectWidth: {
- sm: 'w-[100px]',
+ xs: 'w-[80px]',
+ sm: 'w-[100px]',
md: 'w-[120px]',
lg: 'w-[120px]'
},
flag: {
- sm: '-mt-[14px]!',
+ xs: '-mt-[16px]!',
+ sm: '-mt-[14px]!',
md: '-mt-[9px]! rounded-xs',
lg: '-mt-[9px]! rounded-xs'
},
flagSize: {
- sm: 'small',
+ xs: 'small',
+ sm: 'small',
md: 'normal',
lg: 'normal'
},
maxHeight: {
- sm: 'max-h-[20px]',
+ xs: 'max-h-[16px]',
+ sm: 'max-h-[20px]',
md: 'max-h-[24px]',
lg: 'max-h-[28px]'
}
@@ -410,13 +452,14 @@
option: 'cursor-pointer hover:backdrop-brightness-95 flex items-center space-x-2 border-t border-neutral-300 first:border-t-0 px-2',
unselectedIcon: 'text-neutral-300 dark:text-neutral-600',
icon: {
+ xs: 'w-3 h-3',
sm: 'w-4 h-4',
md: 'w-5 h-5',
lg: 'w-6 h-6 mx-1'
}
},
DateInput: {
- input: 'border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-gray-900 dark:text-gray-100 placeholder-gray-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
+ input: 'border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
},
PaymentInput: {
cardContainer: 'transition-all duration-200',
@@ -424,6 +467,7 @@
},
CheckboxInput:{
size: {
+ xs: 'w-3 h-3',
sm: 'w-4 h-4',
md: 'w-5 h-5',
lg: 'w-5 h-5'
@@ -431,16 +475,19 @@
},
SwitchInput:{
containerSize: {
+ xs: 'h-4 w-8',
sm: 'h-5 w-10',
md: 'h-6 w-12',
lg: 'h-6 w-12'
},
circleSize: {
+ xs: 'h-3 w-3',
sm: 'h-4 w-4',
md: 'h-4 w-4',
lg: 'h-4 w-4'
},
translatedClass: {
+ xs: 'translate-x-4',
sm: 'translate-x-5',
md: 'translate-x-6',
lg: 'translate-x-6'
@@ -448,6 +495,7 @@
},
RatingInput:{
size: {
+ xs: 'w-4 h-4',
sm: 'w-6 h-6',
md: 'w-8 h-8',
lg: 'w-10 h-10'
@@ -457,6 +505,7 @@
input:
'p-4 rounded-xs border border-dashed border-notion-input-border dark:border-notion-input-borderDark bg-notion-input-background dark:bg-notion-dark-light focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
minHeight: {
+ xs: 'min-h-20',
sm: 'min-h-28',
md: 'min-h-40',
lg: 'min-h-48'
@@ -470,6 +519,7 @@
},
SignatureInput: {
minHeight: {
+ xs: 'min-h-20',
sm: 'min-h-28',
md: 'min-h-40',
lg: 'min-h-48'
diff --git a/client/nuxt.config.ts b/client/nuxt.config.ts
index 44e96cf20..1c818bec9 100644
--- a/client/nuxt.config.ts
+++ b/client/nuxt.config.ts
@@ -21,7 +21,7 @@ export default defineNuxtConfig({
],
build: {
- transpile: ["vue-notion", "query-builder-vue-3", "vue-signature-pad", "@zxing/library"],
+ transpile: ["vue-notion", "vue-signature-pad", "@zxing/library"],
},
i18n: {
diff --git a/client/package-lock.json b/client/package-lock.json
index f84fc6367..fbf7f620f 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -43,7 +43,6 @@
"pinia": "^3.0.2",
"prismjs": "^1.29.0",
"qrcode": "^1.5.4",
- "query-builder-vue-3": "^1.0.1",
"quill": "^2.0.2",
"tailwind-merge": "^2.5.4",
"tailwindcss": "^4.1.10",
@@ -18102,20 +18101,6 @@
],
"license": "MIT"
},
- "node_modules/query-builder-vue-3": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/query-builder-vue-3/-/query-builder-vue-3-1.0.1.tgz",
- "integrity": "sha512-fhEWsluNz8vRtrB8w2gjWeSmRkzn1KcOTv9ay6m6w3kX8yTdEUw0ZUv+0P04uhECoXQ+IZRfR4iUD1ffh3M/IQ==",
- "license": "MIT",
- "dependencies": {
- "mitt": "^3.0.0",
- "sortablejs": "^1.14.0",
- "vuedraggable": "^4.1.0"
- },
- "peerDependencies": {
- "vue": "^3.2.20"
- }
- },
"node_modules/query-string": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/query-string/-/query-string-8.1.0.tgz",
@@ -19080,7 +19065,9 @@
"version": "1.15.6",
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.6.tgz",
"integrity": "sha512-aNfiuwMEpfBM/CN6LY0ibyhxPfPbyFeBTYJKCvzkJ2GkUpazIt3H+QIPAMHwqQ7tMKaHz1Qj+rJJCqljnf4p3A==",
- "license": "MIT"
+ "license": "MIT",
+ "optional": true,
+ "peer": true
},
"node_modules/source-map": {
"version": "0.6.1",
diff --git a/client/package.json b/client/package.json
index 7011d5c4a..a47ec6b84 100644
--- a/client/package.json
+++ b/client/package.json
@@ -72,7 +72,7 @@
"pinia": "^3.0.2",
"prismjs": "^1.29.0",
"qrcode": "^1.5.4",
- "query-builder-vue-3": "^1.0.1",
+
"quill": "^2.0.2",
"tailwind-merge": "^2.5.4",
"tailwindcss": "^4.1.10",