@ai-matrx/records-ui 0.93.83 → 0.93.84
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 +105 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +105 -101
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1214,111 +1214,114 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
1214
1214
|
if (q === "") return true;
|
|
1215
1215
|
return `${titleOf(row.id)} ${apart.get(row.id) ?? ""}`.toLowerCase().includes(q);
|
|
1216
1216
|
});
|
|
1217
|
-
return
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
...disabled ? {} : { onRemove: () => toggle(recordId) }
|
|
1223
|
-
},
|
|
1224
|
-
recordId
|
|
1225
|
-
)),
|
|
1226
|
-
disabled ? null : (
|
|
1227
|
-
// THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the choice editor draws the same one.
|
|
1228
|
-
/* @__PURE__ */ jsx5(
|
|
1229
|
-
PickOrAdd,
|
|
1217
|
+
return (
|
|
1218
|
+
// Never wider than where it is drawn (a grid cell beside a sticky column: B3-07) — chips truncate, the button wraps.
|
|
1219
|
+
/* @__PURE__ */ jsxs4("div", { className: cn4("flex min-w-0 max-w-full flex-wrap items-center gap-1", className), children: [
|
|
1220
|
+
picked.map((recordId) => /* @__PURE__ */ jsx5(
|
|
1221
|
+
RecordChip,
|
|
1230
1222
|
{
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
"
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1223
|
+
title: titleOf(recordId),
|
|
1224
|
+
...disabled ? {} : { onRemove: () => toggle(recordId) }
|
|
1225
|
+
},
|
|
1226
|
+
recordId
|
|
1227
|
+
)),
|
|
1228
|
+
disabled ? null : (
|
|
1229
|
+
// THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the choice editor draws the same one.
|
|
1230
|
+
/* @__PURE__ */ jsx5(
|
|
1231
|
+
PickOrAdd,
|
|
1232
|
+
{
|
|
1233
|
+
triggerId: id,
|
|
1234
|
+
triggerLabel: `Pick for ${fieldName(field2)}`,
|
|
1235
|
+
triggerText: picked.length === 0 ? "Pick" : "Change",
|
|
1236
|
+
open,
|
|
1237
|
+
onOpenChange: setOpen,
|
|
1238
|
+
search,
|
|
1239
|
+
onSearch: setSearch,
|
|
1240
|
+
items: visible.map((row) => ({
|
|
1241
|
+
id: row.id,
|
|
1242
|
+
label: titleOf(row.id),
|
|
1243
|
+
detail: apart.get(row.id) ?? null,
|
|
1244
|
+
picked: picked.includes(row.id),
|
|
1245
|
+
title: apart.has(row.id) ? `${titleOf(row.id)} \u2014 ${apart.get(row.id)}` : titleOf(row.id),
|
|
1246
|
+
attrs: { "data-relation-candidate": row.id }
|
|
1247
|
+
})),
|
|
1248
|
+
onPick: toggle,
|
|
1249
|
+
notice: /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1250
|
+
refusal2 ? /* @__PURE__ */ jsx5(RefusalLine, { error: refusal2, className: "p-2" }) : null,
|
|
1251
|
+
!rows && !refusal2 ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
|
|
1252
|
+
full ? /* @__PURE__ */ jsxs4("p", { className: "p-2 text-xs text-muted-foreground", children: [
|
|
1253
|
+
fieldName(field2),
|
|
1254
|
+
" can point at ",
|
|
1255
|
+
field2.relation_max,
|
|
1256
|
+
" at most. Remove one to add another."
|
|
1257
|
+
] }) : null
|
|
1258
|
+
] }),
|
|
1259
|
+
empty: rows ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
|
|
1260
|
+
add: allowCreate && !full && !targetRefusal && target && !creating ? {
|
|
1261
|
+
label: search.trim() !== "" ? `Create \u201C${search.trim()}\u201D` : `New ${targetWord}`,
|
|
1262
|
+
disabled: busy,
|
|
1263
|
+
// TYPED SOMETHING THAT IS NOT THERE? That IS the name. The champions
|
|
1264
|
+
// (Airtable, Notion) make the search text the new record's title in one
|
|
1265
|
+
// press; an empty box asks for one.
|
|
1266
|
+
onAdd: () => {
|
|
1267
|
+
if (search.trim() !== "") void create(search);
|
|
1268
|
+
else {
|
|
1269
|
+
setNewTitle("");
|
|
1270
|
+
setCreating(true);
|
|
1271
|
+
}
|
|
1269
1272
|
}
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1273
|
+
} : null,
|
|
1274
|
+
foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ jsx5(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 p-1", children: [
|
|
1275
|
+
/* @__PURE__ */ jsx5(
|
|
1276
|
+
BasicInput3,
|
|
1277
|
+
{
|
|
1278
|
+
autoFocus: true,
|
|
1279
|
+
value: newTitle,
|
|
1280
|
+
onChange: (e) => setNewTitle(e.target.value),
|
|
1281
|
+
onKeyDown: (e) => {
|
|
1282
|
+
if (e.key === "Enter") {
|
|
1283
|
+
e.preventDefault();
|
|
1284
|
+
void create(newTitle);
|
|
1285
|
+
}
|
|
1286
|
+
},
|
|
1287
|
+
placeholder: `New ${targetWord}`,
|
|
1288
|
+
className: "h-7 flex-1 text-xs",
|
|
1289
|
+
"aria-label": `Name the new ${targetWord}`
|
|
1290
|
+
}
|
|
1291
|
+
),
|
|
1292
|
+
/* @__PURE__ */ jsx5(
|
|
1293
|
+
Button3,
|
|
1294
|
+
{
|
|
1295
|
+
type: "button",
|
|
1296
|
+
size: "sm",
|
|
1297
|
+
variant: "default",
|
|
1298
|
+
disabled: busy || newTitle.trim() === "",
|
|
1299
|
+
onClick: () => void create(newTitle),
|
|
1300
|
+
children: busy ? "Creating\u2026" : "Create"
|
|
1301
|
+
}
|
|
1302
|
+
)
|
|
1303
|
+
] }) : void 0,
|
|
1304
|
+
footNote: allowCreate && !full && createRefusal ? (
|
|
1305
|
+
// The typed title is still in the search box: the notice owns the
|
|
1306
|
+
// two doors out (lane REFUSAL-SWEEP).
|
|
1307
|
+
/* @__PURE__ */ jsx5(
|
|
1308
|
+
RefusalNotice,
|
|
1309
|
+
{
|
|
1310
|
+
error: createRefusal,
|
|
1311
|
+
className: "mt-1 max-w-72",
|
|
1312
|
+
onKeepEditing: () => setCreateRefusal(null),
|
|
1313
|
+
onDiscard: () => {
|
|
1314
|
+
setCreateRefusal(null);
|
|
1315
|
+
setSearch("");
|
|
1283
1316
|
}
|
|
1284
|
-
},
|
|
1285
|
-
placeholder: `New ${targetWord}`,
|
|
1286
|
-
className: "h-7 flex-1 text-xs",
|
|
1287
|
-
"aria-label": `Name the new ${targetWord}`
|
|
1288
|
-
}
|
|
1289
|
-
),
|
|
1290
|
-
/* @__PURE__ */ jsx5(
|
|
1291
|
-
Button3,
|
|
1292
|
-
{
|
|
1293
|
-
type: "button",
|
|
1294
|
-
size: "sm",
|
|
1295
|
-
variant: "default",
|
|
1296
|
-
disabled: busy || newTitle.trim() === "",
|
|
1297
|
-
onClick: () => void create(newTitle),
|
|
1298
|
-
children: busy ? "Creating\u2026" : "Create"
|
|
1299
|
-
}
|
|
1300
|
-
)
|
|
1301
|
-
] }) : void 0,
|
|
1302
|
-
footNote: allowCreate && !full && createRefusal ? (
|
|
1303
|
-
// The typed title is still in the search box: the notice owns the
|
|
1304
|
-
// two doors out (lane REFUSAL-SWEEP).
|
|
1305
|
-
/* @__PURE__ */ jsx5(
|
|
1306
|
-
RefusalNotice,
|
|
1307
|
-
{
|
|
1308
|
-
error: createRefusal,
|
|
1309
|
-
className: "mt-1 max-w-72",
|
|
1310
|
-
onKeepEditing: () => setCreateRefusal(null),
|
|
1311
|
-
onDiscard: () => {
|
|
1312
|
-
setCreateRefusal(null);
|
|
1313
|
-
setSearch("");
|
|
1314
1317
|
}
|
|
1315
|
-
|
|
1316
|
-
)
|
|
1317
|
-
|
|
1318
|
-
|
|
1318
|
+
)
|
|
1319
|
+
) : null
|
|
1320
|
+
}
|
|
1321
|
+
)
|
|
1319
1322
|
)
|
|
1320
|
-
)
|
|
1321
|
-
|
|
1323
|
+
] })
|
|
1324
|
+
);
|
|
1322
1325
|
}
|
|
1323
1326
|
|
|
1324
1327
|
// src/gridAttachments.tsx
|
|
@@ -5213,9 +5216,10 @@ function OpenCell({
|
|
|
5213
5216
|
{
|
|
5214
5217
|
ref: host,
|
|
5215
5218
|
"data-matrx-cell-control": "",
|
|
5219
|
+
"data-matrx-cell-fill": "",
|
|
5216
5220
|
"data-matrx-cell-editor": "",
|
|
5217
5221
|
tabIndex: -1,
|
|
5218
|
-
className: "relative z-[25] flex w-full min-w-
|
|
5222
|
+
className: "relative z-[25] flex w-full min-w-0 max-w-full flex-col gap-1 outline-none",
|
|
5219
5223
|
onDoubleClick: (event) => event.stopPropagation(),
|
|
5220
5224
|
onKeyDown: (event) => {
|
|
5221
5225
|
if (event.target?.closest?.("[data-refusal-notice], [data-records-choice-ask]")) return;
|