@protobase/ui 0.19.5 → 0.19.7
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-section.js +2 -2
- package/dist/account/account-security-page.js +2 -2
- package/dist/account/backup-codes.js +1 -1
- package/dist/account/passkeys-section.js +2 -2
- package/dist/account/password-dialog.js +1 -1
- package/dist/account/sign-in-policy-form.js +2 -2
- package/dist/account/sign-in-policy-page.js +2 -2
- package/dist/account/sign-in-providers-section.js +1 -1
- package/dist/account/staff-sign-in-log.js +3 -3
- package/dist/account/two-factor-setup.js +6 -6
- package/dist/action-card/action-card.js +1 -1
- package/dist/activity-chart/activity-chart.js +2 -2
- package/dist/app/delete/dialogs.js +3 -3
- package/dist/app/displays/display-controls.js +1 -1
- package/dist/app/displays/display-frame.js +1 -1
- package/dist/app/displays/list-cards.js +1 -1
- package/dist/app/displays/map-display.js +1 -1
- package/dist/app/displays/record-card.js +1 -1
- package/dist/app/embedded-list/embedded-list.js +2 -2
- package/dist/app/error-banner.js +1 -1
- package/dist/app/export/builder-port.js +54 -0
- package/dist/app/export/builder.js +61 -0
- package/dist/app/export/cells.js +93 -0
- package/dist/app/export/csv.js +17 -0
- package/dist/app/export/export-dialog.js +235 -0
- package/dist/app/export/export-options.js +49 -0
- package/dist/app/export/export-worker.d.ts +1 -0
- package/dist/app/export/export-worker.js +9 -0
- package/dist/app/export/run-export.js +62 -0
- package/dist/app/export/sink.js +91 -0
- package/dist/app/export/use-export-flow.js +139 -0
- package/dist/app/export/xlsx.js +91 -0
- package/dist/app/field-editor.js +6 -12
- package/dist/app/file-field.js +4 -4
- package/dist/app/gallery/lightbox.js +2 -2
- package/dist/app/gallery/photo-details.js +1 -1
- package/dist/app/import/import-check-step.js +2 -2
- package/dist/app/import/import-file-step.js +2 -2
- package/dist/app/import/import-mapping-step.js +1 -1
- package/dist/app/import/import-result-step.js +2 -2
- package/dist/app/import/import-select.js +2 -2
- package/dist/app/list-page.js +28 -3
- package/dist/app/meta-gate.js +3 -3
- package/dist/app/pages/blocks/card-frame.js +4 -4
- package/dist/app/pages/blocks/field.js +2 -5
- package/dist/app/pages/blocks/stat.js +2 -2
- package/dist/app/pages/problem.js +1 -1
- package/dist/app/pages/render-node.js +1 -1
- package/dist/app/record-page.js +2 -2
- package/dist/app/record-row/record-row-body.js +3 -3
- package/dist/app/record-row/saved-record-row.js +1 -1
- package/dist/app/related-section.js +1 -1
- package/dist/app/relation-picker.js +1 -1
- package/dist/app/runtime/runtime-update.js +3 -3
- package/dist/app/saved/saved-list.js +1 -1
- package/dist/app/searches/saved-search-rows.js +2 -2
- package/dist/app/searches/saved-search-section.js +1 -1
- package/dist/app/searches/saved-searches.js +1 -1
- 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 +16 -19
- package/dist/app/sensitive-field.js +1 -1
- package/dist/app/source-notice.js +3 -3
- package/dist/app/staff-banner.js +1 -1
- package/dist/app-shell/breadcrumb.js +1 -1
- package/dist/app-shell/global-search.js +1 -1
- package/dist/app-shell/page-header.js +1 -1
- package/dist/app-shell/profile-menu.js +3 -3
- package/dist/app-shell/sidebar-group.js +1 -1
- package/dist/app-shell/sidebar-item.js +1 -1
- package/dist/app-shell/sidebar.js +2 -2
- package/dist/assistant-dock/part-view.js +1 -4
- package/dist/assistant-dock/widget-view.js +1 -4
- package/dist/auth/auth-gate.js +2 -2
- package/dist/auth/auth-layout.js +1 -1
- package/dist/auth/code-form.js +2 -2
- package/dist/auth/first-run-page.js +1 -1
- package/dist/auth/forgot-password-form.js +2 -2
- package/dist/auth/provider-sign-in-page.js +1 -1
- package/dist/auth/reset-password-form.js +3 -3
- package/dist/auth/setup-required-form.js +2 -2
- package/dist/auth/setup-required-page.js +1 -1
- package/dist/auth/sign-in-form.js +5 -5
- package/dist/auth/sign-in-prompt.js +2 -2
- package/dist/auth/sign-up-details-form.js +3 -3
- package/dist/auth/sign-up-email-form.js +4 -4
- package/dist/auth/staff-sign-in-form.js +3 -3
- package/dist/auth/two-factor-form.js +5 -5
- package/dist/chat/chat-message.js +1 -1
- package/dist/chat/chat-thread.js +1 -1
- package/dist/data/query-keys.js +7 -0
- package/dist/data-grid/grid-row.js +1 -1
- package/dist/data-grid/header-menu.js +1 -1
- package/dist/data-grid/row-menu.js +1 -1
- package/dist/filter-panel/facet-combobox.js +1 -1
- package/dist/filter-panel/filter-menu.js +1 -1
- package/dist/filter-panel/filter-panel.js +2 -2
- package/dist/inline-child-table/line-menu.js +1 -1
- package/dist/inline-child-table/line-row.js +4 -4
- package/dist/inline-child-table/number-cell.js +1 -1
- package/dist/inline-child-table/totals-footer.js +2 -2
- package/dist/organizations/app-roles-picker.js +1 -1
- package/dist/organizations/invitation-page.js +3 -3
- package/dist/organizations/invitations-page.js +2 -2
- package/dist/organizations/members-page.js +2 -2
- package/dist/organizations/organization-page.js +1 -1
- package/dist/organizations/organizations-page.js +2 -2
- 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/plugins/plugin-notice.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/dialog.js +2 -2
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu-select.js +2 -2
- package/dist/primitives/responsive-dialog.js +1 -1
- package/dist/primitives/segmented.js +1 -1
- package/dist/primitives/sheet.js +1 -1
- package/dist/primitives/textarea.js +1 -1
- package/dist/record-view/action-rail.js +1 -1
- package/dist/record-view/field.js +1 -1
- package/dist/record-view/key-facts.js +2 -2
- package/dist/record-view/record-sidebar.js +2 -2
- package/dist/record-view/section.js +2 -2
- package/dist/record-view/spec-table.js +1 -1
- package/dist/shell/assets/app-BRVJlz_E.js +68 -0
- package/dist/shell/assets/export-worker-CVd5saLq.js +2 -0
- package/dist/shell/assets/{index-BzCCIfII.js → index-CafsxSWx.js} +1 -1
- package/dist/shell/assets/index-Cuulz26c.css +2 -0
- package/dist/shell/assets/maplibre-Cb7ks8SG.js +814 -0
- package/dist/shell/assets/{record-map-BK_02Lmk.js → record-map-dXyPrmGg.js} +1 -1
- package/dist/shell/assets/{records-map-Dn72A_l-.js → records-map-bGH18FRn.js} +1 -1
- package/dist/shell/assets/{shared-protobase-ui-B6lrj7eA.js → shared-protobase-ui-e-G14mxb.js} +1 -1
- package/dist/shell/index.html +4 -4
- package/dist/shell/protobase.shell.json +1 -1
- package/dist/side-panel/side-panel.js +1 -1
- package/dist/step-list/step-list.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme.css +2 -0
- package/dist/toasts/toast.js +2 -2
- package/package.json +5 -4
- package/dist/shell/assets/app-CZ4drn7G.js +0 -67
- package/dist/shell/assets/index-BoeKjvo8.css +0 -2
- package/dist/shell/assets/maplibre-BOsAtlAo.js +0 -814
|
@@ -8,12 +8,12 @@ const AccountSection = ({ title, status, description, children }) => /* @__PURE_
|
|
|
8
8
|
/* @__PURE__ */ jsxs("div", {
|
|
9
9
|
className: "flex flex-wrap items-center gap-2",
|
|
10
10
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
11
|
-
className: "text-[
|
|
11
|
+
className: "text-[16px] font-semibold",
|
|
12
12
|
children: title
|
|
13
13
|
}), status]
|
|
14
14
|
}),
|
|
15
15
|
/* @__PURE__ */ jsx("p", {
|
|
16
|
-
className: "mt-1 text-
|
|
16
|
+
className: "mt-1 text-muted-foreground",
|
|
17
17
|
children: description
|
|
18
18
|
}),
|
|
19
19
|
children && /* @__PURE__ */ jsx("div", {
|
|
@@ -69,10 +69,10 @@ const AccountSecurityPage = ({ email }) => {
|
|
|
69
69
|
})
|
|
70
70
|
] }) : error ? /* @__PURE__ */ jsx("p", {
|
|
71
71
|
role: "alert",
|
|
72
|
-
className: "text-
|
|
72
|
+
className: "text-danger-text",
|
|
73
73
|
children: error
|
|
74
74
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
75
|
-
className: "flex items-center gap-2 text-
|
|
75
|
+
className: "flex items-center gap-2 text-muted-foreground",
|
|
76
76
|
children: [/* @__PURE__ */ jsx(Spinner, {}), " Loading"]
|
|
77
77
|
})]
|
|
78
78
|
});
|
|
@@ -12,7 +12,7 @@ const BackupCodes = ({ codes }) => {
|
|
|
12
12
|
className: "flex flex-col gap-3",
|
|
13
13
|
children: [/* @__PURE__ */ jsx("ul", {
|
|
14
14
|
"aria-label": "Backup codes",
|
|
15
|
-
className: "grid grid-cols-2 gap-x-4 gap-y-1 rounded-md border bg-surface p-3 font-mono
|
|
15
|
+
className: "grid grid-cols-2 gap-x-4 gap-y-1 rounded-md border bg-surface p-3 font-mono",
|
|
16
16
|
children: codes.map((code) => /* @__PURE__ */ jsx("li", { children: code }, code))
|
|
17
17
|
}), /* @__PURE__ */ jsxs("div", {
|
|
18
18
|
className: "flex flex-wrap gap-2",
|
|
@@ -51,7 +51,7 @@ const PasskeysSection = ({ rule, passkeys, onAdd, onRename, onRemove }) => {
|
|
|
51
51
|
/* @__PURE__ */ jsxs("span", {
|
|
52
52
|
className: "min-w-0 flex-1",
|
|
53
53
|
children: [/* @__PURE__ */ jsx("span", {
|
|
54
|
-
className: "block truncate
|
|
54
|
+
className: "block truncate font-medium",
|
|
55
55
|
children: passkey.name ?? "Passkey"
|
|
56
56
|
}), /* @__PURE__ */ jsxs("span", {
|
|
57
57
|
className: "block text-xs text-muted-foreground",
|
|
@@ -110,7 +110,7 @@ const PasskeysSection = ({ rule, passkeys, onAdd, onRename, onRemove }) => {
|
|
|
110
110
|
children: "Save"
|
|
111
111
|
})] }),
|
|
112
112
|
children: [/* @__PURE__ */ jsxs("label", {
|
|
113
|
-
className: "flex flex-col gap-1.5
|
|
113
|
+
className: "flex flex-col gap-1.5 font-medium",
|
|
114
114
|
children: ["Name", /* @__PURE__ */ jsx(Input, {
|
|
115
115
|
autoFocus: true,
|
|
116
116
|
value: name,
|
|
@@ -37,7 +37,7 @@ const PasswordDialog = ({ title, description, confirmLabel, danger, needsPasswor
|
|
|
37
37
|
children: confirmLabel
|
|
38
38
|
})] }),
|
|
39
39
|
children: [needsPassword && /* @__PURE__ */ jsxs("label", {
|
|
40
|
-
className: "flex flex-col gap-1.5
|
|
40
|
+
className: "flex flex-col gap-1.5 font-medium",
|
|
41
41
|
children: ["Your password", /* @__PURE__ */ jsx(Input, {
|
|
42
42
|
type: "password",
|
|
43
43
|
autoComplete: "current-password",
|
|
@@ -59,11 +59,11 @@ const SignInPolicyForm = ({ state, onSave, busy, error, notice }) => {
|
|
|
59
59
|
className: "min-w-0",
|
|
60
60
|
children: [
|
|
61
61
|
/* @__PURE__ */ jsx("h2", {
|
|
62
|
-
className: "
|
|
62
|
+
className: "font-semibold",
|
|
63
63
|
children: row.label
|
|
64
64
|
}),
|
|
65
65
|
/* @__PURE__ */ jsx("p", {
|
|
66
|
-
className: "mt-0.5 text-
|
|
66
|
+
className: "mt-0.5 text-muted-foreground",
|
|
67
67
|
children: row.description
|
|
68
68
|
}),
|
|
69
69
|
note && /* @__PURE__ */ jsx("p", {
|
|
@@ -60,10 +60,10 @@ const SignInPolicyPage = () => {
|
|
|
60
60
|
onSave: (policy) => void save(policy)
|
|
61
61
|
}, state.savedAt ?? "default"), state.operator && /* @__PURE__ */ jsx(StaffSignIns, { operator: state.operator })] }) : error ? /* @__PURE__ */ jsx("p", {
|
|
62
62
|
role: "alert",
|
|
63
|
-
className: "text-
|
|
63
|
+
className: "text-danger-text",
|
|
64
64
|
children: error
|
|
65
65
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
66
|
-
className: "flex items-center gap-2 text-
|
|
66
|
+
className: "flex items-center gap-2 text-muted-foreground",
|
|
67
67
|
children: [/* @__PURE__ */ jsx(Spinner, {}), " Loading"]
|
|
68
68
|
})]
|
|
69
69
|
});
|
|
@@ -32,7 +32,7 @@ const SignInProvidersSection = ({ providers, linked, onConnect, error: returned
|
|
|
32
32
|
children: [
|
|
33
33
|
/* @__PURE__ */ jsx(Link2, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
34
34
|
/* @__PURE__ */ jsx("span", {
|
|
35
|
-
className: "min-w-0 flex-1 truncate
|
|
35
|
+
className: "min-w-0 flex-1 truncate font-medium",
|
|
36
36
|
children: provider.name
|
|
37
37
|
}),
|
|
38
38
|
linked.includes(provider.id) ? /* @__PURE__ */ jsx(Badge, {
|
|
@@ -20,7 +20,7 @@ const StaffSignInLog = ({ signIns, operator, error, now = Date.now() }) => /* @_
|
|
|
20
20
|
children: [
|
|
21
21
|
/* @__PURE__ */ jsx(SectionError, { message: error }),
|
|
22
22
|
signIns && signIns.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
23
|
-
className: "text-
|
|
23
|
+
className: "text-muted-foreground",
|
|
24
24
|
children: "No staff has signed in as anyone yet."
|
|
25
25
|
}),
|
|
26
26
|
signIns && signIns.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
@@ -29,7 +29,7 @@ const StaffSignInLog = ({ signIns, operator, error, now = Date.now() }) => /* @_
|
|
|
29
29
|
className: "flex flex-col gap-1.5 p-3",
|
|
30
30
|
children: [
|
|
31
31
|
/* @__PURE__ */ jsxs("div", {
|
|
32
|
-
className: "flex flex-wrap items-center gap-x-2 gap-y-1
|
|
32
|
+
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
33
33
|
children: [
|
|
34
34
|
/* @__PURE__ */ jsx("span", {
|
|
35
35
|
className: "font-medium break-all",
|
|
@@ -46,7 +46,7 @@ const StaffSignInLog = ({ signIns, operator, error, now = Date.now() }) => /* @_
|
|
|
46
46
|
]
|
|
47
47
|
}),
|
|
48
48
|
/* @__PURE__ */ jsx("p", {
|
|
49
|
-
className: "
|
|
49
|
+
className: "break-words",
|
|
50
50
|
children: entry.reason
|
|
51
51
|
}),
|
|
52
52
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -65,7 +65,7 @@ const TwoFactorSetup = ({ offerEmailedCodes, needsPassword, onStartApp, onConfir
|
|
|
65
65
|
className: "flex flex-col gap-4",
|
|
66
66
|
children: [
|
|
67
67
|
/* @__PURE__ */ jsx("p", {
|
|
68
|
-
className: "text-
|
|
68
|
+
className: "text-muted-foreground",
|
|
69
69
|
children: "Two-factor authentication is on. Keep these backup codes somewhere safe: each one signs you in once if you lose your phone. They are not shown again."
|
|
70
70
|
}),
|
|
71
71
|
/* @__PURE__ */ jsx(BackupCodes, { codes: step.codes }),
|
|
@@ -85,7 +85,7 @@ const TwoFactorSetup = ({ offerEmailedCodes, needsPassword, onStartApp, onConfir
|
|
|
85
85
|
},
|
|
86
86
|
children: [
|
|
87
87
|
/* @__PURE__ */ jsx("p", {
|
|
88
|
-
className: "text-
|
|
88
|
+
className: "text-muted-foreground",
|
|
89
89
|
children: "Scan this code with your authenticator app, then enter the 6-digit code it shows."
|
|
90
90
|
}),
|
|
91
91
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -96,13 +96,13 @@ const TwoFactorSetup = ({ offerEmailedCodes, needsPassword, onStartApp, onConfir
|
|
|
96
96
|
}), /* @__PURE__ */ jsxs("p", {
|
|
97
97
|
className: "text-center text-xs text-muted-foreground",
|
|
98
98
|
children: ["Can't scan it? Enter this key in the app:", /* @__PURE__ */ jsx("span", {
|
|
99
|
-
className: "mt-1 block break-all font-mono text-
|
|
99
|
+
className: "mt-1 block break-all font-mono text-body text-foreground",
|
|
100
100
|
children: totpKey(step.setup.totpURI)
|
|
101
101
|
})]
|
|
102
102
|
})]
|
|
103
103
|
}),
|
|
104
104
|
/* @__PURE__ */ jsxs("label", {
|
|
105
|
-
className: "flex flex-col gap-1.5
|
|
105
|
+
className: "flex flex-col gap-1.5 font-medium",
|
|
106
106
|
children: ["Code from the app", /* @__PURE__ */ jsx(OtpInput, {
|
|
107
107
|
name: "code",
|
|
108
108
|
required: true,
|
|
@@ -147,7 +147,7 @@ const TwoFactorSetup = ({ offerEmailedCodes, needsPassword, onStartApp, onConfir
|
|
|
147
147
|
onClick: () => setChoice(option.value),
|
|
148
148
|
className: cn("rounded-md border p-3 text-left transition-colors", choice === option.value ? "border-primary bg-primary-soft" : "border-border-strong hover:bg-muted"),
|
|
149
149
|
children: [/* @__PURE__ */ jsx("span", {
|
|
150
|
-
className: "block
|
|
150
|
+
className: "block font-medium",
|
|
151
151
|
children: option.label
|
|
152
152
|
}), /* @__PURE__ */ jsx("span", {
|
|
153
153
|
className: "mt-0.5 block text-xs text-muted-foreground",
|
|
@@ -156,7 +156,7 @@ const TwoFactorSetup = ({ offerEmailedCodes, needsPassword, onStartApp, onConfir
|
|
|
156
156
|
}, option.value))
|
|
157
157
|
}),
|
|
158
158
|
needsPassword && /* @__PURE__ */ jsxs("label", {
|
|
159
|
-
className: "flex flex-col gap-1.5
|
|
159
|
+
className: "flex flex-col gap-1.5 font-medium",
|
|
160
160
|
children: ["Your password", /* @__PURE__ */ jsx(Input, {
|
|
161
161
|
type: "password",
|
|
162
162
|
name: "password",
|
|
@@ -38,7 +38,7 @@ const ActionCard = ({ title, tone = "neutral", badge, note, actions = [], onActi
|
|
|
38
38
|
!frameless && /* @__PURE__ */ jsxs("header", {
|
|
39
39
|
className: cn("flex items-center gap-2 px-3 py-2", frames[tone].header),
|
|
40
40
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
41
|
-
className: "min-w-0 flex-1
|
|
41
|
+
className: "min-w-0 flex-1 font-semibold",
|
|
42
42
|
children: title
|
|
43
43
|
}), badge && /* @__PURE__ */ jsx("span", {
|
|
44
44
|
className: "shrink-0 text-xs font-medium",
|
|
@@ -29,11 +29,11 @@ const ActivityChart = ({ title = "Orders created", noun = "orders", defaultGranu
|
|
|
29
29
|
className: "flex items-baseline gap-2",
|
|
30
30
|
children: [
|
|
31
31
|
/* @__PURE__ */ jsx("h2", {
|
|
32
|
-
className: "
|
|
32
|
+
className: "font-semibold",
|
|
33
33
|
children: title
|
|
34
34
|
}),
|
|
35
35
|
/* @__PURE__ */ jsx("span", {
|
|
36
|
-
className: "
|
|
36
|
+
className: "font-semibold tabular-nums",
|
|
37
37
|
children: formatInt(totalCount(series))
|
|
38
38
|
}),
|
|
39
39
|
/* @__PURE__ */ jsxs("span", {
|
|
@@ -32,10 +32,10 @@ const ConflictDialog = ({ title, changes, busy, onReview, onDeleteAnyway, onCanc
|
|
|
32
32
|
children: "Delete anyway"
|
|
33
33
|
})] }),
|
|
34
34
|
children: changes.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
35
|
-
className: "text-
|
|
35
|
+
className: "text-muted-foreground",
|
|
36
36
|
children: "No visible fields differ; the record was saved again with the same values."
|
|
37
37
|
}) : /* @__PURE__ */ jsx("ul", {
|
|
38
|
-
className: "divide-y rounded-md border
|
|
38
|
+
className: "divide-y rounded-md border",
|
|
39
39
|
children: changes.map((change) => /* @__PURE__ */ jsxs("li", {
|
|
40
40
|
className: "grid grid-cols-[96px_1fr] gap-3 px-3 py-2",
|
|
41
41
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -91,7 +91,7 @@ const BulkDeleteDialog = (props) => {
|
|
|
91
91
|
children: "Done"
|
|
92
92
|
}),
|
|
93
93
|
children: props.failures.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
94
|
-
className: "max-h-48 divide-y overflow-y-auto rounded-md border
|
|
94
|
+
className: "max-h-48 divide-y overflow-y-auto rounded-md border",
|
|
95
95
|
children: props.failures.map((failure) => /* @__PURE__ */ jsxs("li", {
|
|
96
96
|
className: "px-3 py-2",
|
|
97
97
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -54,7 +54,7 @@ const SortMenu = ({ model, view, display, orderBy, onChange, className }) => {
|
|
|
54
54
|
"aria-label": "Sort",
|
|
55
55
|
value: `${current.columnId} ${current.direction}`,
|
|
56
56
|
onChange: (event) => onChange(event.target.value),
|
|
57
|
-
className: cn("h-8 rounded-md border border-border-strong bg-background px-2.5
|
|
57
|
+
className: cn("h-8 rounded-md border border-border-strong bg-background px-2.5 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20", className),
|
|
58
58
|
children: names.flatMap((name) => directions.map(([direction, word]) => /* @__PURE__ */ jsxs("option", {
|
|
59
59
|
value: `${name} ${direction}`,
|
|
60
60
|
children: [
|
|
@@ -9,7 +9,7 @@ const DisplayState = ({ list, empty, loading, children }) => /* @__PURE__ */ jsx
|
|
|
9
9
|
title: "Could not load rows",
|
|
10
10
|
error: list.error
|
|
11
11
|
}) : list.rows.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
12
|
-
className: "py-8 text-center text-
|
|
12
|
+
className: "py-8 text-center text-muted-foreground",
|
|
13
13
|
children: empty
|
|
14
14
|
}) : children
|
|
15
15
|
});
|
|
@@ -25,7 +25,7 @@ const ListCards = ({ model, view, display, list }) => {
|
|
|
25
25
|
error: list.error
|
|
26
26
|
});
|
|
27
27
|
if (!list.source || list.source.total === 0) return /* @__PURE__ */ jsxs("p", {
|
|
28
|
-
className: "py-8 text-center text-
|
|
28
|
+
className: "py-8 text-center text-muted-foreground",
|
|
29
29
|
children: [
|
|
30
30
|
"No ",
|
|
31
31
|
plural.toLowerCase(),
|
|
@@ -102,7 +102,7 @@ const MapDisplay = ({ model, view, display, filter, orderBy, fields, at, onMove,
|
|
|
102
102
|
empty && /* @__PURE__ */ jsx("div", {
|
|
103
103
|
className: "pointer-events-none absolute inset-x-3 top-3 z-10 flex justify-center",
|
|
104
104
|
children: /* @__PURE__ */ jsxs("p", {
|
|
105
|
-
className: "pointer-events-auto flex items-center gap-3 rounded-full border border-border bg-background px-4 py-1.5 text-
|
|
105
|
+
className: "pointer-events-auto flex items-center gap-3 rounded-full border border-border bg-background px-4 py-1.5 text-muted-foreground shadow",
|
|
106
106
|
role: "status",
|
|
107
107
|
children: [fitting ? `No ${plural} match.` : `No ${plural} in this part of the map.`, !fitting && /* @__PURE__ */ jsx(Button, {
|
|
108
108
|
size: "sm",
|
|
@@ -141,7 +141,7 @@ const RecordCard = ({ model, view, display, row, swipe = true, mark }) => {
|
|
|
141
141
|
resource: model.name,
|
|
142
142
|
key: row.key
|
|
143
143
|
},
|
|
144
|
-
className: "flex h-full flex-col gap-1.5 rounded-lg border border-border bg-background p-3
|
|
144
|
+
className: "flex h-full flex-col gap-1.5 rounded-lg border border-border bg-background p-3 hover:border-border-strong hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
145
145
|
children: [mark && !pictured && /* @__PURE__ */ jsx(Badge, {
|
|
146
146
|
tone: "blue",
|
|
147
147
|
className: "self-start",
|
|
@@ -86,7 +86,7 @@ const EmbeddedList = ({ model, view, filter, sort, columns, limit, display, empt
|
|
|
86
86
|
display
|
|
87
87
|
}),
|
|
88
88
|
onClick: viewAll?.onOpen,
|
|
89
|
-
className: "flex items-center gap-1 self-end
|
|
89
|
+
className: "flex items-center gap-1 self-end font-medium text-primary-text hover:underline",
|
|
90
90
|
children: [viewAll ? viewAll.label : /* @__PURE__ */ jsxs(Fragment$1, { children: ["View all ", /* @__PURE__ */ jsx("span", {
|
|
91
91
|
className: "sr-only",
|
|
92
92
|
children: plural.toLowerCase()
|
|
@@ -102,7 +102,7 @@ const EmbeddedList = ({ model, view, filter, sort, columns, limit, display, empt
|
|
|
102
102
|
});
|
|
103
103
|
if (!source || source.total === 0) {
|
|
104
104
|
const nothing = /* @__PURE__ */ jsx("p", {
|
|
105
|
-
className: "text-
|
|
105
|
+
className: "text-muted-foreground",
|
|
106
106
|
children: empty ?? "Nothing here yet."
|
|
107
107
|
});
|
|
108
108
|
return viewAll && link ? /* @__PURE__ */ jsxs("div", {
|
package/dist/app/error-banner.js
CHANGED
|
@@ -12,7 +12,7 @@ const describe = (error) => {
|
|
|
12
12
|
};
|
|
13
13
|
const ErrorBanner = ({ error, title }) => /* @__PURE__ */ jsxs("div", {
|
|
14
14
|
role: "alert",
|
|
15
|
-
className: "flex gap-2.5 rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-
|
|
15
|
+
className: "flex gap-2.5 rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-danger-text",
|
|
16
16
|
children: [/* @__PURE__ */ jsx(TriangleAlert, { className: "mt-0.5 size-4 shrink-0" }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
17
17
|
className: "font-medium",
|
|
18
18
|
children: title
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createExportBuilder } from "./builder.js";
|
|
2
|
+
//#region src/app/export/builder-port.ts
|
|
3
|
+
const joined = (chunks) => {
|
|
4
|
+
const bytes = new Uint8Array(chunks.reduce((size, chunk) => size + chunk.length, 0));
|
|
5
|
+
let offset = 0;
|
|
6
|
+
for (const chunk of chunks) {
|
|
7
|
+
bytes.set(chunk, offset);
|
|
8
|
+
offset += chunk.length;
|
|
9
|
+
}
|
|
10
|
+
return bytes;
|
|
11
|
+
};
|
|
12
|
+
/** Handles one message at a time, as the worker does, returning the bytes it made; used by the worker and by tests. */
|
|
13
|
+
const createBuilderHandler = () => {
|
|
14
|
+
let builder;
|
|
15
|
+
let chunks = [];
|
|
16
|
+
return (message) => {
|
|
17
|
+
if (message.kind === "start") builder = createExportBuilder(message.plan, (chunk) => chunks.push(chunk));
|
|
18
|
+
else if (!builder) throw new Error("The export was not started");
|
|
19
|
+
else if (message.kind === "page") builder.page(message.records, message.labels);
|
|
20
|
+
else builder.finish();
|
|
21
|
+
const bytes = joined(chunks);
|
|
22
|
+
chunks = [];
|
|
23
|
+
return bytes;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A port to a Web Worker that builds the file, so compressing it never holds up the page. The worker answers messages
|
|
28
|
+
* in the order they came; an error in it fails every message still waiting.
|
|
29
|
+
*/
|
|
30
|
+
const createWorkerPort = () => {
|
|
31
|
+
const worker = new Worker(new URL("./export-worker.js", import.meta.url), {
|
|
32
|
+
type: "module",
|
|
33
|
+
name: "protobase-export"
|
|
34
|
+
});
|
|
35
|
+
const waiting = [];
|
|
36
|
+
worker.onmessage = (event) => waiting.shift()?.resolve(event.data.bytes);
|
|
37
|
+
worker.onerror = (event) => {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
const error = /* @__PURE__ */ new Error(`The export could not be built: ${event.message}`);
|
|
40
|
+
for (const entry of waiting.splice(0)) entry.reject(error);
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
send: (message) => new Promise((resolve, reject) => {
|
|
44
|
+
waiting.push({
|
|
45
|
+
resolve,
|
|
46
|
+
reject
|
|
47
|
+
});
|
|
48
|
+
worker.postMessage(message);
|
|
49
|
+
}),
|
|
50
|
+
close: () => worker.terminate()
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { createBuilderHandler, createWorkerPort };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createXlsxWriter } from "./xlsx.js";
|
|
2
|
+
import { csvText, xlsxCell } from "./cells.js";
|
|
3
|
+
import { csvField, csvLine, csvTextField, utf8Bom } from "./csv.js";
|
|
4
|
+
//#region src/app/export/builder.ts
|
|
5
|
+
const typedText = /* @__PURE__ */ new Set([
|
|
6
|
+
"text",
|
|
7
|
+
"uuid",
|
|
8
|
+
"enum",
|
|
9
|
+
"relation",
|
|
10
|
+
"file",
|
|
11
|
+
"json",
|
|
12
|
+
"currency",
|
|
13
|
+
"country"
|
|
14
|
+
]);
|
|
15
|
+
const minWidth = 8;
|
|
16
|
+
const maxWidth = 60;
|
|
17
|
+
/** Each column's width in characters, room for its header and the longest value of the first page as shown. */
|
|
18
|
+
const columnWidths = (columns, records, labels) => columns.map((column) => {
|
|
19
|
+
const longest = Math.max(column.header.length, ...records.map((record) => csvText(column, record[column.name], labels, "shown").length));
|
|
20
|
+
return Math.min(maxWidth, Math.max(minWidth, longest + 2));
|
|
21
|
+
});
|
|
22
|
+
const createCsvBuilder = (plan, onChunk) => {
|
|
23
|
+
const encoder = new TextEncoder();
|
|
24
|
+
onChunk(utf8Bom);
|
|
25
|
+
onChunk(encoder.encode(csvLine(plan.columns.map((column) => csvField(column.header)))));
|
|
26
|
+
const field = (column, record, labels) => {
|
|
27
|
+
const text = csvText(column, record[column.name], labels, plan.mode);
|
|
28
|
+
return typedText.has(column.field.type) ? csvTextField(text) : csvField(text);
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
page: (records, labels) => {
|
|
32
|
+
onChunk(encoder.encode(records.map((record) => csvLine(plan.columns.map((column) => field(column, record, labels)))).join("")));
|
|
33
|
+
},
|
|
34
|
+
finish: () => void 0
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const createXlsxBuilder = (plan, onChunk) => {
|
|
38
|
+
let writer;
|
|
39
|
+
const start = (records, labels) => createXlsxWriter({
|
|
40
|
+
name: plan.name,
|
|
41
|
+
headers: plan.columns.map((column) => column.header),
|
|
42
|
+
widths: columnWidths(plan.columns, records, labels)
|
|
43
|
+
}, onChunk);
|
|
44
|
+
return {
|
|
45
|
+
page: (records, labels) => {
|
|
46
|
+
writer ??= start(records, labels);
|
|
47
|
+
writer.rows(records.map((record) => plan.columns.map((column) => xlsxCell(column, record[column.name], labels, plan.mode))));
|
|
48
|
+
},
|
|
49
|
+
finish: () => {
|
|
50
|
+
writer ??= start([], {});
|
|
51
|
+
writer.finish();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Builds an export file page by page: `page` with each page of records and the names of the records their relations
|
|
57
|
+
* point at, then `finish` once. Each piece of the file goes to `onChunk` as soon as it is made.
|
|
58
|
+
*/
|
|
59
|
+
const createExportBuilder = (plan, onChunk) => plan.format === "csv" ? createCsvBuilder(plan, onChunk) : createXlsxBuilder(plan, onChunk);
|
|
60
|
+
//#endregion
|
|
61
|
+
export { columnWidths, createExportBuilder };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { fileShown, isStoredFile } from "../../live/file-values.js";
|
|
2
|
+
import { displayValue } from "../../live/display-value.js";
|
|
3
|
+
//#region src/app/export/cells.ts
|
|
4
|
+
const empty = { kind: "empty" };
|
|
5
|
+
const text = (value) => ({
|
|
6
|
+
kind: "text",
|
|
7
|
+
value
|
|
8
|
+
});
|
|
9
|
+
const isEmpty = (value) => value === null || value === void 0 || value === "";
|
|
10
|
+
const relationLabel = (column, value, labels) => labels[column.name]?.[String(value)] ?? String(value);
|
|
11
|
+
const fileText = (value, mode) => {
|
|
12
|
+
if (!isStoredFile(value)) return String(value);
|
|
13
|
+
return mode === "raw" ? value.uri : fileShown(value)?.name ?? value.uri;
|
|
14
|
+
};
|
|
15
|
+
/** A value as one CSV field: as the list shows it, or as the API sends it, empty for no value. */
|
|
16
|
+
const csvText = (column, value, labels, mode) => {
|
|
17
|
+
if (isEmpty(value)) return "";
|
|
18
|
+
const { field, hints } = column;
|
|
19
|
+
if (field.type === "file") return fileText(value, mode);
|
|
20
|
+
if (field.type === "relation") return mode === "shown" ? relationLabel(column, value, labels) : String(value);
|
|
21
|
+
if (mode === "shown") return displayValue(field, value, hints);
|
|
22
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
23
|
+
return String(value);
|
|
24
|
+
};
|
|
25
|
+
const excelEpochDays = 25569;
|
|
26
|
+
const msPerDay = 864e5;
|
|
27
|
+
const excelSerial = (ms) => ms / msPerDay + excelEpochDays;
|
|
28
|
+
const dateFormats = {
|
|
29
|
+
shown: {
|
|
30
|
+
date: "d mmm yyyy",
|
|
31
|
+
timestamp: "d mmm yyyy, hh:mm"
|
|
32
|
+
},
|
|
33
|
+
raw: {
|
|
34
|
+
date: "yyyy-mm-dd",
|
|
35
|
+
timestamp: "yyyy-mm-dd hh:mm:ss"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const literal = (affix) => [...affix ?? ""].map((char) => `\\${char}`).join("");
|
|
39
|
+
/** The Excel number format that shows a number as the list does: its decimals, prefix and suffix, or a percent sign. */
|
|
40
|
+
const numberFormat = (hints) => {
|
|
41
|
+
if (hints.format === "percent") return "General\\%";
|
|
42
|
+
const digits = hints.decimals === void 0 ? "General" : hints.decimals > 0 ? `#,##0.${"0".repeat(hints.decimals)}` : "#,##0";
|
|
43
|
+
const code = `${literal(hints.prefix)}${digits}${literal(hints.suffix)}`;
|
|
44
|
+
return code === "General" ? void 0 : code;
|
|
45
|
+
};
|
|
46
|
+
const numberCell = (column, value, mode) => {
|
|
47
|
+
const number = Number(value);
|
|
48
|
+
if (!Number.isFinite(number)) return text(String(value));
|
|
49
|
+
if (column.field.type === "bigint" && !Number.isSafeInteger(number)) return text(String(value));
|
|
50
|
+
const format = mode === "shown" ? numberFormat(column.hints) : void 0;
|
|
51
|
+
return format ? {
|
|
52
|
+
kind: "number",
|
|
53
|
+
value: number,
|
|
54
|
+
format
|
|
55
|
+
} : {
|
|
56
|
+
kind: "number",
|
|
57
|
+
value: number
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const dateCell = (type, value, mode) => {
|
|
61
|
+
const ms = Date.parse(String(value));
|
|
62
|
+
if (Number.isNaN(ms)) return text(String(value));
|
|
63
|
+
return {
|
|
64
|
+
kind: "number",
|
|
65
|
+
value: excelSerial(ms),
|
|
66
|
+
format: dateFormats[mode][type]
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/** A value as one typed Excel cell: numbers, dates and booleans as such, labels or stored values as text. */
|
|
70
|
+
const xlsxCell = (column, value, labels, mode) => {
|
|
71
|
+
if (isEmpty(value)) return empty;
|
|
72
|
+
const { field } = column;
|
|
73
|
+
switch (field.type) {
|
|
74
|
+
case "boolean": return {
|
|
75
|
+
kind: "boolean",
|
|
76
|
+
value: Boolean(value)
|
|
77
|
+
};
|
|
78
|
+
case "integer":
|
|
79
|
+
case "bigint":
|
|
80
|
+
case "decimal": return numberCell(column, value, mode);
|
|
81
|
+
case "date":
|
|
82
|
+
case "timestamp": return dateCell(field.type, value, mode);
|
|
83
|
+
case "relation":
|
|
84
|
+
if (mode === "shown") return text(relationLabel(column, value, labels));
|
|
85
|
+
return typeof value === "number" ? {
|
|
86
|
+
kind: "number",
|
|
87
|
+
value
|
|
88
|
+
} : text(String(value));
|
|
89
|
+
default: return text(csvText(column, value, labels, mode));
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
export { csvText, numberFormat, xlsxCell };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/app/export/csv.ts
|
|
2
|
+
/** The UTF-8 byte order mark, which makes Excel read a CSV file as UTF-8 instead of the system's code page. */
|
|
3
|
+
const utf8Bom = new Uint8Array([
|
|
4
|
+
239,
|
|
5
|
+
187,
|
|
6
|
+
191
|
|
7
|
+
]);
|
|
8
|
+
const needsQuotes = /[",\r\n]/;
|
|
9
|
+
const formulaStart = /^[=+\-@\t\r]/;
|
|
10
|
+
/** One field as RFC 4180 writes it: in double quotes, its quotes doubled, when it holds a comma, quote or line break. */
|
|
11
|
+
const csvField = (value) => needsQuotes.test(value) ? `"${value.replaceAll("\"", "\"\"")}"` : value;
|
|
12
|
+
/** Text from a text field, kept from running as a formula in a spreadsheet. */
|
|
13
|
+
const csvTextField = (value) => csvField(formulaStart.test(value) ? `'${value}` : value);
|
|
14
|
+
/** One record, CRLF-terminated as RFC 4180 has it. */
|
|
15
|
+
const csvLine = (fields) => `${fields.join(",")}\r\n`;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { csvField, csvLine, csvTextField, utf8Bom };
|