|
|
@ -1,7 +1,6 @@ |
|
|
|
import { customAlphabet } from 'nanoid'; |
|
|
|
import { customAlphabet } from 'nanoid'; |
|
|
|
import { getAvailableRollupForUiType, UITypes } from 'nocodb-sdk'; |
|
|
|
import { getAvailableRollupForUiType, UITypes } from 'nocodb-sdk'; |
|
|
|
import { pluralize, singularize } from 'inflection'; |
|
|
|
import { pluralize, singularize } from 'inflection'; |
|
|
|
import type { RollupColumn } from '~/models'; |
|
|
|
|
|
|
|
import type { |
|
|
|
import type { |
|
|
|
BoolType, |
|
|
|
BoolType, |
|
|
|
ColumnReqType, |
|
|
|
ColumnReqType, |
|
|
@ -11,13 +10,14 @@ import type { |
|
|
|
RollupColumnReqType, |
|
|
|
RollupColumnReqType, |
|
|
|
TableType, |
|
|
|
TableType, |
|
|
|
} from 'nocodb-sdk'; |
|
|
|
} from 'nocodb-sdk'; |
|
|
|
|
|
|
|
import type { RollupColumn } from '~/models'; |
|
|
|
import type LinkToAnotherRecordColumn from '~/models/LinkToAnotherRecordColumn'; |
|
|
|
import type LinkToAnotherRecordColumn from '~/models/LinkToAnotherRecordColumn'; |
|
|
|
import type LookupColumn from '~/models/LookupColumn'; |
|
|
|
import type LookupColumn from '~/models/LookupColumn'; |
|
|
|
import type Model from '~/models/Model'; |
|
|
|
import type Model from '~/models/Model'; |
|
|
|
|
|
|
|
import { GridViewColumn } from '~/models'; |
|
|
|
import validateParams from '~/helpers/validateParams'; |
|
|
|
import validateParams from '~/helpers/validateParams'; |
|
|
|
import { getUniqueColumnAliasName } from '~/helpers/getUniqueName'; |
|
|
|
import { getUniqueColumnAliasName } from '~/helpers/getUniqueName'; |
|
|
|
import Column from '~/models/Column'; |
|
|
|
import Column from '~/models/Column'; |
|
|
|
import { GridViewColumn } from '~/models'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const randomID = customAlphabet( |
|
|
|
export const randomID = customAlphabet( |
|
|
|
'1234567890abcdefghijklmnopqrstuvwxyz_', |
|
|
|
'1234567890abcdefghijklmnopqrstuvwxyz_', |
|
|
@ -287,3 +287,16 @@ export const sanitizeColumnName = (name: string) => { |
|
|
|
|
|
|
|
|
|
|
|
return columnName; |
|
|
|
return columnName; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if column is an alias column then return the original column
|
|
|
|
|
|
|
|
// for example CreatedTime is an alias column for CreateTime system column
|
|
|
|
|
|
|
|
export const getRefColumnIfAlias = (column: Column, columns?: Column[]) => { |
|
|
|
|
|
|
|
if (![UITypes.CreateTime, UITypes.LastModifiedTime].includes(column.uidt)) |
|
|
|
|
|
|
|
return column; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
(columns || (await Column.list({ fk_model_id: column.fk_model_id }))).find( |
|
|
|
|
|
|
|
(c) => c.system && c.uidt === column.uidt, |
|
|
|
|
|
|
|
) || column |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}; |
|
|
|