mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
3 years ago
|
import { RelationTypes, UITypes } from 'nocodb-sdk'
|
||
|
|
||
3 years ago
|
export default {
|
||
|
props: {
|
||
|
disabledColumns: {
|
||
|
type: Object,
|
||
|
default() {
|
||
|
return {}
|
||
|
}
|
||
|
},
|
||
|
sqlUi: [Object, Function],
|
||
|
nodes: [Object],
|
||
|
api: [Object]
|
||
|
},
|
||
|
methods: {
|
||
3 years ago
|
isValid(_columnObj, rowObj, required = false) {
|
||
3 years ago
|
if (!this.meta) { return }
|
||
3 years ago
|
let columnObj = _columnObj
|
||
3 years ago
|
if (columnObj.uidt === UITypes.LinkToAnotherRecord && columnObj.colOptions && columnObj.colOptions.type === RelationTypes.BELONGS_TO) {
|
||
|
columnObj = this.meta.columns.find(c => c.id === columnObj.colOptions.fk_child_column_id)
|
||
3 years ago
|
}
|
||
3 years ago
|
return ((required || columnObj.rqd) &&
|
||
3 years ago
|
(rowObj[columnObj.title] === undefined || rowObj[columnObj.title] === null) &&
|
||
|
!columnObj.cdf)
|
||
3 years ago
|
},
|
||
|
isRequired(_columnObj, rowObj, required = false) {
|
||
|
let columnObj = _columnObj
|
||
3 years ago
|
if (columnObj.uidt === UITypes.LinkToAnotherRecord && columnObj.colOptions && columnObj.colOptions.type === RelationTypes.BELONGS_TO) {
|
||
|
columnObj = this.meta.columns.find(c => c.id === columnObj.colOptions.fk_child_column_id)
|
||
3 years ago
|
}
|
||
3 years ago
|
|
||
|
return required || (columnObj && columnObj.rqd &&
|
||
|
!columnObj.cdf)
|
||
3 years ago
|
}
|
||
|
}
|
||
|
}
|