@protobase/schema 0.19.16 → 0.20.0
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/internal.d.ts +2 -1
- package/dist/internal.js +2 -1
- package/dist/model.d.ts +17 -2
- package/dist/view-chart.d.ts +32 -0
- package/dist/view-chart.js +29 -0
- package/dist/view.d.ts +8 -7
- package/dist/view.js +7 -7
- package/package.json +1 -1
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 { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CompareOp, CreateModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, 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, RelatedColumnModel, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
|
|
2
|
+
import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CompareOp, CreateModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, GalleryModel, GroupChartModel, HelpWhen, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NavModel, NavRecentModel, NowValue, OrderByItem, PeriodChartModel, RecordMode, RelatedColumnModel, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionPresentation, ShowWhen, 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";
|
|
@@ -9,6 +9,7 @@ import { FieldRefs, FieldsInput, Ref, Refs } from "./refs.js";
|
|
|
9
9
|
import { CreatedOptions, DeletedOptions, EventActor, EventContext, EventHelpers, EventMatch, EventSpec, UndeletedOptions, UpdatedOptions } from "./events/event-helpers.js";
|
|
10
10
|
import { Access, InferRecord, Issue, KeyOf, KeyRefs, RecordKey, RecordOf } from "./resource-types.js";
|
|
11
11
|
import { ResourceBuilder, SearchRef, SearchRefs, Validator, resource } from "./resource.js";
|
|
12
|
+
import { ChartInput, GroupChartInput, PeriodChartInput } from "./view-chart.js";
|
|
12
13
|
import { ListColumn } from "./view-columns.js";
|
|
13
14
|
import { ComponentRef, ViewProps } from "./view-displays.js";
|
|
14
15
|
import { FieldView } from "./view-field.js";
|
|
@@ -38,4 +39,4 @@ import { AccessSource, ResolveOptions, ResolvedAccess, RowFilterOperation, acces
|
|
|
38
39
|
import { restrictModel } from "./access/restrict.js";
|
|
39
40
|
import "./access/index.js";
|
|
40
41
|
import { AssistantAction, AssistantActionRequest, AssistantCardPart, AssistantDiff, AssistantEvent, AssistantMessage, AssistantMessageRequest, AssistantPart, AssistantState, AssistantStep, AssistantStepState, AssistantTablePart, AssistantTextPart, AssistantTone, AssistantWidgetPart } from "./assistant/protocol.js";
|
|
41
|
-
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 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 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 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 ListColumn, 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 RelatedColumnModel, 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 ShowWhen, 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, fitsKeyType, imageFormats, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
|
|
42
|
+
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 Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, 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 GalleryModel, type Grant, type GroupChartInput, type GroupChartModel, 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 ListColumn, 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 PeriodChartInput, type PeriodChartModel, type RecordKey, type RecordMode, type RecordOf, 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 RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SectionPresentation, type ShowWhen, 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, fitsKeyType, 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/internal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { checkedAccept, checkedProvider, parseSize } from "./files/file-options.js";
|
|
2
2
|
import { actionInputErrors, shownInputs } from "./action-inputs.js";
|
|
3
|
+
import { chartFields, isGroupChart } from "./view-chart.js";
|
|
3
4
|
import { boardErrors, cardPhotoLimit, displayFields, tableDisplay } from "./view-displays.js";
|
|
4
5
|
import { fieldRefsIn, isFieldRef, markFieldRefs, unmarkFieldRefs } from "./field-ref.js";
|
|
5
6
|
import { bottomBarFor } from "./bottom-bar.js";
|
|
@@ -15,4 +16,4 @@ import { addressPlaceholders, appHrefError, fillAddress, hrefField, hrefPlacehol
|
|
|
15
16
|
import { AddressCheck, addressErrors } from "./address-errors.js";
|
|
16
17
|
import { applyAssistantEvent, emptyAssistantState } from "./assistant/apply-event.js";
|
|
17
18
|
import { readEventStream } from "./assistant/event-stream.js";
|
|
18
|
-
export { type AddressCheck, type PluginHost, type PluginRequirement, type PropShapes, type RefShape, type SearchTerm, actionInputErrors, addressErrors, addressPlaceholders, appHrefError, applyAssistantEvent, boardErrors, bottomBarFor, cardPhotoLimit, checkEventFilter, checkedAccept, checkedProvider, decodeKey, defaultRecentLimit, displayFields, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, hrefField, hrefPlaceholders, inRange, isFieldRef, leavesApp, linkActionError, markFieldRefs, matchedSearchField, matchesSearch, navRecentErrors, parseSize, pluginProblem, pruneByShape, readEventStream, redactSecrets, searchTerms, shapes, shownInputs, statusTones, tableDisplay, termMatches, unmarkFieldRefs, webhookResources };
|
|
19
|
+
export { type AddressCheck, type PluginHost, type PluginRequirement, type PropShapes, type RefShape, type SearchTerm, actionInputErrors, addressErrors, addressPlaceholders, appHrefError, applyAssistantEvent, boardErrors, bottomBarFor, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, decodeKey, defaultRecentLimit, displayFields, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, hrefField, hrefPlaceholders, inRange, isFieldRef, isGroupChart, leavesApp, linkActionError, markFieldRefs, matchedSearchField, matchesSearch, navRecentErrors, parseSize, pluginProblem, pruneByShape, readEventStream, redactSecrets, searchTerms, shapes, shownInputs, statusTones, tableDisplay, termMatches, unmarkFieldRefs, webhookResources };
|
package/dist/internal.js
CHANGED
|
@@ -4,6 +4,7 @@ import { checkEventFilter } from "./events/event-models.js";
|
|
|
4
4
|
import { defaultRecentLimit, navRecentErrors, statusTones } from "./nav-recent.js";
|
|
5
5
|
import { actionInputErrors, shownInputs } from "./action-inputs.js";
|
|
6
6
|
import { addressPlaceholders, appHrefError, fillAddress, hrefField, hrefPlaceholders, leavesApp, linkActionError } from "./address-template.js";
|
|
7
|
+
import { chartFields, isGroupChart } from "./view-chart.js";
|
|
7
8
|
import { fieldRefsIn, isFieldRef, markFieldRefs, unmarkFieldRefs } from "./field-ref.js";
|
|
8
9
|
import { boardErrors, cardPhotoLimit, displayFields, tableDisplay } from "./view-displays.js";
|
|
9
10
|
import { bottomBarFor } from "./bottom-bar.js";
|
|
@@ -15,4 +16,4 @@ import { redactSecrets } from "./redact-secrets.js";
|
|
|
15
16
|
import { addressErrors } from "./address-errors.js";
|
|
16
17
|
import { applyAssistantEvent, emptyAssistantState } from "./assistant/apply-event.js";
|
|
17
18
|
import { readEventStream } from "./assistant/event-stream.js";
|
|
18
|
-
export { actionInputErrors, addressErrors, addressPlaceholders, appHrefError, applyAssistantEvent, boardErrors, bottomBarFor, cardPhotoLimit, checkEventFilter, checkedAccept, checkedProvider, decodeKey, defaultRecentLimit, displayFields, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, hrefField, hrefPlaceholders, inRange, isFieldRef, leavesApp, linkActionError, markFieldRefs, matchedSearchField, matchesSearch, navRecentErrors, parseSize, pluginProblem, pruneByShape, readEventStream, redactSecrets, searchTerms, shapes, shownInputs, statusTones, tableDisplay, termMatches, unmarkFieldRefs, webhookResources };
|
|
19
|
+
export { actionInputErrors, addressErrors, addressPlaceholders, appHrefError, applyAssistantEvent, boardErrors, bottomBarFor, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, decodeKey, defaultRecentLimit, displayFields, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, hrefField, hrefPlaceholders, inRange, isFieldRef, isGroupChart, leavesApp, linkActionError, markFieldRefs, matchedSearchField, matchesSearch, navRecentErrors, parseSize, pluginProblem, pruneByShape, readEventStream, redactSecrets, searchTerms, shapes, shownInputs, statusTones, tableDisplay, termMatches, unmarkFieldRefs, webhookResources };
|
package/dist/model.d.ts
CHANGED
|
@@ -687,8 +687,8 @@ export type GalleryModel = {
|
|
|
687
687
|
export type ChartRange = '7d' | '30d' | '90d' | '1y' | 'all';
|
|
688
688
|
/** How long each bar of a list's chart is. */
|
|
689
689
|
export type ChartGranularity = 'hour' | 'day' | 'week' | 'month';
|
|
690
|
-
/** A chart of records over time above a list, following its filters (`.chart(...)`). */
|
|
691
|
-
export type
|
|
690
|
+
/** A chart of records over time above a list, following its filters (`.chart(...)` with `field`). */
|
|
691
|
+
export type PeriodChartModel = {
|
|
692
692
|
/** The date or timestamp field the records are counted by. */
|
|
693
693
|
field: string;
|
|
694
694
|
/** How far back it reaches. */
|
|
@@ -696,6 +696,21 @@ export type ChartModel = {
|
|
|
696
696
|
/** How long each bar is. */
|
|
697
697
|
granularity: ChartGranularity;
|
|
698
698
|
};
|
|
699
|
+
/** A chart of records per value of a field above a list, following its filters (`.chart(...)` with `groupBy`). */
|
|
700
|
+
export type GroupChartModel = {
|
|
701
|
+
/** The field whose values make the groups, such as a status or a relation; not a date. */
|
|
702
|
+
groupBy: string;
|
|
703
|
+
/** Bars, the largest first, or a donut. */
|
|
704
|
+
type: 'bar' | 'donut';
|
|
705
|
+
/** A numeric field each group adds up, instead of counting its records. */
|
|
706
|
+
sum?: string;
|
|
707
|
+
/** A numeric field each group averages, instead of counting its records. */
|
|
708
|
+
average?: string;
|
|
709
|
+
/** How many values it shows, the largest. */
|
|
710
|
+
limit: number;
|
|
711
|
+
};
|
|
712
|
+
/** The chart above a list: records over time, or records per value of a field. */
|
|
713
|
+
export type ChartModel = PeriodChartModel | GroupChartModel;
|
|
699
714
|
/**
|
|
700
715
|
* How the record page opens to a user who may change the record: `edit`, the default, as its form, ready to change;
|
|
701
716
|
* `read` as a read view of label/value tables, with an Edit button to the form; `locked` as the same form, locked until
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChartGranularity, ChartModel, ChartRange, GroupChartModel } from "./model.js";
|
|
2
|
+
import { Ref } from "./refs.js";
|
|
3
|
+
//#region src/view-chart.d.ts
|
|
4
|
+
/** Records per `granularity` over a date or timestamp `field`. */
|
|
5
|
+
export type PeriodChartInput = {
|
|
6
|
+
/** The date or timestamp field the records are counted by. */
|
|
7
|
+
field: Ref;
|
|
8
|
+
/** How far back it reaches. */
|
|
9
|
+
range: ChartRange;
|
|
10
|
+
/** How long each bar is. */
|
|
11
|
+
granularity: ChartGranularity;
|
|
12
|
+
};
|
|
13
|
+
/** Records per value of `groupBy`, counted, or with `sum` or `average` that of a numeric field. */
|
|
14
|
+
export type GroupChartInput = {
|
|
15
|
+
/** The field whose values make the groups, such as a status or a relation; not a date. */
|
|
16
|
+
groupBy: Ref;
|
|
17
|
+
/** Bars, the default, or a donut. */
|
|
18
|
+
type?: GroupChartModel['type'];
|
|
19
|
+
/** How many values it shows, the largest; default 10. */
|
|
20
|
+
limit?: number;
|
|
21
|
+
/** A numeric field each group adds up, instead of counting its records. */
|
|
22
|
+
sum?: Ref;
|
|
23
|
+
/** A numeric field each group averages, instead of counting its records. */
|
|
24
|
+
average?: Ref;
|
|
25
|
+
};
|
|
26
|
+
/** What `.chart(...)` takes: a chart over time or per value. */
|
|
27
|
+
export type ChartInput = PeriodChartInput | GroupChartInput;
|
|
28
|
+
/** Whether a list's chart counts records per value of a field rather than over time. */
|
|
29
|
+
export declare const isGroupChart: (chart: ChartModel) => chart is GroupChartModel;
|
|
30
|
+
/** The fields a list's chart reads: its date field, or the field it groups by and the one it adds up. */
|
|
31
|
+
export declare const chartFields: (chart: ChartModel) => string[];
|
|
32
|
+
//#endregion
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/view-chart.ts
|
|
2
|
+
const defaultLimit = 10;
|
|
3
|
+
const chartModel = (input) => {
|
|
4
|
+
if (!("groupBy" in input)) return {
|
|
5
|
+
field: input.field.name,
|
|
6
|
+
range: input.range,
|
|
7
|
+
granularity: input.granularity
|
|
8
|
+
};
|
|
9
|
+
if (input.sum && input.average) throw new Error("A chart takes sum or average, not both");
|
|
10
|
+
const limit = input.limit ?? defaultLimit;
|
|
11
|
+
if (!Number.isInteger(limit) || limit < 1) throw new Error(`A chart's limit must be a positive whole number, not ${limit}`);
|
|
12
|
+
return {
|
|
13
|
+
groupBy: input.groupBy.name,
|
|
14
|
+
type: input.type ?? "bar",
|
|
15
|
+
...input.sum && { sum: input.sum.name },
|
|
16
|
+
...input.average && { average: input.average.name },
|
|
17
|
+
limit
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/** Whether a list's chart counts records per value of a field rather than over time. */
|
|
21
|
+
const isGroupChart = (chart) => "groupBy" in chart;
|
|
22
|
+
/** The fields a list's chart reads: its date field, or the field it groups by and the one it adds up. */
|
|
23
|
+
const chartFields = (chart) => isGroupChart(chart) ? [
|
|
24
|
+
chart.groupBy,
|
|
25
|
+
...chart.sum ? [chart.sum] : [],
|
|
26
|
+
...chart.average ? [chart.average] : []
|
|
27
|
+
] : [chart.field];
|
|
28
|
+
//#endregion
|
|
29
|
+
export { chartFields, chartModel, isGroupChart };
|
package/dist/view.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ActionModel,
|
|
1
|
+
import { ActionModel, CreateModel, ExportModel, FilterWidgetModel, HelpWhen, LayoutItemModel, ListDisplayModel, 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
|
+
import { ChartInput } from "./view-chart.js";
|
|
4
5
|
import { ListColumn, columns } from "./view-columns.js";
|
|
5
6
|
import { displays } from "./view-displays.js";
|
|
6
7
|
import { FieldView } from "./view-field.js";
|
|
@@ -90,12 +91,12 @@ export declare class ViewBuilder<R extends {
|
|
|
90
91
|
* Without it the page shows one section with every field.
|
|
91
92
|
*/
|
|
92
93
|
layout(build: (r: FieldRefs<FieldsOf<R>>) => LayoutItemModel[]): ViewBuilder<R>;
|
|
93
|
-
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
/**
|
|
95
|
+
* A chart above the list, following its filters: records per `granularity` over a date or timestamp `field`, or
|
|
96
|
+
* records per value of `groupBy`, such as a status or a relation, as bars or a donut of the `limit` largest (default
|
|
97
|
+
* 10), counted or with `sum` or `average` that of a numeric field.
|
|
98
|
+
*/
|
|
99
|
+
chart(build: (r: FieldRefs<FieldsOf<R>>) => ChartInput): ViewBuilder<R>;
|
|
99
100
|
/**
|
|
100
101
|
* How the record page opens to a user who may change the record: `edit`, the default, as its form; `read` as a read
|
|
101
102
|
* view, its sections as tables of labels and values, with an Edit button to the form; `locked` as the form, locked
|
package/dist/view.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createRefs, ref } from "./refs.js";
|
|
|
2
2
|
import { isMenuHref } from "./menu-href.js";
|
|
3
3
|
import { navRecentErrors } from "./nav-recent.js";
|
|
4
4
|
import { actions } from "./view-actions.js";
|
|
5
|
+
import { chartModel } from "./view-chart.js";
|
|
5
6
|
import { columns, isListColumn } from "./view-columns.js";
|
|
6
7
|
import { boardErrors, displayErrors, displayFields, displays } from "./view-displays.js";
|
|
7
8
|
import { FieldView } from "./view-field.js";
|
|
@@ -114,14 +115,13 @@ var ViewBuilder = class ViewBuilder {
|
|
|
114
115
|
layout(build) {
|
|
115
116
|
return this.next({ layout: build(this.refs()) });
|
|
116
117
|
}
|
|
117
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* A chart above the list, following its filters: records per `granularity` over a date or timestamp `field`, or
|
|
120
|
+
* records per value of `groupBy`, such as a status or a relation, as bars or a donut of the `limit` largest (default
|
|
121
|
+
* 10), counted or with `sum` or `average` that of a numeric field.
|
|
122
|
+
*/
|
|
118
123
|
chart(build) {
|
|
119
|
-
|
|
120
|
-
return this.next({ chart: {
|
|
121
|
-
field: field.name,
|
|
122
|
-
range,
|
|
123
|
-
granularity
|
|
124
|
-
} });
|
|
124
|
+
return this.next({ chart: chartModel(build(this.refs())) });
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* How the record page opens to a user who may change the record: `edit`, the default, as its form; `read` as a read
|