@ai-matrx/records-ui 0.116.122 → 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 (53) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{SaveToTable-VNAYIDXB.js → SaveToTable-BEKANHD3.js} +4 -3
  3. package/dist/{chunk-KJAVVXRW.js → chunk-5RU7BPCU.js} +8 -230
  4. package/dist/chunk-5RU7BPCU.js.map +1 -0
  5. package/dist/chunk-6DK2DKTD.js +235 -0
  6. package/dist/chunk-6DK2DKTD.js.map +1 -0
  7. package/dist/{chunk-6RFL5KYR.js → chunk-B7A3B6F4.js} +2 -2
  8. package/dist/{chunk-U2B3TLDZ.js → chunk-EB6IVWGJ.js} +193 -77
  9. package/dist/chunk-EB6IVWGJ.js.map +1 -0
  10. package/dist/data-source.d.cts +1 -1
  11. package/dist/data-source.d.ts +1 -1
  12. package/dist/decision-gate.d.cts +4 -4
  13. package/dist/decision-gate.d.ts +4 -4
  14. package/dist/entity-doors.d.cts +24 -28
  15. package/dist/entity-doors.d.ts +24 -28
  16. package/dist/entity-ref.d.cts +48 -52
  17. package/dist/entity-ref.d.ts +48 -52
  18. package/dist/first-page.d.cts +4 -4
  19. package/dist/first-page.d.ts +4 -4
  20. package/dist/helpers.cjs.map +1 -1
  21. package/dist/helpers.d.cts +104 -106
  22. package/dist/helpers.d.ts +104 -106
  23. package/dist/helpers.js.map +1 -1
  24. package/dist/html-frame.d.cts +2 -2
  25. package/dist/html-frame.d.ts +2 -2
  26. package/dist/index.cjs +531 -282
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +488 -480
  29. package/dist/index.d.ts +488 -480
  30. package/dist/index.js +351 -214
  31. package/dist/index.js.map +1 -1
  32. package/dist/list-dimensions.cjs +203 -7
  33. package/dist/list-dimensions.cjs.map +1 -1
  34. package/dist/list-dimensions.d.cts +8 -8
  35. package/dist/list-dimensions.d.ts +8 -8
  36. package/dist/list-dimensions.js +10 -7
  37. package/dist/list-dimensions.js.map +1 -1
  38. package/dist/objectActions-DeP_tTmc.d.cts +12 -12
  39. package/dist/objectActions-DeP_tTmc.d.ts +12 -12
  40. package/dist/pickers.cjs +179 -55
  41. package/dist/pickers.cjs.map +1 -1
  42. package/dist/pickers.d.cts +13 -13
  43. package/dist/pickers.d.ts +13 -13
  44. package/dist/pickers.js +3 -2
  45. package/dist/skeleton.d.cts +11 -11
  46. package/dist/skeleton.d.ts +11 -11
  47. package/dist/table-shape.d.cts +7 -7
  48. package/dist/table-shape.d.ts +7 -7
  49. package/package.json +2 -2
  50. package/dist/chunk-KJAVVXRW.js.map +0 -1
  51. package/dist/chunk-U2B3TLDZ.js.map +0 -1
  52. /package/dist/{SaveToTable-VNAYIDXB.js.map → SaveToTable-BEKANHD3.js.map} +0 -0
  53. /package/dist/{chunk-6RFL5KYR.js.map → chunk-B7A3B6F4.js.map} +0 -0
@@ -33,9 +33,6 @@ import {
33
33
  recordName,
34
34
  recordNameIn,
35
35
  recordVersions_exports,
36
- refusalForAPerson,
37
- refusalIsMissingInput,
38
- refusalSentence,
39
36
  refusals_exports,
40
37
  resolveKeptPerson,
41
38
  rowName,
@@ -51,9 +48,14 @@ import {
51
48
  useReadRefusal,
52
49
  useRecordsUi,
53
50
  useTableRights,
54
- withoutInternalCodes,
55
51
  writeOnTheWinningVersion_exports
56
- } from "./chunk-KJAVVXRW.js";
52
+ } from "./chunk-5RU7BPCU.js";
53
+ import {
54
+ refusalForAPerson,
55
+ refusalIsMissingInput,
56
+ refusalSentence,
57
+ withoutInternalCodes
58
+ } from "./chunk-6DK2DKTD.js";
57
59
  import {
58
60
  kindItemWords,
59
61
  kindLabel,
@@ -1866,14 +1868,10 @@ function AddressControl({ value, onChange, disabled, id }) {
1866
1868
  part
1867
1869
  )) });
1868
1870
  }
1869
- function barcodeDetector() {
1870
- const ctor = globalThis.BarcodeDetector;
1871
- return typeof ctor === "function" ? ctor : null;
1872
- }
1873
1871
  function BarcodeControl({ value, onChange, disabled, id }) {
1874
1872
  const file = useRef4(null);
1875
1873
  const [said2, setSaid] = useState7(null);
1876
- const Detect = barcodeDetector();
1874
+ const [reading, setReading] = useState7(false);
1877
1875
  return /* @__PURE__ */ jsxs6("span", { className: "flex flex-col gap-1", children: [
1878
1876
  /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-1.5", children: [
1879
1877
  /* @__PURE__ */ jsx9(
@@ -1887,13 +1885,17 @@ function BarcodeControl({ value, onChange, disabled, id }) {
1887
1885
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
1888
1886
  }
1889
1887
  ),
1890
- Detect && !disabled ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1888
+ !disabled ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1891
1889
  /* @__PURE__ */ jsx9(
1892
1890
  "button",
1893
1891
  {
1894
1892
  type: "button",
1895
1893
  className: "shrink-0 rounded-md border px-2 py-1 text-xs hover:bg-accent",
1896
- 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
+ },
1897
1899
  children: "Scan"
1898
1900
  }
1899
1901
  ),
@@ -1909,14 +1911,19 @@ function BarcodeControl({ value, onChange, disabled, id }) {
1909
1911
  const photo = e.target.files?.[0];
1910
1912
  e.target.value = "";
1911
1913
  if (!photo) return;
1914
+ setReading(true);
1915
+ setSaid(null);
1912
1916
  try {
1913
- const found = await new Detect().detect(await createImageBitmap(photo));
1914
- if (found[0]?.rawValue) {
1915
- 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);
1916
1921
  setSaid(null);
1917
1922
  } else setSaid("No barcode in that photo. Try closer, in good light.");
1918
1923
  } catch {
1919
- 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);
1920
1927
  }
1921
1928
  }
1922
1929
  }
@@ -2331,7 +2338,7 @@ import { useContext as useContext4, useEffect as useEffect22, useRef as useRef15
2331
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";
2332
2339
  import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, isStyleColor } from "@ai-matrx/design-system/data-table";
2333
2340
  import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
2334
- 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";
2335
2342
 
2336
2343
  // src/gridOpen.tsx
2337
2344
  import { createContext as createContext2 } from "react";
@@ -2479,7 +2486,7 @@ import {
2479
2486
  useRecords as useRecords2,
2480
2487
  useRecordsClient as useRecordsClient14,
2481
2488
  useReverseColumns,
2482
- useTable as useTable3
2489
+ useTable as useTable4
2483
2490
  } from "@ai-matrx/records/react";
2484
2491
  import { announceRecordChanged } from "@ai-matrx/records/core";
2485
2492
  import {
@@ -2884,9 +2891,10 @@ function ReferenceBuilder({
2884
2891
 
2885
2892
  // src/FormulaTextEditor.tsx
2886
2893
  import { useEffect as useEffect7, useMemo as useMemo4, useRef as useRef6, useState as useState10 } from "react";
2887
- import { useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
2894
+ import { useRecordsClient as useRecordsClient3, useTable as useTable2 } from "@ai-matrx/records/react";
2888
2895
  import { RULE_NODE_KINDS } from "@ai-matrx/records";
2889
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";
2890
2898
  import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
2891
2899
  var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
2892
2900
  "fx.add",
@@ -2921,6 +2929,38 @@ function sampleWords(preview) {
2921
2929
  if (typeof v === "number" || typeof v === "string") return String(v);
2922
2930
  return JSON.stringify(v);
2923
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
+ }
2924
2964
  function FormulaTextEditor({
2925
2965
  tableId,
2926
2966
  text,
@@ -2934,18 +2974,20 @@ function FormulaTextEditor({
2934
2974
  const client = useRecordsClient3();
2935
2975
  const host = useRecordsUi();
2936
2976
  const [parsed, setParsed] = useState10(null);
2977
+ const table = useTable2(tableId);
2937
2978
  const [firstRow, setFirstRow] = useState10(null);
2938
2979
  useEffect7(() => {
2939
2980
  if (sampleRecordId !== void 0) return;
2940
2981
  let live = true;
2941
2982
  void client.list({ table_id: tableId, limit: 1 }).then((read) => {
2942
- if (live && read.ok) setFirstRow(read.data.rows[0]?.id ?? null);
2983
+ if (live && read.ok) setFirstRow(read.data.rows[0] ?? null);
2943
2984
  });
2944
2985
  return () => {
2945
2986
  live = false;
2946
2987
  };
2947
2988
  }, [client, tableId, sampleRecordId]);
2948
- 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;
2949
2991
  const [error, setError] = useState10(null);
2950
2992
  const box = useRef6(null);
2951
2993
  const report = useRef6(onChecked);
@@ -2979,17 +3021,62 @@ function FormulaTextEditor({
2979
3021
  clearTimeout(timer);
2980
3022
  };
2981
3023
  }, [client, tableId, text, sampled]);
2982
- const insert = (piece) => {
3024
+ const insert = (piece2) => {
2983
3025
  const el = box.current;
2984
3026
  const at = el?.selectionStart ?? text.length;
2985
3027
  const to = el?.selectionEnd ?? at;
2986
- onText(`${text.slice(0, at)}${piece}${text.slice(to)}`);
3028
+ onText(`${text.slice(0, at)}${piece2}${text.slice(to)}`);
3029
+ requestAnimationFrame(() => {
3030
+ el?.focus();
3031
+ const caret2 = at + piece2.length - (piece2.endsWith("()") ? 1 : 0);
3032
+ el?.setSelectionRange(caret2, caret2);
3033
+ });
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);
2987
3060
  requestAnimationFrame(() => {
2988
3061
  el?.focus();
2989
- const caret = at + piece.length - (piece.endsWith("()") ? 1 : 0);
2990
- el?.setSelectionRange(caret, caret);
3062
+ el?.setSelectionRange(at, at);
2991
3063
  });
2992
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
+ };
2993
3080
  const where = useMemo4(() => {
2994
3081
  if (!parsed || parsed.ok) return null;
2995
3082
  const at = Math.max(0, Math.min(parsed.position ?? 0, parsed.text.length));
@@ -3008,44 +3095,73 @@ function FormulaTextEditor({
3008
3095
  ...purpose ? { purpose } : {}
3009
3096
  }) }) : null
3010
3097
  ] }),
3011
- /* @__PURE__ */ jsx14(
3012
- BasicTextarea2,
3013
- {
3014
- ref: box,
3015
- value: text,
3016
- rows: 2,
3017
- "aria-label": "The formula",
3018
- placeholder: columns.length > 0 ? `{${fieldName(columns[0])}}` : "Write a formula",
3019
- className: "font-mono text-xs",
3020
- onChange: (e) => onText(e.target.value)
3021
- }
3022
- ),
3023
- parsed?.ok ? /* @__PURE__ */ jsxs11("p", { "data-records-formula-ok": "", className: "text-[11px] text-muted-foreground", children: [
3024
- "Reads ",
3025
- parsed.references.length === 0 ? "no column" : parsed.references.map((r) => r.name).join(", "),
3026
- " \xB7 gives ",
3027
- RESULT_WORD[parsed.result_type] ?? "an answer",
3028
- "."
3029
- ] }) : null,
3030
- parsed?.ok && parsed.record_id ? /* @__PURE__ */ jsxs11("p", { "data-records-formula-sample": "", className: "truncate text-[11px]", title: sampleWords(parsed), children: [
3031
- /* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
3032
- sampleRecordId ? "This record" : "First row",
3033
- ": "
3034
- ] }),
3035
- /* @__PURE__ */ jsx14("span", { className: cn6("font-mono", parsed.error ? "text-muted-foreground" : "text-foreground"), children: sampleWords(parsed) })
3036
- ] }) : null,
3037
- parsed && !parsed.ok ? (
3038
- // NOT A REFUSAL, SO NOT RED: nothing was pressed. It is the store's reading of the
3039
- // text as it stands, drawn the way the panel draws what Save is still waiting for.
3040
- /* @__PURE__ */ jsxs11("div", { "data-records-formula-mistake": "", role: "status", className: "text-[11px] text-foreground", children: [
3041
- /* @__PURE__ */ jsx14("p", { children: parsed.error }),
3042
- where ? /* @__PURE__ */ jsxs11("p", { className: "mt-0.5 font-mono text-foreground", children: [
3043
- where.before,
3044
- /* @__PURE__ */ jsx14("span", { className: "bg-amber-500/30 px-0.5", children: "\u258F" }),
3045
- where.after
3046
- ] }) : null
3047
- ] })
3048
- ) : 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
+ ] }),
3049
3165
  error ? /* @__PURE__ */ jsx14(RefusalLine, { error }) : null,
3050
3166
  /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", children: [
3051
3167
  /* @__PURE__ */ jsx14("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
@@ -4646,7 +4762,7 @@ import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
4646
4762
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
4647
4763
  import { momentZoneOptions } from "@ai-matrx/design-system/field-formats";
4648
4764
  import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
4649
- var SaveToTable = lazy(() => import("./SaveToTable-VNAYIDXB.js").then((m) => ({ default: m.SaveToTable })));
4765
+ var SaveToTable = lazy(() => import("./SaveToTable-BEKANHD3.js").then((m) => ({ default: m.SaveToTable })));
4650
4766
  var LONGEST_READ = 5e5;
4651
4767
  var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
4652
4768
  function isPlainObject(v) {
@@ -8455,7 +8571,7 @@ import {
8455
8571
  useRecord,
8456
8572
  useRecordMutation,
8457
8573
  useRecordsClient as useRecordsClient12,
8458
- useTable as useTable2
8574
+ useTable as useTable3
8459
8575
  } from "@ai-matrx/records/react";
8460
8576
  import { recordTypeOf } from "@ai-matrx/records";
8461
8577
  import { asWriteConflict, predictWriteRefusals, wholeValueOf as wholeValueOf3 } from "@ai-matrx/records/core";
@@ -9643,7 +9759,7 @@ function CustomRecordForm({
9643
9759
  }) {
9644
9760
  const host = useRecordsUi();
9645
9761
  const [draft, setDraft] = useState29(() => recordId ? {} : { ...initial ?? {} });
9646
- const table = useTable2(tableId);
9762
+ const table = useTable3(tableId);
9647
9763
  const typeInDraft = recordTypeOf(table.data, draft);
9648
9764
  const typeNow = typeInDraft ?? recordType;
9649
9765
  const fields = useFields4(tableId, typeNow);
@@ -10200,7 +10316,7 @@ function FieldEditor(props) {
10200
10316
  const entityToken = props.entityToken ?? null;
10201
10317
  const onEntity = entityToken !== null;
10202
10318
  const tableId = props.tableId ?? "";
10203
- const table = useTable3(onEntity ? null : tableId);
10319
+ const table = useTable4(onEntity ? null : tableId);
10204
10320
  const tableFields = useFields5(onEntity ? null : tableId, EVERY_RECORD_TYPE);
10205
10321
  const entityFields = useEntityFields(entityToken);
10206
10322
  const fields = onEntity ? entityFields : tableFields;
@@ -10355,7 +10471,7 @@ function FieldEditor(props) {
10355
10471
  const [showOnOther, setShowOnOther] = useState31(true);
10356
10472
  const [nestsSubItems, setNestsSubItems] = useState31(false);
10357
10473
  const [reverseRefused, setReverseRefused] = useState31(null);
10358
- const otherTable = useTable3(!field2 && type === "relation" && relationTarget !== "" ? relationTarget : null);
10474
+ const otherTable = useTable4(!field2 && type === "relation" && relationTarget !== "" ? relationTarget : null);
10359
10475
  const [display, setDisplay] = useState31(start?.display ?? null);
10360
10476
  const [formulaOp, setFormulaOp] = useState31(() => formulaOpOf(start));
10361
10477
  const [formulaFields, setFormulaFields] = useState31(() => formulaFieldIdsOf(start));
@@ -10404,7 +10520,7 @@ function FieldEditor(props) {
10404
10520
  }, [type, editing]);
10405
10521
  const newDefault = !editing && !onEntity && newColumnTakesADefault(type) ? defaultToKeep(startsWith) : null;
10406
10522
  const farFieldsOfLink = useFields5(field2 && sourceKindOf(field2) === "link" && !onEntity ? field2.relation_target ?? null : null);
10407
- 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);
10408
10524
  const linkReaders = useMemo13(
10409
10525
  () => field2 ? readingThroughLink(field2, farFieldsOfLink.data ?? []) : [],
10410
10526
  [field2, farFieldsOfLink.data]
@@ -11653,7 +11769,7 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
11653
11769
  const [opening, setOpening] = useState32(false);
11654
11770
  const here = useContext4(OpenRecordHereContext);
11655
11771
  const host = useRecordsUi();
11656
- 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);
11657
11773
  const waitingOn = useRef15(0);
11658
11774
  useEffect22(() => () => void (waitingOn.current += 1), []);
11659
11775
  if (!b) return null;
@@ -13560,7 +13676,7 @@ function sameParts(a, b) {
13560
13676
 
13561
13677
  // src/TablePickers.tsx
13562
13678
  import { useEffect as useEffect27, useMemo as useMemo14, useState as useState38 } from "react";
13563
- 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";
13564
13680
  import { Button as Button23, CreatablePicker, displayId } from "@ai-matrx/design-system";
13565
13681
  import { momentZoneOptions as momentZoneOptions2 } from "@ai-matrx/design-system/field-formats";
13566
13682
  import { Fragment as Fragment17, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
@@ -13763,7 +13879,7 @@ function ColumnValueRow({
13763
13879
  ] });
13764
13880
  }
13765
13881
  function RecordPicker({ tableId, value, onChange, disabled }) {
13766
- const table = useTable5(tableId);
13882
+ const table = useTable6(tableId);
13767
13883
  const records = useRecords3(tableId, { pageSize: 200 });
13768
13884
  const rows = records.data?.rows ?? [];
13769
13885
  const options = rows.map((row) => ({
@@ -13793,7 +13909,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
13793
13909
  // src/DataBindingPicker.tsx
13794
13910
  import { useEffect as useEffect28, useMemo as useMemo15 } from "react";
13795
13911
  import { isEntityReferenceConfig } from "@ai-matrx/records";
13796
- 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";
13797
13913
  import { BasicInput as BasicInput12, Button as Button24, CreatablePicker as CreatablePicker2, cn as cn24 } from "@ai-matrx/design-system";
13798
13914
  import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
13799
13915
  var DATA_BINDING_SHAPES = [
@@ -13883,7 +13999,7 @@ function BindingDetails({
13883
13999
  disabled,
13884
14000
  defaultRowLimit
13885
14001
  }) {
13886
- const table = useTable6(tableId);
14002
+ const table = useTable7(tableId);
13887
14003
  const fields = useFields7(tableId);
13888
14004
  const fieldList = useMemo15(() => fields.data ?? [], [fields.data]);
13889
14005
  const shape = binding.semantic_type;
@@ -14032,7 +14148,7 @@ function BindingDetails({
14032
14148
  }
14033
14149
 
14034
14150
  // src/PickedSummaries.tsx
14035
- 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";
14036
14152
  import { Fragment as Fragment18, jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
14037
14153
  function TableNameText({ dataSource, tableId }) {
14038
14154
  const tables = useTablesAnywhere(dataSource);
@@ -14100,7 +14216,7 @@ function RecordNameText({
14100
14216
  );
14101
14217
  }
14102
14218
  function RecordNameWords({ tableId, recordId }) {
14103
- const table = useTable7(tableId);
14219
+ const table = useTable8(tableId);
14104
14220
  const record = useRecord2(recordId);
14105
14221
  if (record.loading || table.loading) return /* @__PURE__ */ jsx53(Fragment18, { children: "\u2026" });
14106
14222
  if (record.error) return /* @__PURE__ */ jsx53(Fragment18, { children: "Couldn't load this record" });
@@ -14358,4 +14474,4 @@ export {
14358
14474
  RecordNameText,
14359
14475
  HeldChangeDecision
14360
14476
  };
14361
- //# sourceMappingURL=chunk-U2B3TLDZ.js.map
14477
+ //# sourceMappingURL=chunk-EB6IVWGJ.js.map