refactor new autocolumn functionality
This commit is contained in:
parent
2105fb31db
commit
a25020aad7
|
@ -25,18 +25,11 @@
|
||||||
array: ArrayRenderer,
|
array: ArrayRenderer,
|
||||||
internal: InternalRenderer,
|
internal: InternalRenderer,
|
||||||
}
|
}
|
||||||
|
console.log(value)
|
||||||
|
|
||||||
$: type = schema?.type ?? "string"
|
$: type = schema?.type ?? "string"
|
||||||
$: customRenderer = customRenderers?.find(x => x.column === schema?.name)
|
$: customRenderer = customRenderers?.find(x => x.column === schema?.name)
|
||||||
$: {
|
$: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
|
||||||
// this has to be done purely in the front-end due to migration issues
|
|
||||||
// the schema gets overriden on every tables fetch so we can't just set
|
|
||||||
// these to be a new type unfortunately
|
|
||||||
if (schema.name === "_id" || schema.name === "_rev") {
|
|
||||||
renderer = typeMap.internal
|
|
||||||
} else {
|
|
||||||
renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if renderer && (customRenderer || (value != null && value !== ""))}
|
{#if renderer && (customRenderer || (value != null && value !== ""))}
|
||||||
|
|
|
@ -16,11 +16,31 @@
|
||||||
import { Pagination } from "@budibase/bbui"
|
import { Pagination } from "@budibase/bbui"
|
||||||
|
|
||||||
let hideAutocolumns = true
|
let hideAutocolumns = true
|
||||||
|
let schema
|
||||||
$: isUsersTable = $tables.selected?._id === TableNames.USERS
|
$: isUsersTable = $tables.selected?._id === TableNames.USERS
|
||||||
$: schema = $tables.selected?.schema
|
|
||||||
$: type = $tables.selected?.type
|
$: type = $tables.selected?.type
|
||||||
$: isInternal = type !== "external"
|
$: isInternal = type !== "external"
|
||||||
|
$: {
|
||||||
|
schema = $tables.selected?.schema
|
||||||
|
|
||||||
|
// Manually add these as we don't want them to be 'real' auto-columns
|
||||||
|
schema._id = {
|
||||||
|
type: "internal",
|
||||||
|
editable: false,
|
||||||
|
displayName: "ID",
|
||||||
|
name: "ID",
|
||||||
|
autocolumn: true,
|
||||||
|
}
|
||||||
|
if (isInternal) {
|
||||||
|
schema._rev = {
|
||||||
|
type: "internal",
|
||||||
|
editable: false,
|
||||||
|
displayName: "Revision",
|
||||||
|
name: "REV",
|
||||||
|
autocolumn: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$: id = $tables.selected?._id
|
$: id = $tables.selected?._id
|
||||||
$: search = searchTable(id)
|
$: search = searchTable(id)
|
||||||
$: columnOptions = Object.keys($search.schema || {})
|
$: columnOptions = Object.keys($search.schema || {})
|
||||||
|
|
|
@ -97,8 +97,6 @@ export const AUTO_COLUMN_SUB_TYPES = {
|
||||||
CREATED_AT: "createdAt",
|
CREATED_AT: "createdAt",
|
||||||
UPDATED_BY: "updatedBy",
|
UPDATED_BY: "updatedBy",
|
||||||
UPDATED_AT: "updatedAt",
|
UPDATED_AT: "updatedAt",
|
||||||
_id: "_id",
|
|
||||||
_rev: "_rev",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AUTO_COLUMN_DISPLAY_NAMES = {
|
export const AUTO_COLUMN_DISPLAY_NAMES = {
|
||||||
|
@ -107,8 +105,6 @@ export const AUTO_COLUMN_DISPLAY_NAMES = {
|
||||||
CREATED_AT: "Created At",
|
CREATED_AT: "Created At",
|
||||||
UPDATED_BY: "Updated By",
|
UPDATED_BY: "Updated By",
|
||||||
UPDATED_AT: "Updated At",
|
UPDATED_AT: "Updated At",
|
||||||
_id: "_id",
|
|
||||||
_rev: "_rev",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FILE_TYPES = {
|
export const FILE_TYPES = {
|
||||||
|
|
Loading…
Reference in New Issue