@mistriwork/kit 1.0.0-rc.15 → 1.0.0-rc.17
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/components/CardsList.js +7 -1
- package/dist/client/components/ChartFigure.d.ts +3 -2
- package/dist/client/components/ChartFigure.js +7 -5
- package/dist/client/components/Export.js +8 -4
- package/dist/client/components/Grid.js +21 -2
- package/dist/client/components/JsonView.d.ts +2 -1
- package/dist/client/components/JsonView.js +2 -2
- package/dist/client/components/PageCurrent.d.ts +10 -1
- package/dist/client/components/PageCurrent.js +10 -6
- package/dist/client/components/PageFields.js +15 -4
- package/dist/client/components/PageHead.js +11 -9
- package/dist/client/components/PageHeadline.d.ts +3 -1
- package/dist/client/components/PageHeadline.js +3 -2
- package/dist/client/components/PageMetrics.js +13 -4
- package/dist/client/components/PageRelated.js +17 -2
- package/dist/client/components/PageSectionBox.js +6 -3
- package/dist/client/components/PageSections.js +1 -1
- package/dist/client/components/PageTimeline.js +29 -16
- package/dist/client/components/SecondLine.d.ts +15 -0
- package/dist/client/components/SecondLine.js +18 -0
- package/dist/client/components/Value.d.ts +3 -0
- package/dist/client/components/Value.js +32 -5
- package/dist/client/components/dashboardModel.d.ts +2 -2
- package/dist/client/components/jsonModel.d.ts +3 -0
- package/dist/client/components/jsonModel.js +8 -0
- package/dist/client/components/pageContext.js +2 -1
- package/dist/client/components/pageModel.d.ts +10 -5
- package/dist/client/components/textMeasure.d.ts +2 -0
- package/dist/client/components/textMeasure.js +16 -2
- package/dist/client/copy/record/components/PageTimeline.d.ts +1 -0
- package/dist/client/copy/record/components/PageTimeline.js +1 -0
- package/dist/client/copy/workbench/components/Export.d.ts +3 -2
- package/dist/client/copy/workbench/components/Export.js +3 -2
- package/dist/client/export.d.ts +5 -4
- package/dist/client/export.js +40 -19
- package/dist/client/features.css +2 -0
- package/dist/client/page.css +37 -2
- package/dist/client/shellMode.d.ts +6 -0
- package/dist/client/structure.css +7 -0
- package/package.json +4 -4
package/dist/client/export.js
CHANGED
|
@@ -22,11 +22,11 @@ import { scopeApiRequest } from './requestIdentity.js';
|
|
|
22
22
|
import { captureSessionIdentity } from './sessionIdentity.js';
|
|
23
23
|
import { say } from './copy/workbench/export.js';
|
|
24
24
|
import { portalRoot } from './shellHost.js';
|
|
25
|
+
import { shell } from './shellMode.js';
|
|
25
26
|
import { fetchServer } from './transport.js';
|
|
26
27
|
export { csvField };
|
|
27
|
-
/* Mirrors MAX_LIMIT in packages/engine/src/shared/reads.ts
|
|
28
|
-
|
|
29
|
-
rows "all matching" can actually mean. */
|
|
28
|
+
/* Mirrors MAX_LIMIT in packages/engine/src/shared/reads.ts: the most one `/api/run` reads, which is all an export
|
|
29
|
+
holds only where the server cannot stream the file (streamExport below); a streamed file has no ceiling. */
|
|
30
30
|
export const EXPORT_MAX_ROWS = MAX_LIMIT;
|
|
31
31
|
/** A CSV document: a header row of column names, then one row per record. */
|
|
32
32
|
export function toCsv(columns, rows) {
|
|
@@ -172,10 +172,11 @@ export function saveExport(kind, table, columns, rows) {
|
|
|
172
172
|
/**
|
|
173
173
|
* All matching rows, as a file the server streams (`POST /api/export`):
|
|
174
174
|
* read in batches and written as each arrives, so neither side holds the
|
|
175
|
-
* whole result as objects and nothing is counted.
|
|
176
|
-
*
|
|
177
|
-
* the policy
|
|
178
|
-
*
|
|
175
|
+
* whole result as objects and nothing is counted. A tenant's file is asked
|
|
176
|
+
* on its lease (the shell's `tenant.exportFile`); a row-policy App's is read
|
|
177
|
+
* through the policy like its list. False where the server does not offer
|
|
178
|
+
* it — a support visit, whose every read is ledgered whole — and the caller
|
|
179
|
+
* exports through `/api/run` as before.
|
|
179
180
|
*
|
|
180
181
|
* @param {'csv' | 'json'} kind
|
|
181
182
|
* @param {string} table
|
|
@@ -185,19 +186,9 @@ export function saveExport(kind, table, columns, rows) {
|
|
|
185
186
|
*/
|
|
186
187
|
export async function streamExport(kind, table, q, columns) {
|
|
187
188
|
const identity = captureSessionIdentity();
|
|
188
|
-
|
|
189
|
+
const res = identity.tenantRequired ? await onLease(kind, q, columns) : await ordinary(identity, kind, q, columns);
|
|
190
|
+
if (!res)
|
|
189
191
|
return false;
|
|
190
|
-
const { url, payload } = scopeApiRequest('/api/export', { q, format: kind, columns }, state.activeConnection);
|
|
191
|
-
const res = await fetchServer(url, {
|
|
192
|
-
method: 'POST',
|
|
193
|
-
credentials: 'same-origin',
|
|
194
|
-
cache: 'no-store',
|
|
195
|
-
headers: {
|
|
196
|
-
'content-type': 'application/json',
|
|
197
|
-
...(identity.mode === 'authenticated' ? { 'x-mistri-account': identity.accountId } : {}),
|
|
198
|
-
},
|
|
199
|
-
body: JSON.stringify(payload),
|
|
200
|
-
});
|
|
201
192
|
/* The file is the one answer with a disposition; anything else is JSON
|
|
202
193
|
saying why not — a refusal to fall back from, or the query's error. */
|
|
203
194
|
if (res.ok && res.headers.get('content-disposition')) {
|
|
@@ -215,3 +206,33 @@ export async function streamExport(kind, table, q, columns) {
|
|
|
215
206
|
const said = await res.json().catch(() => null);
|
|
216
207
|
throw new Error(said?.errors?.[0]?.message ?? said?.error ?? say('theExportCouldNotBeRead'));
|
|
217
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* @param {ReturnType<typeof captureSessionIdentity>} identity
|
|
211
|
+
* @param {'csv' | 'json'} kind
|
|
212
|
+
* @param {string} q
|
|
213
|
+
* @param {string[]} columns
|
|
214
|
+
*/
|
|
215
|
+
function ordinary(identity, kind, q, columns) {
|
|
216
|
+
const { url, payload } = scopeApiRequest('/api/export', { q, format: kind, columns }, state.activeConnection);
|
|
217
|
+
return fetchServer(url, {
|
|
218
|
+
method: 'POST',
|
|
219
|
+
credentials: 'same-origin',
|
|
220
|
+
cache: 'no-store',
|
|
221
|
+
headers: {
|
|
222
|
+
'content-type': 'application/json',
|
|
223
|
+
...(identity.mode === 'authenticated' ? { 'x-mistri-account': identity.accountId } : {}),
|
|
224
|
+
},
|
|
225
|
+
body: JSON.stringify(payload),
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The file on the tenant's lease, or undefined where the shell sends none (tenantTransport.ts `tenantExport`).
|
|
230
|
+
*
|
|
231
|
+
* @param {'csv' | 'json'} kind
|
|
232
|
+
* @param {string} q
|
|
233
|
+
* @param {string[]} columns
|
|
234
|
+
*/
|
|
235
|
+
async function onLease(kind, q, columns) {
|
|
236
|
+
const exportFile = shell().tenant?.exportFile;
|
|
237
|
+
return exportFile ? await exportFile({ q, format: kind, columns }) : undefined;
|
|
238
|
+
}
|
package/dist/client/features.css
CHANGED
|
@@ -1000,6 +1000,8 @@ button.ghost.dash-open:hover { color: var(--ink); background: none; }
|
|
|
1000
1000
|
/* The main line is cut as the second is, with an ellipsis: a link clipped mid-letter read as a typo. */
|
|
1001
1001
|
.cell-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1002
1002
|
.cell-sub { font: 400 var(--text-sm)/1.35 var(--sans); color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1003
|
+
.value-subtitled { display: inline-flex; flex-direction: column; min-width: 0; max-width: 100%; }
|
|
1004
|
+
.value-sub { font: 400 var(--text-sm)/1.35 var(--sans); color: var(--ink-muted); overflow-wrap: anywhere; }
|
|
1003
1005
|
td.dressed { white-space: nowrap; }
|
|
1004
1006
|
/* The columns an App's list could not hold, folded under the row's name (Grid.tsx `foldedOf`): each head and its value
|
|
1005
1007
|
kept together, the line wrapping between them rather than the table scrolling sideways. Said a size down, the
|
package/dist/client/page.css
CHANGED
|
@@ -813,6 +813,24 @@
|
|
|
813
813
|
.page-head-facts > .page-fact::before {
|
|
814
814
|
content: none;
|
|
815
815
|
}
|
|
816
|
+
/* Facts past the line wait in a disclosure of the head's own, under the line and in its column. Closed, it is one
|
|
817
|
+
row of the same height whoever opens it, and its summary is the quiet caption a fact's is; opened, the rest
|
|
818
|
+
wrap as the line does, never sideways. */
|
|
819
|
+
.page-head.has-record > .page-head-more {
|
|
820
|
+
grid-column: 1;
|
|
821
|
+
min-width: 0;
|
|
822
|
+
margin-top: var(--space-2);
|
|
823
|
+
font-size: var(--text-md);
|
|
824
|
+
}
|
|
825
|
+
.page-head-more > summary {
|
|
826
|
+
display: inline-block;
|
|
827
|
+
cursor: pointer;
|
|
828
|
+
font: 500 var(--text-sm)/1.4 var(--sans);
|
|
829
|
+
color: var(--ink-muted);
|
|
830
|
+
}
|
|
831
|
+
.page-head-more > .page-head-facts {
|
|
832
|
+
margin-top: var(--space-3);
|
|
833
|
+
}
|
|
816
834
|
.page-head-facts > .page-fact:has(> .page-fact-caption) {
|
|
817
835
|
flex-direction: column;
|
|
818
836
|
align-items: flex-start;
|
|
@@ -841,7 +859,7 @@
|
|
|
841
859
|
flex-basis: 100%;
|
|
842
860
|
margin-inline-start: 0;
|
|
843
861
|
}
|
|
844
|
-
.page-head.has-record > .page-head-facts {
|
|
862
|
+
.page-head.has-record > :is(.page-head-facts, .page-head-more) {
|
|
845
863
|
grid-column: 1 / -1;
|
|
846
864
|
order: -1;
|
|
847
865
|
}
|
|
@@ -873,7 +891,7 @@
|
|
|
873
891
|
flex-basis: 100%;
|
|
874
892
|
margin-inline-start: 0;
|
|
875
893
|
}
|
|
876
|
-
.page-head.has-record > .page-head-facts {
|
|
894
|
+
.page-head.has-record > :is(.page-head-facts, .page-head-more) {
|
|
877
895
|
grid-column: 1 / -1;
|
|
878
896
|
order: -1;
|
|
879
897
|
}
|
|
@@ -1915,6 +1933,10 @@
|
|
|
1915
1933
|
.timeline-fold-toggle[aria-expanded='true'] svg {
|
|
1916
1934
|
transform: rotate(90deg);
|
|
1917
1935
|
}
|
|
1936
|
+
.timeline-more {
|
|
1937
|
+
padding-block: var(--space-2) 0;
|
|
1938
|
+
min-height: 32px;
|
|
1939
|
+
}
|
|
1918
1940
|
.page-related-create.timeline-compose {
|
|
1919
1941
|
padding-block: 0 var(--space-2h);
|
|
1920
1942
|
}
|
|
@@ -3016,6 +3038,13 @@
|
|
|
3016
3038
|
outline: var(--focus-width) solid var(--focus);
|
|
3017
3039
|
outline-offset: -2px;
|
|
3018
3040
|
}
|
|
3041
|
+
/* The title's second line (its column's `subtitle`): another column of the record, said quietly and close under it. */
|
|
3042
|
+
.cards-subtitle {
|
|
3043
|
+
margin: calc(var(--space-1) - var(--space-2h)) 0 0;
|
|
3044
|
+
font: 400 var(--text-sm)/1.35 var(--sans);
|
|
3045
|
+
color: var(--ink-muted);
|
|
3046
|
+
overflow-wrap: anywhere;
|
|
3047
|
+
}
|
|
3019
3048
|
.cards-description {
|
|
3020
3049
|
margin: 0;
|
|
3021
3050
|
color: var(--ink-muted);
|
|
@@ -3321,6 +3350,12 @@
|
|
|
3321
3350
|
font: 500 calc(15px * var(--type-k)) var(--sans);
|
|
3322
3351
|
font-variant-numeric: tabular-nums;
|
|
3323
3352
|
}
|
|
3353
|
+
.page-headline-subtitle {
|
|
3354
|
+
display: block;
|
|
3355
|
+
margin-top: var(--space-1);
|
|
3356
|
+
color: var(--ink-muted);
|
|
3357
|
+
font: 500 var(--text-md)/1.4 var(--sans);
|
|
3358
|
+
}
|
|
3324
3359
|
.page-headline-sub .num-value {
|
|
3325
3360
|
font: inherit;
|
|
3326
3361
|
color: var(--ink);
|
|
@@ -50,6 +50,12 @@ interface TenantRequests {
|
|
|
50
50
|
read(path: string, body: Record<string, unknown> | undefined, connection: string | null | undefined): Promise<unknown>;
|
|
51
51
|
mutate(path: string, body: unknown, connection: string | null | undefined): Promise<unknown>;
|
|
52
52
|
isMutation(path: string): boolean;
|
|
53
|
+
/** The streamed export on the lease: the file, or the server's answer where it is not one. */
|
|
54
|
+
exportFile?(body: {
|
|
55
|
+
q: string;
|
|
56
|
+
format: string;
|
|
57
|
+
columns: readonly string[];
|
|
58
|
+
}): Promise<Response>;
|
|
53
59
|
}
|
|
54
60
|
/** How a tenant's links are read and written (tenantLink.ts). */
|
|
55
61
|
interface TenantLinks {
|
|
@@ -1291,6 +1291,13 @@
|
|
|
1291
1291
|
.page-section-bar > .page-section-head {
|
|
1292
1292
|
flex: 1 1 auto;
|
|
1293
1293
|
}
|
|
1294
|
+
/* A section's mark leads its heading, in the heading's quieter ink (a dashboard section's is the same, Chart.css). */
|
|
1295
|
+
.page-section-head .dash-section-icon {
|
|
1296
|
+
flex: none;
|
|
1297
|
+
margin-right: var(--space-3);
|
|
1298
|
+
vertical-align: -2px;
|
|
1299
|
+
color: var(--ink-muted);
|
|
1300
|
+
}
|
|
1294
1301
|
.page-section-bar > .page-related-create {
|
|
1295
1302
|
flex-wrap: wrap;
|
|
1296
1303
|
justify-content: flex-start;
|
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.17",
|
|
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": {
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"./package.json": "./package.json"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@mistriwork/engine": "1.0.0-rc.
|
|
86
|
-
"@mistriwork/ui": "1.0.0-rc.
|
|
85
|
+
"@mistriwork/engine": "1.0.0-rc.17",
|
|
86
|
+
"@mistriwork/ui": "1.0.0-rc.17",
|
|
87
87
|
"intl-messageformat": "12.1.2",
|
|
88
88
|
"qrcode-generator": "^2.0.4"
|
|
89
89
|
},
|
|
@@ -172,6 +172,6 @@
|
|
|
172
172
|
}
|
|
173
173
|
},
|
|
174
174
|
"engines": {
|
|
175
|
-
"node": ">=24
|
|
175
|
+
"node": ">=24"
|
|
176
176
|
}
|
|
177
177
|
}
|