@ai-matrx/records-ui 0.102.9 → 0.102.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.102.11
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.102.9..npm/records-ui/v0.102.11 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.102.9
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -6200,9 +6200,11 @@ function PageGlyph() {
6200
6200
  }
6201
6201
  function ReferenceChip({ reference, waiting }) {
6202
6202
  const host = useRecordsUi();
6203
+ const look = useEmbeddedLook();
6204
+ const pending = reference.label == null && reference.token === "record" && !waiting && !host.renderReference;
6205
+ const pendingMark = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system19.Skeleton, { "aria-label": "Loading", "data-records-reference-pending": "", className: "inline-block h-3 w-16 shrink-0 rounded-sm align-middle" });
6203
6206
  const words2 = reference.label ?? (reference.token === "record" ? waiting ?? "Loading\u2026" : WITHHELD_ENTITY_LABEL);
6204
6207
  const drawn = host.renderReference ? host.renderReference({ ...reference, label: reference.label ?? words2 }) : null;
6205
- const look = useEmbeddedLook();
6206
6208
  if (look?.plainRelation) {
6207
6209
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6208
6210
  "span",
@@ -6217,7 +6219,7 @@ function ReferenceChip({ reference, waiting }) {
6217
6219
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words2,
6218
6220
  children: [
6219
6221
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PageGlyph, {}) }),
6220
- drawn ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: words2 }),
6222
+ drawn ?? (pending ? pendingMark : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: words2 })),
6221
6223
  reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
6222
6224
  ]
6223
6225
  }
@@ -6235,7 +6237,7 @@ function ReferenceChip({ reference, waiting }) {
6235
6237
  "data-records-reference-archived": reference.archived ? "" : void 0,
6236
6238
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words2,
6237
6239
  children: [
6238
- drawn ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: words2 }),
6240
+ drawn ?? (pending ? pendingMark : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: words2 })),
6239
6241
  reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
6240
6242
  ]
6241
6243
  }
@@ -7135,6 +7137,8 @@ function cardWords(record, field2, labels) {
7135
7137
 
7136
7138
  // src/gridEditing.tsx
7137
7139
  var import_jsx_runtime28 = require("react/jsx-runtime");
7140
+ var FLOATING_EDITOR_TRAY_CLASS = "pointer-events-none absolute left-0 z-[26] w-max max-w-[24rem] rounded-md border bg-popover px-1.5 py-0.5 shadow-md";
7141
+ var FLOATING_EDITOR_NOTE_CLASS = "[&_[data-records-typed-reads-as]]:pointer-events-none [&_[data-records-typed-reads-as]]:absolute [&_[data-records-typed-reads-as]]:bottom-full [&_[data-records-typed-reads-as]]:left-0 [&_[data-records-typed-reads-as]]:z-[26] [&_[data-records-typed-reads-as]]:mb-1 [&_[data-records-typed-reads-as]]:w-max [&_[data-records-typed-reads-as]]:max-w-[24rem] [&_[data-records-typed-reads-as]]:rounded-md [&_[data-records-typed-reads-as]]:border [&_[data-records-typed-reads-as]]:bg-popover [&_[data-records-typed-reads-as]]:px-1.5 [&_[data-records-typed-reads-as]]:py-0.5 [&_[data-records-typed-reads-as]]:shadow-md";
7138
7142
  var NO_ROWS = [];
7139
7143
  function asksWhoChanged(event) {
7140
7144
  return event.altKey && event.shiftKey && !event.metaKey && !event.ctrlKey && (event.code === "KeyH" || event.key.toLowerCase() === "h");
@@ -8094,7 +8098,10 @@ function OpenCell({
8094
8098
  "data-matrx-cell-fill": "",
8095
8099
  "data-matrx-cell-editor": "",
8096
8100
  tabIndex: -1,
8097
- className: "relative z-[25] flex w-full min-w-0 max-w-full flex-col gap-1 outline-none",
8101
+ className: (0, import_design_system23.cn)(
8102
+ "relative z-[25] flex w-full min-w-0 max-w-full flex-col gap-1 outline-none",
8103
+ FLOATING_EDITOR_NOTE_CLASS
8104
+ ),
8098
8105
  onDoubleClick: (event) => event.stopPropagation(),
8099
8106
  onKeyDown: (event) => {
8100
8107
  if (event.target?.closest?.("[data-refusal-notice], [data-records-choice-ask]")) return;
@@ -8149,7 +8156,7 @@ function OpenCell({
8149
8156
  addsChoices: true
8150
8157
  }
8151
8158
  ),
8152
- picker || asksAboutAChoice(draft) ? null : blurCommits ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-[10px] text-muted-foreground", children: multiline ? "\u23CE saves \xB7 \u21E7\u23CE new line \xB7 Esc cancels \xB7 Tab next" : "\u23CE saves \xB7 Esc cancels \xB7 Tab next" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex items-center gap-1", children: [
8159
+ picker || asksAboutAChoice(draft) ? null : blurCommits ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: (0, import_design_system23.cn)("text-[10px] text-muted-foreground", FLOATING_EDITOR_TRAY_CLASS, "top-full mt-1"), "data-records-editor-hint": "", children: multiline ? "\u23CE saves \xB7 \u21E7\u23CE new line \xB7 Esc cancels \xB7 Tab next" : "\u23CE saves \xB7 Esc cancels \xB7 Tab next" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex items-center gap-1", children: [
8153
8160
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system23.Button, { size: "sm", onClick: () => once(() => onCommit(null, "pick")), children: "Save" }),
8154
8161
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system23.Button, { size: "sm", variant: "ghost", onClick: () => once(() => onCancel("pick")), children: "Cancel" })
8155
8162
  ] }),
@@ -10825,7 +10832,7 @@ var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
10825
10832
  label: ROLLUP_AGG_LABEL[value]
10826
10833
  }));
10827
10834
  var FORMULA_SEPARATOR_LABEL = "Joined by";
10828
- var EDITING_A_WORKED_OUT_COLUMN = "This column works out its answer from the columns picked when it was made. To change what it works out, write it as a formula below \u2014 the store checks it as you type, and a rename alone leaves it exactly as it is.";
10835
+ var EDITING_A_WORKED_OUT_COLUMN = "Written as a formula. Edit it below.";
10829
10836
  var FORMULA_DEFAULT_SEPARATOR = " \u2014 ";
10830
10837
  var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
10831
10838
  value,
@@ -11210,8 +11217,7 @@ function FieldEditor(props) {
11210
11217
  placeholder: "Day rate",
11211
11218
  onChange: (e) => setLabel(e.target.value)
11212
11219
  }
11213
- ),
11214
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: onEntity ? "What people will read beside the value." : "What people will read at the top of the column." })
11220
+ )
11215
11221
  ] }),
11216
11222
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-1", children: [
11217
11223
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Label, { className: "text-xs", children: "What it holds" }),
@@ -11222,7 +11228,7 @@ function FieldEditor(props) {
11222
11228
  disabled: editing,
11223
11229
  onValueChange: (next) => setType(next),
11224
11230
  children: [
11225
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectTrigger, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectValue, {}) }),
11231
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectTrigger, { size: "sm", "aria-label": "What this field holds", ...choice?.explanation ? { title: choice.explanation } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectValue, {}) }),
11226
11232
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectContent, { children: FIELD_TYPE_GROUPS.filter((group) => offered.some((c) => c.group === group)).map((group) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system34.SelectGroup, { children: [
11227
11233
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectLabel, { children: group }),
11228
11234
  FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectItem, { value: c.id, children: c.label }, c.id))
@@ -11230,7 +11236,7 @@ function FieldEditor(props) {
11230
11236
  ]
11231
11237
  }
11232
11238
  ),
11233
- editing && field2 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FieldRetype, { field: liveField ?? field2, tableId }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: choice?.explanation ?? "" })
11239
+ editing && field2 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FieldRetype, { field: liveField ?? field2, tableId }) : null
11234
11240
  ] })
11235
11241
  ] }),
11236
11242
  type === "formula" && others.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-2", children: [
@@ -11268,7 +11274,7 @@ function FieldEditor(props) {
11268
11274
  columns: others
11269
11275
  }
11270
11276
  ) : null
11271
- ] }) : editing && type === "formula" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "This column works out its answer from other columns, and this table has no other column left for it to read." }) : null,
11277
+ ] }) : editing && type === "formula" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No other column to read." }) : null,
11272
11278
  editing && field2 && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SourceArchivedNotice, { fieldId: field2.id, tableId }) : null,
11273
11279
  !editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
11274
11280
  TypeQuestions,
@@ -11438,11 +11444,7 @@ function FieldEditor(props) {
11438
11444
  ),
11439
11445
  UNIQUE_LABEL
11440
11446
  ] }) : null,
11441
- rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("p", { className: "text-muted-foreground", children: [
11442
- "No checks. Anything this kind of ",
11443
- onEntity ? "field" : "column",
11444
- " can hold will be accepted."
11445
- ] }) : null,
11447
+ rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-muted-foreground", children: "No checks." }) : null,
11446
11448
  rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-1", children: [
11447
11449
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
11448
11450
  import_design_system34.Select,
@@ -11691,8 +11693,7 @@ function TypeQuestions(props) {
11691
11693
  placeholder: "$",
11692
11694
  onChange: (e) => props.setUnit(e.target.value)
11693
11695
  }
11694
- ),
11695
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Shown with every amount, everywhere the value appears \u2014 including where an assistant reads it." })
11696
+ )
11696
11697
  ] });
11697
11698
  }
11698
11699
  if (type === "datetime") {
@@ -11711,7 +11712,7 @@ function TypeQuestions(props) {
11711
11712
  if (type === "lookup" || type === "rollup" || type === "count") {
11712
11713
  const usable = props.relations;
11713
11714
  if (usable.length === 0) {
11714
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: type !== "lookup" ? "No link, Person or File column yet. Add one that holds more than one first." : "No link, Person or File column yet. Add one first." });
11715
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No link, Person or File column yet." });
11715
11716
  }
11716
11717
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2", children: [
11717
11718
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-1", children: [
@@ -11757,7 +11758,7 @@ function TypeQuestions(props) {
11757
11758
  }
11758
11759
  if (type === "formula") {
11759
11760
  if (props.others.length === 0) {
11760
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "A worked-out column needs other columns to work from, and this table has none yet." });
11761
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No other columns yet." });
11761
11762
  }
11762
11763
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-2", children: [
11763
11764
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-1", children: [
@@ -11784,8 +11785,7 @@ function TypeQuestions(props) {
11784
11785
  },
11785
11786
  f.id
11786
11787
  );
11787
- }) }),
11788
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "In the order you pick them. Columns are remembered by which column they are, so renaming one never breaks this." })
11788
+ }) })
11789
11789
  ] }),
11790
11790
  props.formulaOp === "concat" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-1", children: [
11791
11791
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Label, { className: "text-xs", children: FORMULA_SEPARATOR_LABEL }),
@@ -11798,8 +11798,7 @@ function TypeQuestions(props) {
11798
11798
  className: "max-w-[10rem]",
11799
11799
  onChange: (e) => props.setFormulaSeparator(e.target.value)
11800
11800
  }
11801
- ),
11802
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "What goes between the columns. Leave it empty to run them straight together." })
11801
+ )
11803
11802
  ] }) : null
11804
11803
  ] });
11805
11804
  }
@@ -11885,18 +11884,14 @@ function ValueOnTheOtherSide({
11885
11884
  const carried = sample.data?.rows[0]?.document ?? null;
11886
11885
  const offered = declared2.length > 0 ? declared2.map((f) => ({ key: f.key, name: fieldName(f) })) : Object.keys(carried ?? {}).map((key) => ({ key, name: (0, import_text_case5.humanizeIdentifier)(key) }));
11887
11886
  const stillAsking = columns.loading || declared2.length === 0 && sample.loading;
11888
- const body = !relation ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
11889
- fieldName(relation),
11890
- " points at a table that has no columns to read yet. Add one there first."
11891
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system34.Select, { value, onValueChange: onChange, children: [
11887
+ const body = !relation ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No columns to read yet." }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system34.Select, { value, onValueChange: onChange, children: [
11892
11888
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectTrigger, { size: "sm", "aria-label": label, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectValue, { placeholder: "Choose a column" }) }),
11893
11889
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectContent, { children: offered.map((column) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.SelectItem, { value: column.key, children: column.name }, column.key)) })
11894
11890
  ] });
11895
11891
  if (compact) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mt-1 flex flex-col gap-1", children: body });
11896
11892
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-1", children: [
11897
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Label, { className: "text-xs", children: label }),
11898
- body,
11899
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: help })
11893
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Label, { className: "text-xs", title: help, children: label }),
11894
+ body
11900
11895
  ] });
11901
11896
  }
11902
11897
  function withNumber(rule, key, typed2) {
@@ -46644,7 +46639,33 @@ function LinkedLists({ tableId, recordId }) {
46644
46639
  const links = (fields.data ?? []).filter((field2) => editorKindFor(field2) === "relation");
46645
46640
  const labels = useRecordLabels(links);
46646
46641
  const document2 = record.data?.document;
46642
+ const may = useRecordRights(recordId);
46647
46643
  if (links.length === 0 || !document2) return null;
46644
+ if (may.write) {
46645
+ return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex flex-col gap-3", "data-record-linked-lists": "", children: [
46646
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(import_design_system134.Separator, {}),
46647
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
46648
+ RecordFieldsInPlace,
46649
+ {
46650
+ tableId,
46651
+ recordId,
46652
+ fields: links,
46653
+ document: document2,
46654
+ hidden: record.data?.hidden,
46655
+ canWrite: true,
46656
+ reload: () => record.reload(),
46657
+ className: "flex min-w-0 flex-col gap-1",
46658
+ renderLabel: (field2) => {
46659
+ const count = referencesOf(field2, document2[field2.key], "relation", labels).length;
46660
+ return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { className: "flex items-center gap-2 pt-2 text-foreground", "data-record-linked-list": field2.key, children: [
46661
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "truncate text-xs font-medium", children: fieldName(field2) }),
46662
+ count > 0 ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-[11px] text-muted-foreground", children: count }) : null
46663
+ ] });
46664
+ }
46665
+ }
46666
+ )
46667
+ ] });
46668
+ }
46648
46669
  return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex flex-col gap-3", "data-record-linked-lists": "", children: [
46649
46670
  /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(import_design_system134.Separator, {}),
46650
46671
  links.map((field2) => {