@mistriwork/kit 1.0.0-rc.58 → 1.0.0-rc.60
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 +16 -3
- 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 +46 -11
- package/dist/client/components/AppList.d.ts +3 -1
- package/dist/client/components/AppList.js +92 -19
- 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 +4 -2
- 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 -7
- package/dist/client/components/GridSelection.js +45 -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 +43 -16
- package/dist/client/components/ListFilterBar.js +45 -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 +27 -6
- package/dist/client/components/SectionPeriod.css +1 -1
- package/dist/client/components/SetFieldDialog.js +1 -1
- package/dist/client/components/Sidebar.js +15 -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 +6 -2
- 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/useMediaQuery.d.ts +2 -0
- package/dist/client/components/useMediaQuery.js +2 -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/core.d.ts +2 -1
- package/dist/client/core.js +46 -2
- package/dist/client/customThemes.css +3 -3
- package/dist/client/dom.js +5 -5
- package/dist/client/features.css +220 -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/navigationHold.d.ts +9 -0
- package/dist/client/navigationHold.js +46 -3
- package/dist/client/page.css +107 -357
- 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 +282 -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
|
@@ -16,9 +16,9 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
16
16
|
* those programs wrap a paste in are taken out first.
|
|
17
17
|
*
|
|
18
18
|
* The toolbar is one quiet row that wraps at phone width: the marks and
|
|
19
|
-
* lists as buttons, the text styles and the table's verbs in menus (
|
|
19
|
+
* lists as buttons, the text styles and the table's verbs in menus (UI SDK,
|
|
20
20
|
* through DropMenu), the link in a line of its own under the row. The
|
|
21
|
-
* mention list sits under the
|
|
21
|
+
* mention list sits under the @, placed by UI SDK's popover.
|
|
22
22
|
*/
|
|
23
23
|
import { useEffect, useRef, useState } from 'react';
|
|
24
24
|
import { useEditor, EditorContent } from '@tiptap/react';
|
|
@@ -28,10 +28,8 @@ import { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table
|
|
|
28
28
|
import Mention from '@tiptap/extension-mention';
|
|
29
29
|
import Image from '@tiptap/extension-image';
|
|
30
30
|
import { Placeholder } from '@tiptap/extensions';
|
|
31
|
-
import { Popover } from '@
|
|
31
|
+
import { Popover, PopoverContent } from '@ui-sdk/react/popover';
|
|
32
32
|
import { MENTION_QUERY_WORDS, richTextHref, richTextPlain } from '@mistriwork/engine/shared/richText.js';
|
|
33
|
-
import { viewportScale } from '../core.js';
|
|
34
|
-
import { layoutViewport } from '@mistriwork/ui/internal/anchor.js';
|
|
35
33
|
import { DropItem, DropMenu } from '@mistriwork/ui/DropMenu.js';
|
|
36
34
|
import { say } from '../copy/forms/components/RichTextEditor.js';
|
|
37
35
|
import './RichTextEditor.css';
|
|
@@ -302,11 +300,11 @@ export function RichTextEditor({ id, value, onChange, label, describedBy, invali
|
|
|
302
300
|
setLinkProblem(false);
|
|
303
301
|
setLinking(editor.getAttributes('link').href ?? '');
|
|
304
302
|
};
|
|
305
|
-
return (_jsxs("div", { className: `rich-editor${
|
|
303
|
+
return (_jsxs("div", { className: `rich-editor${disabled ? ' is-disabled' : ''}`, "data-invalid": invalid ? '' : undefined, children: [_jsxs("div", { className: "rich-toolbar", role: "toolbar", "aria-label": say('formatting', { label }), children: [_jsx(ToolButton, { label: say('bold'), active: editor.isActive('bold'), disabled: disabled, onClick: run((c) => c.toggleBold()), children: _jsx("strong", { children: say('boldMark') }) }), _jsx(ToolButton, { label: say('italic'), active: editor.isActive('italic'), disabled: disabled, onClick: run((c) => c.toggleItalic()), children: _jsx("em", { children: say('italicMark') }) }), _jsx(ToolButton, { label: say('strike'), active: editor.isActive('strike'), disabled: disabled, onClick: run((c) => c.toggleStrike()), children: _jsx("s", { children: say('strikeMark') }) }), _jsx("span", { className: "rich-tool-gap", "aria-hidden": "true" }), _jsxs(DropMenu, { className: "rich-tool-menu", triggerClassName: "rich-tool rich-tool-wide", triggerTitle: say('textStyle'), triggerLabel: `${say('textStyle')}: ${style}`, label: _jsxs(_Fragment, { children: [style, _jsx("span", { className: "rich-tool-caret", "aria-hidden": "true", children: "\u25BE" })] }), popupClassName: "page-actions-popup rich-menu", align: "start", children: [_jsx(DropItem, { className: "page-actions-item", onClick: run((c) => c.setParagraph()), children: say('paragraph') }), [2, 3, 4].map((level) => (_jsx(DropItem, { className: `page-actions-item rich-menu-h${level}`, onClick: run((c) => c.setHeading({ level })), children: say('heading', { level }) }, level))), _jsx(DropItem, { className: "page-actions-item", onClick: run((c) => c.toggleBlockquote()), children: say('quote') }), _jsx(DropItem, { className: "page-actions-item", onClick: run((c) => c.toggleCodeBlock()), children: say('codeBlock') })] }), _jsx("span", { className: "rich-tool-gap", "aria-hidden": "true" }), _jsx(ToolButton, { label: say('bulletList'), active: editor.isActive('bulletList'), disabled: disabled, onClick: run((c) => c.toggleBulletList()), children: "\u2022\u2261" }), _jsx(ToolButton, { label: say('orderedList'), active: editor.isActive('orderedList'), disabled: disabled, onClick: run((c) => c.toggleOrderedList()), children: "1\u2261" }), _jsx(ToolButton, { label: say('taskList'), active: editor.isActive('taskList'), disabled: disabled, onClick: run((c) => c.toggleTaskList()), children: "\u2611" }), _jsx("span", { className: "rich-tool-gap", "aria-hidden": "true" }), _jsx(ToolButton, { label: say('link'), active: editor.isActive('link'), disabled: disabled, onClick: openLink, children: "\u2197" }), _jsx(ToolButton, { label: say('inlineCode'), active: editor.isActive('code'), disabled: disabled, onClick: run((c) => c.toggleCode()), children: '</>' }), _jsxs(DropMenu, { className: "rich-tool-menu", triggerClassName: "rich-tool", triggerTitle: say('table'), triggerLabel: say('table'), label: "\u229E", popupClassName: "page-actions-popup rich-menu", align: "start", children: [_jsx(DropItem, { className: "page-actions-item", disabled: inTable, onClick: run((c) => c.insertTable({ rows: 3, cols: 3, withHeaderRow: true })), children: say('tableInsert') }), _jsx(DropItem, { className: "page-actions-item", disabled: !inTable, onClick: run((c) => c.addRowAfter()), children: say('tableRowAfter') }), _jsx(DropItem, { className: "page-actions-item", disabled: !inTable, onClick: run((c) => c.addColumnAfter()), children: say('tableColumnAfter') }), _jsx(DropItem, { className: "page-actions-item", disabled: !inTable, onClick: run((c) => c.deleteRow()), children: say('tableRowDelete') }), _jsx(DropItem, { className: "page-actions-item", disabled: !inTable, onClick: run((c) => c.deleteColumn()), children: say('tableColumnDelete') }), _jsx(DropItem, { className: "page-actions-item", disabled: !inTable, onClick: run((c) => c.deleteTable()), children: say('tableDelete') })] }), pictures && (_jsxs(_Fragment, { children: [_jsx(ToolButton, { label: adding ? say('pictureAdding') : say('picture'), disabled: disabled, onClick: () => fileInput.current?.click(), children: "\u25A3" }), _jsx("input", { ref: fileInput, type: "file", accept: "image/*", hidden: true, onChange: (event) => {
|
|
306
304
|
const files = [...(event.target.files ?? [])];
|
|
307
305
|
event.target.value = '';
|
|
308
306
|
addPictures(editor, files);
|
|
309
|
-
} })] }))] }), linking !== undefined && (_jsxs("div", { className: "rich-link-bar", children: [_jsx("input", {
|
|
307
|
+
} })] }))] }), linking !== undefined && (_jsxs("div", { className: "rich-link-bar", children: [_jsx("input", { "data-slot": "input", type: "url", autoFocus: true, "aria-label": say('linkAddress'), "aria-invalid": linkProblem || undefined, placeholder: say('linkPlaceholder'), value: linking, onChange: (event) => {
|
|
310
308
|
setLinking(event.target.value);
|
|
311
309
|
setLinkProblem(false);
|
|
312
310
|
}, onKeyDown: (event) => {
|
|
@@ -333,16 +331,17 @@ export function RichTextEditor({ id, value, onChange, label, describedBy, invali
|
|
|
333
331
|
}
|
|
334
332
|
/* The people an @ may name, under the @: a listbox the editor drives by key (the focus stays in the text). */
|
|
335
333
|
function MentionList({ suggesting, onPick }) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
334
|
+
/* Where the @ stands, as the window measures it. UI SDK places the list in the same measure and works out the
|
|
335
|
+
density zoom for itself from the list's own box, so nothing is divided out here. */
|
|
336
|
+
const anchor = { getBoundingClientRect: () => suggesting.box() ?? new DOMRect() };
|
|
337
|
+
return (_jsx(Popover, { open: true, modal: false, dismissible: false, children: _jsx(PopoverContent
|
|
338
|
+
/* A popover's panel says it is a dialog named by its trigger. This one has no trigger and takes no focus:
|
|
339
|
+
it holds the listbox the editor drives, and the panel itself is nothing to a reader. */
|
|
340
|
+
, {
|
|
341
|
+
/* A popover's panel says it is a dialog named by its trigger. This one has no trigger and takes no focus:
|
|
342
|
+
it holds the listbox the editor drives, and the panel itself is nothing to a reader. */
|
|
343
|
+
render: (part) => _jsx("div", { ...part, role: "presentation", "aria-labelledby": undefined }), className: "rich-mentions", anchor: anchor, side: "bottom", align: "start", sideOffset: 4, collisionPadding: 8, container: popupContainer(), initialFocus: "none", finalFocus: "none", children: _jsx("div", { role: "listbox", "aria-label": say('people'), children: suggesting.items.length ? (suggesting.items.map((person, index) => (_jsxs("div", { role: "option", "aria-selected": index === suggesting.index, className: `rich-mention-option${index === suggesting.index ? ' is-active' : ''}`, onMouseDown: (event) => {
|
|
344
|
+
event.preventDefault();
|
|
345
|
+
onPick(person);
|
|
346
|
+
}, children: [_jsx("span", { children: person.label }), person.kind === 'group' ? (_jsx("span", { className: "rich-mention-kind", children: say('group') })) : (person.handle && _jsxs("span", { className: "rich-mention-handle", children: ["@", person.handle] }))] }, `${person.kind ?? 'person'}:${person.id}`)))) : (_jsx("div", { className: "rich-mention-none", children: say('noPeople') })) }) }) }));
|
|
348
347
|
}
|
|
@@ -7,8 +7,8 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
7
7
|
* control moves) and the host the component is drawn into.
|
|
8
8
|
*/
|
|
9
9
|
import { DashHead } from './DashHead.js';
|
|
10
|
-
import { useEffect, useRef, useState } from 'react';
|
|
11
|
-
import { allowMutationExit, api, beginNavigation, captureNavigation, currentEntry, findTable, go, humanName, keyOf, pageFor, pageView, primaryKey, refsTo, renderCrumbs, state, tableView, } from '../core.js';
|
|
10
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
11
|
+
import { allowMutationExit, api, beginNavigation, captureNavigation, currentEntry, findTable, go, humanName, keyOf, pageFor, pageView, primaryKey, refine, refsTo, renderCrumbs, state, tableView, } from '../core.js';
|
|
12
12
|
import { equalityFilter } from '../resourceRequests.js';
|
|
13
13
|
import { openNewRecord } from '../insert.js';
|
|
14
14
|
import { squeeze } from '../filterbar.js';
|
|
@@ -19,7 +19,7 @@ import { shell } from '../shellMode.js';
|
|
|
19
19
|
import { pluralOf } from '@mistriwork/engine/shared/appNoun.js';
|
|
20
20
|
import { AppList } from './AppList.js';
|
|
21
21
|
import { appListFor, appListQuery, newRecordNoun, splitOf } from './appListModel.js';
|
|
22
|
-
import { onDemand } from './onDemand.js';
|
|
22
|
+
import { onDemand, useArrived } from './onDemand.js';
|
|
23
23
|
import { dashboardSelection, rootSlot } from './dashboardModel.js';
|
|
24
24
|
import { preloadDashboardParts } from './dashboardParts.js';
|
|
25
25
|
import { NewRecordButton } from './NewRecordButton.js';
|
|
@@ -31,7 +31,10 @@ export function AppListRoom({ entry, spec: given, navigate }) {
|
|
|
31
31
|
query suggest: a split beside a plain list asks the same question of
|
|
32
32
|
the same rows. A key naming no view falls back to the suggestion. */
|
|
33
33
|
const spec = entry.view && given.id !== entry.view ? appListFor(entry.table, entry.query, entry.view) : given;
|
|
34
|
-
|
|
34
|
+
/* A tab, a filter, a search: a refinement of the list on screen, so the room is kept and its Query re-asks in place,
|
|
35
|
+
as a header's sort is. Painted as a new room, each threw the whole list away inside the click and held a deep copy
|
|
36
|
+
of it over the pane while the next was built — most of a tab switch's time (test/built-client-vitals.mjs). */
|
|
37
|
+
const to = navigate ?? ((query) => refine(() => go({ ...tableView(entry.table, query), view: entry.view }, 'replace')));
|
|
35
38
|
/* A bare table reached by link — `/crm/task` — is the list on its first
|
|
36
39
|
tab, the way the sidebar opens it. Rendered as it arrived it was every
|
|
37
40
|
column of the table under raw headers with no tab lit: the workbench's
|
|
@@ -63,8 +66,10 @@ export function AppListRoom({ entry, spec: given, navigate }) {
|
|
|
63
66
|
const table = findTable(entry.table);
|
|
64
67
|
const noun = newRecordNoun(spec, table?.name ?? entry.table);
|
|
65
68
|
/* An import is the App framework's (ImportButton.tsx), drawn through the shell's slot. */
|
|
66
|
-
const { ImportButton } = shell().slots;
|
|
67
|
-
return (_jsx("div", { className: "applist-host", children: _jsx(AppList, { entry: entry, spec: spec, navigate: to, embedded: Boolean(navigate),
|
|
69
|
+
const { ImportButton, ListSummary } = shell().slots;
|
|
70
|
+
return (_jsx("div", { className: "applist-host", children: _jsx(AppList, { entry: entry, spec: spec, navigate: to, embedded: Boolean(navigate),
|
|
71
|
+
/* The list's figures are a dashboard's metrics, drawn by the shell that draws dashboards. */
|
|
72
|
+
summary: ListSummary && spec.summary?.length && !navigate ? _jsx(SummaryStrip, { Part: ListSummary, sections: spec.summary }) : undefined, newButton: _jsxs(_Fragment, { children: [ImportButton && (_jsx(ImportButton, { table: table, view: entry.view ?? spec.id, noun: spec.noun ?? { one: noun, many: pluralOf(noun) } })), _jsx(NewRecordButton, { table: table, label: noun, form: spec.form })] }) }) }));
|
|
68
73
|
}
|
|
69
74
|
/* ---------- a dashboard ---------- */
|
|
70
75
|
export function DashboardRoom({ entry }) {
|
|
@@ -274,3 +279,19 @@ function RowPageRoom({ entry }) {
|
|
|
274
279
|
retry((value) => value + 1);
|
|
275
280
|
}, children: say('retryRecordPage') })] })) : (_jsx("p", { role: "status", className: "note", children: say('common.reading') }));
|
|
276
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* A list's summary, with its room held while the part that draws it is on its way (the dashboard's drawing, fetched
|
|
284
|
+
* the first time a list has one): a strip of as many cards, each with its name and the lines its figure will take,
|
|
285
|
+
* dressed by the same rules. The list under it then starts where it will stay.
|
|
286
|
+
*/
|
|
287
|
+
function SummaryStrip({ Part, sections, }) {
|
|
288
|
+
/* The shell's slot is a part fetched on demand (appnav.js); one that is not is here already. */
|
|
289
|
+
const part = useMemo(() => {
|
|
290
|
+
const waits = Part;
|
|
291
|
+
return { ready: () => waits.ready?.() ?? Promise.resolve(), here: () => waits.here?.() ?? true };
|
|
292
|
+
}, [Part]);
|
|
293
|
+
const here = useArrived(part);
|
|
294
|
+
if (here)
|
|
295
|
+
return _jsx(Part, { sections: sections });
|
|
296
|
+
return (_jsx("section", { className: "page-section width-full dash-strip list-summary", "aria-hidden": "true", children: _jsx("div", { className: "home-cards", children: sections.map((section, at) => (_jsxs("div", { className: "home-card home-card-still", children: [_jsx("span", { className: "home-card-value", children: _jsx("span", { className: "sk-bar home-card-wait" }) }), _jsx("span", { className: "home-card-label", children: section.title }), section.target !== undefined && _jsx("span", { className: "dash-target", children: '\u00a0' })] }, at))) }) }));
|
|
297
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
.dash-section-head { display: flex; align-items: center; gap: var(--space-3h); }
|
|
8
8
|
.dash-section-head > .page-section-title { flex: 1; min-width: 0; }
|
|
9
9
|
.dash-period { flex: none; margin-left: auto; }
|
|
10
|
-
.dash-period
|
|
10
|
+
.dash-period [data-slot='select-trigger'] { font-size: var(--text-sm); padding: var(--space-1h) var(--space-3); }
|
|
11
11
|
.home-card-period { cursor: default; }
|
|
12
12
|
.home-card-period .home-card-label { display: flex; align-items: center; gap: var(--space-3); width: 100%; }
|
|
13
13
|
.home-card-open { display: inline-flex; align-items: center; gap: var(--space-2h); padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
|
|
@@ -39,7 +39,7 @@ export function SetFieldDialog({ table, columns, count, row, onApply, onClose, }
|
|
|
39
39
|
onApply(column, value);
|
|
40
40
|
};
|
|
41
41
|
const records = say('countSelectedRecords', { count });
|
|
42
|
-
return (_jsxs(Modal, { className: "confirm set-field-dialog", ariaLabel: say('setAField'), onClose: onClose, children: [_jsx("h2", { children: say('setAField') }), _jsx("p", { children: say('writesOneValueToEach', { records }) }), columns.length > 1 && (_jsx(Field, { label: say('field'), group: true, children: (control) => (_jsx(Dropdown, { ariaLabel: say('field'), id: control.id, value: column, items: columns.map((name) => ({ value: name, label: nameOf(name) })), onChange: (next) => {
|
|
42
|
+
return (_jsxs(Modal, { className: "confirm set-field-dialog", ariaLabel: say('setAField'), closeLabel: say('common.close'), onClose: onClose, children: [_jsx("h2", { children: say('setAField') }), _jsx("p", { children: say('writesOneValueToEach', { records }) }), columns.length > 1 && (_jsx(Field, { label: say('field'), group: true, children: (control) => (_jsx(Dropdown, { ariaLabel: say('field'), id: control.id, value: column, items: columns.map((name) => ({ value: name, label: nameOf(name) })), onChange: (next) => {
|
|
43
43
|
setColumn(next);
|
|
44
44
|
setValue(null);
|
|
45
45
|
setProblem('');
|
|
@@ -154,6 +154,13 @@ export function Sidebar({ host, footerHost: suppliedFooterHost, onSelect, tabNav
|
|
|
154
154
|
useLayoutEffect(() => {
|
|
155
155
|
host.classList.toggle('skimming', skimming);
|
|
156
156
|
}, [host, skimming]);
|
|
157
|
+
/* Whether any room draws a mark, said on the list (structure.css, a markless room keeping the mark's place). Read
|
|
158
|
+
off the list with `#table-list:has(.nav-icon)`, the rule sat above the whole page: any change in the content
|
|
159
|
+
pane re-matched it against every button there, and a header's sort spent its click restyling them
|
|
160
|
+
(test/built-client-vitals.mjs). Read after every draw, since the marks are whatever the rows drew. */
|
|
161
|
+
useLayoutEffect(() => {
|
|
162
|
+
host.toggleAttribute('data-marks', host.querySelector('.nav-icon') !== null);
|
|
163
|
+
});
|
|
157
164
|
/* The current row is brought clear of the foot's fade (features.css `scroll-padding-bottom`): a page you are on that
|
|
158
165
|
sits under the fade reads as greyed out, as if disabled. */
|
|
159
166
|
useLayoutEffect(() => {
|
|
@@ -219,9 +226,12 @@ export function Sidebar({ host, footerHost: suppliedFooterHost, onSelect, tabNav
|
|
|
219
226
|
words, so a nested room's fill began 13px right of a top-level one's. */
|
|
220
227
|
const order = item.footOrder ? { order: item.footOrder } : undefined;
|
|
221
228
|
const indent = item.depth && !(rail && folded) ? { '--nav-indent': `${Math.min(item.depth, 4) * 12}px`, ...order } : order;
|
|
229
|
+
/* Whether the row stands inside a group, said where a folded rail draws no inset to read it from (the pane
|
|
230
|
+
bar's trail, sidebarShell.js). */
|
|
231
|
+
const place = { style: indent, 'data-nested': item.depth ? '' : undefined };
|
|
222
232
|
switch (item.kind) {
|
|
223
233
|
case 'target':
|
|
224
|
-
return (_jsx("li", {
|
|
234
|
+
return (_jsx("li", { ...place, children: _jsxs("a", { className: "app-nav-target", href: item.href, tabIndex: tabNavigation ? 0 : -1, title: hover(item.label), onClick: (event) => {
|
|
225
235
|
if (!event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey && event.button === 0)
|
|
226
236
|
onSelect?.();
|
|
227
237
|
}, children: [_jsx(NavGlyph, { label: item.label, railed: rail, color: item.color }), _jsx("span", { className: "nav-label", children: item.label })] }) }, `target:${i}:${item.href}`));
|
|
@@ -248,16 +258,16 @@ export function Sidebar({ host, footerHost: suppliedFooterHost, onSelect, tabNav
|
|
|
248
258
|
case 'note':
|
|
249
259
|
return (_jsx("li", { children: _jsx("p", { className: "note", children: item.text }) }, `n${i}`));
|
|
250
260
|
case 'missing':
|
|
251
|
-
return (_jsx("li", {
|
|
261
|
+
return (_jsx("li", { ...place, children: _jsxs("button", { type: "button", className: "nav-missing", title: hover(item.label), onClick: () => toast(item.error, 'error'), children: [_jsx(NavGlyph, { icon: item.icon, label: item.label, railed: rail, color: item.navColor }), _jsx("span", { className: "nav-label", children: item.label }), _jsx("span", { className: "view-tag", children: say('missing') })] }) }, `m${i}`));
|
|
252
262
|
case 'dash':
|
|
253
|
-
return (_jsx("li", {
|
|
263
|
+
return (_jsx("li", { ...place, children: _jsxs("button", { type: "button", className: item.error ? 'nav-missing' : undefined, "data-dash": dashPageId(item.view), "aria-current": Boolean(dashView) && item.view === dashView ? 'true' : 'false', tabIndex: tabNavigation ? 0 : -1, title: hover(item.label), onClick: item.error
|
|
254
264
|
? () => toast(item.error ?? '', 'error')
|
|
255
265
|
: () => {
|
|
256
266
|
go(pageView(dashPageId(item.view), undefined, undefined, item.label), 'reset');
|
|
257
267
|
onSelect?.();
|
|
258
268
|
}, children: [_jsx(NavGlyph, { icon: item.icon, label: item.label, railed: rail, color: item.navColor }), _jsx("span", { className: "nav-label", children: item.label }), item.error ? _jsx("span", { className: "view-tag", children: say('missing') }) : null] }) }, `d${item.view}`));
|
|
259
269
|
case 'form':
|
|
260
|
-
return (_jsx("li", {
|
|
270
|
+
return (_jsx("li", { ...place, children: _jsxs("button", { type: "button", className: item.error ? 'nav-missing' : undefined, "data-form": item.page ?? formPageId(item.view), "aria-current": (item.page ?? item.view) === formView ? 'true' : 'false', tabIndex: tabNavigation ? 0 : -1, title: hover(item.label), onClick: item.error
|
|
261
271
|
? () => toast(item.error ?? '', 'error')
|
|
262
272
|
: () => {
|
|
263
273
|
go(pageView(item.page ?? formPageId(item.view), undefined, undefined, item.label), 'reset');
|
|
@@ -265,7 +275,7 @@ export function Sidebar({ host, footerHost: suppliedFooterHost, onSelect, tabNav
|
|
|
265
275
|
}, children: [_jsx(NavGlyph, { icon: item.icon, label: item.label, railed: rail, color: item.navColor }), _jsx("span", { className: "nav-label", children: item.label }), item.error ? _jsx("span", { className: "view-tag", children: say('missing') }) : null] }) }, `f${item.view}`));
|
|
266
276
|
case 'table': {
|
|
267
277
|
const index = tableIndexes[i];
|
|
268
|
-
return (_jsx("li", {
|
|
278
|
+
return (_jsx("li", { ...place, children: _jsx(TableRow, { item: item, index: index, current: index === current, active: cursor >= 0 && index === cursor, rail: rail, quiet: rail && folded, title: hover(item.label), onSelect: onSelect, tabNavigation: tabNavigation }) }, `r${item.table}|${item.navq ?? '-'}|${i}`));
|
|
269
279
|
}
|
|
270
280
|
}
|
|
271
281
|
}), windowed && spacer('below', items.length - end), pinned && footerHost
|
|
@@ -41,7 +41,7 @@ export function SuggestBox({ table, columns, standing = '', text, onText, onPick
|
|
|
41
41
|
return (_jsx(Typeahead, { text: text, onText: (next) => {
|
|
42
42
|
onText(next);
|
|
43
43
|
setWanted(true);
|
|
44
|
-
}, open: wanted && items.length > 0, onOpenChange: setWanted, items: items, itemKey: (item) => item.value, itemLabel: (item) => item.value, itemClassName: (
|
|
44
|
+
}, open: wanted && items.length > 0, onOpenChange: setWanted, items: items, itemKey: (item) => item.value, itemLabel: (item) => item.value, itemClassName: () => '', renderItem: (item) => _jsx("span", { "data-slot": "option-label", children: item.value }), onPick: (item) => {
|
|
45
45
|
setWanted(false);
|
|
46
46
|
onText(item.value);
|
|
47
47
|
onPick(item.value);
|
|
@@ -56,5 +56,5 @@ export function SuggestBox({ table, columns, standing = '', text, onText, onPick
|
|
|
56
56
|
return;
|
|
57
57
|
onKeyDown?.(e);
|
|
58
58
|
},
|
|
59
|
-
}, popupClassName: "
|
|
59
|
+
}, popupClassName: "", listClassName: "", fit: "min-width" }));
|
|
60
60
|
}
|
|
@@ -34,6 +34,8 @@ interface TableRoomProps {
|
|
|
34
34
|
actions?: TableViewProps['actions'];
|
|
35
35
|
/** The entry's label, the accessible name a presentation goes by. */
|
|
36
36
|
listLabel?: string;
|
|
37
|
+
/** The shown column a row is titled by where the rows are read as records (rowTitle.ts): an embed's own. */
|
|
38
|
+
rowTitle?: string;
|
|
37
39
|
/** The view's hand-order column, where it keeps one. */
|
|
38
40
|
order?: string;
|
|
39
41
|
/** A read-only card may still be a doorway to its record. */
|
|
@@ -68,8 +70,10 @@ interface TableRoomProps {
|
|
|
68
70
|
version?: number;
|
|
69
71
|
/** The answer, once it has rows and columns. */
|
|
70
72
|
onResult?: (data: RunData) => void;
|
|
73
|
+
/** The room's own title while a refusal stands in place of its rows, and null once it no longer does. */
|
|
74
|
+
onRefused?: (title: string | null) => void;
|
|
71
75
|
}
|
|
72
|
-
export declare function TableRoom({ entry, chrome, inset, interactive, hide, labels, referenceLabels, totals, group, density, rowActions, editable, inCrumbs, sizing, export: exportOn, summaries, embedded, version, onResult, presentation, present, actions, listLabel, order, recordNavigation, empty, }: TableRoomProps): import("react").JSX.Element;
|
|
76
|
+
export declare function TableRoom({ entry, chrome, inset, interactive, hide, labels, referenceLabels, totals, group, density, rowActions, editable, inCrumbs, sizing, export: exportOn, summaries, embedded, version, onResult, onRefused, presentation, present, actions, listLabel, rowTitle, order, recordNavigation, empty, }: TableRoomProps): import("react").JSX.Element;
|
|
73
77
|
/**
|
|
74
78
|
* A refusal in the reader's words. An API's refusal quotes columns as the API
|
|
75
79
|
* names them (`carrier_id`) and lists which (`columns`); an App calls them by
|
|
@@ -20,7 +20,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
20
20
|
* is a grid embedded in someone else's surface — an app list, a dashboard
|
|
21
21
|
* section, a page's chooser — and touches nothing but its own box.
|
|
22
22
|
*/
|
|
23
|
-
import { useEffect, useMemo } from 'react';
|
|
23
|
+
import { useContext, useEffect, useMemo } from 'react';
|
|
24
24
|
import { useQuery } from '@tanstack/react-query';
|
|
25
25
|
import { $, api, columnLabel, findTable, go, pageSize, setExplain, showErrors, state, tableView } from '../core.js';
|
|
26
26
|
import { explicitLimit } from '../clauses.js';
|
|
@@ -44,6 +44,7 @@ import { useListHold } from '../liveState.js';
|
|
|
44
44
|
import { laneWindow } from '@mistriwork/engine/shared/boardLanes.js';
|
|
45
45
|
import { say } from '../copy/lists/components/TableRoom.js';
|
|
46
46
|
import { PartialNote } from './PartialNote.js';
|
|
47
|
+
import { RowTitleContext } from './rowTitle.js';
|
|
47
48
|
/* The diagrams are a chunk of their own, loaded when the Diagram tab is first opened. */
|
|
48
49
|
/**
|
|
49
50
|
* A list this reader's catalog leaves out. Signed in, the role is the reason.
|
|
@@ -53,16 +54,32 @@ import { PartialNote } from './PartialNote.js';
|
|
|
53
54
|
* tenant's public address keeps the top bar's door, which leaves that address
|
|
54
55
|
* behind on purpose (app.js, showAccount).
|
|
55
56
|
*/
|
|
56
|
-
function NotYours({ thing }) {
|
|
57
|
+
function NotYours({ thing, onStand }) {
|
|
57
58
|
const app = state.activeConnection;
|
|
58
59
|
const noun = { thing };
|
|
60
|
+
/* The room around it named itself from the address before the answer came ("No-such-page"), which is no name: while
|
|
61
|
+
the refusal stands it gives the room's head its own (`onStand`), and the pane bar's trail, which has no menu row
|
|
62
|
+
to read (sidebarShell.js hears `mistri:room-title`). One title for a room the role may not see and an address
|
|
63
|
+
that names nothing: the catalog leaves out what the reader cannot see, so the two are not told apart here. */
|
|
64
|
+
const title = say('notAvailable');
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
onStand?.(title);
|
|
67
|
+
document.dispatchEvent(new CustomEvent('mistri:room-title', { detail: title }));
|
|
68
|
+
return () => {
|
|
69
|
+
onStand?.(null);
|
|
70
|
+
document.dispatchEvent(new CustomEvent('mistri:room-title', { detail: '' }));
|
|
71
|
+
};
|
|
72
|
+
}, [title]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
59
73
|
// An App with no roles has none to blame: the list is simply not one this address names.
|
|
60
74
|
if (!shell().publicVisitor())
|
|
61
|
-
return _jsx(Refused, { text: say(appKeepsRoles() ? 'notAvailableToYou' : 'notAvailableHere', noun)
|
|
75
|
+
return (_jsx(Refused, { room: true, text: say(appKeepsRoles() ? 'notAvailableToYou' : 'notAvailableHere', noun),
|
|
76
|
+
/* A person told no is told where to go: the App's home, which every role has. The wordmark's own press, so
|
|
77
|
+
home is reached the one way (app.js, goHome). */
|
|
78
|
+
action: _jsx("button", { type: "button", className: "ghost", onClick: () => $('home-button')?.click(), children: say('goHome') }) }));
|
|
62
79
|
// Signed out, no role is the reason, wherever the door is.
|
|
63
80
|
if (typeof app !== 'string' || arrivedPlacement())
|
|
64
|
-
return _jsx(Refused, { text: say('signInToSeeThis', noun) });
|
|
65
|
-
return (_jsx(Refused, { text: say('signInToSeeThis', noun), action: _jsx("button", { type: "button", className: "ghost", onClick: () => shell().signInHere(app), children: say('common.signIn') }) }));
|
|
81
|
+
return _jsx(Refused, { room: true, text: say('signInToSeeThis', noun) });
|
|
82
|
+
return (_jsx(Refused, { room: true, text: say('signInToSeeThis', noun), action: _jsx("button", { type: "button", className: "ghost", onClick: () => shell().signInHere(app), children: say('common.signIn') }) }));
|
|
66
83
|
}
|
|
67
84
|
const NeighbourhoodDiagram = onDemand(() => import('./Diagram.js'), 'NeighbourhoodDiagram');
|
|
68
85
|
/* An API's documented reads, tried from here: only a connection to an API has the tab. */
|
|
@@ -76,7 +93,7 @@ const thingOf = (entry, table) => {
|
|
|
76
93
|
return kind === 'row' || (kind === 'page' && named) ? say('thingRecord') : table ? say('thingList') : say('thingPage');
|
|
77
94
|
};
|
|
78
95
|
const connection = () => state.activeConnection ?? '';
|
|
79
|
-
export function TableRoom({ entry, chrome = true, inset = chrome, interactive = true, hide, labels, referenceLabels, totals, group, density, rowActions, editable, inCrumbs, sizing, export: exportOn = true, summaries = false, embedded = false, version = 0, onResult, presentation, present, actions, listLabel, order, recordNavigation = false, empty, }) {
|
|
96
|
+
export function TableRoom({ entry, chrome = true, inset = chrome, interactive = true, hide, labels, referenceLabels, totals, group, density, rowActions, editable, inCrumbs, sizing, export: exportOn = true, summaries = false, embedded = false, version = 0, onResult, onRefused, presentation, present, actions, listLabel, rowTitle, order, recordNavigation = false, empty, }) {
|
|
80
97
|
/* A tab this reader cannot have here falls back to Rows: Definition and API
|
|
81
98
|
are the operator's, API only over an API, and an API's definition is its
|
|
82
99
|
description, so it has no Definition tab. */
|
|
@@ -97,7 +114,9 @@ export function TableRoom({ entry, chrome = true, inset = chrome, interactive =
|
|
|
97
114
|
if (bar)
|
|
98
115
|
bar.value = entry.query;
|
|
99
116
|
}, [chrome, entry.query]);
|
|
100
|
-
|
|
117
|
+
/* An embed that names its rows' title says so over whatever the caller set; one that does not leaves it alone. */
|
|
118
|
+
const outer = useContext(RowTitleContext);
|
|
119
|
+
return (_jsxs(RowTitleContext.Provider, { value: rowTitle ?? outer, children: [chrome && (_jsx("div", { className: "grid-host", children: _jsx(ViewTabs, { entry: entry }) })), chrome && tab === 'rows' && _jsx(FilterSection, { entry: entry }, entry.query), _jsx("div", { className: inset ? 'grid-inset' : undefined, children: tab === 'diagram' ? (_jsx("div", { className: "panel-pad", children: _jsx("div", { className: "diagram", children: _jsx(NeighbourhoodDiagram, { tableId: entry.table }) }) })) : tab === 'api' ? (_jsx(ApiOperations, { table: entry.table })) : tab === 'ddl' ? (_jsx(DdlPane, { table: entry.table })) : (_jsx(Rows, { entry: entry, chrome: chrome, interactive: interactive, hide: hide, labels: labels, referenceLabels: referenceLabels, totals: totals, group: group, density: density, rowActions: rowActions, editable: editable, inCrumbs: inCrumbs, sizing: sizing, exportOn: exportOn, summaries: summaries, embedded: embedded, version: version, onResult: onResult, onRefused: onRefused, presentation: presentation, present: present, actions: actions, listLabel: listLabel, order: order, recordNavigation: recordNavigation, empty: empty })) })] }));
|
|
101
120
|
}
|
|
102
121
|
const escaped = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
103
122
|
/**
|
|
@@ -149,7 +168,7 @@ function keepTotal(key, reply) {
|
|
|
149
168
|
listTotals.delete(listTotals.keys().next().value);
|
|
150
169
|
listTotals.set(key, { total, ...(exactTotal !== undefined ? { exactTotal } : {}), ...(cappedTotal ? { cappedTotal } : {}) });
|
|
151
170
|
}
|
|
152
|
-
function Rows({ entry: given, chrome, interactive, hide, labels, referenceLabels, totals, group, density, rowActions, editable, inCrumbs, sizing, exportOn, summaries, embedded, version, onResult, presentation, present, actions, listLabel, order, recordNavigation, empty, }) {
|
|
171
|
+
function Rows({ entry: given, chrome, interactive, hide, labels, referenceLabels, totals, group, density, rowActions, editable, inCrumbs, sizing, exportOn, summaries, embedded, version, onResult, onRefused, presentation, present, actions, listLabel, order, recordNavigation, empty, }) {
|
|
153
172
|
/* A grouped list's rows are read in the group's order, each group's together under its head: said to the read and
|
|
154
173
|
the pager that steps it, while the walk keeps the reader's own question (a header's sort writes that). */
|
|
155
174
|
const groupedQuery = group ? groupedQuestion(given.query, group.column) : given.query;
|
|
@@ -229,7 +248,7 @@ function Rows({ entry: given, chrome, interactive, hide, labels, referenceLabels
|
|
|
229
248
|
/* A signed-out visitor asking past what the App opens to the public is asked to sign in (401), whether the table
|
|
230
249
|
is a member's or no table at all: offered in place. */
|
|
231
250
|
if (run.isError && run.error.code === 'members_only' && !chrome)
|
|
232
|
-
return _jsx(NotYours, { thing: thingOf(entry, table) });
|
|
251
|
+
return _jsx(NotYours, { thing: thingOf(entry, table), onStand: onRefused });
|
|
233
252
|
/* An App's list that could not be read says so as every place does (Notes.tsx): the warn mark, the sentence and Try
|
|
234
253
|
again on the list's edge. A bare grey line was a dead end only a reload got out of. The Workbench keeps its note
|
|
235
254
|
under the query bar it can fix the question in. */
|
|
@@ -242,7 +261,7 @@ function Rows({ entry: given, chrome, interactive, hide, labels, referenceLabels
|
|
|
242
261
|
/* An App's list over a table the role cannot read is answered "No table called ..." (the catalog it sees leaves the table out):
|
|
243
262
|
there is no query bar to fix, only a list that is not this reader's. */
|
|
244
263
|
if (!('ms' in data))
|
|
245
|
-
return !chrome && !table ? _jsx(NotYours, { thing: thingOf(entry, table) }) : _jsx("p", { className: "note", children: say('fixTheQueryAbove') });
|
|
264
|
+
return !chrome && !table ? (_jsx(NotYours, { thing: thingOf(entry, table), onStand: onRefused })) : (_jsx("p", { className: "note", children: say('fixTheQueryAbove') }));
|
|
246
265
|
/* Not over a question that failed: its error says why there are no rows. */
|
|
247
266
|
if (empty && !run.isPlaceholderData && data.rows.length === 0 && page === 0 && !data.errors?.length)
|
|
248
267
|
return _jsx(_Fragment, { children: empty });
|
|
@@ -30,6 +30,7 @@ import { BesideDetail } from './besideDetail.js';
|
|
|
30
30
|
import { editableCells } from './gridCellModel.js';
|
|
31
31
|
import { canEditRow } from '../rowEditing.js';
|
|
32
32
|
import { RecordSummaries, tableSaysMore } from './RecordSummaries.js';
|
|
33
|
+
import { RECORDS_QUERY, useMediaQuery } from './useMediaQuery.js';
|
|
33
34
|
import { canUseDatabaseTools } from '../connectionScope.js';
|
|
34
35
|
import { shell } from '../shellMode.js';
|
|
35
36
|
import { onDemand, useArrived } from './onDemand.js';
|
|
@@ -207,6 +208,9 @@ export function TableView({ entry, data, chrome, interactive, hide, labels, refe
|
|
|
207
208
|
/* Records or table: how a narrow screen shows the rows, the reader's pick. The page's own list draws the switch at
|
|
208
209
|
the end of its control strip (AppList), beside the tabs; anywhere else, over the rows. */
|
|
209
210
|
const [layout, setLayout] = useState('records');
|
|
211
|
+
/* The records are drawn only where they can be seen. Wider, the stylesheet hides them, and a desk drew every row
|
|
212
|
+
twice for it — once as a summary nobody saw — in every sort, filter and tab (test/built-client-vitals.mjs). */
|
|
213
|
+
const narrow = useMediaQuery(RECORDS_QUERY);
|
|
210
214
|
const { controls } = useCrumbSlots();
|
|
211
215
|
const presentationSwitch = (element) => (inCrumbs && controls ? createPortal(element, controls) : element);
|
|
212
216
|
const table = findTable(data.table);
|
|
@@ -315,10 +319,10 @@ export function TableView({ entry, data, chrome, interactive, hide, labels, refe
|
|
|
315
319
|
const gridOf = (rows) => (_jsx(Grid, { table: table, data: rows === data.rows ? data : { ...data, rows }, hide: hide, labels: labels, referenceLabels: referenceLabels, totals: totals, ...(group ? { group } : {}), density: density, sizing: sizing, interactive: interactive, firstRow: firstRow, list: list, current: current, dropColumns: embedded || beside, editCell: editCell, ...(adornCell ? { adornCell } : {}) }));
|
|
316
320
|
const hasOrder = Boolean(listOrder && table);
|
|
317
321
|
const ordered = hasOrder && listOrder && table ? (_jsx(GridOrder, { table: table, rows: data.rows, order: listOrder, interactive: interactive, children: gridOf })) : (gridOf(data.rows));
|
|
318
|
-
const selected = table && selectableGrid(table, actions ?? [], interactive, editing) ? (_jsxs(RowHosts, { children: [_jsx(GridSelection, { table: table, rows: data.rows, actions: actions ?? [], interactive: interactive, editable: editing })
|
|
322
|
+
const selected = table && selectableGrid(table, actions ?? [], interactive, editing) ? (_jsxs(RowHosts, { children: [ordered, _jsx(GridSelection, { table: table, rows: data.rows, actions: actions ?? [], interactive: interactive, editable: editing, ...(group ? { group } : {}) })] })) : !hasOrder ? (ordered) : (_jsx(RowHosts, { children: ordered }));
|
|
319
323
|
// A row's menu draws what the record's bar draws, so an action kept out of it (`header: false`) is no reason for a ⋯.
|
|
320
324
|
const tableGrid = rowActions && (interactive || embedded) && table && actions?.some((action) => action.header !== false) && primaryKey(table).length ? (_jsxs(RowTrailHosts, { children: [_jsx(RowActions, { table: table, rows: data.rows, actions: actions, onDone: () => render() }), selected] })) : (selected);
|
|
321
325
|
return (_jsxs(_Fragment, { children: [_jsx(ResultHead, { entry: entry, data: data, chrome: chrome, interactive: interactive, exportOn: exportOn, at: at, headRef: head, inCrumbs: inCrumbs }), _jsxs("div", { className: hasSummaries ? `responsive-results show-${embedded || !choice ? 'records' : layout}` : undefined, children: [hasSummaries && (_jsxs(_Fragment, { children: [!embedded &&
|
|
322
326
|
choice &&
|
|
323
|
-
presentationSwitch(_jsx(PresentationSwitch, { layout: layout, onChange: setLayout, label: say('common.listPresentation'), records: say('common.records'), table: say('common.table') })), _jsx(RecordSummaries, { table: table, data: data, columns: (data.columns ?? []).filter((name) => !hide?.includes(name)), labels: labels, referenceLabels: referenceLabels, list: list, query: entry.query, ...(group ? { group } : {}), ...(adornCell ? { adornFact: (row, column) => adornCell(row, column, 'summary') } : {}) })] })), _jsx("div", { className: "result-table", "aria-busy": busy || undefined, children: tableGrid })] }), _jsx(Pager, { entry: entry, data: data, at: at, range: inCrumbs })] }));
|
|
327
|
+
presentationSwitch(_jsx(PresentationSwitch, { layout: layout, onChange: setLayout, label: say('common.listPresentation'), records: say('common.records'), table: say('common.table') })), narrow && (_jsx(RecordSummaries, { table: table, data: data, columns: (data.columns ?? []).filter((name) => !hide?.includes(name)), labels: labels, referenceLabels: referenceLabels, list: list, query: entry.query, ...(group ? { group } : {}), ...(adornCell ? { adornFact: (row, column) => adornCell(row, column, 'summary') } : {}) }))] })), _jsx("div", { className: "result-table", "aria-busy": busy || undefined, children: tableGrid })] }), _jsx(Pager, { entry: entry, data: data, at: at, range: inCrumbs })] }));
|
|
324
328
|
}
|
|
@@ -5,8 +5,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
* always, ranges where a range means anything. The sampling round trip
|
|
6
6
|
* stays in `thmenu.js`; this is the menu, and the rule for what it offers.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useEffect, useState } from 'react';
|
|
9
|
+
import { createMenuController, Menu, MenuContent, MenuItem, MenuSeparator } from '@ui-sdk/react/menu';
|
|
10
10
|
import { go, quote, refine, render, tableView } from '../core.js';
|
|
11
11
|
import { addSort, nextSort, sortCount, sortDirection } from '../clauses.js';
|
|
12
12
|
import { SORT_SCAN_BELOW } from '../columns.js';
|
|
@@ -15,7 +15,7 @@ import { promptFor, promptForRange } from '../prompt.js';
|
|
|
15
15
|
import { pinnedFor, togglePin } from '../pins.js';
|
|
16
16
|
import { formatNumber } from '../locale.js';
|
|
17
17
|
import { say } from '../copy/columnMenu/components/ThMenu.js';
|
|
18
|
-
import { popupContainer } from '../shellHost.js';
|
|
18
|
+
import { popupContainer, portalRoot } from '../shellHost.js';
|
|
19
19
|
/** Quote a typed value only when the grammar needs it. Trimmed, then handed to the one quoter. */
|
|
20
20
|
const quoteValue = (text) => quote(String(text).trim());
|
|
21
21
|
/**
|
|
@@ -137,27 +137,38 @@ export function FilterMenu({ anchor, name, kind, metaType, dateish, rows, table,
|
|
|
137
137
|
if (range)
|
|
138
138
|
apply(`${name} between ${quoteValue(offer.asStamp(range.from))} and ${quoteValue(offer.asStamp(range.to))}`);
|
|
139
139
|
};
|
|
140
|
-
/*
|
|
140
|
+
/* UI SDK owns the menu's keyboard and its dismissal: focus moves in on
|
|
141
141
|
open, arrows walk the items, Escape and a click outside close only this
|
|
142
|
-
layer, and focus goes back to the ⌄ that opened it.
|
|
143
|
-
|
|
144
|
-
off an edge — which happens constantly on a
|
|
145
|
-
|
|
142
|
+
layer, and focus goes back to the ⌄ that opened it. It has no trigger of
|
|
143
|
+
its own: the ⌄ is the grid's, and the menu is placed under it, flipped or
|
|
144
|
+
shifted when it would run off an edge — which happens constantly on a
|
|
145
|
+
wide table scrolled to the end.
|
|
146
|
+
|
|
147
|
+
It is opened through a controller and not by an `open` prop: a menu that
|
|
148
|
+
is simply drawn open is given no focus, and this one is asked for by a
|
|
149
|
+
press on the ⌄, so the keyboard has to arrive in it. */
|
|
150
|
+
const [controller] = useState(() => createMenuController());
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
void controller.open({ anchor, focus: 'popup' });
|
|
153
|
+
}, [controller, anchor]);
|
|
154
|
+
return (_jsx(Menu, { controller: controller, onOpenChange: (next) => {
|
|
146
155
|
if (next)
|
|
147
156
|
return;
|
|
148
157
|
/* Dismissed rather than used: the keyboard goes back to the ⌄. */
|
|
149
158
|
if (anchor.isConnected)
|
|
150
159
|
anchor.focus();
|
|
151
160
|
onClose();
|
|
152
|
-
}, children:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
161
|
+
}, children: _jsxs(MenuContent, { className: "th-menu", anchor: anchor, side: "bottom", align: "start", sideOffset: 4, collisionPadding: 12,
|
|
162
|
+
/* Out of the table, by name (AppColumnMenuPopups.tsx says why): the dialog the grid is in, else the page. */
|
|
163
|
+
container: anchor.closest('dialog, [role="dialog"]') ?? popupContainer() ?? portalRoot(), finalFocus: () => (anchor.isConnected ? anchor : null), children: [table ? (_jsxs(Item, { onClick: () => {
|
|
164
|
+
togglePin(table, columns, name);
|
|
165
|
+
onClose();
|
|
166
|
+
render();
|
|
167
|
+
}, children: [_jsx("span", { className: "th-menu-label", children: pinned.includes(name) ? say('unpinThisColumn') : say('pinThisColumn') }), _jsx("span", { className: "th-menu-cond", children: pinned.includes(name) ? say('letItScrollAway') : say('keepItInView') })] })) : null, sortItem(say('sortAscending'), 'asc'), sortItem(say('sortDescending'), 'desc'), sortsAlready ? sortItem(say('thenByAscending'), 'asc', true) : null, sortsAlready ? sortItem(say('thenByDescending'), 'desc', true) : null, table ? _jsx(MenuSeparator, { className: "th-menu-sep" }) : null, offer.typed.map((typed) => (_jsx(Item, { className: "th-menu-item th-menu-typed", onClick: () => void ask(typed), children: _jsx("span", { className: "th-menu-label", children: typed.label }) }, typed.label))), offer.ranges.map((range) => (_jsx(Item, { className: "th-menu-item th-menu-typed", onClick: () => void askRange(range), children: _jsx("span", { className: "th-menu-label", children: range[0] }) }, range[0]))), offer.typed.length ? _jsx(MenuSeparator, { className: "th-menu-sep" }) : null, offer.options.map(([label, condition]) => (_jsxs(Item, { onClick: () => add(condition), children: [_jsx("span", { className: "th-menu-label", children: label }), _jsx("span", { className: "th-menu-cond", children: condition })] }, condition + label)))] }) }));
|
|
157
168
|
}
|
|
158
169
|
/** One row of the menu, drawn as the button it always was. */
|
|
159
170
|
function Item({ className = 'th-menu-item', onClick, children }) {
|
|
160
171
|
/* The handlers close the menu themselves (onClose unmounts it), so the
|
|
161
|
-
item does not also ask
|
|
162
|
-
return (_jsx(
|
|
172
|
+
item does not also ask the menu to — that told the caller twice. */
|
|
173
|
+
return (_jsx(MenuItem, { render: _jsx("button", { type: "button" }), className: className, closeOnSelect: false, onSelect: onClick, children: children }));
|
|
163
174
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* What dresses the tour's card. 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 tour ----------
|
|
5
|
+
|
|
6
|
+
A scrim, a ring around the thing being talked about, and a card beside it.
|
|
7
|
+
The scrim is light: this is a tool someone is trying to read, and a
|
|
8
|
+
near-black overlay makes the interface behind it unreadable at exactly the
|
|
9
|
+
moment the card is telling them to look at it. */
|
|
10
|
+
/* The dim is painted by the ring's own outward shadow, not by this, so that
|
|
11
|
+
the one element being talked about is the one element at full strength. A
|
|
12
|
+
full-bleed layer with the ring on top of it tints the anchor as well —
|
|
13
|
+
which is the whole interface saying "look here" while making "here" the
|
|
14
|
+
hardest thing on screen to read.
|
|
15
|
+
|
|
16
|
+
This stays as the thing that catches a click outside. */
|
|
17
|
+
.tour-scrim {
|
|
18
|
+
position: fixed;
|
|
19
|
+
inset: 0;
|
|
20
|
+
z-index: 60;
|
|
21
|
+
}
|
|
22
|
+
/* The stop with no anchor has no hole to punch, so the scrim paints it. */
|
|
23
|
+
.tour-scrim.dim { background: var(--tour-veil); }
|
|
24
|
+
.tour-ring {
|
|
25
|
+
position: fixed;
|
|
26
|
+
z-index: 61;
|
|
27
|
+
border: 2px solid var(--accent);
|
|
28
|
+
border-radius: var(--radius);
|
|
29
|
+
/* Everything outside the ring, dimmed, in one shadow — which is what makes
|
|
30
|
+
the inside of it untouched. `100vmax` rather than a round number of
|
|
31
|
+
pixels so it still covers the corners of a very wide window. */
|
|
32
|
+
box-shadow: 0 0 0 100vmax var(--tour-veil);
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
transition: top var(--t-popover) var(--ease-out), left var(--t-popover) var(--ease-out),
|
|
35
|
+
width var(--t-popover) var(--ease-out), height var(--t-popover) var(--ease-out);
|
|
36
|
+
}
|
|
37
|
+
.tour-card {
|
|
38
|
+
position: fixed;
|
|
39
|
+
z-index: 62;
|
|
40
|
+
width: min(23rem, calc(100vw - 2rem));
|
|
41
|
+
padding: 1rem 1.1rem 0.9rem;
|
|
42
|
+
background: var(--surface);
|
|
43
|
+
border: 1px solid var(--line-strong);
|
|
44
|
+
border-radius: var(--radius);
|
|
45
|
+
box-shadow: var(--shadow-panel);
|
|
46
|
+
}
|
|
47
|
+
.tour-step {
|
|
48
|
+
margin: 0 0 0.35rem;
|
|
49
|
+
font-size: 0.72rem;
|
|
50
|
+
letter-spacing: 0.06em;
|
|
51
|
+
text-transform: uppercase;
|
|
52
|
+
color: var(--ink-muted);
|
|
53
|
+
}
|
|
54
|
+
.tour-title {
|
|
55
|
+
margin: 0 0 0.4rem;
|
|
56
|
+
font-size: 1rem;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
}
|
|
59
|
+
.tour-body {
|
|
60
|
+
margin: 0;
|
|
61
|
+
font-size: 0.87rem;
|
|
62
|
+
line-height: 1.55;
|
|
63
|
+
color: var(--ink-muted);
|
|
64
|
+
}
|
|
65
|
+
.tour-actions {
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: 0.5rem;
|
|
68
|
+
margin-top: 1rem;
|
|
69
|
+
align-items: center;
|
|
70
|
+
}
|
|
71
|
+
/* Skip sits away from the two that move through the tour, so "leave" is never
|
|
72
|
+
the button next to the one the hand is already on. */
|
|
73
|
+
.tour-skip { margin-right: auto; }
|
|
74
|
+
.tour-actions button { font-size: 0.83rem; padding: 0.35rem 0.8rem; }
|
|
75
|
+
@media (prefers-reduced-motion: reduce) {
|
|
76
|
+
.tour-ring { transition: none; }
|
|
77
|
+
}
|
|
78
|
+
/* The example query on the stop that explains the bar. Its own line, because
|
|
79
|
+
it is the thing to be typed rather than part of the sentence around it. */
|
|
80
|
+
.tour-code {
|
|
81
|
+
display: block;
|
|
82
|
+
margin: 0 0 0.55rem;
|
|
83
|
+
padding: 0.4rem 0.55rem;
|
|
84
|
+
background: var(--raised);
|
|
85
|
+
border: 1px solid var(--line);
|
|
86
|
+
border-radius: var(--radius);
|
|
87
|
+
font-family: var(--mono);
|
|
88
|
+
font-size: 0.79rem;
|
|
89
|
+
color: var(--ink);
|
|
90
|
+
/* Wrapped rather than scrolled. A horizontal scrollbar inside a 23rem card
|
|
91
|
+
hides the end of the one line the reader is being asked to copy, and a
|
|
92
|
+
query reads perfectly well over two lines. */
|
|
93
|
+
white-space: pre-wrap;
|
|
94
|
+
word-break: break-word;
|
|
95
|
+
}
|
|
96
|
+
}
|