@protobase/schema 0.19.3 → 0.19.5

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FileOptions, FileProcessor, FileProcessorInput, ImageFormat, ImageVariant, ImageVariantOptions, imageFormats } from "./files/file-options.js";
2
- import { ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CompareOp, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, GalleryModel, HelpWhen, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NavModel, NavRecentModel, NowValue, OrderByItem, RecordMode, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
2
+ import { ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CompareOp, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, GalleryModel, HelpWhen, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NavModel, NavRecentModel, NowValue, OrderByItem, RecordMode, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionPresentation, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
3
3
  import { AccessAction, AccessContext, AccessFn, AccessResult, AccessUser, FieldAccess, FieldRule } from "./access/types.js";
4
4
  import { AnyField, Constraint, Field, FieldMeta, FieldTypeDef } from "./field.js";
5
5
  import { RelationField } from "./relation-field.js";
@@ -37,4 +37,4 @@ import { AccessSource, ResolveOptions, ResolvedAccess, RowFilterOperation, acces
37
37
  import { restrictModel } from "./access/restrict.js";
38
38
  import "./access/index.js";
39
39
  import { AssistantAction, AssistantActionRequest, AssistantCardPart, AssistantDiff, AssistantEvent, AssistantMessage, AssistantMessageRequest, AssistantPart, AssistantState, AssistantStep, AssistantStepState, AssistantTablePart, AssistantTextPart, AssistantTone, AssistantWidgetPart } from "./assistant/protocol.js";
40
- export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionModel, type ActionRun, type AnyField, type AppAddress, 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 BottomBarItemModel, type BottomBarModel, type BottomBarNames, type BottomBarSource, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CompareOp, type ComponentRef, type Constraint, type CreatedOptions, type CustomSectionModel, type DatePreset, type DeletedOptions, type DurationLiteral, type DurationUnit, type EvaluateOptions, type EventActor, type EventContext, type EventHelpers, type EventMatch, type EventModel, type EventOperation, type EventSpec, 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 FileField, type FileFieldModel, 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 GalleryModel, type Grant, type HeldCapability, type HelpWhen, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, type ListDisplayModel, type ListModel, type ListQuery, type Literal, type MapSectionModel, type MapView, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type RecordKey, type RecordMode, type RecordOf, type Ref, type Refs, type RelatedModel, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SignInAddress, type SignInPromptModel, type SignInStep, type SignInViewModel, type SortSpec, type Span, type StatusTone, type UndeletedOptions, type UpdatedOptions, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type Validator, type ViewBuilder, type ViewModel, type ViewProps, accessWarnings, addressWords, anonymousRole, appPath, bottomBar, bottomBarErrors, checkFilter, checkOrderBy, checkRecord, createWhere, defineRoles, enumLabel, evaluateFilter, f, fieldRef, fieldsUsedBy, imageFormats, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
40
+ export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionModel, type ActionRun, type AnyField, type AppAddress, 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 BottomBarItemModel, type BottomBarModel, type BottomBarNames, type BottomBarSource, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CompareOp, type ComponentRef, type Constraint, type CreatedOptions, type CustomSectionModel, type DatePreset, type DeletedOptions, type DurationLiteral, type DurationUnit, type EvaluateOptions, type EventActor, type EventContext, type EventHelpers, type EventMatch, type EventModel, type EventOperation, type EventSpec, 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 FileField, type FileFieldModel, 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 GalleryModel, type Grant, type HeldCapability, type HelpWhen, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, type ListDisplayModel, type ListModel, type ListQuery, type Literal, type MapSectionModel, type MapView, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type RecordKey, type RecordMode, type RecordOf, type Ref, type Refs, type RelatedModel, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SectionPresentation, type SignInAddress, type SignInPromptModel, type SignInStep, type SignInViewModel, type SortSpec, type Span, type StatusTone, type UndeletedOptions, type UpdatedOptions, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type Validator, type ViewBuilder, type ViewModel, type ViewProps, accessWarnings, addressWords, anonymousRole, appPath, bottomBar, bottomBarErrors, checkFilter, checkOrderBy, checkRecord, createWhere, defineRoles, enumLabel, evaluateFilter, f, fieldRef, fieldsUsedBy, imageFormats, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
package/dist/layout.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CardPhotosModel, HelpWhen, LayoutItemModel, RelatedModel } from "./model.js";
1
+ import { CardPhotosModel, HelpWhen, LayoutItemModel, RelatedModel, SectionPresentation } from "./model.js";
2
2
  import { Ref } from "./refs.js";
3
3
  import { ComponentRef, ViewProps } from "./view-displays.js";
4
4
  //#region src/layout.d.ts
@@ -19,10 +19,14 @@ export declare const layout: {
19
19
  /**
20
20
  * A titled group of fields in the main column, editable where the user may write; `help` is a line under the title,
21
21
  * shown only while the record is edited with `helpWhen: 'editing'` (the view's `.helpWhen(...)` when omitted).
22
+ * `presentation: 'facts'` shows the read view's fields as a row of key facts, as a listing on a real estate site does:
23
+ * each value under its field's `.icon(...)`, or under its label without one, leaving out the empty ones. See
24
+ * [Key facts](website/src/content/docs/reference/ui-config.mdx#key-facts).
22
25
  */
23
26
  section: (title: string, fields: Ref[], o?: {
24
27
  help?: string;
25
28
  helpWhen?: HelpWhen;
29
+ presentation?: SectionPresentation;
26
30
  }) => LayoutItemModel;
27
31
  /**
28
32
  * The record's photos as tiles in the main column, one large and the next four smaller, the last saying how many more
package/dist/layout.js CHANGED
@@ -18,13 +18,17 @@ const layout = {
18
18
  /**
19
19
  * A titled group of fields in the main column, editable where the user may write; `help` is a line under the title,
20
20
  * shown only while the record is edited with `helpWhen: 'editing'` (the view's `.helpWhen(...)` when omitted).
21
+ * `presentation: 'facts'` shows the read view's fields as a row of key facts, as a listing on a real estate site does:
22
+ * each value under its field's `.icon(...)`, or under its label without one, leaving out the empty ones. See
23
+ * [Key facts](website/src/content/docs/reference/ui-config.mdx#key-facts).
21
24
  */
22
25
  section: (title, fields, o = {}) => ({
23
26
  kind: "section",
24
27
  title,
25
28
  fields: fields.map((ref) => ref.name),
26
29
  ...o.help !== void 0 && { help: o.help },
27
- ...o.helpWhen !== void 0 && { helpWhen: o.helpWhen }
30
+ ...o.helpWhen !== void 0 && { helpWhen: o.helpWhen },
31
+ ...o.presentation !== void 0 && { presentation: o.presentation }
28
32
  }),
29
33
  /**
30
34
  * The record's photos as tiles in the main column, one large and the next four smaller, the last saying how many more
package/dist/model.d.ts CHANGED
@@ -229,7 +229,10 @@ export type FieldViewModel = {
229
229
  suffix?: string;
230
230
  /** How many decimals a number shows. */
231
231
  decimals?: number;
232
- /** An icon before the value on a card's meta row, by the names actions take (`ruler`); an unknown name shows none. */
232
+ /**
233
+ * An icon before the value on a card's meta row and above it in a section of key facts, by the names actions take
234
+ * (`ruler`); an unknown name shows none.
235
+ */
233
236
  icon?: string;
234
237
  /** What an enum value reads as wherever it is shown; a value without one reads as itself in words (`enumLabel`). */
235
238
  valueLabels?: Record<string, string>;
@@ -566,6 +569,8 @@ export type MapSectionModel = {
566
569
  /** Drawn as a sidebar card instead of in the main column. */
567
570
  sidebar?: true;
568
571
  };
572
+ /** How a section shows its fields on the read view: `facts` as a row of key facts; label/value rows when omitted. */
573
+ export type SectionPresentation = 'facts';
569
574
  /** An item of the record page (`.layout((r) => ...)` with `l`); see [The record page](website/src/content/docs/reference/ui-config.mdx#the-record-page). */
570
575
  export type LayoutItemModel = {
571
576
  /** A titled group of fields in the main column, editable where the user may write. */
@@ -578,6 +583,11 @@ export type LayoutItemModel = {
578
583
  help?: string;
579
584
  /** When `help` shows: always, or only while the record is edited; the view's `helpWhen` when omitted. */
580
585
  helpWhen?: HelpWhen;
586
+ /**
587
+ * `facts` shows the read view's fields as a row of key facts, each value under its field's `icon`, instead of
588
+ * label/value rows; the form edits them as any section's.
589
+ */
590
+ presentation?: SectionPresentation;
581
591
  } | {
582
592
  /** A read-only summary card beside the main column. */
583
593
  kind: 'sidebar';
@@ -654,7 +664,10 @@ export type ActionModel = {
654
664
  name: string;
655
665
  /** The button's label. */
656
666
  label: string;
657
- /** The button's icon: `bed`, `bell`, `bookmark`, `external-link`, `file-text`, `heart`, `ruler`, `send` or `wallet`; another name shows a lightning bolt. */
667
+ /**
668
+ * The button's icon: `bath`, `bed`, `bell`, `bookmark`, `calendar`, `door-open`, `external-link`, `file-text`, `heart`,
669
+ * `house`, `key`, `land-plot`, `leaf`, `ruler`, `send`, `tag` or `wallet`; another name shows a lightning bolt.
670
+ */
658
671
  icon?: string;
659
672
  /** The question the button asks before it runs the action. */
660
673
  confirm?: string;
@@ -826,6 +839,8 @@ export type ViewModel = {
826
839
  signIn?: SignInPromptModel;
827
840
  /** The list page's button that saves its filter as a search of the user's own. */
828
841
  saveSearch?: SaveSearchModel;
842
+ /** Whether the list page offers Import, which creates or updates records from an .xlsx or CSV file; it does when omitted. */
843
+ import?: boolean;
829
844
  /** The list page shows the user's saved searches of another resource, each with what it finds, instead of rows. */
830
845
  searchesOf?: SearchesOfModel;
831
846
  };
@@ -40,7 +40,10 @@ export declare class FieldView<N extends string = string, V = unknown> {
40
40
  valueColors(colors: { readonly [P in Extract<V, string>]?: string; }): FieldView<N, V>;
41
41
  /** `arrow` draws the field's badges as arrows pointing right, as on a rating scale such as the EU energy label. */
42
42
  badgeShape(badgeShape: BadgeShape): FieldView<N, V>;
43
- /** An icon before the value on a card's meta row, by the names actions take, such as `ruler`. */
43
+ /**
44
+ * An icon before the value on a card's meta row and above it in a section of key facts, by the names actions take,
45
+ * such as `ruler`.
46
+ */
44
47
  icon(icon: string): FieldView<N, V>;
45
48
  /**
46
49
  * Shows and edits the field with the field type a plugin registers under `name` (`definePlugin({ fields })`), given
@@ -67,7 +67,10 @@ var FieldView = class FieldView {
67
67
  badgeShape(badgeShape) {
68
68
  return this.with({ badgeShape });
69
69
  }
70
- /** An icon before the value on a card's meta row, by the names actions take, such as `ruler`. */
70
+ /**
71
+ * An icon before the value on a card's meta row and above it in a section of key facts, by the names actions take,
72
+ * such as `ruler`.
73
+ */
71
74
  icon(icon) {
72
75
  return this.with({ icon });
73
76
  }
package/dist/view.d.ts CHANGED
@@ -105,6 +105,12 @@ export declare class ViewBuilder<R extends {
105
105
  helpWhen(helpWhen: HelpWhen): ViewBuilder<R>;
106
106
  /** Where the record page shows that it saved: a toast (the default) or the Save button. */
107
107
  saveFeedback(saveFeedback: SaveFeedback): ViewBuilder<R>;
108
+ /**
109
+ * Whether the list page offers Import, which creates or updates records from an .xlsx or CSV file the user picks
110
+ * (`true`, the default, to users who may create records); `.import(false)` turns it off. See
111
+ * [Importing records](website/src/content/docs/reference/ui-config.mdx#importing-records).
112
+ */
113
+ import(enabled: boolean): ViewBuilder<R>;
108
114
  /**
109
115
  * The named actions of the record page's action rail, which composed pages can put on buttons too: `a.update`,
110
116
  * `a.remove` and `a.link` need no code, `a.action` runs a handler the app registers.
package/dist/view.js CHANGED
@@ -132,6 +132,14 @@ var ViewBuilder = class ViewBuilder {
132
132
  return this.next({ saveFeedback });
133
133
  }
134
134
  /**
135
+ * Whether the list page offers Import, which creates or updates records from an .xlsx or CSV file the user picks
136
+ * (`true`, the default, to users who may create records); `.import(false)` turns it off. See
137
+ * [Importing records](website/src/content/docs/reference/ui-config.mdx#importing-records).
138
+ */
139
+ import(enabled) {
140
+ return this.next({ import: enabled });
141
+ }
142
+ /**
135
143
  * The named actions of the record page's action rail, which composed pages can put on buttons too: `a.update`,
136
144
  * `a.remove` and `a.link` need no code, `a.action` runs a handler the app registers.
137
145
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {