bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
57 lines (56 loc) • 2.97 kB
TypeScript
import type { Static } from "../../core/utils";
import type { EntityManager } from "../../data";
import { Field, type TActionContext, type TRenderContext } from "./Field";
import * as tbbox from "@sinclair/typebox";
import type { TFieldTSType } from "../../data/entities/EntityTypescript";
export declare const numberFieldConfigSchema: tbbox.TObject<{
default_value: tbbox.TOptional<tbbox.TIntersect<[tbbox.TNumber, tbbox.TAny]>>;
minimum: tbbox.TOptional<tbbox.TNumber>;
maximum: tbbox.TOptional<tbbox.TNumber>;
exclusiveMinimum: tbbox.TOptional<tbbox.TNumber>;
exclusiveMaximum: tbbox.TOptional<tbbox.TNumber>;
multipleOf: tbbox.TOptional<tbbox.TNumber>;
required: tbbox.TOptional<tbbox.TBoolean>;
description: tbbox.TOptional<tbbox.TString>;
label: tbbox.TOptional<tbbox.TString>;
fillable: tbbox.TOptional<tbbox.TUnion<[tbbox.TBoolean, tbbox.TArray<tbbox.TUnsafe<"create" | "read" | "update" | "delete">>]>>;
hidden: tbbox.TOptional<tbbox.TUnion<[tbbox.TBoolean, tbbox.TArray<tbbox.TUnsafe<"form" | "table" | "create" | "read" | "update" | "delete" | "submit">>]>>;
virtual: tbbox.TOptional<tbbox.TBoolean>;
}>;
export type NumberFieldConfig = Static<typeof numberFieldConfigSchema>;
export declare class NumberField<Required extends true | false = false> extends Field<NumberFieldConfig, number, Required> {
readonly type = "number";
protected getSchema(): tbbox.TObject<{
default_value: tbbox.TOptional<tbbox.TIntersect<[tbbox.TNumber, tbbox.TAny]>>;
minimum: tbbox.TOptional<tbbox.TNumber>;
maximum: tbbox.TOptional<tbbox.TNumber>;
exclusiveMinimum: tbbox.TOptional<tbbox.TNumber>;
exclusiveMaximum: tbbox.TOptional<tbbox.TNumber>;
multipleOf: tbbox.TOptional<tbbox.TNumber>;
required: tbbox.TOptional<tbbox.TBoolean>;
description: tbbox.TOptional<tbbox.TString>;
label: tbbox.TOptional<tbbox.TString>;
fillable: tbbox.TOptional<tbbox.TUnion<[tbbox.TBoolean, tbbox.TArray<tbbox.TUnsafe<"create" | "read" | "update" | "delete">>]>>;
hidden: tbbox.TOptional<tbbox.TUnion<[tbbox.TBoolean, tbbox.TArray<tbbox.TUnsafe<"form" | "table" | "create" | "read" | "update" | "delete" | "submit">>]>>;
virtual: tbbox.TOptional<tbbox.TBoolean>;
}>;
getHtmlConfig(): {
element: string;
props: any;
};
schema(): Readonly<{
type: "integer";
name: string;
nullable?: boolean;
dflt?: any;
unique?: boolean;
primary?: boolean;
references?: string;
onDelete?: import("kysely").OnModifyForeignAction;
onUpdate?: import("kysely").OnModifyForeignAction;
}>;
getValue(value: any, context?: TRenderContext): any;
transformPersist(_value: unknown, em: EntityManager<any>, context: TActionContext): Promise<number | undefined>;
toJsonSchema(): tbbox.TNumber | tbbox.TOptional<tbbox.TNumber>;
toType(): TFieldTSType;
}