@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.js CHANGED
@@ -2698,7 +2698,7 @@ function FormulaTextEditor({
2698
2698
  value: text,
2699
2699
  rows: 2,
2700
2700
  "aria-label": "The formula",
2701
- placeholder: "{Visit fee} - {Deposit taken}",
2701
+ placeholder: columns.length > 0 ? `{${fieldName(columns[0])}}` : "Write a formula",
2702
2702
  className: "font-mono text-xs",
2703
2703
  onChange: (e) => onText(e.target.value)
2704
2704
  }
@@ -5196,14 +5196,24 @@ import { tableShapeChanged as tableShapeChanged2, useRecordsClient as useRecords
5196
5196
  import { Button as Button13, Select as Select4, SelectContent as SelectContent4, SelectItem as SelectItem4, SelectTrigger as SelectTrigger4, SelectValue as SelectValue4 } from "@ai-matrx/design-system";
5197
5197
  import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
5198
5198
  var RETYPE_TARGETS = [
5199
- { id: "text", behaviour: "text", kind: null, label: "Text", holds: "words" },
5200
- { id: "number", behaviour: "range", kind: "number", label: "Number", holds: "a number" },
5199
+ { id: "text", behaviour: "text", kind: null, label: "Text", holds: "words", via: "behaviour" },
5200
+ { id: "number", behaviour: "range", kind: "number", label: "Number", holds: "a number", via: "behaviour" },
5201
5201
  // A DATE is a `range` of kind date: `migrate_retype` alone cannot say "date" (it keeps the old
5202
5202
  // kind, so every date would be kept aside), so this one goes through `custom.field_update`'s own
5203
5203
  // retype arm (`parity_type: datetime`), which converts on the SAME trigger and keeps what does not
5204
5204
  // fit in `_retired` with the reason — measured on the live store 2026-09-28.
5205
- { id: "date", behaviour: "range", kind: "date", label: "Date", holds: "a date" },
5206
- { id: "checkbox", behaviour: "boolean", kind: null, label: "Yes / no", holds: "a yes or a no" }
5205
+ { id: "date", behaviour: "range", kind: "date", label: "Date", holds: "a date", via: "kind", parity: "datetime" },
5206
+ { id: "checkbox", behaviour: "boolean", kind: null, label: "Yes / no", holds: "a yes or a no", via: "behaviour" },
5207
+ // THE REST OF WHAT THE STORE'S RETYPE TAKES (walk 2026-10-10: a text column could only become Number,
5208
+ // Date or Yes/no, so it could not become a Choice, Phone, Email or Link — the Sheet allowed any
5209
+ // kind the values convert to). All go through `custom.field_update`'s `parity_type` arm, the same
5210
+ // conversion trigger, which keeps what does not fit in `_retired` with the reason.
5211
+ { id: "email", behaviour: "text", kind: null, label: "Email address", holds: "email addresses", via: "kind", parity: "email" },
5212
+ { id: "phone", behaviour: "text", kind: null, label: "Phone number", holds: "phone numbers", via: "kind", parity: "phone" },
5213
+ { id: "url", behaviour: "text", kind: null, label: "Link", holds: "web addresses", via: "kind", parity: "url" },
5214
+ { id: "currency", behaviour: "range", kind: "number", label: "Money", holds: "an amount of money", via: "kind", parity: "currency" },
5215
+ { id: "percent", behaviour: "range", kind: "number", label: "Percentage", holds: "a percentage", via: "kind", parity: "percent" },
5216
+ { id: "select", behaviour: "text", kind: null, label: "Choice", holds: "one choice from a list", via: "kind", parity: "select" }
5207
5217
  ];
5208
5218
  var PREVIEW_GROUPS = 1e3;
5209
5219
  function retypeableFrom(field) {
@@ -5225,6 +5235,7 @@ function currentTarget(field) {
5225
5235
  const kind = String(editorKindFor(field));
5226
5236
  if (String(field.type) === "boolean") return "checkbox";
5227
5237
  if (kind === "datetime" || kind === "date") return "date";
5238
+ if (kind === "email" || kind === "phone" || kind === "url" || kind === "currency" || kind === "percent") return kind;
5228
5239
  if (String(field.type) === "range") return "number";
5229
5240
  return "text";
5230
5241
  }
@@ -5268,8 +5279,8 @@ function FieldRetype({ field, tableId, onRetyped }) {
5268
5279
  setRefusal(null);
5269
5280
  let holding;
5270
5281
  let aside;
5271
- if (to.id === "date") {
5272
- const done = await client.fieldUpdate({ field_id: field.id, patch: { parity_type: "datetime" } });
5282
+ if (to.via !== "behaviour") {
5283
+ const done = await client.fieldUpdate({ field_id: field.id, patch: { parity_type: to.parity } });
5273
5284
  setBusy(false);
5274
5285
  if (!done.ok) {
5275
5286
  setRefusal(done.error);
@@ -6410,7 +6421,7 @@ function FieldEditor(props) {
6410
6421
  const statusGroupsSent = Object.fromEntries(shownStatusRows.filter((r) => !editing || r.ref in statusGroups || !(r.ref in statusKeys)).map((r) => [r.ref, r.group]));
6411
6422
  const statusGroupsChanged = type === "status" && editing && Object.keys(statusGroupsSent).length > 0;
6412
6423
  const formulaChanged = formulaText.trim() !== startingFormulaText.trim();
6413
- 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;
6424
+ 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;
6414
6425
  const noun = onEntity ? "field" : "column";
6415
6426
  const nameTaken = columnNameTakenBy(label, others.map(fieldName));
6416
6427
  const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
@@ -7016,7 +7027,7 @@ function FieldEditor(props) {
7016
7027
  Button15,
7017
7028
  {
7018
7029
  size: "sm",
7019
- disabled: mutation.saving || Boolean(formulaMissing),
7030
+ disabled: mutation.saving || Boolean(formulaMissing) || Boolean(nameLine) && label.trim() !== (field?.label ?? "").trim(),
7020
7031
  ...missingShown ? { "aria-describedby": "field-editor-missing" } : {},
7021
7032
  onClick: () => {
7022
7033
  if (missing) {