Enable default values for options and array types
This commit is contained in:
parent
2ddafeebb7
commit
c4a98832cb
|
@ -134,8 +134,10 @@ async function processDefaultValues(table: Table, row: Row) {
|
|||
|
||||
for (const [key, schema] of Object.entries(table.schema)) {
|
||||
if ("default" in schema && schema.default != null && row[key] == null) {
|
||||
const processed = await processString(schema.default, ctx)
|
||||
|
||||
const processed =
|
||||
typeof schema.default === "string"
|
||||
? await processString(schema.default, ctx)
|
||||
: schema.default
|
||||
try {
|
||||
row[key] = coerce(processed, schema.type)
|
||||
} catch (err: any) {
|
||||
|
|
|
@ -53,8 +53,9 @@ const allowDefaultColumnByType: Record<FieldType, boolean> = {
|
|||
[FieldType.DATETIME]: true,
|
||||
[FieldType.LONGFORM]: true,
|
||||
[FieldType.STRING]: true,
|
||||
[FieldType.OPTIONS]: true,
|
||||
[FieldType.ARRAY]: true,
|
||||
|
||||
[FieldType.OPTIONS]: false,
|
||||
[FieldType.AUTO]: false,
|
||||
[FieldType.INTERNAL]: false,
|
||||
[FieldType.BARCODEQR]: false,
|
||||
|
@ -64,7 +65,6 @@ const allowDefaultColumnByType: Record<FieldType, boolean> = {
|
|||
[FieldType.ATTACHMENTS]: false,
|
||||
[FieldType.ATTACHMENT_SINGLE]: false,
|
||||
[FieldType.SIGNATURE_SINGLE]: false,
|
||||
[FieldType.ARRAY]: false,
|
||||
[FieldType.LINK]: false,
|
||||
[FieldType.BB_REFERENCE]: false,
|
||||
[FieldType.BB_REFERENCE_SINGLE]: false,
|
||||
|
|
Loading…
Reference in New Issue