@mistriwork/kit 1.0.0-rc.58 → 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
|
@@ -19,6 +19,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
19
19
|
* the workbench's dialog and the app's drawer over the list, one form
|
|
20
20
|
* wearing either.
|
|
21
21
|
*/
|
|
22
|
+
import { personFacing } from '../audience.js';
|
|
22
23
|
import { useMessageLanguage } from './useMessageLanguage.js';
|
|
23
24
|
import { MultiStepForm } from './MultiStepForm.js';
|
|
24
25
|
import { Columns } from '@mistriwork/ui/FormParts.js';
|
|
@@ -211,6 +212,16 @@ function NewRecordFormBody({ table, form, app, label: columnLabel, target, inser
|
|
|
211
212
|
const errorPrefix = useId();
|
|
212
213
|
const [validationAttempt, setValidationAttempt] = useState();
|
|
213
214
|
const tried = validationAttempt !== undefined;
|
|
215
|
+
/* What is wrong with an answer once the form has been tried, in the words its field says under it: the summary at
|
|
216
|
+
the form's head says the same line, so the two can never differ. */
|
|
217
|
+
const answerProblem = (column, value, values) => {
|
|
218
|
+
const kind = kindOf(column);
|
|
219
|
+
if (missingFields([column], insertValues({ [column.name]: value }, defaults, edited.current, table.columns), assigned).length > 0)
|
|
220
|
+
return say('fill', { column: label(column) });
|
|
221
|
+
if (invalidDate(column, value, kind))
|
|
222
|
+
return kind === 'datetime' ? say('enterAValidDate') : say('enterAValidDateInYyyy');
|
|
223
|
+
return amountProblem(column, values) || '';
|
|
224
|
+
};
|
|
214
225
|
const [clearedServerFields, setClearedServerFields] = useState(new Set());
|
|
215
226
|
const [dirty, setDirty] = useState(false);
|
|
216
227
|
const controls = useRef(new Map());
|
|
@@ -367,106 +378,111 @@ function NewRecordFormBody({ table, form, app, label: columnLabel, target, inser
|
|
|
367
378
|
/* The groups, laid out; within a step, only the fields that step owns. */
|
|
368
379
|
const fieldsFor = (only, rows) => (_jsx(f.Subscribe, { selector: (state) => state.values, children: (values) => {
|
|
369
380
|
const visibilityValues = visibilityOf(values);
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
for (const dependent of dependents(column.name)) {
|
|
436
|
-
const held = f.getFieldValue(dependent.name);
|
|
437
|
-
if (!held)
|
|
438
|
-
continue;
|
|
439
|
-
const drop = () => {
|
|
440
|
-
if (f.getFieldValue(dependent.name) !== held)
|
|
441
|
-
return;
|
|
442
|
-
edited.current.add(dependent.name);
|
|
443
|
-
f.setFieldValue(dependent.name, '');
|
|
444
|
-
setDirty(hasFormChanges(columns, f.state.values, defaults, edited.current));
|
|
445
|
-
};
|
|
446
|
-
const remote = Object.entries(whereOf(dependent) ?? {}).find(([, local]) => local === column.name)?.[0];
|
|
447
|
-
if (value === '' || value === null || value === undefined || !remote) {
|
|
448
|
-
drop();
|
|
449
|
-
continue;
|
|
381
|
+
/* After a submit that was refused here, two or more wrong answers are said together at the form's head, each
|
|
382
|
+
line a press from its field (one is said under its field alone, where the focus lands): a long form's fourth problem is under the fold, and a reader told only "Fill in Rent" under
|
|
383
|
+
the first does not know there are three more. The line under each field is still the one a screen reader
|
|
384
|
+
is told (it describes the field the focus lands on), so this is a list to see and step through and no
|
|
385
|
+
live region: said twice, a problem is two problems. It shortens as answers are put right. An App's form
|
|
386
|
+
only: the Workbench's dialog is the schema's, a column of boxes read at a glance. */
|
|
387
|
+
const problems = app && tried
|
|
388
|
+
? columns
|
|
389
|
+
.filter((column) => (!only || only.has(column.name)) && isFormFieldVisible(form, column, visibilityValues, table))
|
|
390
|
+
.flatMap((column) => {
|
|
391
|
+
const value = values[column.name] ?? '';
|
|
392
|
+
const rule = textRule(column);
|
|
393
|
+
const message = answerProblem(column, value, values) || (rule && textRuleMessage(rule, value)) || '';
|
|
394
|
+
return message ? [{ name: column.name, label: label(column), message }] : [];
|
|
395
|
+
})
|
|
396
|
+
: [];
|
|
397
|
+
return (_jsxs(_Fragment, { children: [problems.length > 1 && (_jsxs("div", { className: "form-problems", "data-slot": "form-problems", children: [_jsx("p", { children: say(personFacing() ? 'answersNeedALook' : 'fieldsNeedFixing', { count: problems.length }) }), _jsx("ul", { children: problems.map((problem) => (_jsxs("li", { children: [_jsx("button", { type: "button", onClick: () => controls.current.get(problem.name)?.focus(), children: problem.label }), `: ${problem.message}`] }, problem.name))) })] })), groups.map((group, groupIndex) => {
|
|
398
|
+
const fields = group.columns.filter((column) => (!only || only.has(column.name)) && isFormFieldVisible(form, column, visibilityValues, table));
|
|
399
|
+
if (!fields.length)
|
|
400
|
+
return null;
|
|
401
|
+
const body = fields.map((column) => {
|
|
402
|
+
const index = columns.indexOf(column);
|
|
403
|
+
const kind = kindOf(column);
|
|
404
|
+
const own = dress(column);
|
|
405
|
+
/* A narrowed picker offers nothing until the fields it reads are filled, and says which. */
|
|
406
|
+
/* It reads the draft, and the values the form fills without asking (a bound parent key, a default). */
|
|
407
|
+
const where = whereOf(column);
|
|
408
|
+
const narrowed = where && kind === 'reference' ? narrowingCondition(where, { ...defaults, ...values }) : '';
|
|
409
|
+
const waitingOn = narrowed === undefined
|
|
410
|
+
? Object.values(where)
|
|
411
|
+
.map((name) => table.columns.find((c) => c.name === name))
|
|
412
|
+
.filter((c) => Boolean(c))
|
|
413
|
+
.map(label)
|
|
414
|
+
.join(' and ')
|
|
415
|
+
: '';
|
|
416
|
+
/* A row-defined column is its fields, for the definitions the chosen `per` picks (DefinedFields.tsx). */
|
|
417
|
+
const binding = app ? resourceOf(shell().app(), table.id)?.defined?.[column.name] : undefined;
|
|
418
|
+
if (binding)
|
|
419
|
+
return (_jsx(f.Field, { name: column.name, children: (field) => (_jsx(DefinedInputs, { column: column.name, binding: binding, per: binding.per ? { ...defaults, ...values }[binding.per] : undefined, value: field.state.value, errors: submission.fieldErrors, Control: PlatformControl, onChange: (text) => {
|
|
420
|
+
edited.current.add(column.name);
|
|
421
|
+
field.handleChange(text);
|
|
422
|
+
setDirty(hasFormChanges(columns, f.state.values, defaults, edited.current));
|
|
423
|
+
} })) }, column.name));
|
|
424
|
+
return (_jsx(f.Field, { name: column.name, children: (field) => {
|
|
425
|
+
const serverError = submission.fieldErrors.find((error) => error.field === column.name);
|
|
426
|
+
const fieldMessage = (tried && answerProblem(column, field.state.value, values)) ||
|
|
427
|
+
(textRule(column) && typeof field.state.value === 'string' && textRuleMessage(textRule(column), field.state.value)
|
|
428
|
+
? textRuleMessage(textRule(column), field.state.value)
|
|
429
|
+
: serverError && !clearedServerFields.has(column.name)
|
|
430
|
+
? serverError.message
|
|
431
|
+
: '');
|
|
432
|
+
const errorId = `${errorPrefix}-${index}-error`;
|
|
433
|
+
const help = [own?.help, waitingOn ? say('chooseFirst', { waitingOn }) : ''].filter(Boolean).join(' ') || undefined;
|
|
434
|
+
const helpId = help ? `${errorPrefix}-${index}-help` : undefined;
|
|
435
|
+
return (_jsxs("div", { "data-slot": app ? 'field' : undefined, "data-answer": app && (kind === 'number' || kind === 'money' || kind === 'date' || kind === 'datetime') ? kind : undefined, "data-invalid": app && fieldMessage ? '' : undefined, className: `insert-field${fieldMessage ? ' missing' : ''}`, children: [app ? (_jsxs("div", { "data-slot": "field-head", children: [_jsx("label", { "data-slot": "field-label", children: label(column) }), !required(column) && (_jsxs(_Fragment, { children: [' ', _jsx("span", { "data-slot": "field-optional", children: say('optionalWord') })] }))] })) : (_jsxs("label", { children: [label(column), _jsx("span", { className: "type", children: column.type.toLowerCase() }), column.primaryKey && _jsx("span", { className: "pk", children: say('common.key') }), required(column) && (_jsx("span", { className: "req", title: say('notNullWithNoDefault'), children: say('requiredMark') }))] })), _jsx(Control, { column: column, app: app, input: app ? columnInput(table.id, column.name) : undefined, resource: table.id, required: required(column), assigned: assigned, spoken: label(column), target: target, value: field.state.value, kind: kind, rule: app ? ruleIn(column, { ...defaults, ...values }) : (display?.(column) ?? undefined), placeholder: own?.placeholder, as: own?.as, where: narrowed === undefined ? undefined : narrowed || undefined, waiting: narrowed === undefined, tree: kind === 'reference' ? own?.tree : undefined, helpId: helpId, onChange: (value) => {
|
|
436
|
+
edited.current.add(column.name);
|
|
437
|
+
field.handleChange(value);
|
|
438
|
+
/* A value taken from the record this field names follows the choice, until the person says their own. */
|
|
439
|
+
for (const [name, path] of Object.entries(form?.derived ?? {})) {
|
|
440
|
+
if (!path?.startsWith(`${column.name}.`) || edited.current.has(name))
|
|
441
|
+
continue;
|
|
442
|
+
void derivedValue(path, column, value, target).then((taken) => {
|
|
443
|
+
if (!edited.current.has(name) && f.getFieldValue(column.name) === value)
|
|
444
|
+
f.setFieldValue(name, taken);
|
|
445
|
+
});
|
|
450
446
|
}
|
|
451
|
-
|
|
452
|
-
|
|
447
|
+
/* A choice narrowed by this field goes only where it no longer belongs to the pick. A deal
|
|
448
|
+
the form was given (opened from the deal, or from the assistant's proposal) stays when
|
|
449
|
+
the account picked is that deal's own: with the inferred narrowing every New form that
|
|
450
|
+
asks the account first would otherwise drop the record it was opened for. */
|
|
451
|
+
for (const dependent of dependents(column.name)) {
|
|
452
|
+
const held = f.getFieldValue(dependent.name);
|
|
453
|
+
if (!held)
|
|
454
|
+
continue;
|
|
455
|
+
const drop = () => {
|
|
456
|
+
if (f.getFieldValue(dependent.name) !== held)
|
|
457
|
+
return;
|
|
458
|
+
edited.current.add(dependent.name);
|
|
459
|
+
f.setFieldValue(dependent.name, '');
|
|
460
|
+
setDirty(hasFormChanges(columns, f.state.values, defaults, edited.current));
|
|
461
|
+
};
|
|
462
|
+
const remote = Object.entries(whereOf(dependent) ?? {}).find(([, local]) => local === column.name)?.[0];
|
|
463
|
+
if (value === '' || value === null || value === undefined || !remote) {
|
|
453
464
|
drop();
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
void derivedValue(`${dependent.name}.${remote}`, dependent, String(held), target).then((under) => {
|
|
468
|
+
if (f.getFieldValue(column.name) === value && under !== String(value))
|
|
469
|
+
drop();
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
if (serverError)
|
|
473
|
+
setClearedServerFields((previous) => {
|
|
474
|
+
const next = new Set(previous);
|
|
475
|
+
next.add(column.name);
|
|
476
|
+
return next;
|
|
477
|
+
});
|
|
478
|
+
setDirty(hasFormChanges(columns, f.state.values, defaults, edited.current));
|
|
479
|
+
}, explicitNull: !edited.current.has(column.name) && Object.hasOwn(defaults, column.name) && defaults[column.name] === null, register: (node) => controls.current.set(column.name, node), errorId: fieldMessage ? errorId : undefined }), help && (_jsx("p", { id: helpId, "data-slot": "field-description", children: help })), _jsx("span", { id: errorId, className: "insert-missing", "aria-live": "polite", hidden: !fieldMessage, children: fieldMessage })] }));
|
|
480
|
+
} }, column.name));
|
|
481
|
+
});
|
|
482
|
+
const placed = inRows(fields.map((column) => column.name), body, rows);
|
|
483
|
+
const groupHelp = app ? form?.groups?.find((authored) => authored.label === group.label)?.description : undefined;
|
|
484
|
+
return group.label ? (_jsxs("fieldset", { className: "insert-group", children: [_jsx("legend", { children: group.label }), groupHelp && _jsx("p", { className: "insert-group-description", children: groupHelp }), _jsx("div", { className: "insert-group-fields", children: placed })] }, `${group.label}:${groupIndex}`)) : (_jsx("div", { className: "insert-group-fields", children: placed }, `ungrouped:${groupIndex}`));
|
|
485
|
+
})] }));
|
|
470
486
|
} }));
|
|
471
487
|
/* The Workbench says what an empty box means; an App's form says what the
|
|
472
488
|
author wrote (`description`), if anything — each field's own help says
|
|
@@ -492,7 +508,7 @@ function NewRecordFormBody({ table, form, app, label: columnLabel, target, inser
|
|
|
492
508
|
setDirty(true);
|
|
493
509
|
},
|
|
494
510
|
/* The totals stand beside the last grid's Add line, their figures under its amounts. */
|
|
495
|
-
summary: at === lineSets.length - 1 && live.length > 0 ? liveSummary : undefined }, line.table.id))), linesTried && linesShort && (_jsx("p", { className: "form-lines-problem", role: "alert", children: say('addAtLeastLines', { min: linesShort.min }) }))] })), live.length > 0 && !lineSets.length && (!steps || stepIndex === steps.length - 1) && liveSummary, offersTags && (!steps || stepIndex === steps.length - 1) && (_jsxs("div", {
|
|
511
|
+
summary: at === lineSets.length - 1 && live.length > 0 ? liveSummary : undefined }, line.table.id))), linesTried && linesShort && (_jsx("p", { className: "form-lines-problem", role: "alert", children: say('addAtLeastLines', { min: linesShort.min }) }))] })), live.length > 0 && !lineSets.length && (!steps || stepIndex === steps.length - 1) && liveSummary, offersTags && (!steps || stepIndex === steps.length - 1) && (_jsxs("div", { "data-slot": app ? 'field' : undefined, className: "insert-field", children: [_jsx("label", { "data-slot": "field-label", children: humanName(tagTable.name) }), _jsx(RecordPicker, { table: tagTable, multiple: true, value: tagValues, onChange: setTagValues, app: true, hideKey: true, ariaLabel: humanName(tagTable.name) })] }))] }), _jsx("p", { ref: status, className: "insert-status", role: "status", tabIndex: -1, hidden: submission.phase !== 'pending', children: say('adding') }), _jsx(f.Subscribe, { selector: (state) => state.values, children: (values) => {
|
|
496
512
|
const hiddenMissing = tried
|
|
497
513
|
? missingFields(table.columns.filter((c) => !columns.includes(c)), insertValues(values, defaults, edited.current, table.columns), assigned, form?.derived)
|
|
498
514
|
: [];
|
|
@@ -647,7 +663,7 @@ export function PlatformControl({ column, app, required, assigned, spoken, targe
|
|
|
647
663
|
const cards = as === 'cards';
|
|
648
664
|
/* A vocabulary here has no descriptions, so what keeps its cards is only how many words there are. */
|
|
649
665
|
const stacked = cards && words.length > SEGMENTED_WORDS;
|
|
650
|
-
return (_jsx("div", {
|
|
666
|
+
return (_jsx("div", { "data-slot": "radio-group", "data-kind": "cards", "data-fit": stacked ? 'stack' : cards ? 'row' : 'pair', role: "radiogroup", "aria-label": spoken, "aria-required": required || undefined, children: words.map(([stored, said], index) => (_jsxs("label", { "data-slot": "choice", "data-checked": value === stored ? '' : undefined, children: [cards && rule?.icons?.[stored] && isAppIcon(rule.icons[stored]) ? (_jsx("span", { "data-slot": "choice-icon", "aria-hidden": "true", children: _jsx(Icon, { name: rule.icons[stored] }) })) : null, _jsx("input", { type: "radio", name: radioName, value: stored, "data-slot": "radio", "data-checked": value === stored ? '' : undefined, checked: value === stored, onChange: () => onChange(stored), ref: index === 0 ? setControl : undefined }), _jsx("span", { "data-slot": "choice-label", children: said })] }, stored))) }));
|
|
651
667
|
}
|
|
652
668
|
if (((kind === 'radios' && as !== 'select') || (as === 'radios' && app)) && allowed?.length) {
|
|
653
669
|
return (_jsx("div", { className: "command-choices insert-choices", role: "radiogroup", "aria-label": spoken, "aria-required": required || undefined, children: allowed.map((stored, index) => (_jsxs("label", { className: "command-choice", children: [_jsx("input", { type: "radio", name: radioName, value: stored, checked: value === stored, onChange: () => onChange(stored), ref: index === 0 ? setControl : undefined }), word(stored)] }, stored))) }));
|
|
@@ -678,7 +694,7 @@ export function PlatformControl({ column, app, required, assigned, spoken, targe
|
|
|
678
694
|
return (_jsx(RecordPicker, { table: referenced, value: value, onChange: onChange, ariaLabel: spoken, app: app, inputRef: setControl, where: where, disabled: waiting, ...(placeholder ? { placeholder } : {}) }));
|
|
679
695
|
}
|
|
680
696
|
if (dateOnly(column) || kind === 'datetime') {
|
|
681
|
-
return (_jsx(DateField, { id: dateId, inputRef: setControl, className: "insert-input", value: value, onChange: onChange, withTime: kind === 'datetime', "aria-label": app ? spoken : `${column.name} (${column.type})`,
|
|
697
|
+
return (_jsx(DateField, { id: dateId, inputRef: setControl, className: "insert-input", value: value, onChange: onChange, withTime: kind === 'datetime', "aria-invalid": errorId ? true : undefined, "aria-label": app ? spoken : `${column.name} (${column.type})`,
|
|
682
698
|
/* A day's box says the locale's pattern, as its hint does and as it reads what is typed (MM/DD/YYYY in
|
|
683
699
|
en-US; ISO is read too): the field's own (DateField.tsx). */
|
|
684
700
|
placeholder: said || (kind === 'datetime' ? say('yyyyMmDdHh') : undefined), locale: formatLocale(), timezone: formatTimezone(), now: appNow() }));
|
|
@@ -814,7 +830,7 @@ function inertBehind(panel) {
|
|
|
814
830
|
for (const sibling of node.parentElement.children) {
|
|
815
831
|
if (sibling === node || !(sibling instanceof HTMLElement) || sibling.inert)
|
|
816
832
|
continue;
|
|
817
|
-
if (sibling.matches('[
|
|
833
|
+
if (sibling.matches('[popover], [aria-live], [role="status"], [role="alert"]'))
|
|
818
834
|
continue;
|
|
819
835
|
sibling.inert = true;
|
|
820
836
|
made.push(sibling);
|
|
@@ -852,7 +868,7 @@ function NewRecordSheet(props) {
|
|
|
852
868
|
control drawn over the form's fields. Released before focus goes back to the New button, which is behind. */
|
|
853
869
|
useLayoutEffect(() => (root.current ? inertBehind(root.current) : undefined), []);
|
|
854
870
|
useEffect(() => {
|
|
855
|
-
const popupOpen = () => shellQuery('.picker-popup:not([data-closed]) .picker-list,
|
|
871
|
+
const popupOpen = () => shellQuery('.picker-popup:not([data-closed]) .picker-list, [data-slot="select-content"][data-open]');
|
|
856
872
|
/* Tab stays in the drawer. A pointer on the list closes the drawer first,
|
|
857
873
|
so the keyboard gets no more of the list than the pointer does; and the
|
|
858
874
|
drawer covers the list's right side, where Tab walked on under it. An
|
|
@@ -908,7 +924,7 @@ export function NewRecordDialog(props) {
|
|
|
908
924
|
dismissal.change(next);
|
|
909
925
|
props.onUnresolvedChange?.(next);
|
|
910
926
|
}, [props.retainUncertain, props.onUnresolvedChange, dismissal.change]);
|
|
911
|
-
return (_jsxs(Modal, { className: "confirm insert-dialog", onClose: props.onCancel, closeDisabled: dismissal.pending, beforeClose: dismissal.beforeClose, ariaLabel: title, children: [_jsx("h2", { children: title }), _jsx(NewRecordForm, { ...props, onCancel: dismissal.close, onPendingChange: props.retainUncertain ? undefined : dismissal.change, onUnresolvedChange: unresolved, onDiscardChange: dismissal.discardChange }), dismissal.discard && _jsx(DiscardNewRecord, { onDone: dismissal.resolve })] }));
|
|
927
|
+
return (_jsxs(Modal, { className: "confirm insert-dialog", onClose: props.onCancel, closeDisabled: dismissal.pending, beforeClose: dismissal.beforeClose, ariaLabel: title, closeLabel: say('common.close'), children: [_jsx("h2", { children: title }), _jsx(NewRecordForm, { ...props, onCancel: dismissal.close, onPendingChange: props.retainUncertain ? undefined : dismissal.change, onUnresolvedChange: unresolved, onDiscardChange: dismissal.discardChange }), dismissal.discard && _jsx(DiscardNewRecord, { onDone: dismissal.resolve })] }));
|
|
912
928
|
}
|
|
913
929
|
export function DiscardNewRecord({ onDone }) {
|
|
914
930
|
return (_jsx(ConfirmDialog, { title: say('discardNewRecord'), body: say('yourEntriesHaveNotBeen'), confirmLabel: say('discardRecord'), cancelLabel: say('keepEditing'), onDone: onDone }));
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
.empty-note-detail { display: block; }
|
|
13
13
|
/* A refusal stands where a room's content would: on the room's edge, as the bare note it replaces did. */
|
|
14
14
|
.empty-note.is-refused { padding: var(--space-4h) var(--room-inset, 12px); }
|
|
15
|
+
/* The block that is all its room has to say (`room`, Notes.tsx: a page refused, a record gone) stands in the room's
|
|
16
|
+
middle, a little above it, as the sign-in column does: the mark on a tile of the raised ground, the sentence in the
|
|
17
|
+
text ink a step up, the action under it. One block still, with the same parts in the same order. */
|
|
18
|
+
.empty-note.is-room { grid-template-columns: minmax(0, 1fr); justify-items: center; row-gap: var(--space-2); max-width: 28rem; margin: clamp(var(--space-7), 16vh, calc(3 * var(--space-8))) auto var(--space-8); padding: 0 var(--space-5); text-align: center; }
|
|
19
|
+
.empty-note.is-room > * { grid-column: 1; grid-row: auto; }
|
|
20
|
+
.empty-note.is-room > .empty-note-mark { box-sizing: content-box; width: 1em; height: 1em; margin: 0 0 var(--space-3); padding: var(--space-3); border-radius: var(--radius); background: var(--raised); color: var(--ink-muted); font-size: var(--text-xl); }
|
|
21
|
+
.empty-note.is-room > .empty-note-text { color: var(--ink); font-size: var(--text-lg); font-weight: 500; text-wrap: balance; }
|
|
22
|
+
.empty-note.is-room .empty-note-detail { margin-top: var(--space-1); font-size: var(--text-md); font-weight: 400; }
|
|
23
|
+
.empty-note.is-room > .empty-note-action { margin-top: var(--space-4); }
|
|
15
24
|
.empty-note-text { margin: 0; color: var(--ink-muted); font-size: var(--text-md); line-height: 1.5; }
|
|
16
25
|
.empty-note-detail { color: var(--ink-muted); }
|
|
17
26
|
/* An authored title leads in the text ink at the same size: the sentence is what it says, not a heading. */
|
|
@@ -39,21 +39,25 @@ export declare function Problem({ text, retry, crashed }: {
|
|
|
39
39
|
* A place with nothing in it yet: one sentence at body size, a second one
|
|
40
40
|
* that says what belongs here when there is one, and the way to add it.
|
|
41
41
|
*/
|
|
42
|
-
export declare function Empty({ text, detail, action, className, mark, }: {
|
|
42
|
+
export declare function Empty({ text, detail, action, className, mark, room, }: {
|
|
43
43
|
text: ReactNode;
|
|
44
44
|
detail?: ReactNode;
|
|
45
45
|
action?: ReactNode;
|
|
46
46
|
className?: string;
|
|
47
47
|
/** The block's mark; none where the place is too small to carry one. */
|
|
48
48
|
mark?: 'tray' | null;
|
|
49
|
+
/** The block is the whole room's answer, and stands in its middle. */
|
|
50
|
+
room?: boolean;
|
|
49
51
|
}): import("react").JSX.Element;
|
|
50
52
|
/**
|
|
51
53
|
* A place the reader may not see: the same block under a lock, said as a status. What it says is the view's own
|
|
52
54
|
* title and the noun it is (a page, a form, a record, a list), never a bare line.
|
|
53
55
|
*/
|
|
54
|
-
export declare function Refused({ text, detail, action, className, }: {
|
|
56
|
+
export declare function Refused({ text, detail, action, className, room, }: {
|
|
55
57
|
text: ReactNode;
|
|
56
58
|
detail?: ReactNode;
|
|
57
59
|
action?: ReactNode;
|
|
58
60
|
className?: string;
|
|
61
|
+
/** The refusal is the whole room's answer, and stands in its middle. */
|
|
62
|
+
room?: boolean;
|
|
59
63
|
}): import("react").JSX.Element;
|
|
@@ -76,21 +76,25 @@ export function Problem({ text, retry, crashed = false }) {
|
|
|
76
76
|
* The state block, one shape for three states (`Empty`, `Refused`, and `Problem` above): a mark, one line at body
|
|
77
77
|
* size, an optional muted second line, and at most one compact action. It stands on the section's own edge; a
|
|
78
78
|
* look dresses it through the tokens it already sets (ink, line, the warning ink for a failure).
|
|
79
|
+
*
|
|
80
|
+
* `room`: the block is all its room has to say (a page the reader may not see, a record that is gone). The same
|
|
81
|
+
* parts then stand in the room's middle, the mark on a tile and the sentence in the text ink: on the edge of an
|
|
82
|
+
* otherwise empty page, one grey line read as a page that had failed to load.
|
|
79
83
|
*/
|
|
80
|
-
function StateBlock({ mark, text, detail, action, className, role, }) {
|
|
81
|
-
return (_jsxs("div", { className: className
|
|
84
|
+
function StateBlock({ mark, text, detail, action, className, role, room, }) {
|
|
85
|
+
return (_jsxs("div", { className: `${className}${room ? ' is-room' : ''}`, ...(role ? { role } : {}), children: [mark ? _jsx(Icon, { name: mark, className: "empty-note-mark" }) : null, _jsxs("p", { className: "empty-note-text", children: [text, detail ? (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "empty-note-detail", children: detail })] })) : null] }), action ? _jsx("div", { className: "empty-note-action", children: action }) : null] }));
|
|
82
86
|
}
|
|
83
87
|
/**
|
|
84
88
|
* A place with nothing in it yet: one sentence at body size, a second one
|
|
85
89
|
* that says what belongs here when there is one, and the way to add it.
|
|
86
90
|
*/
|
|
87
|
-
export function Empty({ text, detail, action, className = '', mark = 'tray', }) {
|
|
88
|
-
return _jsx(StateBlock, { mark: mark, text: text, detail: detail, action: action, className: `empty-note${className ? ` ${className}` : ''}` });
|
|
91
|
+
export function Empty({ text, detail, action, className = '', mark = 'tray', room, }) {
|
|
92
|
+
return (_jsx(StateBlock, { mark: mark, text: text, detail: detail, action: action, room: room, className: `empty-note${className ? ` ${className}` : ''}` }));
|
|
89
93
|
}
|
|
90
94
|
/**
|
|
91
95
|
* A place the reader may not see: the same block under a lock, said as a status. What it says is the view's own
|
|
92
96
|
* title and the noun it is (a page, a form, a record, a list), never a bare line.
|
|
93
97
|
*/
|
|
94
|
-
export function Refused({ text, detail, action, className = '', }) {
|
|
95
|
-
return (_jsx(StateBlock, { mark: "lock", role: "status", text: text, detail: detail, action: action, className: `empty-note is-refused${className ? ` ${className}` : ''}` }));
|
|
98
|
+
export function Refused({ text, detail, action, className = '', room, }) {
|
|
99
|
+
return (_jsx(StateBlock, { mark: "lock", role: "status", text: text, detail: detail, action: action, room: room, className: `empty-note is-refused${className ? ` ${className}` : ''}` }));
|
|
96
100
|
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* The header's ··· menu — in an App, its settings gear — over
|
|
3
|
+
* The header's ··· menu — in an App, its settings gear — over UI SDK's Menu.
|
|
4
4
|
*
|
|
5
5
|
* The registry behind it is menu.js's: modules add their commands there,
|
|
6
6
|
* the palette lists the same commands, and this draws them when the menu
|
|
7
7
|
* opens — read at open, not at registration, so a detail that describes
|
|
8
8
|
* current state ("credit_limit on customer 4") is the state now, and a
|
|
9
|
-
* `checked` item reflects the toggle as it stands.
|
|
9
|
+
* `checked` item reflects the toggle as it stands. UI SDK owns what a
|
|
10
10
|
* menu owes the keyboard — arrows, Home/End, typeahead, Escape back to the
|
|
11
11
|
* trigger, outside click — and the roles and `aria-expanded` that go with
|
|
12
|
-
* them
|
|
12
|
+
* them, and where the popup stands against its trigger. The open state is
|
|
13
|
+
* held here so the shell can be told about it.
|
|
13
14
|
*/
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
15
|
+
import { personFacing } from '../audience.js';
|
|
16
|
+
import { useState, useSyncExternalStore } from 'react';
|
|
17
|
+
import { Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuTrigger } from '@ui-sdk/react/menu';
|
|
16
18
|
import { detailOf, menuItems, menuMode, menuVersion, settingsInAccount, whenMenuChanges } from '../menu.js';
|
|
17
|
-
import { layoutViewport, zoomAnchor } from '@mistriwork/ui/internal/anchor.js';
|
|
18
19
|
import { Icon } from './Icon.js';
|
|
19
20
|
import { say } from '../copy/shell/components/OverflowMenu.js';
|
|
20
21
|
import { popupContainer } from '../shellHost.js';
|
|
@@ -30,15 +31,16 @@ export function MenuRegistryItems() {
|
|
|
30
31
|
entries.push(item);
|
|
31
32
|
groups.set(category, entries);
|
|
32
33
|
}
|
|
33
|
-
return (_jsx(_Fragment, { children: [...groups].map(([category, entries]) => (_jsxs(
|
|
34
|
+
return (_jsx(_Fragment, { children: [...groups].map(([category, entries]) => (_jsxs(MenuGroup, { children: [!(entries.length === 1 &&
|
|
34
35
|
entries[0].label
|
|
35
36
|
.replace(/[….]+$/, '')
|
|
36
37
|
.trim()
|
|
37
|
-
.toLowerCase() === category.trim().toLowerCase()) && _jsx(
|
|
38
|
+
.toLowerCase() === category.trim().toLowerCase()) && _jsx(MenuGroupLabel, { className: "more-group-label", children: category }), entries.map((item, i) => {
|
|
38
39
|
const ticks = entries.some((entry) => entry.checked?.() != null);
|
|
39
40
|
const checked = item.checked?.() ?? null;
|
|
40
41
|
const body = (_jsxs(_Fragment, { children: [ticks && (_jsx("span", { className: "more-tick", "aria-hidden": "true", children: checked ? '✓' : '' })), _jsx("span", { className: "more-label", children: item.label }), detailOf(item) ? _jsx("span", { className: "more-detail", children: detailOf(item) }) : null] }));
|
|
41
|
-
|
|
42
|
+
const key = `${item.group ?? ''}|${item.label}|${i}`;
|
|
43
|
+
return checked === null ? (_jsx(MenuItem, { className: ticks ? 'more-item' : 'more-item no-tick', onSelect: () => item.onSelect(), children: body }, key)) : (_jsx(MenuCheckboxItem, { value: key, className: checked ? 'more-item checked' : 'more-item', checked: checked, closeOnSelect: true, onCheckedChange: () => item.onSelect(), children: body }, key));
|
|
42
44
|
})] }, category))) }));
|
|
43
45
|
}
|
|
44
46
|
export function OverflowMenu() {
|
|
@@ -46,7 +48,6 @@ export function OverflowMenu() {
|
|
|
46
48
|
useSyncExternalStore(whenMenuChanges, menuVersion, menuVersion);
|
|
47
49
|
/* Its label is said again when a visitor's language arrives with the App. */
|
|
48
50
|
useMessageLanguage();
|
|
49
|
-
const trigger = useRef(null);
|
|
50
51
|
/* In an App what the menu holds is the reader's settings — Preferences and the
|
|
51
52
|
dark mode — so it wears the settings mark and
|
|
52
53
|
says "Settings": an unlabelled "···" beside the account menu was a second
|
|
@@ -56,5 +57,9 @@ export function OverflowMenu() {
|
|
|
56
57
|
const app = menuMode() === 'app';
|
|
57
58
|
if (app && settingsInAccount())
|
|
58
59
|
return null;
|
|
59
|
-
|
|
60
|
+
/* A visitor of an App that signs people in has no settings to keep there: the look is the App owner's, and the
|
|
61
|
+
gear beside "Sign in" read as an account they did not have (audience.ts). */
|
|
62
|
+
if (app && personFacing())
|
|
63
|
+
return null;
|
|
64
|
+
return (_jsxs(Menu, { open: open, onOpenChange: setOpen, children: [_jsx(MenuTrigger, { id: "more-button", className: app ? 'icon-button more-settings' : 'icon-button', "data-own": "", title: app ? say('common.settings') : say('common.more'), "aria-label": app ? say('common.settings') : say('common.more'), children: app ? _jsx(Icon, { name: "gear", className: "more-settings-icon" }) : _jsx("span", { "aria-hidden": "true", children: "\u00B7\u00B7\u00B7" }) }), _jsx(MenuContent, { className: "more-list", side: "bottom", align: "end", sideOffset: 6, collisionPadding: 8, container: popupContainer(), children: _jsx(MenuRegistryItems, {}) })] }));
|
|
60
65
|
}
|
|
@@ -8,11 +8,11 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
8
8
|
*/
|
|
9
9
|
import { shell } from '../shellMode.js';
|
|
10
10
|
import { useMessageLanguage } from './useMessageLanguage.js';
|
|
11
|
-
import { useContext, useEffect } from 'react';
|
|
11
|
+
import { cloneElement, useContext, useEffect } from 'react';
|
|
12
12
|
import { useQuery } from '@tanstack/react-query';
|
|
13
13
|
import { readRecordSource, shareRecordSource } from '../recordSource.js';
|
|
14
14
|
import { readPageFields } from './pageFieldsRead.js';
|
|
15
|
-
import { choiceWord, dressFor, sayValue } from './valueModel.js';
|
|
15
|
+
import { choiceWord, dressFor, hueOf, initialsOf, sayValue } from './valueModel.js';
|
|
16
16
|
import { pathEqualityFilter, recordKey as checkedRecordKey } from '../resourceRequests.js';
|
|
17
17
|
import { columnDisplay, columnLabel, emptyWord, findTable, labelPath, primaryKey, rowLabel, state } from '../core.js';
|
|
18
18
|
import { humanName } from '@mistriwork/engine/shared/model.js';
|
|
@@ -20,6 +20,7 @@ import { resourceOf } from './appRooms.js';
|
|
|
20
20
|
import { recordNoun } from '@mistriwork/engine/shared/appNoun.js';
|
|
21
21
|
import { canEditRow } from '../write.js';
|
|
22
22
|
import { cardStem, sharedPrefix } from '@mistriwork/engine/shared/pagePaths.js';
|
|
23
|
+
import { labelColumn } from '@mistriwork/engine/shared/schema.js';
|
|
23
24
|
import { Editable } from './Editable.js';
|
|
24
25
|
import { RefJump, Value } from './Value.js';
|
|
25
26
|
import { defaultFieldPaths, definedThrough, fieldsColumns } from '@mistriwork/engine/shared/recordReads.js';
|
|
@@ -208,8 +209,16 @@ export function FieldsSection({ page, section, index, base, recordKey: key, fold
|
|
|
208
209
|
const noun = reference
|
|
209
210
|
? recordNoun(resourceOf(shell().app(), reference.table)?.noun, findTable(reference.table)?.name ?? reference.table)
|
|
210
211
|
: '';
|
|
212
|
+
/* A person's card wears the disc their name wears in a list: the record the card names says so itself, where its
|
|
213
|
+
name column is drawn with an avatar (`display: { name: { avatar: true } }`). The disc is decoration; the name
|
|
214
|
+
stays the link's text. */
|
|
215
|
+
const referred = reference ? findTable(reference.table) : undefined;
|
|
216
|
+
const nameColumn = referred ? labelColumn(referred) : undefined;
|
|
217
|
+
const person = referred && nameColumn && columnDisplay(referred.id, nameColumn)?.avatar && titleLabel
|
|
218
|
+
? String(row[titleLabel] ?? '').trim()
|
|
219
|
+
: '';
|
|
211
220
|
const jump = (className, text) => (_jsx(RefJump, { references: reference, value: row[titlePath], label: titleLabel ? row[titleLabel] : undefined, table: base, column: titlePath, row: row, className: className, text: text }));
|
|
212
|
-
return (_jsx("section", { className: `${sectionClass(section)} page-card-section page-reference-card`, children: _jsxs("div", { className: "page-card", children: [section.title && _jsx("h2", { className: "page-card-caption", children: section.title }),
|
|
221
|
+
return (_jsx("section", { className: `${sectionClass(section)} page-card-section page-reference-card`, children: _jsxs("div", { className: "page-card", children: [section.title && _jsx("h2", { className: "page-card-caption", children: section.title }), _jsxs("p", { className: person ? 'page-card-title has-avatar' : 'page-card-title', children: [person && (_jsx("span", { className: `avatar avatar-c${hueOf(person)}`, "aria-hidden": "true", children: initialsOf(person) })), reference ? (jump('page-card-name')) : filled(titlePath) ? (_jsx(Value, { col: titleColumn, value: row[titlePath], tableId: base.id, row: row, subtitled: !titlePath.includes('.') })) : (emptyWord())] }), rest.some(filled) && (_jsx("dl", { className: "page-card-facts", children: rest.filter(filled).map((path) => (_jsxs("div", { className: "page-card-fact", children: [_jsx("dt", { children: columnLabel(base.id, path, factsStem) ?? captionOf(path) }), _jsx("dd", { children: said(path) })] }, path))) })), reference && _jsx("p", { className: "page-card-foot", children: jump('page-card-more', say('common.view', { noun })) })] }) }));
|
|
213
222
|
}
|
|
214
223
|
/* A group of fields that all follow the same reference is that record
|
|
215
224
|
shown inline; its labels drop the hop they all share. */
|
|
@@ -308,7 +317,13 @@ export function FieldsSection({ page, section, index, base, recordKey: key, fold
|
|
|
308
317
|
const lone = Boolean(section.title) && paths.length === 1 && (!rail || long);
|
|
309
318
|
/* …and set as a paragraph: body weight and size, a readable measure, never the weight of a heading. */
|
|
310
319
|
const prose = lone && typeof value === 'string' && !column?.references;
|
|
311
|
-
|
|
320
|
+
/* A summary's line under its figure (`notes`): what the figure counts, in the value's own cell so it is read with
|
|
321
|
+
it and every look's rule for the value's box holds it too. */
|
|
322
|
+
const note = presentation === 'summary' ? section.notes?.[path] : undefined;
|
|
323
|
+
const cell = note
|
|
324
|
+
? cloneElement(dd, undefined, dd.props.children, _jsx("span", { className: "page-field-note", children: note }, "note"))
|
|
325
|
+
: dd;
|
|
326
|
+
return (_jsxs("div", { className: `page-field${long ? ' page-field-wide' : ''}${prose ? ' page-field-prose' : ''}`, children: [_jsx("dt", { title: path, className: lone ? 'visually-hidden' : undefined, children: label }), cell] }, path));
|
|
312
327
|
});
|
|
313
328
|
/* Nothing left to say: the block is not drawn, as a header with no facts is not. A writable block keeps its fields. */
|
|
314
329
|
if (hideEmpty && !fields.some(Boolean) && !section.workflow)
|
|
@@ -9,6 +9,10 @@ interface Counted {
|
|
|
9
9
|
export interface Counting {
|
|
10
10
|
base: TableMeta;
|
|
11
11
|
recordKey: Record<string, unknown>;
|
|
12
|
+
/** On a page an author wrote the figure is seen and not heard: it stays out of the name of the heading or the tab
|
|
13
|
+
it stands in, so "Charges" is still the heading a reader, a script and an address ask for by name. An inferred
|
|
14
|
+
page's count is part of the name, as it has been. */
|
|
15
|
+
seen?: boolean;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* How many rows each of an inferred page's related lists holds, by its question (recordReads.ts,
|
|
@@ -16,7 +20,10 @@ export interface Counting {
|
|
|
16
20
|
* page's compose, so a composed page is answered at once. Kept beside the list badges' counts, so a write that
|
|
17
21
|
* refreshes those refreshes these.
|
|
18
22
|
*/
|
|
19
|
-
export declare function useRelatedCounts(sections: readonly SlotProps['section'][], counting: Counting | undefined
|
|
23
|
+
export declare function useRelatedCounts(sections: readonly SlotProps['section'][], counting: Counting | undefined,
|
|
24
|
+
/** One request to a list, where the server composed them so (a page an author wrote that stands its lists alone,
|
|
25
|
+
recordReads.ts): a strip the record's page tabs made of them asks as the lists alone would have. */
|
|
26
|
+
each?: boolean): Map<string, Counted | null> | undefined;
|
|
20
27
|
/**
|
|
21
28
|
* A related list's count, on its tab or beside its heading. It stands in room kept for it from the first paint
|
|
22
29
|
* (features.css, `.tab-count`), so its arrival moves no tab, no heading and no fold; a list that is no one hop back
|