mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-15 01:28:30 +00:00
Improve create and edit field context
This commit is contained in:
parent
511716c984
commit
6c534b73c5
6 changed files with 49 additions and 2 deletions
changelog/entries/unreleased/feature
web-frontend/modules
core/assets/scss/components
database/components
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"type": "feature",
|
||||
"message": "Improve create and edit field context",
|
||||
"issue_number": 1160,
|
||||
"bullet_points": [
|
||||
"Set field context menu width to 400px",
|
||||
"Open field type dropdown when field context menu is opened",
|
||||
"Set field name after field type when empty",
|
||||
"Increase field context menu dropdown height"
|
||||
],
|
||||
"created_at": "2023-03-03"
|
||||
}
|
|
@ -14,6 +14,7 @@
|
|||
@import 'select';
|
||||
@import 'choose_select';
|
||||
@import 'dropdown';
|
||||
@import 'field_form_context';
|
||||
@import 'tooltip';
|
||||
@import 'markdown';
|
||||
@import 'rating';
|
||||
|
@ -107,7 +108,7 @@
|
|||
@import 'row_edit_modal';
|
||||
@import 'data_table';
|
||||
@import 'auth';
|
||||
@import "expand_on_overflow_list";
|
||||
@import 'expand_on_overflow_list';
|
||||
@import 'list';
|
||||
@import 'help_icon';
|
||||
@import 'group_invite_form';
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
.field-form-context {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.field-form-context__dropdown {
|
||||
.select__items {
|
||||
max-height: clamp(165px, 500px, calc(100vh - 220px));
|
||||
}
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
<template>
|
||||
<Context ref="context">
|
||||
<Context
|
||||
ref="context"
|
||||
class="field-form-context"
|
||||
@shown="$emit('shown', $event)"
|
||||
>
|
||||
<FieldForm
|
||||
ref="form"
|
||||
:table="table"
|
||||
|
@ -92,6 +96,9 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
showFieldTypesDropdown(target) {
|
||||
this.$refs.form.showFieldTypesDropdown(target)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -45,8 +45,10 @@
|
|||
<div v-if="forcedType === null" class="control">
|
||||
<div class="control__elements">
|
||||
<Dropdown
|
||||
ref="fieldTypesDropdown"
|
||||
v-model="values.type"
|
||||
:class="{ 'dropdown--error': $v.values.type.$error }"
|
||||
class="field-form-context__dropdown"
|
||||
@hide="$v.values.type.$touch()"
|
||||
>
|
||||
<DropdownItem
|
||||
|
@ -131,6 +133,15 @@ export default {
|
|||
fields: 'field/getAll',
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
'values.type'(newValueType, oldValueType) {
|
||||
if (
|
||||
this.values.name === '' ||
|
||||
this.values.name === this.fieldTypes[oldValueType]?.getName()
|
||||
)
|
||||
this.values.name = this.fieldTypes[newValueType]?.getName()
|
||||
},
|
||||
},
|
||||
validations() {
|
||||
return {
|
||||
values: {
|
||||
|
@ -158,6 +169,9 @@ export default {
|
|||
getFormComponent(type) {
|
||||
return this.$registry.get('field', type).getFormComponent()
|
||||
},
|
||||
showFieldTypesDropdown(target) {
|
||||
this.$refs.fieldTypesDropdown.show(target)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
ref="createFieldContext"
|
||||
:table="table"
|
||||
@field-created="$emit('field-created', $event)"
|
||||
@shown="onShownCreateFieldContext"
|
||||
></CreateFieldContext>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -150,6 +151,9 @@ export default {
|
|||
notifyIf(error, 'view')
|
||||
}
|
||||
},
|
||||
onShownCreateFieldContext() {
|
||||
this.$refs.createFieldContext.showFieldTypesDropdown(this.$el)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue