@uibot/renderer-react 0.0.0-stage → 0.2.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/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,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentation and interaction features of the paged collection grid and views.
|
|
3
|
+
* Hosts pick a preset and override single flags, so one project can ship a plain
|
|
4
|
+
* inline-editable table while another ships the full workbench experience.
|
|
5
|
+
* Features never change protocol behaviour: data access, CAS and permissions stay
|
|
6
|
+
* with the host. Effective UI = server capabilities ∩ actor permissions ∩ these flags.
|
|
7
|
+
*/
|
|
8
|
+
export interface PagedCollectionGridFeatures {
|
|
9
|
+
/** Field-type icon in every column header. */
|
|
10
|
+
fieldTypeIcons: boolean;
|
|
11
|
+
/** Select options as chips, checkbox boxes, right-aligned numbers, muted dates. */
|
|
12
|
+
optionChips: boolean;
|
|
13
|
+
/** Honour `view.groupByFieldId` in the grid: contiguous group header rows with counts. */
|
|
14
|
+
groupBy: boolean;
|
|
15
|
+
/** Let group header rows fold and unfold. Requires `groupBy`. */
|
|
16
|
+
groupCollapse: boolean;
|
|
17
|
+
/** Fit the grid to its rows (up to `display.maxHeight`) instead of a fixed height. */
|
|
18
|
+
autoHeight: boolean;
|
|
19
|
+
/** Clicking a column header changes the server-side sort. */
|
|
20
|
+
sorting: boolean;
|
|
21
|
+
/** Column resize handles. */
|
|
22
|
+
columnResize: boolean;
|
|
23
|
+
/** Drag a column header sideways to reorder columns. */
|
|
24
|
+
columnReorder: boolean;
|
|
25
|
+
/** Allow the workspace field menu to change view.frozenColumnCount. */
|
|
26
|
+
columnFreezing: boolean;
|
|
27
|
+
/** Allow the workspace field menu to change persisted view.columnColors. */
|
|
28
|
+
columnColors: boolean;
|
|
29
|
+
/** A summary row under the grid (count, sum, average…) chosen per column. */
|
|
30
|
+
footerStats: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Right-click menu on records (copy, duplicate, delete). Uses `ui.ContextMenu` when the host
|
|
33
|
+
* provides one, otherwise a minimal built-in menu. `renderRecordContextMenu` still takes
|
|
34
|
+
* precedence. Duplicate follows `rowCreate`; delete follows `rowDelete`.
|
|
35
|
+
*/
|
|
36
|
+
recordContextMenu: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Inline edits apply immediately and sync in the background: no save/cancel bar, Enter or
|
|
39
|
+
* blur commits, Escape cancels. A failed save keeps the draft and the original request open with the error, and only an explicit retry resends it.
|
|
40
|
+
*/
|
|
41
|
+
optimisticEdit: boolean;
|
|
42
|
+
/** Surface the view types a host allows in view settings. */
|
|
43
|
+
viewTypes: ReadonlyArray<"grid" | "kanban" | "gallery" | "calendar" | "form">;
|
|
44
|
+
/** Search box. */
|
|
45
|
+
search: boolean;
|
|
46
|
+
/** Filter popover, settings section and field-menu "filter by". */
|
|
47
|
+
filter: boolean;
|
|
48
|
+
/** Field config, hide/show columns and row-height chrome. */
|
|
49
|
+
columns: boolean;
|
|
50
|
+
/** Add-record and duplicate-record controls. Intersects `capabilities.write`. */
|
|
51
|
+
rowCreate: boolean;
|
|
52
|
+
/** Inline edits, paste, fill, Form save and Kanban/Calendar moves. Intersects `capabilities.write`. */
|
|
53
|
+
rowUpdate: boolean;
|
|
54
|
+
/** Record delete in menus and shortcuts. Intersects `capabilities.write`. */
|
|
55
|
+
rowDelete: boolean;
|
|
56
|
+
/** Schema editor, field insert/delete and new tables. Intersects `capabilities.schema`. */
|
|
57
|
+
schemaEditor: boolean;
|
|
58
|
+
/** Left-hand table list. `showTableList={false}` still hides it. */
|
|
59
|
+
tableList: boolean;
|
|
60
|
+
/** Create, rename, save, reorder and delete views. Intersects `capabilities.views`. */
|
|
61
|
+
viewManagement: boolean;
|
|
62
|
+
/** CSV export/import chrome when the host passed `transferClient`. */
|
|
63
|
+
export: boolean;
|
|
64
|
+
}
|
|
65
|
+
export type PagedCollectionGridPreset = "basic" | "full" | "simple" | "workbench" | "readonly";
|
|
66
|
+
export type PagedCollectionGridFeaturesInput = {
|
|
67
|
+
[K in keyof PagedCollectionGridFeatures]?: PagedCollectionGridFeatures[K] | undefined;
|
|
68
|
+
} & {
|
|
69
|
+
preset?: PagedCollectionGridPreset | undefined;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* `basic` / `full` keep the historical grid meaning and current workspace chrome.
|
|
73
|
+
* `simple` / `workbench` / `readonly` are the Issue #123 shortcuts; flags still override them.
|
|
74
|
+
*/
|
|
75
|
+
export declare const PAGED_COLLECTION_GRID_PRESETS: Readonly<Record<PagedCollectionGridPreset, PagedCollectionGridFeatures>>;
|
|
76
|
+
export declare function resolvePagedCollectionGridFeatures(input?: PagedCollectionGridFeaturesInput): PagedCollectionGridFeatures;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CollectionFieldOption, type PagedCollectionField, type PagedDateFormatting, type PagedNumberFormatting, dayOfInstant, instantFromZoned, zonedParts } from "@uibot/contracts";
|
|
2
|
+
export { dayOfInstant, instantFromZoned, zonedParts };
|
|
3
|
+
/**
|
|
4
|
+
* How a date field stores and shows its values.
|
|
5
|
+
* - `date`: `formatting.time` is "none": plain `YYYY-MM-DD` days, no time zone.
|
|
6
|
+
* - `datetime`: instants shown and picked in `formatting.timeZone` (default: the viewer's zone).
|
|
7
|
+
* - `auto`: legacy field without formatting; the shape of each value decides.
|
|
8
|
+
*/
|
|
9
|
+
export type PagedDateKind = "date" | "datetime" | "auto";
|
|
10
|
+
export declare function pagedDateFormatting(field: Pick<PagedCollectionField, "type" | "formatting" | "resultType">): PagedDateFormatting | undefined;
|
|
11
|
+
export declare function pagedNumberFormatting(field: Pick<PagedCollectionField, "type" | "formatting">): PagedNumberFormatting | undefined;
|
|
12
|
+
export declare function pagedDateKind(field: Pick<PagedCollectionField, "type" | "formatting" | "resultType">): PagedDateKind;
|
|
13
|
+
/** Shown form of a stored date value, or the raw text when it does not parse. */
|
|
14
|
+
export declare function formatPagedDate(value: unknown, formatting: PagedDateFormatting): string;
|
|
15
|
+
export declare function formatPagedNumber(value: unknown, formatting: PagedNumberFormatting): string;
|
|
16
|
+
/** Palette slot of an option: its colour key when known, otherwise its position. */
|
|
17
|
+
export declare function pagedOptionSlot(options: readonly CollectionFieldOption[] | undefined, optionId: unknown): number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PagedCollectionField, type PagedCollectionMutation, type PagedCollectionRecord } from "@uibot/contracts";
|
|
2
|
+
import type { rangeBounds } from "./paged-model.js";
|
|
3
|
+
export type FillRect = ReturnType<typeof rangeBounds>;
|
|
4
|
+
/** Plans one versioned transaction; source values always come from the original rows. */
|
|
5
|
+
export declare function planFill(source: FillRect, target: FillRect, rows: PagedCollectionRecord[], fields: PagedCollectionField[]): {
|
|
6
|
+
mutations: PagedCollectionMutation[];
|
|
7
|
+
skipped: number;
|
|
8
|
+
count: number;
|
|
9
|
+
limitExceeded: boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type PagedCollectionField, type PagedCollectionFilterNode, type PagedDateFilterMode, type PagedFilterOperator } from "@uibot/contracts";
|
|
2
|
+
import type { PagedCollectionLocale } from "./paged-locale.js";
|
|
3
|
+
export declare const filterOperatorLabel: (op: PagedFilterOperator, locale?: PagedCollectionLocale, field?: Pick<PagedCollectionField, "type" | "resultType">) => string;
|
|
4
|
+
export declare const dateModeLabel: (mode: PagedDateFilterMode, locale?: PagedCollectionLocale) => string;
|
|
5
|
+
/** One-line description of a filter, for summaries and tooltips. */
|
|
6
|
+
export declare function pagedFilterSummary(filter: PagedCollectionFilterNode, fields: PagedCollectionField[], locale?: PagedCollectionLocale): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type PagedCollectionAggregateClient, type PagedCollectionDescriptor, type PagedCollectionField, type PagedCollectionRecord, type PagedCollectionView } from "@uibot/contracts";
|
|
2
|
+
/** One whole-query request for up to eight chosen summaries; larger footers use bounded batches. */
|
|
3
|
+
export declare function useFooterAggregate(descriptor: PagedCollectionDescriptor, view: PagedCollectionView, fields: PagedCollectionField[], rows: PagedCollectionRecord[], client: PagedCollectionAggregateClient | undefined, reloadKey: number | undefined): {
|
|
4
|
+
status: string;
|
|
5
|
+
values: Record<string, string | number | null>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PagedCollectionField, PagedCollectionRecord, PagedFooterStat } from "@uibot/contracts";
|
|
2
|
+
/** Summaries that make sense for a field: counting works everywhere, arithmetic needs numbers. */
|
|
3
|
+
export declare function footerStatsFor(field: PagedCollectionField): PagedFooterStat[];
|
|
4
|
+
/** Over the records given, which are the loaded page: `null` means nothing to show. */
|
|
5
|
+
export declare function computeFooterStat(rows: ReadonlyArray<PagedCollectionRecord>, field: PagedCollectionField, fn: PagedFooterStat): number | string | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { PagedCollectionField, PagedCollectionRecord, PagedCollectionView, PagedRowHeight } from "@uibot/contracts";
|
|
2
|
+
export type PagedGroupableField = PagedCollectionField & {
|
|
3
|
+
type: "singleSelect" | "checkbox";
|
|
4
|
+
};
|
|
5
|
+
export declare function isPagedGroupableField(field: PagedCollectionField | undefined): field is PagedGroupableField;
|
|
6
|
+
export interface PagedGroupHeaderItem {
|
|
7
|
+
kind: "group";
|
|
8
|
+
/** Stable per render: position-qualified so a group repeated across loaded runs stays unique. */
|
|
9
|
+
key: string;
|
|
10
|
+
/** Collapse identity: the stored value, shared by every run of the same group. */
|
|
11
|
+
raw: string;
|
|
12
|
+
/** Option name, boolean label or `null` when the group has no value. */
|
|
13
|
+
label: string | null;
|
|
14
|
+
/** Option index for chip colour, -1 when unknown. */
|
|
15
|
+
colorIndex: number;
|
|
16
|
+
/** Records of this run, including collapsed ones. */
|
|
17
|
+
count: number;
|
|
18
|
+
collapsed: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface PagedGroupRowItem {
|
|
21
|
+
kind: "row";
|
|
22
|
+
index: number;
|
|
23
|
+
key: string;
|
|
24
|
+
}
|
|
25
|
+
export type PagedGroupItem = PagedGroupHeaderItem | PagedGroupRowItem;
|
|
26
|
+
export interface PagedGroupLayout {
|
|
27
|
+
items: PagedGroupItem[];
|
|
28
|
+
/** Item position per loaded row; `undefined` for rows hidden by a collapsed group. */
|
|
29
|
+
rowItem: Array<number | undefined>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Lays out loaded rows with group headers. Rows must already be sorted by the group
|
|
33
|
+
* field (hosts sort the query server-side), so runs are contiguous. Grouping never
|
|
34
|
+
* reorders or filters data.
|
|
35
|
+
*/
|
|
36
|
+
export declare function layoutPagedGroups(rows: readonly PagedCollectionRecord[], field: PagedGroupableField | undefined, collapsed?: ReadonlySet<string>): PagedGroupLayout;
|
|
37
|
+
/** Nearest loaded row that is visible, searching in `step` direction. */
|
|
38
|
+
export declare function nearestVisiblePagedRow(layout: PagedGroupLayout, from: number, step: 1 | -1, rowCount: number): number;
|
|
39
|
+
export declare const PAGED_GROUP_HEADER_HEIGHT = 34;
|
|
40
|
+
export declare const PAGED_ROW_HEIGHT = 38;
|
|
41
|
+
/** Lines of text a row of this height shows (the view's `rowHeight`, `short` when absent). */
|
|
42
|
+
export declare const pagedRowLines: (rowHeight?: PagedRowHeight) => number;
|
|
43
|
+
/** Pixel height of a grid row: one line is the base row, each extra line adds 22px. */
|
|
44
|
+
export declare const pagedRowHeightPx: (rowHeight?: PagedRowHeight) => number;
|
|
45
|
+
/** Content height of the scroll pane: header row plus every item. */
|
|
46
|
+
export declare function pagedLayoutHeight(layout: PagedGroupLayout, rowHeight?: number): number;
|
|
47
|
+
/**
|
|
48
|
+
* Server sort for a grouped grid: the group field first so each group is contiguous across
|
|
49
|
+
* pages. Only grid views grouped by a select or checkbox field are affected.
|
|
50
|
+
*/
|
|
51
|
+
export declare function pagedGroupedSort(view: Pick<PagedCollectionView, "type" | "groupByFieldId" | "sort"> | undefined, fields: readonly PagedCollectionField[] | undefined): PagedCollectionView["sort"];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection grid cell kinds adapted from teable MIT
|
|
3
|
+
* packages/sdk/src/components/grid/renderers/cell-renderer.
|
|
4
|
+
* Copyright (c) 2023-2025 Teable, Inc. MIT.
|
|
5
|
+
*
|
|
6
|
+
* The canvas Grid host (Grid.tsx) needs lodash, react-use, and @teable/*.
|
|
7
|
+
* s1-1 stop_condition: HTML table + typed cells, no those dependencies.
|
|
8
|
+
*/
|
|
9
|
+
export { COLLECTION_CELL_RENDERERS, CollectionGrid } from "./cells.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PagedCollectionField } from "@uibot/contracts";
|
|
2
|
+
import { type PagedCollectionLocale } from "./paged-locale.js";
|
|
3
|
+
export interface PagedFieldInputProps {
|
|
4
|
+
field: PagedCollectionField;
|
|
5
|
+
text: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
id?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Accessible name for compact controls that do not need a visible label. */
|
|
10
|
+
ariaLabel?: string;
|
|
11
|
+
onChange(text: string): void;
|
|
12
|
+
onSave?: ((direction?: "next" | "previous") => void) | undefined;
|
|
13
|
+
onCancel?: (() => void) | undefined;
|
|
14
|
+
locale?: PagedCollectionLocale | undefined;
|
|
15
|
+
/** After a failed submit, empty required fields show their error even if never focused. */
|
|
16
|
+
submitted?: boolean | undefined;
|
|
17
|
+
/** Extra described-by id, composed with the inline error when both are present. */
|
|
18
|
+
describedBy?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare function pagedFieldError(field: PagedCollectionField, text: string, locale: PagedCollectionLocale): string;
|
|
21
|
+
/** Controlled host-owned draft input with shared Paged Collection validation. */
|
|
22
|
+
export declare function PagedFieldInput({ field, text, disabled, id, label, ariaLabel, onChange, onSave, onCancel, locale, submitted, describedBy, }: PagedFieldInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Presentation locale only; schema identifiers and protocol tokens remain unchanged. */
|
|
2
|
+
export type PagedCollectionLocale = "en" | "zh-CN";
|
|
3
|
+
export declare function pagedText(locale?: PagedCollectionLocale): (message: string, values?: Record<string, string | number>) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PagedCollectionField, PagedCollectionMutation, PagedCollectionRecord } from "@uibot/contracts";
|
|
2
|
+
import { type PagedCollectionLocale } from "./paged-locale.js";
|
|
3
|
+
export interface CellPosition {
|
|
4
|
+
row: number;
|
|
5
|
+
column: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function moveCell(cell: CellPosition, key: string, rowCount: number, columnCount: number, backwards?: boolean): CellPosition;
|
|
8
|
+
export declare function rangeBounds(a: CellPosition, b: CellPosition): {
|
|
9
|
+
firstRow: number;
|
|
10
|
+
lastRow: number;
|
|
11
|
+
firstColumn: number;
|
|
12
|
+
lastColumn: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function cellText(value: unknown): string;
|
|
15
|
+
export declare function copyCells(rows: PagedCollectionRecord[], fields: PagedCollectionField[], a: CellPosition, b: CellPosition): string;
|
|
16
|
+
export declare function parseCellValue(text: string, field: PagedCollectionField, locale?: PagedCollectionLocale): unknown;
|
|
17
|
+
export declare function preparePaste(text: string, rows: PagedCollectionRecord[], fields: PagedCollectionField[], origin: CellPosition, locale?: PagedCollectionLocale): {
|
|
18
|
+
ok: true;
|
|
19
|
+
items: PagedCollectionMutation[];
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
/** Compact date presentation only; editors and clipboard retain original values. */
|
|
25
|
+
export declare function dateCellText(value: unknown, timeZone?: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PagedCollectionField, PagedCollectionRelationOption, PagedCollectionRelationOptionsProvider } from "@uibot/contracts";
|
|
2
|
+
import { type PagedCollectionLocale } from "./paged-locale.js";
|
|
3
|
+
/** The host owns scope and transport. Every lookup is a bounded server page. */
|
|
4
|
+
export declare function PagedRelationEditor(props: {
|
|
5
|
+
field: PagedCollectionField;
|
|
6
|
+
locale?: PagedCollectionLocale | undefined;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange(value: string): void;
|
|
9
|
+
getOptions?: PagedCollectionRelationOptionsProvider | undefined;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Server-resolved labels for the current selection; stored values stay record ids. */
|
|
13
|
+
labels?: ReadonlyArray<PagedCollectionRelationOption> | undefined;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PagedCollectionClient, PagedCollectionDescriptor, PagedCollectionField, PagedCollectionRelationOptionsProvider } from "@uibot/contracts";
|
|
2
|
+
/** Text fields of a collection in the order they should label a record. */
|
|
3
|
+
export declare function pagedRelationLabelFields(target: Pick<PagedCollectionDescriptor, "fields"> | undefined, configuredLabelFieldId?: string): PagedCollectionField[];
|
|
4
|
+
export declare function createPagedRelationOptions(client: Pick<PagedCollectionClient, "query">, collections: ReadonlyArray<Pick<PagedCollectionDescriptor, "id" | "fields">> | (() => ReadonlyArray<Pick<PagedCollectionDescriptor, "id" | "fields">>)): PagedCollectionRelationOptionsProvider;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PagedCollectionRecord } from "@uibot/contracts";
|
|
2
|
+
/** Loaded order wins; stale page identities and duplicates never enter bulk actions. */
|
|
3
|
+
export declare function unionRows(rangeRows: PagedCollectionRecord[], extraIds: ReadonlySet<string>, rows: PagedCollectionRecord[], excludedIds?: ReadonlySet<string>): PagedCollectionRecord[];
|
|
4
|
+
export declare function toggleExtra(ids: ReadonlySet<string>, id: string): Set<string>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type Activity = {
|
|
2
|
+
dirty: boolean;
|
|
3
|
+
busy: boolean;
|
|
4
|
+
};
|
|
5
|
+
type Report = (source: object, activity?: Activity) => void;
|
|
6
|
+
export interface CollectionActivityProps {
|
|
7
|
+
/** Unsaved values or an unconfirmed mutation; opening an unchanged editor is clean. */
|
|
8
|
+
onDirtyChange?(dirty: boolean): void;
|
|
9
|
+
/** An original mutation Promise is still pending. This is not a persistence receipt. */
|
|
10
|
+
onBusyChange?(busy: boolean): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const CollectionActivityContext: import("react").Context<Report | undefined>;
|
|
13
|
+
/** Each mounted editor removes only its own contribution. */
|
|
14
|
+
export declare function useCollectionActivity(activity: Activity, props?: CollectionActivityProps): void;
|
|
15
|
+
export declare function useCollectionActivities(): {
|
|
16
|
+
dirty: boolean;
|
|
17
|
+
busy: boolean;
|
|
18
|
+
report: Report;
|
|
19
|
+
};
|
|
20
|
+
/** A detached editor cannot apply a late result to its replacement surface. */
|
|
21
|
+
export declare function useCollectionInteractionLease(client: unknown, id: string): {
|
|
22
|
+
active: boolean;
|
|
23
|
+
client: unknown;
|
|
24
|
+
id: string;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PagedCollectionChangeClient, PagedCollectionChangePage } from "@uibot/contracts";
|
|
2
|
+
export interface CollectionLiveChangesProps {
|
|
3
|
+
collectionIds: string[];
|
|
4
|
+
client: PagedCollectionChangeClient;
|
|
5
|
+
onChanges(id: string, page: PagedCollectionChangePage, bootstrap: boolean): void | Promise<void>;
|
|
6
|
+
pollIntervalMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function CollectionLiveChanges({ collectionIds, client, onChanges, pollIntervalMs, }: CollectionLiveChangesProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PagedCollectionClient, PagedCollectionField, PagedCollectionRecord } from "@uibot/contracts";
|
|
2
|
+
import { type PagedCollectionLocale } from "./collection-grid/paged-locale.js";
|
|
3
|
+
export declare function lookupText(value: unknown): string;
|
|
4
|
+
export declare function relationText(row: PagedCollectionRecord, field: PagedCollectionField): string;
|
|
5
|
+
/** Raw linked value for edits; display labels never replace persisted record IDs. */
|
|
6
|
+
export declare function relationEditText(row: PagedCollectionRecord, field: PagedCollectionField): string;
|
|
7
|
+
export declare function RelationPicker({ field, value, labels, client, onChange, disabled, locale, "aria-describedby": describedBy, "aria-invalid": invalid, }: {
|
|
8
|
+
locale?: PagedCollectionLocale | undefined;
|
|
9
|
+
field: PagedCollectionField;
|
|
10
|
+
value: unknown;
|
|
11
|
+
labels?: Array<{
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}> | undefined;
|
|
15
|
+
client?: Pick<PagedCollectionClient, "query"> | undefined;
|
|
16
|
+
onChange(ids: string[]): void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
"aria-describedby"?: string | undefined;
|
|
19
|
+
"aria-invalid"?: boolean | undefined;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PagedCollectionDescriptor, PagedCollectionShareClient, PagedCollectionShareGrant } from "@uibot/contracts";
|
|
2
|
+
interface Props {
|
|
3
|
+
descriptor: PagedCollectionDescriptor;
|
|
4
|
+
recordIds: string[];
|
|
5
|
+
client: PagedCollectionShareClient;
|
|
6
|
+
linkForGrant(grant: PagedCollectionShareGrant, key: string): string;
|
|
7
|
+
registerRefresh?(fn: (() => Promise<void>) | null): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function CollectionShareControls({ descriptor, recordIds, client, linkForGrant, registerRefresh, }: Props): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PagedCollectionDescriptor, PagedCollectionTransferClient, PagedCollectionQuery } from "@uibot/contracts";
|
|
2
|
+
/** Injected host port only; no credentials, datastore or computed evaluation. */
|
|
3
|
+
export declare function CollectionTransferControls({ descriptor, fieldIds, query, client, readOnly, reloadKey, onImported, onRefreshSchema, }: {
|
|
4
|
+
descriptor: PagedCollectionDescriptor;
|
|
5
|
+
fieldIds: string[];
|
|
6
|
+
query: Omit<PagedCollectionQuery, "limit" | "cursor">;
|
|
7
|
+
client: PagedCollectionTransferClient;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
reloadKey?: number;
|
|
10
|
+
onImported(): void;
|
|
11
|
+
onRefreshSchema?(): Promise<PagedCollectionDescriptor | null>;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { CSSProperties, HTMLAttributes, ReactNode, RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Optional host-provided controls. Without them every view falls back to native
|
|
4
|
+
* elements, so the renderer stays usable with no design system at all. Hosts with one
|
|
5
|
+
* (for example shadcn/ui) provide these once and get consistent controls everywhere.
|
|
6
|
+
*/
|
|
7
|
+
export interface CollectionMenuItem {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
destructive?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Draw a divider above this item (groups related actions). */
|
|
14
|
+
separatorBefore?: boolean;
|
|
15
|
+
onSelect: () => void;
|
|
16
|
+
}
|
|
17
|
+
export interface CollectionUiSlots {
|
|
18
|
+
Button?: (props: {
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/** `default` is the filled primary action (save, create). */
|
|
21
|
+
variant?: "default" | "outline" | "ghost";
|
|
22
|
+
size?: "sm" | "icon";
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
onClick?: (() => void) | undefined;
|
|
25
|
+
title?: string | undefined;
|
|
26
|
+
"aria-label"?: string | undefined;
|
|
27
|
+
}) => ReactNode;
|
|
28
|
+
Select?: (props: {
|
|
29
|
+
value: string;
|
|
30
|
+
options: ReadonlyArray<{
|
|
31
|
+
value: string;
|
|
32
|
+
label: string;
|
|
33
|
+
disabled?: boolean | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
onChange: (value: string) => void;
|
|
36
|
+
disabled?: boolean | undefined;
|
|
37
|
+
"aria-label": string;
|
|
38
|
+
"aria-describedby"?: string | undefined;
|
|
39
|
+
"aria-invalid"?: boolean | undefined;
|
|
40
|
+
}) => ReactNode;
|
|
41
|
+
/** Multi-value select for record editors; `values` are option ids. */
|
|
42
|
+
MultiSelect?: (props: {
|
|
43
|
+
/** `slot` is the option's chip palette slot (its colour key, else its position). */
|
|
44
|
+
options: ReadonlyArray<{
|
|
45
|
+
value: string;
|
|
46
|
+
label: string;
|
|
47
|
+
slot?: number | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
values: string[];
|
|
50
|
+
onChange: (values: string[]) => void;
|
|
51
|
+
disabled?: boolean | undefined;
|
|
52
|
+
"aria-label": string;
|
|
53
|
+
"aria-describedby"?: string | undefined;
|
|
54
|
+
"aria-invalid"?: boolean | undefined;
|
|
55
|
+
placeholder?: string | undefined;
|
|
56
|
+
}) => ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Context menu around `children` (one element). Used for view tabs; hosts render their
|
|
59
|
+
* design-system menu, the renderer falls back to a minimal built-in menu.
|
|
60
|
+
*/
|
|
61
|
+
ContextMenu?: (props: {
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
items: ReadonlyArray<CollectionMenuItem>;
|
|
64
|
+
"aria-label": string;
|
|
65
|
+
}) => ReactNode;
|
|
66
|
+
/** Dropdown menu opened from a trigger button labelled `label`. */
|
|
67
|
+
DropdownMenu?: (props: {
|
|
68
|
+
label: string;
|
|
69
|
+
icon?: ReactNode;
|
|
70
|
+
items: ReadonlyArray<CollectionMenuItem>;
|
|
71
|
+
disabled?: boolean | undefined;
|
|
72
|
+
}) => ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Date (and optional time) picker for record forms. `value` is "" (empty), `YYYY-MM-DD`, or,
|
|
75
|
+
* when `withTime`, local `YYYY-MM-DDTHH:mm`. `onChange` receives the same shapes ("" clears);
|
|
76
|
+
* the renderer converts to and from the stored value.
|
|
77
|
+
*/
|
|
78
|
+
DatePicker?: (props: {
|
|
79
|
+
value: string;
|
|
80
|
+
onChange: (value: string) => void;
|
|
81
|
+
withTime?: boolean | undefined;
|
|
82
|
+
/** The field decides whether it has a time (hosts hide their include-time switch). */
|
|
83
|
+
fixedKind?: boolean | undefined;
|
|
84
|
+
clearable?: boolean | undefined;
|
|
85
|
+
disabled?: boolean | undefined;
|
|
86
|
+
id?: string | undefined;
|
|
87
|
+
"aria-label": string;
|
|
88
|
+
"aria-describedby"?: string | undefined;
|
|
89
|
+
"aria-invalid"?: boolean | undefined;
|
|
90
|
+
}) => ReactNode;
|
|
91
|
+
/** Month picker for the calendar view. `value` and `onChange` use `YYYY-MM`. */
|
|
92
|
+
MonthPicker?: (props: {
|
|
93
|
+
value: string;
|
|
94
|
+
onChange: (value: string) => void;
|
|
95
|
+
disabled?: boolean | undefined;
|
|
96
|
+
"aria-label": string;
|
|
97
|
+
}) => ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* Scroll container for the record grid. Render the host's scroll area with `viewportRef` and
|
|
100
|
+
* `viewportProps` applied to the element that actually scrolls (the grid virtualises on it), and
|
|
101
|
+
* `style` (height, position, overflow) on the outer box.
|
|
102
|
+
*/
|
|
103
|
+
ScrollArea?: (props: {
|
|
104
|
+
viewportRef: RefObject<HTMLDivElement | null>;
|
|
105
|
+
viewportProps: HTMLAttributes<HTMLDivElement>;
|
|
106
|
+
style: CSSProperties;
|
|
107
|
+
children: ReactNode;
|
|
108
|
+
}) => ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Modal confirmation for destructive or bulk actions. Without it the renderer uses a native
|
|
111
|
+
* modal dialog with focus containment, Escape cancellation and return focus.
|
|
112
|
+
*/
|
|
113
|
+
ConfirmDialog?: (props: {
|
|
114
|
+
open: boolean;
|
|
115
|
+
title: string;
|
|
116
|
+
description?: string | undefined;
|
|
117
|
+
confirmLabel: string;
|
|
118
|
+
cancelLabel: string;
|
|
119
|
+
destructive?: boolean | undefined;
|
|
120
|
+
busy?: boolean | undefined;
|
|
121
|
+
onConfirm: () => void;
|
|
122
|
+
onCancel: () => void;
|
|
123
|
+
}) => ReactNode;
|
|
124
|
+
/** Compact on/off control for view-level switches such as "show row numbers". */
|
|
125
|
+
Switch?: (props: {
|
|
126
|
+
checked: boolean;
|
|
127
|
+
onChange: (checked: boolean) => void;
|
|
128
|
+
disabled?: boolean | undefined;
|
|
129
|
+
"aria-label": string;
|
|
130
|
+
}) => ReactNode;
|
|
131
|
+
/** Toolbar button that opens a small panel (`children`) anchored below it; `active` marks a configured state. */
|
|
132
|
+
Popover?: (props: {
|
|
133
|
+
/** Opens a newly mounted settings picker, for example from a column menu. */
|
|
134
|
+
defaultOpen?: boolean | undefined;
|
|
135
|
+
label: string;
|
|
136
|
+
icon?: ReactNode;
|
|
137
|
+
/** Shown after the label, e.g. a chevron for a dropdown-style entry. */
|
|
138
|
+
iconEnd?: ReactNode;
|
|
139
|
+
/** Low-emphasis look for inline entries such as the grid footer. */
|
|
140
|
+
quiet?: boolean | undefined;
|
|
141
|
+
active?: boolean | undefined;
|
|
142
|
+
/** A function receives `close`, so actions that open a drawer can dismiss the popover first. */
|
|
143
|
+
children: ReactNode | ((close: () => void) => ReactNode);
|
|
144
|
+
}) => ReactNode;
|
|
145
|
+
/** Self-contained control that moves a record to another day (calendar view). */
|
|
146
|
+
DateMove?: (props: {
|
|
147
|
+
label: string;
|
|
148
|
+
value: string;
|
|
149
|
+
disabled?: boolean | undefined;
|
|
150
|
+
onPick: (day: string) => void;
|
|
151
|
+
}) => ReactNode;
|
|
152
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PagedCollectionAggregateClient, PagedCollectionAggregateIssue, PagedCollectionAggregateQuery, PagedCollectionAggregateRow, PagedCollectionAggregateSpec, PagedCollectionDescriptor, PagedCollectionView } from "@uibot/contracts";
|
|
2
|
+
import { type PagedCollectionLocale } from "../collection-grid/paged-locale.js";
|
|
3
|
+
export interface CollectionAggregateProps {
|
|
4
|
+
client: PagedCollectionAggregateClient;
|
|
5
|
+
aggregates: PagedCollectionAggregateSpec[];
|
|
6
|
+
groupBy?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function aggregateIssueText(issue: PagedCollectionAggregateIssue): string;
|
|
9
|
+
type AggregateWords = {
|
|
10
|
+
unassigned?: string;
|
|
11
|
+
checked?: string;
|
|
12
|
+
unchecked?: string;
|
|
13
|
+
none?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Renders host rows only. It has no record page to total. */
|
|
16
|
+
export declare function formatPagedAggregateRows(descriptor: PagedCollectionDescriptor, query: PagedCollectionAggregateQuery, rows: PagedCollectionAggregateRow[],
|
|
17
|
+
/** Display names for aggregate aliases (the alias itself is shown when absent). */
|
|
18
|
+
labels?: Record<string, string>,
|
|
19
|
+
/** Replaces the English group-value words ("Unassigned", "Checked", "Unchecked", "none"). */
|
|
20
|
+
words?: AggregateWords): string[];
|
|
21
|
+
export declare function CollectionAggregateRows({ descriptor, query, rows, }: {
|
|
22
|
+
descriptor: PagedCollectionDescriptor;
|
|
23
|
+
query: PagedCollectionAggregateQuery;
|
|
24
|
+
rows: PagedCollectionAggregateRow[];
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
export declare function CollectionAggregateSummary({ collectionId, descriptor, view, groupBy, aggregates, client, locale, labels, reloadKey, }: {
|
|
27
|
+
/** Change to refetch after the underlying records changed. */
|
|
28
|
+
reloadKey?: number;
|
|
29
|
+
locale?: PagedCollectionLocale;
|
|
30
|
+
/** Display names for aggregate aliases. */
|
|
31
|
+
labels?: Record<string, string>;
|
|
32
|
+
collectionId: string;
|
|
33
|
+
descriptor: PagedCollectionDescriptor;
|
|
34
|
+
view: Pick<PagedCollectionView, "filter" | "search">;
|
|
35
|
+
groupBy?: string[];
|
|
36
|
+
aggregates: PagedCollectionAggregateSpec[];
|
|
37
|
+
client: PagedCollectionAggregateClient;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PagedCollectionAiFillClient, PagedCollectionClient, PagedCollectionDescriptor, PagedCollectionMutationReceipt, PagedCollectionQuery, PagedCollectionRecord } from "@uibot/contracts";
|
|
2
|
+
import { type PagedCollectionLocale } from "../collection-grid/paged-locale.js";
|
|
3
|
+
import type { CollectionUiSlots } from "../collection-ui.js";
|
|
4
|
+
export interface AiFillDrawerProps {
|
|
5
|
+
table: PagedCollectionDescriptor;
|
|
6
|
+
rows: PagedCollectionRecord[];
|
|
7
|
+
selection: {
|
|
8
|
+
recordIds: string[];
|
|
9
|
+
fieldIds: string[];
|
|
10
|
+
};
|
|
11
|
+
aiFillClient: PagedCollectionAiFillClient;
|
|
12
|
+
client: Pick<PagedCollectionClient, "mutate" | "query">;
|
|
13
|
+
/** The view's query (filter, sort, search) so a run can cover every record, not just the loaded page. */
|
|
14
|
+
query?: PagedCollectionQuery;
|
|
15
|
+
/** Records the view matches, for the scope label. */
|
|
16
|
+
total?: number;
|
|
17
|
+
onCommitted(receipt: PagedCollectionMutationReceipt): void;
|
|
18
|
+
onClose(): void;
|
|
19
|
+
onNotify?(message: string): void;
|
|
20
|
+
locale?: PagedCollectionLocale;
|
|
21
|
+
ui?: CollectionUiSlots;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Non-modal right-hand drawer for AI fill: pick scope and target fields, describe the change,
|
|
25
|
+
* review per-cell suggestions, then apply by record version. The grid behind stays usable, so
|
|
26
|
+
* the selection can change while the drawer is open.
|
|
27
|
+
*/
|
|
28
|
+
export declare function AiFillDrawer(props: AiFillDrawerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type PagedCollectionAiFillSuggestion, type PagedCollectionField, type PagedCollectionMutation, type PagedCollectionRecord } from "@uibot/contracts";
|
|
2
|
+
/** Records sent as context in one model request. */
|
|
3
|
+
export declare const AI_FILL_BATCH = 50;
|
|
4
|
+
/** Records one run may cover when it walks the whole view. */
|
|
5
|
+
export declare const AI_FILL_MAX_RUN = 1000;
|
|
6
|
+
/** Updates committed per mutation request. */
|
|
7
|
+
export declare const AI_FILL_COMMIT_CHUNK = 100;
|
|
8
|
+
export declare function chunked<T>(items: T[], size: number): T[][];
|
|
9
|
+
/** Combines per-batch reviews; later batches never repeat a cell an earlier batch already proposed. */
|
|
10
|
+
export declare function mergeAiReviews(reviews: AiFillReview[]): AiFillReview;
|
|
11
|
+
/** Fields AI may propose values for: plain stored values, not computed, generated or linked. */
|
|
12
|
+
export declare function aiFillableFields(fields: PagedCollectionField[]): PagedCollectionField[];
|
|
13
|
+
/** Maps a model answer to the stored shape of `field`, or undefined when it cannot be one. */
|
|
14
|
+
export declare function coerceAiValue(field: PagedCollectionField, raw: unknown): unknown;
|
|
15
|
+
export interface AiFillChange {
|
|
16
|
+
/** Stable key for review state: record id and field id. */
|
|
17
|
+
key: string;
|
|
18
|
+
recordId: string;
|
|
19
|
+
expectedVersion: number;
|
|
20
|
+
fieldId: string;
|
|
21
|
+
before: unknown;
|
|
22
|
+
after: unknown;
|
|
23
|
+
reason?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface AiFillReview {
|
|
26
|
+
changes: AiFillChange[];
|
|
27
|
+
/** Proposed values dropped because they were unknown, invalid or already equal. */
|
|
28
|
+
skipped: number;
|
|
29
|
+
}
|
|
30
|
+
/** Turns raw suggestions into reviewable changes against the records the user is looking at. */
|
|
31
|
+
export declare function reviewAiSuggestions(fields: PagedCollectionField[], records: PagedCollectionRecord[], targetFieldIds: string[], suggestions: PagedCollectionAiFillSuggestion[]): AiFillReview;
|
|
32
|
+
/** One update per record carrying only the accepted fields. */
|
|
33
|
+
export declare function aiChangesToMutations(changes: AiFillChange[]): PagedCollectionMutation[];
|
|
34
|
+
/** Reverse updates against the versions the commit produced. */
|
|
35
|
+
export declare function aiUndoMutations(changes: AiFillChange[], committed: PagedCollectionRecord[]): PagedCollectionMutation[];
|