Add record list configuration for columns text wrap
This commit is contained in:
parent
7b680ef09e
commit
ba6a5985d3
@ -33,6 +33,7 @@
|
|||||||
<field-picker
|
<field-picker
|
||||||
:module="module"
|
:module="module"
|
||||||
:fields.sync="filteredFields"
|
:fields.sync="filteredFields"
|
||||||
|
:field-subset="fieldSubset"
|
||||||
style="height: 71vh;"
|
style="height: 71vh;"
|
||||||
/>
|
/>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
@ -78,6 +79,12 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'light',
|
default: 'light',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fieldSubset: {
|
||||||
|
type: Array,
|
||||||
|
required: false,
|
||||||
|
default: () => null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
@ -89,8 +96,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
fields (fields) {
|
fields: {
|
||||||
|
immediate: true,
|
||||||
|
handler (fields) {
|
||||||
|
if (fields) {
|
||||||
this.filteredFields = this.module.filterFields(fields)
|
this.filteredFields = this.module.filterFields(fields)
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -133,7 +133,9 @@ export default {
|
|||||||
|
|
||||||
let sysFields = []
|
let sysFields = []
|
||||||
|
|
||||||
if (!this.disableSystemFields) {
|
if (this.disableSystemFields && mFields) {
|
||||||
|
mFields = mFields.filter(({ isSystem }) => !isSystem)
|
||||||
|
} else if (!this.fieldSubset) {
|
||||||
sysFields = this.module.systemFields().map(sf => {
|
sysFields = this.module.systemFields().map(sf => {
|
||||||
sf.label = this.$t(`field:system.${sf.name}`)
|
sf.label = this.$t(`field:system.${sf.name}`)
|
||||||
return sf
|
return sf
|
||||||
@ -142,10 +144,6 @@ export default {
|
|||||||
if (this.systemFields) {
|
if (this.systemFields) {
|
||||||
sysFields = sysFields.filter(({ name }) => this.systemFields.find(sf => sf === name))
|
sysFields = sysFields.filter(({ name }) => this.systemFields.find(sf => sf === name))
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (mFields) {
|
|
||||||
mFields = mFields.filter(({ isSystem }) => !isSystem)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.disableSorting && mFields) {
|
if (!this.disableSorting && mFields) {
|
||||||
|
|||||||
@ -10,10 +10,6 @@ export default {
|
|||||||
}
|
}
|
||||||
return this.value ? this.field.formatValue(this.value) : null
|
return this.value ? this.field.formatValue(this.value) : null
|
||||||
},
|
},
|
||||||
|
|
||||||
classes () {
|
|
||||||
return this.field.isMulti ? ['multiline'] : []
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div :class="classes">
|
||||||
<span
|
<span
|
||||||
v-for="(v, index) of formattedValue"
|
v-for="(v, index) of formattedValue"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div :class="classes">
|
||||||
<span
|
<span
|
||||||
v-for="(c, index) of localValue"
|
v-for="(c, index) of localValue"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
>
|
>
|
||||||
<p
|
<p
|
||||||
:style="{ 'white-space': field.options.useRichTextEditor && 'pre-line' }"
|
:style="{ 'white-space': field.options.useRichTextEditor && 'pre-line' }"
|
||||||
:class="{ 'multiline': field.isMulti || field.options.multiLine }"
|
:class="[ 'multiline' && field.isMulti || field.options.multiLine, ...classes ]"
|
||||||
v-html="formatted"
|
v-html="formatted"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -19,5 +19,21 @@ import base from './base'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
extends: base,
|
extends: base,
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
classes () {
|
||||||
|
const classes = []
|
||||||
|
const { fieldID } = this.field
|
||||||
|
const { textStyles = {} } = this.extraOptions
|
||||||
|
|
||||||
|
if (this.field.isMulti || this.field.options.multiLine) {
|
||||||
|
classes.push('multiline')
|
||||||
|
} else if (textStyles.noWrapFields && textStyles.noWrapFields.includes(fieldID)) {
|
||||||
|
classes.push('text-nowrap')
|
||||||
|
}
|
||||||
|
|
||||||
|
return classes
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div :class="classes">
|
||||||
<span
|
<span
|
||||||
v-for="(v, index) of formattedValue"
|
v-for="(v, index) of formattedValue"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|||||||
@ -67,10 +67,17 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
classes () {
|
classes () {
|
||||||
|
const classes = []
|
||||||
|
const { fieldID } = this.field
|
||||||
|
const { textStyles = {} } = this.extraOptions
|
||||||
|
|
||||||
if (this.field.isMulti) {
|
if (this.field.isMulti) {
|
||||||
return ['multiline']
|
classes.push('multiline')
|
||||||
|
} else if (textStyles.noWrapFields && textStyles.noWrapFields.includes(fieldID)) {
|
||||||
|
classes.push('text-nowrap')
|
||||||
}
|
}
|
||||||
return []
|
|
||||||
|
return classes
|
||||||
},
|
},
|
||||||
|
|
||||||
options () {
|
options () {
|
||||||
|
|||||||
@ -128,6 +128,27 @@
|
|||||||
</b-form-text>
|
</b-form-text>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
|
|
||||||
|
<b-col
|
||||||
|
cols="12"
|
||||||
|
md="6"
|
||||||
|
>
|
||||||
|
<b-form-group
|
||||||
|
:label="$t('recordList.record.textStyles')"
|
||||||
|
label-class="text-primary"
|
||||||
|
>
|
||||||
|
<column-picker
|
||||||
|
size="sm"
|
||||||
|
variant="light"
|
||||||
|
:module="recordListModule"
|
||||||
|
:fields="options.textStyles.noWrapFields || []"
|
||||||
|
:field-subset="options.fields.length ? options.fields : recordListModule.fields"
|
||||||
|
@updateFields="onUpdateTextWrapOption"
|
||||||
|
>
|
||||||
|
{{ $t('recordList.record.configureNonWrappingFelids') }}
|
||||||
|
</column-picker>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -825,6 +846,7 @@ import AutomationTab from './Shared/AutomationTab'
|
|||||||
import FieldPicker from 'corteza-webapp-compose/src/components/Common/FieldPicker'
|
import FieldPicker from 'corteza-webapp-compose/src/components/Common/FieldPicker'
|
||||||
import RecordListFilter from 'corteza-webapp-compose/src/components/Common/RecordListFilter'
|
import RecordListFilter from 'corteza-webapp-compose/src/components/Common/RecordListFilter'
|
||||||
import { components } from '@cortezaproject/corteza-vue'
|
import { components } from '@cortezaproject/corteza-vue'
|
||||||
|
import ColumnPicker from 'corteza-webapp-compose/src/components/Admin/Module/Records/ColumnPicker'
|
||||||
const { CInputPresort, CInputRole } = components
|
const { CInputPresort, CInputRole } = components
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -841,6 +863,7 @@ export default {
|
|||||||
RecordListFilter,
|
RecordListFilter,
|
||||||
Draggable,
|
Draggable,
|
||||||
CInputRole,
|
CInputRole,
|
||||||
|
ColumnPicker,
|
||||||
},
|
},
|
||||||
|
|
||||||
extends: base,
|
extends: base,
|
||||||
@ -880,6 +903,13 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
textWrapDisplayOptions () {
|
||||||
|
return [
|
||||||
|
{ value: 'text-wrap', text: this.$t('recordList.record.wrapText') },
|
||||||
|
{ value: 'text-nowrap', text: this.$t('recordList.record.showFullText') },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
recordListModule () {
|
recordListModule () {
|
||||||
if (this.options.moduleID !== NoID) {
|
if (this.options.moduleID !== NoID) {
|
||||||
return this.getModuleByID(this.options.moduleID)
|
return this.getModuleByID(this.options.moduleID)
|
||||||
@ -1050,6 +1080,12 @@ export default {
|
|||||||
this.checkboxLabel = {}
|
this.checkboxLabel = {}
|
||||||
this.resolvedRoles = {}
|
this.resolvedRoles = {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onUpdateTextWrapOption (fields = []) {
|
||||||
|
if (this.options.textStyles.noWrapFields) {
|
||||||
|
this.options.textStyles.noWrapFields = fields.map(f => f.fieldID)
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -69,6 +69,10 @@ export interface Options {
|
|||||||
filterPresets: FilterPreset[];
|
filterPresets: FilterPreset[];
|
||||||
showRecordPerPageOption: boolean;
|
showRecordPerPageOption: boolean;
|
||||||
openRecordInEditMode: boolean;
|
openRecordInEditMode: boolean;
|
||||||
|
|
||||||
|
textStyles: {
|
||||||
|
noWrapFields: Array<string>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaults: Readonly<Options> = Object.freeze({
|
const defaults: Readonly<Options> = Object.freeze({
|
||||||
@ -124,6 +128,10 @@ const defaults: Readonly<Options> = Object.freeze({
|
|||||||
filterPresets: [],
|
filterPresets: [],
|
||||||
showRecordPerPageOption: false,
|
showRecordPerPageOption: false,
|
||||||
openRecordInEditMode: false,
|
openRecordInEditMode: false,
|
||||||
|
|
||||||
|
textStyles: {
|
||||||
|
noWrapFields: [],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export class PageBlockRecordList extends PageBlock {
|
export class PageBlockRecordList extends PageBlock {
|
||||||
@ -150,7 +158,7 @@ export class PageBlockRecordList extends PageBlock {
|
|||||||
'recordDisplayOption',
|
'recordDisplayOption',
|
||||||
'magnifyOption',
|
'magnifyOption',
|
||||||
'recordSelectorDisplayOption',
|
'recordSelectorDisplayOption',
|
||||||
'addRecordDisplayOption'
|
'addRecordDisplayOption',
|
||||||
)
|
)
|
||||||
|
|
||||||
Apply(this.options, o, Number, 'perPage', 'refreshRate')
|
Apply(this.options, o, Number, 'perPage', 'refreshRate')
|
||||||
@ -205,6 +213,10 @@ export class PageBlockRecordList extends PageBlock {
|
|||||||
if (o.selectionButtons) {
|
if (o.selectionButtons) {
|
||||||
this.options.selectionButtons = o.selectionButtons.map(b => new Button(b))
|
this.options.selectionButtons = o.selectionButtons.map(b => new Button(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (o.textStyles) {
|
||||||
|
this.options.textStyles = o.textStyles
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetch (api: ComposeAPI, recordListModule: Module, filter: {[_: string]: unknown}): Promise<object> {
|
async fetch (api: ComposeAPI, recordListModule: Module, filter: {[_: string]: unknown}): Promise<object> {
|
||||||
|
|||||||
@ -514,6 +514,9 @@ recordList:
|
|||||||
recordDisplayOptions: On record click
|
recordDisplayOptions: On record click
|
||||||
recordSelectorDisplayOptions: On record selector click
|
recordSelectorDisplayOptions: On record selector click
|
||||||
addRecordOptions: On add record click
|
addRecordOptions: On add record click
|
||||||
|
textStyles: Text Styles
|
||||||
|
configureNonWrappingFelids: Configure non-wrapping fields
|
||||||
|
showFullText: Show full text
|
||||||
recordPage: record page
|
recordPage: record page
|
||||||
refField:
|
refField:
|
||||||
footnote: Field that links records with the parent record
|
footnote: Field that links records with the parent record
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user