@mistriwork/kit 1.0.0-rc.41 → 1.0.0-rc.42
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.
|
@@ -12,7 +12,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
12
12
|
import { useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
13
13
|
import { createPortal } from 'react-dom';
|
|
14
14
|
import { activateDraft, applyStaged, applyingStaged, booleanChoices, canEditRow, cancelRecordAutosave, captureRecordAutosaveGuard, discardStaged, dismissSaveFeedback, draftNeedsReview, draftSchemaChanged, pendingCount, pendingColumns, refreshEditValidation, registerInput, retainedValues, resumeDraft, sameRow, stage, stagedAttempt, stagedDiscardVersion, stagedEditErrors, stagedFeedback, stagedOriginal, stagedValue, subscribeStaged, stagedVersion, suspendDraft, takeFieldFocus, } from '../write.js';
|
|
15
|
-
import { columnKind } from '@mistriwork/engine/shared/schema.js';
|
|
15
|
+
import { columnKind, isAppendOnly } from '@mistriwork/engine/shared/schema.js';
|
|
16
16
|
import { columnDisplay, columnLabel, findTable, prefersPages, refsFrom, state, toast } from '../core.js';
|
|
17
17
|
import { RichTextField, mentionSearch, pictureKeeper } from './RichTextField.js';
|
|
18
18
|
import { booleanWords, choiceWord, linkFor } from './valueModel.js';
|
|
@@ -114,6 +114,7 @@ export function Editable({ table, row, column, recordKey, onSaved, app = false,
|
|
|
114
114
|
enabled: app &&
|
|
115
115
|
shell().saveMode() === 'blur' &&
|
|
116
116
|
column.writable !== false &&
|
|
117
|
+
!isAppendOnly(table) &&
|
|
117
118
|
column.changesBy !== 'actions' &&
|
|
118
119
|
!applying &&
|
|
119
120
|
editorCurrent(isCurrent),
|
|
@@ -215,7 +216,7 @@ export function Editable({ table, row, column, recordKey, onSaved, app = false,
|
|
|
215
216
|
}, [pickerGeneration]);
|
|
216
217
|
// A mounted editor can receive a narrower policy while a field is open; a
|
|
217
218
|
// declared transition is the record's actions' to make, never an editor's.
|
|
218
|
-
if (column.writable === false || column.changesBy === 'actions')
|
|
219
|
+
if (column.writable === false || column.changesBy === 'actions' || isAppendOnly(table))
|
|
219
220
|
return _jsx(_Fragment, { children: display ? display(value) : _jsx("span", { children: value === null || value === undefined ? '—' : String(value) }) });
|
|
220
221
|
/* A document is not a line of text: a box would show `[object Object]`
|
|
221
222
|
and stage it back over the value. JSON is read here, never edited. */
|
|
@@ -223,7 +224,7 @@ export function Editable({ table, row, column, recordKey, onSaved, app = false,
|
|
|
223
224
|
if (json)
|
|
224
225
|
return _jsx(JsonView, { value: json.value, label: column.name });
|
|
225
226
|
const onEdit = (next) => {
|
|
226
|
-
if (applying || column.writable === false || column.changesBy === 'actions' || !editorCurrent(isCurrent))
|
|
227
|
+
if (applying || column.writable === false || column.changesBy === 'actions' || isAppendOnly(table) || !editorCurrent(isCurrent))
|
|
227
228
|
return;
|
|
228
229
|
setSaved(false);
|
|
229
230
|
// An empty box on a nullable column means NULL, not the empty string.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* of its cells edit, and most answer none.
|
|
6
6
|
*/
|
|
7
7
|
import type { ReactNode } from 'react';
|
|
8
|
-
import type
|
|
8
|
+
import { type ColumnMeta, type TableMeta } from '@mistriwork/engine/shared/schema.js';
|
|
9
9
|
/** How a cell draws a value: with no argument, as the grid drew it; with one, another value in the same dress. */
|
|
10
10
|
export type CellDraw = (next?: {
|
|
11
11
|
value: unknown;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { refsFrom } from '../core.js';
|
|
2
|
+
import { isAppendOnly } from '@mistriwork/engine/shared/schema.js';
|
|
2
3
|
/**
|
|
3
4
|
* The cells of a list a reader may edit in place, each drawn column to the
|
|
4
5
|
* column it writes: the view's `editable` (every shown column, or those
|
|
@@ -11,7 +12,8 @@ import { refsFrom } from '../core.js';
|
|
|
11
12
|
*/
|
|
12
13
|
export function editableCells(table, editable, shown) {
|
|
13
14
|
const cells = new Map();
|
|
14
|
-
|
|
15
|
+
// A table the reader only adds rows to has no cell to edit in place.
|
|
16
|
+
if (!table || !editable || table.isView || isAppendOnly(table))
|
|
15
17
|
return cells;
|
|
16
18
|
for (const drawn of shown) {
|
|
17
19
|
const hop = drawn.indexOf('.');
|
package/dist/client/delete.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* The button and its dialog are a component (components/DeleteButton.tsx); what
|
|
19
19
|
* stays here is the gate every write affordance shares.
|
|
20
20
|
*/
|
|
21
|
+
import { isAppendOnly } from '@mistriwork/engine/shared/schema.js';
|
|
21
22
|
import { state, writeAllowed } from './core.js';
|
|
22
23
|
/**
|
|
23
24
|
* Whether this connection will accept a delete at all.
|
|
@@ -27,7 +28,7 @@ import { state, writeAllowed } from './core.js';
|
|
|
27
28
|
* would refuse.
|
|
28
29
|
*/
|
|
29
30
|
export function canDelete(table) {
|
|
30
|
-
if (!state.canWrite || !table || table.isView || table.deletable === false)
|
|
31
|
+
if (!state.canWrite || !table || table.isView || table.deletable === false || isAppendOnly(table))
|
|
31
32
|
return false;
|
|
32
33
|
if (!writeAllowed(table.id))
|
|
33
34
|
return false;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* ask them without loading the draft machinery and its boot-time wiring.
|
|
6
6
|
* write.js re-exports both; the rules are these, once.
|
|
7
7
|
*/
|
|
8
|
+
import { isAppendOnly } from '@mistriwork/engine/shared/schema.js';
|
|
8
9
|
import { prefersPages, state, writeAllowed } from './core.js';
|
|
9
10
|
import { planColumn } from './columns.js';
|
|
10
11
|
import { pageBridge } from './uiBridge.js';
|
|
@@ -41,6 +42,9 @@ function frozenRow(tableId, row) {
|
|
|
41
42
|
export function canEditRow(table, key, row) {
|
|
42
43
|
if (!state.canWrite || !table || table.isView)
|
|
43
44
|
return false;
|
|
45
|
+
// An append-only table takes new rows and no edit (`create` without `write`): the server refuses one, so none is drawn.
|
|
46
|
+
if (isAppendOnly(table))
|
|
47
|
+
return false;
|
|
44
48
|
if (frozenRow(table.id, row))
|
|
45
49
|
return false;
|
|
46
50
|
if (prefersPages() && !writableConnection())
|
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.42",
|
|
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.42",
|
|
87
|
+
"@mistriwork/ui": "1.0.0-rc.42",
|
|
88
88
|
"intl-messageformat": "12.1.2",
|
|
89
89
|
"qrcode-generator": "^2.0.4"
|
|
90
90
|
},
|