| 1 |
<template> |
| 2 |
<div class="ivyforms-field__numeric"> |
| 3 |
<IvyFormItem :label="label" :required="required"> |
| 4 |
<IvyTextInput |
| 5 |
:id="index" |
| 6 |
readonly |
| 7 |
:placeholder="placeholder" |
| 8 |
:model-value="modelValue" |
| 9 |
:type="type" |
| 10 |
/> |
| 11 |
</IvyFormItem> |
| 12 |
</div> |
| 13 |
</template> |
| 14 |
|
| 15 |
<script setup lang="ts"> |
| 16 |
import { computed } from 'vue' |
| 17 |
import { useFormBuilder } from '@/stores/useFormBuilder' |
| 18 |
|
| 19 |
const props = defineProps<{ fieldIndex: number }>() |
| 20 |
const formBuilderStore = useFormBuilder() |
| 21 |
|
| 22 |
// Computed properties to dynamically get values from the store |
| 23 |
const field = computed(() => formBuilderStore.fields.find((f) => f.fieldIndex === props.fieldIndex)) |
| 24 |
|
| 25 |
const label = computed(() => field.value?.label || '') |
| 26 |
const placeholder = computed(() => field.value?.placeholder || '') |
| 27 |
const required = computed(() => field.value?.required || false) |
| 28 |
const index = computed(() => field.value?.fieldIndex ?? props.fieldIndex) |
| 29 |
const type = computed(() => field.value?.type || 'number') |
| 30 |
const modelValue = computed(() => field.value?.defaultValue || '') |
| 31 |
</script> |
| 32 |
<style lang="scss" scoped> |
| 33 |
.ivyforms-field__numeric { |
| 34 |
.ivyforms-form-item { |
| 35 |
margin-bottom: 0; |
| 36 |
:deep(.ivyforms-form-item__label) { |
| 37 |
display: flex; |
| 38 |
align-items: center; |
| 39 |
color: var(--map-base-text-0); |
| 40 |
/* Medium/Medium 14 */ |
| 41 |
font-size: 14px; |
| 42 |
font-style: normal; |
| 43 |
font-weight: 500; |
| 44 |
line-height: 20px; /* 142.857% */ |
| 45 |
margin-bottom: 6px; |
| 46 |
cursor: move; |
| 47 |
} |
| 48 |
:deep(.el-form-item__label) { |
| 49 |
cursor: move; |
| 50 |
} |
| 51 |
.ivyforms-input.el-input { |
| 52 |
:deep(.el-input__wrapper:hover), |
| 53 |
:deep(.el-input__wrapper.is-focus), |
| 54 |
:deep(.el-input__wrapper) { |
| 55 |
border-radius: var(--Radius-radius-md, 8px); |
| 56 |
border: 1px solid var(--map-base-dusk-stroke--2); |
| 57 |
background: var(--map-base-dusk-o05); |
| 58 |
box-shadow: none; |
| 59 |
padding: 0 12px; |
| 60 |
transition: none; |
| 61 |
cursor: move; |
| 62 |
} |
| 63 |
:deep(input) { |
| 64 |
border: none; |
| 65 |
background: transparent; |
| 66 |
cursor: default; |
| 67 |
box-shadow: none; |
| 68 |
|
| 69 |
&:focus { |
| 70 |
outline: none; |
| 71 |
border: 1px solid transparent; /* Ensure border does not change */ |
| 72 |
background: none; /* Ensure background does not change */ |
| 73 |
box-shadow: none; |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
</style> |
| 80 |
|