@protobase/schema 0.12.13 → 0.12.15
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 +2 -2
- package/dist/model.d.ts +15 -0
- package/dist/view-displays.d.ts +5 -3
- package/dist/view-displays.js +5 -3
- package/dist/view-widgets.d.ts +7 -0
- package/dist/view-widgets.js +9 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, 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, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, NavModel, NavRecentModel, NowValue, OrderByItem, RelatedModel, ResourceModel, SaveFeedback, SearchMatch, SearchResultModel, SortSpec, Span, StatusTone, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
|
|
1
|
+
import { ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, 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, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, NavModel, NavRecentModel, NowValue, OrderByItem, RelatedModel, ResourceModel, SaveFeedback, SearchMatch, SearchResultModel, SortSpec, Span, StatusTone, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
|
|
2
2
|
import { AccessAction, AccessContext, AccessFn, AccessResult, AccessUser, FieldAccess, FieldRule } from "./access/types.js";
|
|
3
3
|
import { FileProcessor, FileProcessorInput, checkedAccept, checkedProvider, parseSize } from "./files/file-options.js";
|
|
4
4
|
import { Field } from "./field.js";
|
|
@@ -44,4 +44,4 @@ import "./access/index.js";
|
|
|
44
44
|
import { AssistantAction, AssistantActionRequest, AssistantCardPart, AssistantDiff, AssistantEvent, AssistantMessage, AssistantMessageRequest, AssistantPart, AssistantState, AssistantStep, AssistantStepState, AssistantTablePart, AssistantTextPart, AssistantTone, AssistantWidgetPart } from "./assistant/protocol.js";
|
|
45
45
|
import { applyAssistantEvent, emptyAssistantState } from "./assistant/apply-event.js";
|
|
46
46
|
import { readEventStream } from "./assistant/event-stream.js";
|
|
47
|
-
export { type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionModel, type ActionRun, type AddressCheck, 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 ChartGranularity, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CompareOp, type ComponentRef, type CustomSectionModel, type DatePreset, 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 FieldModel, type FieldPath, type FieldRefValue, type FieldRule, type FieldType, type FieldViewModel, type FieldWidgetModel, type FileField, type FileFieldModel, type FileProcessor, type FileProcessorInput, type FilterError, type FilterErrorCode, type FilterExpr, type FilterLayout, type FilterLimits, type FilterOf, type FilterParse, type FilterValue, type FilterWidgetModel, type InferRecord, type JsonValue, type KeyType, type KeyValue, type LayoutItemModel, type ListDisplayModel, type ListModel, type ListQuery, type Literal, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type PluginHost, type PluginRequirement, type PropShapes, type RecordKey, type RefShape, type RelatedModel, type ResolveOptions, type ResolvedAccess, type ResourceModel, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type RowFilterOperation, type Rule, type SaveFeedback, type SearchMatch, type SearchResultModel, type SearchTerm, type SortSpec, type Span, type StatusTone, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type ViewModel, type ViewProps, accessWarnings, addressErrors, addressPlaceholders, addressWords, anonymousRole, appHrefError, appPath, applyAssistantEvent, bottomBar, bottomBarErrors, bottomBarFor, checkEventFilter, checkFilter, checkOrderBy, checkRecord, checkedAccept, checkedProvider, createWhere, decodeKey, defaultRecentLimit, defineRoles, displayFields, emptyAssistantState, encodeKey, enumLabel, evaluateFilter, f, fieldRef, fieldRefsIn, fieldsUsedBy, fillAddress, hrefPlaceholders, inRange, isFieldRef, keyTypes, layout as l, leavesApp, markFieldRefs, matchedSearchField, matchesSearch, maxBottomBarItems, navRecentErrors, parseFilter, parseOrderBy, parseSize, pickView, pluginProblem, printFilter, printOrderBy, pruneByShape, readAppPath, readEventStream, redactSecrets, resolveAccess, resource, restrictModel, rule, searchTerms, shapes, statusTones, tableDisplay, termMatches, unmarkFieldRefs, userMenu, view, webhookResources, where };
|
|
47
|
+
export { type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionModel, type ActionRun, type AddressCheck, 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 CardPhotosModel, type ChartGranularity, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CompareOp, type ComponentRef, type CustomSectionModel, type DatePreset, 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 FieldModel, type FieldPath, type FieldRefValue, type FieldRule, type FieldType, type FieldViewModel, type FieldWidgetModel, type FileField, type FileFieldModel, type FileProcessor, type FileProcessorInput, type FilterError, type FilterErrorCode, type FilterExpr, type FilterLayout, type FilterLimits, type FilterOf, type FilterParse, type FilterValue, type FilterWidgetModel, type InferRecord, type JsonValue, type KeyType, type KeyValue, type LayoutItemModel, type ListDisplayModel, type ListModel, type ListQuery, type Literal, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type PluginHost, type PluginRequirement, type PropShapes, type RecordKey, type RefShape, type RelatedModel, type ResolveOptions, type ResolvedAccess, type ResourceModel, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type RowFilterOperation, type Rule, type SaveFeedback, type SearchMatch, type SearchResultModel, type SearchTerm, type SortSpec, type Span, type StatusTone, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type ViewModel, type ViewProps, accessWarnings, addressErrors, addressPlaceholders, addressWords, anonymousRole, appHrefError, appPath, applyAssistantEvent, bottomBar, bottomBarErrors, bottomBarFor, checkEventFilter, checkFilter, checkOrderBy, checkRecord, checkedAccept, checkedProvider, createWhere, decodeKey, defaultRecentLimit, defineRoles, displayFields, emptyAssistantState, encodeKey, enumLabel, evaluateFilter, f, fieldRef, fieldRefsIn, fieldsUsedBy, fillAddress, hrefPlaceholders, inRange, isFieldRef, keyTypes, layout as l, leavesApp, markFieldRefs, matchedSearchField, matchesSearch, maxBottomBarItems, navRecentErrors, parseFilter, parseOrderBy, parseSize, pickView, pluginProblem, printFilter, printOrderBy, pruneByShape, readAppPath, readEventStream, redactSecrets, resolveAccess, resource, restrictModel, rule, searchTerms, shapes, statusTones, tableDisplay, termMatches, unmarkFieldRefs, userMenu, view, webhookResources, where };
|
package/dist/model.d.ts
CHANGED
|
@@ -155,6 +155,7 @@ export type ListDisplayModel = {
|
|
|
155
155
|
meta?: string[];
|
|
156
156
|
flags?: string[];
|
|
157
157
|
card?: string;
|
|
158
|
+
photos?: CardPhotosModel;
|
|
158
159
|
} | {
|
|
159
160
|
kind: 'custom';
|
|
160
161
|
name: string;
|
|
@@ -164,6 +165,16 @@ export type ListDisplayModel = {
|
|
|
164
165
|
fields: string[];
|
|
165
166
|
props?: Record<string, JsonValue>;
|
|
166
167
|
};
|
|
168
|
+
/**
|
|
169
|
+
* Where a card's further photos come from: the records of `resource` whose relation `field` points at the card's record,
|
|
170
|
+
* in `sort` order, each shown by its file field `image`. The card loads them when its arrows are first used.
|
|
171
|
+
*/
|
|
172
|
+
export type CardPhotosModel = {
|
|
173
|
+
resource: string;
|
|
174
|
+
field: string;
|
|
175
|
+
image: string;
|
|
176
|
+
sort?: string;
|
|
177
|
+
};
|
|
167
178
|
export type ListModel = {
|
|
168
179
|
columns: string[];
|
|
169
180
|
sort?: SortSpec;
|
|
@@ -190,6 +201,10 @@ export type FilterWidgetModel = {
|
|
|
190
201
|
} | {
|
|
191
202
|
kind: 'toggle';
|
|
192
203
|
field: string;
|
|
204
|
+
} | {
|
|
205
|
+
kind: 'flags';
|
|
206
|
+
fields: string[];
|
|
207
|
+
label: string;
|
|
193
208
|
};
|
|
194
209
|
/**
|
|
195
210
|
* Records of another resource on the record page: those whose `field` holds this record's key or, with `through`,
|
package/dist/view-displays.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListDisplayModel } from "./model.js";
|
|
1
|
+
import { CardPhotosModel, ListDisplayModel } from "./model.js";
|
|
2
2
|
import { Ref } from "./refs.js";
|
|
3
3
|
//#region src/view-displays.d.ts
|
|
4
4
|
/** A custom component as `component(name)` from `@protobase/layout` declares it. */
|
|
@@ -21,8 +21,9 @@ export declare const displays: {
|
|
|
21
21
|
* view's title) over `subtitle`, `badge` drawn as a badge with its value labels, and a few small `meta` fields such as
|
|
22
22
|
* dates. `flags` are boolean fields shown as small badges of their labels when true, such as a garden or parking.
|
|
23
23
|
* With `card`, a component of the project or a plugin draws each card's content instead, from the row of those
|
|
24
|
-
* fields (`{ row }`); without it, or when it throws, the card is the built-in one.
|
|
25
|
-
*
|
|
24
|
+
* fields (`{ row }`); without it, or when it throws, the card is the built-in one. With `photos`, the built-in card's
|
|
25
|
+
* picture gets arrows through the `image` of the records of another resource that point at the card's record, after
|
|
26
|
+
* its own `image`; they load when an arrow is first pressed. Named `cards` unless `name` says otherwise.
|
|
26
27
|
*/
|
|
27
28
|
cards: (fields: {
|
|
28
29
|
image?: Ref;
|
|
@@ -33,6 +34,7 @@ export declare const displays: {
|
|
|
33
34
|
flags?: Ref[];
|
|
34
35
|
}, o?: Naming & {
|
|
35
36
|
card?: ComponentRef<never>;
|
|
37
|
+
photos?: CardPhotosModel;
|
|
36
38
|
}) => ListDisplayModel;
|
|
37
39
|
/**
|
|
38
40
|
* The list drawn by a component of the project, registered in `protobase.ui.tsx` under its name. It gets `props` and
|
package/dist/view-displays.js
CHANGED
|
@@ -17,8 +17,9 @@ const displays = {
|
|
|
17
17
|
* view's title) over `subtitle`, `badge` drawn as a badge with its value labels, and a few small `meta` fields such as
|
|
18
18
|
* dates. `flags` are boolean fields shown as small badges of their labels when true, such as a garden or parking.
|
|
19
19
|
* With `card`, a component of the project or a plugin draws each card's content instead, from the row of those
|
|
20
|
-
* fields (`{ row }`); without it, or when it throws, the card is the built-in one.
|
|
21
|
-
*
|
|
20
|
+
* fields (`{ row }`); without it, or when it throws, the card is the built-in one. With `photos`, the built-in card's
|
|
21
|
+
* picture gets arrows through the `image` of the records of another resource that point at the card's record, after
|
|
22
|
+
* its own `image`; they load when an arrow is first pressed. Named `cards` unless `name` says otherwise.
|
|
22
23
|
*/
|
|
23
24
|
cards: (fields, o = {}) => ({
|
|
24
25
|
kind: "cards",
|
|
@@ -30,7 +31,8 @@ const displays = {
|
|
|
30
31
|
...fields.badge && { badge: fields.badge.name },
|
|
31
32
|
...fields.meta && { meta: fields.meta.map((ref) => ref.name) },
|
|
32
33
|
...fields.flags && { flags: fields.flags.map((ref) => ref.name) },
|
|
33
|
-
...o.card && { card: customComponent(o.card, "d.cards card") }
|
|
34
|
+
...o.card && { card: customComponent(o.card, "d.cards card") },
|
|
35
|
+
...o.photos && { photos: { ...o.photos } }
|
|
34
36
|
}),
|
|
35
37
|
/**
|
|
36
38
|
* The list drawn by a component of the project, registered in `protobase.ui.tsx` under its name. It gets `props` and
|
package/dist/view-widgets.d.ts
CHANGED
|
@@ -12,5 +12,12 @@ export declare const widgets: {
|
|
|
12
12
|
presets?: DatePreset[];
|
|
13
13
|
}) => FilterWidgetModel;
|
|
14
14
|
toggle: (ref: Ref) => FilterWidgetModel;
|
|
15
|
+
/**
|
|
16
|
+
* A menu of boolean fields under one `label`, such as "for sale" and "for rent": a record shows when any chosen field
|
|
17
|
+
* is true, so one that is both shows under each.
|
|
18
|
+
*/
|
|
19
|
+
flags: (refs: Ref<string, boolean | null>[], o: {
|
|
20
|
+
label: string;
|
|
21
|
+
}) => FilterWidgetModel;
|
|
15
22
|
};
|
|
16
23
|
//#endregion
|
package/dist/view-widgets.js
CHANGED
|
@@ -18,6 +18,15 @@ const widgets = {
|
|
|
18
18
|
toggle: (ref) => ({
|
|
19
19
|
kind: "toggle",
|
|
20
20
|
field: ref.name
|
|
21
|
+
}),
|
|
22
|
+
/**
|
|
23
|
+
* A menu of boolean fields under one `label`, such as "for sale" and "for rent": a record shows when any chosen field
|
|
24
|
+
* is true, so one that is both shows under each.
|
|
25
|
+
*/
|
|
26
|
+
flags: (refs, o) => ({
|
|
27
|
+
kind: "flags",
|
|
28
|
+
fields: refs.map((ref) => ref.name),
|
|
29
|
+
label: o.label
|
|
21
30
|
})
|
|
22
31
|
};
|
|
23
32
|
//#endregion
|