mcdview 0.34.7__tar.gz → 0.35.0__tar.gz
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.
- {mcdview-0.34.7 → mcdview-0.35.0}/PKG-INFO +42 -3
- {mcdview-0.34.7 → mcdview-0.35.0}/README.md +41 -2
- {mcdview-0.34.7 → mcdview-0.35.0}/mcdview.py +14 -2
- {mcdview-0.34.7 → mcdview-0.35.0}/pyproject.toml +1 -1
- {mcdview-0.34.7 → mcdview-0.35.0}/templates/explorateur.html +345 -63
- {mcdview-0.34.7 → mcdview-0.35.0}/.gitignore +0 -0
- {mcdview-0.34.7 → mcdview-0.35.0}/LICENSE +0 -0
- {mcdview-0.34.7 → mcdview-0.35.0}/logo.svg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mcdview
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.35.0
|
|
4
4
|
Summary: Turn a SQL data model into one self-contained, interactive HTML page
|
|
5
5
|
Project-URL: Homepage, https://github.com/Gheop/mcdview
|
|
6
6
|
Project-URL: Demo, https://gheop.github.io/mcdview/
|
|
@@ -102,7 +102,8 @@ erDiagram
|
|
|
102
102
|
## What you get
|
|
103
103
|
|
|
104
104
|
- **Explore any model.** Overview grouped by schema, click a table to isolate
|
|
105
|
-
it with its neighbours
|
|
105
|
+
it with its neighbours (or several tables, up to three relations away),
|
|
106
|
+
key columns lit when hovering a link, field detail (types, NOT NULL, DEFAULT, PK 🔑,
|
|
106
107
|
clickable FK 🔗, indexes, comments), search by table *or column*, drag to
|
|
107
108
|
rearrange (links follow live, positions remembered), force-directed relayout,
|
|
108
109
|
a minimap and level-of-detail for big models, light/dark toggle, SVG export,
|
|
@@ -184,12 +185,24 @@ and reuses the table positions drawn in the model.
|
|
|
184
185
|
In the page:
|
|
185
186
|
|
|
186
187
|
- **wheel**: zoom, **drag**: pan;
|
|
187
|
-
- **hover a table**: lights up its foreign-key links;
|
|
188
|
+
- **hover a table**: lights up its foreign-key links; **hover a link**:
|
|
189
|
+
lights the two columns it joins; **hover a key column**: lights the
|
|
190
|
+
columns it pairs with in the other tables (an FK column its target, a
|
|
191
|
+
referenced column every FK column pointing at it);
|
|
188
192
|
- **click a table**: isolates it with its related tables (the others fade
|
|
189
193
|
out, the view re-frames) and shows its detail on the right — fields,
|
|
190
194
|
types, NOT NULL, DEFAULT, PK 🔑, clickable FK 🔗, table and column
|
|
191
195
|
comments, list of referencing tables; the URL gets a `#schema.table`
|
|
192
196
|
permalink that reopens straight on that table;
|
|
197
|
+
- **degree 1 · 2 · 3** (toolbar, while a table is isolated): also shows the
|
|
198
|
+
tables two or three relations away, laid out in rings; **Ctrl+click** (or
|
|
199
|
+
⌘+click, Shift+click) adds or removes a table, so unrelated tables can be
|
|
200
|
+
isolated together, each with its own ring. In the overview, Ctrl+click
|
|
201
|
+
marks tables and a click on one of them isolates them all. The permalink
|
|
202
|
+
carries the selection: `#schema.a+schema.b;2`. Above 120 tables the
|
|
203
|
+
selection stays at its overview places;
|
|
204
|
+
- **"⌗ schema" button**: shows the schema before each table name
|
|
205
|
+
(`public.members`), remembered per viewer; `?schema=show` opens with it;
|
|
193
206
|
- **drag a table** to rearrange the diagram, the links follow live;
|
|
194
207
|
- **"rearrange" button**: a force-directed relayout that spreads the tables
|
|
195
208
|
to unclutter the links (disabled above 400 tables, where it would be slow);
|
|
@@ -352,6 +365,7 @@ file's header.
|
|
|
352
365
|
|
|
353
366
|
| Version | Date | Changes |
|
|
354
367
|
|---------|------------|---------|
|
|
368
|
+
| 1.0.5 | 2026-11-28 | Add the v0.35.0 changelog entry; document link and key-column hover, focus degree, several-table focus and the schema toggle |
|
|
355
369
|
| 1.0.4 | 2026-11-04 | Add the v0.34.7 changelog entry |
|
|
356
370
|
| 1.0.3 | 2026-11-04 | Add the v0.34.6 changelog entry |
|
|
357
371
|
| 1.0.2 | 2026-11-04 | Add the v0.34.5 changelog entry |
|
|
@@ -360,6 +374,31 @@ file's header.
|
|
|
360
374
|
|
|
361
375
|
## Changelog
|
|
362
376
|
|
|
377
|
+
### v0.35.0 — Focus on several tables, key-column hover, schema names (2026-11-28)
|
|
378
|
+
|
|
379
|
+
- **Wider focus.** While a table is isolated, the toolbar's "degree 1 · 2 · 3"
|
|
380
|
+
also shows the tables two or three relations away, laid out in rings so a
|
|
381
|
+
table sits next to the one that brings it in. Ctrl+click (⌘+click,
|
|
382
|
+
Shift+click) adds or removes a table from the focus, so tables that no
|
|
383
|
+
foreign key links can be shown together, each in its own cluster; in the
|
|
384
|
+
overview, Ctrl+click marks tables and a click on one of them isolates them
|
|
385
|
+
all. The permalink carries the selection and the degree
|
|
386
|
+
(`#schema.a+schema.b;2`); an old `#schema.table` link opens as before.
|
|
387
|
+
Above 120 tables (a hub at degree 2 can reach most of a big model) the
|
|
388
|
+
selection stays at its overview places, the rest faded.
|
|
389
|
+
- **Key-column hover.** Hovering a foreign-key link lights the column it
|
|
390
|
+
joins in both tables; hovering a key column lights the columns it pairs
|
|
391
|
+
with: an FK column its target, a referenced column every FK column that
|
|
392
|
+
points at it. Columns are not drawn on models above 800 tables or when
|
|
393
|
+
zoomed far out, so there is nothing to light there.
|
|
394
|
+
- **Schema names.** A "⌗ schema" toolbar button shows the schema before each
|
|
395
|
+
table name (`public.members`), also in the SVG export. Off by default,
|
|
396
|
+
remembered per viewer; `?schema=show` opens a page with it.
|
|
397
|
+
- Framing (overview, isolation, Escape) keeps the tables below the toolbar,
|
|
398
|
+
which wraps to two lines on narrower screens and could cover the top row.
|
|
399
|
+
- An HTML export made while a table is isolated opens on the overview,
|
|
400
|
+
without the focus controls.
|
|
401
|
+
|
|
363
402
|
### v0.34.7 — Tables in /* */ comments are no longer read (2026-11-04)
|
|
364
403
|
|
|
365
404
|
- The PostgreSQL parser no longer reads a `CREATE TABLE` or an `ALTER TABLE`
|
|
@@ -80,7 +80,8 @@ erDiagram
|
|
|
80
80
|
## What you get
|
|
81
81
|
|
|
82
82
|
- **Explore any model.** Overview grouped by schema, click a table to isolate
|
|
83
|
-
it with its neighbours
|
|
83
|
+
it with its neighbours (or several tables, up to three relations away),
|
|
84
|
+
key columns lit when hovering a link, field detail (types, NOT NULL, DEFAULT, PK 🔑,
|
|
84
85
|
clickable FK 🔗, indexes, comments), search by table *or column*, drag to
|
|
85
86
|
rearrange (links follow live, positions remembered), force-directed relayout,
|
|
86
87
|
a minimap and level-of-detail for big models, light/dark toggle, SVG export,
|
|
@@ -162,12 +163,24 @@ and reuses the table positions drawn in the model.
|
|
|
162
163
|
In the page:
|
|
163
164
|
|
|
164
165
|
- **wheel**: zoom, **drag**: pan;
|
|
165
|
-
- **hover a table**: lights up its foreign-key links;
|
|
166
|
+
- **hover a table**: lights up its foreign-key links; **hover a link**:
|
|
167
|
+
lights the two columns it joins; **hover a key column**: lights the
|
|
168
|
+
columns it pairs with in the other tables (an FK column its target, a
|
|
169
|
+
referenced column every FK column pointing at it);
|
|
166
170
|
- **click a table**: isolates it with its related tables (the others fade
|
|
167
171
|
out, the view re-frames) and shows its detail on the right — fields,
|
|
168
172
|
types, NOT NULL, DEFAULT, PK 🔑, clickable FK 🔗, table and column
|
|
169
173
|
comments, list of referencing tables; the URL gets a `#schema.table`
|
|
170
174
|
permalink that reopens straight on that table;
|
|
175
|
+
- **degree 1 · 2 · 3** (toolbar, while a table is isolated): also shows the
|
|
176
|
+
tables two or three relations away, laid out in rings; **Ctrl+click** (or
|
|
177
|
+
⌘+click, Shift+click) adds or removes a table, so unrelated tables can be
|
|
178
|
+
isolated together, each with its own ring. In the overview, Ctrl+click
|
|
179
|
+
marks tables and a click on one of them isolates them all. The permalink
|
|
180
|
+
carries the selection: `#schema.a+schema.b;2`. Above 120 tables the
|
|
181
|
+
selection stays at its overview places;
|
|
182
|
+
- **"⌗ schema" button**: shows the schema before each table name
|
|
183
|
+
(`public.members`), remembered per viewer; `?schema=show` opens with it;
|
|
171
184
|
- **drag a table** to rearrange the diagram, the links follow live;
|
|
172
185
|
- **"rearrange" button**: a force-directed relayout that spreads the tables
|
|
173
186
|
to unclutter the links (disabled above 400 tables, where it would be slow);
|
|
@@ -330,6 +343,7 @@ file's header.
|
|
|
330
343
|
|
|
331
344
|
| Version | Date | Changes |
|
|
332
345
|
|---------|------------|---------|
|
|
346
|
+
| 1.0.5 | 2026-11-28 | Add the v0.35.0 changelog entry; document link and key-column hover, focus degree, several-table focus and the schema toggle |
|
|
333
347
|
| 1.0.4 | 2026-11-04 | Add the v0.34.7 changelog entry |
|
|
334
348
|
| 1.0.3 | 2026-11-04 | Add the v0.34.6 changelog entry |
|
|
335
349
|
| 1.0.2 | 2026-11-04 | Add the v0.34.5 changelog entry |
|
|
@@ -338,6 +352,31 @@ file's header.
|
|
|
338
352
|
|
|
339
353
|
## Changelog
|
|
340
354
|
|
|
355
|
+
### v0.35.0 — Focus on several tables, key-column hover, schema names (2026-11-28)
|
|
356
|
+
|
|
357
|
+
- **Wider focus.** While a table is isolated, the toolbar's "degree 1 · 2 · 3"
|
|
358
|
+
also shows the tables two or three relations away, laid out in rings so a
|
|
359
|
+
table sits next to the one that brings it in. Ctrl+click (⌘+click,
|
|
360
|
+
Shift+click) adds or removes a table from the focus, so tables that no
|
|
361
|
+
foreign key links can be shown together, each in its own cluster; in the
|
|
362
|
+
overview, Ctrl+click marks tables and a click on one of them isolates them
|
|
363
|
+
all. The permalink carries the selection and the degree
|
|
364
|
+
(`#schema.a+schema.b;2`); an old `#schema.table` link opens as before.
|
|
365
|
+
Above 120 tables (a hub at degree 2 can reach most of a big model) the
|
|
366
|
+
selection stays at its overview places, the rest faded.
|
|
367
|
+
- **Key-column hover.** Hovering a foreign-key link lights the column it
|
|
368
|
+
joins in both tables; hovering a key column lights the columns it pairs
|
|
369
|
+
with: an FK column its target, a referenced column every FK column that
|
|
370
|
+
points at it. Columns are not drawn on models above 800 tables or when
|
|
371
|
+
zoomed far out, so there is nothing to light there.
|
|
372
|
+
- **Schema names.** A "⌗ schema" toolbar button shows the schema before each
|
|
373
|
+
table name (`public.members`), also in the SVG export. Off by default,
|
|
374
|
+
remembered per viewer; `?schema=show` opens a page with it.
|
|
375
|
+
- Framing (overview, isolation, Escape) keeps the tables below the toolbar,
|
|
376
|
+
which wraps to two lines on narrower screens and could cover the top row.
|
|
377
|
+
- An HTML export made while a table is isolated opens on the overview,
|
|
378
|
+
without the focus controls.
|
|
379
|
+
|
|
341
380
|
### v0.34.7 — Tables in /* */ comments are no longer read (2026-11-04)
|
|
342
381
|
|
|
343
382
|
- The PostgreSQL parser no longer reads a `CREATE TABLE` or an `ALTER TABLE`
|
|
@@ -1865,13 +1865,21 @@ TRADUCTIONS = {
|
|
|
1865
1865
|
"> FK d'audit": '> audit FKs',
|
|
1866
1866
|
"Cliquer sur une table pour l'isoler avec ses\n"
|
|
1867
1867
|
"tables liées et voir son détail ici.<br><br>Molette : zoom.\n"
|
|
1868
|
-
"Glisser : déplacer. Échap : vue générale
|
|
1868
|
+
"Glisser : déplacer. Échap : vue générale.<br><br>Ctrl+clic : isoler plusieurs\n"
|
|
1869
|
+
"tables ensemble.":
|
|
1869
1870
|
'Click a table to isolate it with its\n'
|
|
1870
1871
|
'related tables and see its details here.<br><br>Wheel: zoom.\n'
|
|
1871
|
-
'Drag: pan. Escape: overview
|
|
1872
|
+
'Drag: pan. Escape: overview.<br><br>Ctrl+click: isolate several\n'
|
|
1873
|
+
'tables together.',
|
|
1874
|
+
'title="tables montrées jusqu\'à 1, 2 ou 3 relations de la sélection ; Ctrl+clic sur '
|
|
1875
|
+
'une table l\'ajoute ou la retire">degré':
|
|
1876
|
+
'title="tables shown up to 1, 2 or 3 relations from the selection; Ctrl+click '
|
|
1877
|
+
'a table to add or remove it">degree',
|
|
1872
1878
|
'⇄ réorganiser': '⇄ rearrange',
|
|
1873
1879
|
'⋈ cardinalités': '⋈ cardinalities',
|
|
1874
1880
|
'"afficher les cardinalités (patte d\'oie)"': '"show cardinalities (crow\'s foot)"',
|
|
1881
|
+
'"afficher le schéma devant le nom des tables">⌗ schéma':
|
|
1882
|
+
'"show the schema before table names">⌗ schema',
|
|
1875
1883
|
'↶ annuler': '↶ undo',
|
|
1876
1884
|
'"annuler la dernière disposition (Ctrl+Z)"':
|
|
1877
1885
|
'"undo the last layout change (Ctrl+Z)"',
|
|
@@ -1941,6 +1949,10 @@ TRADUCTIONS = {
|
|
|
1941
1949
|
'"un-à-plusieurs"': '"one-to-many"',
|
|
1942
1950
|
'"auto-référence"': '"self-reference"',
|
|
1943
1951
|
'"nullable"': '"nullable"',
|
|
1952
|
+
'"tables marquées : cliquer l\'une d\'elles pour les isoler ensemble (Échap pour annuler)."':
|
|
1953
|
+
'"tables marked: click one of them to isolate them together (Esc to cancel)."',
|
|
1954
|
+
'"tables : trop pour les disposer autour de la sélection, elles restent à leur place."':
|
|
1955
|
+
'"tables: too many to lay out around the selection, they stay in place."',
|
|
1944
1956
|
},
|
|
1945
1957
|
}
|
|
1946
1958
|
|
|
@@ -52,6 +52,8 @@ __FAVICON__
|
|
|
52
52
|
.table.choisie { border-color: var(--ligne-vive); border-width: 2.5px;
|
|
53
53
|
box-shadow: 0 2px 12px #0b74c455; }
|
|
54
54
|
.table.efface { opacity: 0; pointer-events: none; }
|
|
55
|
+
/* overview Ctrl+click: tables gathered to be focused together */
|
|
56
|
+
.table.marquee { outline: 2px dashed var(--ligne-vive); outline-offset: 3px; }
|
|
55
57
|
.table.deplace { transition: none; cursor: grabbing; }
|
|
56
58
|
/* restoring saved positions must be instant, never an animated slide from the
|
|
57
59
|
auto-placement spot (the initial links would be drawn against the moving box
|
|
@@ -62,9 +64,15 @@ __FAVICON__
|
|
|
62
64
|
.table ul { margin: 0; padding: 3px 10px 5px; list-style: none; }
|
|
63
65
|
.table li { white-space: nowrap; line-height: 1.45; color: var(--encre); }
|
|
64
66
|
.table li .t { opacity: .55; font-size: 12px; margin-left: 6px; }
|
|
67
|
+
/* key columns lit by a hovered link or a hovered key column */
|
|
68
|
+
.table li.colvif { background: color-mix(in srgb, var(--ligne-vive) 22%, transparent);
|
|
69
|
+
box-shadow: inset 3px 0 0 var(--ligne-vive); margin: 0 -10px; padding: 0 10px; }
|
|
65
70
|
/* level-of-detail: zoomed far out, show table names only (see rendre()) */
|
|
66
71
|
#plan.compact .table ul { display: none; }
|
|
67
72
|
#plan.compact .table h3 { border-radius: 5px; }
|
|
73
|
+
/* schema prefix on table names: always in the markup, shown by the toggle */
|
|
74
|
+
.table h3 .sch { display: none; font-weight: normal; opacity: .7; }
|
|
75
|
+
body.avec-schema .table h3 .sch { display: inline; }
|
|
68
76
|
/* schema diff coloring: only --diff pages carry these classes */
|
|
69
77
|
.table.d-add { box-shadow: 0 0 0 2px #22c55e, 0 1px 4px #0002; }
|
|
70
78
|
.table.d-mod { box-shadow: 0 0 0 2px #f59e0b, 0 1px 4px #0002; }
|
|
@@ -162,7 +170,10 @@ __FAVICON__
|
|
|
162
170
|
#hud button { padding: 4px 10px; border: 1px solid var(--bord); border-radius: 5px;
|
|
163
171
|
background: var(--panneau); color: var(--encre); cursor: pointer; }
|
|
164
172
|
#hud label { display: flex; gap: 4px; align-items: center; font-size: 13px; }
|
|
165
|
-
#hud label[hidden] { display: none; }
|
|
173
|
+
#hud label[hidden] { display: none; }
|
|
174
|
+
#degres { display: flex; gap: 3px; align-items: center; font-size: 13px; }
|
|
175
|
+
#degres[hidden] { display: none; }
|
|
176
|
+
#hud #degres button { padding: 4px 8px; } /* author display:flex beats [hidden]; restore it */
|
|
166
177
|
#compte { font-size: 12px; opacity: .55; white-space: nowrap; }
|
|
167
178
|
.table:hover { border-color: var(--ligne-vive); }
|
|
168
179
|
#panneau { position: absolute; top: 0; right: 0; bottom: 0; width: 340px;
|
|
@@ -245,6 +256,8 @@ __FAVICON__
|
|
|
245
256
|
<input id="cherche" type="search" placeholder="chercher table ou colonne…" list="noms">
|
|
246
257
|
<datalist id="noms"></datalist>
|
|
247
258
|
<button id="vueGenerale" hidden>← vue générale (Échap)</button>
|
|
259
|
+
<span id="degres" hidden title="tables montrées jusqu'à 1, 2 ou 3 relations de la sélection ; Ctrl+clic sur une table l'ajoute ou la retire">degré
|
|
260
|
+
<button data-degre="1">1</button><button data-degre="2">2</button><button data-degre="3">3</button></span>
|
|
248
261
|
<button id="reorganiser" title="réétaler les tables pour dégager les liens">⇄ réorganiser</button>
|
|
249
262
|
<button id="annuler" title="annuler la dernière disposition (Ctrl+Z)" hidden>↶ annuler</button>
|
|
250
263
|
<button id="btnHubs" data-graphe title="teinter les tables par nombre de relations">◉ hubs</button>
|
|
@@ -252,6 +265,7 @@ __FAVICON__
|
|
|
252
265
|
<button id="btnJointure" data-graphe title="chemin de jointure entre deux tables">⇢ jointure</button>
|
|
253
266
|
<button id="btnStats" title="résumé du modèle">∑ résumé</button>
|
|
254
267
|
<button id="btnCard" title="afficher les cardinalités (patte d'oie)">⋈ cardinalités</button>
|
|
268
|
+
<button id="btnSchema" title="afficher le schéma devant le nom des tables">⌗ schéma</button>
|
|
255
269
|
<button id="theme" title="thème clair / sombre">◐</button>
|
|
256
270
|
<details id="menuExport" class="menu">
|
|
257
271
|
<summary title="exporter : SVG, Markdown, DOT, HTML">⬇ export</summary>
|
|
@@ -278,7 +292,8 @@ __FAVICON__
|
|
|
278
292
|
<button id="togglePanneau" type="button" title="réduire / agrandir le panneau">›</button>
|
|
279
293
|
<div id="panneau"><p class="vide">Cliquer sur une table pour l'isoler avec ses
|
|
280
294
|
tables liées et voir son détail ici.<br><br>Molette : zoom.
|
|
281
|
-
Glisser : déplacer. Échap : vue générale
|
|
295
|
+
Glisser : déplacer. Échap : vue générale.<br><br>Ctrl+clic : isoler plusieurs
|
|
296
|
+
tables ensemble.</p></div>
|
|
282
297
|
<script>
|
|
283
298
|
"use strict";
|
|
284
299
|
const D = __DONNEES__;
|
|
@@ -338,11 +353,12 @@ const tParCle = {}; // cle -> table data, for lazy node rebuilds
|
|
|
338
353
|
// isolated table reads like it does on a small model.
|
|
339
354
|
function htmlNoeud(cle, avecColonnes) {
|
|
340
355
|
const t = tParCle[cle];
|
|
341
|
-
const entete = "<h3 style='background:" + ech(D.schemas[t.schema] || "#ccc") + "'>" +
|
|
356
|
+
const entete = "<h3 style='background:" + ech(D.schemas[t.schema] || "#ccc") + "'><span class='sch'>" +
|
|
357
|
+
ech(t.schema) + ".</span>" + ech(t.nom) + "</h3>";
|
|
342
358
|
if (!avecColonnes) return entete;
|
|
343
359
|
const fkCols = fkColsPar[cle] || new Set();
|
|
344
360
|
return entete + "<ul>" +
|
|
345
|
-
t.cols.map(c => "<li" + (c.diff ? " class='" + DCLS[c.diff] + "'" : "") + ">" +
|
|
361
|
+
t.cols.map(c => "<li data-col='" + ech(c.nom) + "'" + (c.diff ? " class='" + DCLS[c.diff] + "'" : "") + ">" +
|
|
346
362
|
(t.pk.includes(c.nom) ? "🔑 " : fkCols.has(c.nom) ? "🔗 " : "") +
|
|
347
363
|
ech(c.nom) + "<span class='t'>" + ech(c.type) + "</span></li>").join("") + "</ul>";
|
|
348
364
|
}
|
|
@@ -410,6 +426,7 @@ if (D.diff) {
|
|
|
410
426
|
btnFiltre.addEventListener("click", () => {
|
|
411
427
|
filtreTouchees = !filtreTouchees;
|
|
412
428
|
btnFiltre.classList.toggle("actif", filtreTouchees);
|
|
429
|
+
quitterFocus();
|
|
413
430
|
focusCle = null; btnRetour.hidden = true;
|
|
414
431
|
if (location.hash) history.replaceState(null, "", location.pathname + location.search);
|
|
415
432
|
Object.keys(elems).forEach(c => elems[c].classList.remove("choisie"));
|
|
@@ -534,7 +551,7 @@ function marqueCardin(p, nn, vif, pourExport) {
|
|
|
534
551
|
// whether a link is highlighted (drawn blue in the overlay above the tables)
|
|
535
552
|
function estVifLien(f) {
|
|
536
553
|
return f === focusLien ||
|
|
537
|
-
(focusCle && (f.de
|
|
554
|
+
(focusCle && (racines.includes(f.de) || racines.includes(f.vers))) ||
|
|
538
555
|
(survolCle && (f.de === survolCle || f.vers === survolCle)) ||
|
|
539
556
|
(mev && mev.liens.has(f.de + " " + f.vers));
|
|
540
557
|
}
|
|
@@ -602,13 +619,49 @@ function survoler(cle) {
|
|
|
602
619
|
});
|
|
603
620
|
}
|
|
604
621
|
|
|
622
|
+
// --- key-column highlight: a hovered link lights its column at both ends; a
|
|
623
|
+
// hovered key column lights the columns it pairs with in the other tables (an
|
|
624
|
+
// FK column its target, a referenced column every FK column pointing at it).
|
|
625
|
+
// Nodes are rebuilt on isolation, so the lit <li> are only kept to unlight them
|
|
626
|
+
// and the pairs are found again from the data on each hover ---
|
|
627
|
+
let lisVifs = [];
|
|
628
|
+
function colonneVisee(f) { // a REFERENCES without columns targets the sole PK
|
|
629
|
+
const pk = parCle[f.vers] ? parCle[f.vers].pk : [];
|
|
630
|
+
return f.colcible || (pk.length === 1 ? pk[0] : "");
|
|
631
|
+
}
|
|
632
|
+
function pairesLien(f) { return [[f.de, f.col], [f.vers, colonneVisee(f)]]; }
|
|
633
|
+
function pairesColonne(cle, col) {
|
|
634
|
+
const paires = [];
|
|
635
|
+
fksVisibles().forEach(f => {
|
|
636
|
+
if (f.de === cle && f.col === col) paires.push([f.vers, colonneVisee(f)]);
|
|
637
|
+
if (f.vers === cle && colonneVisee(f) === col) paires.push([f.de, f.col]);
|
|
638
|
+
});
|
|
639
|
+
if (paires.length) paires.push([cle, col]);
|
|
640
|
+
return paires;
|
|
641
|
+
}
|
|
642
|
+
function allumerColonnes(paires) {
|
|
643
|
+
lisVifs.forEach(li => li.classList.remove("colvif"));
|
|
644
|
+
lisVifs = [];
|
|
645
|
+
paires.forEach(([cle, col]) => {
|
|
646
|
+
const e = elems[cle];
|
|
647
|
+
if (!e || !col) return;
|
|
648
|
+
for (const li of e.querySelectorAll("li[data-col]")) {
|
|
649
|
+
if (li.dataset.col === col) { li.classList.add("colvif"); lisVifs.push(li); }
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
|
|
605
654
|
// --- hover: light up the links of the table under the pointer ---
|
|
606
655
|
plan.addEventListener("mouseover", e => {
|
|
607
656
|
const t = e.target.closest(".table");
|
|
608
657
|
const cle = t ? t.dataset.cle : null;
|
|
609
658
|
survoler(cle);
|
|
659
|
+
const li = t && e.target.closest("li[data-col]");
|
|
660
|
+
const lp = !t && e.target.closest("#liensClic path");
|
|
661
|
+
const f = lp ? liensVus[+lp.dataset.fk] : null;
|
|
662
|
+
allumerColonnes(li ? pairesColonne(cle, li.dataset.col) : f ? pairesLien(f) : []);
|
|
610
663
|
});
|
|
611
|
-
plan.addEventListener("mouseleave", () => survoler(null));
|
|
664
|
+
plan.addEventListener("mouseleave", () => { survoler(null); allumerColonnes([]); });
|
|
612
665
|
|
|
613
666
|
// --- pan / zoom ---
|
|
614
667
|
let estCompact = false;
|
|
@@ -690,9 +743,13 @@ function cadrer(cles) {
|
|
|
690
743
|
y1 = Math.max(y1, e.offsetTop + e.offsetHeight);
|
|
691
744
|
});
|
|
692
745
|
const marge = 60;
|
|
693
|
-
|
|
746
|
+
// the toolbar floats over the top of the viewport and wraps to two lines on
|
|
747
|
+
// narrower screens: frame below it, or the top tables sit under its buttons
|
|
748
|
+
const hud = document.getElementById("hud").getBoundingClientRect();
|
|
749
|
+
const haut = Math.max(0, Math.min(hud.bottom - vp.getBoundingClientRect().top, vp.clientHeight / 3));
|
|
750
|
+
k = Math.min(vp.clientWidth / (x1 - x0 + 2 * marge), (vp.clientHeight - haut) / (y1 - y0 + 2 * marge), 1.4);
|
|
694
751
|
x = (vp.clientWidth - (x1 - x0) * k) / 2 - x0 * k;
|
|
695
|
-
y = (vp.clientHeight - (y1 - y0) * k) / 2 - y0 * k;
|
|
752
|
+
y = haut + (vp.clientHeight - haut - (y1 - y0) * k) / 2 - y0 * k;
|
|
696
753
|
rendre();
|
|
697
754
|
}
|
|
698
755
|
vp.addEventListener("wheel", e => {
|
|
@@ -811,8 +868,14 @@ vp.addEventListener("pointerup", e => {
|
|
|
811
868
|
const el = document.elementFromPoint(e.clientX, e.clientY);
|
|
812
869
|
const cible = el?.closest(".table");
|
|
813
870
|
if (cible) {
|
|
814
|
-
|
|
815
|
-
|
|
871
|
+
const cle = cible.dataset.cle;
|
|
872
|
+
if (jointure.actif) choisirJointure(cle); // pick join endpoints
|
|
873
|
+
else if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
874
|
+
if (focusCle || racines.length) basculerRacine(cle); // add/remove a root
|
|
875
|
+
else marquer(cle); // gather in the overview
|
|
876
|
+
} else if (!focusCle && marquees.has(cle) && marquees.size > 1) {
|
|
877
|
+
ouvrirFocus([...marquees], degreFocus); // focus the gathered tables together
|
|
878
|
+
} else isoler(cle);
|
|
816
879
|
} else { // no table under the pointer — maybe a link
|
|
817
880
|
const lp = el?.closest("#liensClic path");
|
|
818
881
|
if (lp && !jointure.actif) detaillerLien(liensVus[+lp.dataset.fk]);
|
|
@@ -830,8 +893,7 @@ function reduirePanneau(v, refit) {
|
|
|
830
893
|
panneauReduit = v;
|
|
831
894
|
document.body.classList.toggle("panneau-reduit", v);
|
|
832
895
|
btnToggle.textContent = v ? "‹" : "›";
|
|
833
|
-
if (refit) setTimeout(() => cadrer(focusCle ?
|
|
834
|
-
: Object.keys(elems)), 260);
|
|
896
|
+
if (refit) setTimeout(() => cadrer(focusCle ? gardees : Object.keys(elems)), 260);
|
|
835
897
|
}
|
|
836
898
|
let introTimer = null;
|
|
837
899
|
function finIntro() { // stop the intro; leave the panel wherever it now is
|
|
@@ -873,45 +935,37 @@ btnToggle.addEventListener("click", () => {
|
|
|
873
935
|
|
|
874
936
|
// --- DBeaver-like focus mode: the table in the center, its neighbours in a star ---
|
|
875
937
|
const enrichis = new Set(); // huge-model nodes rebuilt with their columns (see isoler)
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
Object.keys(elems).forEach(c => elems[c].classList.toggle("efface", !garde.has(c)));
|
|
892
|
-
Object.keys(elems).forEach(c => elems[c].classList.toggle("choisie", c === cle));
|
|
893
|
-
// huge model: the kept tables were built header-only; give them their columns
|
|
894
|
-
// back now (cheap for a star of a few tables) so the isolated view is legible.
|
|
895
|
-
// Done before measuring sizes below, so the star layout uses the real heights.
|
|
896
|
-
if (NOEUDS_LEGERS) garde.forEach(c => {
|
|
897
|
-
if (!enrichis.has(c)) { elems[c].innerHTML = htmlNoeud(c, true); enrichis.add(c); }
|
|
898
|
-
});
|
|
899
|
-
// star: the chosen table keeps its place, neighbours circle around it.
|
|
900
|
-
// The radius grows with the table sizes (a big neighbour like a 40-column
|
|
901
|
-
// table would overlap the centre at a fixed radius) and a final de-overlap
|
|
902
|
-
// pass, centre kept fixed, guarantees nothing touches.
|
|
903
|
-
const c0 = centre(cle);
|
|
904
|
-
const til = c => { const e = elems[c]; return Math.hypot(e.offsetWidth, e.offsetHeight) / 2; };
|
|
905
|
-
const rC = til(cle);
|
|
906
|
-
let rMax = 0, somme = 0;
|
|
907
|
-
voisinage.forEach(v => { const t = til(v); rMax = Math.max(rMax, t); somme += t; });
|
|
908
|
-
const rayon = Math.max(360, rC + rMax + 90, somme / Math.PI + rMax);
|
|
909
|
-
const P = { [cle]: { x: c0.x, y: c0.y, r: rC } };
|
|
910
|
-
voisinage.forEach((v, i) => {
|
|
911
|
-
const a = -Math.PI / 2 + (2 * Math.PI * i) / voisinage.length;
|
|
912
|
-
P[v] = { x: c0.x + rayon * Math.cos(a), y: c0.y + rayon * Math.sin(a), r: til(v) };
|
|
938
|
+
// --- focus: one table or several (Ctrl/⌘/Shift+click), with the tables up to
|
|
939
|
+
// degreFocus relations away. One table at degree 1 is laid out as a star
|
|
940
|
+
// around it, anything wider in rings, one per distance. Above LIMITE_ANNEAUX
|
|
941
|
+
// kept tables the rings would sprawl (a hub at degree 2 can reach most of the
|
|
942
|
+
// model): they stay at their overview places, the rest faded. ---
|
|
943
|
+
let racines = [], degreFocus = 1, gardees = [];
|
|
944
|
+
const marquees = new Set(); // overview: tables Ctrl+clicked, to focus together
|
|
945
|
+
const LIMITE_ANNEAUX = 120;
|
|
946
|
+
const DEGRE_MAX = 3;
|
|
947
|
+
const blocDegres = document.getElementById("degres");
|
|
948
|
+
function distances(depart, degre) { // BFS over the visible FKs, both directions
|
|
949
|
+
const adj = {};
|
|
950
|
+
fksVisibles().forEach(f => {
|
|
951
|
+
(adj[f.de] = adj[f.de] || []).push(f.vers);
|
|
952
|
+
(adj[f.vers] = adj[f.vers] || []).push(f.de);
|
|
913
953
|
});
|
|
914
|
-
const
|
|
954
|
+
const dist = new Map(depart.map(c => [c, 0]));
|
|
955
|
+
const origine = new Map(depart.map(c => [c, c])); // the root that reached it first
|
|
956
|
+
let front = depart;
|
|
957
|
+
for (let d = 1; d <= degre && front.length; d++) {
|
|
958
|
+
const suivant = [];
|
|
959
|
+
front.forEach(c => (adj[c] || []).forEach(v => {
|
|
960
|
+
if (!dist.has(v)) { dist.set(v, d); origine.set(v, origine.get(c)); suivant.push(v); }
|
|
961
|
+
}));
|
|
962
|
+
front = suivant;
|
|
963
|
+
}
|
|
964
|
+
dist.origine = origine;
|
|
965
|
+
return dist;
|
|
966
|
+
}
|
|
967
|
+
// push overlapping boxes apart (P: key -> {x, y, r} circles); `fixe` never moves
|
|
968
|
+
function ecarter(P, noeuds, fixe) {
|
|
915
969
|
for (let passe = 0; passe < 40; passe++) {
|
|
916
970
|
let colle = false;
|
|
917
971
|
for (let i = 0; i < noeuds.length; i++) {
|
|
@@ -922,8 +976,8 @@ function isoler(cle) {
|
|
|
922
976
|
const dmin = A.r + B.r + 30;
|
|
923
977
|
if (d < dmin) {
|
|
924
978
|
const pousse = dmin - d; ex /= d; ey /= d;
|
|
925
|
-
if (noeuds[i] ===
|
|
926
|
-
else if (noeuds[j] ===
|
|
979
|
+
if (noeuds[i] === fixe) { B.x -= ex * pousse; B.y -= ey * pousse; }
|
|
980
|
+
else if (noeuds[j] === fixe) { A.x += ex * pousse; A.y += ey * pousse; }
|
|
927
981
|
else { A.x += ex * pousse / 2; A.y += ey * pousse / 2; B.x -= ex * pousse / 2; B.y -= ey * pousse / 2; }
|
|
928
982
|
colle = true;
|
|
929
983
|
}
|
|
@@ -931,17 +985,215 @@ function isoler(cle) {
|
|
|
931
985
|
}
|
|
932
986
|
if (!colle) break;
|
|
933
987
|
}
|
|
934
|
-
|
|
988
|
+
}
|
|
989
|
+
const tilTable = c => { const e = elems[c]; return Math.hypot(e.offsetWidth, e.offsetHeight) / 2; };
|
|
990
|
+
function poser(P, noeuds) {
|
|
991
|
+
noeuds.forEach(v => {
|
|
935
992
|
const e = elems[v];
|
|
936
993
|
e.style.left = Math.round(P[v].x - e.offsetWidth / 2) + "px";
|
|
937
994
|
e.style.top = Math.round(P[v].y - e.offsetHeight / 2) + "px";
|
|
938
995
|
});
|
|
996
|
+
}
|
|
997
|
+
// star: the chosen table keeps its place, neighbours circle around it.
|
|
998
|
+
// The radius grows with the table sizes (a big neighbour like a 40-column
|
|
999
|
+
// table would overlap the centre at a fixed radius) and a final de-overlap
|
|
1000
|
+
// pass, centre kept fixed, guarantees nothing touches.
|
|
1001
|
+
function etoile(cle, voisinage) {
|
|
1002
|
+
const c0 = centre(cle);
|
|
1003
|
+
const rC = tilTable(cle);
|
|
1004
|
+
let rMax = 0, somme = 0;
|
|
1005
|
+
voisinage.forEach(v => { const t = tilTable(v); rMax = Math.max(rMax, t); somme += t; });
|
|
1006
|
+
const rayon = Math.max(360, rC + rMax + 90, somme / Math.PI + rMax);
|
|
1007
|
+
const P = { [cle]: { x: c0.x, y: c0.y, r: rC } };
|
|
1008
|
+
voisinage.forEach((v, i) => {
|
|
1009
|
+
const a = -Math.PI / 2 + (2 * Math.PI * i) / voisinage.length;
|
|
1010
|
+
P[v] = { x: c0.x + rayon * Math.cos(a), y: c0.y + rayon * Math.sin(a), r: tilTable(v) };
|
|
1011
|
+
});
|
|
1012
|
+
ecarter(P, [cle, ...voisinage], cle);
|
|
1013
|
+
poser(P, voisinage);
|
|
1014
|
+
}
|
|
1015
|
+
// rings: each root in the middle of its own cluster, one ring per distance;
|
|
1016
|
+
// a table joins the cluster of the root that reached it first. A table sits
|
|
1017
|
+
// at the angle of the tables that bring it in from the ring inside, so links
|
|
1018
|
+
// stay short and rarely cross. Clusters are laid side by side in a grid, the
|
|
1019
|
+
// first root keeping its place.
|
|
1020
|
+
function grappe(racine, membres, dist, adj) { // positions around (0, 0)
|
|
1021
|
+
const parDist = [];
|
|
1022
|
+
membres.forEach(c => (parDist[dist.get(c)] = parDist[dist.get(c)] || []).push(c));
|
|
1023
|
+
const P = {}, angle = {};
|
|
1024
|
+
let bord = 0; // outer edge of the rings placed so far
|
|
1025
|
+
parDist.forEach((anneau, d) => {
|
|
1026
|
+
const n = anneau.length;
|
|
1027
|
+
let rot = -Math.PI / 2;
|
|
1028
|
+
if (d > 0) {
|
|
1029
|
+
const cap = c => { // mean direction of the neighbours one ring in
|
|
1030
|
+
let sx = 0, sy = 0;
|
|
1031
|
+
(adj[c] || []).forEach(v => {
|
|
1032
|
+
if (v in angle && dist.get(v) === d - 1) { sx += Math.cos(angle[v]); sy += Math.sin(angle[v]); }
|
|
1033
|
+
});
|
|
1034
|
+
return Math.atan2(sy, sx);
|
|
1035
|
+
};
|
|
1036
|
+
const caps = new Map(anneau.map(c => [c, cap(c)]));
|
|
1037
|
+
anneau.sort((u, v) => caps.get(u) - caps.get(v));
|
|
1038
|
+
// turn the evenly spaced ring so each table sits closest to its cap
|
|
1039
|
+
let sx = 0, sy = 0;
|
|
1040
|
+
anneau.forEach((c, i) => {
|
|
1041
|
+
const e = caps.get(c) - (2 * Math.PI * i) / n;
|
|
1042
|
+
sx += Math.cos(e); sy += Math.sin(e);
|
|
1043
|
+
});
|
|
1044
|
+
rot = Math.atan2(sy, sx);
|
|
1045
|
+
}
|
|
1046
|
+
let rMax = 0, somme = 0;
|
|
1047
|
+
anneau.forEach(c => { const t = tilTable(c); rMax = Math.max(rMax, t); somme += t; });
|
|
1048
|
+
// as tight as the boxes allow: a sparse model at degree 2 or 3 would
|
|
1049
|
+
// otherwise be framed so small that the columns are hidden
|
|
1050
|
+
const rayon = d === 0 ? 0 : Math.max(bord + rMax + 70, somme / Math.PI + rMax);
|
|
1051
|
+
anneau.forEach((c, i) => {
|
|
1052
|
+
const a = rot + (2 * Math.PI * i) / n;
|
|
1053
|
+
angle[c] = a;
|
|
1054
|
+
P[c] = { x: rayon * Math.cos(a), y: rayon * Math.sin(a), r: tilTable(c) };
|
|
1055
|
+
});
|
|
1056
|
+
bord = rayon + rMax;
|
|
1057
|
+
});
|
|
1058
|
+
ecarter(P, membres, racine);
|
|
1059
|
+
return P;
|
|
1060
|
+
}
|
|
1061
|
+
function anneaux(dist) {
|
|
1062
|
+
const adj = {};
|
|
1063
|
+
fksVisibles().forEach(f => {
|
|
1064
|
+
(adj[f.de] = adj[f.de] || []).push(f.vers);
|
|
1065
|
+
(adj[f.vers] = adj[f.vers] || []).push(f.de);
|
|
1066
|
+
});
|
|
1067
|
+
const groupes = racines.map(r => [...dist.keys()].filter(c => dist.origine.get(c) === r));
|
|
1068
|
+
const plans = racines.map((r, i) => grappe(r, groupes[i], dist, adj));
|
|
1069
|
+
const boites = plans.map((P, i) => { // cluster extent around its root
|
|
1070
|
+
let x0 = 0, y0 = 0, x1 = 0, y1 = 0;
|
|
1071
|
+
groupes[i].forEach(c => {
|
|
1072
|
+
const e = elems[c], w = e.offsetWidth / 2, h = e.offsetHeight / 2;
|
|
1073
|
+
x0 = Math.min(x0, P[c].x - w); x1 = Math.max(x1, P[c].x + w);
|
|
1074
|
+
y0 = Math.min(y0, P[c].y - h); y1 = Math.max(y1, P[c].y + h);
|
|
1075
|
+
});
|
|
1076
|
+
return { x0, y0, x1, y1 };
|
|
1077
|
+
});
|
|
1078
|
+
const parLigne = Math.ceil(Math.sqrt(racines.length)), ecart = 120;
|
|
1079
|
+
const c0 = centre(racines[0]);
|
|
1080
|
+
let oy = 0;
|
|
1081
|
+
for (let l = 0; l * parLigne < racines.length; l++) {
|
|
1082
|
+
const ligne = boites.slice(l * parLigne, (l + 1) * parLigne);
|
|
1083
|
+
let ox = 0;
|
|
1084
|
+
const hautLigne = Math.max(...ligne.map(b => b.y1 - b.y0));
|
|
1085
|
+
ligne.forEach((b, j) => {
|
|
1086
|
+
const i = l * parLigne + j;
|
|
1087
|
+
// the grid starts where the first cluster's box does, so its root stays put
|
|
1088
|
+
const dx = c0.x + boites[0].x0 + ox - b.x0, dy = c0.y + boites[0].y0 + oy - b.y0;
|
|
1089
|
+
groupes[i].forEach(c => { plans[i][c].x += dx; plans[i][c].y += dy; });
|
|
1090
|
+
ox += b.x1 - b.x0 + ecart;
|
|
1091
|
+
});
|
|
1092
|
+
oy += hautLigne + ecart;
|
|
1093
|
+
}
|
|
1094
|
+
racines.forEach((r, i) => poser(plans[i], groupes[i]));
|
|
1095
|
+
}
|
|
1096
|
+
function hashFocus() {
|
|
1097
|
+
return racines.map(encodeURIComponent).join("+") + (degreFocus > 1 ? ";" + degreFocus : "");
|
|
1098
|
+
}
|
|
1099
|
+
// #a, #a+b, #a+b;2: '+' and ';' are always escaped inside a key by
|
|
1100
|
+
// encodeURIComponent, so they only ever separate. Unknown keys are dropped,
|
|
1101
|
+
// the degree is clamped; an old #schema.table permalink reads as before
|
|
1102
|
+
function lireHash() {
|
|
1103
|
+
const [liste, deg] = location.hash.slice(1).split(";");
|
|
1104
|
+
const cles = (liste || "").split("+").map(s => {
|
|
1105
|
+
try { return decodeURIComponent(s); } catch (e) { return ""; }
|
|
1106
|
+
}).filter(c => parCle[c]);
|
|
1107
|
+
return { racines: [...new Set(cles)],
|
|
1108
|
+
degre: Math.min(DEGRE_MAX, Math.max(1, parseInt(deg, 10) || 1)) };
|
|
1109
|
+
}
|
|
1110
|
+
function oublierMarques() {
|
|
1111
|
+
marquees.forEach(c => elems[c] && elems[c].classList.remove("marquee"));
|
|
1112
|
+
marquees.clear();
|
|
1113
|
+
}
|
|
1114
|
+
function marquer(cle) { // overview Ctrl+click: gather tables to focus together
|
|
1115
|
+
if (marquees.has(cle)) marquees.delete(cle); else marquees.add(cle);
|
|
1116
|
+
elems[cle].classList.toggle("marquee", marquees.has(cle));
|
|
1117
|
+
if (marquees.size) montrerIndice(marquees.size + " " + TXT.marquees, true);
|
|
1118
|
+
else cacherIndice();
|
|
1119
|
+
}
|
|
1120
|
+
function isoler(cle) {
|
|
1121
|
+
racines = [cle];
|
|
1122
|
+
focaliser(cle);
|
|
1123
|
+
}
|
|
1124
|
+
function ouvrirFocus(cles, degre) {
|
|
1125
|
+
racines = cles.slice();
|
|
1126
|
+
degreFocus = degre;
|
|
1127
|
+
focaliser(cles[cles.length - 1]);
|
|
1128
|
+
}
|
|
1129
|
+
function basculerRacine(cle) { // focus Ctrl+click: add or remove a root
|
|
1130
|
+
const i = racines.indexOf(cle);
|
|
1131
|
+
if (i < 0) { racines.push(cle); focaliser(cle); return; }
|
|
1132
|
+
if (racines.length === 1) { vueGenerale(); return; }
|
|
1133
|
+
racines.splice(i, 1);
|
|
1134
|
+
focaliser(cle === focusCle ? racines[racines.length - 1] : focusCle || racines[0]);
|
|
1135
|
+
}
|
|
1136
|
+
function choisirDegre(n) {
|
|
1137
|
+
degreFocus = n;
|
|
1138
|
+
if (racines.length) focaliser(focusCle || racines[racines.length - 1]);
|
|
1139
|
+
}
|
|
1140
|
+
blocDegres.querySelectorAll("button").forEach(b =>
|
|
1141
|
+
b.addEventListener("click", () => choisirDegre(+b.dataset.degre)));
|
|
1142
|
+
// lay out the focus around `racines`; `cle` is the table the panel details
|
|
1143
|
+
function focaliser(cle) {
|
|
1144
|
+
sortirModes(); // drilling into a table drops any graph highlight / join mode
|
|
1145
|
+
if (document.body.classList.contains("hubs")) { // heatmap is an overview overlay
|
|
1146
|
+
document.body.classList.remove("hubs");
|
|
1147
|
+
document.getElementById("btnHubs").classList.remove("actif");
|
|
1148
|
+
}
|
|
1149
|
+
if (marquees.size) { oublierMarques(); cacherIndice(); }
|
|
1150
|
+
focusCle = cle;
|
|
1151
|
+
focusLien = null; // leaving a link's detail clears its highlight
|
|
1152
|
+
allumerColonnes([]);
|
|
1153
|
+
finIntro(); // a table click ends the intro and keeps the panel open below
|
|
1154
|
+
if (autoExpand && panneauReduit) reduirePanneau(false, true); // reveal detail
|
|
1155
|
+
survolCle = null;
|
|
1156
|
+
history.replaceState(null, "", "#" + hashFocus());
|
|
1157
|
+
btnRetour.hidden = false;
|
|
1158
|
+
blocDegres.hidden = false;
|
|
1159
|
+
blocDegres.querySelectorAll("button").forEach(b =>
|
|
1160
|
+
b.classList.toggle("actif", +b.dataset.degre === degreFocus));
|
|
1161
|
+
const simple = racines.length === 1 && degreFocus === 1;
|
|
1162
|
+
// a single root at degree 1 keeps the star's neighbour order (voisins)
|
|
1163
|
+
const dist = simple ? null : distances(racines, degreFocus);
|
|
1164
|
+
gardees = simple ? [cle, ...voisins(cle)] : [...dist.keys()];
|
|
1165
|
+
const garde = new Set(gardees);
|
|
1166
|
+
const enAnneaux = !simple && garde.size <= LIMITE_ANNEAUX;
|
|
1167
|
+
Object.keys(elems).forEach(c => elems[c].classList.toggle("efface", !garde.has(c)));
|
|
1168
|
+
Object.keys(elems).forEach(c => elems[c].classList.toggle("choisie", racines.includes(c)));
|
|
1169
|
+
// huge model: the kept tables were built header-only; give them their columns
|
|
1170
|
+
// back now (cheap for a few tables) so the isolated view is legible. Done
|
|
1171
|
+
// before measuring sizes below, so the layout uses the real heights.
|
|
1172
|
+
if (NOEUDS_LEGERS && (simple || enAnneaux)) garde.forEach(c => {
|
|
1173
|
+
if (!enrichis.has(c)) { elems[c].innerHTML = htmlNoeud(c, true); enrichis.add(c); }
|
|
1174
|
+
});
|
|
1175
|
+
if (simple) etoile(cle, gardees.slice(1));
|
|
1176
|
+
else if (enAnneaux) anneaux(dist);
|
|
1177
|
+
else {
|
|
1178
|
+
garde.forEach(c => {
|
|
1179
|
+
elems[c].style.left = origines[c].x + "px";
|
|
1180
|
+
elems[c].style.top = origines[c].y + "px";
|
|
1181
|
+
});
|
|
1182
|
+
montrerIndice(garde.size + " " + TXT.tropPourAnneaux);
|
|
1183
|
+
}
|
|
939
1184
|
detailler(cle);
|
|
940
|
-
setTimeout(() => { dessinerLiens(); cadrer(
|
|
1185
|
+
setTimeout(() => { dessinerLiens(); cadrer(gardees); }, 380);
|
|
941
1186
|
svg.innerHTML = "";
|
|
942
1187
|
}
|
|
1188
|
+
function quitterFocus() { // the overview drops the focus roots, degree and marks
|
|
1189
|
+
racines = []; gardees = []; degreFocus = 1;
|
|
1190
|
+
blocDegres.hidden = true;
|
|
1191
|
+
if (marquees.size) { oublierMarques(); cacherIndice(); }
|
|
1192
|
+
}
|
|
943
1193
|
function vueGenerale() {
|
|
944
1194
|
sortirModes(); // back to overview clears any graph highlight / join mode
|
|
1195
|
+
allumerColonnes([]);
|
|
1196
|
+
quitterFocus();
|
|
945
1197
|
focusCle = null;
|
|
946
1198
|
focusLien = null;
|
|
947
1199
|
filtreTouchees = false; // overview always shows everything
|
|
@@ -987,6 +1239,28 @@ document.addEventListener("keydown", e => {
|
|
|
987
1239
|
}
|
|
988
1240
|
});
|
|
989
1241
|
|
|
1242
|
+
// schema prefix on table names: off by default, remembered per viewer, and
|
|
1243
|
+
// ?schema=show deep-links it. Table widths change, so a star is laid out again
|
|
1244
|
+
// and the overview redraws its links
|
|
1245
|
+
const btnSchema = document.getElementById("btnSchema");
|
|
1246
|
+
function montrerSchemas(v, retenir) {
|
|
1247
|
+
document.body.classList.toggle("avec-schema", v);
|
|
1248
|
+
btnSchema.classList.toggle("actif", v);
|
|
1249
|
+
if (retenir) {
|
|
1250
|
+
try { v ? localStorage.setItem("mcdview:schema", "1") : localStorage.removeItem("mcdview:schema"); }
|
|
1251
|
+
catch (e) { /* ignore */ }
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
(function initSchemas() {
|
|
1255
|
+
let v = new URLSearchParams(location.search).get("schema") === "show";
|
|
1256
|
+
if (!v) { try { v = localStorage.getItem("mcdview:schema") === "1"; } catch (e) { /* ignore */ } }
|
|
1257
|
+
if (v) montrerSchemas(true, false);
|
|
1258
|
+
})();
|
|
1259
|
+
btnSchema.addEventListener("click", () => {
|
|
1260
|
+
montrerSchemas(!document.body.classList.contains("avec-schema"), true);
|
|
1261
|
+
if (focusCle) focaliser(focusCle); else dessinerLiens();
|
|
1262
|
+
});
|
|
1263
|
+
|
|
990
1264
|
// theme toggle: cycle system → light → dark, remembered per viewer. A click
|
|
991
1265
|
// always changes the visible theme: when the next state would render the same
|
|
992
1266
|
// as now (e.g. "system" equals "light" on a light OS), skip it — otherwise the
|
|
@@ -1187,7 +1461,8 @@ function exporterSVGImpl(pad, vis) {
|
|
|
1187
1461
|
p.push(`<rect width="${w}" height="${e.offsetHeight}" rx="6" fill="#ffffff" stroke="#d5d8dd"/>`);
|
|
1188
1462
|
p.push(`<path d="M0 6 a6 6 0 0 1 6 -6 h${w - 12} a6 6 0 0 1 6 6 v20 h-${w} z" ` +
|
|
1189
1463
|
`fill="${ech(D.schemas[t.schema] || '#ccc')}"/>`);
|
|
1190
|
-
|
|
1464
|
+
const sch = document.body.classList.contains("avec-schema") ? t.schema + "." : "";
|
|
1465
|
+
p.push(`<text x="9" y="17" font-weight="bold" font-size="13" fill="#1c1e22">${ech(sch + t.nom)}</text>`);
|
|
1191
1466
|
t.cols.forEach((col, i) => {
|
|
1192
1467
|
const mk = t.pk.includes(col.nom) ? "🔑 " : fkc.has(col.nom) ? "🔗 " : "";
|
|
1193
1468
|
p.push(`<text x="10" y="${42 + i * 20.5}" font-size="12.5" fill="#1c1e22">` +
|
|
@@ -1256,6 +1531,8 @@ function exporterHTML() {
|
|
|
1256
1531
|
const noms = doc.querySelector("#noms"); if (noms) noms.innerHTML = ""; // datalist options
|
|
1257
1532
|
const leg = doc.querySelector("#legende"); if (leg) leg.innerHTML = ""; // schema chips
|
|
1258
1533
|
const corps = doc.querySelector("body"); if (corps) corps.className = "panneau-reduit"; // fresh state
|
|
1534
|
+
// the copy opens on the overview: no focus controls, no leftover hint
|
|
1535
|
+
["#vueGenerale", "#degres", "#indice"].forEach(sel => { const e = doc.querySelector(sel); if (e) e.hidden = true; });
|
|
1259
1536
|
doc.removeAttribute("data-theme"); // do not bake a theme choice
|
|
1260
1537
|
const d2 = JSON.parse(JSON.stringify(D)); // clone, then bake the overview positions
|
|
1261
1538
|
d2.tables.forEach(t => {
|
|
@@ -1477,7 +1754,7 @@ document.getElementById("cherche").addEventListener("change", e => {
|
|
|
1477
1754
|
else montrerIndice(TXT.rienTrouve);
|
|
1478
1755
|
});
|
|
1479
1756
|
ckAudit.addEventListener("change", () => {
|
|
1480
|
-
if (focusCle)
|
|
1757
|
+
if (focusCle) focaliser(focusCle); else dessinerLiens();
|
|
1481
1758
|
});
|
|
1482
1759
|
|
|
1483
1760
|
// ===================== graph analysis & hub heatmap =====================
|
|
@@ -1539,6 +1816,8 @@ const TXT = {
|
|
|
1539
1816
|
unN: "un-à-plusieurs",
|
|
1540
1817
|
autoRef: "auto-référence",
|
|
1541
1818
|
nullable: "nullable",
|
|
1819
|
+
marquees: "tables marquées : cliquer l'une d'elles pour les isoler ensemble (Échap pour annuler).",
|
|
1820
|
+
tropPourAnneaux: "tables : trop pour les disposer autour de la sélection, elles restent à leur place.",
|
|
1542
1821
|
};
|
|
1543
1822
|
function afficherEncartJointure(a, b, chemin) {
|
|
1544
1823
|
let corps;
|
|
@@ -1589,6 +1868,7 @@ function poserMev(cles, liens) {
|
|
|
1589
1868
|
// leave isolation synchronously (all tables back home, visible) without the
|
|
1590
1869
|
// async reframe vueGenerale schedules — so a caller can then frame its own set
|
|
1591
1870
|
function reinitVue() {
|
|
1871
|
+
quitterFocus();
|
|
1592
1872
|
focusCle = null; btnRetour.hidden = true;
|
|
1593
1873
|
if (location.hash) history.replaceState(null, "", location.pathname + location.search);
|
|
1594
1874
|
Object.keys(elems).forEach(c => {
|
|
@@ -1820,16 +2100,18 @@ window.addEventListener("load", () => { if (!vuePrise) refitInitial(); });
|
|
|
1820
2100
|
// still re-fit AND reveal — never reveal edges at their provisional positions
|
|
1821
2101
|
setTimeout(() => { if (!liensReveles) refitInitial(); }, 1200);
|
|
1822
2102
|
|
|
1823
|
-
// --- permalink: #schema.table opens straight on that table
|
|
2103
|
+
// --- permalink: #schema.table opens straight on that table; #a+b;2 on
|
|
2104
|
+
// several tables at degree 2 ---
|
|
1824
2105
|
window.addEventListener("hashchange", () => {
|
|
1825
|
-
const
|
|
1826
|
-
if (
|
|
1827
|
-
|
|
2106
|
+
const h = lireHash();
|
|
2107
|
+
if (h.racines.length) {
|
|
2108
|
+
if (!focusCle || location.hash.slice(1) !== hashFocus()) ouvrirFocus(h.racines, h.degre);
|
|
2109
|
+
} else if (focusCle) vueGenerale();
|
|
1828
2110
|
});
|
|
1829
|
-
const
|
|
1830
|
-
if (
|
|
2111
|
+
const focusInitial = lireHash();
|
|
2112
|
+
if (focusInitial.racines.length) setTimeout(() => ouvrirFocus(focusInitial.racines, focusInitial.degre), 60);
|
|
1831
2113
|
|
|
1832
|
-
// --- view deep-links: ?focus=<table>&theme=dark&audit=show&hubs&cycles ---
|
|
2114
|
+
// --- view deep-links: ?focus=<table>&theme=dark&audit=show&schema=show&hubs&cycles ---
|
|
1833
2115
|
// the hosting side passes the query string straight to the page; theme is
|
|
1834
2116
|
// handled in initTheme, the rest here. Read-only, no network.
|
|
1835
2117
|
(function paramsVue() {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|