@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
|
@@ -11,6 +11,13 @@ const TITLE_TEXT = 240;
|
|
|
11
11
|
const SECONDARY_TEXT = 120;
|
|
12
12
|
/** How much wider a figure sets in the totals row's 600 weight than in a cell's 400 (features.css). */
|
|
13
13
|
const TOTAL_WEIGHT = 1.1;
|
|
14
|
+
/** What a secondary text column keeps when it is cut: its padding and about ten characters, so a person's name is cut
|
|
15
|
+
to a first name and a letter, never to "T…". A column whose values are shorter keeps their width. */
|
|
16
|
+
const CUT_FLOOR = 96;
|
|
17
|
+
/** A cell's padding where none was measured: 12px a side. */
|
|
18
|
+
const CELL_PAD = 24;
|
|
19
|
+
/** What a head keeps of its label when it is cut: about four letters and the ellipsis. */
|
|
20
|
+
const HEAD_KEEP = 36;
|
|
14
21
|
/** An avatar's disc (24px) and the gap before its name. */
|
|
15
22
|
const AVATAR_WIDTH = 32;
|
|
16
23
|
/** How wide a head's characters set: a sentence-case label in the interface
|
|
@@ -19,18 +26,10 @@ const AVATAR_WIDTH = 32;
|
|
|
19
26
|
`--grid-head-char` (themeFamilies.css), which the grid reads where it
|
|
20
27
|
measures its room. */
|
|
21
28
|
export const GRID_HEAD_CHAR = 7;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export function twoLineWidth(label, width) {
|
|
27
|
-
const words = label.split(/\s+/).filter(Boolean);
|
|
28
|
-
if (words.length < 2)
|
|
29
|
-
return width(label);
|
|
30
|
-
let best = width(label);
|
|
31
|
-
for (let at = 1; at < words.length; at++)
|
|
32
|
-
best = Math.min(best, Math.max(width(words.slice(0, at).join(' ')), width(words.slice(at).join(' '))));
|
|
33
|
-
return best;
|
|
29
|
+
/** Whether every value is digits in groups: figures with the marks that set them apart, and nothing to read as words. */
|
|
30
|
+
export function isGroupedNumber(values) {
|
|
31
|
+
const said = values.filter((text) => text.trim() !== '');
|
|
32
|
+
return said.length > 0 && said.every((text) => text.length <= 24 && /\d/.test(text) && /^[\d\s()+\-./#x]+$/i.test(text));
|
|
34
33
|
}
|
|
35
34
|
/** Bounded hints: readable minima survive small containers. Text is measured in
|
|
36
35
|
the cells' own font where the grid can (`measure`); without it, a character
|
|
@@ -41,14 +40,17 @@ export function columnSizeHint(column, headChar = GRID_HEAD_CHAR, measure, squee
|
|
|
41
40
|
edge, which the sort never reaches under (style.css); a reference's arrow beside the label is room too (`mark`).
|
|
42
41
|
Its menu caret and its move buttons stand past the label's end where a pointer hovers, so they are not reserved. */
|
|
43
42
|
const counted = Math.min(column.label.length, 22) * headChar;
|
|
44
|
-
|
|
43
|
+
/* Never less than the room a head had before it was measured: only a look that draws more is given more. */
|
|
44
|
+
const drawn = column.headPad === undefined ? 0 : Math.ceil(column.headPad + 4 + (column.arrow ?? 8));
|
|
45
|
+
const around = (column.controls ? Math.max(34, drawn) : 28) + (column.mark ?? 0) + (column.touchControls ?? 0);
|
|
45
46
|
const header = Math.ceil(column.headWidth === undefined ? counted : Math.min(column.headWidth, counted * 1.15)) + around;
|
|
46
|
-
/*
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
/* A head wider than what its column draws gives way before any value does (giveWay): cut to about four letters
|
|
48
|
+
and an ellipsis, its whole label in its sort's title. "Listed online" over a tick is the head to cut, not the
|
|
49
|
+
resident's name three columns before it. */
|
|
50
|
+
const headFloor = Math.min(header, around + HEAD_KEEP);
|
|
51
|
+
/* What a cell stands its value off its edges by: measured, the cell's own padding (Grid.tsx); unmeasured, 12px a
|
|
52
|
+
side. Four pixels a column past the padding every look draws added up to a name cut in a ten-column list. */
|
|
53
|
+
const pad = column.pad ?? CELL_PAD;
|
|
52
54
|
const sample = (values = []) => values
|
|
53
55
|
.slice(0, GRID_SIZE_SAMPLE)
|
|
54
56
|
.filter((value) => value != null)
|
|
@@ -69,12 +71,13 @@ export function columnSizeHint(column, headChar = GRID_HEAD_CHAR, measure, squee
|
|
|
69
71
|
/* A second line asks for room, never lowers the floor: an email under a
|
|
70
72
|
name wants its width, but a narrow panel still keeps the name's minimum.
|
|
71
73
|
It is set a size down (12.5px under 14px). */
|
|
72
|
-
const under = (measure ? Math.ceil(widest(column.subValues, 0.9)) : longest(column.subValues) * 7) +
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
least
|
|
77
|
-
|
|
74
|
+
const under = (measure ? Math.ceil(widest(column.subValues, 0.9)) : longest(column.subValues) * 7) + pad;
|
|
75
|
+
/* A column whose values are never cut (a mark, a date, a figure): as wide as they are, or as its head. */
|
|
76
|
+
const fixed = (body) => {
|
|
77
|
+
const minimum = Math.max(header, body);
|
|
78
|
+
const least = Math.max(body, headFloor);
|
|
79
|
+
return { minimum, wanted: minimum, least, head: minimum - least };
|
|
80
|
+
};
|
|
78
81
|
/* A date or a number said in a display rule's own words — "4 weeks ago", a priority's chip — is as wide as
|
|
79
82
|
those words measure. Its usual width held a relative date at 112px and a one-digit chip at 97px while the
|
|
80
83
|
name and the owner beside them were cut: the room went to the columns that could not use it. A date or a
|
|
@@ -83,42 +86,44 @@ export function columnSizeHint(column, headChar = GRID_HEAD_CHAR, measure, squee
|
|
|
83
86
|
/* A yes-or-no is a mark, 64px, unless its display says it in words: an SLA's "On track" and "Breached" in tone
|
|
84
87
|
chips were held to the mark's width and cut to "On trac…" (G187). Said in words, it is as wide as they are. */
|
|
85
88
|
if (column.kind === 'boolean') {
|
|
86
|
-
const width = (column.chip || column.dressed) && sample(column.values).length > 0 ? Math.min(264, textWidth +
|
|
87
|
-
return fixed(
|
|
89
|
+
const width = (column.chip || column.dressed) && sample(column.values).length > 0 ? Math.min(264, textWidth + pad) : 64;
|
|
90
|
+
return fixed(width);
|
|
88
91
|
}
|
|
89
92
|
if (column.kind === 'date') {
|
|
90
93
|
const usual = column.showTime ? 176 : 112;
|
|
91
94
|
/* Drawn by the cell in its own font, a date is as wide as it measures: the data face runs wider than the sans
|
|
92
|
-
the usual width was set for, and "Aug 22, 2026" was cut to "Aug 22, 20…" at 1280.
|
|
93
|
-
|
|
95
|
+
the usual width was set for, and "Aug 22, 2026" was cut to "Aug 22, 20…" at 1280. A narrower face gives the
|
|
96
|
+
room back, down to a floor a page of short dates ("May 1, 2026") cannot take it under: the next page's
|
|
97
|
+
"Sep 28, 2026" stands in the same column. */
|
|
94
98
|
const width = measured && column.dressed
|
|
95
|
-
? Math.min(usual, textWidth +
|
|
99
|
+
? Math.min(usual, textWidth + pad)
|
|
96
100
|
: measured && column.drawnDate
|
|
97
|
-
? Math.max(usual, Math.min(column.showTime ? 240 : 176, textWidth +
|
|
101
|
+
? Math.max(usual - 16, Math.min(column.showTime ? 240 : 176, textWidth + pad))
|
|
98
102
|
: usual;
|
|
99
|
-
return fixed(
|
|
103
|
+
return fixed(width);
|
|
100
104
|
}
|
|
101
105
|
/* A number measured as it is drawn ("$22,495", "18,340 mi") is as wide as
|
|
102
106
|
those figures: counted at 8px a character with four to spare, Forecourt's
|
|
103
107
|
price, miles and days held 56px each past their figures while the car's
|
|
104
108
|
name beside them was cut to "2024 Toyota C…". */
|
|
105
109
|
if (column.kind === 'number') {
|
|
106
|
-
const width = measured && (column.chip || column.dressed) ? Math.min(264, textWidth +
|
|
107
|
-
return fixed(
|
|
110
|
+
const width = measured && (column.chip || column.dressed) ? Math.min(264, textWidth + pad) : Math.min(264, Math.max(88, (length + 4) * 8 + 24));
|
|
111
|
+
return fixed(width);
|
|
112
|
+
}
|
|
113
|
+
/* A number set in groups (a telephone number, a card's last digits, a part number of digits) is a number that
|
|
114
|
+
happens to be stored as text: it is never cut and never broken at its spaces (docs/design.md, Truncation), so
|
|
115
|
+
its column is as wide as its widest value, measured or, before the cells' face has loaded, counted. Held to a
|
|
116
|
+
text's floor it wrapped "(720) 555-" over "4381" in a look whose cells are a size up, where every other column
|
|
117
|
+
kept one line. */
|
|
118
|
+
if (isGroupedNumber(sample(column.values))) {
|
|
119
|
+
const width = Math.min(264, textWidth + pad);
|
|
120
|
+
return fixed(width);
|
|
108
121
|
}
|
|
109
122
|
/* Past about 24 characters a text is a sentence that may be cut, not a name
|
|
110
123
|
that must be whole: 24 characters of a 14px sans measure about 168px. At
|
|
111
124
|
190 a 25-character name in a heavier first column kept its whole width
|
|
112
125
|
and four columns of minima ran past a half-width panel. */
|
|
113
126
|
const verbose = measure ? textWidth > 168 : length > 24;
|
|
114
|
-
/* Its values on two lines, each broken at its best word: the widest of them is the floor it may take. */
|
|
115
|
-
const wrapped = column.wrapValues && !column.chip
|
|
116
|
-
? (measure
|
|
117
|
-
? Math.ceil(sample(column.values).reduce((max, text) => Math.max(max, twoLineWidth(text, measure)), 0))
|
|
118
|
-
: sample(column.values).reduce((max, text) => Math.max(max, twoLineWidth(text, (part) => part.length * 8)), 0)) +
|
|
119
|
-
24 +
|
|
120
|
-
(column.avatar ? AVATAR_WIDTH : 0)
|
|
121
|
-
: undefined;
|
|
122
127
|
/* The row's name holds up to TITLE_TEXT as its floor; every other text
|
|
123
128
|
column holds at most SECONDARY_TEXT and asks for the rest as room it
|
|
124
129
|
wants, so when a table is tight the secondary columns are the ones cut.
|
|
@@ -128,74 +133,60 @@ export function columnSizeHint(column, headChar = GRID_HEAD_CHAR, measure, squee
|
|
|
128
133
|
sideways anyway, so nothing was gained for the cut. */
|
|
129
134
|
// A tone chip is a short word that is never cut; it keeps its whole width.
|
|
130
135
|
const floor = (title) => (title ? TITLE_TEXT : column.chip ? 216 : verbose ? 128 : SECONDARY_TEXT);
|
|
131
|
-
|
|
136
|
+
/* Measured, a short key ("AC-101") is as wide as it is; counted, a column keeps 80px against a guess that ran short. */
|
|
137
|
+
const body = Math.min(floor(Boolean(column.title)), Math.max(measure ? 56 : 80, textWidth + pad));
|
|
138
|
+
const minimum = Math.max(header, body);
|
|
132
139
|
/* What a secondary text column gives way to before the table scrolls: its
|
|
133
140
|
head. A dealer's name cut at the head's width reads better than a table
|
|
134
141
|
that scrolls 45px to show the rest of it at the edge. */
|
|
135
142
|
/* In a column of its own (an aside's list, a half-width block) the name is the last to give way, not a floor under
|
|
136
143
|
the table: where the kept columns still run past the room, the name is cut to an ellipsis at its head's width
|
|
137
144
|
rather than the table scrolled sideways under cut-off heads. */
|
|
138
|
-
const least = column.chip
|
|
139
|
-
?
|
|
145
|
+
const least = column.chip || (column.title && !squeezeName)
|
|
146
|
+
? Math.max(body, headFloor)
|
|
140
147
|
: column.title
|
|
141
|
-
?
|
|
142
|
-
|
|
143
|
-
: minimum
|
|
144
|
-
: Math.max(headLeast, Math.min(minimum, 80));
|
|
148
|
+
? Math.max(header, Math.min(minimum, SECONDARY_TEXT - 24))
|
|
149
|
+
: Math.max(headFloor, Math.min(body, CUT_FLOOR + (column.avatar ? AVATAR_WIDTH : 0)));
|
|
145
150
|
return {
|
|
146
151
|
minimum,
|
|
147
152
|
least,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
wraps its values rather than cutting them (fitGridColumns). */
|
|
151
|
-
...(wrapped !== undefined ? { whole: textWidth + 24, twoLines: wrapped } : {}),
|
|
153
|
+
head: Math.max(0, minimum - Math.max(body, headFloor)),
|
|
154
|
+
wanted: Math.max(minimum, header, Math.min(READABLE_TEXT, Math.max(textWidth + pad, under))),
|
|
152
155
|
};
|
|
153
156
|
}
|
|
154
157
|
/**
|
|
155
|
-
* The hints for a grid's columns
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
158
|
+
* The hints for a grid's columns. A table is fitted to its room in this order, each step taken only where the one
|
|
159
|
+
* before still runs past it (docs/design.md, Standing layout rules): every head and value whole on one line; the
|
|
160
|
+
* secondary text given way to its floor, the last column first, cut with its whole value on hover; and only then the
|
|
161
|
+
* columns that still do not fit folded under the row's name or left out (keepFitting). Nothing wraps: a row is one
|
|
162
|
+
* line at every width a table is drawn at.
|
|
160
163
|
*/
|
|
161
164
|
function sizeHints(columns, room, headChar, measure, squeezeName = false, cut = true) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
...column,
|
|
165
|
-
wrapHead: heads && column.wrapHead,
|
|
166
|
-
wrapValues: column.wrapValues && (values === 'all' || (values === 'title' && Boolean(column.title))),
|
|
167
|
-
}, headChar, measure && ((text) => measure(text, index)), squeezeName));
|
|
168
|
-
/* Whether the secondary text may be cut to its head to spare the room. A table that can fold its columns asks no:
|
|
169
|
-
the documented order folds before it cuts, and a table sized as cut already fits, so it never folds one. */
|
|
170
|
-
const way = (list, space) => (cut ? giveWay(list, space) : list);
|
|
171
|
-
const fits = (list) => list.reduce((sum, hint) => sum + hint.minimum, 0) <= room;
|
|
172
|
-
const whole = hints(false, 'none');
|
|
173
|
-
if (fits(whole) || !columns.some((column) => column.wrapHead || column.wrapValues))
|
|
174
|
-
return way(whole, room);
|
|
175
|
-
const heads = hints(true, 'none');
|
|
176
|
-
if (fits(heads) || !columns.some((column) => column.wrapValues))
|
|
177
|
-
return way(heads, room);
|
|
178
|
-
/* The row's name is the most important text in the row, so it takes its second line before a short secondary value
|
|
179
|
-
(a person's two-word name) is given one: the others keep their floors while the name's alone still spares the room. */
|
|
180
|
-
const named = hints(true, 'title');
|
|
181
|
-
if (columns.some((column) => column.title && column.wrapValues) && fits(named))
|
|
182
|
-
return way(named, room);
|
|
183
|
-
return way(hints(true, 'all'), room);
|
|
165
|
+
const hints = columns.map((column, index) => columnSizeHint(column, headChar, measure && ((text) => measure(text, index)), squeezeName));
|
|
166
|
+
return cut ? giveWay(hints, room) : hints;
|
|
184
167
|
}
|
|
185
|
-
/* Where the minima together run past the room, the
|
|
186
|
-
|
|
187
|
-
figures never do. Where giving way would not spare the scroll, nothing is
|
|
188
|
-
|
|
168
|
+
/* Where the minima together run past the room, the heads wider than their columns' values give way first, the
|
|
169
|
+
last first, and then the secondary text columns, the last first, down to their floors; the name, the chips and
|
|
170
|
+
the figures never do. Where giving way would not spare the scroll, nothing is cut for it: a phone's table cut a
|
|
171
|
+
SKU to "BAG-FRB-…" and scrolled anyway. */
|
|
189
172
|
function giveWay(hints, room) {
|
|
190
173
|
let over = hints.reduce((sum, hint) => sum + hint.minimum, 0) - room;
|
|
191
174
|
if (over <= 0 || hints.reduce((sum, hint) => sum + hint.least, 0) > room)
|
|
192
175
|
return hints;
|
|
193
176
|
const given = [...hints];
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
177
|
+
const give = (most, head) => {
|
|
178
|
+
for (let i = given.length - 1; i >= 0 && over > 0; i--) {
|
|
179
|
+
const less = Math.min(over, most(given[i]));
|
|
180
|
+
/* What a head gave it does not ask back: left wanting it, the head stood among the columns cut short and took
|
|
181
|
+
the room a value was then lent (lendHeads), so the head stayed whole and the name beside it stayed cut. */
|
|
182
|
+
given[i] = head
|
|
183
|
+
? { ...given[i], minimum: given[i].minimum - less, wanted: given[i].wanted - less, head: given[i].head - less }
|
|
184
|
+
: { ...given[i], minimum: given[i].minimum - less };
|
|
185
|
+
over -= less;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
give((hint) => Math.min(hint.head, hint.minimum - hint.least), true);
|
|
189
|
+
give((hint) => hint.minimum - hint.least, false);
|
|
199
190
|
return given;
|
|
200
191
|
}
|
|
201
192
|
/**
|
|
@@ -207,11 +198,14 @@ function giveWay(hints, room) {
|
|
|
207
198
|
* which was the one a reader came to it for. Null when all fit, or before
|
|
208
199
|
* the room is measured.
|
|
209
200
|
*/
|
|
210
|
-
export function keepFitting(columns, available, expandable = false, trailing = false, headChar = GRID_HEAD_CHAR, measure
|
|
201
|
+
export function keepFitting(columns, available, expandable = false, trailing = false, headChar = GRID_HEAD_CHAR, measure,
|
|
202
|
+
/* An App's own list cuts its secondary text to its floor before it folds a column (sizeHints); an embedded grid
|
|
203
|
+
leaves a column out before it cuts one, as it always did. */
|
|
204
|
+
cut = false) {
|
|
211
205
|
if (!(available > 0))
|
|
212
206
|
return null;
|
|
213
207
|
let room = available - (expandable ? GRID_EXPANDER_WIDTH : 0) - (trailing ? GRID_TRAIL_WIDTH : 0);
|
|
214
|
-
const hints = sizeHints(columns, room, headChar, measure, false,
|
|
208
|
+
const hints = sizeHints(columns, room, headChar, measure, false, cut);
|
|
215
209
|
if (hints.reduce((sum, hint) => sum + hint.minimum, 0) <= room)
|
|
216
210
|
return null;
|
|
217
211
|
const kept = columns.map((column, index) => index === 0 || Boolean(column.title) || Boolean(column.status));
|
|
@@ -261,15 +255,41 @@ export function holdFold(held, next, width, of) {
|
|
|
261
255
|
const NEARLY_WHOLE = 40;
|
|
262
256
|
/* What a tone chip draws beyond its words, measured (see columnSizeHint). */
|
|
263
257
|
const CHIP_EXTRA = 40;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
258
|
+
/* Where the columns fit and a value is still a few pixels short of whole — a resident's "Lucas Mendoza" cut to
|
|
259
|
+
"Lucas Mendo…" under capital heads that held 113px for "ASKING RENT" over "$1,285" — the heads wider than their
|
|
260
|
+
values lend it the difference, the last first: a head gives way before a value does (giveWay), here as there. Only
|
|
261
|
+
to a column nearly whole, so a long description's wish for a readable line never cuts a table's heads. */
|
|
262
|
+
function lendHeads(hints, room) {
|
|
263
|
+
if (!Number.isFinite(room))
|
|
264
|
+
return hints;
|
|
265
|
+
const spare = room - hints.reduce((sum, hint) => sum + hint.minimum, 0);
|
|
266
|
+
const nearly = hints.reduce((sum, hint) => {
|
|
267
|
+
const lacks = hint.wanted - hint.minimum;
|
|
268
|
+
return lacks > 0 && lacks <= NEARLY_WHOLE ? sum + lacks : sum;
|
|
269
|
+
}, 0);
|
|
270
|
+
const owed = nearly - Math.max(0, spare);
|
|
271
|
+
return owed <= 0 || spare < 0 ? hints : lendFromHeads(hints, owed);
|
|
272
|
+
}
|
|
273
|
+
/* `owed` pixels taken from the heads wider than their values, the last first; the same hints where none has any. */
|
|
274
|
+
function lendFromHeads(hints, owed) {
|
|
275
|
+
let lent;
|
|
276
|
+
for (let i = hints.length - 1; i >= 0 && owed > 0; i--) {
|
|
277
|
+
const hint = (lent ?? hints)[i];
|
|
278
|
+
const less = Math.min(owed, hint.head, hint.minimum - hint.least);
|
|
279
|
+
if (less <= 0)
|
|
280
|
+
continue;
|
|
281
|
+
lent ??= [...hints];
|
|
282
|
+
/* Lent, not kept wanting: the room it gave is the value's, and a lender that still wanted it took it back first,
|
|
283
|
+
as the column least short (shareRoom). */
|
|
284
|
+
lent[i] = { ...hint, minimum: hint.minimum - less, wanted: hint.wanted - less, head: hint.head - less };
|
|
285
|
+
owed -= less;
|
|
286
|
+
}
|
|
287
|
+
return lent ?? hints;
|
|
288
|
+
}
|
|
289
|
+
/* What each column is given of the room past the minima (`filling`), and what is then left to spread evenly. */
|
|
290
|
+
function shareRoom(hints, named, extra) {
|
|
270
291
|
const short = hints.reduce((sum, hint) => sum + hint.wanted - hint.minimum, 0);
|
|
271
292
|
const filling = Math.min(extra, short);
|
|
272
|
-
const spare = extra - filling;
|
|
273
293
|
/* A column a few pixels short of whole is made whole first — an owner's
|
|
274
294
|
"Karen Olstad" short by 20px — then the row's name, up to its readable
|
|
275
295
|
width: Thread's issues cut every name at 274px while Status, Project and
|
|
@@ -281,7 +301,6 @@ export function fitGridColumns(columns, available, expandable = false, trailing
|
|
|
281
301
|
.map((hint, index) => ({ index, lacks: hint.wanted - hint.minimum }))
|
|
282
302
|
.filter(({ lacks }) => lacks > 0)
|
|
283
303
|
.sort((a, b) => a.lacks - b.lacks);
|
|
284
|
-
const named = columns.findIndex((column) => column.title);
|
|
285
304
|
for (const { index, lacks } of lacking) {
|
|
286
305
|
if (index === named || lacks > NEARLY_WHOLE || lacks > left)
|
|
287
306
|
continue;
|
|
@@ -298,21 +317,41 @@ export function fitGridColumns(columns, available, expandable = false, trailing
|
|
|
298
317
|
given[index] = share;
|
|
299
318
|
left -= share;
|
|
300
319
|
});
|
|
320
|
+
return { given, spare: extra - filling };
|
|
321
|
+
}
|
|
322
|
+
export function fitGridColumns(columns, available, expandable = false, trailing = false, headChar = GRID_HEAD_CHAR, measure, squeezeName = false) {
|
|
323
|
+
const gutter = (expandable ? GRID_EXPANDER_WIDTH : 0) + (trailing ? GRID_TRAIL_WIDTH : 0);
|
|
324
|
+
const room = Number.isFinite(available) ? Math.floor(available) - gutter : Infinity;
|
|
325
|
+
let hints = lendHeads(sizeHints(columns, room, headChar, measure, squeezeName), room);
|
|
326
|
+
const named = columns.findIndex((column) => column.title);
|
|
327
|
+
const fill = () => {
|
|
328
|
+
const minimum = hints.reduce((sum, hint) => sum + hint.minimum, gutter);
|
|
329
|
+
const width = Math.max(minimum, Number.isFinite(available) ? Math.floor(available) : 0);
|
|
330
|
+
return { width, extra: width - minimum, ...shareRoom(hints, named, width - minimum) };
|
|
331
|
+
};
|
|
332
|
+
let filled = fill();
|
|
333
|
+
/* A value the shared room still leaves a few pixels short — an email cut to "marcus.morales@example.te…" beside
|
|
334
|
+
"RESIDENT SINCE" over a date — is lent the rest by the heads wider than their values, as a value short before
|
|
335
|
+
the sharing is (lendHeads): the room is shared once more with what they lent. */
|
|
336
|
+
if (Number.isFinite(room)) {
|
|
337
|
+
const still = hints.reduce((sum, hint, index) => {
|
|
338
|
+
const lacks = hint.wanted - hint.minimum - filled.given[index];
|
|
339
|
+
return lacks > 0 && lacks <= NEARLY_WHOLE ? sum + lacks : sum;
|
|
340
|
+
}, 0);
|
|
341
|
+
const lent = still > 0 ? lendFromHeads(hints, still) : hints;
|
|
342
|
+
if (lent !== hints) {
|
|
343
|
+
hints = lent;
|
|
344
|
+
filled = fill();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const { width, extra, given, spare } = filled;
|
|
301
348
|
let remaining = extra;
|
|
302
349
|
const sizes = hints.map((hint, index) => {
|
|
303
350
|
const share = index === hints.length - 1 ? remaining : given[index] + Math.floor(spare / hints.length);
|
|
304
351
|
remaining -= share;
|
|
305
352
|
return hint.minimum + share;
|
|
306
353
|
});
|
|
307
|
-
|
|
308
|
-
`td.wraps`): the value stays whole rather than cut. One given less than that is a sentence, and is cut. */
|
|
309
|
-
const wraps = columns.map((column, index) => {
|
|
310
|
-
if (!column.wrapValues)
|
|
311
|
-
return false;
|
|
312
|
-
const { whole, twoLines } = columnSizeHint({ ...column, wrapHead: false }, headChar, measure && ((text) => measure(text, index)));
|
|
313
|
-
return whole !== undefined && twoLines !== undefined && sizes[index] < whole && sizes[index] >= twoLines;
|
|
314
|
-
});
|
|
315
|
-
return { width, columns: sizes, wraps };
|
|
354
|
+
return { width, columns: sizes };
|
|
316
355
|
}
|
|
317
356
|
/**
|
|
318
357
|
* How many of a cell's tag chips are drawn whole in `room`: as many as fit
|
|
@@ -147,8 +147,9 @@ export interface SlotProps {
|
|
|
147
147
|
onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;
|
|
148
148
|
/** An empty related list said in one line with its neighbours: it draws its Add alone (PageEmptyRun.tsx). */
|
|
149
149
|
collapsed?: boolean;
|
|
150
|
-
/** A related list alone
|
|
151
|
-
|
|
150
|
+
/** A related list alone: it says its count beside its heading, as a tab would. `'seen'` on a page an author wrote,
|
|
151
|
+
where the figure is drawn and kept out of the heading's name (PageRelated.tsx, RelatedCount). */
|
|
152
|
+
counted?: boolean | 'seen';
|
|
152
153
|
}
|
|
153
154
|
/**
|
|
154
155
|
* How this reader's rows are named, as a record page's reads are built from
|
|
@@ -92,6 +92,8 @@ export interface PageSection {
|
|
|
92
92
|
subtitle?: string;
|
|
93
93
|
was?: string;
|
|
94
94
|
note?: string;
|
|
95
|
+
/** A summary's line under a figure, by its field (shared/pageModel.ts, PageFields.notes). */
|
|
96
|
+
notes?: Record<string, string>;
|
|
95
97
|
/** A similar list: rows of the page's own table sharing the record's `same` values, `near` its numbers. */
|
|
96
98
|
similar?: import('@mistriwork/engine/shared/pageModel.js').PageSimilar;
|
|
97
99
|
opens?: string;
|
|
@@ -16,8 +16,16 @@
|
|
|
16
16
|
*
|
|
17
17
|
* `answered` also says whether "nothing matches" may be said yet: an empty
|
|
18
18
|
* filtered list is not the server's answer.
|
|
19
|
+
*
|
|
20
|
+
* The rows on screen may name nothing the box now says: an editable field
|
|
21
|
+
* asks for its chosen record's label while it shows it, so when someone then
|
|
22
|
+
* types, the answer that lands first is for that label, and filtering it
|
|
23
|
+
* leaves nothing. The rows offered a moment ago that the box's text does name
|
|
24
|
+
* (`last`) stand in until the real answer lands: they were on screen, they
|
|
25
|
+
* pass the same rule, and without them the list went away for the length of
|
|
26
|
+
* the pause and came back, with a press on an option landing on the page.
|
|
19
27
|
*/
|
|
20
|
-
export declare function offeredChoices<T>({ typed, asked, placeholder, rows, label, }: {
|
|
28
|
+
export declare function offeredChoices<T>({ typed, asked, placeholder, rows, label, last, }: {
|
|
21
29
|
/** What the box says now. */
|
|
22
30
|
typed: string;
|
|
23
31
|
/** The text the rows on screen were asked for. */
|
|
@@ -26,6 +34,8 @@ export declare function offeredChoices<T>({ typed, asked, placeholder, rows, lab
|
|
|
26
34
|
placeholder?: boolean;
|
|
27
35
|
rows: T[] | undefined;
|
|
28
36
|
label: (row: T) => string;
|
|
37
|
+
/** The rows last offered, for when the rows on screen answer other text and name nothing the box says. */
|
|
38
|
+
last?: readonly T[];
|
|
29
39
|
}): {
|
|
30
40
|
choices: T[];
|
|
31
41
|
answered: boolean;
|
|
@@ -16,12 +16,22 @@
|
|
|
16
16
|
*
|
|
17
17
|
* `answered` also says whether "nothing matches" may be said yet: an empty
|
|
18
18
|
* filtered list is not the server's answer.
|
|
19
|
+
*
|
|
20
|
+
* The rows on screen may name nothing the box now says: an editable field
|
|
21
|
+
* asks for its chosen record's label while it shows it, so when someone then
|
|
22
|
+
* types, the answer that lands first is for that label, and filtering it
|
|
23
|
+
* leaves nothing. The rows offered a moment ago that the box's text does name
|
|
24
|
+
* (`last`) stand in until the real answer lands: they were on screen, they
|
|
25
|
+
* pass the same rule, and without them the list went away for the length of
|
|
26
|
+
* the pause and came back, with a press on an option landing on the page.
|
|
19
27
|
*/
|
|
20
|
-
export function offeredChoices({ typed, asked, placeholder = false, rows, label, }) {
|
|
28
|
+
export function offeredChoices({ typed, asked, placeholder = false, rows, label, last, }) {
|
|
21
29
|
const needle = typed.trim();
|
|
22
30
|
const answered = asked === needle && !placeholder;
|
|
23
31
|
if (answered)
|
|
24
32
|
return { choices: rows ?? [], answered };
|
|
25
33
|
const folded = needle.toLowerCase();
|
|
26
|
-
|
|
34
|
+
const named = (list) => list.filter((row) => label(row).toLowerCase().includes(folded));
|
|
35
|
+
const kept = named(rows ?? []);
|
|
36
|
+
return { choices: kept.length || !last ? kept : named(last), answered };
|
|
27
37
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The column a list titles its rows by (`primary` on a list view), handed down to where the rows are read as
|
|
3
|
+
* records. A record has one name everywhere (`recordLabel`); a list read by one person about their own things
|
|
4
|
+
* often wants another: a patient's visits are titled by the therapist, not by the patient on every row.
|
|
5
|
+
*/
|
|
6
|
+
import { createContext, useContext } from 'react';
|
|
7
|
+
export const RowTitleContext = createContext(undefined);
|
|
8
|
+
export function useRowTitle() {
|
|
9
|
+
return useContext(RowTitleContext);
|
|
10
|
+
}
|
|
@@ -5,6 +5,11 @@ let measuringContext;
|
|
|
5
5
|
number kept for the page's life sized every column from the wrong font, so a table's columns came out differently
|
|
6
6
|
from one load to the next, by whether the webfont beat the first measure. */
|
|
7
7
|
const measures = new Map();
|
|
8
|
+
/* A face may be declared after a text was measured in its name: a look's face sheet is fetched when the look is worn,
|
|
9
|
+
and until its @font-face is on the page `fonts.check` says the font is loaded, there being no declared face to
|
|
10
|
+
wait for. The fallback's widths were then kept under the font's name for the page's life, by whether the sheet
|
|
11
|
+
beat the first measure. Whatever was kept is let go each time a face arrives. */
|
|
12
|
+
globalThis.document?.fonts?.addEventListener?.('loadingdone', () => measures.clear());
|
|
8
13
|
/** Whether `font` is set in faces that are loaded (or that no `@font-face` declares: a system face). */
|
|
9
14
|
export function fontLoaded(font) {
|
|
10
15
|
try {
|
|
@@ -37,13 +42,77 @@ export function textMeasure(font) {
|
|
|
37
42
|
return seen;
|
|
38
43
|
context.font = font;
|
|
39
44
|
/* Cells set their figures tabular (themeFamilies.css), and a canvas cannot: measured proportional,
|
|
40
|
-
"$105,828" came out a few pixels short and its cell cut it to "$105,8…".
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
"$105,828" came out a few pixels short and its cell cut it to "$105,8…". Every figure is measured as a
|
|
46
|
+
zero, and each mark a tabular setting widens is given what it gains (`tabularGain`). */
|
|
47
|
+
let width = context.measureText(text.replace(/[0-9]/g, '0')).width;
|
|
48
|
+
if (/[0-9]/.test(text)) {
|
|
49
|
+
if (!gain) {
|
|
50
|
+
gain = new Map();
|
|
51
|
+
for (const [mark, more] of tabularGain(font))
|
|
52
|
+
gain.set(mark, context.measureText(mark).width * more);
|
|
53
|
+
}
|
|
54
|
+
if (gain.size)
|
|
55
|
+
for (const mark of text)
|
|
56
|
+
width += gain.get(mark >= '0' && mark <= '9' ? '0' : mark) ?? 0;
|
|
57
|
+
}
|
|
43
58
|
cache.set(text, width);
|
|
44
59
|
return width;
|
|
45
60
|
};
|
|
61
|
+
/* What each mark gains among tabular figures, in pixels of this font; read when the first figure is measured. */
|
|
62
|
+
let gain;
|
|
46
63
|
if (loaded)
|
|
47
64
|
measures.set(font, measure);
|
|
48
65
|
return measure;
|
|
49
66
|
}
|
|
67
|
+
/* The marks a face may draw wider among tabular figures: the figures themselves and what stands between them. */
|
|
68
|
+
const TABULAR_MARKS = ['0', '(', ')', '-', '+', '.', ',', ':', '/', '$', '%', ' '];
|
|
69
|
+
/**
|
|
70
|
+
* How much wider each mark sets among tabular figures than on its own, as a share of its own width, in `font`.
|
|
71
|
+
* A face whose own figures are proportional (Inter, a Mac's system face) draws a tabular figure wider than its
|
|
72
|
+
* zero and widens the brackets and the hyphen beside it: measured as zeros alone, "(720) 555-4381" came out five
|
|
73
|
+
* pixels short at 13px, and a look that sets a telephone number in its text face cut it to "(720) 555-43…".
|
|
74
|
+
* Read from the page once for a font, as a ratio of two spans in the same place, so the page's zoom cancels.
|
|
75
|
+
*/
|
|
76
|
+
function tabularGain(font) {
|
|
77
|
+
const gain = new Map();
|
|
78
|
+
try {
|
|
79
|
+
const bench = document.createElement('div');
|
|
80
|
+
bench.setAttribute('aria-hidden', 'true');
|
|
81
|
+
bench.style.cssText = `position:absolute;visibility:hidden;white-space:pre;font:${font}`;
|
|
82
|
+
const spans = TABULAR_MARKS.flatMap((mark) => [false, true].map((tabular) => {
|
|
83
|
+
const span = document.createElement('span');
|
|
84
|
+
span.style.cssText = `display:inline-block;font-variant-numeric:${tabular ? 'tabular-nums' : 'normal'}`;
|
|
85
|
+
// Between figures, since a face widens a mark only where it stands among them.
|
|
86
|
+
span.textContent = `0${mark}`.repeat(8);
|
|
87
|
+
bench.append(span);
|
|
88
|
+
return span;
|
|
89
|
+
}));
|
|
90
|
+
/* The shell's own body is no place to measure in: embedded, it is taken off the page while the host shows
|
|
91
|
+
something else, and what is measured there has no width.
|
|
92
|
+
host-global: two spans that carry their own font and are compared with each other; nothing of the shell's. */
|
|
93
|
+
document.body.append(bench);
|
|
94
|
+
// screen-px: two spans compared with each other, never fed to a style.
|
|
95
|
+
const widths = spans.map((span) => span.getBoundingClientRect().width);
|
|
96
|
+
bench.remove();
|
|
97
|
+
const zero = widths[0] > 0 ? widths[1] / widths[0] - 1 : 0;
|
|
98
|
+
if (zero > 0.001)
|
|
99
|
+
gain.set('0', zero);
|
|
100
|
+
TABULAR_MARKS.forEach((mark, index) => {
|
|
101
|
+
if (index === 0)
|
|
102
|
+
return;
|
|
103
|
+
const own = widths[index * 2];
|
|
104
|
+
const tabular = widths[index * 2 + 1];
|
|
105
|
+
/* The pair's gain less the figure's share of it is the mark's, said against the mark's own width. */
|
|
106
|
+
const pair = own > 0 ? (tabular - own) / 8 : 0;
|
|
107
|
+
const figure = widths[0] > 0 ? (widths[1] - widths[0]) / 16 : 0;
|
|
108
|
+
const markWidth = own / 8 - widths[0] / 16;
|
|
109
|
+
const more = markWidth > 0 ? (pair - figure) / markWidth : 0;
|
|
110
|
+
if (more > 0.001)
|
|
111
|
+
gain.set(mark, more);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// No page to read from: the zero's width stands, as before.
|
|
116
|
+
}
|
|
117
|
+
return gain;
|
|
118
|
+
}
|
|
@@ -4,6 +4,11 @@ import type { ConditionSpeaker } from './conditionWords.js';
|
|
|
4
4
|
interface ConditionWords {
|
|
5
5
|
speaker: ConditionSpeaker | null;
|
|
6
6
|
sayTails(speaker: ConditionSpeaker | null, column: string, tails: readonly string[]): string;
|
|
7
|
+
sayChip(speaker: ConditionSpeaker | null, column: string, tails: readonly string[]): {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
values?: string[];
|
|
11
|
+
};
|
|
7
12
|
sayCondition(speaker: ConditionSpeaker | null, condition: string): string;
|
|
8
13
|
sayFilter(speaker: ConditionSpeaker | null, filter: string): string[];
|
|
9
14
|
sayQuestion(speaker: ConditionSpeaker | null, text: string): string[];
|
|
@@ -55,6 +55,7 @@ let arriving;
|
|
|
55
55
|
const load = () => (arriving ??= import('./conditionWords.js').then((module) => (words = module)));
|
|
56
56
|
const AS_WRITTEN = {
|
|
57
57
|
sayTails: (_, column, tails) => written.tails(column, tails),
|
|
58
|
+
sayChip: (_, column, tails) => ({ label: '', value: written.tails(column, tails) }),
|
|
58
59
|
sayCondition: (_, condition) => written.condition(condition),
|
|
59
60
|
sayFilter: (_, filter) => written.filter(filter),
|
|
60
61
|
sayQuestion: (_, text) => written.question(text),
|
|
@@ -92,10 +93,11 @@ export function useConditionWords(table, texts) {
|
|
|
92
93
|
if (!base || !loaded)
|
|
93
94
|
return { speaker: null, ...AS_WRITTEN };
|
|
94
95
|
const known = new Map(wanted.map(({ column, id }, i) => [`${column}\n${id}`, names[i]?.data ?? undefined]));
|
|
95
|
-
const { sayTails, sayCondition, sayFilter, sayQuestion } = loaded;
|
|
96
|
+
const { sayTails, sayChip, sayCondition, sayFilter, sayQuestion } = loaded;
|
|
96
97
|
return {
|
|
97
98
|
speaker: { ...base, recordName: (column, id) => known.get(`${column}\n${id}`) ?? undefined },
|
|
98
99
|
sayTails,
|
|
100
|
+
sayChip,
|
|
99
101
|
sayCondition,
|
|
100
102
|
sayFilter,
|
|
101
103
|
sayQuestion,
|
|
@@ -128,6 +128,11 @@ export function useGridKeyboard(tableRef, wrapRef, opts) {
|
|
|
128
128
|
const onKey = (e) => {
|
|
129
129
|
if (e.target.closest('input, textarea, select, [contenteditable]'))
|
|
130
130
|
return;
|
|
131
|
+
/* A layer opened from the grid (a column's menu, a cell's listbox) may be drawn inside the table, where its
|
|
132
|
+
trigger is: its keys are its own. Taken here, Escape left the menu open and sent the focus to the filter,
|
|
133
|
+
and an arrow moved the cursor out from under the list. */
|
|
134
|
+
if (e.target.closest('[popover]'))
|
|
135
|
+
return;
|
|
131
136
|
if (e.altKey)
|
|
132
137
|
return;
|
|
133
138
|
/* A control inside the grid — a header's sort, a row's expander, what a
|