@mistriwork/kit 1.0.0-rc.57 → 1.0.0-rc.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/app.js +14 -2
- package/dist/client/audience.d.ts +1 -0
- package/dist/client/audience.js +10 -0
- package/dist/client/brandLook.css +49 -1
- package/dist/client/components/AppColumnMenuPopups.js +41 -11
- package/dist/client/components/AppList.d.ts +3 -1
- package/dist/client/components/AppList.js +77 -15
- package/dist/client/components/CardsList.js +14 -1
- package/dist/client/components/Chart.css +4 -0
- package/dist/client/components/Chart.d.ts +4 -4
- package/dist/client/components/Chart.js +30 -9
- package/dist/client/components/Content.js +3 -1
- package/dist/client/components/DateField.css +1 -1
- package/dist/client/components/DateField.js +1 -0
- package/dist/client/components/DefinedFields.js +2 -2
- package/dist/client/components/Diagram.css +82 -0
- package/dist/client/components/Diagram.d.ts +1 -0
- package/dist/client/components/Diagram.js +1 -0
- package/dist/client/components/Dressed.js +1 -1
- package/dist/client/components/Editable.js +7 -3
- package/dist/client/components/Export.js +1 -1
- package/dist/client/components/FilterBoxes.js +2 -2
- package/dist/client/components/FilterRail.css +1 -1
- package/dist/client/components/FilterRail.js +6 -4
- package/dist/client/components/Gallery.css +171 -0
- package/dist/client/components/Gallery.d.ts +1 -0
- package/dist/client/components/Gallery.js +1 -0
- package/dist/client/components/Grid.d.ts +2 -1
- package/dist/client/components/Grid.js +78 -24
- package/dist/client/components/GridCellEditor.js +4 -2
- package/dist/client/components/GridSelection.d.ts +4 -1
- package/dist/client/components/GridSelection.js +20 -3
- package/dist/client/components/LandingSurface.css +2 -2
- package/dist/client/components/LayoutBuilder.css +225 -0
- package/dist/client/components/LayoutBuilder.d.ts +1 -0
- package/dist/client/components/LayoutBuilder.js +1 -0
- package/dist/client/components/ListColumns.d.ts +12 -0
- package/dist/client/components/ListColumns.js +61 -0
- package/dist/client/components/ListFilterBar.css +39 -14
- package/dist/client/components/ListFilterBar.js +39 -23
- package/dist/client/components/MultiStepForm.css +22 -22
- package/dist/client/components/NewRecord.js +120 -104
- package/dist/client/components/Notes.css +9 -0
- package/dist/client/components/Notes.d.ts +6 -2
- package/dist/client/components/Notes.js +10 -6
- package/dist/client/components/OverflowMenu.js +16 -11
- package/dist/client/components/PageFields.js +19 -4
- package/dist/client/components/PageRelated.d.ts +8 -1
- package/dist/client/components/PageRelated.js +46 -33
- package/dist/client/components/PageSections.js +18 -5
- package/dist/client/components/Palette.js +1 -1
- package/dist/client/components/Prefs.d.ts +10 -0
- package/dist/client/components/Prefs.js +33 -23
- package/dist/client/components/PresentationSwitch.js +4 -0
- package/dist/client/components/Prompt.js +4 -4
- package/dist/client/components/RecordGone.js +4 -4
- package/dist/client/components/RecordPicker.js +24 -6
- package/dist/client/components/RecordSummaries.js +31 -5
- package/dist/client/components/RecordTrailNav.js +4 -0
- package/dist/client/components/RichTextEditor.css +2 -2
- package/dist/client/components/RichTextEditor.js +18 -19
- package/dist/client/components/Rooms.js +22 -4
- package/dist/client/components/SectionPeriod.css +1 -1
- package/dist/client/components/SetFieldDialog.js +1 -1
- package/dist/client/components/Sidebar.js +8 -5
- package/dist/client/components/SuggestBox.js +2 -2
- package/dist/client/components/TableRoom.d.ts +5 -1
- package/dist/client/components/TableRoom.js +29 -10
- package/dist/client/components/TableView.js +1 -1
- package/dist/client/components/ThMenu.js +26 -15
- package/dist/client/components/Tour.css +96 -0
- package/dist/client/components/Tour.d.ts +1 -0
- package/dist/client/components/Tour.js +1 -0
- package/dist/client/components/TreePicker.css +1 -1
- package/dist/client/components/TreePicker.js +27 -20
- package/dist/client/components/Value.js +4 -1
- package/dist/client/components/WorkflowStatus.js +8 -4
- package/dist/client/components/appListModel.d.ts +4 -0
- package/dist/client/components/appRooms.d.ts +2 -0
- package/dist/client/components/appRooms.js +2 -0
- package/dist/client/components/boardNew.d.ts +5 -0
- package/dist/client/components/boardNew.js +5 -0
- package/dist/client/components/conditionWords.d.ts +10 -0
- package/dist/client/components/conditionWords.js +20 -0
- package/dist/client/components/dashboardModel.d.ts +8 -0
- package/dist/client/components/dashboardModel.js +28 -1
- package/dist/client/components/editInteraction.d.ts +1 -1
- package/dist/client/components/editInteraction.js +1 -1
- package/dist/client/components/gridSizing.d.ts +14 -20
- package/dist/client/components/gridSizing.js +147 -108
- package/dist/client/components/pageContext.d.ts +3 -2
- package/dist/client/components/pageModel.d.ts +2 -0
- package/dist/client/components/pickerStaleness.d.ts +11 -1
- package/dist/client/components/pickerStaleness.js +12 -2
- package/dist/client/components/rowTitle.d.ts +2 -0
- package/dist/client/components/rowTitle.js +10 -0
- package/dist/client/components/textMeasure.js +72 -3
- package/dist/client/components/useConditionWords.d.ts +5 -0
- package/dist/client/components/useConditionWords.js +3 -1
- package/dist/client/components/useGridKeyboard.js +5 -0
- package/dist/client/components/valueModel.d.ts +1 -0
- package/dist/client/components/valueModel.js +39 -4
- package/dist/client/composer.css +2 -2
- package/dist/client/copy/es.js +3 -3
- package/dist/client/copy/filters/components/ListFilterBar.d.ts +1 -0
- package/dist/client/copy/filters/components/ListFilterBar.js +1 -0
- package/dist/client/copy/forms/components/DateField.d.ts +2 -0
- package/dist/client/copy/forms/components/DateField.js +2 -0
- package/dist/client/copy/forms/components/NewRecord.d.ts +8 -0
- package/dist/client/copy/forms/components/NewRecord.js +2 -0
- package/dist/client/copy/lists/components/AppList.d.ts +2 -0
- package/dist/client/copy/lists/components/AppList.js +2 -0
- package/dist/client/copy/lists/components/GridSelection.d.ts +1 -0
- package/dist/client/copy/lists/components/GridSelection.js +1 -0
- package/dist/client/copy/lists/components/ListColumns.d.ts +5 -0
- package/dist/client/copy/lists/components/ListColumns.js +7 -0
- package/dist/client/copy/lists/components/TableRoom.d.ts +3 -1
- package/dist/client/copy/lists/components/TableRoom.js +3 -1
- package/dist/client/copy/record/components/PageHistory.d.ts +2 -2
- package/dist/client/copy/record/components/PageHistory.js +4 -2
- package/dist/client/copy/record/components/WorkflowStatus.d.ts +1 -0
- package/dist/client/copy/record/components/WorkflowStatus.js +1 -0
- package/dist/client/copy/shell/components/MobileNavDrawer.d.ts +1 -0
- package/dist/client/copy/shell/components/MobileNavDrawer.js +2 -0
- package/dist/client/customThemes.css +3 -3
- package/dist/client/dom.js +5 -5
- package/dist/client/features.css +216 -356
- package/dist/client/fonts/Manrope-OFL.txt +93 -0
- package/dist/client/fonts/faces.css +10 -1
- package/dist/client/fonts/manrope-latin.woff2 +0 -0
- package/dist/client/formControls.css +4 -4
- package/dist/client/help.css +2 -2
- package/dist/client/ledgerLook.css +28 -0
- package/dist/client/locale.d.ts +2 -10
- package/dist/client/locale.js +0 -0
- package/dist/client/lumenLook.css +295 -105
- package/dist/client/manropeFace.css +32 -0
- package/dist/client/messages.d.ts +3 -3
- package/dist/client/messages.js +3 -3
- package/dist/client/page.css +98 -354
- package/dist/client/palette.js +31 -6
- package/dist/client/partsLook.css +60 -60
- package/dist/client/sageLook.css +101 -32
- package/dist/client/shellHost.d.ts +2 -2
- package/dist/client/shellHost.js +2 -2
- package/dist/client/shellMode.d.ts +9 -0
- package/dist/client/shellMode.js +2 -0
- package/dist/client/structure.css +281 -201
- package/dist/client/style.css +75 -224
- package/dist/client/themeFamilies.css +471 -66
- package/dist/client/tilesLook.css +502 -0
- package/dist/client/visualTheme.js +5 -2
- package/dist/client/visualThemes.css +38 -34
- package/dist/client/workbenchLook.css +12 -12
- package/dist/client/workshopLook.css +3 -8
- package/dist/vite.d.ts +1 -20
- package/dist/vite.js +33 -3
- package/package.json +8 -7
|
@@ -55,7 +55,7 @@ import { fontLoaded, textMeasure } from './textMeasure.js';
|
|
|
55
55
|
import { presentationColumns } from './columnPresentation.js';
|
|
56
56
|
import { usePins } from './usePins.js';
|
|
57
57
|
import { useStickyHead } from './useStickyHead.js';
|
|
58
|
-
import { fitGridColumns, keepFitting, tagsThatFit,
|
|
58
|
+
import { fitGridColumns, keepFitting, tagsThatFit, GRID_EXPANDER_WIDTH, GRID_HEAD_CHAR, GRID_SIZE_SAMPLE, holdFold, GRID_TRAIL_WIDTH, } from './gridSizing.js';
|
|
59
59
|
import { applyColumnOrder, applyColumnWidths, clampColumnWidth, columnResizeStep, MIN_COLUMN_WIDTH, moveColumn } from './gridArrange.js';
|
|
60
60
|
import { VISUAL_THEME_EVENT } from '../visualTheme.js';
|
|
61
61
|
import { JsonPreview } from './JsonPreview.js';
|
|
@@ -85,6 +85,8 @@ const sameRecord = (a, b) => {
|
|
|
85
85
|
return keys.length === Object.keys(b).length && keys.every((key) => key in b && a[key] === b[key]);
|
|
86
86
|
};
|
|
87
87
|
const groupKey = (value) => (value === null || value === undefined ? '\u0000' : String(value));
|
|
88
|
+
/** A group head's host in the row hosts' store: no row's key can spell it (a row's is a JSON array). */
|
|
89
|
+
export const groupHostKey = (value) => `group:${groupKey(value)}`;
|
|
88
90
|
/** Beyond a few hundred rows the DOM, not the database, is the bottleneck. */
|
|
89
91
|
const VIRTUAL_THRESHOLD = 300;
|
|
90
92
|
const OVERSCAN = 12;
|
|
@@ -385,7 +387,7 @@ function CellBody(props) {
|
|
|
385
387
|
}
|
|
386
388
|
return PlatformCell(cell);
|
|
387
389
|
}
|
|
388
|
-
function PlatformCell({ meta, plan, value, label, display, pin, edge, photo,
|
|
390
|
+
function PlatformCell({ meta, plan, value, label, display, pin, edge, photo, }) {
|
|
389
391
|
const classes = [`align-${plan.align}`];
|
|
390
392
|
const peek = meta?.references && value !== null && value !== undefined && value !== ''
|
|
391
393
|
? {
|
|
@@ -398,7 +400,7 @@ function PlatformCell({ meta, plan, value, label, display, pin, edge, photo, wra
|
|
|
398
400
|
/* The face the rule asks for wins; unasked, an App sets short text in the reading face unless it is a key or a code. */
|
|
399
401
|
const face = display?.face;
|
|
400
402
|
const app = shellBody().classList.contains('app-mode');
|
|
401
|
-
const pinClass = (pin !== undefined ? ` pinned${edge ? ' pinned-edge' : ''}` : '') + (face ? ` face-${face}` : '')
|
|
403
|
+
const pinClass = (pin !== undefined ? ` pinned${edge ? ' pinned-edge' : ''}` : '') + (face ? ` face-${face}` : '');
|
|
402
404
|
/* A record's tags (tagLists.ts): a few chips, and how many more there are. */
|
|
403
405
|
if (meta?.type === TAGS_TYPE) {
|
|
404
406
|
const chips = tagChips(value);
|
|
@@ -543,6 +545,10 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
543
545
|
status as a pill spends 41px there, one that says it as a dot and a word 12, and sizing every column for the
|
|
544
546
|
wider kept 30px of every table's room in a status that never used it. -1: the cell holds no chip. */
|
|
545
547
|
const [cellChips, setCellChips] = useState({});
|
|
548
|
+
/* Each column's cell padding as its first row draws it, a pixel spare: what a value is stood off its edges by. */
|
|
549
|
+
const [cellPads, setCellPads] = useState({});
|
|
550
|
+
/* What each head stands its label off its edges by: its own padding and its sort's leading one (gridSizing.ts). */
|
|
551
|
+
const [headPads, setHeadPads] = useState({});
|
|
546
552
|
/* Counts the times a face arrived after the columns were sized in its fallback: the sizes are read again, once for
|
|
547
553
|
each, so a table's columns never stay as the fallback face set them (textMeasure.ts). */
|
|
548
554
|
const [faceEpoch, setFaceEpoch] = useState(0);
|
|
@@ -553,8 +559,11 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
553
559
|
/* The look says how wide its heads' characters set (gridSizing.ts); read
|
|
554
560
|
again when the reader picks another look, which moves no width. */
|
|
555
561
|
let sizedInFallback = false;
|
|
562
|
+
/* The fonts the last measure was made in, to know a face that arrives later as one of them. */
|
|
563
|
+
let measuredIn = '';
|
|
556
564
|
const measure = (contentWidth) => {
|
|
557
565
|
sizedInFallback = false;
|
|
566
|
+
measuredIn = '';
|
|
558
567
|
const style = getComputedStyle(element);
|
|
559
568
|
/* clientWidth rounds up fractional layout widths. At density zoom that
|
|
560
569
|
can create a one-screen-pixel scroll range even when scrollWidth and
|
|
@@ -574,22 +583,63 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
574
583
|
tracking: parseFloat(face.letterSpacing) || 0,
|
|
575
584
|
};
|
|
576
585
|
sizedInFallback = sizedInFallback || !fontLoaded(next.font);
|
|
586
|
+
measuredIn += next.font;
|
|
577
587
|
setHeadFace((was) => (was && was.font === next.font && was.upper === next.upper && was.tracking === next.tracking ? was : next));
|
|
578
588
|
}
|
|
589
|
+
const around = {};
|
|
590
|
+
for (const th of element.querySelector('thead tr')?.children ?? []) {
|
|
591
|
+
const name = th.getAttribute('data-col');
|
|
592
|
+
const sort = th.querySelector('.th-sort');
|
|
593
|
+
if (!name || !sort)
|
|
594
|
+
continue;
|
|
595
|
+
const box = getComputedStyle(th);
|
|
596
|
+
around[name] =
|
|
597
|
+
(parseFloat(box.paddingLeft) || 0) + (parseFloat(box.paddingRight) || 0) + (parseFloat(getComputedStyle(sort).paddingLeft) || 0);
|
|
598
|
+
}
|
|
599
|
+
setHeadPads((was) => (sameRecord(was, around) ? was : around));
|
|
579
600
|
/* A group's head is not a row of values: the first row that is one is sampled. */
|
|
580
601
|
const valueRowSelector = 'tbody tr:not(.grid-group-head):not(.virtual-spacer):not(.grid-totals)';
|
|
581
602
|
const first = element.querySelector(valueRowSelector);
|
|
582
603
|
const heads = [...(element.querySelector('thead tr')?.children ?? [])].map((th) => th.getAttribute('data-col'));
|
|
583
604
|
const cells = first ? [...first.querySelectorAll(':scope > td')] : [];
|
|
584
605
|
if (cells.length) {
|
|
606
|
+
/* The font of what draws the value, which is not always the cell's: a look sets a telephone number or a code in
|
|
607
|
+
its data face on a span inside the cell, and measured in the cell's sans a column came out too narrow for
|
|
608
|
+
the monospace drawn in it, so Mono broke every number over two lines. The longest text in the cell is the
|
|
609
|
+
value (an avatar's initials beside a name are not). */
|
|
610
|
+
const drawing = (cell) => {
|
|
611
|
+
const texts = document.createTreeWalker(cell, NodeFilter.SHOW_TEXT);
|
|
612
|
+
let longest = cell;
|
|
613
|
+
let length = 0;
|
|
614
|
+
for (let node = texts.nextNode(); node; node = texts.nextNode()) {
|
|
615
|
+
const said = node.textContent?.trim().length ?? 0;
|
|
616
|
+
if (said > length && node.parentElement) {
|
|
617
|
+
length = said;
|
|
618
|
+
longest = node.parentElement;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return longest;
|
|
622
|
+
};
|
|
585
623
|
const fonts = cells.map((cell) => {
|
|
586
|
-
const font = getComputedStyle(cell);
|
|
624
|
+
const font = getComputedStyle(drawing(cell));
|
|
587
625
|
return `${font.fontStyle} ${font.fontWeight} ${font.fontSize} ${font.fontFamily}`;
|
|
588
626
|
});
|
|
589
627
|
sizedInFallback = sizedInFallback || !fonts.every(fontLoaded);
|
|
628
|
+
measuredIn += fonts.join(' ');
|
|
590
629
|
const byColumn = (values) => Object.fromEntries(heads.flatMap((name, index) => (name && values[index] !== undefined ? [[name, values[index]]] : [])));
|
|
591
630
|
const named = byColumn(fonts);
|
|
592
631
|
setCellFonts((was) => (sameRecord(was, named) ? was : named));
|
|
632
|
+
/* Never more than the allowance a column had before it was measured: a look that pads a cell wider is
|
|
633
|
+
sized as it was. */
|
|
634
|
+
const pads = {};
|
|
635
|
+
heads.forEach((name, index) => {
|
|
636
|
+
const cell = cells[index];
|
|
637
|
+
if (!name || !cell)
|
|
638
|
+
return;
|
|
639
|
+
const box = getComputedStyle(cell);
|
|
640
|
+
pads[name] = Math.min(24, Math.ceil((parseFloat(box.paddingLeft) || 0) + (parseFloat(box.paddingRight) || 0)) + 1);
|
|
641
|
+
});
|
|
642
|
+
setCellPads((was) => (sameRecord(was, pads) ? was : pads));
|
|
593
643
|
/* The widest chip of the sampled rows, not the first row's: a look may draw a neutral state as a bare word
|
|
594
644
|
and the rest as pills, and sized by a first-row "Ready" Sage cut every "In review" pill to "In rev…". */
|
|
595
645
|
const rows = [...element.querySelectorAll(valueRowSelector)].slice(0, GRID_SIZE_SAMPLE);
|
|
@@ -622,10 +672,14 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
622
672
|
const themeChanged = () => measure();
|
|
623
673
|
addHostListener(window, VISUAL_THEME_EVENT, themeChanged);
|
|
624
674
|
/* A face that arrives after the first measure: sized again with it, once, and only if the last measure was made
|
|
625
|
-
without it (a face already here moves nothing).
|
|
675
|
+
without it (a face already here moves nothing). "Without it" is also a face not yet declared when the grid
|
|
676
|
+
measured — its sheet was still on its way, so nothing said to wait for it (textMeasure.ts): the arrival names
|
|
677
|
+
its family, and a family the grid measured in is measured again. */
|
|
626
678
|
const faces = globalThis.document?.fonts;
|
|
627
|
-
const arrived = () => {
|
|
628
|
-
|
|
679
|
+
const arrived = (event) => {
|
|
680
|
+
const families = (event.fontfaces ?? []).map((face) => face.family.replace(/["']/g, '').toLowerCase());
|
|
681
|
+
const used = measuredIn.toLowerCase();
|
|
682
|
+
if (!sizedInFallback && !families.some((family) => family && used.includes(family)))
|
|
629
683
|
return;
|
|
630
684
|
measure();
|
|
631
685
|
setFaceEpoch((was) => was + 1);
|
|
@@ -650,22 +704,21 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
650
704
|
const headSet = (text) => headMeasure(headFace.upper ? text.toUpperCase() : text) + headFace.tracking * text.length;
|
|
651
705
|
return {
|
|
652
706
|
headWidth: headMeasure ? headSet(headText) : undefined,
|
|
653
|
-
/* An App's head wraps to two lines before it widens its column (style.css, .th-label). */
|
|
654
|
-
wrapHead: shell().inApp(),
|
|
655
|
-
/* An App's words may wrap too, once its heads have and the room is still short: kept whole on two lines. */
|
|
656
|
-
wrapValues: shell().inApp() && (Boolean(labelColumn) || plan.kind === 'text') && !display?.component,
|
|
657
|
-
headWrap: headMeasure && shell().inApp() ? twoLineWidth(headText, headSet) : undefined,
|
|
658
707
|
/* The head's key badge is words too, where it is drawn (an App hides it, features.css): once a
|
|
659
708
|
number was sized by its figures, the Workbench's "id KEY ↓" lost its "id" under the badge. */
|
|
660
709
|
label: byName.get(name)?.primaryKey && !shell().inApp() ? `${label} ${say('common.key')}` : label,
|
|
661
710
|
title: name === titleName,
|
|
662
711
|
avatar: Boolean(display?.avatar),
|
|
663
712
|
chipExtra: cellChips[name],
|
|
713
|
+
pad: cellPads[name],
|
|
714
|
+
headPad: headPads[name],
|
|
715
|
+
arrow: headMeasure ? headMeasure('↑') : undefined,
|
|
664
716
|
kind: labelColumn ? 'text' : plan.kind,
|
|
665
717
|
controls: language || Boolean(byName.get(name)?.primaryKey || byName.get(name)?.references),
|
|
666
718
|
/* A reference's arrow stands beside its label in the sort (the head, below), after the sort's 4px gap:
|
|
667
|
-
uncounted, it took the room past the label that the resizer's strip is (style.css).
|
|
668
|
-
|
|
719
|
+
uncounted, it took the room past the label that the resizer's strip is (style.css). An App's head draws
|
|
720
|
+
none: a reference there is its record's name, and the arrow is the Workbench's word for a foreign key. */
|
|
721
|
+
mark: byName.get(name)?.references && !shell().inApp() ? 4 + (headMeasure ? headSet(REFERENCE_MARK) : GRID_HEAD_CHAR) : undefined,
|
|
669
722
|
/* On touch the head's caret and moves stand beside its label, which gives way to them. The key's label is the
|
|
670
723
|
shortest and gave way whole: a phone drew the Workbench's "id KEY ↓" as "KEY ↓". Its column keeps their
|
|
671
724
|
room; any other head's label may still give way, as it was designed to. */
|
|
@@ -731,6 +784,8 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
731
784
|
titleName,
|
|
732
785
|
headFace,
|
|
733
786
|
cellChips,
|
|
787
|
+
cellPads,
|
|
788
|
+
headPads,
|
|
734
789
|
faceEpoch,
|
|
735
790
|
ownLines,
|
|
736
791
|
]);
|
|
@@ -746,9 +801,9 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
746
801
|
/* faceEpoch: a face that arrived measures again under the same font string. */
|
|
747
802
|
[cellFonts, faceEpoch]);
|
|
748
803
|
const measureAsked = useMemo(() => measureIn(asked), [measureIn, asked]);
|
|
749
|
-
/* An App's own list folds the columns its room cannot hold under the row's name, as a detail line, once its
|
|
750
|
-
|
|
751
|
-
embedded grid leaves them out, as it did. */
|
|
804
|
+
/* An App's own list folds the columns its room cannot hold under the row's name, as a detail line, once its
|
|
805
|
+
secondary text has given way to its floor (gridSizing.ts): they are moved, not lost, and the list does not scroll
|
|
806
|
+
sideways. An embedded grid leaves them out, as it did. */
|
|
752
807
|
const folds = !dropColumns && sizing === 'fit' && shell().inApp();
|
|
753
808
|
/* What folded, and the width it folded at (gridSizing.ts holdFold): a fold changes the rows' height, and the
|
|
754
809
|
scrollbar that brings or takes away must not unfold it again. */
|
|
@@ -756,7 +811,7 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
756
811
|
const kept = useMemo(() => {
|
|
757
812
|
if (!((dropColumns || folds) && sizing === 'fit'))
|
|
758
813
|
return null;
|
|
759
|
-
const next = keepFitting(sizeHints, availableWidth, slotted, trailing, headChar, measureAsked);
|
|
814
|
+
const next = keepFitting(sizeHints, availableWidth, slotted, trailing, headChar, measureAsked, folds);
|
|
760
815
|
const decided = holdFold(foldHeld.current, next, availableWidth, [asked.join('\u0000'), rows]);
|
|
761
816
|
foldHeld.current = decided.held;
|
|
762
817
|
return decided.kept;
|
|
@@ -1013,7 +1068,6 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
1013
1068
|
photoOwner: avatarOwner(table, name, display, data.columns),
|
|
1014
1069
|
pin: lefts.get(name),
|
|
1015
1070
|
edge: name === lastPinned,
|
|
1016
|
-
...(fit.wraps[ordered.indexOf(name)] ? { wraps: true } : {}),
|
|
1017
1071
|
...(name === foldsInto
|
|
1018
1072
|
? {
|
|
1019
1073
|
more: folded.map((other) => ({
|
|
@@ -1124,7 +1178,7 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
1124
1178
|
sortBy(name, sortDirection(currentEntry()?.query ?? '', name) === 'asc' ? 'desc' : 'asc', true);
|
|
1125
1179
|
else
|
|
1126
1180
|
sortBy(name);
|
|
1127
|
-
}, children: [_jsx("span", { className: "th-label", children: headLabel }), meta?.primaryKey && _jsx("span", { className: "pk", children: say('common.key') }), meta?.references && _jsx("span", { className: "fk", children: REFERENCE_MARK }), sorted && _jsx("span", { className: "th-arrow", children: sorted === 'desc' ? '↓' : '↑' })] }), interactive && (_jsxs("span", { className: "th-moves", children: [_jsx("button", { type: "button", className: "th-move th-move-left", tabIndex: -1, disabled: !canMove(name, 'left'), title: say('moveColumnLeft', { name: headLabel }), "aria-label": say('moveColumnLeft', { name: headLabel }), onClick: (e) => {
|
|
1181
|
+
}, children: [_jsx("span", { className: "th-label", children: headLabel }), meta?.primaryKey && _jsx("span", { className: "pk", children: say('common.key') }), meta?.references && !inApp && _jsx("span", { className: "fk", children: REFERENCE_MARK }), sorted && _jsx("span", { className: "th-arrow", children: sorted === 'desc' ? '↓' : '↑' })] }), interactive && (_jsxs("span", { className: "th-moves", children: [_jsx("button", { type: "button", className: "th-move th-move-left", tabIndex: -1, disabled: !canMove(name, 'left'), title: say('moveColumnLeft', { name: headLabel }), "aria-label": say('moveColumnLeft', { name: headLabel }), onClick: (e) => {
|
|
1128
1182
|
e.stopPropagation();
|
|
1129
1183
|
stepColumn(name, 'left');
|
|
1130
1184
|
} }), _jsx("button", { type: "button", className: "th-move th-move-right", tabIndex: -1, disabled: !canMove(name, 'right'), title: say('moveColumnRight', { name: headLabel }), "aria-label": say('moveColumnRight', { name: headLabel }), onClick: (e) => {
|
|
@@ -1230,7 +1284,7 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
1230
1284
|
const named = groupKey(value);
|
|
1231
1285
|
const starts = at === 0 || groupKey(modelRows[shown[at - 1]]?.original[group.column]) !== named;
|
|
1232
1286
|
const shut = shutGroups.has(named);
|
|
1233
|
-
return (_jsxs(Fragment, { children: [starts && (_jsx(GroupHeadRow, { head: group.head(value), folded: shut, onToggle: () => setShutGroups((was) => {
|
|
1287
|
+
return (_jsxs(Fragment, { children: [starts && (_jsx(GroupHeadRow, { head: group.head(value), hostRef: hosts.ref(groupHostKey(named)), folded: shut, onToggle: () => setShutGroups((was) => {
|
|
1234
1288
|
const next = new Set(was);
|
|
1235
1289
|
if (!next.delete(named))
|
|
1236
1290
|
next.add(named);
|
|
@@ -1254,12 +1308,12 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
1254
1308
|
* under each `totals` column, its subtotal — the breakdown's figures, so a group a page divides is counted whole. The
|
|
1255
1309
|
* value is a button that folds the group's rows away and opens them again.
|
|
1256
1310
|
*/
|
|
1257
|
-
function GroupHeadRow({ head, folded, onToggle, slot, trail, columns, table, }) {
|
|
1311
|
+
function GroupHeadRow({ head, hostRef, folded, onToggle, slot, trail, columns, table, }) {
|
|
1258
1312
|
const sums = head.sums ?? {};
|
|
1259
1313
|
/* The value spans the columns before the first subtotal, so each figure stands under the column it sums. */
|
|
1260
1314
|
const first = columns.findIndex((name) => Object.hasOwn(sums, name));
|
|
1261
1315
|
const lead = first < 0 ? columns.length : Math.max(1, first);
|
|
1262
|
-
return (_jsxs("tr", { className: `grid-group-head${folded ? ' is-folded' : ''}`, children: [slot && _jsx("td", { className: "expander-cell" }), _jsx("td", { colSpan: lead, className: "grid-group-cell", children: _jsxs("button", { type: "button", className: "grid-group-toggle", "aria-expanded": !folded, onClick: onToggle, children: [_jsx(Icon, { name: folded ? 'caret-right' : 'caret-down', size: 14, className: "grid-group-caret" }), _jsx("span", { className: "grid-group-name", children: head.label }), head.count !== undefined && _jsx("span", { className: "grid-group-count", children: formatNumber(head.count) })] }) }), columns.slice(lead).map((name) => Object.hasOwn(sums, name) ? (_jsx("td", { className: "align-right num grid-group-sum", children: _jsx(TotalValue, { value: sums[name], display: columnDisplay(table?.id, name) }) }, name)) : (_jsx("td", {}, name))), trail && _jsx("td", {})] }));
|
|
1316
|
+
return (_jsxs("tr", { className: `grid-group-head${folded ? ' is-folded' : ''}`, children: [slot && _jsx("td", { className: "expander-cell row-host", ref: hostRef }), _jsx("td", { colSpan: lead, className: "grid-group-cell", children: _jsxs("button", { type: "button", className: "grid-group-toggle", "aria-expanded": !folded, onClick: onToggle, children: [_jsx(Icon, { name: folded ? 'caret-right' : 'caret-down', size: 14, className: "grid-group-caret" }), _jsx("span", { className: "grid-group-name", children: head.label }), head.count !== undefined && _jsx("span", { className: "grid-group-count", children: formatNumber(head.count) })] }) }), columns.slice(lead).map((name) => Object.hasOwn(sums, name) ? (_jsx("td", { className: "align-right num grid-group-sum", children: _jsx(TotalValue, { value: sums[name], display: columnDisplay(table?.id, name) }) }, name)) : (_jsx("td", {}, name))), trail && _jsx("td", {})] }));
|
|
1263
1317
|
}
|
|
1264
1318
|
/**
|
|
1265
1319
|
* One row, and its detail row when it is open. The leading cell, when the
|
|
@@ -1276,7 +1330,7 @@ const Row = memo(function Row({ index, rowKey, slot, hostRef, trail = false, tra
|
|
|
1276
1330
|
if (e.currentTarget.contains(e.target))
|
|
1277
1331
|
onOpen(record);
|
|
1278
1332
|
}
|
|
1279
|
-
: undefined, children: [slot && _jsx("td", { className: "expander-cell row-host", ref: hostRef }), columns.map((column) => (_jsx(Cell, { meta: column.meta, plan: column.plan, value: column.named ? keyName(column.named, record[column.name]) : record[column.name], label: column.label ? record[column.label] : undefined, display: column.display, pin: column.pin, edge: column.edge,
|
|
1333
|
+
: undefined, children: [slot && _jsx("td", { className: "expander-cell row-host", ref: hostRef }), columns.map((column) => (_jsx(Cell, { meta: column.meta, plan: column.plan, value: column.named ? keyName(column.named, record[column.name]) : record[column.name], label: column.label ? record[column.label] : undefined, display: column.display, pin: column.pin, edge: column.edge, more: column.more ? foldedOf(column.more, record) : undefined, sub: column.subtitle && Object.hasOwn(record, column.subtitle) ? record[column.subtitle] : undefined, currency: column.currency ? record[column.currency] : undefined, open: column.display?.format === 'relative' && dueOpen(table?.id, column.name, record) ? true : undefined, lead: leadOf(column, record), name: column.name, editCell: editCell, adornCell: adornCell, record: editCell || adornCell ? record : undefined, photo: column.photoOwner ? photoOf(column.name, record[column.photoOwner]) : undefined, row: column.display?.component ? record : undefined, table: table?.id }, column.name))), trail && _jsx("td", { className: "row-trail", ref: trailRef })] }));
|
|
1280
1334
|
if (!open || !table)
|
|
1281
1335
|
return row;
|
|
1282
1336
|
return (_jsxs(_Fragment, { children: [row, _jsx(RowHostScope, { store: null, children: _jsx(RowTrailScope, { store: null, children: _jsx(DetailRow, { table: table, row: record, colSpan: colSpan, grid: Grid }) }) })] }));
|
|
@@ -141,7 +141,7 @@ export function GridCellEdit({ table, row, column, recordKey, draw, byName = fal
|
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
const node = surface.current;
|
|
144
|
-
node?.querySelector('input,
|
|
144
|
+
node?.querySelector('input, [data-slot="select-trigger"], button')?.focus();
|
|
145
145
|
}, [editing]);
|
|
146
146
|
const open = () => {
|
|
147
147
|
if (!canEditRow(table, recordKey) ||
|
|
@@ -253,7 +253,9 @@ export function GridCellEdit({ table, row, column, recordKey, draw, byName = fal
|
|
|
253
253
|
const active = document.activeElement;
|
|
254
254
|
if (!alive.current || !node || !editing)
|
|
255
255
|
return;
|
|
256
|
-
if (active &&
|
|
256
|
+
if (active &&
|
|
257
|
+
(node.contains(active) ||
|
|
258
|
+
active.closest('[role="listbox"], [role="dialog"], [data-slot="select-content"], [data-slot="popover-content"][data-kind="calendar"]')))
|
|
257
259
|
return;
|
|
258
260
|
void commit(draft, false, pickedLabel());
|
|
259
261
|
});
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { TableMeta } from '@mistriwork/engine/shared/schema.js';
|
|
8
8
|
import type { AppAction } from '@mistriwork/engine/schema/model.js';
|
|
9
|
-
|
|
9
|
+
import { type GridGroup } from './Grid.js';
|
|
10
|
+
export declare function GridSelection({ table, rows, actions, interactive, editable, group, }: {
|
|
10
11
|
table: TableMeta;
|
|
11
12
|
rows: Array<Record<string, unknown>>;
|
|
12
13
|
actions: AppAction[];
|
|
13
14
|
interactive: boolean;
|
|
14
15
|
/** The list's editable columns: the selection offers "Set field…" over them. */
|
|
15
16
|
editable?: readonly string[];
|
|
17
|
+
/** The list's groups (a list view's `group`): each group's head gets a box for every row of it loaded here. */
|
|
18
|
+
group?: GridGroup;
|
|
16
19
|
}): import("react").JSX.Element;
|
|
@@ -4,9 +4,10 @@ import { shell } from '../shellMode.js';
|
|
|
4
4
|
import { bulkKey } from '../bulkActions.js';
|
|
5
5
|
import { resourceOf } from './appRooms.js';
|
|
6
6
|
import { RowDecoration, RowHeadDecoration } from './RowHost.js';
|
|
7
|
+
import { groupHostKey } from './Grid.js';
|
|
7
8
|
import { useBulkSelection } from './useBulkSelection.js';
|
|
8
9
|
import { say } from '../copy/lists/components/GridSelection.js';
|
|
9
|
-
export function GridSelection({ table, rows, actions, interactive, editable = [], }) {
|
|
10
|
+
export function GridSelection({ table, rows, actions, interactive, editable = [], group, }) {
|
|
10
11
|
const keyed = rows.flatMap((row) => {
|
|
11
12
|
const key = keyOf(table, row);
|
|
12
13
|
return key ? [{ id: bulkKey(table, key), key, label: String(rowLabel(table, row) ?? say('common.untitled')), row }] : [];
|
|
@@ -21,8 +22,24 @@ export function GridSelection({ table, rows, actions, interactive, editable = []
|
|
|
21
22
|
the column says what it is. Its name says what "all" takes — the rows
|
|
22
23
|
loaded here, as before — in the resource's own word where it has one. */
|
|
23
24
|
const noun = resourceOf(shell().app(), table.id)?.noun?.many ?? 'rows';
|
|
24
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "grid-select-bar", children: bar }), keyed.length > 0 && (_jsx(RowHeadDecoration, { children: _jsx("input", { type: "checkbox", className: "row-select", "aria-label": say('selectAll', { noun }), checked: every, ref: (box) => {
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "grid-select-bar", children: _jsx("div", { className: "grid-select-float", children: bar }) }), keyed.length > 0 && (_jsx(RowHeadDecoration, { children: _jsx("input", { type: "checkbox", className: "row-select", "aria-label": say('selectAll', { noun }), checked: every, ref: (box) => {
|
|
25
26
|
if (box)
|
|
26
27
|
box.indeterminate = partly;
|
|
27
|
-
}, onChange: () => change(every ? [] : keyed.map((record) => record.id)) }) })),
|
|
28
|
+
}, onChange: () => change(every ? [] : keyed.map((record) => record.id)) }) })), group &&
|
|
29
|
+
[
|
|
30
|
+
...keyed.reduce((groups, record) => {
|
|
31
|
+
const host = groupHostKey(record.row[group.column]);
|
|
32
|
+
groups.set(host, [...(groups.get(host) ?? []), record]);
|
|
33
|
+
return groups;
|
|
34
|
+
}, new Map()),
|
|
35
|
+
].map(([host, members]) => {
|
|
36
|
+
/* Every row of the group that is loaded here, as the header's box takes every row loaded. */
|
|
37
|
+
const ids = members.map((record) => record.id);
|
|
38
|
+
const all = ids.every((id) => chosen.has(id));
|
|
39
|
+
const some = !all && ids.some((id) => chosen.has(id));
|
|
40
|
+
return (_jsx(RowDecoration, { rowKey: host, children: _jsx("input", { type: "checkbox", className: "row-select", "aria-label": say('selectGroup', { group: group.head(members[0].row[group.column]).label }), checked: all, ref: (box) => {
|
|
41
|
+
if (box)
|
|
42
|
+
box.indeterminate = some;
|
|
43
|
+
}, onClick: (event) => event.stopPropagation(), onChange: () => change(all ? selection.filter((id) => !ids.includes(id)) : [...selection, ...ids.filter((id) => !chosen.has(id))]) }) }, host));
|
|
44
|
+
}), keyed.map((record) => (_jsx(RowDecoration, { rowKey: record.id, children: _jsx("input", { type: "checkbox", className: "row-select", "aria-label": say('select', { label: record.label }), checked: chosen.has(record.id), onClick: (event) => event.stopPropagation(), onChange: (event) => change(event.target.checked ? [...selection, record.id] : selection.filter((id) => id !== record.id)) }) }, record.id))), dialogs] }));
|
|
28
45
|
}
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
.front-hero-beside { grid-template-columns: minmax(0, 3fr) minmax(16rem, 2fr); column-gap: 64px; align-items: center; }
|
|
56
56
|
.front-hero-beside .front-hero-search { grid-column: 1 / -1; }
|
|
57
57
|
.front-hero-points { padding-inline-start: var(--space-7); border-inline-start: 1px solid var(--line); }
|
|
58
|
-
.front-hero-points
|
|
58
|
+
.front-hero-points [data-slot='icon-rows'] { gap: var(--space-5); font-size: var(--text-md); line-height: 1.45; }
|
|
59
59
|
}
|
|
60
60
|
.front-hero-overlay { grid-template-columns: minmax(0, 1fr); container: front-hero / inline-size; }
|
|
61
61
|
.front-hero-overlay .front-hero-media, .front-hero-overlay .front-hero-text { grid-column: 1; grid-row: 1; }
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
/* A text box and a Select in one row are one kind of field: the same edge,
|
|
132
132
|
ground, face and height. Left to the browser, the text box drew its own
|
|
133
133
|
inset grey frame beside the look's selects. */
|
|
134
|
-
.front-search-input, .front-search-field
|
|
134
|
+
.front-search-input, .front-search-field [data-slot='select-trigger'] {
|
|
135
135
|
box-sizing: border-box; width: 100%; min-height: 40px; padding: var(--space-3) var(--space-3h);
|
|
136
136
|
font: var(--text-md) var(--sans); color: var(--ink); background: var(--surface);
|
|
137
137
|
border: 1px solid var(--line-control); border-radius: var(--field-radius, var(--radius));
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/* What dresses the layout builder and its field arranger. These rules match nothing else, so they travel with the component's chunk and are not in
|
|
2
|
+
every first paint (scripts/bundle-budget.mjs); each keeps the layer it stood in. */
|
|
3
|
+
@layer base {
|
|
4
|
+
/* The layout's own name, edited in place in the builder's header. */
|
|
5
|
+
.tpl-title { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
|
|
6
|
+
.tpl-eyebrow {
|
|
7
|
+
font: var(--text-xs) var(--mono); text-transform: uppercase; letter-spacing: 0.07em;
|
|
8
|
+
color: var(--ink-subtle);
|
|
9
|
+
}
|
|
10
|
+
.tpl-name {
|
|
11
|
+
flex: 1 1 8rem; min-width: 0; max-width: 100%;
|
|
12
|
+
padding: var(--space-1) var(--space-2h); margin: 0 -6px;
|
|
13
|
+
border: 1px solid transparent; border-radius: var(--radius-item);
|
|
14
|
+
background: none; color: var(--ink);
|
|
15
|
+
font: 600 calc(15px * var(--type-k)) var(--mono); letter-spacing: 0;
|
|
16
|
+
}
|
|
17
|
+
.tpl-name:hover { border-color: var(--line); }
|
|
18
|
+
.tpl-name:focus { outline: none; border-color: var(--focus); background: var(--ground); }
|
|
19
|
+
.tpl-for { font: var(--text-xs) var(--mono); color: var(--ink-subtle); overflow-wrap: anywhere; }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@layer base {
|
|
23
|
+
@media (max-width: 700px) {
|
|
24
|
+
.tpl-title { display: grid; grid-template-columns: minmax(0, 1fr); }
|
|
25
|
+
.tpl-name { width: 100%; margin: 0; }
|
|
26
|
+
.tpl-section-head { flex-wrap: wrap; }
|
|
27
|
+
.tpl-section-name { overflow-wrap: anywhere; }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@layer base {
|
|
32
|
+
.tpl-head {
|
|
33
|
+
padding: var(--space-4h) var(--space-5) var(--space-4);
|
|
34
|
+
border-bottom: 1px solid var(--line);
|
|
35
|
+
display: flex; flex-direction: column; gap: var(--space-2h);
|
|
36
|
+
}
|
|
37
|
+
.tpl-head h2 { margin: 0; font: 600 var(--text-base) var(--sans); letter-spacing: -0.01em; }
|
|
38
|
+
.tpl-head-actions { display: flex; gap: var(--space-2h); flex-wrap: wrap; margin-top: var(--space-1); }
|
|
39
|
+
.tpl-head-actions button { padding: var(--space-2) var(--space-3h); font-size: var(--text-sm); }
|
|
40
|
+
.tpl-error, .tpl-recovery p { margin: 0; font-size: var(--text-sm); overflow-wrap: anywhere; }
|
|
41
|
+
.tpl-error { color: var(--status-critical); }
|
|
42
|
+
.tpl-recovery { padding-block: var(--space-3); border-block: 1px solid var(--line); }
|
|
43
|
+
.tpl-body[inert] { opacity: 0.6; }
|
|
44
|
+
.tpl-body { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-4h) var(--space-7); }
|
|
45
|
+
.tpl-section { border: 1px solid var(--line); border-radius: var(--radius-panel); margin-bottom: var(--space-3); background: var(--ground); }
|
|
46
|
+
.tpl-section.off { opacity: 0.55; }
|
|
47
|
+
.tpl-section-head {
|
|
48
|
+
display: flex; align-items: center; gap: var(--space-3h);
|
|
49
|
+
padding: var(--space-3h) var(--space-4);
|
|
50
|
+
border-bottom: 1px solid var(--line);
|
|
51
|
+
}
|
|
52
|
+
.tpl-section.off .tpl-section-head { border-bottom: none; }
|
|
53
|
+
.tpl-toggle { display: flex; align-items: center; gap: var(--space-3); cursor: pointer; }
|
|
54
|
+
.tpl-section-name { font: 600 var(--text-sm) var(--sans); color: var(--ink); }
|
|
55
|
+
.tpl-section-kind { font: var(--text-xs) var(--mono); color: var(--ink-subtle); }
|
|
56
|
+
.tpl-section-actions { margin-left: auto; display: flex; gap: var(--space-1); }
|
|
57
|
+
.tpl-move {
|
|
58
|
+
background: none; border: none; border-radius: min(4px, var(--radius));
|
|
59
|
+
color: var(--ink-muted); cursor: pointer; padding: var(--space-1h) var(--space-3); font-size: var(--text-xs);
|
|
60
|
+
}
|
|
61
|
+
.tpl-move:hover:not([disabled]) { color: var(--accent-ink); background: var(--accent-soft); }
|
|
62
|
+
.tpl-move[disabled] { color: var(--ink-subtle); cursor: default; }
|
|
63
|
+
/* The shared arranger (page.css, `.pb-*`) inside a layout card.
|
|
64
|
+
|
|
65
|
+
It is drawn there to hang off a builder row — no top border, its own tint,
|
|
66
|
+
rounded at the bottom only — and a card already provides all three. So it
|
|
67
|
+
keeps its contents and gives up its box. */
|
|
68
|
+
.tpl-section .pb-panel {
|
|
69
|
+
margin: 0; padding: var(--space-3) var(--space-3h) var(--space-3h);
|
|
70
|
+
background: none; border: none; border-radius: 0;
|
|
71
|
+
}
|
|
72
|
+
.tpl-section .pb-arrange { max-height: none; }
|
|
73
|
+
.tpl-rows {
|
|
74
|
+
display: flex; align-items: center; gap: var(--space-3);
|
|
75
|
+
padding: var(--space-2) var(--space-4) var(--space-4); font-size: var(--text-sm); color: var(--ink-muted);
|
|
76
|
+
}
|
|
77
|
+
.tpl-rows input {
|
|
78
|
+
width: 4.5rem; padding: var(--space-2) var(--space-3);
|
|
79
|
+
font: var(--text-sm) var(--mono); color: var(--ink);
|
|
80
|
+
background: var(--ground); border: 1px solid var(--line-control); border-radius: var(--radius);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@layer base {
|
|
85
|
+
.pb-label {
|
|
86
|
+
font: var(--text-xs) var(--mono);
|
|
87
|
+
text-transform: uppercase;
|
|
88
|
+
letter-spacing: 0.06em;
|
|
89
|
+
color: var(--ink-subtle);
|
|
90
|
+
flex: none;
|
|
91
|
+
}
|
|
92
|
+
.pb-remove:hover {
|
|
93
|
+
color: var(--status-critical);
|
|
94
|
+
}
|
|
95
|
+
.pb-spacer {
|
|
96
|
+
flex: 1 1 auto;
|
|
97
|
+
}
|
|
98
|
+
.pb-panel {
|
|
99
|
+
margin: 0 var(--space-3) var(--space-1);
|
|
100
|
+
padding: var(--space-3) var(--space-3h) var(--space-3h);
|
|
101
|
+
background: var(--raised);
|
|
102
|
+
border: 1px solid var(--line);
|
|
103
|
+
border-top: none;
|
|
104
|
+
border-radius: 0 0 var(--radius) var(--radius);
|
|
105
|
+
}
|
|
106
|
+
.pb-panel-head {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: baseline;
|
|
109
|
+
gap: var(--space-3);
|
|
110
|
+
margin-bottom: var(--space-2h);
|
|
111
|
+
}
|
|
112
|
+
.pb-panel-head button {
|
|
113
|
+
padding: var(--space-1) var(--space-3);
|
|
114
|
+
font-size: var(--text-xs);
|
|
115
|
+
}
|
|
116
|
+
.pb-field-count {
|
|
117
|
+
font: var(--text-xs) var(--mono);
|
|
118
|
+
color: var(--ink-subtle);
|
|
119
|
+
}
|
|
120
|
+
.pb-field-name {
|
|
121
|
+
font: var(--text-sm) var(--mono);
|
|
122
|
+
color: var(--ink);
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
}
|
|
127
|
+
.pb-field-type {
|
|
128
|
+
font: var(--text-xs) var(--mono);
|
|
129
|
+
color: var(--ink-subtle);
|
|
130
|
+
flex: none;
|
|
131
|
+
}
|
|
132
|
+
/* The fields on a group, laid out the way the page will lay them out — same
|
|
133
|
+
column count, same order — so arranging them is done on a picture of the
|
|
134
|
+
result rather than on a list that has to be imagined into one. */
|
|
135
|
+
.pb-arrange {
|
|
136
|
+
display: grid;
|
|
137
|
+
gap: var(--space-1) var(--space-3h);
|
|
138
|
+
max-height: 34vh;
|
|
139
|
+
overflow-y: auto;
|
|
140
|
+
margin-bottom: var(--space-3);
|
|
141
|
+
}
|
|
142
|
+
.pb-arrange-row {
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: baseline;
|
|
145
|
+
gap: var(--space-3);
|
|
146
|
+
padding: var(--space-1h) var(--space-2) var(--space-1h) var(--space-1);
|
|
147
|
+
border-radius: var(--radius);
|
|
148
|
+
background: var(--surface);
|
|
149
|
+
border: 1px solid var(--line);
|
|
150
|
+
cursor: grab;
|
|
151
|
+
min-width: 0;
|
|
152
|
+
position: relative;
|
|
153
|
+
}
|
|
154
|
+
.pb-arrange-row:focus-visible {
|
|
155
|
+
outline: var(--focus-width) solid var(--focus);
|
|
156
|
+
outline-offset: 1px;
|
|
157
|
+
}
|
|
158
|
+
.pb-arrange-row.dragging {
|
|
159
|
+
opacity: 0.45;
|
|
160
|
+
cursor: grabbing;
|
|
161
|
+
}
|
|
162
|
+
.pb-arrange-row .pb-field-name {
|
|
163
|
+
flex: 1;
|
|
164
|
+
}
|
|
165
|
+
.pb-grip {
|
|
166
|
+
font: var(--text-sm) var(--mono);
|
|
167
|
+
color: var(--ink-subtle);
|
|
168
|
+
letter-spacing: -1px;
|
|
169
|
+
flex: none;
|
|
170
|
+
transform: rotate(90deg);
|
|
171
|
+
}
|
|
172
|
+
.pb-arrange-row .pb-send,
|
|
173
|
+
.pb-arrange-row .pb-remove {
|
|
174
|
+
flex: none;
|
|
175
|
+
padding: 0 var(--space-2);
|
|
176
|
+
font-size: var(--text-xs);
|
|
177
|
+
line-height: 1.6;
|
|
178
|
+
opacity: 0;
|
|
179
|
+
}
|
|
180
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
181
|
+
.pb-arrange-row .pb-send,
|
|
182
|
+
.pb-arrange-row .pb-remove {
|
|
183
|
+
transition: opacity var(--t-hover) var(--ease-out);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
.pb-arrange-row:hover .pb-send,
|
|
187
|
+
.pb-arrange-row:hover .pb-remove,
|
|
188
|
+
.pb-arrange-row:focus-within .pb-send,
|
|
189
|
+
.pb-arrange-row:focus-within .pb-remove {
|
|
190
|
+
opacity: 1;
|
|
191
|
+
}
|
|
192
|
+
/* Which group to send a field to, opened in the row itself: a dialog here
|
|
193
|
+
would cover the arrangement being made. */
|
|
194
|
+
.pb-send-menu {
|
|
195
|
+
position: absolute;
|
|
196
|
+
z-index: 3;
|
|
197
|
+
top: 100%;
|
|
198
|
+
right: 0;
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
background: var(--surface);
|
|
202
|
+
border: 1px solid var(--line);
|
|
203
|
+
border-radius: var(--radius);
|
|
204
|
+
padding: var(--space-1h);
|
|
205
|
+
gap: var(--space-1);
|
|
206
|
+
box-shadow: var(--shadow, var(--shadow-pop));
|
|
207
|
+
}
|
|
208
|
+
.pb-send-menu button {
|
|
209
|
+
font-size: var(--text-xs);
|
|
210
|
+
text-align: left;
|
|
211
|
+
white-space: nowrap;
|
|
212
|
+
}
|
|
213
|
+
/* Everything not on the page, as chips: short names, many of them, and each
|
|
214
|
+
one click from being added. */
|
|
215
|
+
.pb-pool {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-wrap: wrap;
|
|
218
|
+
align-items: baseline;
|
|
219
|
+
gap: var(--space-2);
|
|
220
|
+
}
|
|
221
|
+
.pb-add-field {
|
|
222
|
+
font: var(--text-xs) var(--mono);
|
|
223
|
+
padding: var(--space-1) var(--space-3);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -12,6 +12,7 @@ import { promptFor } from '../prompt.js';
|
|
|
12
12
|
import { DEFAULT_LIST_LIMIT } from '@mistriwork/engine/shared/recordview.js';
|
|
13
13
|
import { FieldArranger } from './FieldArranger.js';
|
|
14
14
|
import { say } from '../copy/record/components/LayoutBuilder.js';
|
|
15
|
+
import './LayoutBuilder.css';
|
|
15
16
|
function childOf(section) {
|
|
16
17
|
const fk = state.schema.foreignKeys.find((f) => f.name === section.via);
|
|
17
18
|
return fk ? (findTable(fk.from.table) ?? null) : null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The columns a reader left out of a view, among the ones it offers, and the way to change them. */
|
|
2
|
+
export declare function useListColumns(view: string | undefined, offered: readonly string[]): [string[], (hidden: string[]) => void];
|
|
3
|
+
export declare function ListColumns({ columns, hidden, onChange, caption, }: {
|
|
4
|
+
/** The view's columns in its order, each by the label its head says. */
|
|
5
|
+
columns: ReadonlyArray<{
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}>;
|
|
9
|
+
hidden: readonly string[];
|
|
10
|
+
onChange: (hidden: string[]) => void;
|
|
11
|
+
caption: string;
|
|
12
|
+
}): import("react").JSX.Element;
|