Package exports (index.ts)
This page mirrors the public entry web/src/index.ts of the ez-console frontend package (same surface whether you browse the framework repo or the vendored copy under this docs workspace). Use it as a checklist when importing from 'ez-console'.
For narrative guides, see Application shell, Routing & navigation, API integration, React hooks & context, and Built-in components.
Application & typesβ
| Export | Kind | Notes |
|---|---|---|
EZApp | Component (default) | Root app: router, providers, menus. Props type exported as EZAppProps (alias of AppProps in source). |
EZAppProps | Type | basePath, transformRouter, transformSettingTabs, transformLangConfig, extraPrivateRoutes, extraPublicRoutes, menuStyle, transformHeaderItems, renderLayout, aiChatProps. See Application shell. |
Internationalizationβ
| Export | Kind | Notes |
|---|---|---|
useTranslation | Hook | Re-export from react-i18next. |
i18n | Instance | Default i18next instance. See Internationalization. |
Routingβ
| Export | Kind | Notes |
|---|---|---|
withSuspense | Function | Wraps lazy components with <Suspense fallback={<Loading />}>. |
IRoute | Type | IRouteItem | IRouteGroup. |
IRouteItem | Type | path?, element (required), name?, icon?, is_private?, index (boolean β index vs non-index route), permissions?, hideInMenu?. |
IRouteGroup | Type | children (required), optional path / element, name, icon, is_private, permissions, hideInMenu; index is optional and should be false for groups. |
See Routing & navigation.
Layout & shell componentsβ
| Export | Kind | Notes |
|---|---|---|
AppLayout | Component | Main admin shell (header, sider, breadcrumbs, AI affordances). Normally used inside the framework; override via EZAppβs renderLayout if needed. Props: AppLayoutProps (routes, siderWidth, transformLangConfig, menuStyle, transformHeaderItems, renderLayout, aiChatProps, β¦). |
Loading | Component | Suspense / inline loading fallback. |
LanguageSwitch | Component | Header language control; LanguageSwitchProps, AllLangUIConfig. |
HeaderDropdown | Component | Header dropdown wrapper; HeaderDropdownProps. |
Avatar, AvatarUpload | Components | User avatar display / upload; AvatarProps, AvatarUploadProps. |
DynamicIcon, getIconByName | Component + util | Icon by configured name; DynamicIconProps. |
LabelCreater | Component | Tag-style label creator; LabelCreaterProps. |
Tables, actions, markdownβ
| Export | Kind | Notes |
|---|---|---|
Table | Component | Ant Design table extended with request: (params: API.PaginationRequest) => Promise<API.PaginationResponse<T>> for server-driven pagination. Ref types: TableRefProps, TableActionRefProps, TableProps. |
Actions | Component | Renders a row of action buttons (optional PermissionGuard per action, confirm, overflow menu). Item type ActionProps (key required). |
MarkdownViewer | Component | Renders Markdown; MarkdownViewerProps. |
MarkdownCode | Component | Code block renderer exported as Code alias in index.ts (Code as MarkdownCode). |
Auth, routes, errorsβ
| Export | Kind | Notes |
|---|---|---|
PermissionGuard | Component | Declarative RBAC; PermissionGuardProps. |
AdminGuard | Component | Renders children only for global admin. |
PrivateRoute | Component | Auth gate + optional requiredPermission / requiredPermissions; PrivateRouteProps. |
Forbidden | Page | HTTP 403βstyle page component. |
NotFound | Page | 404 page component. |
AI assistant UIβ
| Export | Kind | Notes |
|---|---|---|
AIChat | Component | Full chat UI; AIChatProps. |
AIChatModal | Component | Modal host wired to useAI().visible. |
AIChatSider | Component | Resizable sidebar host. |
AIChatButton | Component | Float button to open assistant. |
Behavior and useAI / registerPageAI are covered in React hooks & context β useAI and AI model integration.
Forms & dynamic configβ
| Export | Kind | Notes |
|---|---|---|
JsonSchemaConfigForm | Component | RJSF-based form from JSON Schema for settings-style objects; JsonSchemaConfigFormRef via formRef. |
JsonSchemaConfigFormItem | Component | Single-field variant for Ant Design Form integration. |
Hooks & AI-related typesβ
| Export | Kind | Notes |
|---|---|---|
useAuth | Hook | Session, login, logout, β¦ β React hooks & context. |
usePermission | Hook | RBAC helpers β same page. |
useSite | Hook | Site config, org, tasks β same page. |
useAI | Hook | AI layout + page tools β same page. |
PageAIOptions, RegisteredClientTool, ClientToolHandler, PageDataGetter | Types | From @/contexts/AIContext. |
HTTP client & low-level helpersβ
| Export | Kind | Notes |
|---|---|---|
client | AxiosInstance | Base URL /api, JSON, auth + X-Scope-OrgID + Accept-Language interceptors. |
request | Function | Typed wrapper: normal JSON unwrap, requestType: 'form' (multipart), requestType: 'sse' (streams via fetchSSE), or responseType blob / text / arraybuffer. |
apiGet, apiPost, apiPut, apiDelete | Functions | Thin client verbs returning unwrapped data. |
fetchSSE | Function | fetch + ReadableStream for SSE bodies (used by request(..., { requestType: 'sse' })). |
ApiError | Class | code + message; thrown from error interceptor for JSON errors. |
Details: API integration.
Generated REST client (api)β
The package builds a single object:
const api = {
...authorizationapi,
...baseapi,
...oauthapi,
...systemapi,
...aiapi,
...tasksapi,
};
- Shape: one flat object of generated async functions (OpenAPI / codegen), e.g.
api.listRoles,api.getCurrentUser, subject to name collisions if two modules ever export the same symbol (later spread wins). Prefer TypeScript and your generated typings to navigate. - Modules merged (star imports):
authorization,base,oauth,system,tasks;aiapiis currently the same module instance assystemapiin source β redundant but harmless. - Inside the framework source tree, you may instead use
import api from '@/service/api'for the nested layout (api.authorization.*,api.system.*, β¦). That default export is not re-exported from'ez-console'β only the flat mergedapifromindex.ts.
Generated request/response types are re-exported from the typing barrel:
export type * from '@/service/api/typing';
Use your editorβs completion on api.<method>(...) return values, or import the concrete types your bundler exposes from ez-console, to stay aligned with the generated OpenAPI surface.
Optional style importβ
Consumer apps typically import the framework stylesheet once (see Quick start):
import 'ez-console/lib/style.css';
Need help? Ask in GitHub Discussions.