1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-17 10:22:36 +00:00

Text type formulas use GridViewFieldLongText to show text

This commit is contained in:
Davide Silvestri 2022-05-26 11:49:13 +00:00
parent 218ee7968f
commit 702ff21135
5 changed files with 25 additions and 6 deletions
changelog.md
web-frontend/modules/database

View file

@ -14,6 +14,8 @@
select the type of row identifier displayed next to a row (`Count`or `Row Identifier`). select the type of row identifier displayed next to a row (`Count`or `Row Identifier`).
* Added an admin setting to disable the ability to reset a users password. * Added an admin setting to disable the ability to reset a users password.
* Fix formula bug caused when arguments of `when_empty` have different types. * Fix formula bug caused when arguments of `when_empty` have different types.
* Formulas of type text now use textarea to show the cell value.
* Fix a bug in public grid views that prevented expanding long-text cells.
## Released (2022-10-05 1.10.0) ## Released (2022-10-05 1.10.0)

View file

@ -5,6 +5,7 @@
:value="value" :value="value"
:read-only="true" :read-only="true"
:selected="selected" :selected="selected"
:store-prefix="storePrefix"
class="active" class="active"
></component> ></component>
</template> </template>
@ -13,7 +14,7 @@
import gridField from '@baserow/modules/database/mixins/gridField' import gridField from '@baserow/modules/database/mixins/gridField'
export default { export default {
name: 'GridViewFormulaField', name: 'GridViewFieldFormula',
mixins: [gridField], mixins: [gridField],
methods: { methods: {
getComponent(field) { getComponent(field) {

View file

@ -2,18 +2,19 @@
<div <div
ref="cell" ref="cell"
class="grid-view__cell grid-field-long-text__cell active" class="grid-view__cell grid-field-long-text__cell active"
:class="{ editing: editing }" :class="{ editing: opened }"
@contextmenu="stopContextIfEditing($event)" @contextmenu="stopContextIfEditing($event)"
> >
<div v-show="!editing" class="grid-field-long-text">{{ value }}</div> <div v-if="!opened" class="grid-field-long-text">{{ value }}</div>
<textarea <textarea
v-if="editing" v-else-if="editing"
ref="input" ref="input"
v-model="copy" v-model="copy"
v-prevent-parent-scroll v-prevent-parent-scroll
type="text" type="text"
class="grid-field-long-text__textarea" class="grid-field-long-text__textarea"
/> />
<div v-else class="grid-field-long-text__textarea">{{ value }}</div>
</div> </div>
</template> </template>

View file

@ -1,12 +1,15 @@
import { Registerable } from '@baserow/modules/core/registry' import { Registerable } from '@baserow/modules/core/registry'
import RowEditFieldText from '@baserow/modules/database/components/row/RowEditFieldText' import RowEditFieldText from '@baserow/modules/database/components/row/RowEditFieldText'
import RowEditFieldLongText from '@baserow/modules/database/components/row/RowEditFieldLongText'
import RowEditFieldNumber from '@baserow/modules/database/components/row/RowEditFieldNumber' import RowEditFieldNumber from '@baserow/modules/database/components/row/RowEditFieldNumber'
import RowEditFieldDate from '@baserow/modules/database/components/row/RowEditFieldDate' import RowEditFieldDate from '@baserow/modules/database/components/row/RowEditFieldDate'
import GridViewFieldLongText from '@baserow/modules/database/components/view/grid/fields/GridViewFieldLongText'
import RowEditFieldBoolean from '@baserow/modules/database/components/row/RowEditFieldBoolean' import RowEditFieldBoolean from '@baserow/modules/database/components/row/RowEditFieldBoolean'
import FunctionalGridViewFieldDate from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldDate' import FunctionalGridViewFieldDate from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldDate'
import FunctionalGridViewFieldBoolean from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldBoolean' import FunctionalGridViewFieldBoolean from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldBoolean'
import FunctionalGridViewFieldSingleSelect from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldSingleSelect' import FunctionalGridViewFieldSingleSelect from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldSingleSelect'
import FunctionalGridViewFieldNumber from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldNumber' import FunctionalGridViewFieldNumber from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldNumber'
import FunctionalGridViewFieldLongText from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldLongText'
import FunctionalGridViewFieldText from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldText' import FunctionalGridViewFieldText from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldText'
import FunctionalGridViewFieldBlank from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldBlank' import FunctionalGridViewFieldBlank from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldBlank'
import FunctionalGridViewFieldArray from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldArray' import FunctionalGridViewFieldArray from '@baserow/modules/database/components/view/grid/fields/FunctionalGridViewFieldArray'
@ -105,12 +108,16 @@ export class BaserowFormulaTextType extends BaserowFormulaTypeDefinition {
return 'font' return 'font'
} }
getGridViewFieldComponent() {
return GridViewFieldLongText
}
getRowEditFieldComponent() { getRowEditFieldComponent() {
return RowEditFieldText return RowEditFieldLongText
} }
getFunctionalGridViewFieldComponent() { getFunctionalGridViewFieldComponent() {
return FunctionalGridViewFieldText return FunctionalGridViewFieldLongText
} }
getSortOrder() { getSortOrder() {

View file

@ -7,6 +7,10 @@ import { isPrintableUnicodeCharacterKeyPress } from '@baserow/modules/core/utils
export default { export default {
data() { data() {
return { return {
/**
* Indicates whether the cell is opened.
*/
opened: false,
/** /**
* Indicates whether the user is editing the value. * Indicates whether the user is editing the value.
*/ */
@ -88,6 +92,7 @@ export default {
* need it. We will also save the changes if the user was editing. * need it. We will also save the changes if the user was editing.
*/ */
beforeUnSelect() { beforeUnSelect() {
this.opened = false
if (this.editing && this.isValid()) { if (this.editing && this.isValid()) {
this.save() this.save()
} else { } else {
@ -108,6 +113,7 @@ export default {
* Method that can be called to initiate the edit state. * Method that can be called to initiate the edit state.
*/ */
edit(value = null, event = null) { edit(value = null, event = null) {
this.opened = true
if (this.readOnly) { if (this.readOnly) {
return return
} }
@ -122,6 +128,7 @@ export default {
* eventually save the changes. * eventually save the changes.
*/ */
save() { save() {
this.opened = false
this.editing = false this.editing = false
const newValue = this.beforeSave(this.copy) const newValue = this.beforeSave(this.copy)
@ -138,6 +145,7 @@ export default {
* without saving. * without saving.
*/ */
cancel() { cancel() {
this.opened = false
this.editing = false this.editing = false
this.copy = this.value this.copy = this.value
this.$emit('edit', this.value, this.value) this.$emit('edit', this.value, this.value)