@protobase/ui 0.46.3 → 0.46.4
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/account/account-page.js +50 -0
- package/dist/account/account-pages.js +24 -9
- package/dist/account/account-tree.js +18 -0
- package/dist/account/blocks/account-loading.js +19 -0
- package/dist/account/blocks/connected-accounts-block.js +37 -0
- package/dist/account/blocks/connected-apps-block.js +21 -0
- package/dist/account/blocks/devices-block.js +23 -0
- package/dist/account/blocks/passkeys-block.js +25 -0
- package/dist/account/blocks/password-block.js +27 -0
- package/dist/account/blocks/profile-block.js +28 -0
- package/dist/account/blocks/two-factor-block.js +29 -0
- package/dist/account/blocks/use-account-data.js +24 -0
- package/dist/account/change-email-dialog.js +98 -0
- package/dist/account/connected-apps-section.js +4 -4
- package/dist/account/device-name.js +26 -0
- package/dist/account/devices-section.js +119 -0
- package/dist/account/messages.js +94 -2
- package/dist/account/passkeys-section.js +4 -4
- package/dist/account/password-change-dialog.js +119 -0
- package/dist/account/password-dialog.js +2 -2
- package/dist/account/password-section.js +51 -0
- package/dist/account/profile-section.js +107 -0
- package/dist/account/sign-in-policy-form.js +1 -1
- package/dist/account/sign-in-policy-page.js +1 -1
- package/dist/account/sign-in-providers-section.js +2 -2
- package/dist/account/staff-sign-in-log.js +1 -1
- package/dist/account/two-factor-section.js +1 -1
- package/dist/account/two-factor-setup.js +2 -2
- package/dist/activity-chart/activity-chart.js +2 -2
- package/dist/app/app.js +39 -23
- package/dist/app/charts/chart-view.js +2 -2
- package/dist/app/comments/comment-composer.js +1 -1
- package/dist/app/comments/comments-section.js +3 -3
- package/dist/app/create/create-page.js +4 -4
- package/dist/app/current-address.d.ts +1 -0
- package/dist/app/custom-section.js +4 -4
- package/dist/app/delete/use-delete-flow.js +1 -1
- package/dist/app/displays/board-column.js +1 -1
- package/dist/app/displays/board-display.js +2 -2
- package/dist/app/displays/calendar-display.js +2 -2
- package/dist/app/displays/custom-display.js +3 -3
- package/dist/app/displays/display-controls.js +1 -1
- package/dist/app/displays/map-display.js +2 -2
- package/dist/app/displays/period-controls.js +1 -1
- package/dist/app/displays/record-card.js +2 -2
- package/dist/app/displays/timeline-display.js +2 -2
- package/dist/app/displays/use-calendar-move.js +1 -1
- package/dist/app/document-title.js +2 -2
- package/dist/app/embedded-list/embedded-display.js +1 -1
- package/dist/app/embedded-list/embedded-list.js +1 -1
- package/dist/app/export/export-dialog.js +2 -2
- package/dist/app/export/use-export-flow.js +1 -1
- package/dist/app/field-editor.js +2 -2
- package/dist/app/file-field.js +3 -3
- package/dist/app/gallery/gallery-section.js +2 -2
- package/dist/app/gallery/photo-details.js +1 -1
- package/dist/app/gallery/use-gallery-photos.js +1 -1
- package/dist/app/hand-order/hand-sorted-list.js +3 -3
- package/dist/app/history/history-section.js +2 -2
- package/dist/app/import/import-button.js +1 -1
- package/dist/app/import/import-check-step.js +1 -1
- package/dist/app/incoming-card.js +2 -2
- package/dist/app/list-group-chart.js +1 -1
- package/dist/app/list-page.js +6 -6
- package/dist/app/messages.js +0 -2
- package/dist/app/meta-gate.js +1 -1
- package/dist/app/nav-from-meta.js +1 -1
- package/dist/app/new-version/new-version-banner.js +1 -1
- package/dist/app/new-version/new-version-button.js +1 -1
- package/dist/app/new-version/new-version-toast.js +1 -1
- package/dist/app/pages/action-inputs/action-inputs-dialog.js +2 -2
- package/dist/app/pages/action-inputs/input-answers.js +1 -1
- package/dist/app/pages/blocks/card-row.js +2 -2
- package/dist/app/pages/blocks/field.js +1 -1
- package/dist/app/pages/blocks/form-draft.js +19 -0
- package/dist/app/pages/blocks/modal-form.js +10 -24
- package/dist/app/pages/blocks/page-block.js +1 -1
- package/dist/app/pages/blocks/record-card.js +2 -2
- package/dist/app/pages/blocks/settings.js +179 -0
- package/dist/app/pages/blocks/stat.js +2 -2
- package/dist/app/pages/blocks/tabs.js +59 -0
- package/dist/app/pages/composed-page.js +16 -3
- package/dist/app/pages/custom-boundary.js +1 -1
- package/dist/app/pages/field-value.js +1 -1
- package/dist/app/pages/messages.js +6 -0
- package/dist/app/pages/page-tabs.js +27 -0
- package/dist/app/pages/record-actions.js +2 -2
- package/dist/app/pages/render-node.js +22 -3
- package/dist/app/pages/use-run-action.js +1 -1
- package/dist/app/project-logo.js +2 -2
- package/dist/app/record-chart/record-chart-section.js +4 -4
- package/dist/app/record-page.js +12 -12
- package/dist/app/record-row/record-row-body.js +1 -1
- package/dist/app/record-row/saved-record-row.js +1 -1
- package/dist/app/related-cards/related-card.js +1 -1
- package/dist/app/related-dots/related-dots-columns.js +1 -1
- package/dist/app/related-section.js +2 -2
- package/dist/app/relation-picker.js +1 -1
- package/dist/app/router.js +2 -2
- package/dist/app/saved/saved-list.js +1 -1
- package/dist/app/search/use-global-search.js +1 -1
- package/dist/app/searches/save-search-button.js +1 -1
- package/dist/app/searches/saved-search-rows.js +1 -1
- package/dist/app/searches/saved-search-section.js +2 -2
- package/dist/app/searches/saved-searches.js +3 -3
- package/dist/app/searches/search-controls.js +2 -2
- package/dist/app/searches/search-name-dialog.js +1 -1
- package/dist/app/searches/update-search-dialog.js +2 -2
- package/dist/app/searches/use-save-search.js +1 -1
- package/dist/app/sensitive-field.js +2 -2
- package/dist/app/source-notice.js +1 -1
- package/dist/app/staff-banner.js +2 -2
- package/dist/app/use-app-address.js +2 -2
- package/dist/app/use-incoming-counts.js +1 -1
- package/dist/app-shell/app-shell.js +2 -1
- package/dist/app-shell/breadcrumb.js +1 -1
- package/dist/app-shell/drawer.js +1 -1
- package/dist/app-shell/global-search.js +1 -1
- package/dist/app-shell/profile-menu.js +27 -12
- package/dist/app-shell/sidebar.js +2 -1
- package/dist/assistant-dock/widget-view.js +1 -1
- package/dist/auth/auth-gate.js +2 -2
- package/dist/auth/auth-messages.js +2 -2
- package/dist/auth/auth-provider.js +4 -0
- package/dist/auth/code-form.js +1 -1
- package/dist/auth/email-code-form.js +1 -1
- package/dist/auth/email-code-page.js +1 -1
- package/dist/auth/forgot-password-form.js +4 -4
- package/dist/auth/provider-sign-in-page.js +2 -2
- package/dist/auth/reset-password-form.js +1 -1
- package/dist/auth/setup-required-form.js +1 -1
- package/dist/auth/setup-required-page.js +2 -2
- package/dist/auth/sign-in-form.js +2 -2
- package/dist/auth/sign-in-page.js +1 -1
- package/dist/auth/sign-in-prompt.js +2 -2
- package/dist/auth/sign-up-code-form.js +1 -1
- package/dist/auth/sign-up-details-form.js +2 -2
- package/dist/auth/sign-up-email-form.js +1 -1
- package/dist/auth/sign-up-page.js +1 -1
- package/dist/auth/staff-sign-in-form.js +2 -2
- package/dist/auth/staff-sign-in-page.js +1 -1
- package/dist/auth/two-factor-form.js +3 -3
- package/dist/auth/two-factor-page.js +1 -1
- package/dist/chat/composer.js +1 -1
- package/dist/connect/connect-page.js +4 -4
- package/dist/data/meta-data.d.ts +3 -1
- package/dist/data/use-meta.js +1 -0
- package/dist/data-grid/cell-text.js +1 -1
- package/dist/data-grid/cells.js +3 -3
- package/dist/data-grid/grid-header.js +1 -1
- package/dist/data-grid/grid-row.js +2 -2
- package/dist/data-grid/row-menu.js +1 -1
- package/dist/filter-panel/facet-group.js +1 -1
- package/dist/forms/public-form-page.js +5 -5
- package/dist/index.js +20 -20
- package/dist/inline-child-table/line-row.js +1 -1
- package/dist/inline-child-table/totals-footer.js +1 -1
- package/dist/invitations/invite-form.js +1 -1
- package/dist/lists/paged-search-list.js +1 -1
- package/dist/live/columns-from-model.js +1 -1
- package/dist/live/use-filter-config.js +1 -1
- package/dist/live/use-reference-search.js +1 -1
- package/dist/notifications/bell/notification-bell.js +1 -1
- package/dist/notifications/bell/notification-item.js +2 -2
- package/dist/organizations/all-organizations.js +1 -1
- package/dist/organizations/invitation-page.js +6 -6
- package/dist/organizations/invitations-page.js +3 -3
- package/dist/organizations/members-page.js +5 -5
- package/dist/organizations/organization-page.js +3 -3
- package/dist/organizations/organization-row.js +1 -1
- package/dist/organizations/organizations-page.js +3 -3
- package/dist/organizations/use-organizations.js +1 -1
- package/dist/package.js +1 -1
- package/dist/plugins/before-sign-in.js +1 -1
- package/dist/plugins/plugin-gate.js +1 -1
- package/dist/primitives/sheet.js +1 -1
- package/dist/record-view/field.js +2 -2
- package/dist/record-view/record-header.js +1 -1
- package/dist/record-view/record-tabs.js +1 -1
- package/dist/roles/use-active-role.js +1 -1
- package/dist/shell/assets/app-BS1C66SI.js +9 -0
- package/dist/shell/assets/index-DMB4DCM1.js +2 -0
- package/dist/shell/assets/index-zVvlyz9B.css +2 -0
- package/dist/shell/assets/{maplibre-BlwO7zTh.js → maplibre-CjNYwEqW.js} +3 -3
- package/dist/shell/assets/{preload-helper-C24C2MCK.js → preload-helper-SYSsmQ2O.js} +2 -2
- package/dist/shell/assets/{record-map-QajKJid1.js → record-map-DjqQGqZ2.js} +2 -2
- package/dist/shell/assets/{records-map-DybHhZlM.js → records-map-peII4mzy.js} +2 -2
- package/dist/shell/assets/shared-protobase-ui-CQQebf-J.js +2 -0
- package/dist/shell/assets/vendor-BzlIWwX2.js +63 -0
- package/dist/shell/index.html +6 -6
- package/dist/shell/protobase.shell.json +1 -1
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/app-BS1C66SI.js.map +1 -0
- package/dist/shell-source-maps/assets/{index-CY22munM.js.map → index-DMB4DCM1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-BlwO7zTh.js.map → maplibre-CjNYwEqW.js.map} +1 -1
- package/dist/shell-source-maps/assets/{preload-helper-C24C2MCK.js.map → preload-helper-SYSsmQ2O.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-QajKJid1.js.map → record-map-DjqQGqZ2.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-DybHhZlM.js.map → records-map-peII4mzy.js.map} +1 -1
- package/dist/shell-source-maps/assets/{shared-protobase-ui-TOG-RVkz.js.map → shared-protobase-ui-CQQebf-J.js.map} +1 -1
- package/dist/shell-source-maps/assets/vendor-BzlIWwX2.js.map +1 -0
- package/dist/side-panel/side-panel.js +1 -1
- package/dist/toasts/toast.js +1 -1
- package/dist/users/create-user-form.js +1 -1
- package/dist/users/use-user-roles.js +1 -1
- package/dist/users/user-row.js +1 -1
- package/package.json +4 -4
- package/dist/account/account-security-page.js +0 -97
- package/dist/shell/assets/app-BDvKMNNB.js +0 -9
- package/dist/shell/assets/index-CY22munM.js +0 -2
- package/dist/shell/assets/index-DHaeB8cs.css +0 -2
- package/dist/shell/assets/shared-protobase-ui-TOG-RVkz.js +0 -2
- package/dist/shell/assets/vendor-C4-Hop1T.js +0 -63
- package/dist/shell-source-maps/assets/app-BDvKMNNB.js.map +0 -1
- package/dist/shell-source-maps/assets/vendor-C4-Hop1T.js.map +0 -1
|
@@ -1,46 +1,32 @@
|
|
|
1
|
-
import { Button } from "../../../primitives/button.js";
|
|
2
|
-
import { Dialog } from "../../../primitives/dialog.js";
|
|
3
|
-
import { useNavigationGuard } from "../../router.js";
|
|
4
1
|
import { useClient } from "../../../data/api-provider.js";
|
|
5
2
|
import { useAdminMeta, usePermissions } from "../../meta-gate.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { Button } from "../../../primitives/button.js";
|
|
4
|
+
import { Dialog } from "../../../primitives/dialog.js";
|
|
8
5
|
import { useToast } from "../../../toasts/toast-provider.js";
|
|
9
6
|
import { Field } from "../../../record-view/field.js";
|
|
10
|
-
import {
|
|
7
|
+
import { humanize } from "../../../live/naming.js";
|
|
8
|
+
import { useNavigationGuard } from "../../router.js";
|
|
11
9
|
import { createBody, isChosen } from "../../create/create-values.js";
|
|
12
10
|
import { ErrorBanner } from "../../error-banner.js";
|
|
11
|
+
import { text } from "../messages.js";
|
|
13
12
|
import { FieldEditor } from "../../field-editor.js";
|
|
14
|
-
import { fieldErrors, fieldMessage } from "../../field-errors.js";
|
|
15
|
-
import { useFocusFirstInvalid } from "../../use-focus-first-invalid.js";
|
|
16
13
|
import { useLayoutRecord } from "../record-scope.js";
|
|
17
14
|
import { can } from "../../permissions.js";
|
|
18
15
|
import { useFirstRecord, useRefreshResource } from "../use-layout-data.js";
|
|
19
16
|
import { propsOf } from "./block-props.js";
|
|
17
|
+
import { fieldErrors, fieldMessage } from "../../field-errors.js";
|
|
18
|
+
import { useFocusFirstInvalid } from "../../use-focus-first-invalid.js";
|
|
19
|
+
import { editBody, startingDraft } from "./form-draft.js";
|
|
20
20
|
import { useState } from "react";
|
|
21
21
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
22
22
|
//#region src/app/pages/blocks/modal-form.tsx
|
|
23
|
-
/** The literal defaults of new records, or the record's values when editing; relations as `{ key, label }` once chosen. */
|
|
24
|
-
const startingDraft = (model, fields, record) => Object.fromEntries(fields.map((name) => {
|
|
25
|
-
const field = model.fields[name];
|
|
26
|
-
if (field.type === "file") return [name, record?.record[name] ?? null];
|
|
27
|
-
if (record) return [name, field.type === "boolean" ? Boolean(record.record[name]) : toDraft(record.record[name])];
|
|
28
|
-
const fallback = field.default && "value" in field.default ? field.default.value : void 0;
|
|
29
|
-
return [name, field.type === "boolean" ? Boolean(fallback) : toDraft(fallback)];
|
|
30
|
-
}));
|
|
31
|
-
/** Changed fields only; a chosen relation sends its key. */
|
|
32
|
-
const editBody = (model, draft, record) => Object.fromEntries(Object.entries(draft).flatMap(([name, value]) => {
|
|
33
|
-
const field = model.fields[name];
|
|
34
|
-
if (isChosen(value)) return value.key === toDraft(record.record[name]) ? [] : [[name, field.type === "integer" ? Number(value.key) : value.key]];
|
|
35
|
-
return differs(field, value, record.record[name]) ? [[name, toPatchValue(field, value)]] : [];
|
|
36
|
-
}));
|
|
37
23
|
const ModalFormDialog = ({ model, record, mode, label, title, fields, values, onClose }) => {
|
|
38
24
|
const { resources, views } = useAdminMeta();
|
|
39
25
|
const client = useClient();
|
|
40
26
|
const toast = useToast();
|
|
41
27
|
const refresh = useRefreshResource();
|
|
42
28
|
const view = views[model.name];
|
|
43
|
-
const [draft, setDraft] = useState(() => startingDraft(model, fields, record));
|
|
29
|
+
const [draft, setDraft] = useState(() => startingDraft(model, fields, record?.record));
|
|
44
30
|
const [errors, setErrors] = useState({});
|
|
45
31
|
const [rejections, setRejections] = useState(0);
|
|
46
32
|
const formRef = useFocusFirstInvalid(rejections);
|
|
@@ -54,7 +40,7 @@ const ModalFormDialog = ({ model, record, mode, label, title, fields, values, on
|
|
|
54
40
|
await (mode === "create" ? client.create(model.name, {
|
|
55
41
|
...createBody(model, resources, draft),
|
|
56
42
|
...values
|
|
57
|
-
}) : client.update(model.name, record.key, editBody(model, draft, record), record.etag ?? "*")).then(async () => {
|
|
43
|
+
}) : client.update(model.name, record.key, editBody(model, draft, record.record), record.etag ?? "*")).then(async () => {
|
|
58
44
|
await refresh(model.name);
|
|
59
45
|
toast.show({
|
|
60
46
|
state: "success",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PageHeader } from "../../../app-shell/page-header.js";
|
|
2
1
|
import { propsOf } from "./block-props.js";
|
|
2
|
+
import { PageHeader } from "../../../app-shell/page-header.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/app/pages/blocks/page-block.tsx
|
|
5
5
|
const PageBlock = ({ node, children, slots }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Skeleton } from "../../../primitives/skeleton.js";
|
|
2
1
|
import { useAdminMeta } from "../../meta-gate.js";
|
|
3
|
-
import {
|
|
2
|
+
import { Skeleton } from "../../../primitives/skeleton.js";
|
|
4
3
|
import { ErrorBanner } from "../../error-banner.js";
|
|
4
|
+
import { text } from "../messages.js";
|
|
5
5
|
import { RecordScope } from "../record-scope.js";
|
|
6
6
|
import { useFirstRecord } from "../use-layout-data.js";
|
|
7
7
|
import { propsOf } from "./block-props.js";
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { useClient } from "../../../data/api-provider.js";
|
|
2
|
+
import { useAdminMeta, usePermissions } from "../../meta-gate.js";
|
|
3
|
+
import { Button } from "../../../primitives/button.js";
|
|
4
|
+
import { Skeleton } from "../../../primitives/skeleton.js";
|
|
5
|
+
import { useToast } from "../../../toasts/toast-provider.js";
|
|
6
|
+
import { Field } from "../../../record-view/field.js";
|
|
7
|
+
import { humanize } from "../../../live/naming.js";
|
|
8
|
+
import { differs } from "../../../live/field-values.js";
|
|
9
|
+
import { createBody } from "../../create/create-values.js";
|
|
10
|
+
import { ErrorBanner } from "../../error-banner.js";
|
|
11
|
+
import { text } from "../messages.js";
|
|
12
|
+
import { FieldEditor } from "../../field-editor.js";
|
|
13
|
+
import { can } from "../../permissions.js";
|
|
14
|
+
import { scopeOf, useFirstRecord, useRefreshResource } from "../use-layout-data.js";
|
|
15
|
+
import { propsOf } from "./block-props.js";
|
|
16
|
+
import { CardFrame } from "./card-frame.js";
|
|
17
|
+
import { fieldErrors, fieldMessage } from "../../field-errors.js";
|
|
18
|
+
import { editBody, startingDraft } from "./form-draft.js";
|
|
19
|
+
import { useRef, useState } from "react";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
//#region src/app/pages/blocks/settings.tsx
|
|
22
|
+
/** A switch or a choice saves as soon as it changes; what is typed waits for Save. */
|
|
23
|
+
const savesAtOnce = (field) => field.type === "boolean" || field.type === "enum";
|
|
24
|
+
const SettingsForm = ({ model, fields, title, description, stored: loaded }) => {
|
|
25
|
+
const { resources, views } = useAdminMeta();
|
|
26
|
+
const permissions = usePermissions(model.name);
|
|
27
|
+
const client = useClient();
|
|
28
|
+
const toast = useToast();
|
|
29
|
+
const refresh = useRefreshResource();
|
|
30
|
+
const view = views[model.name];
|
|
31
|
+
const [stored, setStored] = useState(loaded);
|
|
32
|
+
const [draft, setDraft] = useState(() => startingDraft(model, fields, loaded?.record));
|
|
33
|
+
const [errors, setErrors] = useState({});
|
|
34
|
+
const [failure, setFailure] = useState();
|
|
35
|
+
const [saving, setSaving] = useState(false);
|
|
36
|
+
const queue = useRef(Promise.resolve());
|
|
37
|
+
const latest = useRef(loaded);
|
|
38
|
+
const defaults = startingDraft(model, fields, void 0);
|
|
39
|
+
const writable = stored ? can(permissions, "update") && stored.permissions?.update !== false : can(permissions, "create");
|
|
40
|
+
const typed = fields.filter((name) => !savesAtOnce(model.fields[name]));
|
|
41
|
+
const unsaved = typed.some((name) => stored ? differs(model.fields[name], draft[name], stored.record[name]) : draft[name] !== defaults[name]);
|
|
42
|
+
const write = async (changes) => {
|
|
43
|
+
const current = latest.current;
|
|
44
|
+
if (current) {
|
|
45
|
+
const saved = await client.update(model.name, current.key, editBody(model, changes, current.record), current.etag ?? "*");
|
|
46
|
+
return {
|
|
47
|
+
...scopeOf(model, saved.record),
|
|
48
|
+
etag: saved.etag,
|
|
49
|
+
permissions: saved.permissions ?? current.permissions
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const created = await client.create(model.name, createBody(model, resources, {
|
|
53
|
+
...defaults,
|
|
54
|
+
...changes
|
|
55
|
+
}));
|
|
56
|
+
return {
|
|
57
|
+
...scopeOf(model, created.record),
|
|
58
|
+
etag: created.etag
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const save = (changes) => {
|
|
62
|
+
const run = queue.current.then(async () => {
|
|
63
|
+
setSaving(true);
|
|
64
|
+
setFailure(void 0);
|
|
65
|
+
await write(changes).then(async (record) => {
|
|
66
|
+
latest.current = record;
|
|
67
|
+
setStored(record);
|
|
68
|
+
setErrors((current) => Object.fromEntries(Object.entries(current).filter(([name]) => !Object.hasOwn(changes, name))));
|
|
69
|
+
await refresh(model.name);
|
|
70
|
+
toast.show({
|
|
71
|
+
state: "success",
|
|
72
|
+
title: text("saved", title ?? text("settings"))
|
|
73
|
+
});
|
|
74
|
+
}, (error) => {
|
|
75
|
+
setErrors((current) => ({
|
|
76
|
+
...current,
|
|
77
|
+
...fieldErrors(error)
|
|
78
|
+
}));
|
|
79
|
+
setFailure(error);
|
|
80
|
+
});
|
|
81
|
+
setSaving(false);
|
|
82
|
+
});
|
|
83
|
+
queue.current = run;
|
|
84
|
+
};
|
|
85
|
+
const change = (name, next) => {
|
|
86
|
+
setDraft((current) => ({
|
|
87
|
+
...current,
|
|
88
|
+
[name]: next
|
|
89
|
+
}));
|
|
90
|
+
if (savesAtOnce(model.fields[name])) save({ [name]: next });
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ jsx(CardFrame, {
|
|
93
|
+
title,
|
|
94
|
+
description,
|
|
95
|
+
className: "h-full",
|
|
96
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
97
|
+
className: "flex flex-col gap-4",
|
|
98
|
+
onSubmit: (event) => {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
if (unsaved) save(Object.fromEntries(typed.map((name) => [name, draft[name]])));
|
|
101
|
+
},
|
|
102
|
+
children: [
|
|
103
|
+
failure !== void 0 && Object.keys(errors).length === 0 && /* @__PURE__ */ jsx(ErrorBanner, {
|
|
104
|
+
title: text("notSaved"),
|
|
105
|
+
error: failure
|
|
106
|
+
}),
|
|
107
|
+
fields.map((name) => {
|
|
108
|
+
const field = model.fields[name];
|
|
109
|
+
const label = view?.fields[name]?.label ?? humanize(name);
|
|
110
|
+
const problem = errors[name];
|
|
111
|
+
return /* @__PURE__ */ jsx(Field, {
|
|
112
|
+
name,
|
|
113
|
+
label,
|
|
114
|
+
help: view?.fields[name]?.help,
|
|
115
|
+
error: problem && fieldMessage(field, label, problem),
|
|
116
|
+
children: /* @__PURE__ */ jsx(FieldEditor, {
|
|
117
|
+
field,
|
|
118
|
+
hints: view?.fields[name],
|
|
119
|
+
value: draft[name],
|
|
120
|
+
stored: stored?.record[name] ?? defaults[name],
|
|
121
|
+
invalid: Boolean(problem),
|
|
122
|
+
locked: !writable || field.readOnly,
|
|
123
|
+
resource: model.name,
|
|
124
|
+
onChange: (next) => change(name, next)
|
|
125
|
+
})
|
|
126
|
+
}, name);
|
|
127
|
+
}),
|
|
128
|
+
writable && unsaved && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
|
|
129
|
+
type: "submit",
|
|
130
|
+
variant: "primary",
|
|
131
|
+
size: "sm",
|
|
132
|
+
loading: saving,
|
|
133
|
+
children: text("save")
|
|
134
|
+
}) })
|
|
135
|
+
]
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
const LoadedSettings = (props) => {
|
|
140
|
+
const record = useFirstRecord(props.model, {});
|
|
141
|
+
if (record.isPending) return /* @__PURE__ */ jsx(CardFrame, {
|
|
142
|
+
title: props.title,
|
|
143
|
+
description: props.description,
|
|
144
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
145
|
+
className: "flex flex-col gap-2",
|
|
146
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/3" })]
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
if (record.error) return /* @__PURE__ */ jsx(CardFrame, {
|
|
150
|
+
title: props.title,
|
|
151
|
+
description: props.description,
|
|
152
|
+
children: /* @__PURE__ */ jsx(ErrorBanner, {
|
|
153
|
+
title: text("couldNotLoad"),
|
|
154
|
+
error: record.error
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
return /* @__PURE__ */ jsx(SettingsForm, {
|
|
158
|
+
...props,
|
|
159
|
+
stored: record.data ?? void 0
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* The signed-in person's own record of a resource as settings: each field as a control, a switch or a choice saving as
|
|
164
|
+
* it changes and typed values with Save, the defaults shown until the first save creates the record. The server keeps
|
|
165
|
+
* every caller to their own record, so the list holds at most theirs.
|
|
166
|
+
*/
|
|
167
|
+
const SettingsBlock = ({ node }) => {
|
|
168
|
+
const { resource, fields = [], ...rest } = propsOf(node);
|
|
169
|
+
const model = useAdminMeta().resources[resource];
|
|
170
|
+
if (!model) return null;
|
|
171
|
+
return /* @__PURE__ */ jsx(LoadedSettings, {
|
|
172
|
+
...rest,
|
|
173
|
+
model,
|
|
174
|
+
fields: fields.filter((name) => Object.hasOwn(model.fields, name)),
|
|
175
|
+
stored: void 0
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
//#endregion
|
|
179
|
+
export { SettingsBlock, savesAtOnce };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { formatTag } from "../../../locale/active-locale.js";
|
|
2
|
-
import { Skeleton } from "../../../primitives/skeleton.js";
|
|
3
2
|
import { useAdminMeta } from "../../meta-gate.js";
|
|
4
|
-
import {
|
|
3
|
+
import { Skeleton } from "../../../primitives/skeleton.js";
|
|
5
4
|
import { AppLink } from "../../use-app-address.js";
|
|
5
|
+
import { text } from "../messages.js";
|
|
6
6
|
import { useLayoutRecord } from "../record-scope.js";
|
|
7
7
|
import { useCount } from "../use-layout-data.js";
|
|
8
8
|
import { propsOf } from "./block-props.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cn } from "../../../lib/cn.js";
|
|
2
|
+
import { shownPageTab, tabsOf, usePageTabsRoute } from "../page-tabs.js";
|
|
3
|
+
import { Link, useRouter } from "../../router.js";
|
|
4
|
+
import { Problem } from "../problem.js";
|
|
5
|
+
import { text } from "../messages.js";
|
|
6
|
+
import { Fragment } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/app/pages/blocks/tabs.tsx
|
|
9
|
+
/**
|
|
10
|
+
* The page's tabs, each a link to its own address, and the shown tab alone (its children are the tabs, one each, in
|
|
11
|
+
* order), so the others load nothing. On a phone they are a select. A name the page has no tab for, such as one the
|
|
12
|
+
* user may not see, says so under the tabs.
|
|
13
|
+
*/
|
|
14
|
+
const TabsBlock = ({ node, children }) => {
|
|
15
|
+
const { tab: named, pathOf } = usePageTabsRoute();
|
|
16
|
+
const { navigate } = useRouter();
|
|
17
|
+
const tabs = tabsOf(node);
|
|
18
|
+
const shown = shownPageTab(tabs, named);
|
|
19
|
+
const path = (name) => pathOf(name === tabs[0]?.name ? void 0 : name);
|
|
20
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: "flex flex-col gap-6",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ jsxs("select", {
|
|
24
|
+
"aria-label": text("tabs"),
|
|
25
|
+
value: shown?.name ?? "",
|
|
26
|
+
onChange: (event) => navigate(path(event.target.value)),
|
|
27
|
+
className: "h-9 rounded-md border border-border-strong bg-background px-2 font-medium md:hidden",
|
|
28
|
+
children: [!shown && /* @__PURE__ */ jsx("option", {
|
|
29
|
+
value: "",
|
|
30
|
+
disabled: true
|
|
31
|
+
}), tabs.map((tab) => /* @__PURE__ */ jsx("option", {
|
|
32
|
+
value: tab.name,
|
|
33
|
+
children: tab.label
|
|
34
|
+
}, tab.name))]
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsx("nav", {
|
|
37
|
+
"aria-label": text("tabs"),
|
|
38
|
+
className: "hidden border-b md:block",
|
|
39
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
40
|
+
className: "flex gap-1",
|
|
41
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, {
|
|
42
|
+
to: path(tab.name),
|
|
43
|
+
"aria-current": tab === shown ? "page" : void 0,
|
|
44
|
+
className: cn("-mb-px inline-flex h-9 items-center whitespace-nowrap border-b-2 px-3 font-medium transition-colors", tab === shown ? "border-foreground text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"),
|
|
45
|
+
children: tab.label
|
|
46
|
+
}) }, tab.name))
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
49
|
+
shown ? /* @__PURE__ */ jsx(Fragment, { children: children[tabs.indexOf(shown)] }, shown.name) : /* @__PURE__ */ jsx(Problem, { children: text("noTab", named ?? "") })
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
/** One tab's elements, stacked as on the page. */
|
|
54
|
+
const TabBlock = ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: "flex flex-col gap-6",
|
|
56
|
+
children
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
export { TabBlock, TabsBlock };
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import { Notice, useAdminMeta } from "../meta-gate.js";
|
|
2
|
+
import { PageTabsProvider } from "./page-tabs.js";
|
|
2
3
|
import { slotted } from "../../locale/slotted.js";
|
|
3
4
|
import { text } from "./messages.js";
|
|
4
5
|
import { RenderNode } from "./render-node.js";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { appPath } from "@protobase/schema";
|
|
6
8
|
//#region src/app/pages/composed-page.tsx
|
|
7
|
-
/** `/<page
|
|
8
|
-
const ComposedPage = ({ name }) => {
|
|
9
|
+
/** `/<page>`, and `/<page>/<tab>` for one of its tabs: the page's tree as `/meta` gave it to this user. */
|
|
10
|
+
const ComposedPage = ({ name, tab }) => {
|
|
9
11
|
const page = useAdminMeta().pages[name];
|
|
10
12
|
if (!page) return /* @__PURE__ */ jsx(Notice, {
|
|
11
13
|
title: text("notFound"),
|
|
12
14
|
children: slotted(text("noPage"), name)
|
|
13
15
|
});
|
|
14
|
-
|
|
16
|
+
const pathOf = (shown) => appPath({
|
|
17
|
+
kind: "page",
|
|
18
|
+
page: name,
|
|
19
|
+
...shown && { tab: shown }
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ jsx(PageTabsProvider, {
|
|
22
|
+
route: {
|
|
23
|
+
...tab && { tab },
|
|
24
|
+
pathOf
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ jsx(RenderNode, { node: page.tree })
|
|
27
|
+
});
|
|
15
28
|
};
|
|
16
29
|
//#endregion
|
|
17
30
|
export { ComposedPage };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { slotted } from "../../locale/slotted.js";
|
|
2
1
|
import { reportRenderError } from "../error-reporting.js";
|
|
3
2
|
import { Problem } from "./problem.js";
|
|
3
|
+
import { slotted } from "../../locale/slotted.js";
|
|
4
4
|
import { text } from "./messages.js";
|
|
5
5
|
import { Component } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cn } from "../../lib/cn.js";
|
|
2
1
|
import { keys } from "../../data/query-keys.js";
|
|
3
2
|
import { useClient } from "../../data/api-provider.js";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
4
|
import { useAdminMeta } from "../meta-gate.js";
|
|
5
5
|
import { fileShown, shownImage } from "../../live/file-values.js";
|
|
6
6
|
import { isMarkdown } from "../../markdown/markdown-hint.js";
|
|
@@ -4,6 +4,8 @@ const text = defineMessages({
|
|
|
4
4
|
en: {
|
|
5
5
|
notFound: "Not found",
|
|
6
6
|
noPage: "There is no page called {}.",
|
|
7
|
+
tabs: "Tabs",
|
|
8
|
+
noTab: (name) => `This page has no tab called ${name}.`,
|
|
7
9
|
cancel: "Cancel",
|
|
8
10
|
couldNotDraw: "{} could not be drawn.",
|
|
9
11
|
noComponent: "No component is registered as {}. Export it from protobase.ui.tsx, or load the plugin that provides it.",
|
|
@@ -29,6 +31,7 @@ const text = defineMessages({
|
|
|
29
31
|
create: "Create",
|
|
30
32
|
save: "Save",
|
|
31
33
|
notSaved: "Not saved",
|
|
34
|
+
settings: "Settings",
|
|
32
35
|
couldNotCount: "Could not count",
|
|
33
36
|
required: "Required",
|
|
34
37
|
wholeNumber: "A whole number",
|
|
@@ -39,6 +42,8 @@ const text = defineMessages({
|
|
|
39
42
|
nl: {
|
|
40
43
|
notFound: "Niet gevonden",
|
|
41
44
|
noPage: "Er is geen pagina met de naam {}.",
|
|
45
|
+
tabs: "Tabbladen",
|
|
46
|
+
noTab: (name) => `Deze pagina heeft geen tabblad met de naam ${name}.`,
|
|
42
47
|
cancel: "Annuleren",
|
|
43
48
|
couldNotDraw: "{} kon niet worden getekend.",
|
|
44
49
|
noComponent: "Er is geen component geregistreerd als {}. Exporteer die uit protobase.ui.tsx, of laad de plug-in die haar levert.",
|
|
@@ -64,6 +69,7 @@ const text = defineMessages({
|
|
|
64
69
|
create: "Maken",
|
|
65
70
|
save: "Bewaren",
|
|
66
71
|
notSaved: "Niet bewaard",
|
|
72
|
+
settings: "Instellingen",
|
|
67
73
|
couldNotCount: "Kon niet tellen",
|
|
68
74
|
required: "Verplicht",
|
|
69
75
|
wholeNumber: "Een geheel getal",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/app/pages/page-tabs.tsx
|
|
4
|
+
const PageTabsContext = createContext(null);
|
|
5
|
+
const PageTabsProvider = ({ route, children }) => /* @__PURE__ */ jsx(PageTabsContext.Provider, {
|
|
6
|
+
value: route,
|
|
7
|
+
children
|
|
8
|
+
});
|
|
9
|
+
const usePageTabsRoute = () => {
|
|
10
|
+
const route = useContext(PageTabsContext);
|
|
11
|
+
if (!route) throw new Error("Tabs render inside a page that gives them their addresses: a composed page");
|
|
12
|
+
return route;
|
|
13
|
+
};
|
|
14
|
+
/** The tabs of a `Tabs` element, as the server sent them to this user. */
|
|
15
|
+
const tabsOf = (tabs) => tabs.children.filter((child) => typeof child !== "string").map((node) => ({
|
|
16
|
+
node,
|
|
17
|
+
...node.props
|
|
18
|
+
}));
|
|
19
|
+
/** The tabs of a page's tree: those of its `Tabs`, which sits directly in its `Page`; none without one. */
|
|
20
|
+
const pageTabs = (tree) => {
|
|
21
|
+
const tabs = tree.children.find((child) => typeof child !== "string" && !child.custom && child.type === "Tabs");
|
|
22
|
+
return tabs ? tabsOf(tabs) : [];
|
|
23
|
+
};
|
|
24
|
+
/** The tab shown: the one `named`, else the first when none is named; none for a name the page has no tab for. */
|
|
25
|
+
const shownPageTab = (tabs, named) => named === void 0 ? tabs[0] : tabs.find((tab) => tab.name === named);
|
|
26
|
+
//#endregion
|
|
27
|
+
export { PageTabsProvider, pageTabs, shownPageTab, tabsOf, usePageTabsRoute };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useTopBarSlot } from "../../app-shell/top-bar-slot.js";
|
|
2
|
-
import "../../app-shell/top-bar.js";
|
|
3
1
|
import { ActionRail } from "../../record-view/action-rail.js";
|
|
4
2
|
import { AppLink, useAppAddress } from "../use-app-address.js";
|
|
5
3
|
import { ActionMenu } from "../../record-view/action-menu.js";
|
|
6
4
|
import { ActionPrompt, asksFirst, isDanger } from "./action-prompt.js";
|
|
7
5
|
import { useActionRunner } from "./use-run-action.js";
|
|
6
|
+
import { useTopBarSlot } from "../../app-shell/top-bar-slot.js";
|
|
7
|
+
import "../../app-shell/top-bar.js";
|
|
8
8
|
import { text } from "../record-messages.js";
|
|
9
9
|
import { actionIcon } from "../action-icon.js";
|
|
10
10
|
import { useState } from "react";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProjectUi } from "./project-ui.js";
|
|
2
2
|
import { Problem } from "./problem.js";
|
|
3
|
+
import { slotted } from "../../locale/slotted.js";
|
|
3
4
|
import { text } from "./messages.js";
|
|
4
5
|
import { CustomBoundary } from "./custom-boundary.js";
|
|
5
|
-
import { useProjectUi } from "./project-ui.js";
|
|
6
6
|
import { ActionBlock } from "./blocks/action.js";
|
|
7
7
|
import { CardBlock } from "./blocks/card.js";
|
|
8
8
|
import { CardRowBlock } from "./blocks/card-row.js";
|
|
@@ -16,10 +16,19 @@ import { ProgressBlock } from "./blocks/progress.js";
|
|
|
16
16
|
import { RecordCardBlock } from "./blocks/record-card.js";
|
|
17
17
|
import { RecordCardsBlock } from "./blocks/record-cards.js";
|
|
18
18
|
import { RecordRowBlock } from "./blocks/record-row.js";
|
|
19
|
+
import { SettingsBlock } from "./blocks/settings.js";
|
|
19
20
|
import { ShowBlock } from "./blocks/show.js";
|
|
20
21
|
import { StatBlock } from "./blocks/stat.js";
|
|
21
22
|
import { TableBlock } from "./blocks/table.js";
|
|
23
|
+
import { TabBlock, TabsBlock } from "./blocks/tabs.js";
|
|
22
24
|
import { UsersBlock } from "../../users/users-block.js";
|
|
25
|
+
import { ConnectedAccountsBlock } from "../../account/blocks/connected-accounts-block.js";
|
|
26
|
+
import { ConnectedAppsBlock } from "../../account/blocks/connected-apps-block.js";
|
|
27
|
+
import { DevicesBlock } from "../../account/blocks/devices-block.js";
|
|
28
|
+
import { PasskeysBlock } from "../../account/blocks/passkeys-block.js";
|
|
29
|
+
import { PasswordBlock } from "../../account/blocks/password-block.js";
|
|
30
|
+
import { ProfileBlock } from "../../account/blocks/profile-block.js";
|
|
31
|
+
import { TwoFactorBlock } from "../../account/blocks/two-factor-block.js";
|
|
23
32
|
import { Fragment } from "react";
|
|
24
33
|
import { unmarkFieldRefs } from "@protobase/schema/internal";
|
|
25
34
|
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
@@ -42,7 +51,17 @@ const blocks = {
|
|
|
42
51
|
Action: ActionBlock,
|
|
43
52
|
Show: ShowBlock,
|
|
44
53
|
Link: LinkBlock,
|
|
45
|
-
|
|
54
|
+
Settings: SettingsBlock,
|
|
55
|
+
Tabs: TabsBlock,
|
|
56
|
+
Tab: TabBlock,
|
|
57
|
+
Users: UsersBlock,
|
|
58
|
+
Profile: ProfileBlock,
|
|
59
|
+
Password: PasswordBlock,
|
|
60
|
+
Passkeys: PasskeysBlock,
|
|
61
|
+
TwoFactor: TwoFactorBlock,
|
|
62
|
+
ConnectedAccounts: ConnectedAccountsBlock,
|
|
63
|
+
Devices: DevicesBlock,
|
|
64
|
+
ConnectedApps: ConnectedAppsBlock
|
|
46
65
|
};
|
|
47
66
|
const isInline = (child) => typeof child === "string" || !child.custom && child.type === "Link";
|
|
48
67
|
/** Text and links run together as one paragraph, like a sentence with a link in it; other elements stand alone. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useClient, useResourceClient } from "../../data/api-provider.js";
|
|
2
2
|
import { useAdminMeta, usePermissions } from "../meta-gate.js";
|
|
3
|
-
import { text } from "./messages.js";
|
|
4
3
|
import { useToast } from "../../toasts/toast-provider.js";
|
|
5
4
|
import { useAppAddress } from "../use-app-address.js";
|
|
6
5
|
import { useProjectUi } from "./project-ui.js";
|
|
6
|
+
import { text } from "./messages.js";
|
|
7
7
|
import { can } from "../permissions.js";
|
|
8
8
|
import { actionApplies } from "./action-when.js";
|
|
9
9
|
import { actionFor, linkTarget, openLink } from "./action-href.js";
|
package/dist/app/project-logo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Logo } from "../app-shell/logo.js";
|
|
2
|
-
import { CustomBoundary } from "./pages/custom-boundary.js";
|
|
3
1
|
import { useProjectUi } from "./pages/project-ui.js";
|
|
2
|
+
import { CustomBoundary } from "./pages/custom-boundary.js";
|
|
3
|
+
import { Logo } from "../app-shell/logo.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/app/project-logo.tsx
|
|
6
6
|
/** The project's `shell.logo` at the top of the sidebar, or Protobase's while it has none or when it throws. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Skeleton } from "../../primitives/skeleton.js";
|
|
2
|
-
import { Segmented } from "../../primitives/segmented.js";
|
|
3
|
-
import { viewerZone } from "../../format/zone.js";
|
|
4
1
|
import { useAdminMeta } from "../meta-gate.js";
|
|
5
|
-
import {
|
|
2
|
+
import { viewerZone } from "../../format/zone.js";
|
|
3
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
6
4
|
import { Section } from "../../record-view/section.js";
|
|
5
|
+
import { humanize } from "../../live/naming.js";
|
|
6
|
+
import { Segmented } from "../../primitives/segmented.js";
|
|
7
7
|
import { useAggregates } from "../../data/use-aggregates.js";
|
|
8
8
|
import { PeriodChart } from "../charts/period-chart.js";
|
|
9
9
|
import { chartPoints, rangeBuckets } from "./chart-points.js";
|
package/dist/app/record-page.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { cn } from "../lib/cn.js";
|
|
2
|
-
import { Skeleton } from "../primitives/skeleton.js";
|
|
3
|
-
import { inApp } from "../app-shell/breadcrumb.js";
|
|
4
1
|
import { useAuth } from "../auth/auth-provider.js";
|
|
5
|
-
import { Button, buttonClass } from "../primitives/button.js";
|
|
6
|
-
import { namedIcon } from "./named-icon.js";
|
|
7
|
-
import { text } from "./messages.js";
|
|
8
|
-
import { useNavigationGuard } from "./router.js";
|
|
9
2
|
import { usePauseFocusRefresh } from "../data/focus-refresh.js";
|
|
10
3
|
import { keys } from "../data/query-keys.js";
|
|
11
4
|
import { useClient } from "../data/api-provider.js";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
12
6
|
import { Notice, useAdminMeta, usePermissions } from "./meta-gate.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
7
|
+
import { Button, buttonClass } from "../primitives/button.js";
|
|
8
|
+
import { Skeleton } from "../primitives/skeleton.js";
|
|
9
|
+
import { inApp } from "../app-shell/breadcrumb.js";
|
|
15
10
|
import { Field } from "../record-view/field.js";
|
|
16
11
|
import { Section } from "../record-view/section.js";
|
|
17
12
|
import { MetadataCard } from "../record-view/record-sidebar.js";
|
|
18
13
|
import { RecordHeader } from "../record-view/record-header.js";
|
|
14
|
+
import { humanize } from "../live/naming.js";
|
|
19
15
|
import { markdownExcerpt } from "../markdown/markdown-excerpt.js";
|
|
20
16
|
import { isMarkdown } from "../markdown/markdown-hint.js";
|
|
21
17
|
import { recordTitle } from "../live/model-helpers.js";
|
|
@@ -23,6 +19,8 @@ import { contactFormat } from "../live/contact-links.js";
|
|
|
23
19
|
import { toneFor } from "../live/columns-from-model.js";
|
|
24
20
|
import { displayValue, valueTitle } from "../live/display-value.js";
|
|
25
21
|
import { filledFields } from "./filled-fields.js";
|
|
22
|
+
import { text } from "./messages.js";
|
|
23
|
+
import { useNavigationGuard } from "./router.js";
|
|
26
24
|
import { AppLink, useAppAddress } from "./use-app-address.js";
|
|
27
25
|
import { GroupSection } from "../record-view/group-section.js";
|
|
28
26
|
import { RecordTabs } from "../record-view/record-tabs.js";
|
|
@@ -37,11 +35,13 @@ import { shownWidget } from "./field-types/shown-widget.js";
|
|
|
37
35
|
import { WidgetPart } from "./field-types/widget-part.js";
|
|
38
36
|
import { ContactLink } from "../live/contact-link.js";
|
|
39
37
|
import { FieldEditor } from "./field-editor.js";
|
|
40
|
-
import { fieldMessage } from "./field-errors.js";
|
|
41
|
-
import { useFocusFirstInvalid } from "./use-focus-first-invalid.js";
|
|
42
38
|
import { can, fieldAccess } from "./permissions.js";
|
|
43
39
|
import { ValueBadge } from "./value-badge.js";
|
|
44
40
|
import { FieldValue } from "./pages/field-value.js";
|
|
41
|
+
import { fieldMessage } from "./field-errors.js";
|
|
42
|
+
import { useFocusFirstInvalid } from "./use-focus-first-invalid.js";
|
|
43
|
+
import { namedIcon } from "./named-icon.js";
|
|
44
|
+
import { useOpenedRecord } from "../data/use-record.js";
|
|
45
45
|
import { text as text$1 } from "./record-messages.js";
|
|
46
46
|
import { useDeleteFlow } from "./delete/use-delete-flow.js";
|
|
47
47
|
import { useRestore } from "./delete/use-restore.js";
|
|
@@ -69,8 +69,8 @@ import { Fragment, useEffect, useMemo } from "react";
|
|
|
69
69
|
import { Check } from "lucide-react";
|
|
70
70
|
import { isApiError } from "@protobase/client";
|
|
71
71
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
72
|
-
import { enumLabel } from "@protobase/schema";
|
|
73
72
|
import { useQueryClient } from "@tanstack/react-query";
|
|
73
|
+
import { enumLabel } from "@protobase/schema";
|
|
74
74
|
//#region src/app/record-page.tsx
|
|
75
75
|
const hidden = (model, name) => name === model.tenant || model.primaryKey.includes(name);
|
|
76
76
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { formatTag } from "../../locale/active-locale.js";
|
|
2
|
+
import { useAdminMeta } from "../meta-gate.js";
|
|
2
3
|
import { useIsXs } from "../../lib/use-media-query.js";
|
|
3
4
|
import { Skeleton } from "../../primitives/skeleton.js";
|
|
4
|
-
import { useAdminMeta } from "../meta-gate.js";
|
|
5
5
|
import { humanize } from "../../live/naming.js";
|
|
6
6
|
import { displaysOf, loadedFields } from "../displays/list-displays.js";
|
|
7
7
|
import { defaultOrderBy } from "../list-order.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Skeleton } from "../../primitives/skeleton.js";
|
|
2
1
|
import { useAdminMeta } from "../meta-gate.js";
|
|
2
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
3
3
|
import { humanize } from "../../live/naming.js";
|
|
4
4
|
import { listedResource } from "../current-address.js";
|
|
5
5
|
import { ErrorBanner } from "../error-banner.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Skeleton } from "../../primitives/skeleton.js";
|
|
2
1
|
import { useAdminMeta } from "../meta-gate.js";
|
|
2
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
3
3
|
import { recordKey, recordTitle } from "../../live/model-helpers.js";
|
|
4
4
|
import { AppLink } from "../use-app-address.js";
|
|
5
5
|
import { RecordScope } from "../pages/record-scope.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { humanize } from "../../live/naming.js";
|
|
2
1
|
import { headerWidth } from "../../data-grid/content-widths.js";
|
|
2
|
+
import { humanize } from "../../live/naming.js";
|
|
3
3
|
import { listColumnNames } from "../../live/columns-from-model.js";
|
|
4
4
|
import { RelatedDots } from "./related-dots.js";
|
|
5
5
|
import { RecordCard } from "../displays/record-card.js";
|