@ai-matrx/records-ui 0.110.7 → 0.110.9

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/pickers.cjs CHANGED
@@ -47,6 +47,11 @@ var import_react33 = require("@ai-matrx/records/react");
47
47
  var import_design_system17 = require("@ai-matrx/design-system");
48
48
 
49
49
  // src/askOnce.ts
50
+ var import_core = require("@ai-matrx/records/core");
51
+ var structureEpoch = 0;
52
+ (0, import_core.onTableStructureChanged)(() => {
53
+ structureEpoch += 1;
54
+ });
50
55
  var asked = /* @__PURE__ */ new WeakMap();
51
56
  var byPerson = /* @__PURE__ */ new WeakMap();
52
57
  function heldFor(client) {
@@ -77,7 +82,7 @@ function askOnce(client, key, ask, freshMs) {
77
82
  const held = heldFor(client);
78
83
  const now = Date.now();
79
84
  const kept = held.get(key);
80
- if (kept && now - kept.at <= freshMs) return kept.answer;
85
+ if (kept && kept.epoch === structureEpoch && now - kept.at <= freshMs) return kept.answer;
81
86
  const answer = ask().then(
82
87
  (result) => {
83
88
  if (!result.ok) held.delete(key);
@@ -88,14 +93,14 @@ function askOnce(client, key, ask, freshMs) {
88
93
  throw thrown;
89
94
  }
90
95
  );
91
- held.set(key, { at: now, answer });
96
+ held.set(key, { at: now, epoch: structureEpoch, answer });
92
97
  return answer;
93
98
  }
94
99
  function forgetAsked(client, prefix) {
95
100
  const held = heldFor(client);
96
101
  for (const key of [...held.keys()]) if (key.startsWith(prefix)) held.delete(key);
97
102
  }
98
- var FIELD_OPTIONS_FRESH_MS = 2e3;
103
+ var FIELD_OPTIONS_FRESH_MS = 1e4;
99
104
  function fieldOptionsOnce(client, fieldId) {
100
105
  return askOnce(client, `field_options:${fieldId}`, () => client.fieldOptions({ field_id: fieldId }), FIELD_OPTIONS_FRESH_MS);
101
106
  }
@@ -4808,16 +4813,16 @@ var ABSENCE_WORD_LABEL = {
4808
4813
  };
4809
4814
 
4810
4815
  // src/values.tsx
4811
- var import_core2 = require("@ai-matrx/records/core");
4816
+ var import_core3 = require("@ai-matrx/records/core");
4812
4817
 
4813
4818
  // src/WholeValue.tsx
4814
4819
  var import_react37 = require("react");
4815
- var import_core = require("@ai-matrx/records/core");
4820
+ var import_core2 = require("@ai-matrx/records/core");
4816
4821
  var import_design_system19 = require("@ai-matrx/design-system");
4817
4822
  var import_jsx_runtime23 = require("react/jsx-runtime");
4818
4823
  var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
4819
4824
  function wholeValueLine(pointer) {
4820
- return `Open the whole text (${(0, import_core.wholeValueSize)(pointer)})`;
4825
+ return `Open the whole text (${(0, import_core2.wholeValueSize)(pointer)})`;
4821
4826
  }
4822
4827
  function WholeValueCell({ words, pointer }) {
4823
4828
  const host = useRecordsUi();
@@ -4828,7 +4833,7 @@ function WholeValueCell({ words, pointer }) {
4828
4833
  words,
4829
4834
  "\u2026"
4830
4835
  ] }),
4831
- href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core.wholeValueSize)(pointer)} in a file` })
4836
+ href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core2.wholeValueSize)(pointer)} in a file` })
4832
4837
  ] });
4833
4838
  }
4834
4839
 
@@ -5086,7 +5091,7 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
5086
5091
  if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
5087
5092
  const newer = newerKindValue(field, value);
5088
5093
  if (newer !== void 0) return newer;
5089
- const whole = typeof value === "string" ? (0, import_core2.wholeValueOf)(document2, field.key) : null;
5094
+ const whole = typeof value === "string" ? (0, import_core3.wholeValueOf)(document2, field.key) : null;
5090
5095
  if (whole) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(WholeValueCell, { words: value, pointer: whole });
5091
5096
  const kind = editorKindFor(field);
5092
5097
  if (kind === "relation" || kind === "entity_reference") {