@uibot/renderer-react 0.0.0-stage → 0.2.0
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/dist/HtmlSourceEditor.d.ts +60 -0
- package/dist/collection-activity.d.ts +12 -0
- package/dist/collection-ai.d.ts +17 -0
- package/dist/collection-application.d.ts +5 -0
- package/dist/collection-application.js +25 -0
- package/dist/collection-approval.d.ts +7 -0
- package/dist/collection-attachments.d.ts +10 -0
- package/dist/collection-automation.d.ts +10 -0
- package/dist/collection-calendar-view.d.ts +2 -0
- package/dist/collection-computed.d.ts +4 -0
- package/dist/collection-conversion.d.ts +6 -0
- package/dist/collection-editors.d.ts +40 -0
- package/dist/collection-editors.js +10 -0
- package/dist/collection-form-view.d.ts +2 -0
- package/dist/collection-formula/evaluate.d.ts +18 -0
- package/dist/collection-formula/index.d.ts +1 -0
- package/dist/collection-gallery-view.d.ts +2 -0
- package/dist/collection-grid/cell-display.d.ts +24 -0
- package/dist/collection-grid/cells.d.ts +29 -0
- package/dist/collection-grid/column-color.d.ts +5 -0
- package/dist/collection-grid/date-value.d.ts +13 -0
- package/dist/collection-grid/features.d.ts +76 -0
- package/dist/collection-grid/field-format.d.ts +17 -0
- package/dist/collection-grid/fill.d.ts +10 -0
- package/dist/collection-grid/filter-labels.d.ts +6 -0
- package/dist/collection-grid/footer-aggregate.d.ts +6 -0
- package/dist/collection-grid/footer-stats.d.ts +5 -0
- package/dist/collection-grid/grouping.d.ts +51 -0
- package/dist/collection-grid/index.d.ts +9 -0
- package/dist/collection-grid/paged-field-input.d.ts +22 -0
- package/dist/collection-grid/paged-locale.d.ts +3 -0
- package/dist/collection-grid/paged-model.d.ts +25 -0
- package/dist/collection-grid/relation-editor.d.ts +14 -0
- package/dist/collection-grid/relation-options.d.ts +4 -0
- package/dist/collection-grid/selection.d.ts +4 -0
- package/dist/collection-interaction-state.d.ts +26 -0
- package/dist/collection-kanban-view.d.ts +2 -0
- package/dist/collection-live-changes.d.ts +8 -0
- package/dist/collection-relations.d.ts +20 -0
- package/dist/collection-sharing.d.ts +10 -0
- package/dist/collection-table-view.d.ts +2 -0
- package/dist/collection-transfer.d.ts +12 -0
- package/dist/collection-ui.d.ts +152 -0
- package/dist/collection-views/aggregate.d.ts +39 -0
- package/dist/collection-views/ai-fill-drawer.d.ts +28 -0
- package/dist/collection-views/ai-fill-model.d.ts +35 -0
- package/dist/collection-views/board.d.ts +2 -0
- package/dist/collection-views/calendar.d.ts +4 -0
- package/dist/collection-views/field-config.d.ts +16 -0
- package/dist/collection-views/filter-builder.d.ts +23 -0
- package/dist/collection-views/gallery.d.ts +2 -0
- package/dist/collection-views/icons.d.ts +43 -0
- package/dist/collection-views/menu.d.ts +16 -0
- package/dist/collection-views/model.d.ts +22 -0
- package/dist/collection-views/record-creator.d.ts +31 -0
- package/dist/collection-views/schema-editor.d.ts +38 -0
- package/dist/collection-views/schema-field-settings.d.ts +22 -0
- package/dist/collection-views/schema-styles.d.ts +4 -0
- package/dist/collection-views/shared.d.ts +110 -0
- package/dist/collection-views/table-nav.d.ts +52 -0
- package/dist/collection-views/toolbar-popover.d.ts +24 -0
- package/dist/collection-views/ui.d.ts +45 -0
- package/dist/collection-views/view-settings-sections.d.ts +39 -0
- package/dist/collection-views/view-tabs.d.ts +35 -0
- package/dist/collection-views.d.ts +35 -0
- package/dist/collection-views.js +10 -0
- package/dist/collection-workspace.d.ts +128 -0
- package/dist/collection-workspace.js +26 -0
- package/dist/define-component.d.ts +35 -0
- package/dist/document-collection.d.ts +30 -0
- package/dist/document-view.d.ts +1 -0
- package/dist/html-source-editor.css +84 -0
- package/dist/index.d.ts +121 -0
- package/dist/index.js +25 -0
- package/dist/live-renderer.d.ts +60 -0
- package/dist/paged-collection-grid.d.ts +95 -0
- package/dist/paged-collection-grid.js +25 -0
- package/dist/paged-collection-views.d.ts +15 -0
- package/dist/renderer.d.ts +20 -0
- package/package.json +69 -4
- package/README.md +0 -3
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ActionChain, ActionEventScope, CompiledUIBotSpec } from "@uibot/contracts";
|
|
3
|
+
import { type ReactRegistry } from "./index.js";
|
|
4
|
+
export interface UIBotMountErrorInfo {
|
|
5
|
+
phase: "mount" | "compile" | "render";
|
|
6
|
+
blockId?: string;
|
|
7
|
+
cause: unknown;
|
|
8
|
+
}
|
|
9
|
+
/** Structured mount failure. `cause` is the original rejection or compile gap. */
|
|
10
|
+
export declare class UIBotMountError extends Error implements UIBotMountErrorInfo {
|
|
11
|
+
readonly phase: UIBotMountErrorInfo["phase"];
|
|
12
|
+
readonly blockId?: string;
|
|
13
|
+
readonly cause: unknown;
|
|
14
|
+
constructor(phase: UIBotMountErrorInfo["phase"], cause: unknown, blockId?: string);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Runtime adapter interface — implemented by the client-safe `@uibot/runtime`
|
|
18
|
+
* composition seam and injected into {@link UIBotLiveRenderer}.
|
|
19
|
+
*
|
|
20
|
+
* `renderer-react` only depends on `@uibot/contracts`, so this interface is the
|
|
21
|
+
* dependency-inversion seam that lets the live host drive the engine without
|
|
22
|
+
* `renderer-react` ever importing `@uibot/engine`.
|
|
23
|
+
*/
|
|
24
|
+
export interface UIBotRuntimeAdapter {
|
|
25
|
+
/** Current state snapshot for rendering (includes the `__computed` namespace). */
|
|
26
|
+
snapshot(): Record<string, unknown>;
|
|
27
|
+
/** Dispatch an event/lifecycle ActionChain. */
|
|
28
|
+
dispatch(chain: ActionChain, scope?: {
|
|
29
|
+
event?: ActionEventScope;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
/** Subscribe to any state change in order to trigger a React re-render. */
|
|
32
|
+
subscribeAny(cb: () => void): () => void;
|
|
33
|
+
/** Mount a page's lifecycle (onMount / onStateChange / computed); returns a disposer. */
|
|
34
|
+
mountPage(pageId: string): Promise<() => void>;
|
|
35
|
+
}
|
|
36
|
+
export interface UIBotLiveRendererProps {
|
|
37
|
+
spec: CompiledUIBotSpec;
|
|
38
|
+
registry: ReactRegistry;
|
|
39
|
+
adapter: UIBotRuntimeAdapter;
|
|
40
|
+
/** Page to render; defaults to the first page in the spec. */
|
|
41
|
+
pageId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Invoked when the page lifecycle mount fails (e.g. a throwing `onMount`
|
|
44
|
+
* action chain). The renderer never re-throws the rejection synchronously —
|
|
45
|
+
* it is fail-soft and keeps rendering against the (SSR pre-seeded) snapshot —
|
|
46
|
+
* but the host can use this hook to surface a degraded-state banner or push
|
|
47
|
+
* the error into a render-phase throw so a React error boundary engages.
|
|
48
|
+
*
|
|
49
|
+
* The dispose contract is honoured regardless: any lifecycle subscriptions
|
|
50
|
+
* registered before the failure are still torn down on unmount.
|
|
51
|
+
*/
|
|
52
|
+
onMountError?: (error: UIBotMountError) => void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Stateful React host that owns the render loop. It subscribes to state changes
|
|
56
|
+
* (forcing a re-render), mounts the page lifecycle on mount, and renders the
|
|
57
|
+
* spec against the adapter's live snapshot, wiring `adapter.dispatch` so that
|
|
58
|
+
* interactive components can fire their event chains.
|
|
59
|
+
*/
|
|
60
|
+
export declare function UIBotLiveRenderer(props: UIBotLiveRendererProps): React.ReactElement | null;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type CollectionActivityProps } from "./collection-interaction-state.js";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type { PagedCollectionDescriptor, PagedCollectionField, PagedCollectionMutationReceipt, PagedCollectionMutationRequest, PagedCollectionRecord, PagedCollectionResult, PagedCollectionView, PagedCollectionRelationOptionsProvider, PagedCollectionClient } from "@uibot/contracts";
|
|
4
|
+
import type { CollectionMenuItem, CollectionUiSlots } from "./collection-ui.js";
|
|
5
|
+
import { type PagedCollectionLocale } from "./collection-grid/paged-locale.js";
|
|
6
|
+
import { type PagedCollectionGridFeaturesInput } from "./collection-grid/features.js";
|
|
7
|
+
import { type CollectionAggregateProps } from "./collection-views/aggregate.js";
|
|
8
|
+
export { PAGED_COLLECTION_GRID_PRESETS, resolvePagedCollectionGridFeatures, type PagedCollectionGridFeatures, type PagedCollectionGridFeaturesInput, type PagedCollectionGridPreset, } from "./collection-grid/features.js";
|
|
9
|
+
export { pickerValue, storedFromPicker, type PagedDatePickerMode, } from "./collection-grid/date-value.js";
|
|
10
|
+
export { formatPagedDate, formatPagedNumber, instantFromZoned, pagedDateFormatting, pagedDateKind, pagedNumberFormatting, pagedOptionSlot, type PagedDateKind, } from "./collection-grid/field-format.js";
|
|
11
|
+
export type { CollectionUiSlots } from "./collection-ui.js";
|
|
12
|
+
export declare function nextPagedCollectionSort(sort: NonNullable<PagedCollectionView["sort"]>, fieldId: string): NonNullable<PagedCollectionView["sort"]>;
|
|
13
|
+
export interface PagedCollectionGridProps extends CollectionActivityProps {
|
|
14
|
+
/** Zero-based offset of the first row in the complete ordered query. */
|
|
15
|
+
rowOffset?: number;
|
|
16
|
+
locale?: PagedCollectionLocale;
|
|
17
|
+
/** Hide duplicate host chrome without changing data access or editing permissions. */
|
|
18
|
+
display?: {
|
|
19
|
+
summary?: boolean;
|
|
20
|
+
keyboardHints?: boolean;
|
|
21
|
+
maxHeight?: number;
|
|
22
|
+
/** Stretch the grid to the bottom of the viewport instead of fitting its rows. */
|
|
23
|
+
fill?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** Presentation and interaction features. Defaults to the plain `basic` preset. */
|
|
26
|
+
features?: PagedCollectionGridFeaturesInput;
|
|
27
|
+
/** Host design-system controls for toolbar and confirmation buttons. */
|
|
28
|
+
ui?: CollectionUiSlots;
|
|
29
|
+
descriptor: PagedCollectionDescriptor;
|
|
30
|
+
rows: PagedCollectionRecord[];
|
|
31
|
+
total: number;
|
|
32
|
+
view: PagedCollectionView;
|
|
33
|
+
/** Drafts survive page and data refreshes; selection follows row and column identity. */
|
|
34
|
+
onViewChange(view: PagedCollectionView): void;
|
|
35
|
+
onMutate(request: PagedCollectionMutationRequest): Promise<PagedCollectionResult<PagedCollectionMutationReceipt>>;
|
|
36
|
+
onCommitted(receipt: PagedCollectionMutationReceipt): void;
|
|
37
|
+
readOnly?: boolean;
|
|
38
|
+
/** Actions for a column header: shown in a chevron menu and on right-click. */
|
|
39
|
+
fieldMenu?: (field: PagedCollectionField) => CollectionMenuItem[];
|
|
40
|
+
/** Opens a record in the host's detail surface; adds an expand button to the row number. */
|
|
41
|
+
onExpandRecord?: (row: PagedCollectionRecord) => void;
|
|
42
|
+
/** Adds a "+ Add record" row under the last record when `features.rowCreate` is on. */
|
|
43
|
+
onAddRecord?: () => void;
|
|
44
|
+
/** Success confirmations ("Saved", "Deleted 2 records") go here (e.g. a toast) instead of the status line. */
|
|
45
|
+
onNotify?(message: string): void;
|
|
46
|
+
/** Host design-system editor. Returning undefined keeps the native editor. */
|
|
47
|
+
renderCellEditor?(input: {
|
|
48
|
+
field: PagedCollectionField;
|
|
49
|
+
text: string;
|
|
50
|
+
disabled: boolean;
|
|
51
|
+
/** Inline controls commit directly from onChange; filter controls commit via Apply. */
|
|
52
|
+
mode?: "inline" | "filter";
|
|
53
|
+
/** Visible label for host editors used outside a grid cell. */
|
|
54
|
+
label?: string;
|
|
55
|
+
autoOpen?: boolean;
|
|
56
|
+
id?: string;
|
|
57
|
+
onChange(text: string): void;
|
|
58
|
+
/** Commit the draft; optional direction moves the active cell only after success. */
|
|
59
|
+
onSave(direction?: "next" | "previous"): void;
|
|
60
|
+
onCancel(): void;
|
|
61
|
+
/** Lookup for `relation` fields, so host editors need no data access of their own. */
|
|
62
|
+
getRelationOptions?: PagedCollectionRelationOptionsProvider;
|
|
63
|
+
}): ReactNode;
|
|
64
|
+
/** Host menu wrapper for record actions. The grid remains responsible for selection and mutations. */
|
|
65
|
+
renderRecordContextMenu?(input: {
|
|
66
|
+
children: ReactNode;
|
|
67
|
+
recordIds: string[];
|
|
68
|
+
disabled: boolean;
|
|
69
|
+
onDelete(): void;
|
|
70
|
+
/** Present when exactly one record is selected and the host handles expansion. */
|
|
71
|
+
onExpand?(): void;
|
|
72
|
+
/** Copies the selected cells as tab-separated text. */
|
|
73
|
+
onCopy(): void;
|
|
74
|
+
/** Inserts copies of the selected records; omitted when the grid cannot create. */
|
|
75
|
+
onDuplicate?(): void;
|
|
76
|
+
}): ReactNode;
|
|
77
|
+
getRelationOptions?: PagedCollectionRelationOptionsProvider;
|
|
78
|
+
onSelectionChange?(selection: {
|
|
79
|
+
recordIds: string[];
|
|
80
|
+
fieldIds: string[];
|
|
81
|
+
}): void;
|
|
82
|
+
onInspectRecord?(recordId: string): void;
|
|
83
|
+
relationClient?: Pick<PagedCollectionClient, "query">;
|
|
84
|
+
/** Refetch whole-query statistics after host changes. */
|
|
85
|
+
reloadKey?: number;
|
|
86
|
+
/** False for hosts whose aggregate port only supports legacy summary functions. */
|
|
87
|
+
serverFooterStats?: boolean;
|
|
88
|
+
/** Whole-query statistics. The loaded page is not a source of these totals. */
|
|
89
|
+
aggregate?: CollectionAggregateProps;
|
|
90
|
+
}
|
|
91
|
+
/** Server-paged editable grid. It never filters or sorts a partial page locally. */
|
|
92
|
+
export declare function PagedCollectionGrid(props: PagedCollectionGridProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
93
|
+
/** Column widths stay in a readable range however they were stored or dragged. */
|
|
94
|
+
export declare const PAGED_COLUMN_MIN_WIDTH = 96;
|
|
95
|
+
export declare const PAGED_COLUMN_MAX_WIDTH = 560;
|