@protobase/schema 0.119.4 → 0.119.6
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/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/model.d.ts +48 -2
- package/dist/record-page.d.ts +4 -0
- package/dist/record-page.js +19 -0
- package/dist/view.d.ts +8 -1
- package/dist/view.js +16 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { DerivedModel, DerivedTarget } from "./derived/derived-model.js";
|
|
|
4
4
|
import { BucketEvery, BucketMeasure, BucketsModel } from "./buckets/buckets-model.js";
|
|
5
5
|
import { FileOptions, FileProcessor, FileProcessorInput, ImageFormat, ImageVariant, ImageVariantOptions, imageFormats } from "./files/file-options.js";
|
|
6
6
|
import { BadgeTone, badgeTones, isBadgeTone } from "./badge-tones.js";
|
|
7
|
-
import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BlockElementModel, BlocksSectionModel, BottomBarItemModel, BottomBarModel, CalendarView, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CommentsSectionModel, CompareOp, ComposerSectionModel, CreateModel, CustomFallbackItemModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, FormModel, GalleryModel, GroupChartModel, GroupItemModel, GroupModel, HelpWhen, HistorySectionModel, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListDragModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NamedListModel, NavModel, NavRecentModel, NavStartModel, NowValue, OrderByItem, PageWidth, ParentAccess, ParentModel, PeriodChartModel, PositionAfterModel, RecordChartModel, RecordChartRange, RecordMode, RecordPageModel, RecordTrendModel, RecordWhen, RelatedColumnModel, RelatedFilter, RelatedModel, RelatedPresentation, ResourceModel, RowButtonChoice, RowButtonModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, TabItemModel, TabModel, ThreadSectionModel, TimelineView, TitleFromModel, ToolCallFields, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
|
|
7
|
+
import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BlockElementModel, BlocksSectionModel, BottomBarItemModel, BottomBarModel, CalendarView, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CommentsSectionModel, CompareOp, ComposerSectionModel, ConversationPageModel, CreateModel, CustomFallbackItemModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, FormModel, GalleryModel, GroupChartModel, GroupItemModel, GroupModel, HelpWhen, HistorySectionModel, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListDragModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NamedListModel, NavModel, NavRecentModel, NavStartModel, NowValue, OrderByItem, PageWidth, ParentAccess, ParentModel, PeriodChartModel, PositionAfterModel, ReadPositionModel, RecordChartModel, RecordChartRange, RecordMode, RecordPageModel, RecordTrendModel, RecordWhen, RelatedColumnModel, RelatedFilter, RelatedModel, RelatedPresentation, ResourceModel, RowButtonChoice, RowButtonModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, TabItemModel, TabModel, ThreadSectionModel, TimelineView, TitleFromModel, ToolCallFields, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
|
|
8
8
|
import { AccessAction, AccessContext, AccessFn, AccessResult, AccessUser, FieldAccess, FieldRule } from "./access/types.js";
|
|
9
9
|
import { Encrypted, encrypted } from "./encrypted-value.js";
|
|
10
10
|
import { AnyField, Constraint, Field, FieldMeta, FieldTypeDef } from "./field.js";
|
|
@@ -26,6 +26,7 @@ import { ListColumn } from "./view-columns.js";
|
|
|
26
26
|
import { ComponentRef, ViewProps } from "./view-displays.js";
|
|
27
27
|
import { FieldView } from "./view-field.js";
|
|
28
28
|
import { FieldViews, ViewBuilder, view } from "./view.js";
|
|
29
|
+
import { membersRule } from "./record-page.js";
|
|
29
30
|
import { FieldRefValue, fieldRef } from "./field-ref.js";
|
|
30
31
|
import { enumLabel } from "./enum-label.js";
|
|
31
32
|
import { UserMenuSource, userMenu } from "./user-menu.js";
|
|
@@ -57,4 +58,4 @@ import { CellKind, FileCell, FileDate, FileJson, cellKind, isEmptyFileCell } fro
|
|
|
57
58
|
import { UserTableFieldType, UserTableNameIssue, userTableNameIssue } from "./user-tables/names.js";
|
|
58
59
|
import { ColumnType, ColumnTypeReader, DecimalType, columnTypeReader, inferColumnType, maxShortText, minWholeDigits, widerFieldTypes } from "./user-tables/column-type.js";
|
|
59
60
|
import { fieldNamesOf, tableNameOf } from "./user-tables/column-names.js";
|
|
60
|
-
export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionInputKind, type ActionInputModel, type ActionModel, type ActionRun, type AnyField, type AppAddress, type ArgumentSpec, type ArgumentType, type ArgumentsSpec, type AssistantAction, type AssistantActionRequest, type AssistantCardPart, type AssistantDiff, type AssistantEvent, type AssistantMessage, type AssistantMessageRequest, type AssistantPart, type AssistantState, type AssistantStep, type AssistantStepState, type AssistantTablePart, type AssistantTextPart, type AssistantTone, type AssistantWidgetPart, type BadgeShape, type BadgeTone, type BlockElementModel, type BlocksSectionModel, type BottomBarItemModel, type BottomBarModel, type BottomBarNames, type BottomBarSource, type BucketEvery, type BucketFields, type BucketMeasure, type BucketMeasuresInput, type BucketsModel, type BucketsSpec, type CalendarView, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type CellKind, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type ColumnType, type ColumnTypeReader, type CommentsSectionModel, type CompareOp, type ComponentRef, type ComposerSectionModel, type ComputedReveal, type ConnectAddress, type Constraint, type CreateModel, type CreatedOptions, type CustomFallbackItemModel, type CustomSectionModel, type DatePreset, type DecimalType, type DeletedOptions, type DerivedModel, type DerivedSpec, type DerivedTarget, type DurationLiteral, type DurationUnit, type Encrypted, type EvaluateOptions, type EventActor, type EventContext, type EventHelpers, type EventMatch, type EventModel, type EventOperation, type EventSpec, type ExactCapability, type ExportModel, type Field, type FieldAccess, type FieldFormat, type FieldMeta, type FieldModel, type FieldPath, type FieldRefValue, type FieldRefs, type FieldRule, type FieldType, type FieldTypeDef, type FieldView, type FieldViewModel, type FieldViews, type FieldWidgetModel, type FieldsInput, type FileCell, type FileDate, type FileField, type FileFieldModel, type FileJson, type FileOptions, type FileProcessor, type FileProcessorInput, type FilterError, type FilterErrorCode, type FilterExpr, type FilterLayout, type FilterLimits, type FilterOf, type FilterParse, type FilterValue, type FilterWidgetModel, type FormAddress, type FormInput, type FormModel, type GalleryModel, type Grant, type GroupChartInput, type GroupChartModel, type GroupItemModel, type GroupModel, type HeldCapability, type HelpWhen, type HistorySectionModel, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, type ListColumn, type ListDisplayModel, type ListDragModel, type ListModel, type ListQuery, type Literal, type Lookup, type MapSectionModel, type MapView, type NamedListModel, type NavModel, type NavRecentModel, type NavStartModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type PageWidth, type ParentAccess, type ParentModel, type PeriodChartInput, type PeriodChartModel, type PositionAfterModel, type RecordChartModel, type RecordChartRange, type RecordKey, type RecordMode, type RecordOf, type RecordPageModel, type RecordTrendModel, type RecordWhen, type Ref, type Refs, type RelatedColumnModel, type RelatedFilter, type RelatedModel, type RelatedPresentation, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RevealCaller, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type Rollup, type RollupCount, type RollupFn, type RollupSource, type RollupValue, type RowButtonChoice, type RowButtonModel, type RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SectionModel, type SectionPresentation, type ShowWhen, type SignInAddress, type SignInPromptModel, type SignInStep, type SignInViewModel, type SortSpec, type Span, type StatusTone, type TabItemModel, type TabModel, type TenantOptions, type ThreadSectionModel, type TimelineView, type TitleFromModel, type ToolCallFields, type UndeletedOptions, type UpdatedOptions, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type UserTableFieldType, type UserTableNameIssue, type Validator, type ViewBuilder, type ViewModel, type ViewProps, accessWarnings, addressWords, anonymousRole, appPath, argumentsSchema, badgeTones, bottomBar, bottomBarErrors, cellKind, checkFilter, checkOrderBy, checkRecord, columnTypeReader, connectParams, connectPath, connectRoute, createWhere, defineRoles, encrypted, enumLabel, evaluateFilter, f, fieldNamesOf, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, inferColumnType, isBadgeTone, isEmptyFileCell, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, maxJsonDepth, maxShortText, minWholeDigits, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readConnectAddress, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, tableNameOf, userMenu, userTableNameIssue, view, where, widerFieldTypes };
|
|
61
|
+
export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionInputKind, type ActionInputModel, type ActionModel, type ActionRun, type AnyField, type AppAddress, type ArgumentSpec, type ArgumentType, type ArgumentsSpec, type AssistantAction, type AssistantActionRequest, type AssistantCardPart, type AssistantDiff, type AssistantEvent, type AssistantMessage, type AssistantMessageRequest, type AssistantPart, type AssistantState, type AssistantStep, type AssistantStepState, type AssistantTablePart, type AssistantTextPart, type AssistantTone, type AssistantWidgetPart, type BadgeShape, type BadgeTone, type BlockElementModel, type BlocksSectionModel, type BottomBarItemModel, type BottomBarModel, type BottomBarNames, type BottomBarSource, type BucketEvery, type BucketFields, type BucketMeasure, type BucketMeasuresInput, type BucketsModel, type BucketsSpec, type CalendarView, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type CellKind, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type ColumnType, type ColumnTypeReader, type CommentsSectionModel, type CompareOp, type ComponentRef, type ComposerSectionModel, type ComputedReveal, type ConnectAddress, type Constraint, type ConversationPageModel, type CreateModel, type CreatedOptions, type CustomFallbackItemModel, type CustomSectionModel, type DatePreset, type DecimalType, type DeletedOptions, type DerivedModel, type DerivedSpec, type DerivedTarget, type DurationLiteral, type DurationUnit, type Encrypted, type EvaluateOptions, type EventActor, type EventContext, type EventHelpers, type EventMatch, type EventModel, type EventOperation, type EventSpec, type ExactCapability, type ExportModel, type Field, type FieldAccess, type FieldFormat, type FieldMeta, type FieldModel, type FieldPath, type FieldRefValue, type FieldRefs, type FieldRule, type FieldType, type FieldTypeDef, type FieldView, type FieldViewModel, type FieldViews, type FieldWidgetModel, type FieldsInput, type FileCell, type FileDate, type FileField, type FileFieldModel, type FileJson, type FileOptions, type FileProcessor, type FileProcessorInput, type FilterError, type FilterErrorCode, type FilterExpr, type FilterLayout, type FilterLimits, type FilterOf, type FilterParse, type FilterValue, type FilterWidgetModel, type FormAddress, type FormInput, type FormModel, type GalleryModel, type Grant, type GroupChartInput, type GroupChartModel, type GroupItemModel, type GroupModel, type HeldCapability, type HelpWhen, type HistorySectionModel, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, type ListColumn, type ListDisplayModel, type ListDragModel, type ListModel, type ListQuery, type Literal, type Lookup, type MapSectionModel, type MapView, type NamedListModel, type NavModel, type NavRecentModel, type NavStartModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type PageWidth, type ParentAccess, type ParentModel, type PeriodChartInput, type PeriodChartModel, type PositionAfterModel, type ReadPositionModel, type RecordChartModel, type RecordChartRange, type RecordKey, type RecordMode, type RecordOf, type RecordPageModel, type RecordTrendModel, type RecordWhen, type Ref, type Refs, type RelatedColumnModel, type RelatedFilter, type RelatedModel, type RelatedPresentation, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RevealCaller, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type Rollup, type RollupCount, type RollupFn, type RollupSource, type RollupValue, type RowButtonChoice, type RowButtonModel, type RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SectionModel, type SectionPresentation, type ShowWhen, type SignInAddress, type SignInPromptModel, type SignInStep, type SignInViewModel, type SortSpec, type Span, type StatusTone, type TabItemModel, type TabModel, type TenantOptions, type ThreadSectionModel, type TimelineView, type TitleFromModel, type ToolCallFields, type UndeletedOptions, type UpdatedOptions, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type UserTableFieldType, type UserTableNameIssue, type Validator, type ViewBuilder, type ViewModel, type ViewProps, accessWarnings, addressWords, anonymousRole, appPath, argumentsSchema, badgeTones, bottomBar, bottomBarErrors, cellKind, checkFilter, checkOrderBy, checkRecord, columnTypeReader, connectParams, connectPath, connectRoute, createWhere, defineRoles, encrypted, enumLabel, evaluateFilter, f, fieldNamesOf, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, inferColumnType, isBadgeTone, isEmptyFileCell, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, maxJsonDepth, maxShortText, membersRule, minWholeDigits, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readConnectAddress, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, tableNameOf, userMenu, userTableNameIssue, view, where, widerFieldTypes };
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { accessWarnings, checkRecord, fieldsUsedBy, resolveAccess } from "./acce
|
|
|
13
13
|
import { resource } from "./resource.js";
|
|
14
14
|
import { isRecordCondition } from "./record-when.js";
|
|
15
15
|
import { formPath, formRoute, readFormAddress } from "./form-address.js";
|
|
16
|
+
import { membersRule } from "./record-page.js";
|
|
16
17
|
import { fieldRef } from "./field-ref.js";
|
|
17
18
|
import { badgeTones, isBadgeTone } from "./badge-tones.js";
|
|
18
19
|
import { view } from "./view.js";
|
|
@@ -34,4 +35,4 @@ import { cellKind, isEmptyFileCell } from "./user-tables/cell-kind.js";
|
|
|
34
35
|
import { columnTypeReader, inferColumnType, maxShortText, minWholeDigits, widerFieldTypes } from "./user-tables/column-type.js";
|
|
35
36
|
import { userTableNameIssue } from "./user-tables/names.js";
|
|
36
37
|
import { fieldNamesOf, tableNameOf } from "./user-tables/column-names.js";
|
|
37
|
-
export { accessWarnings, addressWords, anonymousRole, appPath, argumentsSchema, badgeTones, bottomBar, bottomBarErrors, cellKind, checkFilter, checkOrderBy, checkRecord, columnTypeReader, connectParams, connectPath, connectRoute, createWhere, defineRoles, encrypted, enumLabel, evaluateFilter, f, fieldNamesOf, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, inferColumnType, isBadgeTone, isEmptyFileCell, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, maxJsonDepth, maxShortText, minWholeDigits, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readConnectAddress, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, tableNameOf, userMenu, userTableNameIssue, view, where, widerFieldTypes };
|
|
38
|
+
export { accessWarnings, addressWords, anonymousRole, appPath, argumentsSchema, badgeTones, bottomBar, bottomBarErrors, cellKind, checkFilter, checkOrderBy, checkRecord, columnTypeReader, connectParams, connectPath, connectRoute, createWhere, defineRoles, encrypted, enumLabel, evaluateFilter, f, fieldNamesOf, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, inferColumnType, isBadgeTone, isEmptyFileCell, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, maxJsonDepth, maxShortText, membersRule, minWholeDigits, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readConnectAddress, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, tableNameOf, userMenu, userTableNameIssue, view, where, widerFieldTypes };
|
package/dist/model.d.ts
CHANGED
|
@@ -1682,8 +1682,8 @@ export type CreateModel = {
|
|
|
1682
1682
|
};
|
|
1683
1683
|
/**
|
|
1684
1684
|
* The record page as something else than the form (`.record(...)`): a component of the app's own, filling the content
|
|
1685
|
-
* area, on a focus page with its bar and Save when `focus`;
|
|
1686
|
-
* field type and saved by the framework.
|
|
1685
|
+
* area, on a focus page with its bar and Save when `focus`; a focus page whose surface is one field, drawn by its
|
|
1686
|
+
* field type and saved by the framework; or the record's conversation, filling the content area.
|
|
1687
1687
|
*/
|
|
1688
1688
|
export type RecordPageModel = {
|
|
1689
1689
|
/** The component, by the name `protobase.ui.tsx` exports it under. */
|
|
@@ -1693,6 +1693,52 @@ export type RecordPageModel = {
|
|
|
1693
1693
|
} | {
|
|
1694
1694
|
/** The field the page's surface draws. */
|
|
1695
1695
|
surface: string;
|
|
1696
|
+
} | {
|
|
1697
|
+
/** The record's conversation, its whole page. */
|
|
1698
|
+
conversation: ConversationPageModel;
|
|
1699
|
+
};
|
|
1700
|
+
/**
|
|
1701
|
+
* A record page that is the record's conversation (`.record({ conversation })`): a header, the messages that point at
|
|
1702
|
+
* the record, and a box that sends one. Its message fields name fields of `resource`; `subtitle` and `members` name
|
|
1703
|
+
* fields of the record.
|
|
1704
|
+
*/
|
|
1705
|
+
export type ConversationPageModel = {
|
|
1706
|
+
/** The message resource. */
|
|
1707
|
+
resource: string;
|
|
1708
|
+
/** The filterable relation of `resource` that holds this record's key, which each message sent gets too. */
|
|
1709
|
+
field: string;
|
|
1710
|
+
/** Who wrote each message: a relation, named as the record it points at, or a text field of user ids, named after the organization's members. */
|
|
1711
|
+
sender: string;
|
|
1712
|
+
/** When each message was sent: a date or timestamp field the API can sort by. */
|
|
1713
|
+
time: string;
|
|
1714
|
+
/** The message itself: a text field. */
|
|
1715
|
+
text: string;
|
|
1716
|
+
/** When the message was last changed, a date or timestamp field, empty for one never changed: a changed one says "(edited)". */
|
|
1717
|
+
edited?: string;
|
|
1718
|
+
/** The user ids a message mentions, a JSON field: `@` in the box lists the organization's members, and each pick lands here. */
|
|
1719
|
+
mentions?: string;
|
|
1720
|
+
/** A text field of the record shown beside its title in the header, such as a channel's topic. */
|
|
1721
|
+
subtitle?: string;
|
|
1722
|
+
/** A JSON field of the record holding user ids: the header names the people other than the reader, with their status, in place of the title. */
|
|
1723
|
+
members?: string;
|
|
1724
|
+
/** Where each reader's read position in the record is kept: the conversation opens on a "New messages" line and moves it as they read to the end. */
|
|
1725
|
+
readPosition?: ReadPositionModel;
|
|
1726
|
+
/** The hint in the empty box. */
|
|
1727
|
+
placeholder?: string;
|
|
1728
|
+
/** What the conversation says while it has no messages. */
|
|
1729
|
+
empty?: string;
|
|
1730
|
+
};
|
|
1731
|
+
/**
|
|
1732
|
+
* The resource that keeps how far each reader has read a record's conversation: one record per reader and record, its
|
|
1733
|
+
* `.author()` the reader, `field` a relation to the record and `message` the key of the newest message they read.
|
|
1734
|
+
*/
|
|
1735
|
+
export type ReadPositionModel = {
|
|
1736
|
+
/** The read position resource, which has an `.author()` field. */
|
|
1737
|
+
resource: string;
|
|
1738
|
+
/** The relation of `resource` that holds the record's key. */
|
|
1739
|
+
field: string;
|
|
1740
|
+
/** The integer field that holds the key of the newest message read; the message resource's key is one integer column. */
|
|
1741
|
+
message: string;
|
|
1696
1742
|
};
|
|
1697
1743
|
/** The list page's Export (`.export(...)`): how many rows a file may hold. */
|
|
1698
1744
|
export type ExportModel = {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/record-page.ts
|
|
2
|
+
/** The title rule that names a record after the people in a field of user ids other than the reader. */
|
|
3
|
+
const membersRule = "members";
|
|
4
|
+
/** What is wrong with the record page's own fields, those a conversation's header reads of the record; empty when nothing is. */
|
|
5
|
+
const recordPageErrors = (page, resource) => {
|
|
6
|
+
if (!page || !("conversation" in page)) return [];
|
|
7
|
+
const { subtitle, members } = page.conversation;
|
|
8
|
+
return [...subtitle === void 0 || Object.hasOwn(resource.fields, subtitle) ? [] : [`conversation subtitle names field "${subtitle}", which the resource does not have`], ...members === void 0 || Object.hasOwn(resource.fields, members) ? [] : [`conversation members names field "${members}", which the resource does not have`]];
|
|
9
|
+
};
|
|
10
|
+
/** The title a conversation page with `members` gives its record, after the people in it other than the reader. */
|
|
11
|
+
const membersTitle = (page) => {
|
|
12
|
+
if (!page || !("conversation" in page) || page.conversation.members === void 0) return;
|
|
13
|
+
return { titleFrom: {
|
|
14
|
+
rule: membersRule,
|
|
15
|
+
fields: [page.conversation.members]
|
|
16
|
+
} };
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { membersRule, membersTitle, recordPageErrors };
|
package/dist/view.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionModel, AppAddress, CreateModel, ExportModel, FilterWidgetModel, HelpWhen, LayoutItemModel, ListDisplayModel, ListDragModel, NavModel, NavRecentModel, PageWidth, RecordMode, ResourceModel, SaveFeedback, SaveSearchModel, SignInPromptModel, ViewModel } from "./model.js";
|
|
1
|
+
import { ActionModel, AppAddress, ConversationPageModel, CreateModel, ExportModel, FilterWidgetModel, HelpWhen, LayoutItemModel, ListDisplayModel, ListDragModel, NavModel, NavRecentModel, PageWidth, RecordMode, ResourceModel, SaveFeedback, SaveSearchModel, SignInPromptModel, ViewModel } from "./model.js";
|
|
2
2
|
import { FieldRefs, Ref } from "./refs.js";
|
|
3
3
|
import { actions } from "./view-actions.js";
|
|
4
4
|
import { ChartInput } from "./view-chart.js";
|
|
@@ -218,10 +218,17 @@ export declare class ViewBuilder<R extends {
|
|
|
218
218
|
* `focus: true` draws it on a focus page, with the bar's state, Save, the record's actions and panels; the form
|
|
219
219
|
* `(r) => ({ surface: r.body })` needs no component: the surface is one field, drawn by its field type. See
|
|
220
220
|
* [Focus pages](docs/website/src/content/docs/reference/ui-config.mdx#focus-pages).
|
|
221
|
+
*
|
|
222
|
+
* `conversation` makes the page the record's conversation, filling the area with no component of the app's own: a
|
|
223
|
+
* header, the messages that point at the record and a box that sends one. A conversation with `members` titles its
|
|
224
|
+
* record after them for each reader, as `.titleFrom('members', ...)` does, unless the view sets its own. See
|
|
225
|
+
* [Conversation pages](docs/website/src/content/docs/reference/ui-config.mdx#conversation-pages).
|
|
221
226
|
*/
|
|
222
227
|
record(options: {
|
|
223
228
|
component: ComponentRef<never>;
|
|
224
229
|
focus?: boolean;
|
|
230
|
+
} | {
|
|
231
|
+
conversation: ConversationPageModel;
|
|
225
232
|
} | ((r: FieldRefs<FieldsOf<R>>) => {
|
|
226
233
|
surface: Ref;
|
|
227
234
|
})): ViewBuilder<R>;
|
package/dist/view.js
CHANGED
|
@@ -5,6 +5,7 @@ import { layoutItems } from "./layout-items.js";
|
|
|
5
5
|
import { isMenuHref } from "./menu-href.js";
|
|
6
6
|
import { viewOfList } from "./named-list.js";
|
|
7
7
|
import { navRecentErrors } from "./nav-recent.js";
|
|
8
|
+
import { membersTitle, recordPageErrors } from "./record-page.js";
|
|
8
9
|
import { navStartErrors } from "./nav-start.js";
|
|
9
10
|
import { actions } from "./view-actions.js";
|
|
10
11
|
import { chartModel } from "./view-chart.js";
|
|
@@ -310,13 +311,19 @@ var ViewBuilder = class ViewBuilder {
|
|
|
310
311
|
* `focus: true` draws it on a focus page, with the bar's state, Save, the record's actions and panels; the form
|
|
311
312
|
* `(r) => ({ surface: r.body })` needs no component: the surface is one field, drawn by its field type. See
|
|
312
313
|
* [Focus pages](docs/website/src/content/docs/reference/ui-config.mdx#focus-pages).
|
|
314
|
+
*
|
|
315
|
+
* `conversation` makes the page the record's conversation, filling the area with no component of the app's own: a
|
|
316
|
+
* header, the messages that point at the record and a box that sends one. A conversation with `members` titles its
|
|
317
|
+
* record after them for each reader, as `.titleFrom('members', ...)` does, unless the view sets its own. See
|
|
318
|
+
* [Conversation pages](docs/website/src/content/docs/reference/ui-config.mdx#conversation-pages).
|
|
313
319
|
*/
|
|
314
320
|
record(options) {
|
|
315
|
-
|
|
321
|
+
if (typeof options === "function") return this.next({ record: { surface: options(this.refs()).surface.name } });
|
|
322
|
+
if ("conversation" in options) return this.next({ record: { conversation: structuredClone(options.conversation) } });
|
|
323
|
+
return this.next({ record: {
|
|
316
324
|
component: customComponent(options.component, "record component"),
|
|
317
325
|
...options.focus && { focus: true }
|
|
318
|
-
};
|
|
319
|
-
return this.next({ record });
|
|
326
|
+
} });
|
|
320
327
|
}
|
|
321
328
|
/**
|
|
322
329
|
* A record's page opens `to` in its place, replacing the address in the history, `{{field}}` in its resource, key and
|
|
@@ -426,8 +433,13 @@ var ViewBuilder = class ViewBuilder {
|
|
|
426
433
|
const opensUnknown = resource ? (this.state.recordOpens ?? []).flatMap(addressPlaceholders).find((name) => !Object.hasOwn(resource.fields, name)) : void 0;
|
|
427
434
|
if (opensUnknown !== void 0) throw new Error(`View "${this.state.resource}": recordOpens names field "${opensUnknown}", which the resource does not have`);
|
|
428
435
|
if (this.state.lists?.length && (listOf !== void 0 || this.state.searchesOf)) throw new Error(`View "${this.state.resource}": named lists cannot go with listOf or searchesOf, which replace the list page`);
|
|
436
|
+
const pageErrors = resource ? recordPageErrors(this.state.record, resource) : [];
|
|
437
|
+
if (pageErrors.length > 0) throw new Error(`View "${this.state.resource}": record ${pageErrors.join("; ")}`);
|
|
429
438
|
for (const named of this.state.lists ?? []) new ViewBuilder(viewOfList(this.state, named.name)).toModel(resource);
|
|
430
|
-
return structuredClone(
|
|
439
|
+
return structuredClone({
|
|
440
|
+
...this.state,
|
|
441
|
+
...!titleFrom && membersTitle(this.state.record)
|
|
442
|
+
});
|
|
431
443
|
}
|
|
432
444
|
refs() {
|
|
433
445
|
return createRefs(ref);
|