@ai-matrx/records-ui 0.93.133 → 0.93.142

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.
@@ -0,0 +1,137 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { Uuid, RecordsDataSource, Field, Table } from '@ai-matrx/records';
4
+
5
+ /** One row of `custom.data_home_tables()`. */
6
+ interface TableAnywhere {
7
+ table_id: Uuid;
8
+ table_name: string;
9
+ organization_id: Uuid;
10
+ organization_name: string;
11
+ kind: string | null;
12
+ kept_by_the_app: boolean;
13
+ }
14
+ interface TablesAnywhere {
15
+ loading: boolean;
16
+ /** The store's own sentence when the list was refused. */
17
+ error: string | null;
18
+ rows: TableAnywhere[];
19
+ }
20
+ /** Every Table the person can open, in every organization, sorted by name. */
21
+ declare function useTablesAnywhere(dataSource: RecordsDataSource): TablesAnywhere;
22
+ interface TablePickerProps {
23
+ dataSource: RecordsDataSource;
24
+ value: string | null;
25
+ onChange: (tableId: string) => void;
26
+ disabled?: boolean;
27
+ /** Hand in an already-read list to skip a second read. */
28
+ tables?: TablesAnywhere;
29
+ }
30
+ /** Pick a Table by its name; the id is what `onChange` hands back. */
31
+ declare function TablePicker({ dataSource, value, onChange, disabled, tables }: TablePickerProps): react.JSX.Element;
32
+ interface TableScopeProps {
33
+ dataSource: RecordsDataSource;
34
+ /** The signed-in person — the actor every read runs as. */
35
+ userId: Uuid | null;
36
+ tableId: string | null;
37
+ children: ReactNode;
38
+ /** Shown while the Table's organization is unknown, or when no Table is chosen. */
39
+ fallback?: ReactNode;
40
+ tables?: TablesAnywhere;
41
+ }
42
+ /** The record store, bound to the organization the chosen Table lives in. */
43
+ declare function TableScope({ dataSource, userId, tableId, children, fallback, tables }: TableScopeProps): react.JSX.Element;
44
+ interface ColumnValuesEditorProps {
45
+ tableId: string;
46
+ /** `{field key: stored value}` — what the step matches on or writes. */
47
+ value: Record<string, unknown>;
48
+ onChange: (next: Record<string, unknown>) => void;
49
+ disabled?: boolean;
50
+ /** The add button's label: "Add a condition" for a lookup, "Add a value" for a write. */
51
+ addLabel: string;
52
+ }
53
+ /** Column / value rows for one Table. Must sit inside a `TableScope`. */
54
+ declare function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }: ColumnValuesEditorProps): react.JSX.Element;
55
+ interface RecordPickerProps {
56
+ tableId: string;
57
+ value: string | null;
58
+ onChange: (recordId: string) => void;
59
+ disabled?: boolean;
60
+ }
61
+ /** Pick one record of a Table by its name. Must sit inside a `TableScope`. */
62
+ declare function RecordPicker({ tableId, value, onChange, disabled }: RecordPickerProps): react.JSX.Element;
63
+
64
+ interface DataBinding {
65
+ kind: "merge_field";
66
+ source: "record";
67
+ semantic_type: "collection" | "reference" | "value";
68
+ table_id: string;
69
+ record_id?: string;
70
+ field_key?: string;
71
+ match?: Record<string, string | number | boolean | null>;
72
+ limit?: number;
73
+ transform?: {
74
+ name: "list";
75
+ template: string;
76
+ join?: string;
77
+ max?: number;
78
+ };
79
+ missing: "absent" | "block";
80
+ override_policy: "shown_locked";
81
+ }
82
+ type DataBindingShape = DataBinding["semantic_type"];
83
+ declare const DATA_BINDING_SHAPES: {
84
+ value: DataBindingShape;
85
+ label: string;
86
+ }[];
87
+ declare const DATA_BINDING_MISSING: {
88
+ value: DataBinding["missing"];
89
+ label: string;
90
+ }[];
91
+ /** A fresh, empty whole-table binding. */
92
+ declare function emptyDataBinding(): DataBinding;
93
+ /** True when a value is a merge-field binding (the one shape this picker reads and writes). */
94
+ declare function isDataBinding(value: unknown): value is DataBinding;
95
+ /** Ready to run only when the shape has everything it needs. */
96
+ declare function isCompleteDataBinding(binding: DataBinding): boolean;
97
+ /** The placeholders one column offers; an entity reference offers its words and its id apart. */
98
+ declare function bindingPlaceholdersFor(field: Field): {
99
+ token: string;
100
+ label: string;
101
+ }[];
102
+ /** The starting row template: the table's name column, then one or two describing columns. */
103
+ declare function defaultBindingTemplate(table: Pick<Table, "title_field"> | null, fields: readonly Field[]): string;
104
+ interface DataBindingPickerProps {
105
+ dataSource: RecordsDataSource;
106
+ /** The signed-in person — every read runs as them. */
107
+ userId: Uuid | null;
108
+ binding: DataBinding;
109
+ onChange: (binding: DataBinding) => void;
110
+ disabled?: boolean;
111
+ /** The host's starting row cap for a whole-table read (a knob the host reads), if any. */
112
+ defaultRowLimit?: number | null;
113
+ }
114
+ /** "From my data": table → shape → record / field → template → when it's missing. */
115
+ declare function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, defaultRowLimit }: DataBindingPickerProps): react.JSX.Element;
116
+
117
+ /** The chosen table's name, or `—` when it is not one this person can open. */
118
+ declare function TableNameText({ dataSource, tableId }: {
119
+ dataSource: RecordsDataSource;
120
+ tableId: string | null;
121
+ }): react.JSX.Element;
122
+ /** `{column key: value}` as "Column is value, Other is value" for one table. */
123
+ declare function ColumnValuesText({ dataSource, userId, tableId, value, }: {
124
+ dataSource: RecordsDataSource;
125
+ userId: Uuid | null;
126
+ tableId: string | null;
127
+ value: Record<string, unknown>;
128
+ }): react.JSX.Element;
129
+ /** One record of a table, read back as its name. */
130
+ declare function RecordNameText({ dataSource, userId, tableId, recordId, }: {
131
+ dataSource: RecordsDataSource;
132
+ userId: Uuid | null;
133
+ tableId: string | null;
134
+ recordId: string | null;
135
+ }): react.JSX.Element;
136
+
137
+ export { ColumnValuesEditor, type ColumnValuesEditorProps, ColumnValuesText, DATA_BINDING_MISSING, DATA_BINDING_SHAPES, type DataBinding, DataBindingPicker, type DataBindingPickerProps, type DataBindingShape, RecordNameText, RecordPicker, type RecordPickerProps, type TableAnywhere, TableNameText, TablePicker, type TablePickerProps, TableScope, type TableScopeProps, type TablesAnywhere, bindingPlaceholdersFor, defaultBindingTemplate, emptyDataBinding, isCompleteDataBinding, isDataBinding, useTablesAnywhere };
@@ -0,0 +1,137 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { Uuid, RecordsDataSource, Field, Table } from '@ai-matrx/records';
4
+
5
+ /** One row of `custom.data_home_tables()`. */
6
+ interface TableAnywhere {
7
+ table_id: Uuid;
8
+ table_name: string;
9
+ organization_id: Uuid;
10
+ organization_name: string;
11
+ kind: string | null;
12
+ kept_by_the_app: boolean;
13
+ }
14
+ interface TablesAnywhere {
15
+ loading: boolean;
16
+ /** The store's own sentence when the list was refused. */
17
+ error: string | null;
18
+ rows: TableAnywhere[];
19
+ }
20
+ /** Every Table the person can open, in every organization, sorted by name. */
21
+ declare function useTablesAnywhere(dataSource: RecordsDataSource): TablesAnywhere;
22
+ interface TablePickerProps {
23
+ dataSource: RecordsDataSource;
24
+ value: string | null;
25
+ onChange: (tableId: string) => void;
26
+ disabled?: boolean;
27
+ /** Hand in an already-read list to skip a second read. */
28
+ tables?: TablesAnywhere;
29
+ }
30
+ /** Pick a Table by its name; the id is what `onChange` hands back. */
31
+ declare function TablePicker({ dataSource, value, onChange, disabled, tables }: TablePickerProps): react.JSX.Element;
32
+ interface TableScopeProps {
33
+ dataSource: RecordsDataSource;
34
+ /** The signed-in person — the actor every read runs as. */
35
+ userId: Uuid | null;
36
+ tableId: string | null;
37
+ children: ReactNode;
38
+ /** Shown while the Table's organization is unknown, or when no Table is chosen. */
39
+ fallback?: ReactNode;
40
+ tables?: TablesAnywhere;
41
+ }
42
+ /** The record store, bound to the organization the chosen Table lives in. */
43
+ declare function TableScope({ dataSource, userId, tableId, children, fallback, tables }: TableScopeProps): react.JSX.Element;
44
+ interface ColumnValuesEditorProps {
45
+ tableId: string;
46
+ /** `{field key: stored value}` — what the step matches on or writes. */
47
+ value: Record<string, unknown>;
48
+ onChange: (next: Record<string, unknown>) => void;
49
+ disabled?: boolean;
50
+ /** The add button's label: "Add a condition" for a lookup, "Add a value" for a write. */
51
+ addLabel: string;
52
+ }
53
+ /** Column / value rows for one Table. Must sit inside a `TableScope`. */
54
+ declare function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }: ColumnValuesEditorProps): react.JSX.Element;
55
+ interface RecordPickerProps {
56
+ tableId: string;
57
+ value: string | null;
58
+ onChange: (recordId: string) => void;
59
+ disabled?: boolean;
60
+ }
61
+ /** Pick one record of a Table by its name. Must sit inside a `TableScope`. */
62
+ declare function RecordPicker({ tableId, value, onChange, disabled }: RecordPickerProps): react.JSX.Element;
63
+
64
+ interface DataBinding {
65
+ kind: "merge_field";
66
+ source: "record";
67
+ semantic_type: "collection" | "reference" | "value";
68
+ table_id: string;
69
+ record_id?: string;
70
+ field_key?: string;
71
+ match?: Record<string, string | number | boolean | null>;
72
+ limit?: number;
73
+ transform?: {
74
+ name: "list";
75
+ template: string;
76
+ join?: string;
77
+ max?: number;
78
+ };
79
+ missing: "absent" | "block";
80
+ override_policy: "shown_locked";
81
+ }
82
+ type DataBindingShape = DataBinding["semantic_type"];
83
+ declare const DATA_BINDING_SHAPES: {
84
+ value: DataBindingShape;
85
+ label: string;
86
+ }[];
87
+ declare const DATA_BINDING_MISSING: {
88
+ value: DataBinding["missing"];
89
+ label: string;
90
+ }[];
91
+ /** A fresh, empty whole-table binding. */
92
+ declare function emptyDataBinding(): DataBinding;
93
+ /** True when a value is a merge-field binding (the one shape this picker reads and writes). */
94
+ declare function isDataBinding(value: unknown): value is DataBinding;
95
+ /** Ready to run only when the shape has everything it needs. */
96
+ declare function isCompleteDataBinding(binding: DataBinding): boolean;
97
+ /** The placeholders one column offers; an entity reference offers its words and its id apart. */
98
+ declare function bindingPlaceholdersFor(field: Field): {
99
+ token: string;
100
+ label: string;
101
+ }[];
102
+ /** The starting row template: the table's name column, then one or two describing columns. */
103
+ declare function defaultBindingTemplate(table: Pick<Table, "title_field"> | null, fields: readonly Field[]): string;
104
+ interface DataBindingPickerProps {
105
+ dataSource: RecordsDataSource;
106
+ /** The signed-in person — every read runs as them. */
107
+ userId: Uuid | null;
108
+ binding: DataBinding;
109
+ onChange: (binding: DataBinding) => void;
110
+ disabled?: boolean;
111
+ /** The host's starting row cap for a whole-table read (a knob the host reads), if any. */
112
+ defaultRowLimit?: number | null;
113
+ }
114
+ /** "From my data": table → shape → record / field → template → when it's missing. */
115
+ declare function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, defaultRowLimit }: DataBindingPickerProps): react.JSX.Element;
116
+
117
+ /** The chosen table's name, or `—` when it is not one this person can open. */
118
+ declare function TableNameText({ dataSource, tableId }: {
119
+ dataSource: RecordsDataSource;
120
+ tableId: string | null;
121
+ }): react.JSX.Element;
122
+ /** `{column key: value}` as "Column is value, Other is value" for one table. */
123
+ declare function ColumnValuesText({ dataSource, userId, tableId, value, }: {
124
+ dataSource: RecordsDataSource;
125
+ userId: Uuid | null;
126
+ tableId: string | null;
127
+ value: Record<string, unknown>;
128
+ }): react.JSX.Element;
129
+ /** One record of a table, read back as its name. */
130
+ declare function RecordNameText({ dataSource, userId, tableId, recordId, }: {
131
+ dataSource: RecordsDataSource;
132
+ userId: Uuid | null;
133
+ tableId: string | null;
134
+ recordId: string | null;
135
+ }): react.JSX.Element;
136
+
137
+ export { ColumnValuesEditor, type ColumnValuesEditorProps, ColumnValuesText, DATA_BINDING_MISSING, DATA_BINDING_SHAPES, type DataBinding, DataBindingPicker, type DataBindingPickerProps, type DataBindingShape, RecordNameText, RecordPicker, type RecordPickerProps, type TableAnywhere, TableNameText, TablePicker, type TablePickerProps, TableScope, type TableScopeProps, type TablesAnywhere, bindingPlaceholdersFor, defaultBindingTemplate, emptyDataBinding, isCompleteDataBinding, isDataBinding, useTablesAnywhere };