@ai-matrx/records-ui 0.115.101 → 0.115.102

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.js CHANGED
@@ -30269,6 +30269,9 @@ function GridBody({
30269
30269
  }, [countedButNotReturned]);
30270
30270
  const askPerRow = Boolean(editable) && !host.rights && rights.known && !rights.write && rows.length > 0;
30271
30271
  const rowRights = useRowRights(rowIds, askPerRow);
30272
+ const rowRightsAnswered = useRef42(false);
30273
+ const rowRightsWaiting = askPerRow && !rowRightsAnswered.current && rowIds.length > 0 && rowRights(rowIds[0])?.known === false;
30274
+ if (askPerRow && !rowRightsWaiting) rowRightsAnswered.current = true;
30272
30275
  const mayWriteRow = useCallback32(
30273
30276
  (rowId) => askPerRow ? rowRights(rowId)?.write ?? false : rights.write,
30274
30277
  [askPerRow, rowRights, rights.write]
@@ -31825,7 +31828,7 @@ function GridBody({
31825
31828
  if (table.error) return /* @__PURE__ */ jsx99(RefusalNotice, { error: table.error, className });
31826
31829
  if (fields.error) return /* @__PURE__ */ jsx99(RefusalNotice, { error: fields.error, className });
31827
31830
  const nothingToShowYet = table.loading && !table.data || // No columns on a table whose level may hide them: not yet known which (one read, Confidential only).
31828
- !structure.settled && (fields.data ?? []).length === 0 || fields.loading && !fields.data || !rights.known || records.loading && rows.length === 0 || // The page read has neither answered nor refused: nothing has been said yet, so nothing is empty.
31831
+ !structure.settled && (fields.data ?? []).length === 0 || fields.loading && !fields.data || !rights.known || rowRightsWaiting || records.loading && rows.length === 0 || // The page read has neither answered nor refused: nothing has been said yet, so nothing is empty.
31829
31832
  !records.data && !records.error || countedButNotReturned || manual && hand.loading && rows.length === 0;
31830
31833
  const refreshing = !nothingToShowYet && (records.loading || manual && hand.loading);
31831
31834
  const structureLocked = !nothingToShowYet && (fields.data ?? []).length === 0 && structure.hidden;
@@ -53221,7 +53224,7 @@ function ReviewBlockView({ block, viewerUserId, extra }) {
53221
53224
  const name = block.title ?? table.data?.name ?? "Records";
53222
53225
  const neighbors = current ? neighborsOf(rows.map((r) => r.id), current.id) : null;
53223
53226
  if (read.error) return /* @__PURE__ */ jsx165(RefusalLine, { error: read.error });
53224
- if (read.waiting || read.loading && rows.length === 0) return /* @__PURE__ */ jsx165(Skeleton40, { className: "h-48 w-full" });
53227
+ if (read.waiting || read.loading && rows.length === 0) return /* @__PURE__ */ jsx165(Skeleton40, { className: "h-72 w-full" });
53225
53228
  if (rows.length === 0) return /* @__PURE__ */ jsx165(BlockNote, { children: read.mine ? "Nothing assigned to you here." : "No records match." });
53226
53229
  return /* @__PURE__ */ jsxs153("div", { className: "grid min-w-0 grid-cols-1 gap-2 md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", "data-records-page-review": block.id, children: [
53227
53230
  /* @__PURE__ */ jsxs153("div", { className: "flex min-w-0 flex-col rounded-md border bg-card", children: [
@@ -55949,6 +55952,8 @@ import { Fragment as Fragment73, jsx as jsx176, jsxs as jsxs164 } from "react/js
55949
55952
  function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = false, neighbors, onStep, expanded, onToggleExpand }) {
55950
55953
  const host = useRecordsUi();
55951
55954
  const [asking, setAsking] = useState150(null);
55955
+ const record = useRecord5(recordId, true, { tableId });
55956
+ const answered = Boolean(record.data) && !record.error;
55952
55957
  return /* @__PURE__ */ jsxs164(
55953
55958
  "div",
55954
55959
  {
@@ -55975,28 +55980,30 @@ function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = fal
55975
55980
  children: [
55976
55981
  neighbors && onStep ? /* @__PURE__ */ jsx176(RecordStepper, { neighbors, onStep: (to) => onStep(to), expanded, onToggleExpand }) : null,
55977
55982
  /* @__PURE__ */ jsx176(Peek, { tableId, recordId, onPage, ...onClose ? { onClose } : {} }),
55978
- onPage ? /* @__PURE__ */ jsxs164(Fragment73, { children: [
55979
- /* @__PURE__ */ jsx176(RecordBody, { tableId, recordId }),
55980
- /* @__PURE__ */ jsx176(LinkedLists, { tableId, recordId }),
55981
- /* @__PURE__ */ jsx176(ReverseLinksSections, { tableId, recordId })
55982
- ] }) : null,
55983
- host.recordSections ? /* @__PURE__ */ jsxs164(Fragment72, { children: [
55983
+ answered ? /* @__PURE__ */ jsxs164(Fragment73, { children: [
55984
+ onPage ? /* @__PURE__ */ jsxs164(Fragment73, { children: [
55985
+ /* @__PURE__ */ jsx176(RecordBody, { tableId, recordId }),
55986
+ /* @__PURE__ */ jsx176(LinkedLists, { tableId, recordId }),
55987
+ /* @__PURE__ */ jsx176(ReverseLinksSections, { tableId, recordId })
55988
+ ] }) : null,
55989
+ host.recordSections ? /* @__PURE__ */ jsxs164(Fragment72, { children: [
55990
+ /* @__PURE__ */ jsx176(Separator13, {}),
55991
+ host.recordSections({ tableId, recordId })
55992
+ ] }) : null,
55993
+ /* @__PURE__ */ jsx176(ChecklistRunner, { tableId, recordId, quietWhenEmpty: true, className: "border-t pt-3" }),
55984
55994
  /* @__PURE__ */ jsx176(Separator13, {}),
55985
- host.recordSections({ tableId, recordId })
55986
- ] }) : null,
55987
- /* @__PURE__ */ jsx176(ChecklistRunner, { tableId, recordId, quietWhenEmpty: true, className: "border-t pt-3" }),
55988
- /* @__PURE__ */ jsx176(Separator13, {}),
55989
- /* @__PURE__ */ jsx176(CommentThread, { tableId, recordId }),
55990
- /* @__PURE__ */ jsx176(Separator13, {}),
55991
- /* @__PURE__ */ jsx176(
55992
- HistoryPanel,
55993
- {
55994
- tableId,
55995
- recordId,
55996
- onAskAboutField: (fieldKey) => onAskAboutField ? onAskAboutField(fieldKey) : setAsking(fieldKey)
55997
- }
55998
- ),
55999
- !onAskAboutField && asking ? /* @__PURE__ */ jsx176(FieldHistoryPanel, { tableId, fieldKey: asking, recordId, onClose: () => setAsking(null) }) : null
55995
+ /* @__PURE__ */ jsx176(CommentThread, { tableId, recordId }),
55996
+ /* @__PURE__ */ jsx176(Separator13, {}),
55997
+ /* @__PURE__ */ jsx176(
55998
+ HistoryPanel,
55999
+ {
56000
+ tableId,
56001
+ recordId,
56002
+ onAskAboutField: (fieldKey) => onAskAboutField ? onAskAboutField(fieldKey) : setAsking(fieldKey)
56003
+ }
56004
+ ),
56005
+ !onAskAboutField && asking ? /* @__PURE__ */ jsx176(FieldHistoryPanel, { tableId, fieldKey: asking, recordId, onClose: () => setAsking(null) }) : null
56006
+ ] }) : null
56000
56007
  ]
56001
56008
  }
56002
56009
  );
@@ -56520,6 +56527,7 @@ init_host();
56520
56527
 
56521
56528
  // src/toolbarFit.ts
56522
56529
  import { useEffect as useEffect130, useLayoutEffect as useLayoutEffect6, useState as useState155 } from "react";
56530
+ import { flushSync } from "react-dom";
56523
56531
  function widthAtFold(piece, fold) {
56524
56532
  for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
56525
56533
  const w = piece.byFold?.[f];
@@ -56619,7 +56627,7 @@ function useToolbarFit(row) {
56619
56627
  let current = 0;
56620
56628
  let pending = 0;
56621
56629
  let stopped = false;
56622
- const measure = () => {
56630
+ const measure = (sync = false) => {
56623
56631
  pending = 0;
56624
56632
  if (stopped) return;
56625
56633
  const available = row.clientWidth;
@@ -56639,12 +56647,13 @@ function useToolbarFit(row) {
56639
56647
  const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools, share });
56640
56648
  if (next !== current) {
56641
56649
  current = next;
56642
- setFold(next);
56650
+ if (sync) flushSync(() => setFold(next));
56651
+ else setFold(next);
56643
56652
  }
56644
56653
  };
56645
56654
  const schedule = () => {
56646
56655
  if (pending) return;
56647
- pending = typeof requestAnimationFrame === "function" ? requestAnimationFrame(measure) : setTimeout(measure, 0);
56656
+ pending = typeof requestAnimationFrame === "function" ? requestAnimationFrame(() => measure()) : setTimeout(() => measure(), 0);
56648
56657
  };
56649
56658
  const sizes = typeof ResizeObserver === "function" ? new ResizeObserver(schedule) : null;
56650
56659
  const watchSizes = () => {
@@ -56658,6 +56667,7 @@ function useToolbarFit(row) {
56658
56667
  };
56659
56668
  const content = new MutationObserver(() => {
56660
56669
  watchSizes();
56670
+ measure(true);
56661
56671
  schedule();
56662
56672
  });
56663
56673
  content.observe(row, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ["class", "style"] });