@ai-matrx/records-ui 0.115.95 → 0.115.97

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
@@ -10621,11 +10621,14 @@ function ButtonValue({ field: field2, recordId, inCell }) {
10621
10621
  const tableId = field2.entity_definition_id;
10622
10622
  const press = async () => {
10623
10623
  if (!client || !recordId) return setSaid({ kind: "public" });
10624
- if (needs) return setSaid({ kind: "needs", says: needs });
10624
+ if (needs && b.do) return setSaid({ kind: "needs", says: needs });
10625
10625
  setBusy(true);
10626
10626
  const answered = await client.buttonPress({ record_id: recordId, field_id: field2.id });
10627
10627
  setBusy(false);
10628
- if (!answered.ok) return setSaid({ kind: "refused", error: answered.error });
10628
+ if (!answered.ok) {
10629
+ if (needs && (answered.error.sqlstate === "22023" || answered.error.code === "invalid_argument")) return setSaid({ kind: "needs", says: needs });
10630
+ return setSaid({ kind: "refused", error: answered.error });
10631
+ }
10629
10632
  const pressed = answered.data;
10630
10633
  if (pressed.do === "open_url") {
10631
10634
  const opened = typeof window !== "undefined" ? openOutbound(pressed.url, "_blank", "noopener") : null;
@@ -51221,6 +51224,7 @@ import {
51221
51224
  } from "@ai-matrx/records/react";
51222
51225
  import { exportCsv as exportCsv2, onRecordChanged as onRecordChanged2 } from "@ai-matrx/records/core";
51223
51226
  import { downloadFile as downloadFile3 } from "@ai-matrx/kit/download";
51227
+ import { formatCount as formatCount7 } from "@ai-matrx/kit/format";
51224
51228
  import { BasicInput as BasicInput35, Button as Button108, Checkbox as Checkbox19, Skeleton as Skeleton40, cn as cn93 } from "@ai-matrx/design-system";
51225
51229
  import { formFromSummary as formFromSummary2 } from "@ai-matrx/records/forms";
51226
51230
 
@@ -51795,7 +51799,7 @@ function NumberBlockView({ block, viewerUserId, extra }) {
51795
51799
  const read = useElementRows(block, viewerUserId, extra, false);
51796
51800
  if (read.error) return /* @__PURE__ */ jsx164(RefusalLine, { error: read.error });
51797
51801
  if (read.waiting || read.total === null) return /* @__PURE__ */ jsx164(Skeleton40, { className: "h-12 w-24" });
51798
- return /* @__PURE__ */ jsx164("p", { className: "text-3xl font-semibold tabular-nums", "data-records-page-number": block.id, children: read.total.toLocaleString() });
51802
+ return /* @__PURE__ */ jsx164("p", { className: "text-3xl font-semibold tabular-nums", "data-records-page-number": block.id, children: formatCount7(read.total) });
51799
51803
  }
51800
51804
  function LayoutBlockView({ block, viewerUserId, extra }) {
51801
51805
  const door = useInterfaceDoor();
@@ -54686,7 +54690,7 @@ function TableReferenceDialog({
54686
54690
  }
54687
54691
 
54688
54692
  // src/TableDuplicate.tsx
54689
- import { formatCount as formatCount7 } from "@ai-matrx/kit/format";
54693
+ import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
54690
54694
  import { useState as useState152 } from "react";
54691
54695
  import { tableShapeChanged as tableShapeChanged14, useRecordsClient as useRecordsClient107 } from "@ai-matrx/records/react";
54692
54696
  import { Button as Button120, Dialog as Dialog22, DialogContent as DialogContent22, DialogFooter as DialogFooter13, DialogHeader as DialogHeader22, DialogTitle as DialogTitle22, ErrorBox as ErrorBox8, Input as Input11, Switch as Switch7 } from "@ai-matrx/design-system";
@@ -54695,7 +54699,7 @@ function copyNameFor(name) {
54695
54699
  return `${name.trim() || "Table"} (copy)`;
54696
54700
  }
54697
54701
  function duplicateProgressWords(p) {
54698
- if (p.records && p.records.total > 0) return `Copying records \xB7 ${formatCount7(p.records.done)} of ${formatCount7(p.records.total)}`;
54702
+ if (p.records && p.records.total > 0) return `Copying records \xB7 ${formatCount8(p.records.done)} of ${formatCount8(p.records.total)}`;
54699
54703
  if (p.views.total > 0 && p.step === "views") return `Copying views \xB7 ${p.views.done} of ${p.views.total}`;
54700
54704
  return "Copying columns\u2026";
54701
54705
  }
@@ -54752,7 +54756,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
54752
54756
  " columns, ",
54753
54757
  phase.copy.copied.views,
54754
54758
  " views",
54755
- phase.copy.copied.withRecords ? `, ${formatCount7(phase.copy.copied.records)} records` : "",
54759
+ phase.copy.copied.withRecords ? `, ${formatCount8(phase.copy.copied.records)} records` : "",
54756
54760
  "."
54757
54761
  ] }),
54758
54762
  phase.copy.notCopied.length > 0 ? /* @__PURE__ */ jsxs166("p", { className: "text-xs text-muted-foreground", children: [
@@ -56722,7 +56726,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
56722
56726
  }
56723
56727
 
56724
56728
  // src/entityViews.tsx
56725
- import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
56729
+ import { formatCount as formatCount9 } from "@ai-matrx/kit/format";
56726
56730
  import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
56727
56731
  import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
56728
56732
  import { useEffect as useEffect132, useMemo as useMemo86, useRef as useRef69, useState as useState156 } from "react";
@@ -56915,7 +56919,7 @@ function EntityTablePageBody({
56915
56919
  return /* @__PURE__ */ jsxs170("div", { className: cn104("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
56916
56920
  presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs170("div", { className: "flex min-w-0 items-center gap-2", children: [
56917
56921
  presentation === "page" ? /* @__PURE__ */ jsx182("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
56918
- presentation === "page" ? /* @__PURE__ */ jsx182("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount8(entity.total) }) : null,
56922
+ presentation === "page" ? /* @__PURE__ */ jsx182("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount9(entity.total) }) : null,
56919
56923
  /* @__PURE__ */ jsxs170("span", { className: "ml-auto flex items-center gap-1", children: [
56920
56924
  boardable ? /* @__PURE__ */ jsxs170(Fragment76, { children: [
56921
56925
  /* @__PURE__ */ jsx182(Button123, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),