mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
export default {
|
|
props: {
|
|
table: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
fieldType: {
|
|
type: String,
|
|
required: false,
|
|
default: '',
|
|
},
|
|
view: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
primary: {
|
|
type: Boolean,
|
|
},
|
|
allFieldsInTable: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
database: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
fieldConstraints: {
|
|
type: Array,
|
|
required: false,
|
|
default: () => [],
|
|
},
|
|
},
|
|
computed: {
|
|
hasViewLevelDefaultValue() {
|
|
const fieldId = this.defaultValues?.id
|
|
if (!fieldId || !this.view?.default_row_values) {
|
|
return false
|
|
}
|
|
return this.view.default_row_values.some(
|
|
(item) => item.field === fieldId && item.enabled
|
|
)
|
|
},
|
|
isDefaultValueFieldDisabled() {
|
|
if (!this.fieldConstraints || this.fieldConstraints.length === 0) {
|
|
return false
|
|
}
|
|
|
|
return this.fieldConstraints.some(
|
|
(constraint) =>
|
|
constraint.type_name &&
|
|
!this.$registry
|
|
.getSpecificConstraint(
|
|
'fieldConstraint',
|
|
constraint.type_name,
|
|
this.fieldType
|
|
)
|
|
.canSupportDefaultValue()
|
|
)
|
|
},
|
|
},
|
|
}
|