@protobase/schema 0.55.2 → 0.55.3
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/model.d.ts +8 -0
- package/dist/view.d.ts +2 -1
- package/dist/view.js +3 -1
- package/package.json +1 -1
package/dist/model.d.ts
CHANGED
|
@@ -1135,6 +1135,14 @@ export type NavModel = {
|
|
|
1135
1135
|
* filter and the recent records' filter as `tenantField = "<tenant>"`, which the person can clear or change.
|
|
1136
1136
|
*/
|
|
1137
1137
|
tenant?: 'current';
|
|
1138
|
+
/**
|
|
1139
|
+
* A link under the entry to the resource's create form (its create page when the view has one), for whoever may
|
|
1140
|
+
* create; `true` reads "New <singular>", `{ label }` its own text.
|
|
1141
|
+
*/
|
|
1142
|
+
create?: true | {
|
|
1143
|
+
/** The link's text, in place of "New <singular>". */
|
|
1144
|
+
label: string;
|
|
1145
|
+
};
|
|
1138
1146
|
};
|
|
1139
1147
|
/** An entry in the menu under the signed-in user, at the bottom of the sidebar. */
|
|
1140
1148
|
export type UserMenuItemModel = {
|
package/dist/view.d.ts
CHANGED
|
@@ -74,7 +74,8 @@ export declare class ViewBuilder<R extends {
|
|
|
74
74
|
/**
|
|
75
75
|
* Where the resource sits in the sidebar; `recent` lists a few of its records under the entry (see
|
|
76
76
|
* [Sidebar](website/src/content/docs/reference/sidebar.md#recent-records)), and `tenant: 'current'` opens it on the
|
|
77
|
-
* caller's own tenant (see [The current organization](website/src/content/docs/reference/sidebar.md#the-current-organization))
|
|
77
|
+
* caller's own tenant (see [The current organization](website/src/content/docs/reference/sidebar.md#the-current-organization)),
|
|
78
|
+
* and `create` links to the create form under it (see [Create link](website/src/content/docs/reference/sidebar.md#create-link)).
|
|
78
79
|
*/
|
|
79
80
|
nav(nav: NavInput<R>): ViewBuilder<R>;
|
|
80
81
|
/** A line under the list's title. */
|
package/dist/view.js
CHANGED
|
@@ -86,7 +86,8 @@ var ViewBuilder = class ViewBuilder {
|
|
|
86
86
|
/**
|
|
87
87
|
* Where the resource sits in the sidebar; `recent` lists a few of its records under the entry (see
|
|
88
88
|
* [Sidebar](website/src/content/docs/reference/sidebar.md#recent-records)), and `tenant: 'current'` opens it on the
|
|
89
|
-
* caller's own tenant (see [The current organization](website/src/content/docs/reference/sidebar.md#the-current-organization))
|
|
89
|
+
* caller's own tenant (see [The current organization](website/src/content/docs/reference/sidebar.md#the-current-organization)),
|
|
90
|
+
* and `create` links to the create form under it (see [Create link](website/src/content/docs/reference/sidebar.md#create-link)).
|
|
90
91
|
*/
|
|
91
92
|
nav(nav) {
|
|
92
93
|
return this.next({ nav });
|
|
@@ -354,6 +355,7 @@ var ViewBuilder = class ViewBuilder {
|
|
|
354
355
|
if (nav?.tenant === "current" && !list) throw new Error(`View "${this.state.resource}": nav.tenant narrows the opening filter of the list, so the view needs .list(...)`);
|
|
355
356
|
const tenantField = resource?.tenant === void 0 ? void 0 : resource.fields[resource.tenant];
|
|
356
357
|
if (resource && nav?.tenant === "current" && !tenantField?.filterable) throw new Error(`View "${this.state.resource}": nav.tenant opens the list on the current tenant, so the resource needs .tenant() on a .filterable() field`);
|
|
358
|
+
if (typeof nav?.create === "object" && nav.create.label.trim() === "") throw new Error(`View "${this.state.resource}": nav.create needs a label, or true for "New <singular>"`);
|
|
357
359
|
const recentErrors = resource && nav?.recent ? navRecentErrors(nav.recent, resource) : [];
|
|
358
360
|
if (recentErrors.length > 0) throw new Error(`View "${this.state.resource}": nav.recent ${recentErrors.join("; ")}`);
|
|
359
361
|
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`);
|