Start working on the dialog to make a new table

This commit is contained in:
Oliver-Akins 2025-04-30 22:51:03 -06:00
parent 46a9d46e9a
commit a3900a6c7c
8 changed files with 186 additions and 5 deletions

View file

@ -26,8 +26,14 @@ export function validateValue(value, options) {
return !error;
};
export const BucketTypes = {
STRING: `string`,
NUMBER: `number`,
RANGE: `range`,
};
const validatorTypes = {
string: {
[BucketTypes.STRING]: {
field: StringField,
transformOptions: (opts) => {
delete opts.type;
@ -40,20 +46,28 @@ const validatorTypes = {
};
},
},
number: {
[BucketTypes.NUMBER]: {
field: NumberField,
transformOptions: (opts) => {
delete opts.type;
opts.nullable = false;
opts.integer = true;
if (typeof opts.choices === `function`) {
Logger.error(`Choices cannot be a function in a table's buckets configuraion`);
delete opts.choices;
};
},
},
range: {
[BucketTypes.RANGE]: {
field: NumberField,
transformOptions: (opts) => {
delete opts.type;
opts.nullable = false;
opts.integer = true;
if (typeof opts.choices === `function`) {
Logger.error(`Choices cannot be a function in a table's buckets configuraion`);
delete opts.choices;
};
},
},
};