@ai-matrx/records-ui 0.116.13 → 0.116.15

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/pickers.cjs CHANGED
@@ -850,6 +850,9 @@ function recordName(document2, titleKey, fallback = "Untitled") {
850
850
  function looksLikeId(value) {
851
851
  return typeof value === "string" && (0, import_uuid.isUuidShape)(value.trim());
852
852
  }
853
+ function recordNameIn(table, document2, fallback = "Untitled") {
854
+ return recordName(document2, table?.title_field ?? null, fallback);
855
+ }
853
856
  function rowNameIn(table, row, fallback = "Untitled") {
854
857
  return recordName(row?.document, table?.title_field ?? null, fallback);
855
858
  }
@@ -12322,6 +12325,10 @@ function buttonPressWords(label, pressed) {
12322
12325
  const status = pressed.status ?? "ran";
12323
12326
  return [`${pressed.automation ?? label}: ${status}.`, pressed.says].filter(Boolean).join(" ");
12324
12327
  }
12328
+ function addRowWords(label, table, document2) {
12329
+ const name = recordNameIn(table, document2, "");
12330
+ return name !== "" ? `${label}: added \u201C${name}\u201D and opened it.` : `${label}: added to ${tableName(table)} and opened it.`;
12331
+ }
12325
12332
  var POLL_EVERY_MS = 1200;
12326
12333
  var POLL_FOR_MS = 12e4;
12327
12334
  var RUN_BOOKKEEPING = /* @__PURE__ */ new Set(["run_id", "conversation_id"]);
@@ -12403,6 +12410,12 @@ function ButtonValue({ field, recordId, inCell }) {
12403
12410
  here.open(pressed.record_id);
12404
12411
  return setSaid({ kind: "ran", says: `${b.label}: a row was added and opened.` });
12405
12412
  }
12413
+ if (host.openRecord && addsTo.data) {
12414
+ const made = addsTo.data;
12415
+ host.openRecord({ table: made, recordId: pressed.record_id });
12416
+ const read = await client.recordRead({ record_id: pressed.record_id });
12417
+ return setSaid({ kind: "ran", says: addRowWords(b.label, made, read.ok ? read.data.document : void 0) });
12418
+ }
12406
12419
  const href = addsTo.data ? host.hrefForRecord?.({ table: addsTo.data, recordId: pressed.record_id }) : void 0;
12407
12420
  if (href) {
12408
12421
  setOpening(true);