1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-22 15:52:34 +00:00
bramw_baserow/web-frontend/modules/builder/components/page/settings/PageSettingsNameFormElement.vue
2024-11-14 12:30:42 +00:00

67 lines
1.4 KiB
Vue

<template>
<FormGroup
required
small-label
:label="$t('pageForm.nameTitle')"
:error="hasErrors"
:helper-text="$t('pageForm.nameSubtitle')"
>
<FormInput
ref="input"
size="large"
:placeholder="$t('pageForm.namePlaceholder')"
:value="value"
:disabled="disabled"
@input="$emit('input', $event)"
@blur="$emit('blur')"
@focus.once="isCreation && $event.target.select()"
>
</FormInput>
<template #error>
<span v-if="validationState.$dirty && !validationState.required">
{{ $t('error.requiredField') }}
</span>
<span v-if="validationState.$dirty && !validationState.maxLength">
{{ $t('error.maxLength', { max: 255 }) }}
</span>
<span v-if="validationState.$dirty && !validationState.isUnique">
{{ $t('pageErrors.errorNameNotUnique') }}
</span>
</template>
</FormGroup>
</template>
<script>
export default {
name: 'PageSettingsNameFormElement',
props: {
value: {
type: String,
required: false,
default: '',
},
hasErrors: {
type: Boolean,
required: false,
default: false,
},
disabled: {
type: Boolean,
required: false,
default: false,
},
validationState: {
type: Object,
required: false,
default: () => ({}),
},
isCreation: {
type: Boolean,
required: false,
default: false,
},
},
}
</script>