@ai-matrx/records-ui 0.115.66 → 0.115.67
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 +6 -0
- package/dist/index.cjs +53 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +53 -10
- package/dist/index.js.map +1 -1
- package/dist/table-shape.cjs +2 -2
- package/dist/table-shape.cjs.map +1 -1
- package/dist/table-shape.d.cts +3 -1
- package/dist/table-shape.d.ts +3 -1
- package/dist/table-shape.js +2 -2
- package/dist/table-shape.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
+
## 0.115.67
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/records-ui/v0.115.66..npm/records-ui/v0.115.67 -- apps/shared/records-ui`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
3
9
|
## 0.115.66
|
|
4
10
|
|
|
5
11
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/index.cjs
CHANGED
|
@@ -23831,11 +23831,11 @@ function readTableShape(text) {
|
|
|
23831
23831
|
function hasTableShape(text) {
|
|
23832
23832
|
return readTableShapes(text).length > 0;
|
|
23833
23833
|
}
|
|
23834
|
-
function shapeOfGrid(headers, cells, name = null) {
|
|
23834
|
+
function shapeOfGrid(headers, cells, name = null, from = "table") {
|
|
23835
23835
|
const labels = uniqueLabels(headers.map((h) => cellWords(String(h ?? ""))));
|
|
23836
23836
|
const rows = rowsOf(labels, cells.map((r) => r.map((c) => cellWords(String(c ?? "")))));
|
|
23837
23837
|
if (labels.length === 0) return null;
|
|
23838
|
-
const said2 = rows.length === 0 ? `${plural3(labels.length, "column", "columns")} and no rows yet` : `${sizeWords(rows.length, labels.length)} from a
|
|
23838
|
+
const said2 = rows.length === 0 ? `${plural3(labels.length, "column", "columns")} and no rows yet` : `${sizeWords(rows.length, labels.length)} from a ${from}`;
|
|
23839
23839
|
return { kind: "table", headers: labels, rows, name, at: null, splits: [], said: said2 };
|
|
23840
23840
|
}
|
|
23841
23841
|
var MOST_GUESSED_CHOICES = 12;
|
|
@@ -28628,6 +28628,34 @@ var import_react167 = require("react");
|
|
|
28628
28628
|
var import_react168 = require("@ai-matrx/records/react");
|
|
28629
28629
|
var import_design_system85 = require("@ai-matrx/design-system");
|
|
28630
28630
|
|
|
28631
|
+
// src/unfinishedTable.ts
|
|
28632
|
+
var UNFINISHED_WINDOW_MS = 24 * 60 * 60 * 1e3;
|
|
28633
|
+
async function findUnfinishedTable(client, wantedName, wantedKeys, now = Date.now()) {
|
|
28634
|
+
const name = wantedName.trim().toLowerCase();
|
|
28635
|
+
if (!name) return null;
|
|
28636
|
+
const listed = await client.tableList();
|
|
28637
|
+
if (!listed.ok) return null;
|
|
28638
|
+
const candidates = listed.data.filter((t) => {
|
|
28639
|
+
if (t.is_kernel || t.name.trim().toLowerCase() !== name) return false;
|
|
28640
|
+
const made = Date.parse(t.created_at);
|
|
28641
|
+
return Number.isFinite(made) && now - made <= UNFINISHED_WINDOW_MS;
|
|
28642
|
+
});
|
|
28643
|
+
if (candidates.length === 0) return null;
|
|
28644
|
+
const counted = await client.tableRowCounts({ table_ids: candidates.map((t) => t.id) });
|
|
28645
|
+
if (!counted.ok) return null;
|
|
28646
|
+
const withRows = new Set(counted.data.filter((c) => c.visible_rows > 0).map((c) => c.table_id));
|
|
28647
|
+
const wanted = new Set(wantedKeys);
|
|
28648
|
+
const ordered = [...candidates].sort((a, b) => Date.parse(b.created_at) - Date.parse(a.created_at));
|
|
28649
|
+
for (const t of ordered) {
|
|
28650
|
+
if (withRows.has(t.id)) continue;
|
|
28651
|
+
const read = await client.fields({ table_id: t.id });
|
|
28652
|
+
if (!read.ok) continue;
|
|
28653
|
+
const have = new Set(read.data.map((f) => f.key));
|
|
28654
|
+
if ([...have].every((k) => wanted.has(k))) return { tableId: t.id, haveKeys: have };
|
|
28655
|
+
}
|
|
28656
|
+
return null;
|
|
28657
|
+
}
|
|
28658
|
+
|
|
28631
28659
|
// src/TablesHome.tsx
|
|
28632
28660
|
var import_react165 = require("react");
|
|
28633
28661
|
var import_react166 = require("@ai-matrx/records/react");
|
|
@@ -30723,7 +30751,7 @@ var SAVE_TO_TABLE_TYPES = [
|
|
|
30723
30751
|
];
|
|
30724
30752
|
function shapesOfSource(source) {
|
|
30725
30753
|
if (source.grid) {
|
|
30726
|
-
const s = shapeOfGrid(source.grid.headers, source.grid.rows, source.title ?? null);
|
|
30754
|
+
const s = shapeOfGrid(source.grid.headers, source.grid.rows, source.title ?? null, source.grid.from);
|
|
30727
30755
|
return s ? [s] : [];
|
|
30728
30756
|
}
|
|
30729
30757
|
if (source.value !== void 0) {
|
|
@@ -30842,16 +30870,31 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
30842
30870
|
...c.guess.type === "datetime" && c.guess.kind ? { kind: c.guess.kind } : {}
|
|
30843
30871
|
};
|
|
30844
30872
|
});
|
|
30845
|
-
const tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
|
|
30846
30873
|
setPhase("making");
|
|
30847
30874
|
try {
|
|
30848
|
-
const
|
|
30849
|
-
|
|
30850
|
-
|
|
30851
|
-
|
|
30852
|
-
|
|
30875
|
+
const earlier = await findUnfinishedTable(client, name ?? proposedName, fields.map((f) => f.key));
|
|
30876
|
+
let tableName2;
|
|
30877
|
+
let newId;
|
|
30878
|
+
if (earlier) {
|
|
30879
|
+
tableName2 = (name ?? proposedName).trim();
|
|
30880
|
+
newId = earlier.tableId;
|
|
30881
|
+
const lacking = fields.filter((f) => !earlier.haveKeys.has(f.key));
|
|
30882
|
+
const added = await (0, import_core3.addFields)(client, newId, lacking);
|
|
30883
|
+
if (!added.ok) {
|
|
30884
|
+
setProblem(added.error);
|
|
30885
|
+
setPhase("ready");
|
|
30886
|
+
return;
|
|
30887
|
+
}
|
|
30888
|
+
} else {
|
|
30889
|
+
tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
|
|
30890
|
+
const born = await (0, import_core3.declareTable)(client, { name: tableName2, fields });
|
|
30891
|
+
if (!born.ok) {
|
|
30892
|
+
setProblem(born.error);
|
|
30893
|
+
setPhase("ready");
|
|
30894
|
+
return;
|
|
30895
|
+
}
|
|
30896
|
+
newId = born.data;
|
|
30853
30897
|
}
|
|
30854
|
-
const newId = born.data;
|
|
30855
30898
|
if (description.trim()) {
|
|
30856
30899
|
const described = await (0, writeOnTheWinningVersion_exports.updateOnTheWinningVersion)(
|
|
30857
30900
|
client,
|