@ai-matrx/records-ui 0.116.63 → 0.116.64

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.cjs CHANGED
@@ -17019,6 +17019,11 @@ function linkedOf(expr) {
17019
17019
  return { via: rel["field"], inner: a["field"], op: match === "any" ? "eq" : "ne", value: b["const"] };
17020
17020
  }
17021
17021
  var FilterTermsContext = (0, import_react80.createContext)(false);
17022
+ var WithheldConditionFieldsContext = (0, import_react80.createContext)([]);
17023
+ function withheldConditionFields(fields, withheldKeys) {
17024
+ const withheld = new Set(withheldKeys ?? []);
17025
+ return fields.filter((f) => withheld.has(f.key)).map((f) => ({ id: f.id, key: f.key, label: f.label || f.key }));
17026
+ }
17022
17027
  var RELATIVE_DAY_TERMS = [
17023
17028
  { kind: "today", label: "is today" },
17024
17029
  { kind: "tomorrow", label: "is tomorrow" },
@@ -17272,6 +17277,7 @@ function conditionValue(typed2) {
17272
17277
  function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", className }) {
17273
17278
  const node = expr ?? null;
17274
17279
  const filterTerms = (0, import_react80.useContext)(FilterTermsContext);
17280
+ const withheldFields = (0, import_react80.useContext)(WithheldConditionFieldsContext);
17275
17281
  const choiceListTerms = (0, import_react80.useContext)(ChoiceListTermsContext) || filterTerms;
17276
17282
  const relative = relativeDayOf(expr);
17277
17283
  const reader = meOf(expr);
@@ -17337,7 +17343,18 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
17337
17343
  attrs: { "data-condition": "field" }
17338
17344
  }
17339
17345
  ),
17340
- onField && !fields.some((f) => f.id === onField) ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
17346
+ onField && !fields.some((f) => f.id === onField) && withheldFields.some((f) => f.id === onField) ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
17347
+ "span",
17348
+ {
17349
+ className: "rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",
17350
+ title: "This column is withheld from you, so this condition is skipped.",
17351
+ "data-records-condition-withheld": "",
17352
+ children: [
17353
+ withheldFields.find((f) => f.id === onField).label,
17354
+ " (withheld)"
17355
+ ]
17356
+ }
17357
+ ) : onField && !fields.some((f) => f.id === onField) ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
17341
17358
  "span",
17342
17359
  {
17343
17360
  className: "rounded bg-destructive px-1.5 py-0.5 text-[11px] font-medium text-destructive-foreground",
@@ -61083,6 +61100,7 @@ function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
61083
61100
  );
61084
61101
  return [...own3, ...reached];
61085
61102
  }, [fields.data, relations, linkedFields, withheldKeys]);
61103
+ const withheldFields = (0, import_react345.useMemo)(() => withheldConditionFields(fields.data ?? [], withheldKeys), [fields.data, withheldKeys]);
61086
61104
  if (!view) return null;
61087
61105
  const count = conditionCount(saved);
61088
61106
  const changed2 = JSON.stringify(draft) !== savedKey;
@@ -61120,7 +61138,7 @@ function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
61120
61138
  "This view asks: ",
61121
61139
  conditionInWords(saved, conditionFields),
61122
61140
  ". It cannot be drawn here; clear it to start a new filter."
61123
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(FilterTermsContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
61141
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(FilterTermsContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(WithheldConditionFieldsContext.Provider, { value: withheldFields, children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
61124
61142
  ConditionGroup,
61125
61143
  {
61126
61144
  lead: "Show records where",
@@ -61129,7 +61147,7 @@ function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
61129
61147
  fields: conditionFields,
61130
61148
  onChange: setDraft
61131
61149
  }
61132
- ) }),
61150
+ ) }) }),
61133
61151
  view.ruleId ? null : /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex items-center gap-1", children: [
61134
61152
  changed2 ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
61135
61153
  import_design_system175.Button,