UNPKG

@premieroctet/next-admin

Version:

Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje

54 lines 2.44 kB
import { TranslationFn } from "../context/I18nContext"; import { ModelName, ModelOptions, Schema, SchemaModel } from "../types"; export type QueryCondition = "equals" | "not" | "in" | "notIn" | "lt" | "lte" | "gt" | "gte" | "contains" | "search" | "startsWith" | "endsWith" | "null" | "nnull" | "has"; type FilterValue = string | number | boolean | null; export type Filter = { [key: string]: { [key in QueryCondition]?: FilterValue | FilterValue[]; } | { some: QueryBlock | Filter; } | Filter; }; export type QueryBlock = { AND: QueryBlock[]; } | { OR: QueryBlock[]; } | Filter; export declare const validateQuery: (query: string) => false | QueryBlock; export declare const getQueryCondition: (condition: string) => false | "search" | "endsWith" | "startsWith" | "contains" | "not" | "equals" | "in" | "notIn" | "lt" | "lte" | "gt" | "gte" | "has"; export declare const contentTypeFromSchemaType: (schemaProperty: Schema) => "text" | "number" | "boolean" | "datetime" | "enum"; export declare const isFieldNullable: (schemaType: Schema["type"]) => boolean; export type UIQueryBlock = ({ type: "filter"; path: string; condition: QueryCondition; value: string | number | boolean | null; contentType: "text" | "number" | "datetime" | "boolean" | "enum"; enum?: string[]; defaultValue?: string | number | boolean | null; canHaveChildren: false; internalPath?: string; nullable: boolean; displayPath?: string; } | { type: "and" | "or"; children?: UIQueryBlock[]; internalPath?: string; }) & { id: string; }; export declare const isSchemaPropertyScalarArray: (definition: SchemaModel<ModelName>, property: string) => boolean; export declare const setInternalPathToBlocks: (blocks: UIQueryBlock[], path?: string) => void; export declare const cleanEmptyBlocks: (blocks: UIQueryBlock[]) => UIQueryBlock[]; export declare const buildUIBlocks: <M extends ModelName>(blocks: QueryBlock | null, { resource, schema, options, t, }: { resource: M; schema: Schema; options?: ModelOptions<ModelName>; t?: TranslationFn; }, fields?: string[], displayFields?: string[]) => UIQueryBlock[]; export declare const buildQueryBlocks: <M extends ModelName>(blocks: UIQueryBlock[], { resource, schema }: { resource: M; schema: Schema; }, acc?: QueryBlock, path?: string) => QueryBlock; export {}; //# sourceMappingURL=advancedSearch.d.ts.map