@protobase/ui 0.46.3 → 0.46.5
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-DYCHMbTU.js +9 -0
- package/dist/shell/assets/index-CT4BrHx-.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-CZB4A_qN.js} +2 -2
- package/dist/shell/assets/shared-protobase-ui-DVOkKNxu.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-DYCHMbTU.js.map +1 -0
- package/dist/shell-source-maps/assets/{index-CY22munM.js.map → index-CT4BrHx-.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-CZB4A_qN.js.map} +1 -1
- package/dist/shell-source-maps/assets/{shared-protobase-ui-TOG-RVkz.js.map → shared-protobase-ui-DVOkKNxu.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,8 +1,8 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
2
|
import { Button } from "../../primitives/button.js";
|
|
3
|
-
import { useNavigationGuard } from "../router.js";
|
|
4
3
|
import { useToast } from "../../toasts/toast-provider.js";
|
|
5
4
|
import { refusalReason } from "../displays/board-columns.js";
|
|
5
|
+
import { useNavigationGuard } from "../router.js";
|
|
6
6
|
import { Textarea } from "../../primitives/textarea.js";
|
|
7
7
|
import { menuKeyTarget } from "../../primitives/menu-keys.js";
|
|
8
8
|
import { activeMention, insertMention, mentionedIds } from "./mention-text.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { Button } from "../../primitives/button.js";
|
|
2
|
+
import { formatDateTime, formatRelativeTime } from "../../format/date.js";
|
|
1
3
|
import { Skeleton } from "../../primitives/skeleton.js";
|
|
2
4
|
import { Avatar } from "../../primitives/avatar.js";
|
|
3
|
-
import { formatDateTime, formatRelativeTime } from "../../format/date.js";
|
|
4
|
-
import { Button } from "../../primitives/button.js";
|
|
5
|
-
import { hueOf, initialsOf } from "../../auth/user-to-shell.js";
|
|
6
5
|
import { Section } from "../../record-view/section.js";
|
|
7
6
|
import { ErrorBanner } from "../error-banner.js";
|
|
7
|
+
import { hueOf, initialsOf } from "../../auth/user-to-shell.js";
|
|
8
8
|
import { CommentBody } from "./comment-body.js";
|
|
9
9
|
import { text } from "./messages.js";
|
|
10
10
|
import { CommentComposer } from "./comment-composer.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { text } from "../messages.js";
|
|
2
|
-
import { useNavigationGuard } from "../router.js";
|
|
3
1
|
import { useClient } from "../../data/api-provider.js";
|
|
4
2
|
import { Notice, useAdminMeta, usePermissions } from "../meta-gate.js";
|
|
5
3
|
import { humanize } from "../../live/naming.js";
|
|
6
4
|
import { recordKey } from "../../live/model-helpers.js";
|
|
5
|
+
import { text } from "../messages.js";
|
|
6
|
+
import { useNavigationGuard } from "../router.js";
|
|
7
7
|
import { useAppAddress } from "../use-app-address.js";
|
|
8
8
|
import { text as text$1 } from "./messages.js";
|
|
9
9
|
import { createBody, createSections, hasDatabaseDefault, initialDraft, isChosen, isRequired } from "./create-values.js";
|
|
10
10
|
import { FieldEditor } from "../field-editor.js";
|
|
11
|
-
import { fieldErrors, fieldMessage } from "../field-errors.js";
|
|
12
|
-
import { useFocusFirstInvalid } from "../use-focus-first-invalid.js";
|
|
13
11
|
import { can } from "../permissions.js";
|
|
14
12
|
import { fetchLabels } from "../../live/relation-labels.js";
|
|
13
|
+
import { fieldErrors, fieldMessage } from "../field-errors.js";
|
|
14
|
+
import { useFocusFirstInvalid } from "../use-focus-first-invalid.js";
|
|
15
15
|
import { useLiveSave } from "../use-live-save.js";
|
|
16
16
|
import { CreateRecordForm } from "./create-record-form.js";
|
|
17
17
|
import { useEffect, useState } from "react";
|
|
@@ -32,6 +32,7 @@ export type CurrentAddress = ListAddress | {
|
|
|
32
32
|
} | {
|
|
33
33
|
kind: 'page';
|
|
34
34
|
page: string;
|
|
35
|
+
tab?: string;
|
|
35
36
|
};
|
|
36
37
|
/** What can change about the list the app shows; `undefined` returns a value to its default. */
|
|
37
38
|
export type ListChange = Partial<Omit<ListAddress, 'kind' | 'resource' | 'list'>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { text } from "./messages.js";
|
|
2
|
-
import { slotted } from "../locale/slotted.js";
|
|
3
|
-
import { Problem } from "./pages/problem.js";
|
|
4
|
-
import { CustomBoundary } from "./pages/custom-boundary.js";
|
|
5
1
|
import { Section } from "../record-view/section.js";
|
|
6
2
|
import { SidebarCard } from "../record-view/record-sidebar.js";
|
|
3
|
+
import { text } from "./messages.js";
|
|
7
4
|
import { useProjectUi } from "./pages/project-ui.js";
|
|
5
|
+
import { Problem } from "./pages/problem.js";
|
|
6
|
+
import { slotted } from "../locale/slotted.js";
|
|
7
|
+
import { CustomBoundary } from "./pages/custom-boundary.js";
|
|
8
8
|
import { RecordScope } from "./pages/record-scope.js";
|
|
9
9
|
import { unmarkFieldRefs } from "@protobase/schema/internal";
|
|
10
10
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useClient } from "../../data/api-provider.js";
|
|
2
2
|
import { useAdminMeta } from "../meta-gate.js";
|
|
3
|
-
import { humanize } from "../../live/naming.js";
|
|
4
3
|
import { useToast } from "../../toasts/toast-provider.js";
|
|
4
|
+
import { humanize } from "../../live/naming.js";
|
|
5
5
|
import { useAppAddress } from "../use-app-address.js";
|
|
6
6
|
import { text } from "./messages.js";
|
|
7
7
|
import { blockedDelete } from "./blocked-delete.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { formatTag } from "../../locale/active-locale.js";
|
|
2
2
|
import { cn } from "../../lib/cn.js";
|
|
3
|
-
import { Skeleton } from "../../primitives/skeleton.js";
|
|
4
3
|
import { Button } from "../../primitives/button.js";
|
|
4
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
5
5
|
import { humanize } from "../../live/naming.js";
|
|
6
6
|
import { text } from "./messages.js";
|
|
7
7
|
import { boardCard } from "./board-columns.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { usePermissions } from "../meta-gate.js";
|
|
2
|
-
import { slotted } from "../../locale/slotted.js";
|
|
3
|
-
import { Problem } from "../pages/problem.js";
|
|
4
2
|
import { text } from "./messages.js";
|
|
5
3
|
import { boardCard, boardColumns, boardRank } from "./board-columns.js";
|
|
6
4
|
import { useProjectUi } from "../pages/project-ui.js";
|
|
5
|
+
import { Problem } from "../pages/problem.js";
|
|
6
|
+
import { slotted } from "../../locale/slotted.js";
|
|
7
7
|
import { can } from "../permissions.js";
|
|
8
8
|
import { RecordCard } from "./record-card.js";
|
|
9
9
|
import { listHandOrder } from "../hand-order/hand-order.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
-
import {
|
|
2
|
+
import { usePermissions } from "../meta-gate.js";
|
|
3
3
|
import { dayIn, viewerZone } from "../../format/zone.js";
|
|
4
4
|
import { formatDate, formatWeekday } from "../../format/date.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
6
6
|
import { text } from "./messages.js";
|
|
7
7
|
import { AppLink } from "../use-app-address.js";
|
|
8
8
|
import { ErrorBanner } from "../error-banner.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { slotted } from "../../locale/slotted.js";
|
|
2
|
-
import { Problem } from "../pages/problem.js";
|
|
3
|
-
import { CustomBoundary } from "../pages/custom-boundary.js";
|
|
4
1
|
import { text } from "./messages.js";
|
|
5
2
|
import { useProjectUi } from "../pages/project-ui.js";
|
|
3
|
+
import { Problem } from "../pages/problem.js";
|
|
4
|
+
import { slotted } from "../../locale/slotted.js";
|
|
5
|
+
import { CustomBoundary } from "../pages/custom-boundary.js";
|
|
6
6
|
import { ListDisplayProvider } from "./display-context.js";
|
|
7
7
|
import { unmarkFieldRefs } from "@protobase/schema/internal";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
-
import { Segmented } from "../../primitives/segmented.js";
|
|
3
2
|
import { humanize } from "../../live/naming.js";
|
|
4
3
|
import { text } from "./messages.js";
|
|
5
4
|
import { displayChoices, sortFields } from "./list-displays.js";
|
|
6
5
|
import { parseSort } from "../list-order.js";
|
|
6
|
+
import { Segmented } from "../../primitives/segmented.js";
|
|
7
7
|
import { MenuSelect } from "../../primitives/menu-select.js";
|
|
8
8
|
import { Calendar, ChartGantt, Columns3, LayoutGrid, List, Map, SquareKanban, Table2 } from "lucide-react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { formatTag } from "../../locale/active-locale.js";
|
|
2
2
|
import { cn } from "../../lib/cn.js";
|
|
3
|
-
import { Button } from "../../primitives/button.js";
|
|
4
3
|
import { useAdminMeta } from "../meta-gate.js";
|
|
5
|
-
import {
|
|
4
|
+
import { Button } from "../../primitives/button.js";
|
|
6
5
|
import { humanize } from "../../live/naming.js";
|
|
7
6
|
import { text } from "./messages.js";
|
|
8
7
|
import { mapCards } from "./list-displays.js";
|
|
9
8
|
import { ErrorBanner } from "../error-banner.js";
|
|
9
|
+
import { Problem } from "../pages/problem.js";
|
|
10
10
|
import { useDebounced } from "../../lib/use-debounced.js";
|
|
11
11
|
import { RecordCard } from "./record-card.js";
|
|
12
12
|
import { boundsAround, worldArea } from "../map/map-area.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { segmentedClass } from "../../primitives/segmented.js";
|
|
2
1
|
import { buttonClass } from "../../primitives/button.js";
|
|
3
2
|
import { text } from "./messages.js";
|
|
4
3
|
import { AppLink } from "../use-app-address.js";
|
|
4
|
+
import { segmentedClass } from "../../primitives/segmented.js";
|
|
5
5
|
import { Fragment } from "react";
|
|
6
6
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Badge } from "../../primitives/badge.js";
|
|
2
|
-
import { namedIcon } from "../named-icon.js";
|
|
3
|
-
import { CustomBoundary } from "../pages/custom-boundary.js";
|
|
4
2
|
import { humanize } from "../../live/naming.js";
|
|
5
3
|
import { markdownExcerpt } from "../../markdown/markdown-excerpt.js";
|
|
6
4
|
import { isMarkdown } from "../../markdown/markdown-hint.js";
|
|
@@ -11,10 +9,12 @@ import { amountParts, cardFields, filledAmount, filledMeta } from "./list-displa
|
|
|
11
9
|
import { AppLink } from "../use-app-address.js";
|
|
12
10
|
import { useProjectUi } from "../pages/project-ui.js";
|
|
13
11
|
import { shownWidget } from "../field-types/shown-widget.js";
|
|
12
|
+
import { CustomBoundary } from "../pages/custom-boundary.js";
|
|
14
13
|
import { WidgetPart } from "../field-types/widget-part.js";
|
|
15
14
|
import { Markdown } from "../../markdown/markdown.js";
|
|
16
15
|
import { ValueBadge } from "../value-badge.js";
|
|
17
16
|
import { useSeedRecord } from "../record-preview.js";
|
|
17
|
+
import { namedIcon } from "../named-icon.js";
|
|
18
18
|
import { FavoriteButton } from "../saved/favorite-button.js";
|
|
19
19
|
import { CardDots, CardDotsRoom } from "../related-dots/card-dots.js";
|
|
20
20
|
import { cardDotsLines } from "../related-dots/card-dots-lines.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { usePermissions } from "../meta-gate.js";
|
|
2
2
|
import { dayIn, viewerZone } from "../../format/zone.js";
|
|
3
3
|
import { formatDate } from "../../format/date.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
5
5
|
import { humanize } from "../../live/naming.js";
|
|
6
6
|
import { text } from "./messages.js";
|
|
7
7
|
import { ErrorBanner } from "../error-banner.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { formatDate } from "../../format/date.js";
|
|
2
1
|
import { useClient } from "../../data/api-provider.js";
|
|
2
|
+
import { formatDate } from "../../format/date.js";
|
|
3
3
|
import { useToast } from "../../toasts/toast-provider.js";
|
|
4
4
|
import { recordKey } from "../../live/model-helpers.js";
|
|
5
5
|
import { text } from "./messages.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { text } from "./create/messages.js";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
//#region src/app/document-title.ts
|
|
4
|
-
/** What a tab names, most specific first: the record and its list, the new record and its list, the list, or the page. */
|
|
4
|
+
/** What a tab names, most specific first: the record and its list, the new record and its list, the list, or the page (after its tab). */
|
|
5
5
|
const titleParts = ({ address, page, accountPage, resourceLabel, singular, recordTitle, recordLoading }) => {
|
|
6
|
+
if (page) return page.tab ? [page.tab, page.title] : [page.title];
|
|
6
7
|
if (accountPage) return [accountPage];
|
|
7
|
-
if (page) return [page.title];
|
|
8
8
|
if (!address || address.kind === "page") return [];
|
|
9
9
|
const list = resourceLabel ? [resourceLabel] : [];
|
|
10
10
|
if (address.kind === "list") return list;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { guarded } from "../../lib/guarded.js";
|
|
2
1
|
import { defaultDisplay, displayChoices } from "../displays/list-displays.js";
|
|
3
2
|
import { changedList, listDefaults } from "../current-address.js";
|
|
3
|
+
import { guarded } from "../../lib/guarded.js";
|
|
4
4
|
//#region src/app/embedded-list/embedded-display.ts
|
|
5
5
|
const prefix = "protobase:embedded-display:";
|
|
6
6
|
/** Where a viewer's pick of display is kept for one embedded list, named by the place it is shown. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useAdminMeta, usePermissions } from "../meta-gate.js";
|
|
1
2
|
import { useIsDesktop, useIsXs } from "../../lib/use-media-query.js";
|
|
2
3
|
import { Skeleton } from "../../primitives/skeleton.js";
|
|
3
|
-
import { useAdminMeta, usePermissions } from "../meta-gate.js";
|
|
4
4
|
import { humanize } from "../../live/naming.js";
|
|
5
5
|
import { listColumnNames } from "../../live/columns-from-model.js";
|
|
6
6
|
import { displayRow, loadedFields, shownDisplay } from "../displays/list-displays.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Segmented } from "../../primitives/segmented.js";
|
|
2
|
-
import { formatApproxRows, formatInt } from "../../format/number.js";
|
|
3
1
|
import { Button } from "../../primitives/button.js";
|
|
4
2
|
import { ResponsiveDialog } from "../../primitives/responsive-dialog.js";
|
|
3
|
+
import { formatApproxRows, formatInt } from "../../format/number.js";
|
|
4
|
+
import { Segmented } from "../../primitives/segmented.js";
|
|
5
5
|
import { Checkbox } from "../../primitives/checkbox.js";
|
|
6
6
|
import { text } from "./messages.js";
|
|
7
7
|
import { exportLimit } from "./export-options.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { formatInt } from "../../format/number.js";
|
|
2
1
|
import { keys } from "../../data/query-keys.js";
|
|
3
2
|
import { useClient } from "../../data/api-provider.js";
|
|
3
|
+
import { formatInt } from "../../format/number.js";
|
|
4
4
|
import { useToast } from "../../toasts/toast-provider.js";
|
|
5
5
|
import { listLabels } from "../../live/relation-labels.js";
|
|
6
6
|
import { text } from "./messages.js";
|
package/dist/app/field-editor.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { buttonClass } from "../primitives/button.js";
|
|
2
3
|
import { useFieldControl } from "../primitives/field-control.js";
|
|
3
4
|
import { Input } from "../primitives/input.js";
|
|
4
|
-
import { buttonClass } from "../primitives/button.js";
|
|
5
|
-
import { text } from "./messages.js";
|
|
6
5
|
import { humanize } from "../live/naming.js";
|
|
7
6
|
import { isMarkdown } from "../markdown/markdown-hint.js";
|
|
8
7
|
import { contactFormat, contactInputProps } from "../live/contact-links.js";
|
|
9
8
|
import { displayValue, valueTitle } from "../live/display-value.js";
|
|
9
|
+
import { text } from "./messages.js";
|
|
10
10
|
import { AppLink } from "./use-app-address.js";
|
|
11
11
|
import { fromDraft, isEditable, toFieldDraft } from "../live/field-values.js";
|
|
12
12
|
import { Switch } from "../primitives/switch.js";
|
package/dist/app/file-field.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { useClient } from "../data/api-provider.js";
|
|
1
2
|
import { cn } from "../lib/cn.js";
|
|
2
3
|
import { Button } from "../primitives/button.js";
|
|
3
|
-
import { text } from "./messages.js";
|
|
4
|
-
import { useClient } from "../data/api-provider.js";
|
|
5
|
-
import { humanize } from "../live/naming.js";
|
|
6
4
|
import { acceptOf, fileShown, formatSize, isPreviewable, shownImage } from "../live/file-values.js";
|
|
5
|
+
import { humanize } from "../live/naming.js";
|
|
6
|
+
import { text } from "./messages.js";
|
|
7
7
|
import { ErrorBanner } from "./error-banner.js";
|
|
8
8
|
import { FileImage } from "../live/file-image.js";
|
|
9
9
|
import { useRef, useState } from "react";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
-
import { Skeleton } from "../../primitives/skeleton.js";
|
|
3
2
|
import { useAdminMeta, usePermissions } from "../meta-gate.js";
|
|
4
|
-
import {
|
|
3
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
5
4
|
import { Section } from "../../record-view/section.js";
|
|
6
5
|
import { shownImage } from "../../live/file-values.js";
|
|
6
|
+
import { humanize } from "../../live/naming.js";
|
|
7
7
|
import { ErrorBanner } from "../error-banner.js";
|
|
8
8
|
import { FileImage } from "../../live/file-image.js";
|
|
9
9
|
import { galleryTiles } from "./gallery-layout.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Skeleton } from "../../primitives/skeleton.js";
|
|
2
|
-
import { useRecord } from "../../data/use-record.js";
|
|
3
2
|
import { humanize } from "../../live/naming.js";
|
|
4
3
|
import { AppLink } from "../use-app-address.js";
|
|
5
4
|
import { SpecTable } from "../../record-view/spec-table.js";
|
|
6
5
|
import { ErrorBanner } from "../error-banner.js";
|
|
7
6
|
import { fieldAccess } from "../permissions.js";
|
|
8
7
|
import { FieldValue } from "../pages/field-value.js";
|
|
8
|
+
import { useRecord } from "../../data/use-record.js";
|
|
9
9
|
import { text } from "./messages.js";
|
|
10
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region src/app/gallery/photo-details.tsx
|
|
@@ -2,8 +2,8 @@ import { keys } from "../../data/query-keys.js";
|
|
|
2
2
|
import { useClient } from "../../data/api-provider.js";
|
|
3
3
|
import { useAdminMeta } from "../meta-gate.js";
|
|
4
4
|
import { galleryItems } from "./gallery-items.js";
|
|
5
|
-
import { createWhere, printFilter } from "@protobase/schema";
|
|
6
5
|
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import { createWhere, printFilter } from "@protobase/schema";
|
|
7
7
|
//#region src/app/gallery/use-gallery-photos.ts
|
|
8
8
|
const where$1 = createWhere();
|
|
9
9
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Skeleton } from "../../primitives/skeleton.js";
|
|
2
1
|
import { useAdminMeta } from "../meta-gate.js";
|
|
3
|
-
import {
|
|
4
|
-
import { Problem } from "../pages/problem.js";
|
|
2
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
5
3
|
import { recordKey, recordTitle } from "../../live/model-helpers.js";
|
|
6
4
|
import { loadedFields } from "../displays/list-displays.js";
|
|
7
5
|
import { useAppAddress } from "../use-app-address.js";
|
|
8
6
|
import { ErrorBanner } from "../error-banner.js";
|
|
9
7
|
import { useProjectUi } from "../pages/project-ui.js";
|
|
8
|
+
import { Problem } from "../pages/problem.js";
|
|
9
|
+
import { slotted } from "../../locale/slotted.js";
|
|
10
10
|
import { DataGrid } from "../../data-grid/data-grid.js";
|
|
11
11
|
import { text } from "./messages.js";
|
|
12
12
|
import { embeddedColumns } from "../embedded-list/embedded-columns.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Skeleton } from "../../primitives/skeleton.js";
|
|
2
|
-
import { formatDateTime, formatRelativeTime } from "../../format/date.js";
|
|
3
1
|
import { Button } from "../../primitives/button.js";
|
|
2
|
+
import { formatDateTime, formatRelativeTime } from "../../format/date.js";
|
|
3
|
+
import { Skeleton } from "../../primitives/skeleton.js";
|
|
4
4
|
import { Section } from "../../record-view/section.js";
|
|
5
5
|
import { ErrorBanner } from "../error-banner.js";
|
|
6
6
|
import { describeChange } from "./describe-change.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Button } from "../../primitives/button.js";
|
|
2
1
|
import { useAdminMeta, usePermissions } from "../meta-gate.js";
|
|
2
|
+
import { Button } from "../../primitives/button.js";
|
|
3
3
|
import { can } from "../permissions.js";
|
|
4
4
|
import { text } from "./messages.js";
|
|
5
5
|
import { ImportDialog } from "./import-dialog.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { formatTag } from "../../locale/active-locale.js";
|
|
2
2
|
import { Spinner } from "../../primitives/spinner.js";
|
|
3
3
|
import { Button } from "../../primitives/button.js";
|
|
4
|
-
import { saveFile } from "../../lib/save-file.js";
|
|
5
4
|
import { displayValue } from "../../live/display-value.js";
|
|
5
|
+
import { saveFile } from "../../lib/save-file.js";
|
|
6
6
|
import { text } from "./messages.js";
|
|
7
7
|
import { failedRowsCsv } from "./failed-rows.js";
|
|
8
8
|
import { ImportCounts } from "./import-counts.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Skeleton } from "../primitives/skeleton.js";
|
|
2
|
-
import { formatInt } from "../format/number.js";
|
|
3
1
|
import { useAdminMeta } from "./meta-gate.js";
|
|
2
|
+
import { formatInt } from "../format/number.js";
|
|
3
|
+
import { Skeleton } from "../primitives/skeleton.js";
|
|
4
4
|
import { SidebarCard } from "../record-view/record-sidebar.js";
|
|
5
5
|
import { AppLink } from "./use-app-address.js";
|
|
6
6
|
import { text } from "./record-messages.js";
|
package/dist/app/list-page.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { useIsDesktop, useIsXs } from "../lib/use-media-query.js";
|
|
2
|
-
import { usePageScroll } from "../app-shell/page-scroll.js";
|
|
3
|
-
import { PageHeader } from "../app-shell/page-header.js";
|
|
4
1
|
import { useAuth } from "../auth/auth-provider.js";
|
|
2
|
+
import { Notice, useAdminMeta, usePermissions } from "./meta-gate.js";
|
|
5
3
|
import { Button, buttonClass } from "../primitives/button.js";
|
|
4
|
+
import { useIsDesktop, useIsXs } from "../lib/use-media-query.js";
|
|
6
5
|
import { Sheet } from "../primitives/sheet.js";
|
|
7
|
-
import { text } from "./messages.js";
|
|
8
|
-
import { SignInPrompt } from "../auth/sign-in-prompt.js";
|
|
9
|
-
import { Notice, useAdminMeta, usePermissions } from "./meta-gate.js";
|
|
10
6
|
import { humanize } from "../live/naming.js";
|
|
11
7
|
import { recordKey, recordTitleField } from "../live/model-helpers.js";
|
|
12
8
|
import { columnsFromModel, listColumnNames } from "../live/columns-from-model.js";
|
|
@@ -14,10 +10,13 @@ import { boardRank } from "./displays/board-columns.js";
|
|
|
14
10
|
import { displayRow, listDisplayChoices, loadedFields, shownListDisplay } from "./displays/list-displays.js";
|
|
15
11
|
import { parseSort, sortToOrderBy } from "./list-order.js";
|
|
16
12
|
import { listedResource } from "./current-address.js";
|
|
13
|
+
import { text } from "./messages.js";
|
|
17
14
|
import { AppLink, useAppAddress } from "./use-app-address.js";
|
|
18
15
|
import { ErrorBanner } from "./error-banner.js";
|
|
19
16
|
import { useProjectUi } from "./pages/project-ui.js";
|
|
20
17
|
import { can, rowAllows } from "./permissions.js";
|
|
18
|
+
import { usePageScroll } from "../app-shell/page-scroll.js";
|
|
19
|
+
import { PageHeader } from "../app-shell/page-header.js";
|
|
21
20
|
import { pinnedStorageKey } from "../data-grid/pinned-storage.js";
|
|
22
21
|
import { DataGrid } from "../data-grid/data-grid.js";
|
|
23
22
|
import { useLiveRows } from "../live/use-live-rows.js";
|
|
@@ -30,6 +29,7 @@ import { stateToText, textToState } from "../live/filter-string.js";
|
|
|
30
29
|
import { widgetFields } from "../live/view-fields.js";
|
|
31
30
|
import { facetNames, filterChips } from "./searches/saved-search.js";
|
|
32
31
|
import { useSeedRecord } from "./record-preview.js";
|
|
32
|
+
import { SignInPrompt } from "../auth/sign-in-prompt.js";
|
|
33
33
|
import { relatedColumnLoads } from "./related-dots/dot-card.js";
|
|
34
34
|
import { dragsRank, listHandOrder } from "./hand-order/hand-order.js";
|
|
35
35
|
import { useDisplayRows } from "./displays/use-display-rows.js";
|
package/dist/app/messages.js
CHANGED
|
@@ -5,7 +5,6 @@ const text = defineMessages({
|
|
|
5
5
|
notFound: "Not found",
|
|
6
6
|
noResource: (name) => `There is no resource called ${name}.`,
|
|
7
7
|
somethingWentWrong: "Something went wrong",
|
|
8
|
-
signInSecurity: "Sign-in & security",
|
|
9
8
|
signInPolicy: "Sign-in policy",
|
|
10
9
|
adminsOnly: "Admins only",
|
|
11
10
|
onlyAdminPolicy: "Only an admin can change how people sign in.",
|
|
@@ -74,7 +73,6 @@ const text = defineMessages({
|
|
|
74
73
|
notFound: "Niet gevonden",
|
|
75
74
|
noResource: (name) => `Er is geen onderdeel met de naam ${name}.`,
|
|
76
75
|
somethingWentWrong: "Er ging iets mis",
|
|
77
|
-
signInSecurity: "Inloggen en beveiliging",
|
|
78
76
|
signInPolicy: "Inlogbeleid",
|
|
79
77
|
adminsOnly: "Alleen beheerders",
|
|
80
78
|
onlyAdminPolicy: "Alleen een beheerder kan wijzigen hoe mensen inloggen.",
|
package/dist/app/meta-gate.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Spinner } from "../primitives/spinner.js";
|
|
2
1
|
import { ClientProvider, useClient, useSourceClients } from "../data/api-provider.js";
|
|
3
2
|
import { MetaContext } from "../data/meta-context.js";
|
|
4
3
|
import { allowEverything } from "../data/meta-data.js";
|
|
@@ -6,6 +5,7 @@ import { useMeta } from "../data/use-meta.js";
|
|
|
6
5
|
import { useSourceMetas } from "../data/use-source-metas.js";
|
|
7
6
|
import { withSources } from "../data/with-sources.js";
|
|
8
7
|
import { AppLocale } from "../locale/app-locale.js";
|
|
8
|
+
import { Spinner } from "../primitives/spinner.js";
|
|
9
9
|
import { text } from "./meta-gate-messages.js";
|
|
10
10
|
import { useContext, useMemo } from "react";
|
|
11
11
|
import { isApiError, routedClient } from "@protobase/client";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { text } from "./messages.js";
|
|
2
1
|
import { humanize } from "../live/naming.js";
|
|
2
|
+
import { text } from "./messages.js";
|
|
3
3
|
import { iconFor } from "./icons.js";
|
|
4
4
|
import { menuIcon } from "./menu-icons.js";
|
|
5
5
|
import { userMenuResources } from "./user-menu-from-meta.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useRouter } from "../router.js";
|
|
2
1
|
import { useAdminMeta } from "../meta-gate.js";
|
|
2
|
+
import { useRouter } from "../router.js";
|
|
3
3
|
import { slotted } from "../../locale/slotted.js";
|
|
4
4
|
import { text } from "./messages.js";
|
|
5
5
|
import { RotateCw } from "lucide-react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useAdminMeta } from "../meta-gate.js";
|
|
1
2
|
import { Button } from "../../primitives/button.js";
|
|
2
3
|
import { useRouter } from "../router.js";
|
|
3
|
-
import { useAdminMeta } from "../meta-gate.js";
|
|
4
4
|
import { text } from "./messages.js";
|
|
5
5
|
import { RotateCw } from "lucide-react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useRouter } from "../router.js";
|
|
2
1
|
import { useAdminMeta } from "../meta-gate.js";
|
|
3
2
|
import { useToast } from "../../toasts/toast-provider.js";
|
|
3
|
+
import { useRouter } from "../router.js";
|
|
4
4
|
import { text } from "./messages.js";
|
|
5
5
|
import { useModalOpen } from "./use-modal-open.js";
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { useAdminMeta } from "../../meta-gate.js";
|
|
1
2
|
import { Button } from "../../../primitives/button.js";
|
|
2
3
|
import { ResponsiveDialog } from "../../../primitives/responsive-dialog.js";
|
|
3
|
-
import { useAdminMeta } from "../../meta-gate.js";
|
|
4
|
-
import { text } from "../messages.js";
|
|
5
4
|
import { Field } from "../../../record-view/field.js";
|
|
6
5
|
import { isChosen } from "../../create/create-values.js";
|
|
7
6
|
import { ErrorBanner } from "../../error-banner.js";
|
|
8
7
|
import { useProjectUi } from "../project-ui.js";
|
|
8
|
+
import { text } from "../messages.js";
|
|
9
9
|
import { FieldEditor } from "../../field-editor.js";
|
|
10
10
|
import { answeredValues, inputField, inputHints, refusedAnswers, startingAnswers } from "./input-answers.js";
|
|
11
11
|
import { inputErrors } from "./input-errors.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { text } from "../messages.js";
|
|
2
1
|
import { toDraft, toPatchValue } from "../../../live/field-values.js";
|
|
3
2
|
import { isChosen } from "../../create/create-values.js";
|
|
3
|
+
import { text } from "../messages.js";
|
|
4
4
|
import { shownInputs } from "@protobase/schema/internal";
|
|
5
5
|
//#region src/app/pages/action-inputs/input-answers.ts
|
|
6
6
|
const fieldTypes = {
|
|
@@ -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 { scopeOf, useListPage } from "../use-layout-data.js";
|
|
7
7
|
import { propsOf } from "./block-props.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 { useLayoutRecord } from "../record-scope.js";
|
|
5
5
|
import { propsOf } from "./block-props.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { differs, toDraft, toPatchValue } from "../../../live/field-values.js";
|
|
2
|
+
import { isChosen } from "../../create/create-values.js";
|
|
3
|
+
//#region src/app/pages/blocks/form-draft.ts
|
|
4
|
+
/** The literal defaults of new records, or the stored record's values; relations as `{ key, label }` once chosen. */
|
|
5
|
+
const startingDraft = (model, fields, stored) => Object.fromEntries(fields.map((name) => {
|
|
6
|
+
const field = model.fields[name];
|
|
7
|
+
if (field.type === "file") return [name, stored?.[name] ?? null];
|
|
8
|
+
if (stored) return [name, field.type === "boolean" ? Boolean(stored[name]) : toDraft(stored[name])];
|
|
9
|
+
const fallback = field.default && "value" in field.default ? field.default.value : void 0;
|
|
10
|
+
return [name, field.type === "boolean" ? Boolean(fallback) : toDraft(fallback)];
|
|
11
|
+
}));
|
|
12
|
+
/** Changed fields only; a chosen relation sends its key. */
|
|
13
|
+
const editBody = (model, draft, stored) => Object.fromEntries(Object.entries(draft).flatMap(([name, value]) => {
|
|
14
|
+
const field = model.fields[name];
|
|
15
|
+
if (isChosen(value)) return value.key === toDraft(stored[name]) ? [] : [[name, field.type === "integer" ? Number(value.key) : value.key]];
|
|
16
|
+
return differs(field, value, stored[name]) ? [[name, toPatchValue(field, value)]] : [];
|
|
17
|
+
}));
|
|
18
|
+
//#endregion
|
|
19
|
+
export { editBody, startingDraft };
|