@mistriwork/kit 1.0.0-rc.57 → 1.0.0-rc.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/app.js +14 -2
- package/dist/client/audience.d.ts +1 -0
- package/dist/client/audience.js +10 -0
- package/dist/client/brandLook.css +49 -1
- package/dist/client/components/AppColumnMenuPopups.js +41 -11
- package/dist/client/components/AppList.d.ts +3 -1
- package/dist/client/components/AppList.js +77 -15
- package/dist/client/components/CardsList.js +14 -1
- package/dist/client/components/Chart.css +4 -0
- package/dist/client/components/Chart.d.ts +4 -4
- package/dist/client/components/Chart.js +30 -9
- package/dist/client/components/Content.js +3 -1
- package/dist/client/components/DateField.css +1 -1
- package/dist/client/components/DateField.js +1 -0
- package/dist/client/components/DefinedFields.js +2 -2
- package/dist/client/components/Diagram.css +82 -0
- package/dist/client/components/Diagram.d.ts +1 -0
- package/dist/client/components/Diagram.js +1 -0
- package/dist/client/components/Dressed.js +1 -1
- package/dist/client/components/Editable.js +7 -3
- package/dist/client/components/Export.js +1 -1
- package/dist/client/components/FilterBoxes.js +2 -2
- package/dist/client/components/FilterRail.css +1 -1
- package/dist/client/components/FilterRail.js +6 -4
- package/dist/client/components/Gallery.css +171 -0
- package/dist/client/components/Gallery.d.ts +1 -0
- package/dist/client/components/Gallery.js +1 -0
- package/dist/client/components/Grid.d.ts +2 -1
- package/dist/client/components/Grid.js +78 -24
- package/dist/client/components/GridCellEditor.js +4 -2
- package/dist/client/components/GridSelection.d.ts +4 -1
- package/dist/client/components/GridSelection.js +20 -3
- package/dist/client/components/LandingSurface.css +2 -2
- package/dist/client/components/LayoutBuilder.css +225 -0
- package/dist/client/components/LayoutBuilder.d.ts +1 -0
- package/dist/client/components/LayoutBuilder.js +1 -0
- package/dist/client/components/ListColumns.d.ts +12 -0
- package/dist/client/components/ListColumns.js +61 -0
- package/dist/client/components/ListFilterBar.css +39 -14
- package/dist/client/components/ListFilterBar.js +39 -23
- package/dist/client/components/MultiStepForm.css +22 -22
- package/dist/client/components/NewRecord.js +120 -104
- package/dist/client/components/Notes.css +9 -0
- package/dist/client/components/Notes.d.ts +6 -2
- package/dist/client/components/Notes.js +10 -6
- package/dist/client/components/OverflowMenu.js +16 -11
- package/dist/client/components/PageFields.js +19 -4
- package/dist/client/components/PageRelated.d.ts +8 -1
- package/dist/client/components/PageRelated.js +46 -33
- package/dist/client/components/PageSections.js +18 -5
- package/dist/client/components/Palette.js +1 -1
- package/dist/client/components/Prefs.d.ts +10 -0
- package/dist/client/components/Prefs.js +33 -23
- package/dist/client/components/PresentationSwitch.js +4 -0
- package/dist/client/components/Prompt.js +4 -4
- package/dist/client/components/RecordGone.js +4 -4
- package/dist/client/components/RecordPicker.js +24 -6
- package/dist/client/components/RecordSummaries.js +31 -5
- package/dist/client/components/RecordTrailNav.js +4 -0
- package/dist/client/components/RichTextEditor.css +2 -2
- package/dist/client/components/RichTextEditor.js +18 -19
- package/dist/client/components/Rooms.js +22 -4
- package/dist/client/components/SectionPeriod.css +1 -1
- package/dist/client/components/SetFieldDialog.js +1 -1
- package/dist/client/components/Sidebar.js +8 -5
- package/dist/client/components/SuggestBox.js +2 -2
- package/dist/client/components/TableRoom.d.ts +5 -1
- package/dist/client/components/TableRoom.js +29 -10
- package/dist/client/components/TableView.js +1 -1
- package/dist/client/components/ThMenu.js +26 -15
- package/dist/client/components/Tour.css +96 -0
- package/dist/client/components/Tour.d.ts +1 -0
- package/dist/client/components/Tour.js +1 -0
- package/dist/client/components/TreePicker.css +1 -1
- package/dist/client/components/TreePicker.js +27 -20
- package/dist/client/components/Value.js +4 -1
- package/dist/client/components/WorkflowStatus.js +8 -4
- package/dist/client/components/appListModel.d.ts +4 -0
- package/dist/client/components/appRooms.d.ts +2 -0
- package/dist/client/components/appRooms.js +2 -0
- package/dist/client/components/boardNew.d.ts +5 -0
- package/dist/client/components/boardNew.js +5 -0
- package/dist/client/components/conditionWords.d.ts +10 -0
- package/dist/client/components/conditionWords.js +20 -0
- package/dist/client/components/dashboardModel.d.ts +8 -0
- package/dist/client/components/dashboardModel.js +28 -1
- package/dist/client/components/editInteraction.d.ts +1 -1
- package/dist/client/components/editInteraction.js +1 -1
- package/dist/client/components/gridSizing.d.ts +14 -20
- package/dist/client/components/gridSizing.js +147 -108
- package/dist/client/components/pageContext.d.ts +3 -2
- package/dist/client/components/pageModel.d.ts +2 -0
- package/dist/client/components/pickerStaleness.d.ts +11 -1
- package/dist/client/components/pickerStaleness.js +12 -2
- package/dist/client/components/rowTitle.d.ts +2 -0
- package/dist/client/components/rowTitle.js +10 -0
- package/dist/client/components/textMeasure.js +72 -3
- package/dist/client/components/useConditionWords.d.ts +5 -0
- package/dist/client/components/useConditionWords.js +3 -1
- package/dist/client/components/useGridKeyboard.js +5 -0
- package/dist/client/components/valueModel.d.ts +1 -0
- package/dist/client/components/valueModel.js +39 -4
- package/dist/client/composer.css +2 -2
- package/dist/client/copy/es.js +3 -3
- package/dist/client/copy/filters/components/ListFilterBar.d.ts +1 -0
- package/dist/client/copy/filters/components/ListFilterBar.js +1 -0
- package/dist/client/copy/forms/components/DateField.d.ts +2 -0
- package/dist/client/copy/forms/components/DateField.js +2 -0
- package/dist/client/copy/forms/components/NewRecord.d.ts +8 -0
- package/dist/client/copy/forms/components/NewRecord.js +2 -0
- package/dist/client/copy/lists/components/AppList.d.ts +2 -0
- package/dist/client/copy/lists/components/AppList.js +2 -0
- package/dist/client/copy/lists/components/GridSelection.d.ts +1 -0
- package/dist/client/copy/lists/components/GridSelection.js +1 -0
- package/dist/client/copy/lists/components/ListColumns.d.ts +5 -0
- package/dist/client/copy/lists/components/ListColumns.js +7 -0
- package/dist/client/copy/lists/components/TableRoom.d.ts +3 -1
- package/dist/client/copy/lists/components/TableRoom.js +3 -1
- package/dist/client/copy/record/components/PageHistory.d.ts +2 -2
- package/dist/client/copy/record/components/PageHistory.js +4 -2
- package/dist/client/copy/record/components/WorkflowStatus.d.ts +1 -0
- package/dist/client/copy/record/components/WorkflowStatus.js +1 -0
- package/dist/client/copy/shell/components/MobileNavDrawer.d.ts +1 -0
- package/dist/client/copy/shell/components/MobileNavDrawer.js +2 -0
- package/dist/client/customThemes.css +3 -3
- package/dist/client/dom.js +5 -5
- package/dist/client/features.css +216 -356
- package/dist/client/fonts/Manrope-OFL.txt +93 -0
- package/dist/client/fonts/faces.css +10 -1
- package/dist/client/fonts/manrope-latin.woff2 +0 -0
- package/dist/client/formControls.css +4 -4
- package/dist/client/help.css +2 -2
- package/dist/client/ledgerLook.css +28 -0
- package/dist/client/locale.d.ts +2 -10
- package/dist/client/locale.js +0 -0
- package/dist/client/lumenLook.css +295 -105
- package/dist/client/manropeFace.css +32 -0
- package/dist/client/messages.d.ts +3 -3
- package/dist/client/messages.js +3 -3
- package/dist/client/page.css +98 -354
- package/dist/client/palette.js +31 -6
- package/dist/client/partsLook.css +60 -60
- package/dist/client/sageLook.css +101 -32
- package/dist/client/shellHost.d.ts +2 -2
- package/dist/client/shellHost.js +2 -2
- package/dist/client/shellMode.d.ts +9 -0
- package/dist/client/shellMode.js +2 -0
- package/dist/client/structure.css +281 -201
- package/dist/client/style.css +75 -224
- package/dist/client/themeFamilies.css +471 -66
- package/dist/client/tilesLook.css +502 -0
- package/dist/client/visualTheme.js +5 -2
- package/dist/client/visualThemes.css +38 -34
- package/dist/client/workbenchLook.css +12 -12
- package/dist/client/workshopLook.css +3 -8
- package/dist/vite.d.ts +1 -20
- package/dist/vite.js +33 -3
- package/package.json +8 -7
|
@@ -7,7 +7,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
7
7
|
*/
|
|
8
8
|
import { PresentationSwitch } from './PresentationSwitch.js';
|
|
9
9
|
import { useContext, useMemo, useRef, useState } from 'react';
|
|
10
|
-
import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
10
|
+
import { keepPreviousData, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
11
11
|
import { ownedBy } from '../requestIdentity.js';
|
|
12
12
|
import { columnDisplay, columnLabel, recordLabel, api as coreApi, findTable, openRecord, rowLabel, state, writeAllowed } from '../core.js';
|
|
13
13
|
import { relatedRows } from '../prefs.js';
|
|
@@ -41,6 +41,7 @@ import { Loading, SectionBox } from './PageSectionBox.js';
|
|
|
41
41
|
import { ListEmpty } from './ListEmpty.js';
|
|
42
42
|
import { Empty } from './Notes.js';
|
|
43
43
|
import { RecordSummaries } from './RecordSummaries.js';
|
|
44
|
+
import { RowTitleContext } from './rowTitle.js';
|
|
44
45
|
import { canDelete } from '../delete.js';
|
|
45
46
|
import { updateAttempts } from '../updateAttempts.js';
|
|
46
47
|
import { shell } from '../shellMode.js';
|
|
@@ -77,30 +78,37 @@ function linkOf(bindings) {
|
|
|
77
78
|
* page's compose, so a composed page is answered at once. Kept beside the list badges' counts, so a write that
|
|
78
79
|
* refreshes those refreshes these.
|
|
79
80
|
*/
|
|
80
|
-
export function useRelatedCounts(sections, counting
|
|
81
|
+
export function useRelatedCounts(sections, counting,
|
|
82
|
+
/** One request to a list, where the server composed them so (a page an author wrote that stands its lists alone,
|
|
83
|
+
recordReads.ts): a strip the record's page tabs made of them asks as the lists alone would have. */
|
|
84
|
+
each = false) {
|
|
81
85
|
const api = usePageApi();
|
|
82
86
|
const { connection, preview } = useContext(PageRenderContext);
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
const schema = state.schema;
|
|
88
|
+
const bodies = counting && !preview && !shell().publicVisitor()
|
|
89
|
+
? (each ? sections.map((section) => [section]) : [sections]).flatMap((asked) => relatedCountsBody(schema, asked, counting.base, counting.recordKey) ?? [])
|
|
90
|
+
: [];
|
|
91
|
+
const answers = useQueries({
|
|
92
|
+
queries: bodies.map((body) => ({
|
|
93
|
+
queryKey: ['count', connection ?? state.activeConnection ?? '', 'related', body.items],
|
|
94
|
+
queryFn: async () => {
|
|
95
|
+
const data = (await api('/api/counts', body));
|
|
96
|
+
/* In the shape a list's badges keep theirs (AppList.tsx), under the same key, so either reads the other's. */
|
|
97
|
+
return new Map(body.items.map((question, i) => {
|
|
98
|
+
const result = data.results?.[i];
|
|
99
|
+
return [
|
|
100
|
+
question,
|
|
101
|
+
result && !result.errors?.length && typeof result.total === 'number'
|
|
102
|
+
? { total: result.total, capped: result.cappedTotal === true }
|
|
103
|
+
: null,
|
|
104
|
+
];
|
|
105
|
+
}));
|
|
106
|
+
},
|
|
107
|
+
staleTime: 0,
|
|
108
|
+
})),
|
|
109
|
+
});
|
|
110
|
+
const known = answers.flatMap((answer) => (answer.data ? [...answer.data] : []));
|
|
111
|
+
return known.length ? new Map(known) : undefined;
|
|
104
112
|
}
|
|
105
113
|
/**
|
|
106
114
|
* A related list's count, on its tab or beside its heading. It stands in room kept for it from the first paint
|
|
@@ -114,7 +122,7 @@ export function RelatedCount({ section, counting, counts, }) {
|
|
|
114
122
|
if (question === undefined)
|
|
115
123
|
return null;
|
|
116
124
|
const known = counts?.get(question);
|
|
117
|
-
return _jsx("span", { className: "tab-count", children: known && _jsx("span", { children: `${formatNumber(known.total)}${known.capped ? '+' : ''}` }) });
|
|
125
|
+
return (_jsx("span", { className: "tab-count", "aria-hidden": counting.seen || undefined, children: known && _jsx("span", { children: `${formatNumber(known.total)}${known.capped ? '+' : ''}` }) }));
|
|
118
126
|
}
|
|
119
127
|
/** Rows related to the root: the real list. */
|
|
120
128
|
export function ListSection(props) {
|
|
@@ -181,7 +189,7 @@ export function relatedDoor(section, base, recordKey, context) {
|
|
|
181
189
|
function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counted }) {
|
|
182
190
|
const api = usePageApi('related');
|
|
183
191
|
const { preview, isCurrent, openRelated, connection, recordName, onActionDone, actions: recordActions } = useContext(PageRenderContext);
|
|
184
|
-
const counting = counted ? { base, recordKey } : undefined;
|
|
192
|
+
const counting = counted ? { base, recordKey, ...(counted === 'seen' ? { seen: true } : {}) } : undefined;
|
|
185
193
|
const counts = useRelatedCounts(counted ? [section] : [], counting);
|
|
186
194
|
const queries = useQueryClient();
|
|
187
195
|
const [added, setAdded] = useState(false);
|
|
@@ -621,15 +629,20 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
|
|
|
621
629
|
const rowKey = recordViewKey(keyColumns, got.columns, row);
|
|
622
630
|
if (!rowKey)
|
|
623
631
|
return [];
|
|
632
|
+
/* A column that describes the picture for someone who cannot see it (`alt`, `alt_text`) is its alt and
|
|
633
|
+
never its caption: printed under the photo it told a sighted visitor what they were looking at. */
|
|
634
|
+
const described = (got.columns ?? []).find((column) => /^alt(_text)?$/i.test(column) && captions(column));
|
|
624
635
|
const words = (got.columns ?? [])
|
|
625
|
-
.filter((column) =>
|
|
636
|
+
.filter((column) => column !== described &&
|
|
637
|
+
![file.name, file.content, file.type, file.size, file.thumbnail].includes(column) &&
|
|
626
638
|
!keyColumns.some((key) => key.column === column) &&
|
|
627
639
|
!hidden.includes(column) &&
|
|
628
640
|
row[column] != null &&
|
|
629
641
|
row[column] !== '' &&
|
|
630
642
|
captions(column))
|
|
631
643
|
.map((column) => worded(column, row[column]) ?? String(row[column]));
|
|
632
|
-
const
|
|
644
|
+
const said = described ? row[described] : undefined;
|
|
645
|
+
const alt = said != null && said !== '' ? String(said) : (words[0] ?? String(row[file.name] ?? ''));
|
|
633
646
|
return [
|
|
634
647
|
{
|
|
635
648
|
id: JSON.stringify(rowKey),
|
|
@@ -727,12 +740,12 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
|
|
|
727
740
|
refreshLists();
|
|
728
741
|
onActionDone?.();
|
|
729
742
|
} }), table_] })) : (table_);
|
|
730
|
-
} })) : presented ? (presented.element) : custom && table && CustomList ? (cardRows.length ? (_jsx(CustomList, { table: table, rows: cardRows, spec: custom, interactive: !preview, label: section.title ?? spoken(table.name), page: { index: Math.floor(offset / Math.max(1, limit)), size: limit } })) : (_jsx(Empty, { className: "page-group-empty", text: nothingYet }))) : cards && table ? (cardRows.length ? (_jsx(CardsList, { table: table, rows: cardRows, spec: cards, label: section.title ?? spoken(table.name) })) : (_jsx(Empty, { className: "page-group-empty", text: nothingYet }))) : gallery ? (_jsxs(_Fragment, { children: [canCreate && (_jsx(AttachmentList, { items: [], empty: false, emptyText: "", upload: { label: create.label, maxBytes: file.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send } })), _jsx(Gallery, { items: gallery, label: section.title ?? say('photos'), emptyText: section.title ? say('common.noYet', { things: section.title.toLocaleLowerCase() }) : say('noPhotosYet') })] })) : file ? (_jsx(AttachmentList, { items: attachments, empty: authoredEmpty, emptyText: section.title ? say('common.noYet', { things: section.title.toLocaleLowerCase() }) : say('noFilesYet'), upload: canCreate ? { label: create.label, maxBytes: file.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send } : undefined })) : ((plainEmpty ?? (_jsxs("div", { className: summaries ? `responsive-results page-related-results show-${layout}` : undefined, children: [summaries && (_jsxs(_Fragment, { children: [_jsx(PresentationSwitch, { layout: layout, onChange: setLayout, label: say('common.listPresentation'), records: say('common.records'), table: say('common.table') }), _jsx(RecordSummaries, { table: table, data: { ...got, rows }, columns: got.columns.filter((name) => !hiddenColumns.has(name)), referenceLabels: labelColumns, parent: !section.similar && section.path && !section.path.includes('.') ? section.path : undefined, recordForRow: section.similar
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
743
|
+
} })) : presented ? (presented.element) : custom && table && CustomList ? (cardRows.length ? (_jsx(CustomList, { table: table, rows: cardRows, spec: custom, interactive: !preview, label: section.title ?? spoken(table.name), page: { index: Math.floor(offset / Math.max(1, limit)), size: limit } })) : (_jsx(Empty, { className: "page-group-empty", text: nothingYet }))) : cards && table ? (cardRows.length ? (_jsx(CardsList, { table: table, rows: cardRows, spec: cards, label: section.title ?? spoken(table.name) })) : (_jsx(Empty, { className: "page-group-empty", text: nothingYet }))) : gallery ? (_jsxs(_Fragment, { children: [canCreate && (_jsx(AttachmentList, { items: [], empty: false, emptyText: "", upload: { label: create.label, maxBytes: file.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send } })), _jsx(Gallery, { items: gallery, label: section.title ?? say('photos'), emptyText: section.title ? say('common.noYet', { things: section.title.toLocaleLowerCase() }) : say('noPhotosYet') })] })) : file ? (_jsx(AttachmentList, { items: attachments, empty: authoredEmpty, emptyText: section.title ? say('common.noYet', { things: section.title.toLocaleLowerCase() }) : say('noFilesYet'), upload: canCreate ? { label: create.label, maxBytes: file.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send } : undefined })) : ((plainEmpty ?? (_jsxs("div", { className: summaries ? `responsive-results page-related-results show-${layout}` : undefined, children: [summaries && (_jsxs(_Fragment, { children: [_jsx(PresentationSwitch, { layout: layout, onChange: setLayout, label: say('common.listPresentation'), records: say('common.records'), table: say('common.table') }), _jsx(RowTitleContext.Provider, { value: section.primary, children: _jsx(RecordSummaries, { table: table, data: { ...got, rows }, columns: got.columns.filter((name) => !hiddenColumns.has(name)), referenceLabels: labelColumns, parent: !section.similar && section.path && !section.path.includes('.') ? section.path : undefined, recordForRow: section.similar
|
|
744
|
+
? recordForRow
|
|
745
|
+
: (row) => {
|
|
746
|
+
const record = recordForRow(row);
|
|
747
|
+
return { ...record, label: withoutParent(record.label, recordName) };
|
|
748
|
+
} }) })] })), _jsx("div", { className: "result-table", children: ((grid) => rowVerbs ? (_jsxs(RowTrailHosts, { children: [_jsx(RowActions, { table: table, rows: gridRows, actions: rowVerbs, labelOf: (row) => recordForRow(row).label, onDone: () => {
|
|
736
749
|
refreshLists();
|
|
737
750
|
onActionDone?.();
|
|
738
751
|
} }), grid] })) : (grid))(_jsx(Grid, { table: table, sizing: section.sizing, data: { ...got, rows: gridRows, columns: [...(got.columns ?? columnsOf()), ...keyNames] }, hide: keyNames.length ? [...hidden, ...keyNames] : hidden, referenceLabels: labelColumns, totals: totals, totalsLabel: totalsLabel, interactive: false, virtual: false,
|
|
@@ -209,7 +209,7 @@ export function TabStrip({ tabs, name, entry, onTab, draw, scoped, eager = [], c
|
|
|
209
209
|
}, children: tab.label }, tab.key))) }), _jsx("div", { className: "page-tab-more", "data-fold-more": "", "data-folded": folded.size ? undefined : '', "aria-hidden": !folded.size || undefined, children: _jsx(DropMenu, { className: "page-tab-more-menu", triggerClassName: "page-tab", label: message('common.more'), popupClassName: "page-actions-popup", align: "end", children: tabs.map((tab, i) => folded.has(i) ? (_jsx(DropItem, { className: "page-actions-item", onClick: () => show(i), children: tab.label }, tab.key)) : null) }) })] }), _jsx("div", { className: "page-tabpanels", children: tabs.map((tab, i) => (_jsx("div", { className: "page-tabpanel", role: "tabpanel", id: `${id}-tabpanel-${i}`, "aria-labelledby": `${id}-tab-${i}`, tabIndex: i === active ? 0 : -1, hidden: i !== active, inert: i !== active, "aria-hidden": i !== active, children: drawn.has(i) ? draw(i) : null }, tab.key))) })] }));
|
|
210
210
|
}
|
|
211
211
|
/** A run of lists as tabs: the names across the top, one table under them, fetched when opened. */
|
|
212
|
-
function ListTabs({ items: run, plans, base, recordKey, entry, onTab, draw, scoped, counting, pages, }) {
|
|
212
|
+
function ListTabs({ items: run, plans, base, recordKey, entry, onTab, draw, scoped, counting, countEach, pages, }) {
|
|
213
213
|
useMessageLanguage();
|
|
214
214
|
const context = useContext(PageRenderContext);
|
|
215
215
|
/* A list stands in a strip as it stands outside one: its `when` unmet leaves it no tab, and one that hides while empty
|
|
@@ -240,7 +240,10 @@ function ListTabs({ items: run, plans, base, recordKey, entry, onTab, draw, scop
|
|
|
240
240
|
findTable(item.section.from ?? '')?.name ??
|
|
241
241
|
item.section.from ??
|
|
242
242
|
'');
|
|
243
|
-
|
|
243
|
+
/* Asked of the whole run, not of the tabs that stand now: a list that hides while empty comes and goes with its
|
|
244
|
+
rows, and the server composed one count for the run as it was written (recordReads.ts). A body that followed the
|
|
245
|
+
tabs was a second request the moment one arrived. */
|
|
246
|
+
const counts = useRelatedCounts(run.map((item) => item.section), counting, countEach);
|
|
244
247
|
const word = (item) => item.section.kind === 'history' && item.section.title === undefined
|
|
245
248
|
? historyWord()
|
|
246
249
|
: (item.section.title ?? spoken(findTable(item.section.from ?? '')?.name ?? item.section.from ?? ''));
|
|
@@ -373,7 +376,10 @@ export function Sections({ page, base, recordKey: key, plans, entry, onLabel, on
|
|
|
373
376
|
if (listTabs && autoTabs && listRuns.has(i) && (listRuns.get(i) ?? 0) >= (pageTabs.length ? 1 : 2)) {
|
|
374
377
|
if (!strip) {
|
|
375
378
|
strip = [];
|
|
376
|
-
laid.push(_jsx(ListTabs, { items: strip, plans: plans, base: base, recordKey: key, entry: entry, onTab: onTab, draw: draw, scoped: scoped, counting: inferred ? { base, recordKey: key } :
|
|
379
|
+
laid.push(_jsx(ListTabs, { items: strip, plans: plans, base: base, recordKey: key, entry: entry, onTab: onTab, draw: draw, scoped: scoped, counting: inferred ? { base, recordKey: key } : inAppPage() ? { base, recordKey: key, seen: true } : undefined,
|
|
380
|
+
/* A strip the record's page tabs made, on a page that did not ask for one: the server stood these
|
|
381
|
+
lists alone and composed a count to each (recordReads.ts), so each is asked as it was composed. */
|
|
382
|
+
countEach: !inferred && page.listTabs !== true, pages: grouped ? undefined : takePageTabs() }, `tabs-${i}`));
|
|
377
383
|
}
|
|
378
384
|
strip.push(item);
|
|
379
385
|
leave = null;
|
|
@@ -389,8 +395,15 @@ export function Sections({ page, base, recordKey: key, plans, entry, onLabel, on
|
|
|
389
395
|
return;
|
|
390
396
|
}
|
|
391
397
|
leave = null;
|
|
392
|
-
/* A related list alone
|
|
393
|
-
|
|
398
|
+
/* A related list alone says its count in its head, as it would on its tab: on an inferred page where it would
|
|
399
|
+
have been a tab, and on a page an author wrote wherever it stands ("Charges 7"). */
|
|
400
|
+
laid.push(draw(item, false, item.section.kind !== 'list'
|
|
401
|
+
? false
|
|
402
|
+
: inferred
|
|
403
|
+
? Boolean(listTabs && autoTabs && tabbed(item.section))
|
|
404
|
+
: inAppPage()
|
|
405
|
+
? 'seen'
|
|
406
|
+
: false));
|
|
394
407
|
});
|
|
395
408
|
return laid;
|
|
396
409
|
};
|
|
@@ -272,7 +272,7 @@ export function Palette({ prefill = '', onClose }) {
|
|
|
272
272
|
return (_jsx("div", { className: "palette-backdrop", onPointerDown: (e) => {
|
|
273
273
|
if (e.target === e.currentTarget)
|
|
274
274
|
onClose();
|
|
275
|
-
}, children: _jsxs("div", { className: `palette${inApp ? ' palette-grouped' : ''}`, role: "dialog", "aria-modal": "true", "aria-label": say('navigation.search'), children: [_jsx("input", { ref: input, type: "text", className: "palette-input", placeholder: shell().inApp() ? say('searchRecordsPagesAndCommands') : say('goToATable'), "aria-label": say('navigation.search'), autoComplete: "off", spellCheck: false, role: "combobox", "aria-autocomplete": "list", "aria-expanded": "true", "aria-controls": "palette-list", "aria-activedescendant": shown.length ? `palette-o${current}` : undefined, value: query, onChange: (e) => {
|
|
275
|
+
}, children: _jsxs("div", { className: `palette${inApp ? ' palette-grouped' : ''}`, role: "dialog", "aria-modal": "true", "aria-label": say('navigation.search'), children: [_jsx("span", { className: "palette-glyph", "aria-hidden": "true", children: _jsx(Icon, { name: "magnifying-glass", size: 16 }) }), _jsx("input", { ref: input, type: "text", className: "palette-input", placeholder: shell().inApp() ? say('searchRecordsPagesAndCommands') : say('goToATable'), "aria-label": say('navigation.search'), autoComplete: "off", spellCheck: false, role: "combobox", "aria-autocomplete": "list", "aria-expanded": "true", "aria-controls": "palette-list", "aria-activedescendant": shown.length ? `palette-o${current}` : undefined, value: query, onChange: (e) => {
|
|
276
276
|
setQuery(e.currentTarget.value);
|
|
277
277
|
setActive(0);
|
|
278
278
|
} }), _jsx("div", { ref: list, className: "palette-list", id: "palette-list", role: "listbox", "aria-label": say('navigation.search'), children: !shown.length
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/** Which of the rows to draw: a settings page groups them under its own headings; the dialog draws them all. */
|
|
2
|
+
type PrefsPart = 'language' | 'appearance' | 'lists';
|
|
3
|
+
/**
|
|
4
|
+
* The rows themselves, without a dialog round them: the dialog below draws every one, and an App's settings page
|
|
5
|
+
* (the App framework's SettingsRoom.tsx) draws each part under a heading of its own.
|
|
6
|
+
*/
|
|
7
|
+
export declare function PrefsRows({ part }: {
|
|
8
|
+
part?: PrefsPart;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
1
10
|
export declare function PrefsDialog({ onClose }: {
|
|
2
11
|
onClose: () => void;
|
|
3
12
|
}): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* Preferences: visual theme, color mode, density, typography, and list lengths. Each
|
|
4
4
|
* is a dropdown over a setting that already lives somewhere else; this
|
|
@@ -71,8 +71,12 @@ function LanguageRow({ language }) {
|
|
|
71
71
|
{ value: 'es', label: ownName('es') },
|
|
72
72
|
] }) }));
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
/**
|
|
75
|
+
* The rows themselves, without a dialog round them: the dialog below draws every one, and an App's settings page
|
|
76
|
+
* (the App framework's SettingsRoom.tsx) draws each part under a heading of its own.
|
|
77
|
+
*/
|
|
78
|
+
export function PrefsRows({ part }) {
|
|
79
|
+
const shows = (one) => part === undefined || part === one;
|
|
76
80
|
const language = useSyncExternalStore(subscribeMessages, messageLanguage, messageLanguage);
|
|
77
81
|
const related = useSyncExternalStore(subscribeRelatedRows, relatedRows);
|
|
78
82
|
/* The choices live in their stores; a pick writes there and this looks
|
|
@@ -95,27 +99,33 @@ export function PrefsDialog({ onClose }) {
|
|
|
95
99
|
const darkOnly = visualThemeScheme() === 'dark-only';
|
|
96
100
|
/* Which of a suite's Apps opens first is the App framework's (SuiteAppPreference.tsx), drawn through the shell's slot. */
|
|
97
101
|
const { SuitePreference } = shell().slots;
|
|
98
|
-
return (_jsxs(
|
|
102
|
+
return (_jsxs(_Fragment, { children: [shows('language') && SuitePreference && _jsx(SuitePreference, {}), shows('language') && _jsx(LanguageRow, { language: language }), shows('appearance') && visualThemesOffered() && (_jsx(Row, { label: message('preferences.visualTheme'), action: readerOverridesAppTheme() ? (_jsx("button", { type: "button", className: "prefs-reset", onClick: () => after(resetVisualTheme), children: message('preferences.resetTheme') })) : null, children: _jsx(Dropdown, { ariaLabel: message('preferences.visualTheme'), value: visualThemeChoice(), onChange: (v) => after(() => setVisualTheme(v)), items: visualThemeOptions().map((theme) => ({
|
|
99
103
|
...theme,
|
|
100
104
|
swatches: [...theme.swatches],
|
|
101
105
|
...(theme.value === appVisualTheme() ? { detail: message('preferences.appTheme') } : {}),
|
|
102
|
-
})) }) })), visualThemesOffered() && visualPaletteOptions().length > 1 && (_jsx(Row, { label: message('preferences.palette'), hint: message('preferences.paletteHint'), children: _jsx(Dropdown, { ariaLabel: message('preferences.palette'), value: visualPaletteChoice(), onChange: (v) => after(() => setVisualPalette(v)), items: visualPaletteOptions().map((palette) => ({ ...palette, swatches: [...palette.swatches] })) }) })), _jsx(Row, { label: message('preferences.colorMode'), hint: darkOnly ? message('preferences.colorModeDarkOnly') : undefined, children: _jsx(Dropdown, { ariaLabel: message('preferences.colorMode'), disabled: darkOnly, value: darkOnly ? 'dark' : themeChoice(), onChange: (v) => after(() => setTheme(v)), items: [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
})) }) })), shows('appearance') && visualThemesOffered() && visualPaletteOptions().length > 1 && (_jsx(Row, { label: message('preferences.palette'), hint: message('preferences.paletteHint'), children: _jsx(Dropdown, { ariaLabel: message('preferences.palette'), value: visualPaletteChoice(), onChange: (v) => after(() => setVisualPalette(v)), items: visualPaletteOptions().map((palette) => ({ ...palette, swatches: [...palette.swatches] })) }) })), shows('appearance') && (_jsxs(_Fragment, { children: [_jsx(Row, { label: message('preferences.colorMode'), hint: darkOnly ? message('preferences.colorModeDarkOnly') : undefined, children: _jsx(Dropdown, { ariaLabel: message('preferences.colorMode'), disabled: darkOnly, value: darkOnly ? 'dark' : themeChoice(), onChange: (v) => after(() => setTheme(v)), items: [
|
|
107
|
+
{ value: 'system', label: message('preferences.system') },
|
|
108
|
+
{ value: 'light', label: message('preferences.light') },
|
|
109
|
+
{ value: 'dark', label: message('preferences.dark') },
|
|
110
|
+
] }) }), _jsx(Row, { label: message('preferences.density'), children: _jsx(Dropdown, { ariaLabel: message('preferences.density'), value: densityChoice(), onChange: (v) => after(() => setDensity(v)), items: [
|
|
111
|
+
{ value: 'comfortable', label: message('preferences.comfortable'), detail: message('preferences.defaultHint') },
|
|
112
|
+
{ value: 'spacious', label: message('preferences.spacious'), detail: message('preferences.spaciousHint') },
|
|
113
|
+
{ value: 'compact', label: message('preferences.compact'), detail: message('preferences.compactHint') },
|
|
114
|
+
] }) }), _jsx(Row, { label: message('preferences.typography'), children: _jsx(Dropdown, { ariaLabel: message('preferences.typography'), value: typographyPreference(), onChange: (v) => after(() => setTypography(v)), items: [
|
|
115
|
+
{ value: 'default', label: message('preferences.appDefault') },
|
|
116
|
+
{ value: 'mono', label: message('preferences.mono'), detail: message('preferences.monoHint') },
|
|
117
|
+
{ value: 'sans', label: message('preferences.sans'), detail: message('preferences.sansHint') },
|
|
118
|
+
] }) })] })), shows('lists') && (_jsxs(_Fragment, { children: [_jsx(Row, { label: message('preferences.rowsPerList'), hint: message('preferences.rowsPerListHint'), children: _jsx(Dropdown, { ariaLabel: message('preferences.rowsPerList'), value: String(pageSize()), onChange: (v) => after(() => {
|
|
119
|
+
setPageSize(Number(v));
|
|
120
|
+
render();
|
|
121
|
+
}), items: PAGE_SIZES.map((n) => ({ value: String(n), label: String(n) })) }) }), _jsx(Row, { label: message('preferences.rowsPerRelatedList'), hint: message('preferences.rowsPerRelatedListHint'), children: _jsx(Dropdown, { ariaLabel: message('preferences.rowsPerRelatedList'), value: String(related), onChange: (v) => {
|
|
122
|
+
setRelatedRows(Number(v));
|
|
123
|
+
render();
|
|
124
|
+
}, items: RELATED_SIZES.map((n) => ({ value: String(n), label: String(n) })) }) })] }))] }));
|
|
125
|
+
}
|
|
126
|
+
export function PrefsDialog({ onClose }) {
|
|
127
|
+
const dialog = useRef(null);
|
|
128
|
+
/* The dialog's own words (its title, Close) follow the language as a row picks it. */
|
|
129
|
+
useSyncExternalStore(subscribeMessages, messageLanguage, messageLanguage);
|
|
130
|
+
return (_jsxs(Modal, { className: "prefs", ref: dialog, onClose: onClose, ariaLabel: message('preferences.title'), children: [_jsx("h2", { className: "prefs-title", children: message('preferences.title') }), _jsx(PrefsRows, {}), _jsx("div", { className: "prefs-foot", children: _jsx("button", { type: "button", className: "ghost", onClick: () => dialog.current?.close(), children: message('common.close') }) })] }));
|
|
121
131
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { personFacing } from '../audience.js';
|
|
2
3
|
/**
|
|
3
4
|
* How the same rows are read on a phone — as records or as the table — as a
|
|
4
5
|
* two-icon segmented control at the row's end, not a second row of tabs
|
|
@@ -6,5 +7,8 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
6
7
|
* underline for underline). The names stay on the buttons for a screen reader.
|
|
7
8
|
*/
|
|
8
9
|
export function PresentationSwitch({ layout, onChange, label, records, table, }) {
|
|
10
|
+
/* How the rows are read is the office's choice: the App's own public is given the records (audience.ts). */
|
|
11
|
+
if (personFacing())
|
|
12
|
+
return null;
|
|
9
13
|
return (_jsx("div", { className: "record-presentation", role: "group", "aria-label": label, children: ['records', 'table'].map((mode) => (_jsx("button", { type: "button", className: "presentation-seg", "aria-pressed": layout === mode, "aria-label": mode === 'records' ? records : table, title: mode === 'records' ? records : table, onClick: () => onChange(mode), children: _jsx("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.4", children: mode === 'records' ? (_jsx("path", { d: "M2 4h12M2 8h12M2 12h12" })) : (_jsxs(_Fragment, { children: [_jsx("rect", { x: "2", y: "3", width: "12", height: "10", rx: "1" }), _jsx("path", { d: "M2 7h12M6.5 3v10" })] })) }) }, mode))) }));
|
|
10
14
|
}
|
|
@@ -42,11 +42,11 @@ export function PromptDialog({ title, label, value = '', hint, confirmLabel = sa
|
|
|
42
42
|
submit();
|
|
43
43
|
}, children: [_jsx("h2", { children: title }), _jsx(Field, { label: label, id: fieldId, children: multiline ? (_jsx("textarea", { ref: (node) => {
|
|
44
44
|
input.current = node;
|
|
45
|
-
}, className: "
|
|
45
|
+
}, "data-slot": "textarea", className: "prompt-multiline", rows: 10, defaultValue: value, placeholder: placeholder ?? '' })) : dateOnly || dateTime ? (_jsx(DateField, { id: fieldId, inputRef: (node) => {
|
|
46
46
|
input.current = node;
|
|
47
|
-
}, value: date, onChange: setDate, withTime: dateTime,
|
|
47
|
+
}, value: date, onChange: setDate, withTime: dateTime, "aria-label": label, placeholder: dateTime ? undefined : placeholder, locale: formatLocale(), timezone: formatTimezone(), now: appNow() })) : (_jsx("input", { ref: (node) => {
|
|
48
48
|
input.current = node;
|
|
49
|
-
}, type: type,
|
|
49
|
+
}, type: type, "data-slot": "input", defaultValue: value, placeholder: placeholder ?? '' })) }), hint ? _jsx("p", { className: "confirm-params", children: hint }) : null, _jsxs("div", { className: "confirm-actions", children: [_jsx(Button, { intent: "secondary", onClick: () => {
|
|
50
50
|
finish(null);
|
|
51
51
|
dialog.current?.close();
|
|
52
52
|
}, children: say('common.cancel') }), _jsx(Button, { intent: "primary", type: "submit", children: confirmLabel })] })] }) }));
|
|
@@ -88,7 +88,7 @@ export function RangeDialog({ title, fromLabel, toLabel, hint, type = 'text', pl
|
|
|
88
88
|
return (_jsx(Modal, { className: "confirm", ref: dialog, onClose: () => finish(null), initialFocus: from, children: _jsxs("form", { onSubmit: (e) => {
|
|
89
89
|
e.preventDefault();
|
|
90
90
|
submit();
|
|
91
|
-
}, children: [_jsx("h2", { children: title }), _jsxs("div", { className: "confirm-fields", children: [_jsx(Field, { label: fromLabel, id: `${fieldId}-from`, children: calendar ? (_jsx(DateField, { id: `${fieldId}-from`, inputRef: from, value: fromDate, onChange: setFromDate,
|
|
91
|
+
}, children: [_jsx("h2", { children: title }), _jsxs("div", { className: "confirm-fields", children: [_jsx(Field, { label: fromLabel, id: `${fieldId}-from`, children: calendar ? (_jsx(DateField, { id: `${fieldId}-from`, inputRef: from, value: fromDate, onChange: setFromDate, withTime: type === 'datetime-local', "aria-label": fromLabel, placeholder: type === 'date' ? placeholder : undefined, locale: formatLocale(), timezone: formatTimezone(), now: appNow() })) : (_jsx("input", { ref: from, type: type, "data-slot": "input", placeholder: placeholder ?? '' })) }), _jsx(Field, { label: toLabel, id: `${fieldId}-to`, children: calendar ? (_jsx(DateField, { id: `${fieldId}-to`, inputRef: to, value: toDate, onChange: setToDate, withTime: type === 'datetime-local', "aria-label": toLabel, placeholder: type === 'date' ? placeholder : undefined, locale: formatLocale(), timezone: formatTimezone(), now: appNow() })) : (_jsx("input", { ref: to, type: type, "data-slot": "input", placeholder: placeholder ?? '' })) })] }), hint ? _jsx("p", { className: "confirm-params", children: hint }) : null, _jsxs("div", { className: "confirm-actions", children: [_jsx(Button, { intent: "secondary", onClick: () => {
|
|
92
92
|
finish(null);
|
|
93
93
|
dialog.current?.close();
|
|
94
94
|
}, children: say('common.cancel') }), _jsx(Button, { intent: "primary", type: "submit", children: say('common.apply') })] })] }) }));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* A record that is gone — deleted under an open page, or a link to one that
|
|
4
|
-
* never was — said once in plain words, with the way back to its list.
|
|
5
|
-
*
|
|
6
|
-
* names no key: "1 names nothing" read like a bug to the person who followed
|
|
4
|
+
* never was — said once in plain words, with the way back to its list. It is
|
|
5
|
+
* all the page has to say, so the block stands in the page's middle (the empty
|
|
6
|
+
* block's `room`, Notes.tsx), and names no key: "1 names nothing" read like a bug to the person who followed
|
|
7
7
|
* the link. The caller says the table's name as its page does (`spoken` in
|
|
8
8
|
* pageContext.ts): this module imports nothing of the page around it, so the
|
|
9
9
|
* page may import it without a cycle.
|
|
@@ -18,5 +18,5 @@ export const recordNotFound = (spoken) => {
|
|
|
18
18
|
};
|
|
19
19
|
export function RecordGone({ base, spoken, className }) {
|
|
20
20
|
const name = spoken.toLowerCase();
|
|
21
|
-
return (_jsx(Empty, { className: className, text: say('common.thatIsNoLonger', { spoken: name }), action: _jsx(Button, { intent: "secondary", onClick: () => go(tableView(base.id), 'push'), children: say('backToTheList', { spoken: name }) }) }));
|
|
21
|
+
return (_jsx(Empty, { room: true, className: className, text: say('common.thatIsNoLonger', { spoken: name }), action: _jsx(Button, { intent: "secondary", onClick: () => go(tableView(base.id), 'push'), children: say('backToTheList', { spoken: name }) }) }));
|
|
22
22
|
}
|
|
@@ -28,6 +28,23 @@ import { resourceOf } from './appRooms.js';
|
|
|
28
28
|
import { collidingNames, referenceSubline, sublineText } from '@mistriwork/engine/shared/referenceSubline.js';
|
|
29
29
|
import { sessionIdentity, subscribeSessionIdentity } from '../sessionIdentity.js';
|
|
30
30
|
import { say } from '../copy/forms/components/RecordPicker.js';
|
|
31
|
+
/**
|
|
32
|
+
* An option's name with what was typed picked out of it, so a reader running down a long list sees why each row is
|
|
33
|
+
* there. The first place the letters stand together, whatever their case; a name that matched some other way (by its
|
|
34
|
+
* key, by a word the server folded) is drawn as it is. The mark is a weight, not a colour: the lit row already has
|
|
35
|
+
* the accent's. A span and not a `mark`: the option's name is still its words, read in one piece, where a mark is
|
|
36
|
+
* announced as a highlight inside every option.
|
|
37
|
+
*/
|
|
38
|
+
/* Said on the span itself: a name is computed from what is drawn in line as one run of words, and a reader of the
|
|
39
|
+
tree that knows no stylesheet (the component tests' DOM) takes a bare span for a block and hears "La unch". */
|
|
40
|
+
const IN_LINE = { display: 'inline' };
|
|
41
|
+
function typedIn(label, typed) {
|
|
42
|
+
const wanted = typed.trim();
|
|
43
|
+
const at = wanted ? label.toLocaleLowerCase().indexOf(wanted.toLocaleLowerCase()) : -1;
|
|
44
|
+
if (at < 0)
|
|
45
|
+
return label;
|
|
46
|
+
return (_jsxs(_Fragment, { children: [label.slice(0, at), _jsx("span", { className: "picker-match", style: IN_LINE, children: label.slice(at, at + wanted.length) }), label.slice(at + wanted.length)] }));
|
|
47
|
+
}
|
|
31
48
|
const LIMIT = 20;
|
|
32
49
|
/** The second line a table's choices are read with, by the rule every reference shares, with the App's display rule. */
|
|
33
50
|
function sublineFor(table) {
|
|
@@ -177,13 +194,19 @@ function RecordPickerControl(props) {
|
|
|
177
194
|
});
|
|
178
195
|
/* A list still answering earlier text offers only the rows the box's text
|
|
179
196
|
also names — its lit first row is otherwise a record nobody named. */
|
|
197
|
+
/* What was last offered for this value, so a list is not taken away while an answer for other text is on screen
|
|
198
|
+
(pickerStaleness.ts). Kept beside the value it was offered for: another record's choices are not this one's. */
|
|
199
|
+
const lastOffered = useRef({ for: signature, rows: [] });
|
|
180
200
|
const { choices: options, answered } = offeredChoices({
|
|
181
201
|
typed: typedSearch,
|
|
182
202
|
asked,
|
|
183
203
|
placeholder: results.isPlaceholderData,
|
|
184
204
|
rows: results.data,
|
|
185
205
|
label: (o) => o.label,
|
|
206
|
+
last: lastOffered.current.for === signature ? lastOffered.current.rows : undefined,
|
|
186
207
|
});
|
|
208
|
+
if (options.length || lastOffered.current.for !== signature)
|
|
209
|
+
lastOffered.current = { for: signature, rows: options };
|
|
187
210
|
const selected = useQuery({
|
|
188
211
|
queryKey: ['picker-labels', connection, table.id, valueColumn, ids, props.scope, labelPath(table), recordLabel(table), subline?.path],
|
|
189
212
|
enabled: Boolean(valueColumn && ids.length),
|
|
@@ -295,7 +318,7 @@ function RecordPickerControl(props) {
|
|
|
295
318
|
setOpen(true);
|
|
296
319
|
if (!editing && !props.multiple && ids.length)
|
|
297
320
|
report([]);
|
|
298
|
-
}, open: open, onOpenChange: setOpen, items: options, itemKey: (o) => o.value, itemLabel: (o) => o.label, itemClassName: (o, highlighted) => `picker-option${highlighted ? ' active' : ''}${ids.includes(o.value) ? ' chosen' : ''}`, renderItem: (o) => props.face && o.row ? (props.face.draw(o.row, o.label, options.flatMap((each) => (each.row ? [each.row] : [])))) : (_jsxs(_Fragment, { children: [subOf(o) ? (_jsxs("span", { className: "picker-option-name", children: [_jsx("span", { className: "picker-option-label", children: o.label }), _jsx("span", { className: "picker-option-sub", children: subOf(o) })] })) : (_jsx("span", { className: "picker-option-label", children: o.label })), !props.hideKey && o.label !== o.value && _jsx("span", { className: "picker-option-detail", children: o.value })] })), onPick: pick, inputRef: setInput, popupRef: editing?.popupRef, anchorRef: wrap, fit: "width", inputProps: {
|
|
321
|
+
}, open: open, onOpenChange: setOpen, items: options, itemKey: (o) => o.value, itemLabel: (o) => o.label, itemClassName: (o, highlighted) => `picker-option${highlighted ? ' active' : ''}${ids.includes(o.value) ? ' chosen' : ''}`, renderItem: (o) => props.face && o.row ? (props.face.draw(o.row, o.label, options.flatMap((each) => (each.row ? [each.row] : [])))) : (_jsxs(_Fragment, { children: [subOf(o) ? (_jsxs("span", { className: "picker-option-name", children: [_jsx("span", { className: "picker-option-label", children: typedIn(o.label, typedSearch) }), _jsx("span", { className: "picker-option-sub", children: subOf(o) })] })) : (_jsx("span", { className: "picker-option-label", children: typedIn(o.label, typedSearch) })), !props.hideKey && o.label !== o.value && _jsx("span", { className: "picker-option-detail", children: o.value })] })), onPick: pick, inputRef: setInput, popupRef: editing?.popupRef, anchorRef: wrap, fit: "width", inputProps: {
|
|
299
322
|
type: 'text',
|
|
300
323
|
className: 'picker-input',
|
|
301
324
|
'aria-label': ariaLabel ?? say('choose', { name: humanName(table.name) }),
|
|
@@ -313,11 +336,6 @@ function RecordPickerControl(props) {
|
|
|
313
336
|
...(props.describedBy ? { 'aria-describedby': props.describedBy } : {}),
|
|
314
337
|
/* Backspace on an empty box takes the last chip off. */
|
|
315
338
|
onKeyDown: (e) => {
|
|
316
|
-
// Base UI clears text on closed-popup Escape. Let the editor receive
|
|
317
|
-
// that key without manufacturing a new search or selection first.
|
|
318
|
-
if (editing && e.key === 'Escape') {
|
|
319
|
-
e.preventBaseUIHandler?.();
|
|
320
|
-
}
|
|
321
339
|
if (e.key === 'Backspace' && props.multiple && !text && ids.length)
|
|
322
340
|
report(ids.slice(0, -1));
|
|
323
341
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* A list read as summaries: a title and up to four facts a row, the dress a narrow screen and a related list wear in
|
|
4
4
|
* place of the grid. This module owns which columns say what: the facts a question already fixes are left out
|
|
@@ -7,14 +7,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
*/
|
|
8
8
|
import { Fragment } from 'react';
|
|
9
9
|
import { useMessageLanguage } from './useMessageLanguage.js';
|
|
10
|
-
import { columnLabel, keyOf, labelPath, openRecord, recordLabel, rowLabel, state } from '../core.js';
|
|
10
|
+
import { columnDisplay, columnLabel, keyOf, labelPath, openRecord, recordLabel, rowLabel, state } from '../core.js';
|
|
11
11
|
import { opensRecord } from '../recordIntent.js';
|
|
12
12
|
import { humanName } from '@mistriwork/engine/shared/model.js';
|
|
13
13
|
import { isLabelTemplate, parseLabelTemplate } from '@mistriwork/engine/shared/recordLabel.js';
|
|
14
|
-
import { primaryKey } from '@mistriwork/engine/shared/schema.js';
|
|
14
|
+
import { columnKind, primaryKey } from '@mistriwork/engine/shared/schema.js';
|
|
15
15
|
import { TAGS_TYPE, tagChips } from '@mistriwork/engine/shared/tagLists.js';
|
|
16
|
-
import { Value } from './Value.js';
|
|
16
|
+
import { AvatarText, Value } from './Value.js';
|
|
17
|
+
import { dressFor } from './valueModel.js';
|
|
17
18
|
import { rowOpensTarget, useRowOpens } from './rowOpens.js';
|
|
19
|
+
import { useRowTitle } from './rowTitle.js';
|
|
18
20
|
import { presentationColumns } from './columnPresentation.js';
|
|
19
21
|
import { splitConditions, splitQuery } from '../clauses.js';
|
|
20
22
|
import { say } from '../copy/record/components/RecordSummaries.js';
|
|
@@ -124,7 +126,16 @@ export function RecordSummaries({ table, data, columns, labels, referenceLabels,
|
|
|
124
126
|
useMessageLanguage();
|
|
125
127
|
const fixed = fixedColumns(query);
|
|
126
128
|
const linkTitle = linkTitleColumn(table, columns, [...fixed, ...(parent ? [parent] : [])], referenceLabels);
|
|
129
|
+
/* The list's own title for a row (`primary`, rowTitle.ts) comes before the record's name: said as the column is
|
|
130
|
+
shown, so a reference is the record it names. An empty one falls back, so no row is left without a name. */
|
|
131
|
+
const primary = useRowTitle();
|
|
132
|
+
const titled = primary && columns.includes(primary) ? primary : undefined;
|
|
127
133
|
const linked = (row) => {
|
|
134
|
+
if (titled) {
|
|
135
|
+
const own = shownValue(row, titled, referenceLabels);
|
|
136
|
+
if (own !== '')
|
|
137
|
+
return own;
|
|
138
|
+
}
|
|
128
139
|
const value = linkTitle ? (referenceLabels?.[linkTitle] ? row[referenceLabels[linkTitle]] : row[linkTitle]) : undefined;
|
|
129
140
|
return value == null || String(value) === '' ? undefined : String(value);
|
|
130
141
|
};
|
|
@@ -184,7 +195,22 @@ export function RecordSummaries({ table, data, columns, labels, referenceLabels,
|
|
|
184
195
|
alone would say nothing. What the host draws in its place (`adornFact`) is something, and stays. */
|
|
185
196
|
const empty = adorned === undefined &&
|
|
186
197
|
(value === null || value === undefined || value === '' || (col.type === TAGS_TYPE && !tagChips(value).length));
|
|
187
|
-
|
|
198
|
+
/* A date, a count or a disc of initials says nothing of what it is: two dates on a row read "reported?
|
|
199
|
+
visit?", and "SW" read "who?" (a cold review on a phone). Those keep their caption where the App's
|
|
200
|
+
row drops the rest (style.css); a status, a name and money say themselves. */
|
|
201
|
+
const rule = columnDisplay(table.id, name);
|
|
202
|
+
const kind = label == null ? columnKind(col.type) : 'text';
|
|
203
|
+
const bare = kind === 'date' ||
|
|
204
|
+
(kind === 'number' && rule?.format !== 'money' && rule?.format !== 'percent') ||
|
|
205
|
+
rule?.format === 'avatars' ||
|
|
206
|
+
Boolean(rule?.avatar);
|
|
207
|
+
const stack = rule?.format === 'avatars' && !empty ? dressFor(rule, value) : null;
|
|
208
|
+
const people = stack?.kind === 'avatars' && !stack.more ? stack.names : null;
|
|
209
|
+
return (_jsxs("div", { "data-empty": empty ? '' : undefined, "data-captioned": bare ? '' : undefined, children: [_jsx("dt", { children: labels?.[name] ?? columnLabel(table.id, name) ?? humanName(name) }), _jsx("dd", { children: adorned ??
|
|
210
|
+
(people ? (
|
|
211
|
+
/* One person is their disc and their name; several, the discs and then the names: on a row
|
|
212
|
+
read down a phone a disc alone asked "who?" (a cold review). */
|
|
213
|
+
people.length === 1 ? (_jsx(AvatarText, { text: people[0] })) : (_jsxs(_Fragment, { children: [_jsx(Value, { tableId: table.id, col: col, value: value, compact: true }), ' ', _jsx("span", { className: "avatar-text", children: people.join(', ') })] }))) : (_jsx(Value, { tableId: table.id, col: label == null ? col : { ...col, type: 'TEXT' }, value: value, compact: true }))) })] }, name));
|
|
188
214
|
}) })] }, key ? JSON.stringify(key) : index));
|
|
189
215
|
if (!head)
|
|
190
216
|
return summary;
|
|
@@ -22,6 +22,7 @@ import { canStep, stepTrail, stepWithin, trailPosition } from '../recordTrail.js
|
|
|
22
22
|
import { say } from '../copy/record/components/RecordTrailNav.js';
|
|
23
23
|
import { Icon } from './Icon.js';
|
|
24
24
|
import { addHostListener, removeHostListener } from '../shellHost.js';
|
|
25
|
+
import { personFacing } from '../audience.js';
|
|
25
26
|
/** One page of the list's own question, as the records a step can land on. */
|
|
26
27
|
const readPage = async (tableId, list, offset) => {
|
|
27
28
|
const table = findTable(tableId);
|
|
@@ -71,6 +72,9 @@ export function useTrailStep(trail, land, stillHere) {
|
|
|
71
72
|
/** "3 of 20" between Previous and Next — or "3" where the list has no total. */
|
|
72
73
|
export function TrailSteps({ trail, reading, onStep, onPointerDown, }) {
|
|
73
74
|
const { at, of } = trailPosition(trail);
|
|
75
|
+
/* "10 of 80" is a place in the office's list; a visitor opened one thing (audience.ts). */
|
|
76
|
+
if (personFacing())
|
|
77
|
+
return null;
|
|
74
78
|
return (_jsx("nav", { className: "record-trail", "aria-label": say('recordsInThisList'), "aria-busy": reading || undefined, children: _jsxs("span", { className: "step-control", children: [_jsx("button", { type: "button", className: "step-button record-trail-step", "aria-label": say('previousRecord'), title: say('previousRecordK'), "aria-keyshortcuts": "K", disabled: !canStep(trail, -1), onPointerDown: onPointerDown, onClick: () => onStep(-1), children: _jsx(Icon, { name: "caret-left", size: 16 }) }), _jsx("span", { className: "step-position record-trail-at", "aria-live": "polite", children: of === undefined ? `${at}` : say('atOfOf', { at, of }) }), _jsx("button", { type: "button", className: "step-button record-trail-step", "aria-label": say('nextRecord'), title: say('nextRecordJ'), "aria-keyshortcuts": "J", disabled: !canStep(trail, 1), onPointerDown: onPointerDown, onClick: () => onStep(1), children: _jsx(Icon, { name: "caret-right", size: 16 }) })] }) }));
|
|
75
79
|
}
|
|
76
80
|
/** A key the page's single-letter shortcuts must not take: typing, a dialog over the page, or a modifier. */
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
outline: var(--focus-width) solid var(--focus);
|
|
17
17
|
outline-offset: -1px;
|
|
18
18
|
}
|
|
19
|
-
.rich-editor
|
|
19
|
+
.rich-editor[data-invalid] {
|
|
20
20
|
border-color: var(--status-critical);
|
|
21
21
|
}
|
|
22
22
|
.rich-editor.is-disabled {
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
padding: var(--space-2h) var(--space-3);
|
|
104
104
|
border-bottom: 1px solid var(--line);
|
|
105
105
|
}
|
|
106
|
-
.rich-link-bar
|
|
106
|
+
.rich-link-bar :is([data-slot='input'], [data-slot='textarea']) {
|
|
107
107
|
flex: 1 1 14rem;
|
|
108
108
|
min-height: 28px;
|
|
109
109
|
padding: var(--space-1h) var(--space-3);
|