@ai-matrx/records-ui 0.115.41 → 0.115.43
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +174 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +208 -143
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +1 -1
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
+
## 0.115.43
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/records-ui/v0.115.42..npm/records-ui/v0.115.43 -- apps/shared/records-ui`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## 0.115.42
|
|
10
|
+
|
|
11
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
12
|
+
`git diff npm/records-ui/v0.115.41..npm/records-ui/v0.115.42 -- apps/shared/records-ui`).
|
|
13
|
+
No source changes intended and no consumer action required.
|
|
14
|
+
|
|
3
15
|
## 0.115.41
|
|
4
16
|
|
|
5
17
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/index.cjs
CHANGED
|
@@ -2635,7 +2635,7 @@ function RefusalLine({ error, className }) {
|
|
|
2635
2635
|
import_design_system3.ErrorBox,
|
|
2636
2636
|
{
|
|
2637
2637
|
"data-refusal-line": "",
|
|
2638
|
-
className: (0, import_design_system3.cn)("text-xs text-destructive", className),
|
|
2638
|
+
className: (0, import_design_system3.cn)("whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]", className),
|
|
2639
2639
|
message: (0, import_core2.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : refusalLineForAPerson(error),
|
|
2640
2640
|
error,
|
|
2641
2641
|
origin: "records-ui/RefusalLine",
|
|
@@ -11907,6 +11907,102 @@ function useWhoChanged(fieldKey, recordId) {
|
|
|
11907
11907
|
};
|
|
11908
11908
|
}
|
|
11909
11909
|
|
|
11910
|
+
// src/gridHeldKeys.ts
|
|
11911
|
+
function isHeldKey(e) {
|
|
11912
|
+
if (e.metaKey || e.ctrlKey || e.altKey) return false;
|
|
11913
|
+
return e.key.length === 1 || e.key === "Tab" || e.key === "Enter" || e.key === "Backspace";
|
|
11914
|
+
}
|
|
11915
|
+
function splitHeldKeys(held) {
|
|
11916
|
+
let seed = "";
|
|
11917
|
+
let i = 0;
|
|
11918
|
+
for (; i < held.length; i++) {
|
|
11919
|
+
const k = held[i];
|
|
11920
|
+
if (k.key === "Tab" || k.key === "Enter") break;
|
|
11921
|
+
if (k.key === "Backspace") seed = seed.slice(0, -1);
|
|
11922
|
+
else seed += k.key;
|
|
11923
|
+
}
|
|
11924
|
+
return { seed, rest: held.slice(i) };
|
|
11925
|
+
}
|
|
11926
|
+
var EDITOR = "[data-matrx-cell-editor]";
|
|
11927
|
+
var CATCHER = "[data-matrx-type-catcher]";
|
|
11928
|
+
function typeInto(box, ch) {
|
|
11929
|
+
const proto = box instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
|
|
11930
|
+
const setValue = Object.getOwnPropertyDescriptor(proto, "value")?.set;
|
|
11931
|
+
const start = box.selectionStart ?? box.value.length;
|
|
11932
|
+
const end = box.selectionEnd ?? box.value.length;
|
|
11933
|
+
setValue?.call(box, box.value.slice(0, start) + ch + box.value.slice(end));
|
|
11934
|
+
box.setSelectionRange?.(start + ch.length, start + ch.length);
|
|
11935
|
+
box.dispatchEvent(new Event("input", { bubbles: true }));
|
|
11936
|
+
}
|
|
11937
|
+
function editorBox(scope) {
|
|
11938
|
+
const active = typeof document !== "undefined" ? document.activeElement : null;
|
|
11939
|
+
if ((active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) && active.closest(EDITOR)) return active;
|
|
11940
|
+
return scope.querySelector(
|
|
11941
|
+
`${EDITOR} textarea, ${EDITOR} input[type=text], ${EDITOR} input:not([type])`
|
|
11942
|
+
);
|
|
11943
|
+
}
|
|
11944
|
+
function holdKeys() {
|
|
11945
|
+
const held = [];
|
|
11946
|
+
const queue = [];
|
|
11947
|
+
const ours = /* @__PURE__ */ new WeakSet();
|
|
11948
|
+
const hold = (e) => {
|
|
11949
|
+
if (e.key === "Escape" && !ours.has(e)) {
|
|
11950
|
+
held.length = 0;
|
|
11951
|
+
queue.length = 0;
|
|
11952
|
+
return;
|
|
11953
|
+
}
|
|
11954
|
+
if (ours.has(e) || !isHeldKey(e)) return;
|
|
11955
|
+
const target = e.target instanceof Element ? e.target : null;
|
|
11956
|
+
if (target && target.closest("input, textarea, [contenteditable=true]") && !target.closest(`${CATCHER}, ${EDITOR}`)) return;
|
|
11957
|
+
e.preventDefault();
|
|
11958
|
+
e.stopPropagation();
|
|
11959
|
+
held.push({ key: e.key, shiftKey: e.shiftKey });
|
|
11960
|
+
};
|
|
11961
|
+
window.addEventListener("keydown", hold, true);
|
|
11962
|
+
let released = false;
|
|
11963
|
+
const release = () => {
|
|
11964
|
+
if (!released) window.removeEventListener("keydown", hold, true);
|
|
11965
|
+
released = true;
|
|
11966
|
+
return [...queue.splice(0), ...held.splice(0)];
|
|
11967
|
+
};
|
|
11968
|
+
const takeSeed = () => {
|
|
11969
|
+
const first = splitHeldKeys(held.splice(0));
|
|
11970
|
+
queue.push(...first.rest);
|
|
11971
|
+
return first.seed;
|
|
11972
|
+
};
|
|
11973
|
+
const deliver = async (scope) => {
|
|
11974
|
+
const editorOpen = () => Boolean(scope.querySelector(EDITOR));
|
|
11975
|
+
const until = async (done) => {
|
|
11976
|
+
for (let i = 0; i < 100 && !done(); i++) await new Promise((r) => setTimeout(r, 30));
|
|
11977
|
+
};
|
|
11978
|
+
await until(editorOpen);
|
|
11979
|
+
for (; ; ) {
|
|
11980
|
+
if (held.length > 0) queue.push(...held.splice(0));
|
|
11981
|
+
const next = queue.shift();
|
|
11982
|
+
if (!next) {
|
|
11983
|
+
await new Promise((r) => setTimeout(r, 60));
|
|
11984
|
+
if (held.length === 0) break;
|
|
11985
|
+
continue;
|
|
11986
|
+
}
|
|
11987
|
+
const wasOpen = editorOpen();
|
|
11988
|
+
const box = wasOpen ? editorBox(scope) : null;
|
|
11989
|
+
const catcher = !wasOpen ? scope.querySelector(CATCHER) : null;
|
|
11990
|
+
if (next.key.length === 1 && (box || catcher)) {
|
|
11991
|
+
typeInto(box ?? catcher, next.key);
|
|
11992
|
+
} else {
|
|
11993
|
+
const event = new KeyboardEvent("keydown", { key: next.key, shiftKey: next.shiftKey, bubbles: true, cancelable: true });
|
|
11994
|
+
ours.add(event);
|
|
11995
|
+
const to = box ?? catcher ?? document.activeElement ?? null;
|
|
11996
|
+
to?.dispatchEvent(event);
|
|
11997
|
+
}
|
|
11998
|
+
if (next.key === "Tab" || next.key === "Enter") await until(() => !editorOpen());
|
|
11999
|
+
else if (!wasOpen && next.key.length === 1) await until(editorOpen);
|
|
12000
|
+
else await new Promise((r) => setTimeout(r, 15));
|
|
12001
|
+
}
|
|
12002
|
+
};
|
|
12003
|
+
return { release, deliver, takeSeed };
|
|
12004
|
+
}
|
|
12005
|
+
|
|
11910
12006
|
// src/unsentWrites.ts
|
|
11911
12007
|
var import_react65 = require("react");
|
|
11912
12008
|
var UNSENT_LINE = "Not saved";
|
|
@@ -12428,20 +12524,29 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
12428
12524
|
const addRecord = (0, import_react66.useCallback)(async () => {
|
|
12429
12525
|
setBusy(true);
|
|
12430
12526
|
setRowError(null);
|
|
12527
|
+
const hold = holdKeys();
|
|
12431
12528
|
const written = await client.recordWrite({ table_id: tableId, data: {} });
|
|
12432
12529
|
setBusy(false);
|
|
12433
12530
|
if (!written.ok) {
|
|
12531
|
+
hold.release();
|
|
12434
12532
|
setRowError(written.error);
|
|
12435
12533
|
return written.error;
|
|
12436
12534
|
}
|
|
12437
12535
|
reload();
|
|
12438
12536
|
const first = order[0];
|
|
12537
|
+
if (!first) hold.release();
|
|
12439
12538
|
if (first) {
|
|
12440
12539
|
startedFrom.current = void 0;
|
|
12441
|
-
const
|
|
12540
|
+
const seed = hold.takeSeed();
|
|
12541
|
+
const opened = seed === "" ? openingDraft(first, void 0) : seed;
|
|
12442
12542
|
typed2.current = opened;
|
|
12443
12543
|
setDraft(opened);
|
|
12444
12544
|
setEditing({ rowId: written.data, key: first });
|
|
12545
|
+
try {
|
|
12546
|
+
await hold.deliver(document);
|
|
12547
|
+
} finally {
|
|
12548
|
+
hold.release();
|
|
12549
|
+
}
|
|
12445
12550
|
}
|
|
12446
12551
|
return null;
|
|
12447
12552
|
}, [client, tableId, reload, order, fields]);
|
|
@@ -13907,8 +14012,9 @@ function SplitRecordDialog({ tableId, record, document: document2, open, onOpenC
|
|
|
13907
14012
|
setMoving(/* @__PURE__ */ new Set());
|
|
13908
14013
|
onOpenChange(false);
|
|
13909
14014
|
onChanged?.();
|
|
13910
|
-
const made = await client.
|
|
13911
|
-
const
|
|
14015
|
+
const made = await client.listByIds({ table_id: tableId, ids: [created] });
|
|
14016
|
+
const madeRow = made.ok ? made.data.find((r) => r.id === created) : void 0;
|
|
14017
|
+
const madeDoc = madeRow?.document ?? {};
|
|
13912
14018
|
const fieldKeys = new Set((fields.data ?? []).map((f) => f.key));
|
|
13913
14019
|
const titleKey = table.data?.title_field ?? (["name", "title"].find((k) => fieldKeys.has(k)) ?? null);
|
|
13914
14020
|
const titleHeld = titleKey !== null && typeof madeDoc[titleKey] === "string" && String(madeDoc[titleKey]).trim() !== "";
|
|
@@ -14326,14 +14432,17 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
14326
14432
|
const [parentId, setParentId] = (0, import_react81.useState)(null);
|
|
14327
14433
|
const parentFields = (0, import_react82.useFields)(parentId ?? tableId);
|
|
14328
14434
|
const parentTable = (0, import_react82.useTable)(parentId ?? tableId);
|
|
14435
|
+
const homeTable = (0, import_react82.useTable)(tableId);
|
|
14436
|
+
const [parentNameTyped, setParentNameTyped] = (0, import_react81.useState)("");
|
|
14329
14437
|
const [copying, setCopying] = (0, import_react81.useState)(/* @__PURE__ */ new Set());
|
|
14330
14438
|
const [busy, setBusy] = (0, import_react81.useState)(false);
|
|
14331
14439
|
const [refusal3, setRefusal] = (0, import_react81.useState)(null);
|
|
14332
14440
|
const doc = document2 ?? {};
|
|
14333
14441
|
const pickable = (0, import_react81.useMemo)(() => {
|
|
14334
|
-
const home = tables.rows.find((t) => t.table_id === tableId)?.organization_id;
|
|
14335
|
-
return { ...tables, rows:
|
|
14336
|
-
|
|
14442
|
+
const home = tables.rows.find((t) => t.table_id === tableId)?.organization_id ?? homeTable.data?.organization_id;
|
|
14443
|
+
if (home === void 0) return { ...tables, rows: [], loading: tables.loading || homeTable.loading };
|
|
14444
|
+
return { ...tables, rows: tables.rows.filter((t) => t.table_id !== tableId && t.organization_id === home) };
|
|
14445
|
+
}, [tables, tableId, homeTable.data, homeTable.loading]);
|
|
14337
14446
|
const shared = (0, import_react81.useMemo)(() => {
|
|
14338
14447
|
if (!parentId) return [];
|
|
14339
14448
|
const there = new Set((parentFields.data ?? []).map((f) => f.key));
|
|
@@ -14346,12 +14455,14 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
14346
14455
|
if (!next) {
|
|
14347
14456
|
setParentId(null);
|
|
14348
14457
|
setCopying(/* @__PURE__ */ new Set());
|
|
14458
|
+
setParentNameTyped("");
|
|
14349
14459
|
setRefusal(null);
|
|
14350
14460
|
}
|
|
14351
14461
|
onOpenChange(next);
|
|
14352
14462
|
};
|
|
14353
14463
|
const pick = (id) => {
|
|
14354
14464
|
setParentId(id);
|
|
14465
|
+
setParentNameTyped("");
|
|
14355
14466
|
setCopying(/* @__PURE__ */ new Set());
|
|
14356
14467
|
setRefusal(null);
|
|
14357
14468
|
};
|
|
@@ -14361,8 +14472,14 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
14361
14472
|
else next.delete(key);
|
|
14362
14473
|
return next;
|
|
14363
14474
|
});
|
|
14475
|
+
const typedName = parentNameTyped.trim();
|
|
14476
|
+
const hasChoice = copying.size > 0 || typedName !== "";
|
|
14364
14477
|
const extract = async () => {
|
|
14365
14478
|
if (!parentId) return;
|
|
14479
|
+
if (!hasChoice) {
|
|
14480
|
+
setRefusal({ code: "invalid", message: "Tick at least one value to copy up, or name the new parent.", hint: "", ours: true });
|
|
14481
|
+
return;
|
|
14482
|
+
}
|
|
14366
14483
|
setBusy(true);
|
|
14367
14484
|
setRefusal(null);
|
|
14368
14485
|
const done = await client.migrateExtractParent({
|
|
@@ -14382,9 +14499,17 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
14382
14499
|
setCopying(/* @__PURE__ */ new Set());
|
|
14383
14500
|
onOpenChange(false);
|
|
14384
14501
|
onChanged?.();
|
|
14385
|
-
const made = await client.
|
|
14386
|
-
const madeDoc = made.ok ? made.data.
|
|
14387
|
-
|
|
14502
|
+
const made = await client.listByIds({ table_id: parentTableId, ids: [created] });
|
|
14503
|
+
const madeDoc = (made.ok ? made.data.find((r) => r.id === created)?.document : void 0) ?? {};
|
|
14504
|
+
let madeName = recordNameIn(parentTable.data ?? null, madeDoc, `New ${parentName}`);
|
|
14505
|
+
const parentTitleKey = parentTable.data?.title_field ?? (["name", "title"].find((k) => (parentFields.data ?? []).some((f) => f.key === k)) ?? null);
|
|
14506
|
+
if (typedName !== "" && parentTitleKey !== null) {
|
|
14507
|
+
const renamed = await (0, recordVersions_exports.updateRecordAt)(client, { record_id: created, patch: { [parentTitleKey]: typedName }, version: await (0, recordVersions_exports.readVersionNow)(client, created) });
|
|
14508
|
+
if (renamed.ok) {
|
|
14509
|
+
madeName = typedName;
|
|
14510
|
+
onChanged?.();
|
|
14511
|
+
}
|
|
14512
|
+
}
|
|
14388
14513
|
const undo = async () => {
|
|
14389
14514
|
const back = await client.migrateUndo({ migration_id: migration });
|
|
14390
14515
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
@@ -14441,10 +14566,21 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
|
|
|
14441
14566
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "shrink-0 font-medium", children: fieldName(f) }),
|
|
14442
14567
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "min-w-0 truncate text-muted-foreground", children: valueWords(doc[f.key]) })
|
|
14443
14568
|
] }) }, f.key)) }) }),
|
|
14569
|
+
parentId ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
14570
|
+
import_design_system44.Input,
|
|
14571
|
+
{
|
|
14572
|
+
value: parentNameTyped,
|
|
14573
|
+
onChange: (e) => setParentNameTyped(e.target.value),
|
|
14574
|
+
placeholder: `Name for the new ${parentName}`,
|
|
14575
|
+
"aria-label": "Name for the new parent",
|
|
14576
|
+
disabled: busy,
|
|
14577
|
+
"data-records-extract-name": ""
|
|
14578
|
+
}
|
|
14579
|
+
) : null,
|
|
14444
14580
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RefusalNotice, { error: refusal3 }) : null,
|
|
14445
14581
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system44.DialogFooter, { children: [
|
|
14446
14582
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system44.Button, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
|
|
14447
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system44.Button, { size: "sm", onClick: () => void extract(), disabled: !parentId || loadingShared || busy, "data-records-extract-go": "", children: busy ? "Extracting\u2026" : "Extract" })
|
|
14583
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system44.Button, { size: "sm", onClick: () => void extract(), disabled: !parentId || loadingShared || busy || !hasChoice, "data-records-extract-go": "", children: busy ? "Extracting\u2026" : "Extract" })
|
|
14448
14584
|
] })
|
|
14449
14585
|
] }) });
|
|
14450
14586
|
}
|
|
@@ -17736,7 +17872,7 @@ function useMergedGridControls(args) {
|
|
|
17736
17872
|
},
|
|
17737
17873
|
variant: "destructive",
|
|
17738
17874
|
title: dialog?.kind === "delete" ? `Delete the ${fieldName(dialog.field)} column?` : "Delete this column?",
|
|
17739
|
-
description: mutation.error && dialog?.kind === "delete" ? `The store kept the column: ${refusalSentence(mutation.error)}` : "
|
|
17875
|
+
description: mutation.error && dialog?.kind === "delete" ? `The store kept the column: ${refusalSentence(mutation.error)}` : "Removes it from the table and every view. Its values stay in record history; anything still using it is named.",
|
|
17740
17876
|
confirmLabel: "Delete column",
|
|
17741
17877
|
cancelLabel: "Keep",
|
|
17742
17878
|
busy: deleteBusy,
|
|
@@ -24024,97 +24160,6 @@ function useRowFollowsItsMove(args) {
|
|
|
24024
24160
|
return { noteWrite };
|
|
24025
24161
|
}
|
|
24026
24162
|
|
|
24027
|
-
// src/gridHeldKeys.ts
|
|
24028
|
-
function isHeldKey(e) {
|
|
24029
|
-
if (e.metaKey || e.ctrlKey || e.altKey) return false;
|
|
24030
|
-
return e.key.length === 1 || e.key === "Tab" || e.key === "Enter" || e.key === "Backspace";
|
|
24031
|
-
}
|
|
24032
|
-
function splitHeldKeys(held) {
|
|
24033
|
-
let seed = "";
|
|
24034
|
-
let i = 0;
|
|
24035
|
-
for (; i < held.length; i++) {
|
|
24036
|
-
const k = held[i];
|
|
24037
|
-
if (k.key === "Tab" || k.key === "Enter") break;
|
|
24038
|
-
if (k.key === "Backspace") seed = seed.slice(0, -1);
|
|
24039
|
-
else seed += k.key;
|
|
24040
|
-
}
|
|
24041
|
-
return { seed, rest: held.slice(i) };
|
|
24042
|
-
}
|
|
24043
|
-
var EDITOR = "[data-matrx-cell-editor]";
|
|
24044
|
-
var CATCHER = "[data-matrx-type-catcher]";
|
|
24045
|
-
function typeInto(box, ch) {
|
|
24046
|
-
const proto = box instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
|
|
24047
|
-
const setValue = Object.getOwnPropertyDescriptor(proto, "value")?.set;
|
|
24048
|
-
const start = box.selectionStart ?? box.value.length;
|
|
24049
|
-
const end = box.selectionEnd ?? box.value.length;
|
|
24050
|
-
setValue?.call(box, box.value.slice(0, start) + ch + box.value.slice(end));
|
|
24051
|
-
box.setSelectionRange?.(start + ch.length, start + ch.length);
|
|
24052
|
-
box.dispatchEvent(new Event("input", { bubbles: true }));
|
|
24053
|
-
}
|
|
24054
|
-
function editorBox(scope) {
|
|
24055
|
-
const active = typeof document !== "undefined" ? document.activeElement : null;
|
|
24056
|
-
if ((active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) && active.closest(EDITOR)) return active;
|
|
24057
|
-
return scope.querySelector(
|
|
24058
|
-
`${EDITOR} textarea, ${EDITOR} input[type=text], ${EDITOR} input:not([type])`
|
|
24059
|
-
);
|
|
24060
|
-
}
|
|
24061
|
-
function holdKeys() {
|
|
24062
|
-
const held = [];
|
|
24063
|
-
const queue = [];
|
|
24064
|
-
const ours = /* @__PURE__ */ new WeakSet();
|
|
24065
|
-
const hold = (e) => {
|
|
24066
|
-
if (ours.has(e) || !isHeldKey(e)) return;
|
|
24067
|
-
const target = e.target instanceof Element ? e.target : null;
|
|
24068
|
-
if (target && target.closest("input, textarea, [contenteditable=true]") && !target.closest(`${CATCHER}, ${EDITOR}`)) return;
|
|
24069
|
-
e.preventDefault();
|
|
24070
|
-
e.stopPropagation();
|
|
24071
|
-
held.push({ key: e.key, shiftKey: e.shiftKey });
|
|
24072
|
-
};
|
|
24073
|
-
window.addEventListener("keydown", hold, true);
|
|
24074
|
-
let released = false;
|
|
24075
|
-
const release = () => {
|
|
24076
|
-
if (!released) window.removeEventListener("keydown", hold, true);
|
|
24077
|
-
released = true;
|
|
24078
|
-
return [...queue.splice(0), ...held.splice(0)];
|
|
24079
|
-
};
|
|
24080
|
-
const takeSeed = () => {
|
|
24081
|
-
const first = splitHeldKeys(held.splice(0));
|
|
24082
|
-
queue.push(...first.rest);
|
|
24083
|
-
return first.seed;
|
|
24084
|
-
};
|
|
24085
|
-
const deliver = async (scope) => {
|
|
24086
|
-
const editorOpen = () => Boolean(scope.querySelector(EDITOR));
|
|
24087
|
-
const until = async (done) => {
|
|
24088
|
-
for (let i = 0; i < 100 && !done(); i++) await new Promise((r) => setTimeout(r, 30));
|
|
24089
|
-
};
|
|
24090
|
-
await until(editorOpen);
|
|
24091
|
-
for (; ; ) {
|
|
24092
|
-
if (held.length > 0) queue.push(...held.splice(0));
|
|
24093
|
-
const next = queue.shift();
|
|
24094
|
-
if (!next) {
|
|
24095
|
-
await new Promise((r) => setTimeout(r, 60));
|
|
24096
|
-
if (held.length === 0) break;
|
|
24097
|
-
continue;
|
|
24098
|
-
}
|
|
24099
|
-
const wasOpen = editorOpen();
|
|
24100
|
-
const box = wasOpen ? editorBox(scope) : null;
|
|
24101
|
-
const catcher = !wasOpen ? scope.querySelector(CATCHER) : null;
|
|
24102
|
-
if (next.key.length === 1 && (box || catcher)) {
|
|
24103
|
-
typeInto(box ?? catcher, next.key);
|
|
24104
|
-
} else {
|
|
24105
|
-
const event = new KeyboardEvent("keydown", { key: next.key, shiftKey: next.shiftKey, bubbles: true, cancelable: true });
|
|
24106
|
-
ours.add(event);
|
|
24107
|
-
const to = box ?? catcher ?? document.activeElement ?? null;
|
|
24108
|
-
to?.dispatchEvent(event);
|
|
24109
|
-
}
|
|
24110
|
-
if (next.key === "Tab" || next.key === "Enter") await until(() => !editorOpen());
|
|
24111
|
-
else if (!wasOpen && next.key.length === 1) await until(editorOpen);
|
|
24112
|
-
else await new Promise((r) => setTimeout(r, 15));
|
|
24113
|
-
}
|
|
24114
|
-
};
|
|
24115
|
-
return { release, deliver, takeSeed };
|
|
24116
|
-
}
|
|
24117
|
-
|
|
24118
24163
|
// src/gridAssist.tsx
|
|
24119
24164
|
var import_clipboard2 = require("@ai-matrx/kit/clipboard");
|
|
24120
24165
|
var import_react132 = require("react");
|
|
@@ -35218,10 +35263,12 @@ function TimelineView({
|
|
|
35218
35263
|
const named = (key) => key && fields.some((f) => f.key === key) ? key : null;
|
|
35219
35264
|
const startChosen = "startKey" in picked ? picked.startKey ?? null : has(dates, startKey) ?? named(startKey) ?? onlyCandidate(dates);
|
|
35220
35265
|
const endCandidates = (0, import_react207.useMemo)(() => dates.filter((f) => f.key !== startChosen), [dates, startChosen]);
|
|
35266
|
+
const baselineKeys = (0, import_react207.useMemo)(() => new Set([gantt?.baselineStart ?? "baseline_start", gantt?.baselineEnd ?? "baseline_end"].filter((k) => Boolean(k))), [gantt]);
|
|
35267
|
+
const endAutoCandidates = (0, import_react207.useMemo)(() => endCandidates.filter((f) => !baselineKeys.has(f.key)), [endCandidates, baselineKeys]);
|
|
35221
35268
|
const endAuto = (0, import_react207.useMemo)(() => {
|
|
35222
|
-
const only = onlyCandidate(
|
|
35269
|
+
const only = onlyCandidate(endAutoCandidates);
|
|
35223
35270
|
return only && startChosen && endFollowsStart(rows, startChosen, only) ? only : null;
|
|
35224
|
-
}, [
|
|
35271
|
+
}, [endAutoCandidates, rows, startChosen]);
|
|
35225
35272
|
const endChosen = "endKey" in picked ? picked.endKey ?? null : has(endCandidates, endKey) ?? (endKey !== startChosen ? named(endKey) : null) ?? (endKey === void 0 ? endAuto : null);
|
|
35226
35273
|
const groupCandidates = (0, import_react207.useMemo)(() => groupableFields(fields), [fields]);
|
|
35227
35274
|
const groupChosen = "groupKey" in picked ? picked.groupKey ?? null : has(groupCandidates, groupKey);
|
|
@@ -39322,6 +39369,14 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
39322
39369
|
}, 250);
|
|
39323
39370
|
if (!event.over || !views) return;
|
|
39324
39371
|
const writes = (0, import_views2.planViewDrop)(views, String(event.active.id), String(event.over.id));
|
|
39372
|
+
if (writes.length > 0) {
|
|
39373
|
+
const next = views.map((v) => {
|
|
39374
|
+
const w = writes.find((x) => x.id === v.id);
|
|
39375
|
+
return w ? { ...v, position: w.position, ..."section" in w ? { section: w.section ?? null } : {} } : v;
|
|
39376
|
+
});
|
|
39377
|
+
setViews(next);
|
|
39378
|
+
onViews?.(next);
|
|
39379
|
+
}
|
|
39325
39380
|
for (const w of writes) {
|
|
39326
39381
|
const written = await saveViewPatch(client, tableId, w.id, { position: w.position, ..."section" in w ? { section: w.section ?? null } : {} });
|
|
39327
39382
|
if (!written.ok) {
|
|
@@ -41747,7 +41802,7 @@ function MigrationLog({ entries, readError, canUndo, whyNotUndo, onUndone, class
|
|
|
41747
41802
|
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("ul", { className: "flex flex-col divide-y rounded border text-xs", children: entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("li", { "data-migration-id": entry.id, className: "flex items-center gap-2 px-2 py-1.5", children: [
|
|
41748
41803
|
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "shrink-0 font-medium", children: migrationWords(entry.verb) }),
|
|
41749
41804
|
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", title: entry.note ?? void 0, children: entry.note ?? "" }),
|
|
41750
|
-
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "w-28 shrink-0 whitespace-nowrap text-right text-muted-foreground", title: new Date(entry.applied_at).toLocaleString(), children: whenText(entry.applied_at) }),
|
|
41805
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "min-w-28 shrink-0 whitespace-nowrap text-right text-muted-foreground", title: new Date(entry.applied_at).toLocaleString(), children: whenText(entry.applied_at) }),
|
|
41751
41806
|
entry.undone_at ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "w-14 shrink-0 text-right text-muted-foreground", children: "Undone" }) : canUndo ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
41752
41807
|
import_design_system117.Button,
|
|
41753
41808
|
{
|
|
@@ -41945,12 +42000,21 @@ function VersionRow({
|
|
|
41945
42000
|
] }),
|
|
41946
42001
|
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { className: "shrink-0 font-medium", children: operationWords(entry.operation_label) }),
|
|
41947
42002
|
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Who, { actor: entry.actor }),
|
|
41948
|
-
/* @__PURE__ */ (0, import_jsx_runtime137.
|
|
41949
|
-
|
|
42003
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
42004
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
42005
|
+
"span",
|
|
42006
|
+
{
|
|
42007
|
+
className: "min-w-0 truncate text-muted-foreground",
|
|
42008
|
+
title: entry.changes.length === 0 ? "nothing about the values changed" : entry.changes.map((c) => c.label).join(", "),
|
|
42009
|
+
children: entry.changes.length === 0 ? "nothing about the values changed" : entry.changes.map((c) => c.label).join(", ")
|
|
42010
|
+
}
|
|
42011
|
+
),
|
|
42012
|
+
entry.undoable ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_design_system118.Badge, { variant: "secondary", className: "min-w-0 shrink truncate text-[10px]", title: "part of a bigger change", children: "part of a bigger change" }) : null
|
|
42013
|
+
] }),
|
|
41950
42014
|
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
41951
42015
|
"span",
|
|
41952
42016
|
{
|
|
41953
|
-
className: "w-28 shrink-0 whitespace-nowrap text-right text-muted-foreground",
|
|
42017
|
+
className: "min-w-28 shrink-0 whitespace-nowrap text-right text-muted-foreground",
|
|
41954
42018
|
title: new Date(entry.occurred_at).toLocaleString(),
|
|
41955
42019
|
children: whenText(entry.occurred_at)
|
|
41956
42020
|
}
|
|
@@ -49326,7 +49390,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
49326
49390
|
setSaid({ kind: "asking", reads: words2.trim() });
|
|
49327
49391
|
const got = await askTable({ tableId, question: words2.trim(), viewId: viewId ?? "" });
|
|
49328
49392
|
setSaid(
|
|
49329
|
-
got.ok ? { kind: "agent-answer", answer: got.answer, costPoints: got.costPoints ?? null } : { kind: "agent-failed", error: (0, refusals_exports.refusal)("door", got.message,
|
|
49393
|
+
got.ok ? { kind: "agent-answer", answer: got.answer, costPoints: got.costPoints ?? null } : { kind: "agent-failed", error: (0, refusals_exports.refusal)("door", got.message, got.hint ?? null) }
|
|
49330
49394
|
);
|
|
49331
49395
|
return;
|
|
49332
49396
|
}
|