@mistriwork/kit 1.0.0-rc.45 → 1.0.0-rc.47
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/columns.js +3 -1
- package/dist/client/components/Grid.d.ts +11 -1
- package/dist/client/components/Grid.js +25 -10
- package/dist/client/components/MultiStepForm.js +3 -2
- package/dist/client/components/PageHead.js +4 -1
- package/dist/client/components/PageRelated.js +4 -2
- package/dist/client/components/pageContext.d.ts +3 -0
- package/dist/client/components/valueModel.js +4 -1
- package/dist/client/copy/record/components/Actions.d.ts +13 -0
- package/dist/client/copy/record/components/Actions.js +10 -0
- package/dist/client/recordWriteRefresh.js +2 -0
- package/dist/client/visualThemes.css +5 -2
- package/package.json +3 -3
package/dist/client/columns.js
CHANGED
|
@@ -80,7 +80,9 @@ export function planColumn(meta, name, rows) {
|
|
|
80
80
|
them turns invoice 1001 into "1,001", which reads as a quantity and is
|
|
81
81
|
not what the value means. */
|
|
82
82
|
const identifier = Boolean(meta?.primaryKey || meta?.references || meta?.identifier);
|
|
83
|
-
|
|
83
|
+
/* A worked-out figure (an average, a computed number) says its places, never the six an average of whole
|
|
84
|
+
numbers carries: `places` (shared/rollups.ts DERIVED_PLACES). */
|
|
85
|
+
const decimals = identifier ? 0 : Math.min(meta?.places ?? 6, Math.max(0, ...values.map(countDecimals)));
|
|
84
86
|
const group = !identifier && values.some((v) => Math.abs(Number(v)) >= 10000);
|
|
85
87
|
return { ...plan, kind: 'number', align: 'right', decimals, group, identifier };
|
|
86
88
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type DisplayRule } from './valueModel.js';
|
|
3
|
-
import type { ColumnMeta, TableMeta } from '@mistriwork/engine/shared/schema.js';
|
|
3
|
+
import type { ColumnMeta, DatabaseSchema, TableMeta } from '@mistriwork/engine/shared/schema.js';
|
|
4
4
|
import type { TrailList } from '../recordTrail.js';
|
|
5
5
|
import type { TableSizing } from '@mistriwork/engine/shared/tableSizing.js';
|
|
6
6
|
import type { CellDraw } from './gridCellModel.js';
|
|
@@ -92,6 +92,16 @@ interface Plan {
|
|
|
92
92
|
group?: boolean;
|
|
93
93
|
showTime?: boolean;
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* The column a list names its rows by, among those it draws: the App's record name where it says one, else the
|
|
97
|
+
* table's label, else the first column of words. The App's name comes first: a field report's tickets, named by their
|
|
98
|
+
* title, were cut to fifteen characters beside a wide `number` column, which the schema alone calls the name.
|
|
99
|
+
*/
|
|
100
|
+
export declare function rowNameColumn(named: {
|
|
101
|
+
schema: DatabaseSchema;
|
|
102
|
+
table: TableMeta;
|
|
103
|
+
authored: string | false | undefined;
|
|
104
|
+
} | undefined, asked: readonly string[], words: (name: string) => boolean): string | undefined;
|
|
95
105
|
/** A row's folded columns, each drawn as its own cell would draw it, for the detail line under the row's name. */
|
|
96
106
|
export declare function foldedOf(more: NonNullable<CellColumn['more']>, record: Row): {
|
|
97
107
|
name: string;
|
|
@@ -31,7 +31,7 @@ import { createColumnHelper, tableFeatures, useTable } from '@tanstack/react-tab
|
|
|
31
31
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
32
32
|
import { columnDisplay, columnLabel, currentEntry, emptyWord, keyOf, openRecord, peekRecord, prefersPages, primaryKey, rowLabel, state, viewportBox, viewportScale, } from '../core.js';
|
|
33
33
|
import { opensRecord } from '../recordIntent.js';
|
|
34
|
-
import { labelColumn as namingColumn } from '@mistriwork/engine/shared/schema.js';
|
|
34
|
+
import { labelColumn as namingColumn, labelPath as namingPath } from '@mistriwork/engine/shared/schema.js';
|
|
35
35
|
import { ListSubtitles } from './listSubtitles.js';
|
|
36
36
|
import { datesAmong, dressFor, leadTonePath, maskedText, ruleSays, subtitlePath } from './valueModel.js';
|
|
37
37
|
import { currencyPath } from '@mistriwork/engine/shared/money.js';
|
|
@@ -63,7 +63,7 @@ import { AvatarPhotoContext, AvatarPhotos, avatarOwner } from './avatarPhotos.js
|
|
|
63
63
|
import { jsonValueOf, previewOf } from './jsonModel.js';
|
|
64
64
|
import { vocabularyWord } from '@mistriwork/engine/shared/model.js';
|
|
65
65
|
import { shell } from '../shellMode.js';
|
|
66
|
-
import { parseLabelTemplate } from '@mistriwork/engine/shared/recordLabel.js';
|
|
66
|
+
import { LABEL_SEGMENT, parseLabelTemplate } from '@mistriwork/engine/shared/recordLabel.js';
|
|
67
67
|
import { say } from '../copy/lists/components/Grid.js';
|
|
68
68
|
import { TAGS_TYPE, tagChips } from '@mistriwork/engine/shared/tagLists.js';
|
|
69
69
|
import { addHostListener, removeHostListener, shellBody } from '../shellHost.js';
|
|
@@ -155,6 +155,26 @@ function drawnWords(display, plan, value, label) {
|
|
|
155
155
|
}
|
|
156
156
|
return (dress?.kind === 'tone' || dress?.kind === 'word' || dress?.kind === 'mark' ? dress.label : dress?.text) ?? value;
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* The column a list names its rows by, among those it draws: the App's record name where it says one, else the
|
|
160
|
+
* table's label, else the first column of words. The App's name comes first: a field report's tickets, named by their
|
|
161
|
+
* title, were cut to fifteen characters beside a wide `number` column, which the schema alone calls the name.
|
|
162
|
+
*/
|
|
163
|
+
export function rowNameColumn(named, asked, words) {
|
|
164
|
+
const naming = !named
|
|
165
|
+
? undefined
|
|
166
|
+
: named.authored === undefined && !named.table.labelTemplate
|
|
167
|
+
? namingColumn(named.table)
|
|
168
|
+
: namingPath(named.schema, named.table, named.authored);
|
|
169
|
+
if (naming === LABEL_SEGMENT) {
|
|
170
|
+
/* A name the catalog computes is the `$label` the grid is handed, where it asks for it; where it does not, the
|
|
171
|
+
template's own first column, which is what the name leads with. Neither: the first column of words, as before. */
|
|
172
|
+
const parsed = named?.table.labelTemplate ? parseLabelTemplate(named.table.labelTemplate) : undefined;
|
|
173
|
+
const first = parsed && 'paths' in parsed ? parsed.paths.find((path) => asked.includes(path)) : undefined;
|
|
174
|
+
return asked.includes(LABEL_SEGMENT) ? LABEL_SEGMENT : (first ?? asked.find(words));
|
|
175
|
+
}
|
|
176
|
+
return naming && asked.includes(naming) ? naming : asked.find(words);
|
|
177
|
+
}
|
|
158
178
|
/** A row's folded columns, each drawn as its own cell would draw it, for the detail line under the row's name. */
|
|
159
179
|
export function foldedOf(more, record) {
|
|
160
180
|
/* Empty says nothing, and a yes-or-no says its head where it is yes ("Listed online") and nothing where it is no. */
|
|
@@ -617,14 +637,9 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
617
637
|
removeHostListener(window, VISUAL_THEME_EVENT, themeChanged);
|
|
618
638
|
};
|
|
619
639
|
}, [sizing]);
|
|
620
|
-
/* The column that names the row
|
|
621
|
-
|
|
622
|
-
const titleName = useMemo(() => {
|
|
623
|
-
const naming = table ? namingColumn(table) : undefined;
|
|
624
|
-
return naming && asked.includes(naming)
|
|
625
|
-
? naming
|
|
626
|
-
: asked.find((name) => plans.get(name)?.kind === 'text' || Boolean(referenceLabels?.[name]));
|
|
627
|
-
}, [table, asked, plans, referenceLabels]);
|
|
640
|
+
/* The column that names the row is read whole before the others (gridSizing.ts). */
|
|
641
|
+
const recordLabel = table ? shell().recordLabel(table.id) : undefined;
|
|
642
|
+
const titleName = useMemo(() => rowNameColumn(table && { schema: state.schema, table, authored: recordLabel }, asked, (name) => plans.get(name)?.kind === 'text' || Boolean(referenceLabels?.[name])), [table, state.schema, recordLabel, asked, plans, referenceLabels]);
|
|
628
643
|
const sizeHints = useMemo(() => asked.map((name) => {
|
|
629
644
|
const plan = plans.get(name);
|
|
630
645
|
const labelColumn = referenceLabels?.[name];
|
|
@@ -191,8 +191,9 @@ export function MultiStepForm({ steps, children, step, initialStep = 0, onStepCh
|
|
|
191
191
|
void (last ? complete() : move('next'));
|
|
192
192
|
};
|
|
193
193
|
/* The bar and its count beside it. The count is the bar's own name said again for the eye, so it is hidden from
|
|
194
|
-
assistive technology, which hears the bar's.
|
|
195
|
-
|
|
194
|
+
assistive technology, which hears the bar's. A form of one step has no way through to show: "Step 1 of 1" over a
|
|
195
|
+
full bar said nothing, so neither is drawn. */
|
|
196
|
+
const progressRow = boundedSteps.length > 1 && (_jsxs("div", { className: "multi-step-progress", children: [_jsx(ProgressBar, { min: 1, value: current + 1, max: boundedSteps.length, label: say('progress', { step: current + 1, count: boundedSteps.length, label: active.label }) }), _jsx("span", { className: "multi-step-count", "aria-hidden": "true", children: say('stepOf', { step: current + 1, count: boundedSteps.length }) })] }));
|
|
196
197
|
const panelNode = (_jsx("div", { id: panelId, ref: panel, className: "multi-step-panel", role: "group", "aria-labelledby": titleId, onKeyDown: enter, children: children(active, current) }));
|
|
197
198
|
const problemNode = (_jsx("p", { ref: said, tabIndex: -1, className: "multi-step-problem", role: "alert", "aria-live": "polite", hidden: !problem, children: problem }));
|
|
198
199
|
/* A page's steps beside the form (drawn, and shown only where the page is wide enough, by structure.css, so the
|
|
@@ -143,7 +143,10 @@ export function PageHead({ entry, page, base, others, onLayout, actions, host, o
|
|
|
143
143
|
/* A record that is gone has nothing to be done to it: no verbs, no Delete. */
|
|
144
144
|
/* The verbs, the documents and Delete stand in the App's bar (Actions.tsx), drawn through the shell's slot. */
|
|
145
145
|
const { ActionBar } = shell().slots;
|
|
146
|
-
|
|
146
|
+
/* Revoking the record's links is a write to it, offered where the server says this reader may (appProjection.ts);
|
|
147
|
+
the item stands from the first paint, so the head row never changes size for it; the count is asked when its dialog opens. */
|
|
148
|
+
const revokesLinks = Boolean(key && !gone && shell().inApp() && shell().app()?.revokesLinks?.includes(base.id));
|
|
149
|
+
const toolbar = ActionBar && key && !gone && (actions || deleting.available || documents.length || revokesLinks) ? (_jsx("div", { className: "page-head-actions", children: _jsx(ActionBar, { tableId: base.id, actions: actions?.list ?? [], recordKey: key, label: label, matches: actions?.matches ?? (async () => false), queryScope: actions?.queryScope, isCurrent: isCurrent, compact: phone, destructive: destructive, primary: header?.section.primary, only: header?.section.headerActions, canUpdate: actions?.canUpdate, grantedCommands: actions?.grantedCommands, grantedActions: actions?.grantedActions, revokesLinks: revokesLinks, menuTail: documents.length || deleting.available ? (_jsxs(_Fragment, { children: [documents.map((document) => (_jsx(DropItem, { className: "page-actions-item", onClick: () => go({ kind: 'page', pageId: page.id, table: base.id, key, label, tab: document.id }), children: document.label }, document.id))), deleting.available && (_jsx(DropItem, { className: "page-actions-item is-danger", disabled: deleting.blocked, onClick: deleting.ask, children: say('common.delete') }))] })) : undefined, onDone: () => {
|
|
147
150
|
if (host) {
|
|
148
151
|
if (isCurrent?.())
|
|
149
152
|
host.onActionDone();
|
|
@@ -12,7 +12,7 @@ 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';
|
|
14
14
|
import { formatBytes, formatNumber, formatRelativeDay } from '../locale.js';
|
|
15
|
-
import { columnKind, linkTarget } from '@mistriwork/engine/shared/schema.js';
|
|
15
|
+
import { columnKind, isAppendOnly, linkTarget } from '@mistriwork/engine/shared/schema.js';
|
|
16
16
|
import { recordViewKey, recordViewLabel, withoutParent, withoutParentName } from '@mistriwork/engine/shared/referenceModel.js';
|
|
17
17
|
import { groupsBody, listView, relatedCountsBody } from '@mistriwork/engine/shared/recordReads.js';
|
|
18
18
|
import { GROUP_ROWS_DEFAULT, GROUPS_DEFAULT } from '@mistriwork/engine/shared/pageModel.js';
|
|
@@ -438,7 +438,8 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
|
|
|
438
438
|
const owner = connection ?? state.activeConnection;
|
|
439
439
|
/* Rename and Remove are offered where the server would accept them — the
|
|
440
440
|
catalog's own answer for this reader, as the record's Delete asks it —
|
|
441
|
-
and never in a preview, which writes nothing.
|
|
441
|
+
and never in a preview, which writes nothing. A file the reader only
|
|
442
|
+
appends is never changed after its upload, so it is never renamed. */
|
|
442
443
|
const nameColumn = file && table ? table.columns.find((column) => column.name === file.name) : undefined;
|
|
443
444
|
const connectionWritable = Boolean(state.connections?.some((c) => c.id === owner && c.writable));
|
|
444
445
|
const renamable = Boolean(!preview &&
|
|
@@ -448,6 +449,7 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
|
|
|
448
449
|
!nameColumn.primaryKey &&
|
|
449
450
|
nameColumn.writable !== false &&
|
|
450
451
|
!table.isView &&
|
|
452
|
+
!isAppendOnly(table) &&
|
|
451
453
|
writeAllowed(table.id) &&
|
|
452
454
|
connectionWritable);
|
|
453
455
|
/* A grouped list's rows move between groups, and to their place in a ranked one (groupMoves.tsx), on the board's
|
|
@@ -65,6 +65,9 @@ export interface ActionBarProps {
|
|
|
65
65
|
only?: readonly string[];
|
|
66
66
|
/** Items drawn last in More, after the record's own verbs: Delete. Their presence alone gives the bar a More menu. */
|
|
67
67
|
menuTail?: ReactNode;
|
|
68
|
+
/** A record page's own: this reader may revoke the record's capability links (the server's answer), so More
|
|
69
|
+
offers it while some still open. */
|
|
70
|
+
revokesLinks?: boolean;
|
|
68
71
|
/** A row's own menu: every shown verb an item of one ⋯ menu the caller opens, no buttons. */
|
|
69
72
|
menuOnly?: {
|
|
70
73
|
label: string;
|
|
@@ -556,7 +556,10 @@ export function sayValue(col, value) {
|
|
|
556
556
|
? formatNumber(text)
|
|
557
557
|
: plan.identifier
|
|
558
558
|
? text
|
|
559
|
-
: formatNumber(n, {
|
|
559
|
+
: formatNumber(n, {
|
|
560
|
+
maximumFractionDigits: col?.places ?? 6,
|
|
561
|
+
useGrouping: !YEAR_NAME.test((col?.name ?? '').split('.').pop() ?? ''),
|
|
562
|
+
});
|
|
560
563
|
return { kind: 'number', text: shown, title: shown === text ? undefined : text };
|
|
561
564
|
}
|
|
562
565
|
if (plan.kind === 'date' || /date|time/.test(type))
|
|
@@ -10,4 +10,17 @@ export declare const say: import("../../../messages.js").RoomMessage<{
|
|
|
10
10
|
readonly theReasonIsKept: "The reason is kept with the record.";
|
|
11
11
|
readonly reason: "Reason";
|
|
12
12
|
readonly labelReason: "{label}: reason";
|
|
13
|
+
readonly revokeLinks: "Revoke links";
|
|
14
|
+
readonly revokeLinksQuestion: "Revoke links?";
|
|
15
|
+
readonly linksStopOpening: {
|
|
16
|
+
readonly one: "The {count} link to {label} that still opens stops opening.";
|
|
17
|
+
readonly other: "The {count} links to {label} that still open stop opening.";
|
|
18
|
+
};
|
|
19
|
+
readonly noOpenLinks: "No links to {label} are open.";
|
|
20
|
+
readonly linksAreKept: "Keep links";
|
|
21
|
+
readonly linksRevoked: {
|
|
22
|
+
readonly one: "Revoked {count} link.";
|
|
23
|
+
readonly other: "Revoked {count} links.";
|
|
24
|
+
};
|
|
25
|
+
readonly linksWereNotRevoked: "The links were not revoked.";
|
|
13
26
|
}>;
|
|
@@ -12,4 +12,14 @@ export const say = defineMessages({
|
|
|
12
12
|
theReasonIsKept: 'The reason is kept with the record.',
|
|
13
13
|
reason: 'Reason',
|
|
14
14
|
labelReason: '{label}: reason',
|
|
15
|
+
revokeLinks: 'Revoke links',
|
|
16
|
+
revokeLinksQuestion: 'Revoke links?',
|
|
17
|
+
linksStopOpening: {
|
|
18
|
+
one: 'The {count} link to {label} that still opens stops opening.',
|
|
19
|
+
other: 'The {count} links to {label} that still open stop opening.',
|
|
20
|
+
},
|
|
21
|
+
noOpenLinks: 'No links to {label} are open.',
|
|
22
|
+
linksAreKept: 'Keep links',
|
|
23
|
+
linksRevoked: { one: 'Revoked {count} link.', other: 'Revoked {count} links.' },
|
|
24
|
+
linksWereNotRevoked: 'The links were not revoked.',
|
|
15
25
|
});
|
|
@@ -266,6 +266,8 @@ export function refreshAfterCommand(client, record) {
|
|
|
266
266
|
export const KEYED_SECTION_READS = {
|
|
267
267
|
'page-history': { table: 1, key: 2 },
|
|
268
268
|
'page-flows': { table: 1, key: 2 },
|
|
269
|
+
/* How many of the record's capability links still open (Actions.tsx): a command that mints one leaves it stale. */
|
|
270
|
+
'record-links': { table: 1, key: 2 },
|
|
269
271
|
'page-link-fields': { table: 3, key: 4 },
|
|
270
272
|
'record-children': { table: 1, key: 2 },
|
|
271
273
|
'record-children-page': { table: 1, key: 2 },
|
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
:root[data-visual-theme] .app-mode .topbar button.account:hover { background: color-mix(in srgb, var(--nav-ink) 5%, transparent); }
|
|
148
148
|
:root[data-visual-theme] .app-mode .topbar .tn-group.active > .tn-group-button { color: var(--nav-accent); }
|
|
149
149
|
:root[data-visual-theme] .app-mode .topbar .tn-group.active > .tn-group-button::after { background: var(--nav-accent); }
|
|
150
|
+
:root[data-visual-theme] .app-mode .topbar .workspace-tab[aria-current="page"]::after { background: var(--nav-accent); }
|
|
150
151
|
:root[data-visual-theme] .app-mode .topbar .tn-group-button[aria-expanded="true"] { color: var(--nav-ink); background: color-mix(in srgb, var(--nav-ink) 7%, transparent); }
|
|
151
152
|
:root[data-visual-theme] .app-mode .topbar .mode { background: transparent; border-color: var(--nav-line); }
|
|
152
153
|
/* Danger is checked against the palette's surface, not an unrelated nav
|
|
@@ -329,8 +330,10 @@
|
|
|
329
330
|
color: var(--nav-ink);
|
|
330
331
|
}
|
|
331
332
|
/* A top bar's menu: its entries and the folded Menu stand on the bar, which wears nav.ground (above), so the same
|
|
332
|
-
inks; only the menu, since the search beside it is a field on the page's surface.
|
|
333
|
-
|
|
333
|
+
inks; only the menu, since the search beside it is a field on the page's surface. The workspaces' tabs stand on
|
|
334
|
+
the same bar (appChrome.js renderWorkspaces): left the page's ink, the current one was dark on a dark bar, and no
|
|
335
|
+
pair check read was the one drawn (a field report). */
|
|
336
|
+
:root[data-visual-theme] .app-mode .topbar :is(.tn-links, .workspace-host) {
|
|
334
337
|
--ink: var(--nav-ink);
|
|
335
338
|
--ink-muted: var(--nav-muted);
|
|
336
339
|
--ink-subtle: var(--nav-muted);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mistriwork/kit",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.47",
|
|
4
4
|
"description": "The shared React client both shells are drawn with: the walk and the address, Grid, Value, the record page, lists, filters and charts.",
|
|
5
5
|
"homepage": "https://mistriwork.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"./package.json": "./package.json"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@mistriwork/engine": "1.0.0-rc.
|
|
87
|
-
"@mistriwork/ui": "1.0.0-rc.
|
|
86
|
+
"@mistriwork/engine": "1.0.0-rc.47",
|
|
87
|
+
"@mistriwork/ui": "1.0.0-rc.47",
|
|
88
88
|
"intl-messageformat": "12.1.2",
|
|
89
89
|
"qrcode-generator": "^2.0.4"
|
|
90
90
|
},
|