import { SchemaBase, Field } from './dsl.js'; import { TableSchema } from './db.js'; import { FrontAppSchema } from './project.js'; import { PageActionSchema } from './page-action.js'; import type { FilterSchema } from './filter.js'; /** Mode of an action page: modal dialog or standalone route. */ export type ActionPageMode = 'modal' | 'route'; /** One CRUD action page (add / update / detail). */ export interface ActionPage { mode: ActionPageMode; /** Fields rendered on this page. Required, non-empty — every field the * frontend shows must be listed explicitly. */ columns: Field[]; } /** List page configuration. */ export interface CurdListConfig { /** List columns; required, non-empty. Every field the list shows must be * listed explicitly. May include cross-table fields via foreign refs. */ columns: Field[]; /** Page filter (search form + keyword search). Conditions declared on the * filter render the search form; the filter's keyword (when present) * drives the keyword query endpoint. Optional — a page without a filter * has no search form. */ filter?: FilterSchema; /** Default sort. Required — column and direction are both mandatory. */ orderBy: { column: Field; direction: 'asc' | 'desc'; }; /** Column header text overrides: Field.name → header text. */ columnTitles?: Record; } /** Admin-only CRUD page standard: binds one entity table to a frontend * admin app. Drives generation of the list page plus optional * add/update/detail pages. */ export interface CurdSchema extends SchemaBase { /** The admin frontend app this CRUD belongs to (shared instance, type must be 'admin'). */ app: FrontAppSchema; /** The bound entity table (shared instance). */ table: TableSchema; /** List page Chinese title. */ title: string; /** Sidebar menu section (group) this CRUD page belongs to. */ section: string; /** Extra user actions on this page (beyond the standard CRUD). */ actions?: PageActionSchema[]; /** Add/update/detail action pages. */ actionPages?: { add?: ActionPage; update?: ActionPage; detail?: ActionPage; }; list: CurdListConfig; } /** Defines an admin CRUD page standard. Runtime-validates admin app binding, * non-empty columns and table field ownership (same style as defineTable). */ export declare function defineCurd(name: string, schema: Omit): CurdSchema;