PluginProbe
The Innovative Form Builder – IvyForms / 1.1
The Innovative Form Builder – IvyForms v1.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / frontend / src / composables / useHorizontalSpacing.ts

useHorizontalSpacing.ts in The Innovative Form Builder – IvyForms 1.1, at frontend/src/composables/useHorizontalSpacing.ts

28 lines 857 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { computed, type ComputedRef } from 'vue'
2 import { DEFAULT_FORM_STYLES } from '@/constants/defaultFormStyles'
3 import type { FormStyleSettings } from '@/types/form-style'
4
5 const FALLBACK_HORIZONTAL_SPACING = DEFAULT_FORM_STYLES.quickMode?.horizontalSpacing || '12px'
6
7 export function resolveHorizontalSpacing(
8 styleSettings?: FormStyleSettings | null,
9 fallback: string = FALLBACK_HORIZONTAL_SPACING,
10 ): string {
11 if (!styleSettings) {
12 return fallback
13 }
14
15 return (
16 styleSettings.advancedMode?.general?.horizontalSpacing ||
17 styleSettings.quickMode?.horizontalSpacing ||
18 fallback
19 )
20 }
21
22 export function useHorizontalSpacing(
23 styleSettings: ComputedRef<FormStyleSettings | null | undefined>,
24 fallback: string = FALLBACK_HORIZONTAL_SPACING,
25 ) {
26 return computed(() => resolveHorizontalSpacing(styleSettings.value, fallback))
27 }
28