@dudousxd/nestjs-catalog-react 0.36.0 → 0.37.0
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/{LICENSE-bklit → LICENSE} +1 -1
- package/README.md +11 -3
- package/THIRD_PARTY_NOTICES.md +34 -0
- package/dist/CatalogManager.d.ts +21 -1
- package/dist/CatalogManager.js +67 -25
- package/dist/EditableField.d.ts +7 -1
- package/dist/EditableField.js +7 -1
- package/dist/LoadExpectationSection.d.ts +7 -1
- package/dist/LoadExpectationSection.js +5 -5
- package/dist/ObjectExplorer.d.ts +16 -1
- package/dist/ObjectExplorer.js +18 -4
- package/dist/charts/bklit/animation.d.ts +1 -1
- package/dist/charts/bklit/area-chart-loading.js +1 -1
- package/dist/charts/bklit/area-chart.js +1 -1
- package/dist/charts/bklit/area-gradient-defs.d.ts +1 -1
- package/dist/charts/bklit/area-gradient-defs.js +1 -1
- package/dist/charts/bklit/area.js +1 -1
- package/dist/charts/bklit/bar-chart-loading.js +1 -1
- package/dist/charts/bklit/bar-chart.js +1 -1
- package/dist/charts/bklit/bar-depth-geometry.d.ts +1 -1
- package/dist/charts/bklit/bar-depth-geometry.js +1 -1
- package/dist/charts/bklit/bar-squares-layout.d.ts +1 -1
- package/dist/charts/bklit/bar-x-axis.js +1 -1
- package/dist/charts/bklit/bar-y-axis.js +1 -1
- package/dist/charts/bklit/chart-child-passthrough.d.ts +1 -1
- package/dist/charts/bklit/chart-child-passthrough.js +1 -1
- package/dist/charts/bklit/chart-config-context.d.ts +1 -1
- package/dist/charts/bklit/chart-config-context.js +1 -1
- package/dist/charts/bklit/chart-context.d.ts +1 -1
- package/dist/charts/bklit/chart-defs.d.ts +1 -1
- package/dist/charts/bklit/chart-defs.js +1 -1
- package/dist/charts/bklit/chart-formatters.d.ts +1 -1
- package/dist/charts/bklit/chart-formatters.js +1 -1
- package/dist/charts/bklit/chart-legend-hover.d.ts +1 -1
- package/dist/charts/bklit/chart-legend-hover.js +1 -1
- package/dist/charts/bklit/chart-loading-label.js +1 -1
- package/dist/charts/bklit/chart-phase.d.ts +1 -1
- package/dist/charts/bklit/chart-reveal-clip.d.ts +1 -1
- package/dist/charts/bklit/dash-tail-stroke.js +1 -1
- package/dist/charts/bklit/decimate-time-series.d.ts +1 -1
- package/dist/charts/bklit/decimate-time-series.js +1 -1
- package/dist/charts/bklit/fade-edges.d.ts +1 -1
- package/dist/charts/bklit/filter-data-by-x-domain.d.ts +1 -1
- package/dist/charts/bklit/filter-data-by-x-domain.js +1 -1
- package/dist/charts/bklit/generate-chart-skeleton-data.d.ts +1 -1
- package/dist/charts/bklit/generate-chart-skeleton-data.js +1 -1
- package/dist/charts/bklit/grid.js +1 -1
- package/dist/charts/bklit/highlight-segment-bounds.d.ts +1 -1
- package/dist/charts/bklit/highlight-segment.d.ts +1 -1
- package/dist/charts/bklit/highlight-segment.js +1 -1
- package/dist/charts/bklit/indicator-fade.d.ts +1 -1
- package/dist/charts/bklit/line-chart-loading.js +1 -1
- package/dist/charts/bklit/line-chart.js +1 -1
- package/dist/charts/bklit/line-loading-pulse.js +1 -1
- package/dist/charts/bklit/line-loading-timing.d.ts +1 -1
- package/dist/charts/bklit/line-loading-timing.js +1 -1
- package/dist/charts/bklit/line-series-terminal-marker.js +1 -1
- package/dist/charts/bklit/line.js +1 -1
- package/dist/charts/bklit/loading-sweep.js +1 -1
- package/dist/charts/bklit/motion-utils.d.ts +1 -1
- package/dist/charts/bklit/path-stroke-utils.d.ts +1 -1
- package/dist/charts/bklit/path-stroke-utils.js +1 -1
- package/dist/charts/bklit/pattern-area.js +1 -1
- package/dist/charts/bklit/pattern-preset.d.ts +1 -1
- package/dist/charts/bklit/projection-config.d.ts +1 -1
- package/dist/charts/bklit/projection-config.js +1 -1
- package/dist/charts/bklit/projection-line-end-marker.js +1 -1
- package/dist/charts/bklit/projection-line.js +1 -1
- package/dist/charts/bklit/projection-utils.d.ts +1 -1
- package/dist/charts/bklit/reference-area-config.d.ts +1 -1
- package/dist/charts/bklit/reference-area-config.js +1 -1
- package/dist/charts/bklit/reference-area-registration-context.js +1 -1
- package/dist/charts/bklit/series-bar-layout.d.ts +1 -1
- package/dist/charts/bklit/series-bar-layout.js +1 -1
- package/dist/charts/bklit/series-dash-tail-overlay.js +1 -1
- package/dist/charts/bklit/series-highlight-layer.d.ts +1 -1
- package/dist/charts/bklit/series-hover-dim.js +1 -1
- package/dist/charts/bklit/series-markers.js +1 -1
- package/dist/charts/bklit/series-path-utils.js +1 -1
- package/dist/charts/bklit/static-chart-preview-context.d.ts +1 -1
- package/dist/charts/bklit/static-chart-preview-context.js +1 -1
- package/dist/charts/bklit/time-series-chart-shell.js +1 -1
- package/dist/charts/bklit/tooltip/chart-tooltip.js +1 -1
- package/dist/charts/bklit/tooltip/date-ticker.js +1 -1
- package/dist/charts/bklit/tooltip/index.d.ts +1 -1
- package/dist/charts/bklit/tooltip/index.js +1 -1
- package/dist/charts/bklit/tooltip/tooltip-box.d.ts +1 -1
- package/dist/charts/bklit/tooltip/tooltip-box.js +1 -1
- package/dist/charts/bklit/tooltip/tooltip-content.d.ts +1 -1
- package/dist/charts/bklit/tooltip/tooltip-dot.js +1 -1
- package/dist/charts/bklit/tooltip/tooltip-indicator.js +1 -1
- package/dist/charts/bklit/use-animated-series-path.js +1 -1
- package/dist/charts/bklit/use-animated-y-domains.js +1 -1
- package/dist/charts/bklit/use-chart-interaction.js +1 -1
- package/dist/charts/bklit/use-chart-phase-orchestrator.js +1 -1
- package/dist/charts/bklit/use-enter-complete.d.ts +1 -1
- package/dist/charts/bklit/use-grid-shimmer.js +1 -1
- package/dist/charts/bklit/use-highlight-segment.d.ts +1 -1
- package/dist/charts/bklit/use-highlight-segment.js +1 -1
- package/dist/charts/bklit/use-mount-progress.d.ts +1 -1
- package/dist/charts/bklit/use-mount-progress.js +1 -1
- package/dist/charts/bklit/use-scheduled-tooltip.js +1 -1
- package/dist/charts/bklit/visx-pattern.d.ts +1 -1
- package/dist/charts/bklit/visx-pattern.js +1 -1
- package/dist/charts/bklit/x-axis.js +1 -1
- package/dist/charts/bklit/y-axis-scales.d.ts +1 -1
- package/dist/charts/bklit/y-axis-scales.js +1 -1
- package/dist/charts/bklit/y-axis-ticks.d.ts +1 -1
- package/dist/charts/bklit/y-axis-ticks.js +1 -1
- package/dist/charts/bklit/y-domain-utils.js +1 -1
- package/dist/charts/bklit.js +1 -1
- package/dist/charts/components/shimmering-text.d.ts +1 -1
- package/dist/charts/components/shimmering-text.js +1 -1
- package/dist/manager.d.ts +13 -0
- package/dist/manager.js +13 -0
- package/dist/ui/rich-text-field.d.ts +3 -1
- package/dist/ui/rich-text-field.js +4 -1
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -37,9 +37,16 @@ Requires a `QueryClientProvider` from `@tanstack/react-query` above it.
|
|
|
37
37
|
- **`<CatalogManager />`** — browse types by group, see every property beside the
|
|
38
38
|
column it came from, and edit labels, descriptions and units inline. Edits are
|
|
39
39
|
presentation-only; nothing here can reach a migration.
|
|
40
|
+
`canEdit={false}` shows the same screen read-only (no editors, no Hide/Show, no
|
|
41
|
+
**Reset edits**, no writes), and `pipeline={false}` leaves out the **Loaded by**
|
|
42
|
+
and **Load expectation** sections, which read the host's pipeline endpoints.
|
|
43
|
+
Import it from `@dudousxd/nestjs-catalog-react/manager` to pull in this screen
|
|
44
|
+
alone.
|
|
40
45
|
- **`<ObjectExplorer />`** — one table for every type in the catalog. Columns,
|
|
41
46
|
labels, alignment and units all arrive with the data, so it knows nothing about
|
|
42
47
|
your domain.
|
|
48
|
+
`search={false}` leaves out the search box for a server that cannot search,
|
|
49
|
+
and `rowCountCap={10_000}` shows a count the server capped as "10,000+ rows".
|
|
43
50
|
- **`<QueryConsole />`**, **`<DashboardBoard />`** — SQL over the published
|
|
44
51
|
snapshots, saved queries, and cards built from them.
|
|
45
52
|
- **`<GovernanceTimeline />`**, **`<TraceExplorer />`** — what happened, flat and
|
|
@@ -331,8 +338,8 @@ The chart components under `src/charts/bklit/` (and
|
|
|
331
338
|
`src/charts/components/shimmering-text.tsx`) are vendored from
|
|
332
339
|
[**bklit-ui**](https://github.com/bklit/bklit-ui), Copyright (c) 2026 uixmat,
|
|
333
340
|
released under the **MIT licence**. The full licence text ships with this
|
|
334
|
-
package
|
|
335
|
-
header naming its origin.
|
|
341
|
+
package in [`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md), and every
|
|
342
|
+
vendored file carries a header naming its origin.
|
|
336
343
|
|
|
337
344
|
They are vendored rather than depended on because bklit-ui is a shadcn-style
|
|
338
345
|
registry — components you own, not a package you install. The only local change
|
|
@@ -342,4 +349,5 @@ upstream stays a diff rather than a merge.
|
|
|
342
349
|
|
|
343
350
|
## License
|
|
344
351
|
|
|
345
|
-
MIT
|
|
352
|
+
MIT, in [`LICENSE`](./LICENSE). The vendored bklit-ui components keep their own MIT
|
|
353
|
+
licence, in [`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@dudousxd/nestjs-catalog-react` is licensed under the MIT licence in `LICENSE`, copyright Davide
|
|
4
|
+
Carvalho. It also ships code vendored from the projects below, each under its own licence. That
|
|
5
|
+
code keeps its original copyright, and each vendored file names its source in its header.
|
|
6
|
+
|
|
7
|
+
## bklit-ui
|
|
8
|
+
|
|
9
|
+
Source: https://github.com/bklit/bklit-ui. Vendored into `src/charts/` (mostly
|
|
10
|
+
`src/charts/bklit/`), shipped in `dist/charts/`. Only the `./bklit` entry reaches this code.
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
MIT License
|
|
14
|
+
|
|
15
|
+
Copyright (c) 2026 uixmat
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
SOFTWARE.
|
|
34
|
+
```
|
package/dist/CatalogManager.d.ts
CHANGED
|
@@ -29,6 +29,26 @@ export interface CatalogManagerProps {
|
|
|
29
29
|
/** Heading copy, so the host can call this whatever its users call it. */
|
|
30
30
|
title?: string;
|
|
31
31
|
eyebrow?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Defaults to a sentence that matches `canEdit`: an invitation to rename
|
|
34
|
+
* things on an editable screen, a plain description on a read-only one.
|
|
35
|
+
*/
|
|
32
36
|
intro?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Set false where the viewer is known to be read-only. Every curated field
|
|
39
|
+
* (name, description, group, plural, icon, unit, link labels) renders as plain
|
|
40
|
+
* text, the Hide/Show toggle and **Reset edits** are not offered, and nothing
|
|
41
|
+
* on the screen issues a write. The endpoints refuse regardless; this only
|
|
42
|
+
* stops the screen offering edits that always fail. The same prop, with the
|
|
43
|
+
* same meaning, as on `PipelineConsole` and `WorkflowCanvas`.
|
|
44
|
+
*/
|
|
45
|
+
canEdit?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Set false to leave out the two sections served by the HOST's pipeline
|
|
48
|
+
* endpoints — **Loaded by** and **Load expectation** — for a host that does
|
|
49
|
+
* not mount them, or a screen that should show the model alone. Neither
|
|
50
|
+
* section is rendered and neither endpoint is requested.
|
|
51
|
+
*/
|
|
52
|
+
pipeline?: boolean;
|
|
33
53
|
}
|
|
34
|
-
export declare function CatalogManager({ type: typeProp, explorerHref, workflowHref, title, eyebrow, intro, }: CatalogManagerProps): import("react").JSX.Element;
|
|
54
|
+
export declare function CatalogManager({ type: typeProp, explorerHref, workflowHref, title, eyebrow, canEdit, pipeline, intro, }: CatalogManagerProps): import("react").JSX.Element;
|
package/dist/CatalogManager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
|
-
import { ArrowLeft, ArrowRight, ArrowUpRight, Eye, EyeOff, RotateCcw, Search, Unlink, } from 'lucide-react';
|
|
3
|
+
import { ArrowLeft, ArrowRight, ArrowUpRight, Eye, EyeOff, RotateCcw, Search, Unlink, X, } from 'lucide-react';
|
|
4
4
|
import { useEffect, useMemo, useState } from 'react';
|
|
5
5
|
import { CoverageLedger } from './CoverageLedger.js';
|
|
6
6
|
import { EditableField } from './EditableField.js';
|
|
@@ -37,7 +37,9 @@ const HAIRLINE = 'border-zinc-100 dark:border-zinc-900';
|
|
|
37
37
|
function ScalarBadge({ type }) {
|
|
38
38
|
return (_jsx("span", { className: cn('rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider dark:bg-zinc-800', TYPE_TONE[type]), children: type }));
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
const EDITABLE_INTRO = 'Every object type the system already holds, derived from the ORM. Names, descriptions and units are yours to change — none of it touches the database.';
|
|
41
|
+
const READ_ONLY_INTRO = 'Every object type the system already holds, derived from the ORM, with the names, descriptions and units people have given them.';
|
|
42
|
+
export function CatalogManager({ type: typeProp, explorerHref, workflowHref, title = 'Catalog', eyebrow = 'Semantic layer', canEdit = true, pipeline = true, intro = canEdit ? EDITABLE_INTRO : READ_ONLY_INTRO, }) {
|
|
41
43
|
const client = useCatalogClient();
|
|
42
44
|
const queryClient = useQueryClient();
|
|
43
45
|
const { data, isLoading, isError } = useQuery({
|
|
@@ -48,6 +50,21 @@ export function CatalogManager({ type: typeProp, explorerHref, workflowHref, tit
|
|
|
48
50
|
const [selectedName, setSelectedName] = useSelectedType(typeProp);
|
|
49
51
|
const [filter, setFilter] = useState('');
|
|
50
52
|
const [onlyUnnamed, setOnlyUnnamed] = useState(false);
|
|
53
|
+
/**
|
|
54
|
+
* The last edit the server refused, said out loud.
|
|
55
|
+
*
|
|
56
|
+
* Edits are not applied optimistically — the snapshot changes only when the
|
|
57
|
+
* server answers — so a refused edit leaves the field showing its old value.
|
|
58
|
+
* Without this, that read as the screen quietly undoing what somebody typed.
|
|
59
|
+
*/
|
|
60
|
+
const [editError, setEditError] = useState(null);
|
|
61
|
+
function refused(what) {
|
|
62
|
+
return (error) => setEditError(`${what} was not saved${error instanceof Error && error.message ? `: ${error.message}` : '.'}`);
|
|
63
|
+
}
|
|
64
|
+
function saved(updated) {
|
|
65
|
+
setEditError(null);
|
|
66
|
+
applyToSnapshot(updated);
|
|
67
|
+
}
|
|
51
68
|
/** Presentation edits should feel like typing, not like saving. */
|
|
52
69
|
function applyToSnapshot(updated) {
|
|
53
70
|
if (!updated || typeof updated !== 'object' || !('name' in updated))
|
|
@@ -66,15 +83,21 @@ export function CatalogManager({ type: typeProp, explorerHref, workflowHref, tit
|
|
|
66
83
|
}
|
|
67
84
|
const typeMutation = useMutation({
|
|
68
85
|
mutationFn: ({ name, patch }) => client.patchType(name, patch),
|
|
69
|
-
onSuccess:
|
|
86
|
+
onSuccess: saved,
|
|
87
|
+
onError: refused('That edit'),
|
|
70
88
|
});
|
|
71
89
|
const propertyMutation = useMutation({
|
|
72
90
|
mutationFn: ({ name, property, patch, }) => client.patchProperty(name, property, patch),
|
|
73
|
-
onSuccess:
|
|
91
|
+
onSuccess: saved,
|
|
92
|
+
onError: refused('That edit'),
|
|
74
93
|
});
|
|
75
94
|
const resetMutation = useMutation({
|
|
76
95
|
mutationFn: () => client.reset(),
|
|
77
|
-
onSuccess: (snapshot) =>
|
|
96
|
+
onSuccess: (snapshot) => {
|
|
97
|
+
setEditError(null);
|
|
98
|
+
queryClient.setQueryData(catalogQueryKeys.snapshot, snapshot);
|
|
99
|
+
},
|
|
100
|
+
onError: refused('The reset'),
|
|
78
101
|
});
|
|
79
102
|
const types = useMemo(() => data?.types ?? [], [data]);
|
|
80
103
|
/**
|
|
@@ -115,15 +138,25 @@ export function CatalogManager({ type: typeProp, explorerHref, workflowHref, tit
|
|
|
115
138
|
if (isError || !data) {
|
|
116
139
|
return (_jsx("div", { className: "flex h-full items-center justify-center px-6", children: _jsxs("div", { className: "max-w-md text-center", children: [_jsx("h2", { className: "text-lg font-medium", children: "The catalog did not load" }), _jsx("p", { className: cn('mt-1 text-sm', SECONDARY), children: "The server builds it from ORM metadata at boot. Check that the API is reachable and that your account may read it." })] }) }));
|
|
117
140
|
}
|
|
118
|
-
return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full flex-col bg-zinc-50 dark:bg-zinc-950", children: [_jsxs("header", { className: cn('shrink-0 border-b px-8 py-6', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-6", children: [_jsxs("div", { children: [_jsx("p", { className: cn('font-mono text-[11px] uppercase tracking-[0.18em]', MUTED), children: eyebrow }), _jsx("h1", { className: "mt-1 text-2xl font-semibold tracking-tight", children: title }), _jsx("p", { className: cn('mt-1 max-w-xl text-sm', SECONDARY), children: intro })] }), _jsxs("div", { className: "flex items-center gap-6", children: [_jsx(Stat, { label: "Types", value: data.stats.types }), _jsx(Stat, { label: "Properties", value: data.stats.properties }), _jsx(Tooltip, { content: "Relations declared across every type. A link declared at both ends counts twice \u2014 the graph draws it once.", children: _jsx("span", { className: "cursor-help", children: _jsx(Stat, { label: "Relations", value: data.stats.relations }) }) }), _jsxs("button", { type: "button", onClick: () => resetMutation.mutate(), disabled: resetMutation.isPending, className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, SECONDARY, 'transition-colors hover:bg-zinc-50 disabled:opacity-50 dark:hover:bg-zinc-800'), children: [_jsx(RotateCcw, { size: 13 }), "Reset edits"] })] })] }), _jsx("div", { className: "mt-6", children: _jsx(CoverageLedger, { types: types, selected: selected?.name, onSelect: setSelectedName }) })] }), _jsxs("div", { className: "flex min-h-0 flex-1", children: [_jsxs("aside", { className: cn('flex w-72 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsxs("div", { className: cn('shrink-0 space-y-2 border-b p-3', HAIRLINE), children: [_jsxs("div", { className: "relative", children: [_jsx(Search, { size: 14, className: cn('pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2', MUTED) }), _jsx("input", { type: "text", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: "Find a type or table", "aria-label": "Filter object types", className: cn('w-full rounded-md border bg-zinc-50 py-1.5 pl-8 pr-2 text-sm outline-none dark:bg-zinc-950', RULE, 'placeholder:text-zinc-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/15') })] }), _jsxs("label", { className: cn('flex cursor-pointer items-center gap-2 px-0.5 text-xs', SECONDARY), children: [_jsx("input", { type: "checkbox", checked: onlyUnnamed, onChange: (e) => setOnlyUnnamed(e.target.checked), className: "accent-amber-500" }), "Only types nobody has named"] })] }), _jsxs("nav", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [grouped.length === 0 && (_jsxs("p", { className: cn('px-2 py-6 text-center text-xs', MUTED), children: ["Nothing matches \u201C", filter, "\u201D."] })), grouped.map(([group, groupTypes]) => (_jsxs("div", { className: "mb-3", children: [_jsxs("div", { className: "flex items-baseline justify-between px-2 py-1", children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: group }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: groupTypes.length })] }), groupTypes.map((type) => (_jsxs("button", { type: "button", onClick: () => setSelectedName(type.name), className: cn('group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors', selected?.name === type.name
|
|
141
|
+
return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full flex-col bg-zinc-50 dark:bg-zinc-950", children: [_jsxs("header", { className: cn('shrink-0 border-b px-8 py-6', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-6", children: [_jsxs("div", { children: [_jsx("p", { className: cn('font-mono text-[11px] uppercase tracking-[0.18em]', MUTED), children: eyebrow }), _jsx("h1", { className: "mt-1 text-2xl font-semibold tracking-tight", children: title }), _jsx("p", { className: cn('mt-1 max-w-xl text-sm', SECONDARY), children: intro })] }), _jsxs("div", { className: "flex items-center gap-6", children: [_jsx(Stat, { label: "Types", value: data.stats.types }), _jsx(Stat, { label: "Properties", value: data.stats.properties }), _jsx(Tooltip, { content: "Relations declared across every type. A link declared at both ends counts twice \u2014 the graph draws it once.", children: _jsx("span", { className: "cursor-help", children: _jsx(Stat, { label: "Relations", value: data.stats.relations }) }) }), canEdit && (_jsxs("button", { type: "button", onClick: () => resetMutation.mutate(), disabled: resetMutation.isPending, className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, SECONDARY, 'transition-colors hover:bg-zinc-50 disabled:opacity-50 dark:hover:bg-zinc-800'), children: [_jsx(RotateCcw, { size: 13 }), "Reset edits"] }))] })] }), editError && (_jsxs("div", { role: "alert", className: cn('mt-4 flex items-start justify-between gap-3 rounded-md border px-3 py-2 text-sm', 'border-rose-200 bg-rose-50 text-rose-800', 'dark:border-rose-900 dark:bg-rose-950/40 dark:text-rose-200'), children: [_jsx("span", { children: editError }), _jsx("button", { type: "button", onClick: () => setEditError(null), "aria-label": "Dismiss", className: "shrink-0 rounded-sm p-0.5 hover:bg-rose-100 dark:hover:bg-rose-900", children: _jsx(X, { size: 14 }) })] })), _jsx("div", { className: "mt-6", children: _jsx(CoverageLedger, { types: types, selected: selected?.name, onSelect: setSelectedName }) })] }), _jsxs("div", { className: "flex min-h-0 flex-1", children: [_jsxs("aside", { className: cn('flex w-72 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsxs("div", { className: cn('shrink-0 space-y-2 border-b p-3', HAIRLINE), children: [_jsxs("div", { className: "relative", children: [_jsx(Search, { size: 14, className: cn('pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2', MUTED) }), _jsx("input", { type: "text", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: "Find a type or table", "aria-label": "Filter object types", className: cn('w-full rounded-md border bg-zinc-50 py-1.5 pl-8 pr-2 text-sm outline-none dark:bg-zinc-950', RULE, 'placeholder:text-zinc-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/15') })] }), _jsxs("label", { className: cn('flex cursor-pointer items-center gap-2 px-0.5 text-xs', SECONDARY), children: [_jsx("input", { type: "checkbox", checked: onlyUnnamed, onChange: (e) => setOnlyUnnamed(e.target.checked), className: "accent-amber-500" }), "Only types nobody has named"] })] }), _jsxs("nav", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [grouped.length === 0 && (_jsxs("p", { className: cn('px-2 py-6 text-center text-xs', MUTED), children: ["Nothing matches \u201C", filter, "\u201D."] })), grouped.map(([group, groupTypes]) => (_jsxs("div", { className: "mb-3", children: [_jsxs("div", { className: "flex items-baseline justify-between px-2 py-1", children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: group }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: groupTypes.length })] }), groupTypes.map((type) => (_jsxs("button", { type: "button", onClick: () => setSelectedName(type.name), className: cn('group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors', selected?.name === type.name
|
|
119
142
|
? 'bg-sky-100 dark:bg-sky-950'
|
|
120
|
-
: 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx("span", { "aria-hidden": true, className: cn('h-1.5 w-1.5 shrink-0 rounded-full', type.enriched ? 'bg-emerald-500' : 'bg-amber-400/60') }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "block truncate text-sm", children: [type.icon ? `${type.icon} ` : '', type.displayName] }), _jsxs("span", { className: cn('block truncate font-mono text-[10px]', MUTED), children: [type.tableName, _jsx(FreshnessNote, { type: type })] })] })] }, type.name)))] }, group)))] })] }), _jsxs("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [missing && _jsx(NoSuchType, { name: missing }), selected && (_jsx(TypeDetail, { type: selected, workflowHref: workflowHref,
|
|
143
|
+
: 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx("span", { "aria-hidden": true, className: cn('h-1.5 w-1.5 shrink-0 rounded-full', type.enriched ? 'bg-emerald-500' : 'bg-amber-400/60') }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "block truncate text-sm", children: [type.icon ? `${type.icon} ` : '', type.displayName] }), _jsxs("span", { className: cn('block truncate font-mono text-[10px]', MUTED), children: [type.tableName, _jsx(FreshnessNote, { type: type })] })] })] }, type.name)))] }, group)))] })] }), _jsxs("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [missing && _jsx(NoSuchType, { name: missing }), selected && (_jsx(TypeDetail, { type: selected, canEdit: canEdit, pipeline: pipeline, workflowHref: workflowHref,
|
|
121
144
|
// The whole catalog, so the detail pane can answer what points
|
|
122
145
|
// AT this type. Nothing on a type records its inbound links —
|
|
123
146
|
// one row per declaration, and the declaration lives on the
|
|
124
147
|
// other end — so the only place that question can be answered
|
|
125
148
|
// is somewhere holding every type.
|
|
126
|
-
types: types, explorerHref: explorerHref,
|
|
149
|
+
types: types, explorerHref: explorerHref,
|
|
150
|
+
// Guarded here as well as by every control being absent: a
|
|
151
|
+
// read-only screen must not be able to write even if a child
|
|
152
|
+
// forgets to honour `canEdit`.
|
|
153
|
+
onPatchType: (patch) => {
|
|
154
|
+
if (canEdit)
|
|
155
|
+
typeMutation.mutate({ name: selected.name, patch });
|
|
156
|
+
}, onPatchProperty: (property, patch) => {
|
|
157
|
+
if (canEdit)
|
|
158
|
+
propertyMutation.mutate({ name: selected.name, property, patch });
|
|
159
|
+
}, onNavigate: setSelectedName }, selected.name))] })] })] }) }));
|
|
127
160
|
}
|
|
128
161
|
/**
|
|
129
162
|
* Which type this screen is showing, and how it gets chosen.
|
|
@@ -177,9 +210,11 @@ function NoSuchType({ name }) {
|
|
|
177
210
|
function Stat({ label, value }) {
|
|
178
211
|
return (_jsxs("div", { className: "text-right", children: [_jsx("div", { className: "font-mono text-xl leading-none tabular-nums", children: value }), _jsx("div", { className: cn('mt-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: label })] }));
|
|
179
212
|
}
|
|
180
|
-
function TypeDetail({ type, types, explorerHref, workflowHref, onPatchType, onPatchProperty, onNavigate, }) {
|
|
213
|
+
function TypeDetail({ type, types, explorerHref, workflowHref, canEdit, pipeline, onPatchType, onPatchProperty, onNavigate, }) {
|
|
181
214
|
const visible = type.properties.filter((p) => !p.hidden).length;
|
|
182
|
-
return (_jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("span", { className: "text-2xl leading-none", children: type.icon ?? '◈' }), _jsx(EditableField, { label: "display name", value: type.displayName, onSave: (displayName) => onPatchType({ displayName }), className: "text-2xl font-semibold tracking-tight", inputClassName: "text-2xl font-semibold tracking-tight" })] }), _jsxs("div", { className: cn('mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 pl-1 font-mono text-[11px]', MUTED), children: [_jsx("span", { children: type.name }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { children: type.tableName }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: ["pk ", type.primaryKey.join(', ') || 'none'] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: [visible, " of ", type.properties.length, " shown"] })] })] }), explorerHref && (_jsxs("a", { href: explorerHref(type.name), className: cn('flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-2 text-xs text-zinc-50', 'transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-950 dark:hover:bg-zinc-300'), children: ["Open ", type.pluralDisplayName, _jsx(ArrowUpRight, { size: 13 })] }))] }), _jsx("div", { className: "mt-5 border-l-2 border-sky-200 pl-4 dark:border-sky-900", children: _jsx(RichTextField, { label: "description", value: type.description ?? '', placeholder: "No one has written down what this type means yet.", onSave: (description) => onPatchType({ description }), className: cn('text-sm leading-relaxed', SECONDARY) }) }), _jsxs("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [_jsx(FieldChip, { label: "Group", value: type.group, onSave: (group) => onPatchType({ group }) }), _jsx(FieldChip, { label: "Plural", value: type.pluralDisplayName, onSave: (pluralDisplayName) => onPatchType({ pluralDisplayName }) }), _jsx(FieldChip, { label: "Icon", value: type.icon ?? '', onSave: (icon) => onPatchType({ icon }) })] }), _jsxs("section", { className: "mt-10", children: [_jsx(SectionHeading, { title: "Properties", note:
|
|
215
|
+
return (_jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("span", { className: "text-2xl leading-none", children: type.icon ?? '◈' }), _jsx(EditableField, { label: "display name", value: type.displayName, onSave: (displayName) => onPatchType({ displayName }), readOnly: !canEdit, className: "text-2xl font-semibold tracking-tight", inputClassName: "text-2xl font-semibold tracking-tight" })] }), _jsxs("div", { className: cn('mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 pl-1 font-mono text-[11px]', MUTED), children: [_jsx("span", { children: type.name }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { children: type.tableName }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: ["pk ", type.primaryKey.join(', ') || 'none'] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: [visible, " of ", type.properties.length, " shown"] })] })] }), explorerHref && (_jsxs("a", { href: explorerHref(type.name), className: cn('flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-2 text-xs text-zinc-50', 'transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-950 dark:hover:bg-zinc-300'), children: ["Open ", type.pluralDisplayName, _jsx(ArrowUpRight, { size: 13 })] }))] }), _jsx("div", { className: "mt-5 border-l-2 border-sky-200 pl-4 dark:border-sky-900", children: _jsx(RichTextField, { label: "description", value: type.description ?? '', placeholder: "No one has written down what this type means yet.", onSave: (description) => onPatchType({ description }), readOnly: !canEdit, className: cn('text-sm leading-relaxed', SECONDARY) }) }), _jsxs("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [_jsx(FieldChip, { label: "Group", value: type.group, readOnly: !canEdit, onSave: (group) => onPatchType({ group }) }), _jsx(FieldChip, { label: "Plural", value: type.pluralDisplayName, readOnly: !canEdit, onSave: (pluralDisplayName) => onPatchType({ pluralDisplayName }) }), _jsx(FieldChip, { label: "Icon", value: type.icon ?? '', readOnly: !canEdit, onSave: (icon) => onPatchType({ icon }) })] }), _jsxs("section", { className: "mt-10", children: [_jsx(SectionHeading, { title: "Properties", note: canEdit
|
|
216
|
+
? 'The column and its SQL type are read from the ORM. The label, description and unit are yours.'
|
|
217
|
+
: 'The column and its SQL type are read from the ORM. The label, description and unit were written by people.' }), _jsx("div", { className: cn('overflow-hidden rounded-lg border', RULE, PANEL), children: _jsx(PropertyTable, { properties: type.properties, canEdit: canEdit, onPatchProperty: onPatchProperty }) })] }), pipeline && (_jsx(LoadedBySection, { typeName: type.name, displayName: type.displayName, workflowHref: workflowHref })), pipeline && (_jsx(LoadExpectationSection, { typeName: type.name, displayName: type.displayName, canEdit: canEdit })), _jsx(LinkSection, { type: type, types: types, canEdit: canEdit, onPatchProperty: onPatchProperty, onNavigate: onNavigate })] }));
|
|
183
218
|
}
|
|
184
219
|
/** What each kind actually says, for people who do not read `m:n` fluently. */
|
|
185
220
|
const KIND_MEANING = {
|
|
@@ -224,10 +259,12 @@ function inboundLinks(type, types) {
|
|
|
224
259
|
}
|
|
225
260
|
return inbound;
|
|
226
261
|
}
|
|
227
|
-
function LinkSection({ type, types, onPatchProperty, onNavigate, }) {
|
|
262
|
+
function LinkSection({ type, types, canEdit, onPatchProperty, onNavigate, }) {
|
|
228
263
|
const inbound = useMemo(() => inboundLinks(type, types), [type, types]);
|
|
229
264
|
const labelFor = useMemo(() => new Map(types.map((t) => [t.name, t.displayName])), [types]);
|
|
230
|
-
return (_jsxs("section", { className: "mt-10 pb-16", children: [_jsx(SectionHeading, { title: "Links", note:
|
|
265
|
+
return (_jsxs("section", { className: "mt-10 pb-16", children: [_jsx(SectionHeading, { title: "Links", note: canEdit
|
|
266
|
+
? 'Read from the foreign keys. What a link is called is yours to change; where it points is not.'
|
|
267
|
+
: 'Read from the foreign keys.' }), type.relations.length === 0 && inbound.length === 0 ? (_jsxs("p", { className: cn('rounded-lg border border-dashed px-4 py-6 text-center text-sm', RULE, MUTED), children: ["Nothing links to or from ", type.displayName, " yet."] })) : (_jsxs("div", { className: "space-y-5", children: [type.relations.length > 0 && (_jsxs("div", { children: [_jsxs("p", { className: cn('mb-2 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: [type.displayName, " points at"] }), _jsx("ul", { className: "space-y-1.5", children: type.relations.map((relation) => (_jsx(OutboundLink, { relation: relation, targetLabel: labelFor.get(relation.targetType), canEdit: canEdit, onPatchProperty: onPatchProperty, onNavigate: onNavigate }, relation.name))) })] })), inbound.length > 0 && (_jsxs("div", { children: [_jsxs("p", { className: cn('mb-2 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: ["Points at ", type.displayName] }), _jsx("ul", { className: "space-y-1.5", children: inbound.map(({ from, relation }) => (_jsx("li", { children: _jsxs("button", { type: "button", onClick: () => onNavigate(from.name), className: cn('flex w-full items-center gap-2 rounded-md border px-3 py-2 text-left transition-colors', RULE, PANEL, 'hover:border-sky-500 hover:bg-sky-100 dark:hover:bg-sky-950'), children: [_jsx(ArrowLeft, { size: 13, className: MUTED }), _jsx("span", { className: "text-sm", children: from.displayName }), _jsxs("span", { className: cn('font-mono text-[10px]', MUTED), children: [relation.kind, " \u00B7 ", from.name, ".", relation.name] })] }) }, `${from.name}.${relation.name}`))) }), canEdit && (_jsx("p", { className: cn('mt-1.5 text-[11px]', MUTED), children: "Declared on the other type. Open it to rename the link." }))] }))] }))] }));
|
|
231
268
|
}
|
|
232
269
|
/**
|
|
233
270
|
* One link this type declares.
|
|
@@ -237,8 +274,8 @@ function LinkSection({ type, types, onPatchProperty, onNavigate, }) {
|
|
|
237
274
|
* rename a link was to first go somewhere else. A nested interactive element is
|
|
238
275
|
* also the one thing a screen reader cannot describe.
|
|
239
276
|
*/
|
|
240
|
-
function OutboundLink({ relation, targetLabel, onPatchProperty, onNavigate, }) {
|
|
241
|
-
return (_jsxs("li", { className: cn('flex items-center gap-2 rounded-md border px-3 py-2', RULE, PANEL, relation.hidden && 'opacity-45'), children: [_jsx(Tooltip, { content: KIND_MEANING[relation.kind], children: _jsx("span", { className: cn('cursor-help font-mono text-[10px] uppercase tracking-wider', MUTED), children: relation.kind }) }), _jsx("span", { className: "min-w-0 flex-1", children: _jsx(EditableField, { label: `label for ${relation.name}`, value: relation.displayName, onSave: (displayName) => onPatchProperty(relation.name, { displayName }), className: "text-sm", inputClassName: "text-sm" }) }), _jsxs("span", { className: cn('shrink-0 font-mono text-[10px]', MUTED), children: [relation.name, relation.localKey ? ` · ${relation.localKey}` : ''] }), _jsx("span", { className: "shrink-0", children: relation.targetPublished ? (_jsxs("button", { type: "button", onClick: () => onNavigate(relation.targetType), className: cn('flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs transition-colors', SECONDARY, 'hover:bg-sky-100 dark:hover:bg-sky-950'), children: [_jsx(ArrowRight, { size: 13 }), targetLabel ?? relation.targetType] })) : (
|
|
277
|
+
function OutboundLink({ relation, targetLabel, canEdit, onPatchProperty, onNavigate, }) {
|
|
278
|
+
return (_jsxs("li", { className: cn('flex items-center gap-2 rounded-md border px-3 py-2', RULE, PANEL, relation.hidden && 'opacity-45'), children: [_jsx(Tooltip, { content: KIND_MEANING[relation.kind], children: _jsx("span", { className: cn('cursor-help font-mono text-[10px] uppercase tracking-wider', MUTED), children: relation.kind }) }), _jsx("span", { className: "min-w-0 flex-1", children: _jsx(EditableField, { label: `label for ${relation.name}`, value: relation.displayName, onSave: (displayName) => onPatchProperty(relation.name, { displayName }), readOnly: !canEdit, className: "text-sm", inputClassName: "text-sm" }) }), _jsxs("span", { className: cn('shrink-0 font-mono text-[10px]', MUTED), children: [relation.name, relation.localKey ? ` · ${relation.localKey}` : ''] }), _jsx("span", { className: "shrink-0", children: relation.targetPublished ? (_jsxs("button", { type: "button", onClick: () => onNavigate(relation.targetType), className: cn('flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs transition-colors', SECONDARY, 'hover:bg-sky-100 dark:hover:bg-sky-950'), children: [_jsx(ArrowRight, { size: 13 }), targetLabel ?? relation.targetType] })) : (
|
|
242
279
|
// Kept, and marked. Dropping it would leave the type looking less
|
|
243
280
|
// connected than it is; making it navigable would send the reader to
|
|
244
281
|
// a type that is not there — the button used to do exactly that, and
|
|
@@ -248,8 +285,8 @@ function OutboundLink({ relation, targetLabel, onPatchProperty, onNavigate, }) {
|
|
|
248
285
|
function SectionHeading({ title, note }) {
|
|
249
286
|
return (_jsxs("div", { className: "mb-3", children: [_jsx("h2", { className: cn('font-mono text-[11px] uppercase tracking-[0.16em]', MUTED), children: title }), _jsx("p", { className: cn('mt-1 text-xs', MUTED), children: note })] }));
|
|
250
287
|
}
|
|
251
|
-
function FieldChip({ label, value, onSave, }) {
|
|
252
|
-
return (_jsxs("div", { className: cn('flex items-center gap-1.5 rounded-md border px-2 py-1', RULE, PANEL), children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-wider', MUTED), children: label }), _jsx(EditableField, { label: label, value: value, placeholder: "\u2014", onSave: onSave, className: "text-xs", inputClassName: "text-xs" })] }));
|
|
288
|
+
function FieldChip({ label, value, readOnly, onSave, }) {
|
|
289
|
+
return (_jsxs("div", { className: cn('flex items-center gap-1.5 rounded-md border px-2 py-1', RULE, PANEL), children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-wider', MUTED), children: label }), _jsx(EditableField, { label: label, value: value, placeholder: "\u2014", onSave: onSave, readOnly: readOnly, className: "text-xs", inputClassName: "text-xs" })] }));
|
|
253
290
|
}
|
|
254
291
|
/**
|
|
255
292
|
* The properties of one type, as a table.
|
|
@@ -263,13 +300,13 @@ function FieldChip({ label, value, onSave, }) {
|
|
|
263
300
|
* declaring them at all: these cells contain inputs, and a column that sizes to
|
|
264
301
|
* its content reflows the whole table on every keystroke.
|
|
265
302
|
*/
|
|
266
|
-
function PropertyTable({ properties, onPatchProperty, }) {
|
|
303
|
+
function PropertyTable({ properties, canEdit, onPatchProperty, }) {
|
|
267
304
|
const columns = useMemo(() => [
|
|
268
305
|
{
|
|
269
306
|
id: 'label',
|
|
270
307
|
header: 'Label',
|
|
271
308
|
accessorFn: (p) => p.displayName,
|
|
272
|
-
cell: ({ row }) => (_jsx(PropertyLabelCell, { property: row.original, onPatchProperty: onPatchProperty })),
|
|
309
|
+
cell: ({ row }) => (_jsx(PropertyLabelCell, { property: row.original, canEdit: canEdit, onPatchProperty: onPatchProperty })),
|
|
273
310
|
},
|
|
274
311
|
{
|
|
275
312
|
id: 'column',
|
|
@@ -287,21 +324,21 @@ function PropertyTable({ properties, onPatchProperty, }) {
|
|
|
287
324
|
id: 'unit',
|
|
288
325
|
header: 'Unit',
|
|
289
326
|
accessorFn: (p) => p.unit ?? '',
|
|
290
|
-
cell: ({ row }) => (_jsx(EditableField, { label: `unit for ${row.original.name}`, value: row.original.unit ?? '', placeholder: "\u2014", onSave: (unit) => onPatchProperty(row.original.name, { unit }), inputClassName: "text-xs", className: "text-xs" })),
|
|
327
|
+
cell: ({ row }) => (_jsx(EditableField, { label: `unit for ${row.original.name}`, value: row.original.unit ?? '', placeholder: "\u2014", onSave: (unit) => onPatchProperty(row.original.name, { unit }), readOnly: !canEdit, inputClassName: "text-xs", className: "text-xs" })),
|
|
291
328
|
},
|
|
292
329
|
{
|
|
293
330
|
id: 'meaning',
|
|
294
331
|
header: 'Meaning',
|
|
295
332
|
accessorFn: (p) => p.description ?? '',
|
|
296
|
-
cell: ({ row }) => (_jsx(RichTextField, { label: `description for ${row.original.name}`, value: row.original.description ?? '', placeholder: "\u2014", onSave: (description) => onPatchProperty(row.original.name, { description }), className: cn('text-xs leading-snug', SECONDARY) })),
|
|
333
|
+
cell: ({ row }) => (_jsx(RichTextField, { label: `description for ${row.original.name}`, value: row.original.description ?? '', placeholder: "\u2014", onSave: (description) => onPatchProperty(row.original.name, { description }), readOnly: !canEdit, className: cn('text-xs leading-snug', SECONDARY) })),
|
|
297
334
|
},
|
|
298
335
|
{
|
|
299
336
|
id: 'shown',
|
|
300
337
|
header: 'Shown',
|
|
301
338
|
accessorFn: (p) => !p.hidden,
|
|
302
|
-
cell: ({ row }) => (_jsx(VisibilityToggle, { property: row.original, onPatchProperty: onPatchProperty })),
|
|
339
|
+
cell: ({ row }) => (_jsx(VisibilityToggle, { property: row.original, canEdit: canEdit, onPatchProperty: onPatchProperty })),
|
|
303
340
|
},
|
|
304
|
-
], [onPatchProperty]);
|
|
341
|
+
], [onPatchProperty, canEdit]);
|
|
305
342
|
return (_jsx(DataTable, { data: properties, columns: columns, getRowId: (property) => property.name,
|
|
306
343
|
// Dimmed rather than dropped: a hidden property is still stored, and a
|
|
307
344
|
// screen that simply omitted it could not tell you that showing it again
|
|
@@ -320,15 +357,20 @@ const PROPERTY_WIDTHS = {
|
|
|
320
357
|
shown: 'w-[6%] text-right',
|
|
321
358
|
};
|
|
322
359
|
/** The label cell: the curated name, with the physical name and its constraints beneath. */
|
|
323
|
-
function PropertyLabelCell({ property, onPatchProperty, }) {
|
|
324
|
-
return (_jsxs(_Fragment, { children: [_jsx(EditableField, { label: `label for ${property.name}`, value: property.displayName, onSave: (displayName) => onPatchProperty(property.name, { displayName }), inputClassName: "text-sm" }), _jsxs("div", { className: cn('px-1.5 font-mono text-[10px]', MUTED), children: [property.name, property.primary && (_jsx(Tooltip, { content: "Primary key. Always fetched, even when hidden, so a row keeps a stable identity.", children: _jsx("span", { className: "ml-1.5 cursor-help text-sky-600 dark:text-sky-400", children: "pk" }) })), !property.nullable && !property.primary && (_jsx(Tooltip, { content: "NOT NULL in the database. Read from the ORM, not something this screen can change.", children: _jsx("span", { className: "ml-1.5 cursor-help text-amber-600", children: "required" }) }))] })] }));
|
|
360
|
+
function PropertyLabelCell({ property, canEdit, onPatchProperty, }) {
|
|
361
|
+
return (_jsxs(_Fragment, { children: [_jsx(EditableField, { label: `label for ${property.name}`, value: property.displayName, onSave: (displayName) => onPatchProperty(property.name, { displayName }), readOnly: !canEdit, inputClassName: "text-sm" }), _jsxs("div", { className: cn('px-1.5 font-mono text-[10px]', MUTED), children: [property.name, property.primary && (_jsx(Tooltip, { content: "Primary key. Always fetched, even when hidden, so a row keeps a stable identity.", children: _jsx("span", { className: "ml-1.5 cursor-help text-sky-600 dark:text-sky-400", children: "pk" }) })), !property.nullable && !property.primary && (_jsx(Tooltip, { content: "NOT NULL in the database. Read from the ORM, not something this screen can change.", children: _jsx("span", { className: "ml-1.5 cursor-help text-amber-600", children: "required" }) }))] })] }));
|
|
325
362
|
}
|
|
326
363
|
/**
|
|
327
364
|
* Hiding is presentation, not schema — the tooltip says so on both sides,
|
|
328
365
|
* because "hidden" next to a database column reads as destructive until
|
|
329
366
|
* somebody tells you it is not.
|
|
330
367
|
*/
|
|
331
|
-
function VisibilityToggle({ property, onPatchProperty, }) {
|
|
368
|
+
function VisibilityToggle({ property, canEdit, onPatchProperty, }) {
|
|
369
|
+
if (!canEdit) {
|
|
370
|
+
// The state, without the switch: the row is still dimmed when hidden, and
|
|
371
|
+
// the icon says which it is to somebody who cannot see the dimming.
|
|
372
|
+
return (_jsx("span", { role: "img", "aria-label": `${property.displayName} is ${property.hidden ? 'hidden' : 'shown'}`, className: cn('inline-flex p-1', MUTED), children: property.hidden ? _jsx(EyeOff, { size: 14 }) : _jsx(Eye, { size: 14 }) }));
|
|
373
|
+
}
|
|
332
374
|
return (_jsx(Tooltip, { content: property.hidden
|
|
333
375
|
? `Hidden from tables and search. ${property.displayName} is still stored — showing it again needs no migration.`
|
|
334
376
|
: 'Shown in tables and search. Hiding it only changes what is displayed; the column is untouched.', children: _jsx("button", { type: "button", "aria-label": `${property.hidden ? 'Show' : 'Hide'} ${property.displayName}`, onClick: () => onPatchProperty(property.name, { hidden: !property.hidden }), className: cn('rounded-sm p-1 hover:bg-zinc-100 dark:hover:bg-zinc-800', MUTED), children: property.hidden ? _jsx(EyeOff, { size: 14 }) : _jsx(Eye, { size: 14 }) }) }));
|
package/dist/EditableField.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ interface EditableFieldProps {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
inputClassName?: string;
|
|
8
8
|
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* Render the value as plain text, with no edit affordance at all — no button,
|
|
11
|
+
* no pencil, nothing a click turns into a write. For a viewer who may read the
|
|
12
|
+
* catalog but not change it.
|
|
13
|
+
*/
|
|
14
|
+
readOnly?: boolean;
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* Click to edit, Enter to save, Escape to cancel.
|
|
@@ -14,5 +20,5 @@ interface EditableFieldProps {
|
|
|
14
20
|
* None of it reaches a migration, which is the only reason it is safe to make
|
|
15
21
|
* editing this casual.
|
|
16
22
|
*/
|
|
17
|
-
export declare function EditableField({ value, placeholder, onSave, multiline, className, inputClassName, label, }: EditableFieldProps): import("react").JSX.Element;
|
|
23
|
+
export declare function EditableField({ value, placeholder, onSave, multiline, className, inputClassName, label, readOnly, }: EditableFieldProps): import("react").JSX.Element;
|
|
18
24
|
export {};
|
package/dist/EditableField.js
CHANGED
|
@@ -9,7 +9,7 @@ import { cn } from './cn.js';
|
|
|
9
9
|
* None of it reaches a migration, which is the only reason it is safe to make
|
|
10
10
|
* editing this casual.
|
|
11
11
|
*/
|
|
12
|
-
export function EditableField({ value, placeholder = 'Not named yet', onSave, multiline = false, className, inputClassName, label, }) {
|
|
12
|
+
export function EditableField({ value, placeholder = 'Not named yet', onSave, multiline = false, className, inputClassName, label, readOnly = false, }) {
|
|
13
13
|
const [editing, setEditing] = useState(false);
|
|
14
14
|
const [draft, setDraft] = useState(value);
|
|
15
15
|
// Two refs rather than one union-typed ref: React types `ref` per element, so
|
|
@@ -37,6 +37,12 @@ export function EditableField({ value, placeholder = 'Not named yet', onSave, mu
|
|
|
37
37
|
setDraft(value);
|
|
38
38
|
setEditing(false);
|
|
39
39
|
}
|
|
40
|
+
if (readOnly) {
|
|
41
|
+
return (_jsx("span", { className: cn('flex w-full items-start px-1.5 py-0.5 text-left',
|
|
42
|
+
// The same box the button draws, minus the border that only exists to
|
|
43
|
+
// be hovered, so a read-only screen lines up with an editable one.
|
|
44
|
+
className), children: _jsx("span", { className: cn(!value && 'italic text-zinc-400 dark:text-zinc-500'), children: value || placeholder }) }));
|
|
45
|
+
}
|
|
40
46
|
if (editing) {
|
|
41
47
|
const shared = {
|
|
42
48
|
value: draft,
|
|
@@ -8,5 +8,11 @@ export interface LoadExpectationSectionProps {
|
|
|
8
8
|
typeName: string;
|
|
9
9
|
/** What a person calls the type. Used in the sentences, which are about the type. */
|
|
10
10
|
displayName: string;
|
|
11
|
+
/**
|
|
12
|
+
* Set false where the viewer is known to be read-only. The expectation in
|
|
13
|
+
* force, its reason and where each field came from are still shown; the form
|
|
14
|
+
* that sets it is not rendered, so nothing here can issue a write.
|
|
15
|
+
*/
|
|
16
|
+
canEdit?: boolean;
|
|
11
17
|
}
|
|
12
|
-
export declare function LoadExpectationSection({ typeName, displayName }: LoadExpectationSectionProps): import("react").JSX.Element;
|
|
18
|
+
export declare function LoadExpectationSection({ typeName, displayName, canEdit, }: LoadExpectationSectionProps): import("react").JSX.Element;
|
|
@@ -224,7 +224,7 @@ function describeInterval(ms) {
|
|
|
224
224
|
return `${trim(hours)} hours`;
|
|
225
225
|
return `${trim(ms / 60_000)} minutes`;
|
|
226
226
|
}
|
|
227
|
-
export function LoadExpectationSection({ typeName, displayName }) {
|
|
227
|
+
export function LoadExpectationSection({ typeName, displayName, canEdit = true, }) {
|
|
228
228
|
const client = useCatalogClient();
|
|
229
229
|
const { data: view, isPending, isError, error, } = useQuery({
|
|
230
230
|
queryKey: catalogQueryKeys.loadExpectation(typeName),
|
|
@@ -234,19 +234,19 @@ export function LoadExpectationSection({ typeName, displayName }) {
|
|
|
234
234
|
// section that says nothing for half a minute before saying that.
|
|
235
235
|
retry: false,
|
|
236
236
|
});
|
|
237
|
-
return (_jsxs("section", { className: "mt-10", children: [_jsxs("div", { className: "mb-3", children: [_jsx("h2", { className: cn('font-mono text-[11px] uppercase tracking-[0.16em]', MUTED), children: "Load expectation" }), _jsx("p", { className: cn('mt-1 text-xs', MUTED), children: "How this type reconciles rows deleted at the source, and how far one load may move its row count. Checked before a load is allowed to become the data everybody reads." })] }), isPending && _jsx("p", { className: cn('font-mono text-xs', MUTED), children: "Reading the expectation\u2026" }), isError && (_jsxs("div", { className: cn('rounded-lg border px-4 py-3', RULE, PANEL), children: [_jsx("p", { className: "text-sm", children: "Could not read the load expectation." }), _jsxs("p", { className: cn('mt-1 text-xs', SECONDARY), children: ["It is served by the pipeline endpoints, which are the host's rather than this library's \u2014 this deployment may not mount them, or this account may not read them. Nothing here says whether a load of ", displayName, " would be refused."] }), error instanceof Error && (_jsx("p", { className: cn('mt-1 font-mono text-[11px]', MUTED), children: error.message }))] })), view && _jsx(LoadExpectationBody, { view: view, displayName: displayName })] }));
|
|
237
|
+
return (_jsxs("section", { className: "mt-10", children: [_jsxs("div", { className: "mb-3", children: [_jsx("h2", { className: cn('font-mono text-[11px] uppercase tracking-[0.16em]', MUTED), children: "Load expectation" }), _jsx("p", { className: cn('mt-1 text-xs', MUTED), children: "How this type reconciles rows deleted at the source, and how far one load may move its row count. Checked before a load is allowed to become the data everybody reads." })] }), isPending && _jsx("p", { className: cn('font-mono text-xs', MUTED), children: "Reading the expectation\u2026" }), isError && (_jsxs("div", { className: cn('rounded-lg border px-4 py-3', RULE, PANEL), children: [_jsx("p", { className: "text-sm", children: "Could not read the load expectation." }), _jsxs("p", { className: cn('mt-1 text-xs', SECONDARY), children: ["It is served by the pipeline endpoints, which are the host's rather than this library's \u2014 this deployment may not mount them, or this account may not read them. Nothing here says whether a load of ", displayName, " would be refused."] }), error instanceof Error && (_jsx("p", { className: cn('mt-1 font-mono text-[11px]', MUTED), children: error.message }))] })), view && _jsx(LoadExpectationBody, { view: view, displayName: displayName, canEdit: canEdit })] }));
|
|
238
238
|
}
|
|
239
|
-
function LoadExpectationBody({ view, displayName, }) {
|
|
239
|
+
function LoadExpectationBody({ view, displayName, canEdit, }) {
|
|
240
240
|
const deletes = view.resolved.deletes;
|
|
241
241
|
return (_jsxs("div", { className: "space-y-4", children: [view.deletesFrom === 'none' ? (
|
|
242
242
|
// The whole reason somebody opens this section. Said in words, and
|
|
243
243
|
// said first: a blank strategy field is read as "not filled in yet",
|
|
244
244
|
// which is exactly the wrong conclusion — the load is already refused.
|
|
245
|
-
_jsxs("div", { className: cn('rounded-lg border border-amber-300 bg-amber-50 px-4 py-3', 'dark:border-amber-900 dark:bg-amber-950/40'), children: [_jsxs("p", { className: "text-sm text-amber-900 dark:text-amber-200", children: ["Nothing declares how ", displayName, " reconciles deletes, so an incremental load of it will be refused."] }),
|
|
245
|
+
_jsxs("div", { className: cn('rounded-lg border border-amber-300 bg-amber-50 px-4 py-3', 'dark:border-amber-900 dark:bg-amber-950/40'), children: [_jsxs("p", { className: "text-sm text-amber-900 dark:text-amber-200", children: ["Nothing declares how ", displayName, " reconciles deletes, so an incremental load of it will be refused."] }), _jsxs("p", { className: "mt-1 text-xs text-amber-800 dark:text-amber-300/80", children: ["A full load still commits \u2014 it replaces the whole type, so deletions reconcile by construction. What is blocked is the incremental path, until somebody chooses a strategy", canEdit ? ' below' : '', " and writes down why."] })] })) : (_jsxs("div", { className: cn('rounded-lg border px-4 py-3', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-2", children: [_jsxs("p", { className: "text-sm", children: ["Deletes: ", _jsx("span", { className: "font-mono", children: deletes?.strategy }), deletes?.strategy === 'periodic-full-reload' && (_jsxs("span", { className: SECONDARY, children: [' ', "\u00B7 reconciled every ", describeInterval(deletes.withinMs)] })), deletes?.strategy === 'soft-deleted-at-source' && deletes.column && (_jsxs("span", { className: SECONDARY, children: [" \u00B7 column ", deletes.column] }))] }), _jsx(SourceBadge, { source: view.deletesFrom })] }), deletes && (
|
|
246
246
|
// Prose, and marked up as prose: this is a sentence somebody is
|
|
247
247
|
// accountable for, not a config value. In the table below it would
|
|
248
248
|
// be skimmed like one.
|
|
249
|
-
_jsxs("blockquote", { className: "mt-2 border-l-2 border-sky-200 pl-4 dark:border-sky-900", children: [_jsx("p", { className: "text-sm leading-relaxed", children: deletes.because }), _jsx(Attribution, { view: view })] }))] })), _jsx(ProvenanceTable, { view: view }), _jsx(ExpectationForm, { view: view, displayName: displayName })] }));
|
|
249
|
+
_jsxs("blockquote", { className: "mt-2 border-l-2 border-sky-200 pl-4 dark:border-sky-900", children: [_jsx("p", { className: "text-sm leading-relaxed", children: deletes.because }), _jsx(Attribution, { view: view })] }))] })), _jsx(ProvenanceTable, { view: view }), canEdit && _jsx(ExpectationForm, { view: view, displayName: displayName })] }));
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
252
252
|
* Who wrote the sentence above, and when.
|
package/dist/ObjectExplorer.d.ts
CHANGED
|
@@ -5,6 +5,21 @@ export interface ObjectExplorerProps {
|
|
|
5
5
|
/** Where to send the "back" link. Omit to hide it. */
|
|
6
6
|
backHref?: string;
|
|
7
7
|
backLabel?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Set false to leave out the search box, for a host whose object endpoint
|
|
10
|
+
* does not support `search`. Without the box nothing sends the parameter, so
|
|
11
|
+
* a server that ignores it can no longer present an unsearched page as the
|
|
12
|
+
* answer to a search.
|
|
13
|
+
*/
|
|
14
|
+
search?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The most rows the host's server will count. A page whose `total` is at
|
|
17
|
+
* least this is shown as "10,000+ rows" rather than "10,000 rows", because a
|
|
18
|
+
* capped count is a lower bound and the exact figure reads as the real size.
|
|
19
|
+
* Omit when the server counts every row. A cap that is not a positive whole
|
|
20
|
+
* number is ignored, and the count is shown exactly.
|
|
21
|
+
*/
|
|
22
|
+
rowCountCap?: number;
|
|
8
23
|
}
|
|
9
24
|
/**
|
|
10
25
|
* A parameter asked for in the URL, wherever the host keeps it.
|
|
@@ -29,4 +44,4 @@ export interface ObjectExplorerProps {
|
|
|
29
44
|
* object type is, and it should move the day a third concern needs it.
|
|
30
45
|
*/
|
|
31
46
|
export declare function paramFromLocation(name: string): string | null;
|
|
32
|
-
export declare function ObjectExplorer({ type: typeProp, pageSize, backHref, backLabel, }: ObjectExplorerProps): import("react").JSX.Element;
|
|
47
|
+
export declare function ObjectExplorer({ type: typeProp, pageSize, backHref, backLabel, search: searchable, rowCountCap, }: ObjectExplorerProps): import("react").JSX.Element;
|
package/dist/ObjectExplorer.js
CHANGED
|
@@ -105,7 +105,7 @@ export function paramFromLocation(name) {
|
|
|
105
105
|
return null;
|
|
106
106
|
return new URLSearchParams(hash.slice(mark + 1)).get(name);
|
|
107
107
|
}
|
|
108
|
-
export function ObjectExplorer({ type: typeProp, pageSize = 25, backHref, backLabel = 'Catalog', }) {
|
|
108
|
+
export function ObjectExplorer({ type: typeProp, pageSize = 25, backHref, backLabel = 'Catalog', search: searchable = true, rowCountCap, }) {
|
|
109
109
|
const client = useCatalogClient();
|
|
110
110
|
const { data: snapshot, isLoading: loadingCatalog } = useQuery({
|
|
111
111
|
queryKey: catalogQueryKeys.snapshot,
|
|
@@ -236,7 +236,7 @@ export function ObjectExplorer({ type: typeProp, pageSize = 25, backHref, backLa
|
|
|
236
236
|
// A request in flight, a stale cache or a snapshot that has since been dropped
|
|
237
237
|
// all make those two disagree, and only one of them is evidence.
|
|
238
238
|
const stale = data?.snapshot?.current === false;
|
|
239
|
-
return (_jsxs("div", { className: "flex h-full flex-col bg-zinc-50 dark:bg-zinc-950", children: [_jsxs("header", { className: cn('shrink-0 border-b px-8 py-5', RULE, PANEL), children: [backHref && (_jsxs("a", { href: backHref, className: cn('mb-3 inline-flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-[0.14em]', MUTED, 'hover:text-zinc-950 dark:hover:text-zinc-50'), children: [_jsx(ArrowLeft, { size: 12 }), backLabel] })), _jsxs("div", { className: "flex flex-wrap items-end justify-between gap-4", children: [_jsx(TypeSwitcher, { types: snapshot?.types ?? [], selected: selectedType, open: switcherOpen, onToggle: () => setSwitcherOpen((o) => !o), onChoose: chooseType, caption: tableCaption(selectedType, data) }), _jsx(SearchBox, { value: search, onChange: setSearch, what: selectedType?.pluralDisplayName })] }), _jsx(FilterBar, { columns: filterable, filters: filters, onChange: setFilters, snapshots: snapshots ?? [], snapshotId: snapshotId, onSnapshot: readSnapshot }), stale && (_jsx(StaleSnapshotBanner, { snapshots: snapshots ?? [], id: data?.snapshot?.id, onCurrent: backToCurrent }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-auto px-8 py-6", children: [error ? (_jsx(RefusedRead, { error: error })) : (_jsxs("div", { className: cn('overflow-hidden rounded-lg border transition-opacity',
|
|
239
|
+
return (_jsxs("div", { className: "flex h-full flex-col bg-zinc-50 dark:bg-zinc-950", children: [_jsxs("header", { className: cn('shrink-0 border-b px-8 py-5', RULE, PANEL), children: [backHref && (_jsxs("a", { href: backHref, className: cn('mb-3 inline-flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-[0.14em]', MUTED, 'hover:text-zinc-950 dark:hover:text-zinc-50'), children: [_jsx(ArrowLeft, { size: 12 }), backLabel] })), _jsxs("div", { className: "flex flex-wrap items-end justify-between gap-4", children: [_jsx(TypeSwitcher, { types: snapshot?.types ?? [], selected: selectedType, open: switcherOpen, onToggle: () => setSwitcherOpen((o) => !o), onChoose: chooseType, caption: tableCaption(selectedType, data, rowCountCap) }), searchable && (_jsx(SearchBox, { value: search, onChange: setSearch, what: selectedType?.pluralDisplayName }))] }), _jsx(FilterBar, { columns: filterable, filters: filters, onChange: setFilters, snapshots: snapshots ?? [], snapshotId: snapshotId, onSnapshot: readSnapshot }), stale && (_jsx(StaleSnapshotBanner, { snapshots: snapshots ?? [], id: data?.snapshot?.id, onCurrent: backToCurrent }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-auto px-8 py-6", children: [error ? (_jsx(RefusedRead, { error: error })) : (_jsxs("div", { className: cn('overflow-hidden rounded-lg border transition-opacity',
|
|
240
240
|
// The stale border is not decoration: the banner is at the top of a
|
|
241
241
|
// scrolling page, and somebody who came back to this tab after
|
|
242
242
|
// lunch may only ever see the grid.
|
|
@@ -253,10 +253,24 @@ export function ObjectExplorer({ type: typeProp, pageSize = 25, backHref, backLa
|
|
|
253
253
|
* a zero while the read is in flight: "0 rows" and "not yet answered" are
|
|
254
254
|
* different facts and only one of them is worth reacting to.
|
|
255
255
|
*/
|
|
256
|
-
function tableCaption(type, data) {
|
|
257
|
-
const rows = data ?
|
|
256
|
+
function tableCaption(type, data, rowCountCap) {
|
|
257
|
+
const rows = data ? rowCount(data.meta.total, rowCountCap) : '…';
|
|
258
258
|
return `${type?.tableName} · ${rows} · ${data?.columns.length ?? 0} columns from the catalog`;
|
|
259
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* The row count as the reader should take it.
|
|
262
|
+
*
|
|
263
|
+
* A count at or above the host's cap is the cap with a plus sign: the server
|
|
264
|
+
* stopped counting there, so the true size is at least that and possibly far
|
|
265
|
+
* more. Below the cap the count is exact and shown as it is.
|
|
266
|
+
*/
|
|
267
|
+
function rowCount(total, cap) {
|
|
268
|
+
// A cap that is not a whole number of rows above zero is a host mistake, and
|
|
269
|
+
// "0+ rows" or "2.5+ rows" would say something no server meant; it is ignored.
|
|
270
|
+
if (cap !== undefined && Number.isInteger(cap) && cap > 0 && total >= cap)
|
|
271
|
+
return `${cap.toLocaleString()}+ rows`;
|
|
272
|
+
return `${total.toLocaleString()} rows`;
|
|
273
|
+
}
|
|
260
274
|
/** The one control that searches every text column at once. */
|
|
261
275
|
function SearchBox({ value, onChange, what, }) {
|
|
262
276
|
return (_jsxs("div", { className: "relative", children: [_jsx(Search, { size: 14, className: cn('pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2', MUTED) }), _jsx("input", { type: "text", value: value, onChange: (event) => onChange(event.target.value), placeholder: `Search ${what?.toLowerCase() ?? 'objects'}`, "aria-label": "Search objects", className: cn('w-72 rounded-md border bg-zinc-50 py-2 pl-8 pr-3 text-sm outline-none dark:bg-zinc-950', RULE, 'placeholder:text-zinc-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/15') })] }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vendored from bklit-ui — https://github.com/bklit/bklit-ui
|
|
3
3
|
* Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
|
|
4
|
-
*
|
|
4
|
+
* THIRD_PARTY_NOTICES.md at the root of this package.
|
|
5
5
|
*
|
|
6
6
|
* Local change: the `@/lib/utils` import was repointed at this package's own
|
|
7
7
|
* `cn`, which is the same function. Nothing else is modified, so re-syncing
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
/**
|
|
4
4
|
* Vendored from bklit-ui — https://github.com/bklit/bklit-ui
|
|
5
5
|
* Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
|
|
6
|
-
*
|
|
6
|
+
* THIRD_PARTY_NOTICES.md at the root of this package.
|
|
7
7
|
*
|
|
8
8
|
* Local change: the `@/lib/utils` import was repointed at this package's own
|
|
9
9
|
* `cn`, which is the same function. Nothing else is modified, so re-syncing
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
/**
|
|
4
4
|
* Vendored from bklit-ui — https://github.com/bklit/bklit-ui
|
|
5
5
|
* Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
|
|
6
|
-
*
|
|
6
|
+
* THIRD_PARTY_NOTICES.md at the root of this package.
|
|
7
7
|
*
|
|
8
8
|
* Local change: the `@/lib/utils` import was repointed at this package's own
|
|
9
9
|
* `cn`, which is the same function. Nothing else is modified, so re-syncing
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vendored from bklit-ui — https://github.com/bklit/bklit-ui
|
|
3
3
|
* Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
|
|
4
|
-
*
|
|
4
|
+
* THIRD_PARTY_NOTICES.md at the root of this package.
|
|
5
5
|
*
|
|
6
6
|
* Local change: the `@/lib/utils` import was repointed at this package's own
|
|
7
7
|
* `cn`, which is the same function. Nothing else is modified, so re-syncing
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
/**
|
|
3
3
|
* Vendored from bklit-ui — https://github.com/bklit/bklit-ui
|
|
4
4
|
* Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
|
|
5
|
-
*
|
|
5
|
+
* THIRD_PARTY_NOTICES.md at the root of this package.
|
|
6
6
|
*
|
|
7
7
|
* Local change: the `@/lib/utils` import was repointed at this package's own
|
|
8
8
|
* `cn`, which is the same function. Nothing else is modified, so re-syncing
|