@ai-matrx/records-ui 0.115.46 → 0.115.48

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
@@ -2630,7 +2630,7 @@ function FormulaTextEditor({
2630
2630
  value: text,
2631
2631
  rows: 2,
2632
2632
  "aria-label": "The formula",
2633
- placeholder: "{Visit fee} - {Deposit taken}",
2633
+ placeholder: columns.length > 0 ? `{${fieldName(columns[0])}}` : "Write a formula",
2634
2634
  className: "font-mono text-xs",
2635
2635
  onChange: (e) => onText(e.target.value)
2636
2636
  }
@@ -5126,14 +5126,24 @@ var import_react39 = require("@ai-matrx/records/react");
5126
5126
  var import_design_system24 = require("@ai-matrx/design-system");
5127
5127
  var import_jsx_runtime26 = require("react/jsx-runtime");
5128
5128
  var RETYPE_TARGETS = [
5129
- { id: "text", behaviour: "text", kind: null, label: "Text", holds: "words" },
5130
- { id: "number", behaviour: "range", kind: "number", label: "Number", holds: "a number" },
5129
+ { id: "text", behaviour: "text", kind: null, label: "Text", holds: "words", via: "behaviour" },
5130
+ { id: "number", behaviour: "range", kind: "number", label: "Number", holds: "a number", via: "behaviour" },
5131
5131
  // A DATE is a `range` of kind date: `migrate_retype` alone cannot say "date" (it keeps the old
5132
5132
  // kind, so every date would be kept aside), so this one goes through `custom.field_update`'s own
5133
5133
  // retype arm (`parity_type: datetime`), which converts on the SAME trigger and keeps what does not
5134
5134
  // fit in `_retired` with the reason — measured on the live store 2026-09-28.
5135
- { id: "date", behaviour: "range", kind: "date", label: "Date", holds: "a date" },
5136
- { id: "checkbox", behaviour: "boolean", kind: null, label: "Yes / no", holds: "a yes or a no" }
5135
+ { id: "date", behaviour: "range", kind: "date", label: "Date", holds: "a date", via: "kind", parity: "datetime" },
5136
+ { id: "checkbox", behaviour: "boolean", kind: null, label: "Yes / no", holds: "a yes or a no", via: "behaviour" },
5137
+ // THE REST OF WHAT THE STORE'S RETYPE TAKES (walk 2026-10-10: a text column could only become Number,
5138
+ // Date or Yes/no, so it could not become a Choice, Phone, Email or Link — the Sheet allowed any
5139
+ // kind the values convert to). All go through `custom.field_update`'s `parity_type` arm, the same
5140
+ // conversion trigger, which keeps what does not fit in `_retired` with the reason.
5141
+ { id: "email", behaviour: "text", kind: null, label: "Email address", holds: "email addresses", via: "kind", parity: "email" },
5142
+ { id: "phone", behaviour: "text", kind: null, label: "Phone number", holds: "phone numbers", via: "kind", parity: "phone" },
5143
+ { id: "url", behaviour: "text", kind: null, label: "Link", holds: "web addresses", via: "kind", parity: "url" },
5144
+ { id: "currency", behaviour: "range", kind: "number", label: "Money", holds: "an amount of money", via: "kind", parity: "currency" },
5145
+ { id: "percent", behaviour: "range", kind: "number", label: "Percentage", holds: "a percentage", via: "kind", parity: "percent" },
5146
+ { id: "select", behaviour: "text", kind: null, label: "Choice", holds: "one choice from a list", via: "kind", parity: "select" }
5137
5147
  ];
5138
5148
  var PREVIEW_GROUPS = 1e3;
5139
5149
  function retypeableFrom(field) {
@@ -5155,6 +5165,7 @@ function currentTarget(field) {
5155
5165
  const kind = String(editorKindFor(field));
5156
5166
  if (String(field.type) === "boolean") return "checkbox";
5157
5167
  if (kind === "datetime" || kind === "date") return "date";
5168
+ if (kind === "email" || kind === "phone" || kind === "url" || kind === "currency" || kind === "percent") return kind;
5158
5169
  if (String(field.type) === "range") return "number";
5159
5170
  return "text";
5160
5171
  }
@@ -5198,8 +5209,8 @@ function FieldRetype({ field, tableId, onRetyped }) {
5198
5209
  setRefusal(null);
5199
5210
  let holding;
5200
5211
  let aside;
5201
- if (to.id === "date") {
5202
- const done = await client.fieldUpdate({ field_id: field.id, patch: { parity_type: "datetime" } });
5212
+ if (to.via !== "behaviour") {
5213
+ const done = await client.fieldUpdate({ field_id: field.id, patch: { parity_type: to.parity } });
5203
5214
  setBusy(false);
5204
5215
  if (!done.ok) {
5205
5216
  setRefusal(done.error);
@@ -6331,7 +6342,7 @@ function FieldEditor(props) {
6331
6342
  const statusGroupsSent = Object.fromEntries(shownStatusRows.filter((r) => !editing || r.ref in statusGroups || !(r.ref in statusKeys)).map((r) => [r.ref, r.group]));
6332
6343
  const statusGroupsChanged = type === "status" && editing && Object.keys(statusGroupsSent).length > 0;
6333
6344
  const formulaChanged = formulaText.trim() !== startingFormulaText.trim();
6334
- const formulaMissing = type !== "formula" || !formulaWritten ? null : editing && !formulaChanged ? null : formulaText.trim() === "" ? "Write the formula this column works out." : formulaOk === false ? "The formula has a mistake \u2014 it is marked above." : formulaOk === null ? "Checking the formula\u2026" : null;
6345
+ const formulaMissing = type !== "formula" || !formulaWritten ? null : editing && !formulaChanged ? null : formulaText.trim() === "" ? "Write the formula" : formulaOk === false ? "The formula has a mistake \u2014 it is marked above." : formulaOk === null ? "Checking the formula\u2026" : null;
6335
6346
  const noun = onEntity ? "field" : "column";
6336
6347
  const nameTaken = columnNameTakenBy(label, others.map(fieldName));
6337
6348
  const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
@@ -6937,7 +6948,7 @@ function FieldEditor(props) {
6937
6948
  import_design_system29.Button,
6938
6949
  {
6939
6950
  size: "sm",
6940
- disabled: mutation.saving || Boolean(formulaMissing),
6951
+ disabled: mutation.saving || Boolean(formulaMissing) || Boolean(nameLine) && label.trim() !== (field?.label ?? "").trim(),
6941
6952
  ...missingShown ? { "aria-describedby": "field-editor-missing" } : {},
6942
6953
  onClick: () => {
6943
6954
  if (missing) {