@mistriwork/kit 1.0.0-rc.62 → 1.0.0-rc.64
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 +5 -4
- package/dist/client/components/AiMark.d.ts +6 -0
- package/dist/client/components/AiMark.js +21 -0
- package/dist/client/components/AppList.js +6 -3
- package/dist/client/components/Content.js +3 -1
- package/dist/client/components/Crumbs.js +8 -4
- package/dist/client/components/DashHead.js +2 -1
- package/dist/client/components/DateField.js +3 -3
- package/dist/client/components/Grid.js +32 -7
- package/dist/client/components/GridSelection.js +7 -5
- package/dist/client/components/NewRecord.js +3 -3
- package/dist/client/components/Notes.css +10 -0
- package/dist/client/components/Page.js +1 -1
- package/dist/client/components/PageHeading.d.ts +21 -0
- package/dist/client/components/PageHeading.js +6 -0
- package/dist/client/components/PageHistory.d.ts +6 -1
- package/dist/client/components/PageHistory.js +13 -1
- package/dist/client/components/PageRoom.d.ts +15 -0
- package/dist/client/components/PageRoom.js +10 -1
- package/dist/client/components/Palette.js +9 -4
- package/dist/client/components/appListModel.d.ts +10 -0
- package/dist/client/components/appListModel.js +20 -1
- package/dist/client/components/appRooms.d.ts +2 -0
- package/dist/client/components/appRooms.js +2 -0
- package/dist/client/components/gridArrange.d.ts +4 -3
- package/dist/client/components/gridArrange.js +8 -6
- package/dist/client/components/gridSizing.d.ts +9 -1
- package/dist/client/components/gridSizing.js +21 -2
- package/dist/client/components/useMediaQuery.d.ts +2 -1
- package/dist/client/components/useMediaQuery.js +4 -2
- package/dist/client/components/valueModel.js +1 -1
- package/dist/client/copy/forms/components/DateField.d.ts +3 -3
- package/dist/client/copy/forms/components/DateField.js +3 -3
- package/dist/client/copy/forms/components/NewRecord.d.ts +0 -1
- package/dist/client/copy/forms/components/NewRecord.js +0 -1
- package/dist/client/copy/record/components/PageHistory.d.ts +4 -0
- package/dist/client/copy/record/components/PageHistory.js +4 -0
- package/dist/client/copy/shell/components/AiMark.d.ts +3 -0
- package/dist/client/copy/shell/components/AiMark.js +5 -0
- package/dist/client/core.js +2 -1
- package/dist/client/dayLabel.d.ts +8 -0
- package/dist/client/dayLabel.js +18 -0
- package/dist/client/features.css +52 -4
- package/dist/client/page.css +107 -2
- package/dist/client/palette.js +15 -2
- package/dist/client/shellMode.d.ts +5 -1
- package/dist/client/shellMode.js +1 -0
- package/dist/client/shells.d.ts +2 -0
- package/dist/client/structure.css +43 -9
- package/dist/client/style.css +28 -6
- package/dist/client/visualThemes.css +0 -2
- package/dist/shared/uiTokens.js +1 -0
- package/package.json +4 -3
package/dist/client/app.js
CHANGED
|
@@ -735,10 +735,11 @@ export async function boot(me, landingAt, installed) {
|
|
|
735
735
|
whenPagesChange(() => void registerPages());
|
|
736
736
|
initSidebarToggle();
|
|
737
737
|
// Only remount navigation on a breakpoint crossing; record editors keep their owner.
|
|
738
|
-
chrome.compactNavigation
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
738
|
+
for (const band of [chrome.compactNavigation, chrome.tabletNavigation])
|
|
739
|
+
band?.addEventListener('change', () => {
|
|
740
|
+
if (!businessRetired && sessionIdentity().mode !== 'locked')
|
|
741
|
+
renderTableList($('table-filter').value);
|
|
742
|
+
});
|
|
742
743
|
// The theme bench moved the menu (themeBench.ts): the shell is drawn again around the same room.
|
|
743
744
|
chrome.whenMenuMoves?.(() => {
|
|
744
745
|
if (!businessRetired && sessionIdentity().mode !== 'locked')
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The one mark for something a model made or proposed: a small glyph and the App's word for it (`ai: { label }` on
|
|
4
|
+
* the App, "AI" when absent), in `--ai`. Every built-in AI surface draws this — the review queue, a record's
|
|
5
|
+
* proposal line, history, an unconfirmed field — and an App's own components draw the same one
|
|
6
|
+
* (`@mistriwork/mistri/ui`), so a reader learns one sign rather than six labels.
|
|
7
|
+
*
|
|
8
|
+
* The glyph is drawn here, not taken from the icon set: the chrome's icons travel in the first page's bundle, and
|
|
9
|
+
* this one is needed only where a proposal is. Its rule is a few lines of features.css, so nothing waits on a sheet.
|
|
10
|
+
* `quiet` drops the word, for a cell where the word would crowd the value; the word is still there for a screen reader.
|
|
11
|
+
*/
|
|
12
|
+
import { shell } from '../shellMode.js';
|
|
13
|
+
import { say } from '../copy/shell/components/AiMark.js';
|
|
14
|
+
export function AiMark({ quiet = false, className }) {
|
|
15
|
+
const label = shell().app()?.ai?.label ?? say('ai');
|
|
16
|
+
return (_jsxs("span", { className: className ? `ai-mark ${className}` : 'ai-mark', "data-quiet": quiet ? '' : undefined, children: [_jsxs("svg", { className: "ai-mark-glyph", viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: [_jsx("path", { d: "M8 1.5c.5 3.2 1.8 4.5 5 5-3.2.5-4.5 1.8-5 5-.5-3.2-1.8-4.5-5-5 3.2-.5 4.5-1.8 5-5Z" }), _jsx("path", { d: "M13 10.5c.2 1.2.8 1.8 2 2-1.2.2-1.8.8-2 2-.2-1.2-.8-1.8-2-2 1.2-.2 1.8-.8 2-2Z" })] }), _jsx("span", { className: quiet ? 'visually-hidden' : 'ai-mark-word', children: label })] }));
|
|
17
|
+
}
|
|
18
|
+
/** The App's word for AI, for copy that names it in a sentence ("Proposed by AI"). */
|
|
19
|
+
export function aiWord() {
|
|
20
|
+
return shell().app()?.ai?.label ?? say('ai');
|
|
21
|
+
}
|
|
@@ -42,7 +42,7 @@ import { pluralOf, recordNoun } from '@mistriwork/engine/shared/appNoun.js';
|
|
|
42
42
|
import { primaryKey } from '@mistriwork/engine/shared/schema.js';
|
|
43
43
|
import { findTable } from '../core.js';
|
|
44
44
|
import { sameReads } from '../liveReads.js';
|
|
45
|
-
import { appListQuery, litTabFor, residueOf, searchColumn, shownTabs, visibleQuestion, wholeQuery, subtitleColumns, editedReferences, listReferenceNames, } from './appListModel.js';
|
|
45
|
+
import { appListQuery, litTabFor, tabPinnedColumns, residueOf, searchColumn, shownTabs, visibleQuestion, wholeQuery, subtitleColumns, editedReferences, listReferenceNames, } from './appListModel.js';
|
|
46
46
|
import { boxTail, boxesFor } from './FilterBoxes.js';
|
|
47
47
|
import { onDemand } from './onDemand.js';
|
|
48
48
|
import { useGridGroups } from './useGridGroups.js';
|
|
@@ -662,8 +662,11 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
662
662
|
unchanged. The search box is this room's state, so each character typed
|
|
663
663
|
redrew the room and, with it, the whole grid under the box; now a
|
|
664
664
|
keystroke redraws the box and the chips, and the rows are left alone. */
|
|
665
|
-
|
|
666
|
-
|
|
665
|
+
/* A column the lit tab pins to one value repeats it on every row; the tab says it once. A view with two columns or
|
|
666
|
+
fewer keeps what it has, so the tab never empties the grid. */
|
|
667
|
+
const pinned = litTab >= 0 && (spec.show?.length ?? 0) > 2 ? tabPinnedColumns(spec, tabs[litTab].query ?? '', spec.show) : [];
|
|
668
|
+
const hideKey = [...hide, ...leftOut, ...pinned].join('\n');
|
|
669
|
+
const keptHide = useMemo(() => [...hide, ...leftOut, ...pinned], [hideKey]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
667
670
|
const totalsKey = totals ? JSON.stringify(totals) : '';
|
|
668
671
|
const keptTotals = useMemo(() => totals, [totalsKey]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
669
672
|
const onGridNow = useRef(onGrid);
|
|
@@ -25,7 +25,7 @@ import { currentEntry, paintVersion, renderCrumbs, roomVersion } from '../core.j
|
|
|
25
25
|
import { shell } from '../shellMode.js';
|
|
26
26
|
import { syncHash } from '../url.js';
|
|
27
27
|
import { appListFor } from './appListModel.js';
|
|
28
|
-
import { ASSISTANT_PAGE, DIRECTORY_PAGE, INBOX_PAGE, SETTINGS_PAGE, dashPageId, dashViewKey, formViewKey, homeRoom } from './appRooms.js';
|
|
28
|
+
import { ASSISTANT_PAGE, DIRECTORY_PAGE, INBOX_PAGE, REVIEW_PAGE, SETTINGS_PAGE, dashPageId, dashViewKey, formViewKey, homeRoom, } from './appRooms.js';
|
|
29
29
|
import { onDemand } from './onDemand.js';
|
|
30
30
|
import { crumbBarShown, Crumbs } from './Crumbs.js';
|
|
31
31
|
import { LoadErrorNote, NothingGranted, WorkbenchLanding } from './Landing.js';
|
|
@@ -168,6 +168,8 @@ function Room({ entry }) {
|
|
|
168
168
|
return rooms.Directory ? _jsx(rooms.Directory, {}) : null;
|
|
169
169
|
if (shell().inApp() && page.pageId === SETTINGS_PAGE)
|
|
170
170
|
return rooms.Settings ? _jsx(rooms.Settings, { section: page.tab }) : null;
|
|
171
|
+
if (shell().inApp() && page.pageId === REVIEW_PAGE)
|
|
172
|
+
return rooms.Review ? _jsx(rooms.Review, {}) : null;
|
|
171
173
|
return _jsx(PageRoom, { entry: page });
|
|
172
174
|
}
|
|
173
175
|
return _jsx(RowRoom, { entry: entry });
|
|
@@ -118,16 +118,20 @@ export function Crumbs({ onHome }) {
|
|
|
118
118
|
const setting = trailSetting();
|
|
119
119
|
const home = Boolean(setting && setting.home);
|
|
120
120
|
const previous = stack.length > 1 ? stack[stack.length - 2] : null;
|
|
121
|
-
/*
|
|
122
|
-
|
|
121
|
+
/* An App's record page names itself in its heading straight below, so the trail ends at the list it came from, which
|
|
122
|
+
stays a link: the name stands once, as the title, and not again as the last crumb beside it. The Workbench's record
|
|
123
|
+
has no such heading, and keeps its crumb. */
|
|
123
124
|
const top = stack[stack.length - 1];
|
|
124
|
-
const trail = shell().publicVisitor() && stack.length > 1 && top && (top.kind === 'row' || top.kind === 'page') && top.table
|
|
125
|
+
const trail = (shell().publicVisitor() || shell().inApp()) && stack.length > 1 && top && (top.kind === 'row' || top.kind === 'page') && top.table
|
|
125
126
|
? stack.slice(0, -1)
|
|
126
127
|
: stack;
|
|
127
128
|
// Each crumb keeps its index in the walk, which is where it goes back to.
|
|
128
129
|
const shown = trail.map((entry, index) => ({ entry, index })).filter(({ entry, index }) => !sameRoom(entry, trail[index + 1]));
|
|
129
130
|
return (_jsxs("nav", { className: "crumbs", "aria-label": say('trail'), children: [home && (_jsx("button", { type: "button", className: "crumb-home", ...homeWords(), onClick: onHome, children: _jsxs("svg", { viewBox: "0 0 16 16", width: "17", height: "17", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { d: "M2 7.2 8 2.4l6 4.8" }), _jsx("path", { d: "M3.4 6.6V13a.6.6 0 0 0 .6.6h8a.6.6 0 0 0 .6-.6V6.6" })] }) })), shown.map(({ entry, index: i }, n) => {
|
|
130
131
|
const last = i === stack.length - 1;
|
|
132
|
+
/* Where the step stands in what is drawn, for the stylesheet: a short bar cuts the middle steps first and keeps
|
|
133
|
+
the first, where the trail began, and the last, where the reader is. */
|
|
134
|
+
const place = n === 0 ? 'first' : n === shown.length - 1 ? 'last' : 'middle';
|
|
131
135
|
/* Without the house the first step stands at the start of the bar, with nothing before it to separate. */
|
|
132
136
|
const first = n === 0 && !home;
|
|
133
137
|
/* A row crumb names its table when the walk has changed table —
|
|
@@ -149,6 +153,6 @@ export function Crumbs({ onHome }) {
|
|
|
149
153
|
: '';
|
|
150
154
|
const ownStep = showsTable && shell().inApp();
|
|
151
155
|
const content = (_jsxs(_Fragment, { children: [showsTable && !ownStep && (_jsx("span", { className: "crumb-table", title: entry.table, children: tableWord })), nameOf(entry)] }));
|
|
152
|
-
return (_jsxs(Fragment, { children: [ownStep && (_jsxs(_Fragment, { children: [!first && _jsx("span", { className: "sep", children: "\u203A" }), _jsx("span", { className: "crumb-table-step", children: tableWord })] })), (!first || ownStep) && _jsx("span", { className: "sep", children: "\u203A" }), last ? (_jsx("span", { className: "current", children: content })) : (_jsx("button", { type: "button", onClick: () => backTo(i), children: content }))] }, i));
|
|
156
|
+
return (_jsxs(Fragment, { children: [ownStep && (_jsxs(_Fragment, { children: [!first && _jsx("span", { className: "sep", children: "\u203A" }), _jsx("span", { className: "crumb-table-step", "data-crumb": place, children: tableWord })] })), (!first || ownStep) && _jsx("span", { className: "sep", children: "\u203A" }), last ? (_jsx("span", { className: "current", "data-crumb": place, children: content })) : (_jsx("button", { type: "button", "data-crumb": place, onClick: () => backTo(i), children: content }))] }, i));
|
|
153
157
|
}), _jsx("span", { className: "crumb-note", ref: crumbNoteRef }), previous && !shell().publicVisitor() && (_jsxs("button", { type: "button", className: "crumb-back", title: say('back', { previous: nameOf(previous) }), onClick: () => backTo(stack.length - 2), children: [_jsx(Icon, { name: "caret-left", size: 16 }), _jsx("span", { children: say('common.back') })] })), _jsx("div", { className: "crumb-tools", ref: crumbToolsRef })] }));
|
|
154
158
|
}
|
|
@@ -10,6 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
* title, the crumbs and the palette read the label as they always do.
|
|
11
11
|
*/
|
|
12
12
|
import { FavoriteStar } from './FavoriteStar.js';
|
|
13
|
+
import { PageHeading } from './PageHeading.js';
|
|
13
14
|
export function DashHead({ dashboard, star = true, }) {
|
|
14
15
|
const hidden = dashboard.headingHidden === true || dashboard.head === 'own';
|
|
15
16
|
const title = dashboard.heading ?? dashboard.label;
|
|
@@ -20,5 +21,5 @@ export function DashHead({ dashboard, star = true, }) {
|
|
|
20
21
|
return _jsx("h1", { className: "applist-title visually-hidden", children: title });
|
|
21
22
|
if (dashboard.head === 'compact' && !hidden)
|
|
22
23
|
return (_jsxs("div", { className: "applist-head applist-head-row dash-head-compact", children: [_jsx("h1", { className: "applist-title", children: title }), favorite] }));
|
|
23
|
-
return (
|
|
24
|
+
return (_jsx(PageHeading, { title: title, hidden: hidden, favorite: favorite, description: dashboard.description && dashboard.head !== 'own' ? dashboard.description : undefined }));
|
|
24
25
|
}
|
|
@@ -9,10 +9,10 @@ import { say } from '../copy/forms/components/DateField.js';
|
|
|
9
9
|
import { appWord } from '../messages.js';
|
|
10
10
|
/* Read when a field draws, so a catalog worn later is the one said. */
|
|
11
11
|
const words = () => ({
|
|
12
|
-
|
|
13
|
-
enterDateAndTime: say('enterADateAndTime'),
|
|
12
|
+
timePattern: appWord('mistri.form.timeHint', say('hhMm')),
|
|
13
|
+
enterDateAndTime: (format) => say('enterADateAndTime', { format }),
|
|
14
14
|
enterDate: (format) => say('enterADateInYyyy', { format }),
|
|
15
|
-
dateAndTimeFormat: say('dateAndTimeFormat'),
|
|
15
|
+
dateAndTimeFormat: (format) => say('dateAndTimeFormat', { format }),
|
|
16
16
|
dateFormat: (format) => say('dateFormatIs', { format }),
|
|
17
17
|
openWithKeys: say('altAndDownArrow'),
|
|
18
18
|
chooseDate: (label) => (label ? say('chooseDateFor', { label }) : say('chooseDate')),
|
|
@@ -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, GRID_EXPANDER_WIDTH, GRID_HEAD_CHAR, GRID_SIZE_SAMPLE, holdFold, GRID_TRAIL_WIDTH, } from './gridSizing.js';
|
|
58
|
+
import { columnFloor, 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';
|
|
@@ -309,6 +309,19 @@ function numberShown(value, plan) {
|
|
|
309
309
|
/* A dress that draws only its words: a meter's bar and a percent's bar or ring are width the words do not
|
|
310
310
|
measure. (Only a number's or a date's dress is read for this: an avatar or a signature is text's.) */
|
|
311
311
|
const drawsWords = (dress) => dress.kind !== 'meter' && !('bar' in dress && dress.bar) && !('ring' in dress && dress.ring);
|
|
312
|
+
/* What a bar or a ring draws beside its words: its width and the gap before the words (features.css: .pct-bar
|
|
313
|
+
52px, a meter's 64px, .pct-ring 16px, gap --space-3). Sized by its words alone, Compass's probability column
|
|
314
|
+
held 88px and cut "100%" to "10…" beside its bar. */
|
|
315
|
+
const BESIDE_GAP = 8;
|
|
316
|
+
const besideWords = (dress) => {
|
|
317
|
+
if (dress.kind === 'meter')
|
|
318
|
+
return 64 + BESIDE_GAP;
|
|
319
|
+
if ('bar' in dress && dress.bar !== undefined)
|
|
320
|
+
return 52 + BESIDE_GAP;
|
|
321
|
+
if ('ring' in dress && dress.ring !== undefined)
|
|
322
|
+
return 16 + BESIDE_GAP;
|
|
323
|
+
return 0;
|
|
324
|
+
};
|
|
312
325
|
/* A record's tags in a list's cell: as many whole chips as the cell holds
|
|
313
326
|
(at most TAGS_SHOWN, at least one), then how many more. Clipped by the
|
|
314
327
|
cell, Thread's issues read "accessibility perfo"; a chip is a word, and a
|
|
@@ -759,8 +772,14 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
759
772
|
if (row[name] == null)
|
|
760
773
|
return true;
|
|
761
774
|
const dress = dressFor(display, row[name]);
|
|
762
|
-
return dress ? drawsWords(dress) : plan.kind === 'number' && numberShown(row[name], plan) != null;
|
|
775
|
+
return dress ? drawsWords(dress) || besideWords(dress) > 0 : plan.kind === 'number' && numberShown(row[name], plan) != null;
|
|
763
776
|
}),
|
|
777
|
+
beside: labelColumn || display?.component
|
|
778
|
+
? undefined
|
|
779
|
+
: rows.slice(0, GRID_SIZE_SAMPLE).reduce((most, row) => {
|
|
780
|
+
const dress = row[name] == null ? undefined : dressFor(display, row[name]);
|
|
781
|
+
return Math.max(most, dress ? besideWords(dress) : 0);
|
|
782
|
+
}, 0) || undefined,
|
|
764
783
|
/* A date no rule dresses is drawn as the cell formats it, and sized by that. */
|
|
765
784
|
drawnDate: plan.kind === 'date' && !labelColumn && !display?.component,
|
|
766
785
|
status: !labelColumn &&
|
|
@@ -834,16 +853,22 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
834
853
|
columns untouched — a grid that was never arranged draws exactly as it
|
|
835
854
|
did. */
|
|
836
855
|
const hasWidthOverrides = Object.keys(columnWidths).length > 0;
|
|
837
|
-
|
|
856
|
+
/* What a dragged column may not go under: a date, a figure or a status pill holds its value's width, text keeps its
|
|
857
|
+
ellipsis (gridSizing.ts columnFloor). */
|
|
858
|
+
const floors = useMemo(() => Object.fromEntries(ordered.map((name, index) => [
|
|
859
|
+
name,
|
|
860
|
+
columnFloor(orderedHints[index], headChar, measureOrdered && ((text) => measureOrdered(text, index))),
|
|
861
|
+
])), [ordered, orderedHints, headChar, measureOrdered]);
|
|
862
|
+
const colWidths = useMemo(() => (hasWidthOverrides ? applyColumnWidths(fit.columns, ordered, columnWidths, floors) : fit.columns), [hasWidthOverrides, fit.columns, ordered, columnWidths, floors]);
|
|
838
863
|
const useColgroup = sizing === 'fit' || hasWidthOverrides;
|
|
839
864
|
const tableWidth = hasWidthOverrides
|
|
840
865
|
? colWidths.reduce((sum, width) => sum + width, 0) + (slotted ? GRID_EXPANDER_WIDTH : 0) + (trailing ? GRID_TRAIL_WIDTH : 0)
|
|
841
866
|
: fit.width;
|
|
842
867
|
const moveColumnBy = useCallback((name, direction) => setColumnOrder((current) => moveColumn(applyColumnOrder(drawn, current), name, direction)), [drawn]);
|
|
843
868
|
const setColumnWidth = useCallback((name, width) => setColumnWidths((current) => {
|
|
844
|
-
const next = clampColumnWidth(width);
|
|
869
|
+
const next = clampColumnWidth(width, floors[name]);
|
|
845
870
|
return current[name] === next ? current : { ...current, [name]: next };
|
|
846
|
-
}), []);
|
|
871
|
+
}), [floors]);
|
|
847
872
|
const resetColumnWidth = useCallback((name) => setColumnWidths((current) => {
|
|
848
873
|
if (!(name in current))
|
|
849
874
|
return current;
|
|
@@ -1218,7 +1243,7 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
1218
1243
|
const seed = drag.seed;
|
|
1219
1244
|
drag.seed = null;
|
|
1220
1245
|
drag.seeded = true;
|
|
1221
|
-
setColumnWidths({ ...seed, [name]: clampColumnWidth(width) });
|
|
1246
|
+
setColumnWidths({ ...seed, [name]: clampColumnWidth(width, floors[name]) });
|
|
1222
1247
|
return;
|
|
1223
1248
|
}
|
|
1224
1249
|
setColumnWidth(name, width);
|
|
@@ -1256,7 +1281,7 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
1256
1281
|
const current = seed?.[name] ?? appliedWidth ?? colWidths[index] ?? 0;
|
|
1257
1282
|
const width = current + (e.key === 'ArrowRight' ? 1 : -1) * columnResizeStep(e.shiftKey);
|
|
1258
1283
|
if (seed)
|
|
1259
|
-
setColumnWidths({ ...seed, [name]: clampColumnWidth(width) });
|
|
1284
|
+
setColumnWidths({ ...seed, [name]: clampColumnWidth(width, floors[name]) });
|
|
1260
1285
|
else
|
|
1261
1286
|
setColumnWidth(name, width);
|
|
1262
1287
|
}, onDoubleClick: () => resetColumnWidth(name) }))] }, name));
|
|
@@ -29,10 +29,10 @@ export function GridSelection({ table, rows, actions, interactive, editable = []
|
|
|
29
29
|
the column says what it is. Its name says what "all" takes — the rows
|
|
30
30
|
loaded here, as before — in the resource's own word where it has one. */
|
|
31
31
|
const noun = resourceOf(shell().app(), table.id)?.noun?.many ?? 'rows';
|
|
32
|
-
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) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
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("label", { className: "row-select-hit", children: _jsx("input", { type: "checkbox", className: "row-select", "aria-label": say('selectAll', { noun }), checked: every, ref: (box) => {
|
|
33
|
+
if (box)
|
|
34
|
+
box.indeterminate = partly;
|
|
35
|
+
}, onChange: () => change(every ? [] : keyed.map((record) => record.id)) }) }) })), group &&
|
|
36
36
|
[
|
|
37
37
|
...keyed.reduce((groups, record) => {
|
|
38
38
|
const host = groupHostKey(record.row[group.column]);
|
|
@@ -66,5 +66,7 @@ function RowBox({ checked, indeterminate = false, ...props }) {
|
|
|
66
66
|
row.setAttribute('data-chosen', '');
|
|
67
67
|
return () => row.removeAttribute('data-chosen');
|
|
68
68
|
}, [checked]);
|
|
69
|
-
|
|
69
|
+
/* In its label, which a coarse pointer pads to a finger's 44px (features.css): a checkbox cannot be padded itself.
|
|
70
|
+
A tap on that padding is the box's, never the row's, so it does not open the record. */
|
|
71
|
+
return (_jsx("label", { className: "row-select-hit", onClick: (event) => event.stopPropagation(), children: _jsx("input", { ref: box, type: "checkbox", className: "row-select", checked: checked, ...props }) }));
|
|
70
72
|
}
|
|
@@ -695,9 +695,9 @@ export function PlatformControl({ column, app, required, assigned, spoken, targe
|
|
|
695
695
|
}
|
|
696
696
|
if (dateOnly(column) || kind === 'datetime') {
|
|
697
697
|
return (_jsx(DateField, { id: dateId, inputRef: setControl, className: "insert-input", value: value, onChange: onChange, withTime: kind === 'datetime', "aria-invalid": errorId ? true : undefined, "aria-label": app ? spoken : `${column.name} (${column.type})`,
|
|
698
|
-
/* A day's box says the locale's pattern, as its hint does and as it reads what is typed
|
|
699
|
-
en-US; ISO is read too): the field's own (DateField.tsx). */
|
|
700
|
-
placeholder: said ||
|
|
698
|
+
/* A day's box, with or without a time, says the locale's pattern, as its hint does and as it reads what is typed
|
|
699
|
+
(MM/DD/YYYY, and HH:MM after it for a moment, in en-US; ISO is read too): the field's own (DateField.tsx). */
|
|
700
|
+
placeholder: said || undefined, locale: formatLocale(), timezone: formatTimezone(), now: appNow() }));
|
|
701
701
|
}
|
|
702
702
|
/* Formatted text: the editor, fetched when the form first draws one. A new record has no row yet for a
|
|
703
703
|
picture to be attached to, so it takes pictures once it is saved and edited. */
|
|
@@ -21,6 +21,16 @@
|
|
|
21
21
|
.empty-note.is-room > .empty-note-text { color: var(--ink); font-size: var(--text-lg); font-weight: 500; text-wrap: balance; }
|
|
22
22
|
.empty-note.is-room .empty-note-detail { margin-top: var(--space-1); font-size: var(--text-md); font-weight: 400; }
|
|
23
23
|
.empty-note.is-room > .empty-note-action { margin-top: var(--space-4); }
|
|
24
|
+
/* An empty place is centered in its room, mark over sentence, where it was
|
|
25
|
+
left on the edge with its mark beside it: off centre in a wide card and
|
|
26
|
+
nowhere in particular on a page. Inside a card it sits flush on the card's
|
|
27
|
+
own edge and draws nothing of its own (no border, ground or shadow a look
|
|
28
|
+
may give a note): the card is the box, not the note in it. */
|
|
29
|
+
.empty-note:not(.is-room, .is-refused) { grid-template-columns: minmax(0, 1fr); justify-items: center; row-gap: var(--space-1h); margin-inline: auto; text-align: center; }
|
|
30
|
+
.empty-note:not(.is-room, .is-refused) > * { grid-column: 1; grid-row: auto; }
|
|
31
|
+
.empty-note:not(.is-room, .is-refused) > .empty-note-mark { margin-top: 0; }
|
|
32
|
+
.empty-note:not(.is-room, .is-refused) .page-related-create, .empty-note:not(.is-room, .is-refused) .empty-note-action { justify-content: center; }
|
|
33
|
+
:is(.panel, .page-section, .dash-list, [data-slot='card']) :is(.empty-note, .page-empty) { border: 0; border-radius: 0; background: none; box-shadow: none; padding-inline: 0; }
|
|
24
34
|
.empty-note-text { margin: 0; color: var(--ink-muted); font-size: var(--text-md); line-height: 1.5; }
|
|
25
35
|
.empty-note-detail { color: var(--ink-muted); }
|
|
26
36
|
/* An authored title leads in the text ink at the same size: the sentence is what it says, not a heading. */
|
|
@@ -233,5 +233,5 @@ export function PageView(props) {
|
|
|
233
233
|
onGone,
|
|
234
234
|
recordName: entry.label,
|
|
235
235
|
...(host ? { onActionDone: host.onActionDone } : {}),
|
|
236
|
-
}, children: _jsxs(ProblemScopeProvider, { children: [props.preview ? (_jsxs("div", { className: "page-head", children: [_jsx("h2", { className: "page-title", children: page.name }), _jsx("div", { className: "root-bar", children: _jsx("h1", { className: "root-current", children: entry.label ?? (entry.key ? rootLabel(entry.key) : '') }) })] })) : props.bare ? null : (_jsx(ErrorBoundary, { children: _jsx(PageHead, { ...props, actions: gone ? undefined : headActions, gone: gone, onPending: onPending, title: titleEditor && titleEditor.index === titleOwner ? titleEditor.render : undefined, header: header, onSectionLabel: onSectionLabel, onTitleEditor: onTitleEditor, titleOwner: titleOwner }) })), gone && entry.key ? (_jsx(PageLayout, { children: _jsx(RecordGone, { base: base, spoken: spoken(base.name), className: "page-gone" }) })) : entry.key ? (showcase !== undefined ? (_jsx(PageLayout, { layout: layout, panel: panel, aside: hasAside ? sectionsOf('aside') : undefined, below: sectionsOf(hasAside ? 'main' : undefined, (index) => index !== showcase), children: sectionsOf(hasAside ? 'main' : undefined, (index) => index === showcase) })) : (_jsx(PageLayout, { layout: layout, leads: leads, aside: hasAside ? sectionsOf('aside') : undefined, children: sectionsOf(hasAside ? 'main' : undefined) }))) : (_jsx(PageLayout, { children: chooser })), host && _jsx("span", { hidden: true, ref: relatedAnchor }), related?.props && related.surface === surface && (_jsx(NewRecordDialog, { ...related.props, retainUncertain: true, onUnresolvedChange: related.changed }))] }) }));
|
|
236
|
+
}, children: _jsxs(ProblemScopeProvider, { children: [props.preview ? (_jsxs("div", { className: "page-head", children: [_jsx("h2", { className: "page-title", children: page.name }), _jsx("div", { className: "root-bar", children: _jsx("h1", { className: "root-current", children: entry.label ?? (entry.key ? rootLabel(entry.key) : '') }) })] })) : props.bare ? null : (_jsx(ErrorBoundary, { children: _jsx(PageHead, { ...props, actions: gone ? undefined : headActions, gone: gone, onPending: onPending, title: titleEditor && titleEditor.index === titleOwner ? titleEditor.render : undefined, header: header, onSectionLabel: onSectionLabel, onTitleEditor: onTitleEditor, titleOwner: titleOwner }) })), !props.preview && !props.bare && !gone && adornment?.notice ? _jsx(ErrorBoundary, { children: adornment.notice }) : null, gone && entry.key ? (_jsx(PageLayout, { children: _jsx(RecordGone, { base: base, spoken: spoken(base.name), className: "page-gone" }) })) : entry.key ? (showcase !== undefined ? (_jsx(PageLayout, { layout: layout, panel: panel, aside: hasAside ? sectionsOf('aside') : undefined, below: sectionsOf(hasAside ? 'main' : undefined, (index) => index !== showcase), children: sectionsOf(hasAside ? 'main' : undefined, (index) => index === showcase) })) : (_jsx(PageLayout, { layout: layout, leads: leads, aside: hasAside ? sectionsOf('aside') : undefined, children: sectionsOf(hasAside ? 'main' : undefined) }))) : (_jsx(PageLayout, { children: chooser })), host && _jsx("span", { hidden: true, ref: relatedAnchor }), related?.props && related.surface === surface && (_jsx(NewRecordDialog, { ...related.props, retainUncertain: true, onUnresolvedChange: related.changed }))] }) }));
|
|
237
237
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The head of a dashboard or a free-form page, as markup: the title, its star, a line of intro, and, when there are
|
|
3
|
+
* any, the page's verbs and a way back. DashHead is the platform's own use of it; a free-form page that draws its own
|
|
4
|
+
* head reaches it through the SDK's `PageHeader`, so both wear the one set of classes and every look and theme
|
|
5
|
+
* dresses them alike (features.css `.dash-head`).
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
8
|
+
export declare function PageHeading({ title, favorite, description, actions, back, hidden, level, }: {
|
|
9
|
+
title: ReactNode;
|
|
10
|
+
/** The Favorites star beside the title. */
|
|
11
|
+
favorite?: ReactNode;
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
/** The page's verbs, at the head's far end. */
|
|
14
|
+
actions?: ReactNode;
|
|
15
|
+
/** A way back, over the title. */
|
|
16
|
+
back?: ReactNode;
|
|
17
|
+
/** The title stays for a screen reader and is not seen. */
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
/** A page has one h1, the platform's; a head a page draws itself is an h2. */
|
|
20
|
+
level?: 1 | 2;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function PageHeading({ title, favorite, description, actions, back, hidden = false, level = 1, }) {
|
|
3
|
+
const Title = level === 1 ? 'h1' : 'h2';
|
|
4
|
+
const drawn = actions !== undefined && actions !== null && actions !== false;
|
|
5
|
+
return (_jsxs("div", { className: `applist-head dash-head${drawn ? ' has-actions' : ''}${back ? ' has-back' : ''}`, children: [back ? _jsx("div", { className: "dash-head-back", children: back }) : null, _jsx(Title, { className: `applist-title${hidden ? ' visually-hidden' : ''}`, children: title }), favorite, drawn ? _jsx("div", { className: "applist-head-tools dash-head-actions", children: actions }) : null, description ? _jsx("p", { className: "note dash-description", children: description }) : null] }));
|
|
6
|
+
}
|
|
@@ -36,6 +36,11 @@ export interface HistoryEntry {
|
|
|
36
36
|
via: 'app' | 'workbench' | 'agent' | 'api' | 'form' | 'system';
|
|
37
37
|
action?: string;
|
|
38
38
|
/** The writer's name when they wrote; never an email. */ by?: string;
|
|
39
|
+
/** Who made the write when no one typed it: a model's decision, or a job (by its id when it has one). */
|
|
40
|
+
maker?: 'ai' | 'job';
|
|
41
|
+
job?: string;
|
|
42
|
+
/** The write carried out a proposal a person approved: `by` is the approver. */
|
|
43
|
+
proposed?: true;
|
|
39
44
|
fields: HistoryField[];
|
|
40
45
|
}
|
|
41
46
|
/** A read through the page's connection, as `usePageApi` makes one. */
|
|
@@ -54,7 +59,7 @@ interface HistoryProps {
|
|
|
54
59
|
}
|
|
55
60
|
/** Who made a write, as a person reads it: their name when they wrote, else the door it came through.
|
|
56
61
|
Never an address: the server sends none, and a name that reads as one is not said either. */
|
|
57
|
-
export declare function whoWrote(entry: Pick<HistoryEntry, 'by' | 'via'>): string;
|
|
62
|
+
export declare function whoWrote(entry: Pick<HistoryEntry, 'by' | 'via' | 'maker' | 'job' | 'proposed'>): string;
|
|
58
63
|
/** What a write did, in a word: the action or command by its label, else what any write is. */
|
|
59
64
|
export declare const whatWrote: (entry: Pick<HistoryEntry, 'action' | 'kind'>) => string;
|
|
60
65
|
/** The record's own change history, newest first, with "Show earlier changes" while the store holds more. */
|
|
@@ -9,12 +9,24 @@ import { LABEL_SEGMENT } from '@mistriwork/engine/shared/recordLabel.js';
|
|
|
9
9
|
import { Empty } from './Notes.js';
|
|
10
10
|
import { Value } from './Value.js';
|
|
11
11
|
import { say } from '../copy/record/components/PageHistory.js';
|
|
12
|
+
import { AiMark, aiWord } from './AiMark.js';
|
|
12
13
|
import { pageBridge } from '../uiBridge.js';
|
|
13
14
|
/* The machine of the record's resource, when it has one: its state's words, and its column leads a change. */
|
|
14
15
|
const machineOf = (tableId) => pageBridge.activeApp()?.resources?.[tableId]?.machine;
|
|
15
16
|
/** Who made a write, as a person reads it: their name when they wrote, else the door it came through.
|
|
16
17
|
Never an address: the server sends none, and a name that reads as one is not said either. */
|
|
17
18
|
export function whoWrote(entry) {
|
|
19
|
+
/* A proposal carried out names both hands, the model's and the approver's; a write no person approved names its
|
|
20
|
+
maker, so a model's change never reads as the person whose session it ran under. */
|
|
21
|
+
if (entry.proposed)
|
|
22
|
+
return say('proposedBy', { ai: aiWord(), by: writer(entry) });
|
|
23
|
+
if (entry.maker === 'ai')
|
|
24
|
+
return say('madeByAi', { ai: aiWord() });
|
|
25
|
+
if (entry.maker === 'job')
|
|
26
|
+
return entry.job ? say('madeByJob', { job: entry.job }) : say('madeByAJob');
|
|
27
|
+
return writer(entry);
|
|
28
|
+
}
|
|
29
|
+
function writer(entry) {
|
|
18
30
|
if (entry.by && !/[^\s@]+@[^\s@]+\.[^\s@]+/.test(entry.by))
|
|
19
31
|
return entry.by;
|
|
20
32
|
switch (entry.via) {
|
|
@@ -131,7 +143,7 @@ export function RecordHistory({ section, base, recordKey, api, preview, frame, l
|
|
|
131
143
|
function HistoryItem({ entry, base, names }) {
|
|
132
144
|
const when = new Date(entry.at);
|
|
133
145
|
const said = Number.isNaN(when.getTime()) ? entry.at : formatDateTime(when);
|
|
134
|
-
return (_jsxs("li", { className: "history-entry", children: [_jsxs("div", { className: "history-head", children: [
|
|
146
|
+
return (_jsxs("li", { className: "history-entry", children: [_jsxs("div", { className: "history-head", children: [_jsxs("span", { className: "history-by", children: [(entry.proposed || entry.maker === 'ai') && (_jsxs(_Fragment, { children: [_jsx(AiMark, { quiet: true }), ' '] })), whoWrote(entry)] }), _jsx("span", { className: "history-what", children: whatWrote(entry) }), _jsx("time", { className: "history-when", dateTime: entry.at, title: entry.at, children: said })] }), entry.fields.length > 0 && (_jsx("dl", { className: "history-fields", children: [...entry.fields]
|
|
135
147
|
.sort((a, b) => Number(b.column === machineOf(base.id)?.column) - Number(a.column === machineOf(base.id)?.column))
|
|
136
148
|
.map((field) => (_jsx(HistoryFieldRow, { field: field, kind: entry.kind, base: base, names: names?.get(field.column) }, field.column))) }))] }));
|
|
137
149
|
}
|
|
@@ -13,10 +13,25 @@
|
|
|
13
13
|
* it, and the callbacks check the entry before touching it.
|
|
14
14
|
*/
|
|
15
15
|
import { type ReactNode } from 'react';
|
|
16
|
+
import type { TableMeta } from '@mistriwork/engine/shared/schema.js';
|
|
16
17
|
import { type PageEntry } from './pageModel.js';
|
|
18
|
+
import { type RecordSurfacePage as Def, type RecordSurfaceAlternative as Others } from './recordSurface.js';
|
|
17
19
|
export declare function PageRoom({ entry }: {
|
|
18
20
|
entry: PageEntry;
|
|
19
21
|
}): import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* No record chosen: the list *is* the chooser. The app's list page in app
|
|
24
|
+
* mode — tabs, named filters, chips, the lot — and the plain grid in the
|
|
25
|
+
* workbench; a row click opens this record as a page, because the walk is
|
|
26
|
+
* already in page view and `openRecord` keeps it there.
|
|
27
|
+
*/
|
|
28
|
+
export declare function Rootless({ entry, page, base, others, onLayout, }: {
|
|
29
|
+
entry: PageEntry;
|
|
30
|
+
page: Def;
|
|
31
|
+
base: TableMeta;
|
|
32
|
+
others: Others[];
|
|
33
|
+
onLayout: () => void;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
20
35
|
/**
|
|
21
36
|
* The record's page as it arrives, shown once it is complete. A section
|
|
22
37
|
* draws when its own read answers, and the header's verbs when their
|
|
@@ -110,7 +110,7 @@ function Known({ entry, page, base, surface, }) {
|
|
|
110
110
|
* workbench; a row click opens this record as a page, because the walk is
|
|
111
111
|
* already in page view and `openRecord` keeps it there.
|
|
112
112
|
*/
|
|
113
|
-
function Rootless({ entry, page, base, others, onLayout, }) {
|
|
113
|
+
export function Rootless({ entry, page, base, others, onLayout, }) {
|
|
114
114
|
useEffect(() => {
|
|
115
115
|
if (currentEntry() === entry && entry.label !== page.name) {
|
|
116
116
|
entry.label = page.name;
|
|
@@ -118,6 +118,15 @@ function Rootless({ entry, page, base, others, onLayout, }) {
|
|
|
118
118
|
}
|
|
119
119
|
}, [entry, page.name]);
|
|
120
120
|
const spec = shell().inApp() ? appListFor(base.id) : null;
|
|
121
|
+
/* A page opened with no record is a dead end where its table has a list of its own: the person came for a record,
|
|
122
|
+
and the list is where they are picked, at the one address it has. Replaced, so Back does not return to the empty
|
|
123
|
+
page. Where there is no list the chooser below stays, and says to pick one. */
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
if (spec)
|
|
126
|
+
go(tableView(base.id), 'replace');
|
|
127
|
+
}, [spec, base.id]);
|
|
128
|
+
if (spec)
|
|
129
|
+
return null;
|
|
121
130
|
return (_jsx(PageView, { entry: entry, page: page, base: base, plans: [], others: others, onLabel: () => { }, onTab: () => { }, onLayout: onLayout, chooser: _jsx(Chooser, { entry: entry, base: base, spec: spec }) }));
|
|
122
131
|
}
|
|
123
132
|
function Chooser({ entry, base, spec }) {
|
|
@@ -29,6 +29,11 @@ const MOST = { recent: 4, pages: 8, create: 5, commands: 4, records: 9 };
|
|
|
29
29
|
first screen. A menu that fits the shortlist (MOST.pages) is shown whole: cut to five, an App of seven lists hid
|
|
30
30
|
two of them until a word was typed. */
|
|
31
31
|
const FIRST_PAGES = 5;
|
|
32
|
+
/** Once a word is typed the list is what it names, not a shortlist: every page the word matches stays reachable, the
|
|
33
|
+
cap only keeps a one-letter term from drawing a screenful. (The shortlist above capped a typed App at eight pages,
|
|
34
|
+
and the ninth named by the word could not be reached by any word.) Records are not here: the database answers those
|
|
35
|
+
a few at a time (`MOST.records`). */
|
|
36
|
+
const MOST_TYPED = { recent: MOST.recent, pages: 60, create: 20, commands: 20, records: MOST.records };
|
|
32
37
|
const groupOf = (item) => item.kind === 'page' ? 'pages' : item.kind === 'create' ? 'create' : item.kind === 'record' ? 'records' : 'commands';
|
|
33
38
|
function groupWord(group) {
|
|
34
39
|
switch (group) {
|
|
@@ -191,8 +196,8 @@ export function Palette({ prefill = '', onClose }) {
|
|
|
191
196
|
.filter(({ points }) => points > 0)
|
|
192
197
|
.sort((a, b) => b.points - a.points)
|
|
193
198
|
.map(({ item }) => item);
|
|
194
|
-
// Bounded because a palette is a shortlist.
|
|
195
|
-
const named = ranked.slice(0, 20);
|
|
199
|
+
// Bounded because a palette is a shortlist, past a typed word's own matches (MOST_TYPED).
|
|
200
|
+
const named = ranked.slice(0, term ? 60 : 20);
|
|
196
201
|
/* Hits for earlier text keep only the rows this text also names: with
|
|
197
202
|
nothing named above them, the first is lit and Enter would open a record
|
|
198
203
|
the box never named. Until the hits answer this text, "nothing matches"
|
|
@@ -212,14 +217,14 @@ export function Palette({ prefill = '', onClose }) {
|
|
|
212
217
|
? recent
|
|
213
218
|
: (group === 'records'
|
|
214
219
|
? hits.choices
|
|
215
|
-
: ranked.filter((item) => groupOf(item) === group && !(item.room !== undefined && recentRooms.has(item.room)))).slice(0, group === 'pages' && !term && pageCount > MOST.pages ? FIRST_PAGES : MOST[group]),
|
|
220
|
+
: ranked.filter((item) => groupOf(item) === group && !(item.room !== undefined && recentRooms.has(item.room)))).slice(0, group === 'pages' && !term && pageCount > MOST.pages ? FIRST_PAGES : term ? MOST_TYPED[group] : MOST[group]),
|
|
216
221
|
}))
|
|
217
222
|
.filter(({ items }) => items.length)
|
|
218
223
|
.map((entry, at, every) => ({ ...entry, from: every.slice(0, at).reduce((sum, { items }) => sum + items.length, 0) }));
|
|
219
224
|
/* Record hits ride below the named things: a table you typed exactly still wins the top. */
|
|
220
225
|
const rows = inApp
|
|
221
226
|
? grouped.flatMap(({ group, items }) => items.map((item) => ({ item, group })))
|
|
222
|
-
: [...named, ...hits.choices].slice(0, 20).map((item) => ({ item, group: groupOf(item) }));
|
|
227
|
+
: [...named, ...hits.choices].slice(0, term ? 60 : 20).map((item) => ({ item, group: groupOf(item) }));
|
|
223
228
|
const shown = rows.map(({ item }) => item);
|
|
224
229
|
const current = shown.length ? ((active % shown.length) + shown.length) % shown.length : 0;
|
|
225
230
|
const choose = (index) => {
|
|
@@ -171,6 +171,16 @@ export declare function wholeQuery(spec: ListSpec, typed: string): string;
|
|
|
171
171
|
* group in parens, and `(a or b)` still *is* the "a or b" tab.
|
|
172
172
|
*/
|
|
173
173
|
export declare function litTabFor(tabs: ListTab[], refinement: string, boxColumns: string[]): number;
|
|
174
|
+
/**
|
|
175
|
+
* The columns a tab's own question fixes to one value: on "To submit" (`status = to_submit`) the status column
|
|
176
|
+
* says the same thing on every row, so the grid leaves it out while that tab is lit. Only an exact single-value
|
|
177
|
+
* equality pins — `in` with two or more values, a range, `!=`, a contains or a relative date do not — and a column
|
|
178
|
+
* that two conditions both speak for is left shown.
|
|
179
|
+
*/
|
|
180
|
+
export declare function pinnedColumns(tabQuery: string, columns: string[]): string[];
|
|
181
|
+
/** pinnedColumns for a lit tab of a view: a named tab (`tabs: ['new']`) carries its segment's word, not its
|
|
182
|
+
conditions, so the word is expanded through the table's segments before the columns are read. */
|
|
183
|
+
export declare function tabPinnedColumns(spec: ListSpec, tabQuery: string, columns: string[]): string[];
|
|
174
184
|
/** The refinement with every box column's conditions taken out. */
|
|
175
185
|
export declare function residueOf(refinement: string, boxColumns: string[]): string;
|
|
176
186
|
/** What the New button makes: one of the table's records, by its resource's
|
|
@@ -23,7 +23,7 @@ import { referenceProjection } from '@mistriwork/engine/shared/referenceModel.js
|
|
|
23
23
|
import { LABEL_SEGMENT } from '@mistriwork/engine/shared/recordLabel.js';
|
|
24
24
|
import { appListQuery as sharedAppListQuery, editedReferences as sharedEditedReferences, limitClause, listReferenceNames as sharedListReferenceNames, orderClause, referenceNames as sharedReferenceNames, showClause as sharedShowClause, subtitleColumns as sharedSubtitleColumns, withOrder, } from '@mistriwork/engine/shared/listQuestion.js';
|
|
25
25
|
import { shell } from '../shellMode.js';
|
|
26
|
-
import { canonicalize, conditionTail, hasShowClause, squeeze, stripCondition } from '../filterbar.js';
|
|
26
|
+
import { canonicalize, conditionTail, hasShowClause, ownedTails, squeeze, stripCondition } from '../filterbar.js';
|
|
27
27
|
import { maskQuoted, splitConditions, splitQuery } from '../clauses.js';
|
|
28
28
|
import { appRooms, isListRoom, offeredBy, resourceOf, viewRoom } from './appRooms.js';
|
|
29
29
|
import { say } from '../copy/lists/components/appListModel.js';
|
|
@@ -377,6 +377,25 @@ export function litTabFor(tabs, refinement, boxColumns) {
|
|
|
377
377
|
});
|
|
378
378
|
return best;
|
|
379
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* The columns a tab's own question fixes to one value: on "To submit" (`status = to_submit`) the status column
|
|
382
|
+
* says the same thing on every row, so the grid leaves it out while that tab is lit. Only an exact single-value
|
|
383
|
+
* equality pins — `in` with two or more values, a range, `!=`, a contains or a relative date do not — and a column
|
|
384
|
+
* that two conditions both speak for is left shown.
|
|
385
|
+
*/
|
|
386
|
+
export function pinnedColumns(tabQuery, columns) {
|
|
387
|
+
const single = /^=\s*(?:"[^"]*"|'[^']*'|[^\s,"'()]+)$|^in\s*\(\s*(?:"[^"]*"|'[^']*'|[^\s,"'()]+)\s*\)$/i;
|
|
388
|
+
return columns.filter((column) => {
|
|
389
|
+
const tails = ownedTails(tabQuery, column);
|
|
390
|
+
return tails.length === 1 && single.test(tails[0]);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
/** pinnedColumns for a lit tab of a view: a named tab (`tabs: ['new']`) carries its segment's word, not its
|
|
394
|
+
conditions, so the word is expanded through the table's segments before the columns are read. */
|
|
395
|
+
export function tabPinnedColumns(spec, tabQuery, columns) {
|
|
396
|
+
const segments = findTable(spec.table)?.segments;
|
|
397
|
+
return pinnedColumns(unwrapped(expandSegments(tabQuery, segments).text), columns);
|
|
398
|
+
}
|
|
380
399
|
/** The refinement with every box column's conditions taken out. */
|
|
381
400
|
export function residueOf(refinement, boxColumns) {
|
|
382
401
|
return boxColumns.reduce((out, name) => stripCondition(out, name), squeeze(refinement));
|
|
@@ -65,6 +65,8 @@ export declare const ASSISTANT_PAGE = "app:assistant";
|
|
|
65
65
|
export declare const DIRECTORY_PAGE = "app:directory";
|
|
66
66
|
/** The page id the reader's settings ride (SettingsRoom.tsx): their profile and their preferences, at `/{app}/settings`. */
|
|
67
67
|
export declare const SETTINGS_PAGE = "app:settings";
|
|
68
|
+
/** For review (`/{app}/review`): proposals this reader may approve and values no person has confirmed. */
|
|
69
|
+
export declare const REVIEW_PAGE = "app:review";
|
|
68
70
|
/** Whether a room is the assistant's page. */
|
|
69
71
|
export declare const isAssistantRoom: (room: object) => room is AssistantRoom;
|
|
70
72
|
/** Whether a room is one of the App's lists: neither a dashboard, a form nor the assistant's page. */
|
|
@@ -26,6 +26,8 @@ export const ASSISTANT_PAGE = 'app:assistant';
|
|
|
26
26
|
export const DIRECTORY_PAGE = 'app:directory';
|
|
27
27
|
/** The page id the reader's settings ride (SettingsRoom.tsx): their profile and their preferences, at `/{app}/settings`. */
|
|
28
28
|
export const SETTINGS_PAGE = 'app:settings';
|
|
29
|
+
/** For review (`/{app}/review`): proposals this reader may approve and values no person has confirmed. */
|
|
30
|
+
export const REVIEW_PAGE = 'app:review';
|
|
29
31
|
/** Whether a room is the assistant's page. */
|
|
30
32
|
export const isAssistantRoom = (room) => Object.hasOwn(room, 'assistant');
|
|
31
33
|
/** Whether a room is one of the App's lists: neither a dashboard, a form nor the assistant's page. */
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
export declare const MIN_COLUMN_WIDTH = 48;
|
|
16
16
|
/** The step an arrow key moves a resizer, larger with Shift held. */
|
|
17
17
|
export declare function columnResizeStep(shiftKey: boolean): number;
|
|
18
|
-
/** A width a column may actually be given: whole pixels, never below its floor
|
|
19
|
-
|
|
18
|
+
/** A width a column may actually be given: whole pixels, never below its floor — the grid's own, or the wider one its
|
|
19
|
+
type asks (gridSizing.ts columnFloor: a date, a figure or a status chip is never dragged under its value). */
|
|
20
|
+
export declare function clampColumnWidth(width: number, floor?: number): number;
|
|
20
21
|
/**
|
|
21
22
|
* The columns as drawn, in the reader's order: the order's names first,
|
|
22
23
|
* in the order's order, then every drawn column the order never named,
|
|
@@ -30,4 +31,4 @@ export declare function applyColumnOrder(drawn: readonly string[], order: readon
|
|
|
30
31
|
*/
|
|
31
32
|
export declare function moveColumn(order: readonly string[], name: string, direction: 'left' | 'right'): string[];
|
|
32
33
|
/** The fitted widths, with every width the reader dragged standing in place of its fitted one. */
|
|
33
|
-
export declare function applyColumnWidths(fitted: readonly number[], columns: readonly string[], overrides: Readonly<Record<string, number>>): number[];
|
|
34
|
+
export declare function applyColumnWidths(fitted: readonly number[], columns: readonly string[], overrides: Readonly<Record<string, number>>, floors?: Readonly<Record<string, number>>): number[];
|