@ai-matrx/records-ui 0.116.123 → 0.116.124

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/{SaveToTable-7Z33WFLA.js → SaveToTable-BEKANHD3.js} +4 -4
  3. package/dist/{chunk-W2P3LXJY.js → chunk-5RU7BPCU.js} +2 -2
  4. package/dist/{chunk-CSGNQAQD.js → chunk-6DK2DKTD.js} +2 -2
  5. package/dist/{chunk-CSGNQAQD.js.map → chunk-6DK2DKTD.js.map} +1 -1
  6. package/dist/{chunk-EPZG2VCY.js → chunk-B7A3B6F4.js} +2 -2
  7. package/dist/{chunk-5452DUL7.js → chunk-EB6IVWGJ.js} +188 -74
  8. package/dist/chunk-EB6IVWGJ.js.map +1 -0
  9. package/dist/data-source.d.cts +1 -1
  10. package/dist/data-source.d.ts +1 -1
  11. package/dist/decision-gate.d.cts +4 -4
  12. package/dist/decision-gate.d.ts +4 -4
  13. package/dist/entity-doors.d.cts +24 -28
  14. package/dist/entity-doors.d.ts +24 -28
  15. package/dist/entity-ref.d.cts +48 -52
  16. package/dist/entity-ref.d.ts +48 -52
  17. package/dist/first-page.d.cts +4 -4
  18. package/dist/first-page.d.ts +4 -4
  19. package/dist/helpers.cjs.map +1 -1
  20. package/dist/helpers.d.cts +104 -106
  21. package/dist/helpers.d.ts +104 -106
  22. package/dist/helpers.js.map +1 -1
  23. package/dist/html-frame.d.cts +2 -2
  24. package/dist/html-frame.d.ts +2 -2
  25. package/dist/index.cjs +531 -282
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +488 -480
  28. package/dist/index.d.ts +488 -480
  29. package/dist/index.js +341 -206
  30. package/dist/index.js.map +1 -1
  31. package/dist/list-dimensions.cjs +2 -2
  32. package/dist/list-dimensions.cjs.map +1 -1
  33. package/dist/list-dimensions.d.cts +8 -8
  34. package/dist/list-dimensions.d.ts +8 -8
  35. package/dist/list-dimensions.js +3 -3
  36. package/dist/list-dimensions.js.map +1 -1
  37. package/dist/objectActions-DeP_tTmc.d.cts +12 -12
  38. package/dist/objectActions-DeP_tTmc.d.ts +12 -12
  39. package/dist/pickers.cjs +179 -55
  40. package/dist/pickers.cjs.map +1 -1
  41. package/dist/pickers.d.cts +13 -13
  42. package/dist/pickers.d.ts +13 -13
  43. package/dist/pickers.js +3 -3
  44. package/dist/skeleton.d.cts +11 -11
  45. package/dist/skeleton.d.ts +11 -11
  46. package/dist/table-shape.d.cts +7 -7
  47. package/dist/table-shape.d.ts +7 -7
  48. package/package.json +2 -2
  49. package/dist/chunk-5452DUL7.js.map +0 -1
  50. /package/dist/{SaveToTable-7Z33WFLA.js.map → SaveToTable-BEKANHD3.js.map} +0 -0
  51. /package/dist/{chunk-W2P3LXJY.js.map → chunk-5RU7BPCU.js.map} +0 -0
  52. /package/dist/{chunk-EPZG2VCY.js.map → chunk-B7A3B6F4.js.map} +0 -0
@@ -49,13 +49,13 @@ import {
49
49
  useRecordsUi,
50
50
  useTableRights,
51
51
  writeOnTheWinningVersion_exports
52
- } from "./chunk-W2P3LXJY.js";
52
+ } from "./chunk-5RU7BPCU.js";
53
53
  import {
54
54
  refusalForAPerson,
55
55
  refusalIsMissingInput,
56
56
  refusalSentence,
57
57
  withoutInternalCodes
58
- } from "./chunk-CSGNQAQD.js";
58
+ } from "./chunk-6DK2DKTD.js";
59
59
  import {
60
60
  kindItemWords,
61
61
  kindLabel,
@@ -1868,14 +1868,10 @@ function AddressControl({ value, onChange, disabled, id }) {
1868
1868
  part
1869
1869
  )) });
1870
1870
  }
1871
- function barcodeDetector() {
1872
- const ctor = globalThis.BarcodeDetector;
1873
- return typeof ctor === "function" ? ctor : null;
1874
- }
1875
1871
  function BarcodeControl({ value, onChange, disabled, id }) {
1876
1872
  const file = useRef4(null);
1877
1873
  const [said2, setSaid] = useState7(null);
1878
- const Detect = barcodeDetector();
1874
+ const [reading, setReading] = useState7(false);
1879
1875
  return /* @__PURE__ */ jsxs6("span", { className: "flex flex-col gap-1", children: [
1880
1876
  /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-1.5", children: [
1881
1877
  /* @__PURE__ */ jsx9(
@@ -1889,13 +1885,17 @@ function BarcodeControl({ value, onChange, disabled, id }) {
1889
1885
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
1890
1886
  }
1891
1887
  ),
1892
- Detect && !disabled ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1888
+ !disabled ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1893
1889
  /* @__PURE__ */ jsx9(
1894
1890
  "button",
1895
1891
  {
1896
1892
  type: "button",
1897
1893
  className: "shrink-0 rounded-md border px-2 py-1 text-xs hover:bg-accent",
1898
- onClick: () => file.current?.click(),
1894
+ "aria-disabled": reading || void 0,
1895
+ "aria-busy": reading || void 0,
1896
+ onClick: () => {
1897
+ if (!reading) file.current?.click();
1898
+ },
1899
1899
  children: "Scan"
1900
1900
  }
1901
1901
  ),
@@ -1911,14 +1911,19 @@ function BarcodeControl({ value, onChange, disabled, id }) {
1911
1911
  const photo = e.target.files?.[0];
1912
1912
  e.target.value = "";
1913
1913
  if (!photo) return;
1914
+ setReading(true);
1915
+ setSaid(null);
1914
1916
  try {
1915
- const found = await new Detect().detect(await createImageBitmap(photo));
1916
- if (found[0]?.rawValue) {
1917
- onChange(found[0].rawValue);
1917
+ const { readBarcodeFromPhoto } = await import("@ai-matrx/print/barcode");
1918
+ const found = await readBarcodeFromPhoto(photo);
1919
+ if (found) {
1920
+ onChange(found.value);
1918
1921
  setSaid(null);
1919
1922
  } else setSaid("No barcode in that photo. Try closer, in good light.");
1920
1923
  } catch {
1921
- setSaid("This phone could not read that photo. Type the code instead.");
1924
+ setSaid("That photo could not be read. Type the code instead.");
1925
+ } finally {
1926
+ setReading(false);
1922
1927
  }
1923
1928
  }
1924
1929
  }
@@ -2333,7 +2338,7 @@ import { useContext as useContext4, useEffect as useEffect22, useRef as useRef15
2333
2338
  import { Button as Button20, Dialog as Dialog5, ErrorBox as ErrorBox2, DialogContent as DialogContent5, DialogDescription as DialogDescription3, DialogHeader as DialogHeader5, DialogTitle as DialogTitle5, Popover as Popover4, PopoverContent as PopoverContent4, PopoverTrigger as PopoverTrigger4, cn as cn20 } from "@ai-matrx/design-system";
2334
2339
  import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, isStyleColor } from "@ai-matrx/design-system/data-table";
2335
2340
  import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
2336
- import { useOptionalRecordsClient as useOptionalRecordsClient9, useTable as useTable4 } from "@ai-matrx/records/react";
2341
+ import { useOptionalRecordsClient as useOptionalRecordsClient9, useTable as useTable5 } from "@ai-matrx/records/react";
2337
2342
 
2338
2343
  // src/gridOpen.tsx
2339
2344
  import { createContext as createContext2 } from "react";
@@ -2481,7 +2486,7 @@ import {
2481
2486
  useRecords as useRecords2,
2482
2487
  useRecordsClient as useRecordsClient14,
2483
2488
  useReverseColumns,
2484
- useTable as useTable3
2489
+ useTable as useTable4
2485
2490
  } from "@ai-matrx/records/react";
2486
2491
  import { announceRecordChanged } from "@ai-matrx/records/core";
2487
2492
  import {
@@ -2886,9 +2891,10 @@ function ReferenceBuilder({
2886
2891
 
2887
2892
  // src/FormulaTextEditor.tsx
2888
2893
  import { useEffect as useEffect7, useMemo as useMemo4, useRef as useRef6, useState as useState10 } from "react";
2889
- import { useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
2894
+ import { useRecordsClient as useRecordsClient3, useTable as useTable2 } from "@ai-matrx/records/react";
2890
2895
  import { RULE_NODE_KINDS } from "@ai-matrx/records";
2891
2896
  import { BasicTextarea as BasicTextarea2, Button as Button6, Label as Label3, cn as cn6 } from "@ai-matrx/design-system";
2897
+ import { MenuLookPanel, MenuLookPanelItem } from "@ai-matrx/design-system/menu-look";
2892
2898
  import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
2893
2899
  var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
2894
2900
  "fx.add",
@@ -2923,6 +2929,38 @@ function sampleWords(preview) {
2923
2929
  if (typeof v === "number" || typeof v === "string") return String(v);
2924
2930
  return JSON.stringify(v);
2925
2931
  }
2932
+ function pieceAtCaret(text, caret) {
2933
+ const before = text.slice(0, Math.max(0, Math.min(caret, text.length)));
2934
+ let quote = null;
2935
+ let brace = -1;
2936
+ for (let i = 0; i < before.length; i += 1) {
2937
+ const ch = before[i];
2938
+ if (quote) {
2939
+ if (ch === quote) quote = null;
2940
+ continue;
2941
+ }
2942
+ if (brace >= 0) {
2943
+ if (ch === "}") brace = -1;
2944
+ continue;
2945
+ }
2946
+ if (ch === '"' || ch === "'") quote = ch;
2947
+ else if (ch === "{") brace = i;
2948
+ }
2949
+ if (quote) return null;
2950
+ if (brace >= 0) {
2951
+ const typed = before.slice(brace + 1);
2952
+ return typed.includes("\n") ? null : { kind: "column", start: brace, typed };
2953
+ }
2954
+ const word = /[A-Za-z_][A-Za-z0-9_]*$/.exec(before);
2955
+ if (!word || word[0].length < 2) return null;
2956
+ return { kind: "function", start: word.index, typed: word[0] };
2957
+ }
2958
+ function piecesMatching(names2, typed, limit = 8) {
2959
+ const t = typed.trim().toLowerCase();
2960
+ const starts = names2.filter((n) => n.toLowerCase().startsWith(t));
2961
+ const inside = t === "" ? [] : names2.filter((n) => !n.toLowerCase().startsWith(t) && n.toLowerCase().includes(t));
2962
+ return [...starts, ...inside].slice(0, limit);
2963
+ }
2926
2964
  function FormulaTextEditor({
2927
2965
  tableId,
2928
2966
  text,
@@ -2936,18 +2974,20 @@ function FormulaTextEditor({
2936
2974
  const client = useRecordsClient3();
2937
2975
  const host = useRecordsUi();
2938
2976
  const [parsed, setParsed] = useState10(null);
2977
+ const table = useTable2(tableId);
2939
2978
  const [firstRow, setFirstRow] = useState10(null);
2940
2979
  useEffect7(() => {
2941
2980
  if (sampleRecordId !== void 0) return;
2942
2981
  let live = true;
2943
2982
  void client.list({ table_id: tableId, limit: 1 }).then((read) => {
2944
- if (live && read.ok) setFirstRow(read.data.rows[0]?.id ?? null);
2983
+ if (live && read.ok) setFirstRow(read.data.rows[0] ?? null);
2945
2984
  });
2946
2985
  return () => {
2947
2986
  live = false;
2948
2987
  };
2949
2988
  }, [client, tableId, sampleRecordId]);
2950
- const sampled = sampleRecordId !== void 0 ? sampleRecordId : firstRow;
2989
+ const sampledName = firstRow ? rowNameIn(table.data, firstRow, "") : "";
2990
+ const sampled = sampleRecordId !== void 0 ? sampleRecordId : firstRow?.id ?? null;
2951
2991
  const [error, setError] = useState10(null);
2952
2992
  const box = useRef6(null);
2953
2993
  const report = useRef6(onChecked);
@@ -2981,17 +3021,62 @@ function FormulaTextEditor({
2981
3021
  clearTimeout(timer);
2982
3022
  };
2983
3023
  }, [client, tableId, text, sampled]);
2984
- const insert = (piece) => {
3024
+ const insert = (piece2) => {
2985
3025
  const el = box.current;
2986
3026
  const at = el?.selectionStart ?? text.length;
2987
3027
  const to = el?.selectionEnd ?? at;
2988
- onText(`${text.slice(0, at)}${piece}${text.slice(to)}`);
3028
+ onText(`${text.slice(0, at)}${piece2}${text.slice(to)}`);
2989
3029
  requestAnimationFrame(() => {
2990
3030
  el?.focus();
2991
- const caret = at + piece.length - (piece.endsWith("()") ? 1 : 0);
2992
- el?.setSelectionRange(caret, caret);
3031
+ const caret2 = at + piece2.length - (piece2.endsWith("()") ? 1 : 0);
3032
+ el?.setSelectionRange(caret2, caret2);
2993
3033
  });
2994
3034
  };
3035
+ const [caret, setCaret] = useState10(null);
3036
+ const [active, setActive] = useState10(0);
3037
+ const [dismissedAt, setDismissedAt] = useState10(null);
3038
+ const piece = caret === null ? null : pieceAtCaret(text, caret);
3039
+ const offered = (() => {
3040
+ if (!piece) return [];
3041
+ if (piece.kind === "column") {
3042
+ return piecesMatching(columns.map((f) => fieldName(f)), piece.typed).map((name) => ({ label: name, complete: `{${name}}`, caretBack: 0 }));
3043
+ }
3044
+ const found = piecesMatching(STORE_FORMULA_FUNCTION_NAMES, piece.typed);
3045
+ if (found.length === 1 && found[0] === piece.typed.toUpperCase()) return [];
3046
+ return found.map((name) => ({ label: `${name}()`, complete: `${name}()`, caretBack: 1 }));
3047
+ })();
3048
+ const showList = offered.length > 0 && piece !== null && dismissedAt !== piece.start;
3049
+ useEffect7(() => setActive(0), [piece?.start, piece?.typed]);
3050
+ const track = (el) => setCaret(el.selectionStart === el.selectionEnd ? el.selectionStart : null);
3051
+ const accept = (index) => {
3052
+ const pick = offered[index];
3053
+ const el = box.current;
3054
+ if (!pick || !piece || caret === null) return;
3055
+ const end = piece.kind === "column" && text[caret] === "}" ? caret + 1 : caret;
3056
+ const next = `${text.slice(0, piece.start)}${pick.complete}${text.slice(end)}`;
3057
+ const at = piece.start + pick.complete.length - pick.caretBack;
3058
+ onText(next);
3059
+ setCaret(at);
3060
+ requestAnimationFrame(() => {
3061
+ el?.focus();
3062
+ el?.setSelectionRange(at, at);
3063
+ });
3064
+ };
3065
+ const onKeys = (e) => {
3066
+ if (!showList) return;
3067
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
3068
+ e.preventDefault();
3069
+ const step = e.key === "ArrowDown" ? 1 : -1;
3070
+ setActive((i) => (i + step + offered.length) % offered.length);
3071
+ } else if (e.key === "Enter" || e.key === "Tab") {
3072
+ e.preventDefault();
3073
+ accept(active);
3074
+ } else if (e.key === "Escape") {
3075
+ e.preventDefault();
3076
+ e.stopPropagation();
3077
+ if (piece) setDismissedAt(piece.start);
3078
+ }
3079
+ };
2995
3080
  const where = useMemo4(() => {
2996
3081
  if (!parsed || parsed.ok) return null;
2997
3082
  const at = Math.max(0, Math.min(parsed.position ?? 0, parsed.text.length));
@@ -3010,44 +3095,73 @@ function FormulaTextEditor({
3010
3095
  ...purpose ? { purpose } : {}
3011
3096
  }) }) : null
3012
3097
  ] }),
3013
- /* @__PURE__ */ jsx14(
3014
- BasicTextarea2,
3015
- {
3016
- ref: box,
3017
- value: text,
3018
- rows: 2,
3019
- "aria-label": "The formula",
3020
- placeholder: columns.length > 0 ? `{${fieldName(columns[0])}}` : "Write a formula",
3021
- className: "font-mono text-xs",
3022
- onChange: (e) => onText(e.target.value)
3023
- }
3024
- ),
3025
- parsed?.ok ? /* @__PURE__ */ jsxs11("p", { "data-records-formula-ok": "", className: "text-[11px] text-muted-foreground", children: [
3026
- "Reads ",
3027
- parsed.references.length === 0 ? "no column" : parsed.references.map((r) => r.name).join(", "),
3028
- " \xB7 gives ",
3029
- RESULT_WORD[parsed.result_type] ?? "an answer",
3030
- "."
3031
- ] }) : null,
3032
- parsed?.ok && parsed.record_id ? /* @__PURE__ */ jsxs11("p", { "data-records-formula-sample": "", className: "truncate text-[11px]", title: sampleWords(parsed), children: [
3033
- /* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
3034
- sampleRecordId ? "This record" : "First row",
3035
- ": "
3036
- ] }),
3037
- /* @__PURE__ */ jsx14("span", { className: cn6("font-mono", parsed.error ? "text-muted-foreground" : "text-foreground"), children: sampleWords(parsed) })
3038
- ] }) : null,
3039
- parsed && !parsed.ok ? (
3040
- // NOT A REFUSAL, SO NOT RED: nothing was pressed. It is the store's reading of the
3041
- // text as it stands, drawn the way the panel draws what Save is still waiting for.
3042
- /* @__PURE__ */ jsxs11("div", { "data-records-formula-mistake": "", role: "status", className: "text-[11px] text-foreground", children: [
3043
- /* @__PURE__ */ jsx14("p", { children: parsed.error }),
3044
- where ? /* @__PURE__ */ jsxs11("p", { className: "mt-0.5 font-mono text-foreground", children: [
3045
- where.before,
3046
- /* @__PURE__ */ jsx14("span", { className: "bg-amber-500/30 px-0.5", children: "\u258F" }),
3047
- where.after
3048
- ] }) : null
3049
- ] })
3050
- ) : null,
3098
+ /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
3099
+ /* @__PURE__ */ jsx14(
3100
+ BasicTextarea2,
3101
+ {
3102
+ ref: box,
3103
+ value: text,
3104
+ rows: 2,
3105
+ "aria-label": "The formula",
3106
+ "aria-autocomplete": "list",
3107
+ "aria-expanded": showList,
3108
+ ...showList ? { "aria-controls": "records-formula-suggestions" } : {},
3109
+ placeholder: columns.length > 0 ? `{${fieldName(columns[0])}}` : "Write a formula",
3110
+ className: "font-mono text-xs",
3111
+ onChange: (e) => {
3112
+ onText(e.target.value);
3113
+ track(e.target);
3114
+ },
3115
+ onSelect: (e) => track(e.currentTarget),
3116
+ onKeyDown: onKeys,
3117
+ onBlur: () => setCaret(null)
3118
+ }
3119
+ ),
3120
+ showList ? (
3121
+ // Floats over what is below the box, so opening it moves nothing on the panel.
3122
+ /* @__PURE__ */ jsx14("div", { className: "absolute left-0 top-full z-50 mt-1", "data-records-formula-suggestions": "", children: /* @__PURE__ */ jsx14(MenuLookPanel, { id: "records-formula-suggestions", role: "listbox", "aria-label": piece?.kind === "column" ? "Columns" : "Functions", density: "compact", children: offered.map((o, i) => /* @__PURE__ */ jsx14(
3123
+ MenuLookPanelItem,
3124
+ {
3125
+ role: "option",
3126
+ "aria-selected": i === active,
3127
+ ...i === active ? { "data-highlighted": "" } : {},
3128
+ label: o.label,
3129
+ onMouseDown: (e) => e.preventDefault(),
3130
+ onMouseEnter: () => setActive(i),
3131
+ onClick: () => accept(i)
3132
+ },
3133
+ o.label
3134
+ )) }) })
3135
+ ) : null
3136
+ ] }),
3137
+ /* @__PURE__ */ jsxs11("div", { "data-records-formula-status": "", className: "min-h-9", children: [
3138
+ parsed?.ok ? /* @__PURE__ */ jsxs11("p", { "data-records-formula-ok": "", className: "text-[11px] text-muted-foreground", children: [
3139
+ "Reads ",
3140
+ parsed.references.length === 0 ? "no column" : parsed.references.map((r) => r.name).join(", "),
3141
+ " \xB7 gives ",
3142
+ RESULT_WORD[parsed.result_type] ?? "an answer",
3143
+ "."
3144
+ ] }) : null,
3145
+ parsed?.ok && parsed.record_id ? /* @__PURE__ */ jsxs11("p", { "data-records-formula-sample": "", className: "truncate text-[11px]", title: sampleWords(parsed), children: [
3146
+ /* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
3147
+ sampleRecordId ? "This record" : sampledName ? `On ${sampledName}` : "On one row",
3148
+ ": "
3149
+ ] }),
3150
+ /* @__PURE__ */ jsx14("span", { className: cn6("font-mono", parsed.error ? "text-muted-foreground" : "text-foreground"), children: sampleWords(parsed) })
3151
+ ] }) : null,
3152
+ parsed && !parsed.ok ? (
3153
+ // NOT A REFUSAL, SO NOT RED: nothing was pressed. It is the store's reading of the
3154
+ // text as it stands, drawn the way the panel draws what Save is still waiting for.
3155
+ /* @__PURE__ */ jsxs11("div", { "data-records-formula-mistake": "", role: "status", className: "text-[11px] text-foreground", children: [
3156
+ /* @__PURE__ */ jsx14("p", { children: parsed.error }),
3157
+ where ? /* @__PURE__ */ jsxs11("p", { className: "mt-0.5 font-mono text-foreground", children: [
3158
+ where.before,
3159
+ /* @__PURE__ */ jsx14("span", { className: "bg-amber-500/30 px-0.5", children: "\u258F" }),
3160
+ where.after
3161
+ ] }) : null
3162
+ ] })
3163
+ ) : null
3164
+ ] }),
3051
3165
  error ? /* @__PURE__ */ jsx14(RefusalLine, { error }) : null,
3052
3166
  /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", children: [
3053
3167
  /* @__PURE__ */ jsx14("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
@@ -4648,7 +4762,7 @@ import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
4648
4762
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
4649
4763
  import { momentZoneOptions } from "@ai-matrx/design-system/field-formats";
4650
4764
  import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
4651
- var SaveToTable = lazy(() => import("./SaveToTable-7Z33WFLA.js").then((m) => ({ default: m.SaveToTable })));
4765
+ var SaveToTable = lazy(() => import("./SaveToTable-BEKANHD3.js").then((m) => ({ default: m.SaveToTable })));
4652
4766
  var LONGEST_READ = 5e5;
4653
4767
  var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
4654
4768
  function isPlainObject(v) {
@@ -8457,7 +8571,7 @@ import {
8457
8571
  useRecord,
8458
8572
  useRecordMutation,
8459
8573
  useRecordsClient as useRecordsClient12,
8460
- useTable as useTable2
8574
+ useTable as useTable3
8461
8575
  } from "@ai-matrx/records/react";
8462
8576
  import { recordTypeOf } from "@ai-matrx/records";
8463
8577
  import { asWriteConflict, predictWriteRefusals, wholeValueOf as wholeValueOf3 } from "@ai-matrx/records/core";
@@ -9645,7 +9759,7 @@ function CustomRecordForm({
9645
9759
  }) {
9646
9760
  const host = useRecordsUi();
9647
9761
  const [draft, setDraft] = useState29(() => recordId ? {} : { ...initial ?? {} });
9648
- const table = useTable2(tableId);
9762
+ const table = useTable3(tableId);
9649
9763
  const typeInDraft = recordTypeOf(table.data, draft);
9650
9764
  const typeNow = typeInDraft ?? recordType;
9651
9765
  const fields = useFields4(tableId, typeNow);
@@ -10202,7 +10316,7 @@ function FieldEditor(props) {
10202
10316
  const entityToken = props.entityToken ?? null;
10203
10317
  const onEntity = entityToken !== null;
10204
10318
  const tableId = props.tableId ?? "";
10205
- const table = useTable3(onEntity ? null : tableId);
10319
+ const table = useTable4(onEntity ? null : tableId);
10206
10320
  const tableFields = useFields5(onEntity ? null : tableId, EVERY_RECORD_TYPE);
10207
10321
  const entityFields = useEntityFields(entityToken);
10208
10322
  const fields = onEntity ? entityFields : tableFields;
@@ -10357,7 +10471,7 @@ function FieldEditor(props) {
10357
10471
  const [showOnOther, setShowOnOther] = useState31(true);
10358
10472
  const [nestsSubItems, setNestsSubItems] = useState31(false);
10359
10473
  const [reverseRefused, setReverseRefused] = useState31(null);
10360
- const otherTable = useTable3(!field2 && type === "relation" && relationTarget !== "" ? relationTarget : null);
10474
+ const otherTable = useTable4(!field2 && type === "relation" && relationTarget !== "" ? relationTarget : null);
10361
10475
  const [display, setDisplay] = useState31(start?.display ?? null);
10362
10476
  const [formulaOp, setFormulaOp] = useState31(() => formulaOpOf(start));
10363
10477
  const [formulaFields, setFormulaFields] = useState31(() => formulaFieldIdsOf(start));
@@ -10406,7 +10520,7 @@ function FieldEditor(props) {
10406
10520
  }, [type, editing]);
10407
10521
  const newDefault = !editing && !onEntity && newColumnTakesADefault(type) ? defaultToKeep(startsWith) : null;
10408
10522
  const farFieldsOfLink = useFields5(field2 && sourceKindOf(field2) === "link" && !onEntity ? field2.relation_target ?? null : null);
10409
- const farTable = useTable3(field2 && sourceKindOf(field2) === "link" && !onEntity ? field2.relation_target ?? null : null);
10523
+ const farTable = useTable4(field2 && sourceKindOf(field2) === "link" && !onEntity ? field2.relation_target ?? null : null);
10410
10524
  const linkReaders = useMemo13(
10411
10525
  () => field2 ? readingThroughLink(field2, farFieldsOfLink.data ?? []) : [],
10412
10526
  [field2, farFieldsOfLink.data]
@@ -11655,7 +11769,7 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
11655
11769
  const [opening, setOpening] = useState32(false);
11656
11770
  const here = useContext4(OpenRecordHereContext);
11657
11771
  const host = useRecordsUi();
11658
- const addsTo = useTable4(b?.do === "add_row" ? b.table_id ?? field2.entity_definition_id : null);
11772
+ const addsTo = useTable5(b?.do === "add_row" ? b.table_id ?? field2.entity_definition_id : null);
11659
11773
  const waitingOn = useRef15(0);
11660
11774
  useEffect22(() => () => void (waitingOn.current += 1), []);
11661
11775
  if (!b) return null;
@@ -13562,7 +13676,7 @@ function sameParts(a, b) {
13562
13676
 
13563
13677
  // src/TablePickers.tsx
13564
13678
  import { useEffect as useEffect27, useMemo as useMemo14, useState as useState38 } from "react";
13565
- import { RecordsProvider as RecordsProvider2, useFields as useFields6, useRecords as useRecords3, useTable as useTable5 } from "@ai-matrx/records/react";
13679
+ import { RecordsProvider as RecordsProvider2, useFields as useFields6, useRecords as useRecords3, useTable as useTable6 } from "@ai-matrx/records/react";
13566
13680
  import { Button as Button23, CreatablePicker, displayId } from "@ai-matrx/design-system";
13567
13681
  import { momentZoneOptions as momentZoneOptions2 } from "@ai-matrx/design-system/field-formats";
13568
13682
  import { Fragment as Fragment17, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
@@ -13765,7 +13879,7 @@ function ColumnValueRow({
13765
13879
  ] });
13766
13880
  }
13767
13881
  function RecordPicker({ tableId, value, onChange, disabled }) {
13768
- const table = useTable5(tableId);
13882
+ const table = useTable6(tableId);
13769
13883
  const records = useRecords3(tableId, { pageSize: 200 });
13770
13884
  const rows = records.data?.rows ?? [];
13771
13885
  const options = rows.map((row) => ({
@@ -13795,7 +13909,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
13795
13909
  // src/DataBindingPicker.tsx
13796
13910
  import { useEffect as useEffect28, useMemo as useMemo15 } from "react";
13797
13911
  import { isEntityReferenceConfig } from "@ai-matrx/records";
13798
- import { useFields as useFields7, useTable as useTable6 } from "@ai-matrx/records/react";
13912
+ import { useFields as useFields7, useTable as useTable7 } from "@ai-matrx/records/react";
13799
13913
  import { BasicInput as BasicInput12, Button as Button24, CreatablePicker as CreatablePicker2, cn as cn24 } from "@ai-matrx/design-system";
13800
13914
  import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
13801
13915
  var DATA_BINDING_SHAPES = [
@@ -13885,7 +13999,7 @@ function BindingDetails({
13885
13999
  disabled,
13886
14000
  defaultRowLimit
13887
14001
  }) {
13888
- const table = useTable6(tableId);
14002
+ const table = useTable7(tableId);
13889
14003
  const fields = useFields7(tableId);
13890
14004
  const fieldList = useMemo15(() => fields.data ?? [], [fields.data]);
13891
14005
  const shape = binding.semantic_type;
@@ -14034,7 +14148,7 @@ function BindingDetails({
14034
14148
  }
14035
14149
 
14036
14150
  // src/PickedSummaries.tsx
14037
- import { useFields as useFields8, useRecord as useRecord2, useTable as useTable7 } from "@ai-matrx/records/react";
14151
+ import { useFields as useFields8, useRecord as useRecord2, useTable as useTable8 } from "@ai-matrx/records/react";
14038
14152
  import { Fragment as Fragment18, jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
14039
14153
  function TableNameText({ dataSource, tableId }) {
14040
14154
  const tables = useTablesAnywhere(dataSource);
@@ -14102,7 +14216,7 @@ function RecordNameText({
14102
14216
  );
14103
14217
  }
14104
14218
  function RecordNameWords({ tableId, recordId }) {
14105
- const table = useTable7(tableId);
14219
+ const table = useTable8(tableId);
14106
14220
  const record = useRecord2(recordId);
14107
14221
  if (record.loading || table.loading) return /* @__PURE__ */ jsx53(Fragment18, { children: "\u2026" });
14108
14222
  if (record.error) return /* @__PURE__ */ jsx53(Fragment18, { children: "Couldn't load this record" });
@@ -14360,4 +14474,4 @@ export {
14360
14474
  RecordNameText,
14361
14475
  HeldChangeDecision
14362
14476
  };
14363
- //# sourceMappingURL=chunk-5452DUL7.js.map
14477
+ //# sourceMappingURL=chunk-EB6IVWGJ.js.map