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.
123 lines
3.3 KiB
123 lines
3.3 KiB
3 years ago
|
import { UITypes } from 'nocodb-sdk'
|
||
3 years ago
|
import { uiTypes } from '@/components/project/spreadsheet/helpers/uiTypes'
|
||
4 years ago
|
|
||
|
export default {
|
||
|
props: {
|
||
|
sqlUi: [Object, Function],
|
||
3 years ago
|
column: Object
|
||
4 years ago
|
},
|
||
|
computed: {
|
||
3 years ago
|
uiDatatype() {
|
||
3 years ago
|
return this.column && this.column.uidt
|
||
4 years ago
|
},
|
||
3 years ago
|
uiDatatypeIcon() {
|
||
3 years ago
|
const ui = this.uiDatatype && uiTypes.find(ui => ui.name === this.uiDatatype)
|
||
|
return ui && ui.icon
|
||
4 years ago
|
},
|
||
3 years ago
|
abstractType() {
|
||
3 years ago
|
return this.sqlUi && this.column && this.column.dt && this.sqlUi.getAbstractType(this.column)
|
||
4 years ago
|
},
|
||
3 years ago
|
dataTypeLow() {
|
||
3 years ago
|
return this.column && this.column.dt && this.column.dt.toLowerCase()
|
||
4 years ago
|
},
|
||
3 years ago
|
isBoolean() {
|
||
3 years ago
|
return this.abstractType === 'boolean'
|
||
4 years ago
|
},
|
||
3 years ago
|
isString() {
|
||
3 years ago
|
return this.abstractType === 'string'
|
||
4 years ago
|
},
|
||
3 years ago
|
isTextArea() {
|
||
3 years ago
|
return this.uiDatatype === UITypes.LongText
|
||
3 years ago
|
},
|
||
3 years ago
|
isInt() {
|
||
3 years ago
|
return this.abstractType === 'integer'
|
||
|
},
|
||
3 years ago
|
isFloat() {
|
||
3 years ago
|
return this.abstractType === 'float'
|
||
|
},
|
||
3 years ago
|
isDate() {
|
||
3 years ago
|
return this.abstractType === 'date' || this.uiDatatype === 'Date'
|
||
3 years ago
|
},
|
||
3 years ago
|
isTime() {
|
||
3 years ago
|
return this.abstractType === 'time' || this.uiDatatype === 'Time'
|
||
3 years ago
|
},
|
||
3 years ago
|
isDateTime() {
|
||
3 years ago
|
return this.abstractType === 'datetime' || this.uiDatatype === 'DateTime'
|
||
3 years ago
|
},
|
||
3 years ago
|
isJSON() {
|
||
3 years ago
|
return this.uiDatatype === 'JSON'
|
||
3 years ago
|
},
|
||
3 years ago
|
isEnum() {
|
||
3 years ago
|
return this.uiDatatype === 'SingleSelect'
|
||
3 years ago
|
},
|
||
3 years ago
|
isSet() {
|
||
3 years ago
|
return this.uiDatatype === 'MultiSelect'
|
||
3 years ago
|
},
|
||
3 years ago
|
isURL() {
|
||
3 years ago
|
return this.uiDatatype === 'URL'
|
||
3 years ago
|
},
|
||
3 years ago
|
isEmail() {
|
||
|
return this.uiDatatype === UITypes.Email
|
||
|
},
|
||
3 years ago
|
isAttachment() {
|
||
3 years ago
|
return this.uiDatatype === 'Attachment'
|
||
3 years ago
|
},
|
||
3 years ago
|
isRating() {
|
||
|
return this.uiDatatype === UITypes.Rating
|
||
|
},
|
||
3 years ago
|
isCurrency() {
|
||
3 years ago
|
return this.uiDatatype === 'Currency'
|
||
3 years ago
|
},
|
||
|
isDuration() {
|
||
|
return this.uiDatatype === UITypes.Duration
|
||
2 years ago
|
},
|
||
|
isAutoSaved() {
|
||
|
return [
|
||
|
UITypes.SingleLineText,
|
||
|
UITypes.LongText,
|
||
|
UITypes.PhoneNumber,
|
||
|
UITypes.Email,
|
||
|
UITypes.URL,
|
||
|
UITypes.Number,
|
||
|
UITypes.Decimal,
|
||
|
UITypes.Percent,
|
||
|
UITypes.Count,
|
||
|
UITypes.AutoNumber,
|
||
|
UITypes.SpecificDBType,
|
||
|
UITypes.Geometry
|
||
|
].includes(this.uiDatatype)
|
||
|
},
|
||
|
isManualSaved() {
|
||
|
return [
|
||
|
UITypes.Currency,
|
||
|
UITypes.Year,
|
||
2 years ago
|
UITypes.Time,
|
||
|
UITypes.Duration
|
||
2 years ago
|
].includes(this.uiDatatype)
|
||
4 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
3 years ago
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
|
||
4 years ago
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|