elysia-rack 0.3.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -9
- package/dist/Dashboard-2raba6xf.js +212 -0
- package/dist/Panel-5wx7qpqt.js +1159 -0
- package/dist/Panel-9k5vambv.js +1160 -0
- package/dist/index-9k12apt9.js +157 -0
- package/dist/index-vq4gh509.js +40 -0
- package/dist/panel-app.js +322 -83
- package/dist/panel.css +1 -1
- package/dist/rack/index.js +15 -11
- package/dist/rack/page.d.ts +2 -0
- package/dist/rack/query.d.ts +14 -12
- package/dist/rack/types/actions.d.ts +27 -0
- package/dist/rack/types/fields.d.ts +48 -0
- package/dist/rack/types/index.d.ts +15 -0
- package/dist/rack/types/metadata.d.ts +11 -0
- package/dist/react/index.js +65 -21
- package/dist/react/page/Panel.d.ts +6 -23
- package/dist/react/page/components/DataTable.d.ts +9 -2
- package/dist/react/page/components/Toolbar.d.ts +5 -1
- package/dist/react/page/components/panelFields.d.ts +39 -0
- package/dist/react/render.d.ts +1 -1
- package/dist/react/types.d.ts +18 -2
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { FieldDescriptor, FieldKind } from "../../../rack/adapters/index";
|
|
2
|
+
import type { CrudFieldConfig, CrudFieldFormat, CrudFieldOption } from "../../../rack/types/fields";
|
|
3
|
+
/**
|
|
4
|
+
* Serializable per-field descriptor shared by the server renderer,
|
|
5
|
+
* the browser bundle, and tests. Relation options are resolved before
|
|
6
|
+
* serialization so the client never needs a data loader.
|
|
7
|
+
*/
|
|
8
|
+
export interface PanelField {
|
|
9
|
+
name: string;
|
|
10
|
+
label: string;
|
|
11
|
+
kind: FieldKind;
|
|
12
|
+
format: CrudFieldFormat;
|
|
13
|
+
currency?: string;
|
|
14
|
+
nullable: boolean;
|
|
15
|
+
primary: boolean;
|
|
16
|
+
autoIncrement: boolean;
|
|
17
|
+
readOnly: boolean;
|
|
18
|
+
hideInTable: boolean;
|
|
19
|
+
hideInForm: boolean;
|
|
20
|
+
enumValues?: readonly string[];
|
|
21
|
+
relation?: readonly CrudFieldOption[];
|
|
22
|
+
order: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function buildPanelFields(input: {
|
|
25
|
+
fields?: FieldDescriptor[];
|
|
26
|
+
columns: string[];
|
|
27
|
+
config?: Record<string, CrudFieldConfig>;
|
|
28
|
+
hiddenFields?: readonly string[];
|
|
29
|
+
primaryKey: string;
|
|
30
|
+
deletedAtField: string;
|
|
31
|
+
}): Promise<PanelField[]>;
|
|
32
|
+
export declare function isNumericField(field: PanelField): boolean;
|
|
33
|
+
/** Human-readable cell text for a field value. */
|
|
34
|
+
export declare function displayValue(field: PanelField | undefined, value: unknown): string;
|
|
35
|
+
/** Coerce a raw form/bulk string to the field's kind. */
|
|
36
|
+
export declare function coerceFieldValue(field: PanelField | undefined, raw: string): {
|
|
37
|
+
value?: unknown;
|
|
38
|
+
error?: string;
|
|
39
|
+
};
|
package/dist/react/render.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactRack } from "./types";
|
|
2
2
|
export declare function createRenderer(pages: ReactRack.PageRegistry): (path: string, props: unknown) => Promise<Response>;
|
package/dist/react/types.d.ts
CHANGED
|
@@ -7,9 +7,23 @@ export declare namespace ReactRack {
|
|
|
7
7
|
props?: Props;
|
|
8
8
|
}
|
|
9
9
|
type PageComponent<Props = any> = ComponentType<Props>;
|
|
10
|
-
type
|
|
10
|
+
type PageLoader = () => Promise<{
|
|
11
11
|
default: PageComponent;
|
|
12
|
-
}
|
|
12
|
+
}>;
|
|
13
|
+
/** A page is either a component or a loader wrapped with `lazyPage()`. */
|
|
14
|
+
type PageEntry = PageComponent | PageLoader;
|
|
15
|
+
type PageRegistry = Record<string, PageEntry>;
|
|
16
|
+
/** Mark a `() => import(...)` loader so it is not mistaken for a component. */
|
|
17
|
+
function lazyPage(loader: PageLoader): PageLoader;
|
|
18
|
+
/** @internal */
|
|
19
|
+
function isLazyPage(entry: PageEntry): entry is PageLoader;
|
|
20
|
+
/** A page registered directly with its URL — no `page()` call needed. */
|
|
21
|
+
interface ReactView<Props = any> {
|
|
22
|
+
/** URL path the route is mounted at. */
|
|
23
|
+
path: string;
|
|
24
|
+
component: PageEntry;
|
|
25
|
+
props?: Props;
|
|
26
|
+
}
|
|
13
27
|
/** Override source for panel.css */
|
|
14
28
|
type PanelCssOverride = string | {
|
|
15
29
|
path?: string;
|
|
@@ -17,6 +31,8 @@ export declare namespace ReactRack {
|
|
|
17
31
|
};
|
|
18
32
|
interface ReactPluginOptions {
|
|
19
33
|
pages?: PageRegistry | PageRegistry[];
|
|
34
|
+
/** Pages auto-mounted at their `path`; `page()` is not needed for these. */
|
|
35
|
+
views?: ReactView[];
|
|
20
36
|
/**
|
|
21
37
|
* Override `panel.css` served at `/__rack/panel.css`.
|
|
22
38
|
* - `string`: file path if the file exists, otherwise raw CSS string.
|
package/package.json
CHANGED