@protobase/ui 0.55.5 → 0.55.6
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/app/current-address.d.ts +1 -0
- package/dist/app/current-address.js +2 -1
- package/dist/app/full-area-record.js +33 -0
- package/dist/app/record-page.js +25 -3
- package/dist/package.js +1 -1
- package/dist/shell/assets/app-Co8P2yd_.js +9 -0
- package/dist/shell/assets/index-mZM1MZhj.css +2 -0
- package/dist/shell/assets/{index-BPJWloi_.js → index-s_7wHErR.js} +2 -2
- package/dist/shell/assets/{records-map-BN8vvmFn.js → records-map-CB1CggIx.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-DkshFYfA.js → shared-protobase-ui-MiSbBekN.js} +2 -2
- package/dist/shell/index.html +4 -4
- package/dist/shell/protobase.shell.json +1 -1
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/app-Co8P2yd_.js.map +1 -0
- package/dist/shell-source-maps/assets/{index-BPJWloi_.js.map → index-s_7wHErR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-BN8vvmFn.js.map → records-map-CB1CggIx.js.map} +1 -1
- package/dist/shell-source-maps/assets/{shared-protobase-ui-DkshFYfA.js.map → shared-protobase-ui-MiSbBekN.js.map} +1 -1
- package/package.json +4 -4
- package/dist/shell/assets/app-CGJ1DQ5X.js +0 -9
- package/dist/shell/assets/index-CuWdbv0k.css +0 -2
- package/dist/shell-source-maps/assets/app-CGJ1DQ5X.js.map +0 -1
|
@@ -36,7 +36,8 @@ const currentAddress = (read, defaults) => {
|
|
|
36
36
|
key: encodeKey(read.key),
|
|
37
37
|
...read.edit && { edit: true },
|
|
38
38
|
...read.open && { open: read.open },
|
|
39
|
-
...read.tab && { tab: read.tab }
|
|
39
|
+
...read.tab && { tab: read.tab },
|
|
40
|
+
...read.standard && { standard: true }
|
|
40
41
|
};
|
|
41
42
|
if (read?.kind !== "list") return read;
|
|
42
43
|
return {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useProjectUi } from "./pages/project-ui.js";
|
|
2
|
+
import { CustomBoundary } from "./pages/custom-boundary.js";
|
|
3
|
+
import { RecordScope } from "./pages/record-scope.js";
|
|
4
|
+
import { usePageScroll } from "../app-shell/page-scroll.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/app/full-area-record.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A record page that is a component of the app's own (`.record({ component })`), with the record around it as
|
|
9
|
+
* `useLayoutRecord()` gives it. It fills the content area, which does not scroll while it shows; `standard`, the
|
|
10
|
+
* record's standard page, shows instead while the component is missing or when it throws.
|
|
11
|
+
*/
|
|
12
|
+
const FullAreaRecord = ({ component, scope, standard }) => {
|
|
13
|
+
const { components } = useProjectUi();
|
|
14
|
+
const Component = components?.[component];
|
|
15
|
+
if (!Component) return standard;
|
|
16
|
+
return /* @__PURE__ */ jsx(CustomBoundary, {
|
|
17
|
+
name: component,
|
|
18
|
+
fallback: standard,
|
|
19
|
+
children: /* @__PURE__ */ jsx(FullArea, { children: /* @__PURE__ */ jsx(RecordScope, {
|
|
20
|
+
value: scope,
|
|
21
|
+
children: /* @__PURE__ */ jsx(Component, {})
|
|
22
|
+
}) })
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const FullArea = ({ children }) => {
|
|
26
|
+
usePageScroll(false);
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: "grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] grid-rows-[minmax(0,1fr)]",
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { FullAreaRecord };
|
package/dist/app/record-page.js
CHANGED
|
@@ -47,6 +47,7 @@ import { useDeleteFlow } from "./delete/use-delete-flow.js";
|
|
|
47
47
|
import { useRestore } from "./delete/use-restore.js";
|
|
48
48
|
import { auditField } from "../live/audit-fields.js";
|
|
49
49
|
import { CustomSection } from "./custom-section.js";
|
|
50
|
+
import { FullAreaRecord } from "./full-area-record.js";
|
|
50
51
|
import { MapSection } from "./map/map-section.js";
|
|
51
52
|
import { RecordChartSection } from "./record-chart/record-chart-section.js";
|
|
52
53
|
import { RecordActions } from "./pages/record-actions.js";
|
|
@@ -101,7 +102,8 @@ const layoutFor = (model, view, read) => {
|
|
|
101
102
|
];
|
|
102
103
|
};
|
|
103
104
|
const RecordPage = ({ resource, recordKey }) => {
|
|
104
|
-
const { resources } = useAdminMeta();
|
|
105
|
+
const { resources, views } = useAdminMeta();
|
|
106
|
+
const { address } = useAppAddress();
|
|
105
107
|
const model = resources[resource];
|
|
106
108
|
const record = useOpenedRecord(resource, recordKey);
|
|
107
109
|
if (!model) return /* @__PURE__ */ jsx(Notice, {
|
|
@@ -122,12 +124,30 @@ const RecordPage = ({ resource, recordKey }) => {
|
|
|
122
124
|
error: record.error
|
|
123
125
|
})
|
|
124
126
|
});
|
|
125
|
-
|
|
127
|
+
const standard = /* @__PURE__ */ jsx(LoadedRecord, {
|
|
126
128
|
model,
|
|
127
129
|
recordKey,
|
|
128
130
|
stored: record.data,
|
|
129
131
|
preview: record.isPlaceholderData
|
|
130
132
|
}, record.isPlaceholderData ? "preview" : "loaded");
|
|
133
|
+
const fullArea = views[resource]?.record;
|
|
134
|
+
if (!fullArea || address?.kind === "record" && address.standard) return standard;
|
|
135
|
+
if (record.isPlaceholderData) return /* @__PURE__ */ jsx(Notice, {
|
|
136
|
+
title: text$1("loading"),
|
|
137
|
+
children: text$1("fetching")
|
|
138
|
+
});
|
|
139
|
+
const { record: fields, etag, permissions } = record.data;
|
|
140
|
+
return /* @__PURE__ */ jsx(FullAreaRecord, {
|
|
141
|
+
component: fullArea.component,
|
|
142
|
+
scope: {
|
|
143
|
+
model,
|
|
144
|
+
record: fields,
|
|
145
|
+
key: recordKey,
|
|
146
|
+
etag,
|
|
147
|
+
permissions
|
|
148
|
+
},
|
|
149
|
+
standard
|
|
150
|
+
});
|
|
131
151
|
};
|
|
132
152
|
const RecordNotFound = ({ model, recordKey }) => {
|
|
133
153
|
const elsewhere = useRecordElsewhere(model, recordKey);
|
|
@@ -178,13 +198,15 @@ const LoadedRecord = ({ model, recordKey, stored, preview }) => {
|
|
|
178
198
|
const openGroups = address?.kind === "record" ? address.open : void 0;
|
|
179
199
|
const atEdit = address?.kind === "record" && address.edit === true;
|
|
180
200
|
const addressedTab = address?.kind === "record" ? address.tab : void 0;
|
|
201
|
+
const standard = address?.kind === "record" && address.standard === true;
|
|
181
202
|
const recordAt = (open = [], edit = false, tab) => ({
|
|
182
203
|
kind: "record",
|
|
183
204
|
resource: model.name,
|
|
184
205
|
key: recordKey,
|
|
185
206
|
...edit && { edit },
|
|
186
207
|
...open.length > 0 && { open },
|
|
187
|
-
...tab && { tab }
|
|
208
|
+
...tab && { tab },
|
|
209
|
+
...standard && { standard }
|
|
188
210
|
});
|
|
189
211
|
const readAddress = recordAt(openGroups, false, addressedTab);
|
|
190
212
|
const editAddress = recordAt(openGroups, true, addressedTab);
|
package/dist/package.js
CHANGED