Page MenuHomeSealhub

enum.ts
No OneTemporary

import { toPascalCase } from "js-convert-case";
import {
FieldHandler,
FieldHandlerResult,
} from "../shared-crud-form-fields.js";
export const enum_handler: FieldHandler<
FieldHandlerResult,
Partial<FieldHandlerResult>
> = async (collection_name, { name }, _, { fields_var }) => ({
// this assertion and import is only necessary because required fields
// in Sealious lose the type information. Once this is fixed, we can remove this import here
imports: { shared: `import type { FieldTypes } from "sealious";` },
field: `${name}: new Fields.PickFromListField(
${toPascalCase(collection_name)}.fields["${name}"].required,
async (ctx) =>
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
(${toPascalCase(collection_name)}.fields["${name}"])
.getAllowedValues(ctx.$app)
.map((value) => ({ value, label: value }))
)`,
controls: `new Controls.Dropdown(${fields_var}.${name}, { label: "${name}"})`,
});

File Metadata

Mime Type
text/x-java
Expires
Tue, Jul 8, 08:36 (7 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
802173
Default Alt Text
enum.ts (959 B)

Event Timeline