@protobase/schema 0.23.14 → 0.24.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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Rollup, RollupCount, RollupFn, RollupSource, RollupValue } from "./computed/rollup.js";
2
2
  import { FileOptions, FileProcessor, FileProcessorInput, ImageFormat, ImageVariant, ImageVariantOptions, imageFormats } from "./files/file-options.js";
3
- import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CalendarView, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CommentsSectionModel, CompareOp, CreateModel, 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, ListModel, ListQuery, Literal, MapSectionModel, MapView, NamedListModel, NavModel, NavRecentModel, NowValue, OrderByItem, PeriodChartModel, RecordMode, RecordWhen, RelatedColumnModel, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, TabItemModel, TabModel, TimelineView, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
3
+ import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CalendarView, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CommentsSectionModel, CompareOp, CreateModel, 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, NowValue, OrderByItem, PeriodChartModel, RecordMode, RecordWhen, RelatedColumnModel, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, TabItemModel, TabModel, TimelineView, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
4
4
  import { AccessAction, AccessContext, AccessFn, AccessResult, AccessUser, FieldAccess, FieldRule } from "./access/types.js";
5
5
  import { AnyField, Constraint, Field, FieldMeta, FieldTypeDef } from "./field.js";
6
6
  import { RelationField } from "./relation-field.js";
@@ -43,4 +43,4 @@ import { AccessSource, ResolveOptions, ResolvedAccess, RowFilterOperation, acces
43
43
  import { restrictModel } from "./access/restrict.js";
44
44
  import "./access/index.js";
45
45
  import { AssistantAction, AssistantActionRequest, AssistantCardPart, AssistantDiff, AssistantEvent, AssistantMessage, AssistantMessageRequest, AssistantPart, AssistantState, AssistantStep, AssistantStepState, AssistantTablePart, AssistantTextPart, AssistantTone, AssistantWidgetPart } from "./assistant/protocol.js";
46
- 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 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 CalendarView, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CommentsSectionModel, type CompareOp, type ComponentRef, type Constraint, type CreateModel, 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 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 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 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 ListModel, type ListQuery, type Literal, type MapSectionModel, type MapView, type NamedListModel, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type PeriodChartInput, type PeriodChartModel, type RecordKey, type RecordMode, type RecordOf, type RecordWhen, type Ref, type Refs, type RelatedColumnModel, type RelatedModel, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type Rollup, type RollupCount, type RollupFn, type RollupSource, type RollupValue, 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 TimelineView, 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, fitsKeyType, formPath, formRoute, imageFormats, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
46
+ 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 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 CalendarView, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CommentsSectionModel, type CompareOp, type ComponentRef, type Constraint, type CreateModel, 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 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 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 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 MapSectionModel, type MapView, type NamedListModel, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type PeriodChartInput, type PeriodChartModel, type RecordKey, type RecordMode, type RecordOf, type RecordWhen, type Ref, type Refs, type RelatedColumnModel, type RelatedModel, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type Rollup, type RollupCount, type RollupFn, type RollupSource, type RollupValue, 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 TimelineView, 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, fitsKeyType, formPath, formRoute, imageFormats, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
package/dist/model.d.ts CHANGED
@@ -582,6 +582,26 @@ export type ListModel = {
582
582
  * [Editing in the list](website/src/content/docs/reference/ui-config.mdx#editing-in-the-list).
583
583
  */
584
584
  editable?: string[];
585
+ /** What dragging changes, each off unless the list turns it on; see `ListDragModel`. */
586
+ drag?: ListDragModel;
587
+ };
588
+ /**
589
+ * What a user may change by dragging in a list, each for a user who may update the field it writes. See
590
+ * [Dragging in the list](website/src/content/docs/reference/ui-config.mdx#dragging-in-the-list).
591
+ */
592
+ export type ListDragModel = {
593
+ /**
594
+ * Re-ranking: in the resource's `.position()` order, without a parent's `within`, the table's rows and a board's cards
595
+ * move by dragging them, at any time, rather than after **Reorder**.
596
+ */
597
+ rank?: boolean;
598
+ /** Moving a board's card to another column, which saves its record with that column's value. */
599
+ board?: boolean;
600
+ /**
601
+ * Where the table's rows may land when re-ranked: the name of a drop rule in the UI config's `dropRules`. A drop where
602
+ * it refuses lands in the first place below that it allows, with a warning saying why.
603
+ */
604
+ rule?: string;
585
605
  };
586
606
  /**
587
607
  * A list column of the records of another resource that point at each row, directly or through a join resource, as a
@@ -79,9 +79,10 @@ export declare const displays: {
79
79
  * many of the list's records have it; with a column for records without a value when the field may be empty. Each
80
80
  * column pages through the list API with the list's filter and search, its value added, in the list's order. A card
81
81
  * shows `title` (default: the view's title) over `subtitle`, with `badge` and a few small `meta` fields, as the built-in
82
- * card of `d.cards` does, and opens the record. Dragging a card to another column, or picking it up with Space and
83
- * moving it with the arrow keys, saves the record with `by` set to that column's value, as one update with its ETag,
84
- * so the resource's access rules and `validate` decide, and a refusal puts the card back and says why. `by` must be
82
+ * card of `d.cards` does, and opens the record. With the list's `drag: { board: true }`, dragging a card to another
83
+ * column, or picking it up with Space and moving it with the arrow keys, saves the record with `by` set to that
84
+ * column's value, as one update with its ETag, so the resource's access rules and `validate` decide, and a refusal
85
+ * puts the card back and says why; with `drag: { rank: true }` a card moves within its column too. `by` must be
85
86
  * a filterable enum field. Named `board` unless `name` says otherwise. See
86
87
  * [Boards](website/src/content/docs/reference/ui-config.mdx#boards).
87
88
  */
@@ -75,9 +75,10 @@ const displays = {
75
75
  * many of the list's records have it; with a column for records without a value when the field may be empty. Each
76
76
  * column pages through the list API with the list's filter and search, its value added, in the list's order. A card
77
77
  * shows `title` (default: the view's title) over `subtitle`, with `badge` and a few small `meta` fields, as the built-in
78
- * card of `d.cards` does, and opens the record. Dragging a card to another column, or picking it up with Space and
79
- * moving it with the arrow keys, saves the record with `by` set to that column's value, as one update with its ETag,
80
- * so the resource's access rules and `validate` decide, and a refusal puts the card back and says why. `by` must be
78
+ * card of `d.cards` does, and opens the record. With the list's `drag: { board: true }`, dragging a card to another
79
+ * column, or picking it up with Space and moving it with the arrow keys, saves the record with `by` set to that
80
+ * column's value, as one update with its ETag, so the resource's access rules and `validate` decide, and a refusal
81
+ * puts the card back and says why; with `drag: { rank: true }` a card moves within its column too. `by` must be
81
82
  * a filterable enum field. Named `board` unless `name` says otherwise. See
82
83
  * [Boards](website/src/content/docs/reference/ui-config.mdx#boards).
83
84
  */
package/dist/view.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ActionModel, CreateModel, ExportModel, FilterWidgetModel, HelpWhen, LayoutItemModel, ListDisplayModel, NavModel, NavRecentModel, RecordMode, ResourceModel, SaveFeedback, SaveSearchModel, SignInPromptModel, ViewModel } from "./model.js";
1
+ import { ActionModel, CreateModel, ExportModel, FilterWidgetModel, HelpWhen, LayoutItemModel, ListDisplayModel, ListDragModel, NavModel, NavRecentModel, 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";
@@ -70,8 +70,8 @@ export declare class ViewBuilder<R extends {
70
70
  /**
71
71
  * The list: its table's `columns`, fields or columns of related records (`c.related`), `sort`, `search` and a `filter` it opens with, the
72
72
  * columns that are `editable` in their cell, and other `displays` to switch to (`d.cards`, `d.map`, `d.board`, `d.calendar`, `d.timeline`, `d.custom`), one of which
73
- * may be the `default` the list opens in. Throws when display or column names collide, `default` names none or an
74
- * editable field is not among the columns. See
73
+ * may be the `default` the list opens in, and what `drag` lets a user change by dragging, nothing unless it says.
74
+ * Throws when display or column names collide, `default` names none or an editable field is not among the columns. See
75
75
  * [Editing in the list](website/src/content/docs/reference/ui-config.mdx#editing-in-the-list).
76
76
  */
77
77
  list(build: (r: FieldRefs<FieldsOf<R>>, d: typeof displays, c: typeof columns) => {
@@ -82,6 +82,7 @@ export declare class ViewBuilder<R extends {
82
82
  editable?: Ref[];
83
83
  displays?: ListDisplayModel[];
84
84
  default?: string;
85
+ drag?: ListDragModel;
85
86
  }): ViewBuilder<R>;
86
87
  /**
87
88
  * The filter widgets above the list, in order, each on a `.filterable()` field: `w.facets`, `w.dateRange`, `w.range`,
package/dist/view.js CHANGED
@@ -89,12 +89,12 @@ var ViewBuilder = class ViewBuilder {
89
89
  /**
90
90
  * The list: its table's `columns`, fields or columns of related records (`c.related`), `sort`, `search` and a `filter` it opens with, the
91
91
  * columns that are `editable` in their cell, and other `displays` to switch to (`d.cards`, `d.map`, `d.board`, `d.calendar`, `d.timeline`, `d.custom`), one of which
92
- * may be the `default` the list opens in. Throws when display or column names collide, `default` names none or an
93
- * editable field is not among the columns. See
92
+ * may be the `default` the list opens in, and what `drag` lets a user change by dragging, nothing unless it says.
93
+ * Throws when display or column names collide, `default` names none or an editable field is not among the columns. See
94
94
  * [Editing in the list](website/src/content/docs/reference/ui-config.mdx#editing-in-the-list).
95
95
  */
96
96
  list(build) {
97
- const { columns: columns$1, sort, search, filter, editable, displays: shown = [], default: opens } = build(this.refs(), displays, columns);
97
+ const { columns: columns$1, sort, search, filter, editable, displays: shown = [], default: opens, drag } = build(this.refs(), displays, columns);
98
98
  const related = columns$1.filter(isListColumn).map(({ kind: _, ...column }) => column);
99
99
  const names = columns$1.map((column) => column.name);
100
100
  const repeated = names.find((name, index) => names.indexOf(name) !== index);
@@ -109,7 +109,8 @@ var ViewBuilder = class ViewBuilder {
109
109
  ...filter !== void 0 && filter !== "" && { filter },
110
110
  ...editable && editable.length > 0 && { editable: editable.map((ref) => ref.name) },
111
111
  ...shown.length > 0 && { displays: shown },
112
- ...opens !== void 0 && { default: opens }
112
+ ...opens !== void 0 && { default: opens },
113
+ ...drag && { drag: { ...drag } }
113
114
  };
114
115
  const errors = displayErrors(list);
115
116
  if (errors.length > 0) throw new Error(`View "${this.state.resource}": ${errors.join("; ")}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.23.14",
3
+ "version": "0.24.1",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {