|
|
@ -56,7 +56,7 @@ |
|
|
|
> |
|
|
|
> |
|
|
|
<v-card |
|
|
|
<v-card |
|
|
|
v-for="(col) in hiddenColumns" |
|
|
|
v-for="(col) in hiddenColumns" |
|
|
|
:key="col.alias" |
|
|
|
:key="col.title" |
|
|
|
class="pa-2 my-2 item pointer elevation-0" |
|
|
|
class="pa-2 my-2 item pointer elevation-0" |
|
|
|
@mousedown="moved=false" |
|
|
|
@mousedown="moved=false" |
|
|
|
@mousemove="moved=false" |
|
|
|
@mousemove="moved=false" |
|
|
@ -178,13 +178,13 @@ |
|
|
|
> |
|
|
|
> |
|
|
|
<div |
|
|
|
<div |
|
|
|
v-for="(col,i) in columns" |
|
|
|
v-for="(col,i) in columns" |
|
|
|
:key="col.alias" |
|
|
|
:key="col.title" |
|
|
|
class="nc-field-wrapper item px-4 my-3 pointer" |
|
|
|
class="nc-field-wrapper item px-4 my-3 pointer" |
|
|
|
:class="{'nc-editable':isEditable , 'active-row': isActiveRow(col) , 'py-4': !isActiveRow(col) , 'pb-4':isActiveRow(col)}" |
|
|
|
:class="{'nc-editable':isEditable , 'active-row': isActiveRow(col) , 'py-4': !isActiveRow(col) , 'pb-4':isActiveRow(col)}" |
|
|
|
> |
|
|
|
> |
|
|
|
<div |
|
|
|
<div |
|
|
|
v-click-outside="() => onClickOutside(col)" |
|
|
|
v-click-outside="() => onClickOutside(col)" |
|
|
|
@click="activeRow= col.alias" |
|
|
|
@click="activeRow= col.title" |
|
|
|
> |
|
|
|
> |
|
|
|
<template |
|
|
|
<template |
|
|
|
v-if="_isUIAllowed('editFormView')" |
|
|
|
v-if="_isUIAllowed('editFormView')" |
|
|
@ -195,10 +195,10 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
<div |
|
|
|
v-if="localParams.fields && localParams.fields[col.alias]" |
|
|
|
v-if="localParams.fields && localParams.fields[col.title]" |
|
|
|
:class="{ |
|
|
|
:class="{ |
|
|
|
'active-row' : active === col.title, |
|
|
|
'active-row' : active === col.title, |
|
|
|
required: isRequired(col, localState, localParams.fields[col.alias].required) |
|
|
|
required: isRequired(col, localState, localParams.fields[col.title].required) |
|
|
|
}" |
|
|
|
}" |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="nc-field-editables" :class="{'nc-show' : isActiveRow(col)}"> |
|
|
|
<div class="nc-field-editables" :class="{'nc-show' : isActiveRow(col)}"> |
|
|
@ -256,7 +256,7 @@ |
|
|
|
:nodes="nodes" |
|
|
|
:nodes="nodes" |
|
|
|
:is-form="true" |
|
|
|
:is-form="true" |
|
|
|
:meta="meta" |
|
|
|
:meta="meta" |
|
|
|
:required="isRequired(col, localState, localParams.fields[col.alias].required)" |
|
|
|
:required="isRequired(col, localState, localParams.fields[col.title].required)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<header-cell |
|
|
|
<header-cell |
|
|
|
v-else |
|
|
|
v-else |
|
|
@ -265,7 +265,7 @@ |
|
|
|
:value="col.label || col.title" |
|
|
|
:value="col.label || col.title" |
|
|
|
:column="col" |
|
|
|
:column="col" |
|
|
|
:sql-ui="sqlUi" |
|
|
|
:sql-ui="sqlUi" |
|
|
|
:required="isRequired(col, localState, localParams.fields[col.alias].required)" |
|
|
|
:required="isRequired(col, localState, localParams.fields[col.title].required)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
</label> |
|
|
|
</label> |
|
|
@ -287,11 +287,11 @@ |
|
|
|
:is-form="true" |
|
|
|
:is-form="true" |
|
|
|
:hint="col.description" |
|
|
|
:hint="col.description" |
|
|
|
:required="col.required" |
|
|
|
:required="col.required" |
|
|
|
@update:localState="state => $set(virtual,col.alias, state)" |
|
|
|
@update:localState="state => $set(virtual,col.title, state)" |
|
|
|
@updateCol="updateCol" |
|
|
|
@updateCol="updateCol" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div |
|
|
|
<div |
|
|
|
v-if="$v.virtual && $v.virtual.$dirty && $v.virtual[col.alias] && (!$v.virtual[col.alias].required || !$v.virtual[col.alias].minLength)" |
|
|
|
v-if="$v.virtual && $v.virtual.$dirty && $v.virtual[col.title] && (!$v.virtual[col.title].required || !$v.virtual[col.alias].minLength)" |
|
|
|
class="error--text caption" |
|
|
|
class="error--text caption" |
|
|
|
> |
|
|
|
> |
|
|
|
Field is required. |
|
|
|
Field is required. |
|
|
@ -512,18 +512,18 @@ export default { |
|
|
|
virtual: {} |
|
|
|
virtual: {} |
|
|
|
} |
|
|
|
} |
|
|
|
for (const column of this.columns) { |
|
|
|
for (const column of this.columns) { |
|
|
|
if (!this.localParams || !this.localParams.fields || !this.localParams.fields[column.alias]) { |
|
|
|
if (!this.localParams || !this.localParams.fields || !this.localParams.fields[column.title]) { |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
if (!column.virtual && (((column.rqd || column.notnull) && !column.cdf) || (column.pk && !(column.ai || column.default)) || this.localParams.fields[column.alias].required)) { |
|
|
|
if (!column.virtual && (((column.rqd || column.notnull) && !column.cdf) || (column.pk && !(column.ai || column.default)) || this.localParams.fields[column.title].required)) { |
|
|
|
obj.localState[column.title] = { required } |
|
|
|
obj.localState[column.title] = { required } |
|
|
|
} else if (column.bt) { |
|
|
|
} else if (column.bt) { |
|
|
|
const col = this.meta.columns.find(c => c.column_name === column.bt.column_name) |
|
|
|
const col = this.meta.columns.find(c => c.column_name === column.bt.column_name) |
|
|
|
if ((col.rqd && !col.default) || this.localParams.fields[column.alias].required) { |
|
|
|
if ((col.rqd && !col.default) || this.localParams.fields[column.title].required) { |
|
|
|
obj.localState[col.title] = { required } |
|
|
|
obj.localState[col.title] = { required } |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (column.virtual && this.localParams.fields[column.alias].required && (column.mm || column.hm)) { |
|
|
|
} else if (column.virtual && this.localParams.fields[column.title].required && (column.mm || column.hm)) { |
|
|
|
obj.virtual[column.alias] = { |
|
|
|
obj.virtual[column.title] = { |
|
|
|
minLength: minLength(1), |
|
|
|
minLength: minLength(1), |
|
|
|
required |
|
|
|
required |
|
|
|
} |
|
|
|
} |
|
|
@ -589,7 +589,7 @@ export default { |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
'meta.columns'() { |
|
|
|
'meta.columns'() { |
|
|
|
this.meta.columns.forEach((c) => { |
|
|
|
this.meta.columns.forEach((c) => { |
|
|
|
this.localParams.fields[c.alias] = this.localParams.fields[c.alias] || {} |
|
|
|
this.localParams.fields[c.title] = this.localParams.fields[c.title] || {} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
submitted(val) { |
|
|
|
submitted(val) { |
|
|
@ -616,7 +616,7 @@ export default { |
|
|
|
fields: {} |
|
|
|
fields: {} |
|
|
|
}, this.localParams) |
|
|
|
}, this.localParams) |
|
|
|
this.availableColumns.forEach((c) => { |
|
|
|
this.availableColumns.forEach((c) => { |
|
|
|
localParams.fields[c.alias] = localParams.fields[c.alias] || {} |
|
|
|
localParams.fields[c.title] = localParams.fields[c.title] || {} |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.localParams = localParams |
|
|
|
this.localParams = localParams |
|
|
|
// this.columns = [...this.availableColumns] |
|
|
|
// this.columns = [...this.availableColumns] |
|
|
@ -706,7 +706,6 @@ export default { |
|
|
|
const meta = this.$store.state.meta.metas[this.meta.id] |
|
|
|
const meta = this.$store.state.meta.metas[this.meta.id] |
|
|
|
this.fields = meta.columns.map(c => ({ |
|
|
|
this.fields = meta.columns.map(c => ({ |
|
|
|
...c, |
|
|
|
...c, |
|
|
|
alias: c.title, |
|
|
|
|
|
|
|
fk_column_id: c.id, |
|
|
|
fk_column_id: c.id, |
|
|
|
fk_view_id: this.viewId, |
|
|
|
fk_view_id: this.viewId, |
|
|
|
...(fieldById[c.id] ? fieldById[c.id] : {}), |
|
|
|
...(fieldById[c.id] ? fieldById[c.id] : {}), |
|
|
@ -778,7 +777,7 @@ export default { |
|
|
|
(column.pk && !column.ai && !column.cdf) |
|
|
|
(column.pk && !column.ai && !column.cdf) |
|
|
|
if (column.uidt === UITypes.LinkToAnotherRecord && column.colOptions.type === RelationTypes.BELONGS_TO) { |
|
|
|
if (column.uidt === UITypes.LinkToAnotherRecord && column.colOptions.type === RelationTypes.BELONGS_TO) { |
|
|
|
const col = this.meta.columns.find(c => c.id === column.colOptions.fk_child_column_id) |
|
|
|
const col = this.meta.columns.find(c => c.id === column.colOptions.fk_child_column_id) |
|
|
|
if ((col.rqd && !col.default) || this.localParams.fields[column.alias].required) { |
|
|
|
if ((col.rqd && !col.default) || this.localParams.fields[column.title].required) { |
|
|
|
isRequired = true |
|
|
|
isRequired = true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -798,10 +797,10 @@ export default { |
|
|
|
this.$set(this.localState, column, id) |
|
|
|
this.$set(this.localState, column, id) |
|
|
|
}, |
|
|
|
}, |
|
|
|
isActiveRow(col) { |
|
|
|
isActiveRow(col) { |
|
|
|
return this.activeRow === col.alias |
|
|
|
return this.activeRow === col.title |
|
|
|
}, |
|
|
|
}, |
|
|
|
onClickOutside(col) { |
|
|
|
onClickOutside(col) { |
|
|
|
this.activeRow = this.activeRow === col.alias ? null : this.activeRow |
|
|
|
this.activeRow = this.activeRow === col.title ? null : this.activeRow |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleMouseUp(col) { |
|
|
|
handleMouseUp(col) { |
|
|
|
if (!this.moved) { |
|
|
|
if (!this.moved) { |
|
|
|