@protobase/ui 0.19.11 → 0.19.12
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/record-page.js +21 -30
- package/dist/package.js +1 -1
- package/dist/record-view/record-header.js +50 -44
- package/dist/shell/assets/app-CGERExLJ.js +69 -0
- package/dist/shell/assets/{index-C15EeI8X.js → index-Cw_3EJp-.js} +1 -1
- package/dist/shell/assets/{index-DxV5Rp_F.css → index-Dbt3yBEP.css} +1 -1
- package/dist/shell/assets/{maplibre-CqK5gKEr.js → maplibre-DfaBCAzg.js} +1 -1
- package/dist/shell/assets/{markdown-content-DS62HyvW.js → markdown-content-COc571bl.js} +1 -1
- package/dist/shell/assets/{record-map-Cp9MkzTk.js → record-map-ChfoXEsT.js} +1 -1
- package/dist/shell/assets/{records-map-BQm4s9Cw.js → records-map-CAw0zACV.js} +1 -1
- package/dist/shell/assets/{shared-protobase-ui-Cqe5I8UQ.js → shared-protobase-ui-BSdpZAbP.js} +1 -1
- package/dist/shell/index.html +4 -4
- package/dist/shell/protobase.shell.json +1 -1
- package/package.json +4 -4
- package/dist/shell/assets/app-DQRL4UH0.js +0 -69
package/dist/app/record-page.js
CHANGED
|
@@ -104,7 +104,6 @@ const LoadedRecord = ({ model, recordKey, stored }) => {
|
|
|
104
104
|
const { basePath } = useRouter();
|
|
105
105
|
const { address, go, open } = useAppAddress();
|
|
106
106
|
const view = meta.views[model.name];
|
|
107
|
-
const singular = view?.names?.singular ?? humanize(model.name);
|
|
108
107
|
const title = recordTitle(model, view, stored.record, recordKey);
|
|
109
108
|
const { state: auth } = useAuth();
|
|
110
109
|
const linesModel = useMemo(() => findLinesResource(meta.resources, model), [meta.resources, model]);
|
|
@@ -153,7 +152,7 @@ const LoadedRecord = ({ model, recordKey, stored }) => {
|
|
|
153
152
|
const sidebarFields = layout.flatMap((item) => item.kind === "sidebar" ? item.fields : []);
|
|
154
153
|
const hasStatus = model.fields.status?.type === "enum";
|
|
155
154
|
const statusValue = stored.record.status;
|
|
156
|
-
const status = hasStatus && statusValue !== null && statusValue !== void 0 && statusValue !== "" ? String(statusValue) : void 0;
|
|
155
|
+
const status = hasStatus && !sidebarFields.includes("status") && statusValue !== null && statusValue !== void 0 && statusValue !== "" ? String(statusValue) : void 0;
|
|
157
156
|
const updatedAt = auditField(model, "updated");
|
|
158
157
|
const hint = (name) => view?.fields[name];
|
|
159
158
|
const visible = (name) => fieldAccess(stored.permissions, name) !== "hidden";
|
|
@@ -264,29 +263,23 @@ const LoadedRecord = ({ model, recordKey, stored }) => {
|
|
|
264
263
|
snapshot: stored.record
|
|
265
264
|
}) : void 0;
|
|
266
265
|
const formControls = shown === "form" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
267
|
-
editor.dirty && /* @__PURE__ */ jsx("span", {
|
|
268
|
-
className: "text-xs text-muted-foreground",
|
|
269
|
-
children: "Unsaved changes"
|
|
270
|
-
}),
|
|
271
|
-
editor.dirty && !leavesForm && /* @__PURE__ */ jsx(Button, {
|
|
272
|
-
className: "max-md:min-h-11",
|
|
273
|
-
disabled: editor.saving,
|
|
274
|
-
onClick: editor.discard,
|
|
275
|
-
children: "Discard"
|
|
276
|
-
}),
|
|
277
|
-
leavesForm && /* @__PURE__ */ jsx(AppLink, {
|
|
278
|
-
to: readAddress,
|
|
279
|
-
className: cn(buttonClass(), "max-md:min-h-11"),
|
|
280
|
-
onClick: (event) => inApp(event) && editor.discard(),
|
|
281
|
-
children: "Cancel"
|
|
282
|
-
}),
|
|
283
266
|
/* @__PURE__ */ jsxs(Button, {
|
|
284
267
|
variant: "primary",
|
|
285
|
-
className: "max-md:min-h-11 max-md:flex-1",
|
|
268
|
+
className: "max-md:min-h-11 max-md:flex-1 md:w-full",
|
|
286
269
|
loading: editor.saving,
|
|
287
270
|
disabled: !editor.dirty && editor.phase !== "saved",
|
|
288
271
|
onClick: () => void save(),
|
|
289
272
|
children: [editor.phase === "saved" && /* @__PURE__ */ jsx(Check, { className: "size-4" }), editor.phase === "saved" ? "Saved" : "Save"]
|
|
273
|
+
}),
|
|
274
|
+
leavesForm && /* @__PURE__ */ jsx(AppLink, {
|
|
275
|
+
to: readAddress,
|
|
276
|
+
className: cn(buttonClass(), "max-md:min-h-11 md:w-full"),
|
|
277
|
+
onClick: (event) => inApp(event) && editor.discard(),
|
|
278
|
+
children: "Cancel"
|
|
279
|
+
}),
|
|
280
|
+
editor.dirty && /* @__PURE__ */ jsx("span", {
|
|
281
|
+
className: "text-xs text-muted-foreground max-md:order-first",
|
|
282
|
+
children: "Unsaved changes"
|
|
290
283
|
})
|
|
291
284
|
] });
|
|
292
285
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -300,17 +293,11 @@ const LoadedRecord = ({ model, recordKey, stored }) => {
|
|
|
300
293
|
children: [
|
|
301
294
|
/* @__PURE__ */ jsx(RecordHeader, {
|
|
302
295
|
title,
|
|
296
|
+
titleHidden: true,
|
|
303
297
|
status: status ? {
|
|
304
298
|
label: enumLabel(status, hint("status")?.valueLabels),
|
|
305
299
|
tone: toneFor(status)
|
|
306
|
-
} :
|
|
307
|
-
label: singular,
|
|
308
|
-
tone: "neutral"
|
|
309
|
-
},
|
|
310
|
-
actions: /* @__PURE__ */ jsx("div", {
|
|
311
|
-
className: "hidden items-center gap-4 md:flex",
|
|
312
|
-
children: formControls
|
|
313
|
-
})
|
|
300
|
+
} : void 0
|
|
314
301
|
}),
|
|
315
302
|
editor.message && /* @__PURE__ */ jsx("div", {
|
|
316
303
|
className: "mt-4",
|
|
@@ -323,7 +310,7 @@ const LoadedRecord = ({ model, recordKey, stored }) => {
|
|
|
323
310
|
className: "mt-4",
|
|
324
311
|
children: /* @__PURE__ */ jsx(ErrorBanner, {
|
|
325
312
|
title: "The lines were changed by someone else",
|
|
326
|
-
error: /* @__PURE__ */ new Error("The lines were reloaded. Your new order is kept: Save again to apply it
|
|
313
|
+
error: /* @__PURE__ */ new Error("The lines were reloaded. Your new order is kept: Save again to apply it.")
|
|
327
314
|
})
|
|
328
315
|
}),
|
|
329
316
|
shown !== "form" && offersEdit && editor.dirty && /* @__PURE__ */ jsxs("div", {
|
|
@@ -361,7 +348,7 @@ const LoadedRecord = ({ model, recordKey, stored }) => {
|
|
|
361
348
|
/* @__PURE__ */ jsxs("div", {
|
|
362
349
|
className: "grid grid-cols-1 gap-8 md:grid-cols-[minmax(0,1fr)_300px] md:gap-12",
|
|
363
350
|
children: [/* @__PURE__ */ jsxs("main", {
|
|
364
|
-
className: "divide-y divide-border",
|
|
351
|
+
className: cn("divide-y divide-border", !status && "*:first:pt-0!"),
|
|
365
352
|
children: [layout.flatMap((item, index) => {
|
|
366
353
|
if (item.kind === "related") return [/* @__PURE__ */ jsx(RelatedSection, {
|
|
367
354
|
item,
|
|
@@ -406,8 +393,12 @@ const LoadedRecord = ({ model, recordKey, stored }) => {
|
|
|
406
393
|
locked: shown !== "form"
|
|
407
394
|
})]
|
|
408
395
|
}), /* @__PURE__ */ jsxs("aside", {
|
|
409
|
-
className: "space-y-4 md:pt-8",
|
|
396
|
+
className: cn("space-y-4", status && "md:pt-8"),
|
|
410
397
|
children: [
|
|
398
|
+
formControls && /* @__PURE__ */ jsx("div", {
|
|
399
|
+
className: "hidden flex-col items-center gap-2 md:flex",
|
|
400
|
+
children: formControls
|
|
401
|
+
}),
|
|
411
402
|
/* @__PURE__ */ jsx(RecordActions, {
|
|
412
403
|
model,
|
|
413
404
|
stored,
|
package/dist/package.js
CHANGED
|
@@ -2,49 +2,55 @@ import { AvatarStack } from "../primitives/avatar.js";
|
|
|
2
2
|
import { Badge } from "../primitives/badge.js";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/record-view/record-header.tsx
|
|
5
|
-
const RecordHeader = ({ collection, title, status, lastEditedBy, presence = [], actions }) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/* @__PURE__ */ jsxs("div", {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
children:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
5
|
+
const RecordHeader = ({ collection, title, titleHidden, status, lastEditedBy, presence = [], actions }) => {
|
|
6
|
+
if (titleHidden && !collection && !status && !lastEditedBy && presence.length === 0 && !actions) return /* @__PURE__ */ jsx("h1", {
|
|
7
|
+
className: "sr-only",
|
|
8
|
+
children: title
|
|
9
|
+
});
|
|
10
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
11
|
+
className: "flex flex-col gap-4 border-b border-border pb-6 md:flex-row md:items-end md:justify-between md:gap-6",
|
|
12
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
13
|
+
collection && /* @__PURE__ */ jsx("p", {
|
|
14
|
+
className: "mb-1 text-xs text-muted-foreground",
|
|
15
|
+
children: collection
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-1",
|
|
19
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
20
|
+
className: titleHidden ? "sr-only" : "text-xl font-semibold tracking-tight text-foreground md:text-2xl",
|
|
21
|
+
children: title
|
|
22
|
+
}), status && /* @__PURE__ */ jsx(Badge, {
|
|
23
|
+
tone: status.tone,
|
|
24
|
+
children: status.label
|
|
25
|
+
})]
|
|
26
|
+
}),
|
|
27
|
+
lastEditedBy && /* @__PURE__ */ jsx("p", {
|
|
28
|
+
className: "mt-1.5 text-xs text-muted-foreground",
|
|
29
|
+
children: lastEditedBy.name ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
"Last edited by ",
|
|
31
|
+
/* @__PURE__ */ jsx("span", {
|
|
32
|
+
className: "font-medium text-foreground",
|
|
33
|
+
children: lastEditedBy.name
|
|
34
|
+
}),
|
|
35
|
+
" ",
|
|
36
|
+
lastEditedBy.ago
|
|
37
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: ["Last updated ", lastEditedBy.ago] })
|
|
38
|
+
})
|
|
39
|
+
] }), /* @__PURE__ */ jsxs("div", {
|
|
40
|
+
className: "flex items-center gap-4",
|
|
41
|
+
children: [presence.length > 0 && /* @__PURE__ */ jsxs("span", {
|
|
42
|
+
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(AvatarStack, {
|
|
45
|
+
people: presence,
|
|
46
|
+
size: "md"
|
|
47
|
+
}),
|
|
48
|
+
presence.length,
|
|
49
|
+
" viewing"
|
|
50
|
+
]
|
|
51
|
+
}), actions]
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
49
55
|
//#endregion
|
|
50
56
|
export { RecordHeader };
|