@ai-matrx/records-ui 0.116.14 → 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/index.d.cts CHANGED
@@ -713,6 +713,15 @@ interface RecordsUiHost {
713
713
  * drops the grid, its scroll and its selection. Unbound, the control assigns the location (a full load).
714
714
  */
715
715
  navigate?: (href: string) => void;
716
+ /**
717
+ * OPTIONAL. OPEN ONE RECORD WHERE THE HOST OPENS A RECORD, not at its page. A button that adds a row opens the
718
+ * row it made through this port first: a host whose rows open in a peek or a panel of its own (a page of
719
+ * Spaces) keeps the person where they are. Unbound, the press uses `hrefForRecord` + `navigate` as before.
720
+ */
721
+ openRecord?: (args: {
722
+ table: Table;
723
+ recordId: Uuid;
724
+ }) => void;
716
725
  /**
717
726
  * OPTIONAL. WHERE A FILE OPENS. A value too big for one cell is kept as a file and the cell
718
727
  * holds its first words (`@ai-matrx/records/core` `wholeValueOf`); this is the host's page for
package/dist/index.d.ts CHANGED
@@ -713,6 +713,15 @@ interface RecordsUiHost {
713
713
  * drops the grid, its scroll and its selection. Unbound, the control assigns the location (a full load).
714
714
  */
715
715
  navigate?: (href: string) => void;
716
+ /**
717
+ * OPTIONAL. OPEN ONE RECORD WHERE THE HOST OPENS A RECORD, not at its page. A button that adds a row opens the
718
+ * row it made through this port first: a host whose rows open in a peek or a panel of its own (a page of
719
+ * Spaces) keeps the person where they are. Unbound, the press uses `hrefForRecord` + `navigate` as before.
720
+ */
721
+ openRecord?: (args: {
722
+ table: Table;
723
+ recordId: Uuid;
724
+ }) => void;
716
725
  /**
717
726
  * OPTIONAL. WHERE A FILE OPENS. A value too big for one cell is kept as a file and the cell
718
727
  * holds its first words (`@ai-matrx/records/core` `wholeValueOf`); this is the host's page for
package/dist/index.js CHANGED
@@ -172,7 +172,7 @@ import {
172
172
  withoutAddition,
173
173
  withoutLeadingBlank,
174
174
  workedOutErrorFor
175
- } from "./chunk-NE72B4OK.js";
175
+ } from "./chunk-E5HKO5LT.js";
176
176
  import {
177
177
  CHART_PLOT_PX,
178
178
  RECORDS_GRID_ROW_PX,
@@ -273,7 +273,7 @@ import {
273
273
  visibilityLaneFor,
274
274
  whyNotAskable,
275
275
  writeOnTheWinningVersion_exports
276
- } from "./chunk-HUPBD4JF.js";
276
+ } from "./chunk-YIGEIVU7.js";
277
277
  import {
278
278
  ACTION_CHECKING_ACCESS_REASON,
279
279
  ACTION_NOT_HERE_REASON,
@@ -380,7 +380,7 @@ import {
380
380
  useRowRights,
381
381
  useTableRights,
382
382
  withoutInternalCodes
383
- } from "./chunk-RQL7QRGR.js";
383
+ } from "./chunk-TF3JYYJN.js";
384
384
  import {
385
385
  FEWEST_KEY_VALUE_PAIRS,
386
386
  FEWEST_LIST_ITEMS,
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);