@ai-matrx/records-ui 0.115.108 → 0.116.1

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/dist/SaveToTable-3VDK4U5M.js +20 -0
  3. package/dist/{chunk-W3EU7H4V.js → chunk-42VA6SWA.js} +93 -512
  4. package/dist/chunk-42VA6SWA.js.map +1 -0
  5. package/dist/chunk-B5S5F5NH.js +445 -0
  6. package/dist/chunk-B5S5F5NH.js.map +1 -0
  7. package/dist/chunk-IUUZVQZD.js +95 -0
  8. package/dist/chunk-IUUZVQZD.js.map +1 -0
  9. package/dist/{chunk-6NSGVKYL.js → chunk-NJYJEAQC.js} +1 -91
  10. package/dist/chunk-NJYJEAQC.js.map +1 -0
  11. package/dist/{chunk-VGNQBI2J.js → chunk-QRZ4RW2T.js} +56 -31
  12. package/dist/chunk-QRZ4RW2T.js.map +1 -0
  13. package/dist/chunk-SPPATZSR.js +288 -0
  14. package/dist/chunk-SPPATZSR.js.map +1 -0
  15. package/dist/{chunk-W5SOKJ5P.js → chunk-TNIC2SGW.js} +5 -3
  16. package/dist/{chunk-W5SOKJ5P.js.map → chunk-TNIC2SGW.js.map} +1 -1
  17. package/dist/{chunk-4U2JCICC.js → chunk-VCAOXQ5K.js} +2 -283
  18. package/dist/chunk-VCAOXQ5K.js.map +1 -0
  19. package/dist/chunk-Z6WTP467.js +245 -0
  20. package/dist/chunk-Z6WTP467.js.map +1 -0
  21. package/dist/first-page.cjs.map +1 -1
  22. package/dist/first-page.js.map +1 -1
  23. package/dist/helpers.cjs +813 -8
  24. package/dist/helpers.cjs.map +1 -1
  25. package/dist/helpers.d.cts +478 -4
  26. package/dist/helpers.d.ts +478 -4
  27. package/dist/helpers.js +755 -10
  28. package/dist/helpers.js.map +1 -1
  29. package/dist/index.cjs +4610 -3878
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +357 -175
  32. package/dist/index.d.ts +357 -175
  33. package/dist/index.js +5891 -5405
  34. package/dist/index.js.map +1 -1
  35. package/dist/object-actions.js +3 -2
  36. package/dist/pickers.cjs +111 -72
  37. package/dist/pickers.cjs.map +1 -1
  38. package/dist/pickers.js +6 -3
  39. package/dist/skeleton.cjs +261 -0
  40. package/dist/skeleton.cjs.map +1 -0
  41. package/dist/skeleton.d.cts +50 -0
  42. package/dist/skeleton.d.ts +50 -0
  43. package/dist/skeleton.js +26 -0
  44. package/dist/skeleton.js.map +1 -0
  45. package/package.json +16 -5
  46. package/dist/SaveToTable-V3R7QVKV.js +0 -18
  47. package/dist/chunk-4U2JCICC.js.map +0 -1
  48. package/dist/chunk-6NSGVKYL.js.map +0 -1
  49. package/dist/chunk-VGNQBI2J.js.map +0 -1
  50. package/dist/chunk-W3EU7H4V.js.map +0 -1
  51. /package/dist/{SaveToTable-V3R7QVKV.js.map → SaveToTable-3VDK4U5M.js.map} +0 -0
@@ -20,8 +20,9 @@ import {
20
20
  toDropdownEntries,
21
21
  toStripAndRows,
22
22
  withExtensions
23
- } from "./chunk-W5SOKJ5P.js";
24
- import "./chunk-6NSGVKYL.js";
23
+ } from "./chunk-TNIC2SGW.js";
24
+ import "./chunk-IUUZVQZD.js";
25
+ import "./chunk-NJYJEAQC.js";
25
26
  import "./chunk-HKYEHBQT.js";
26
27
  export {
27
28
  ACTION_CHECKING_ACCESS_REASON,
package/dist/pickers.cjs CHANGED
@@ -2132,6 +2132,16 @@ async function findUnfinishedTable(client, wantedName, wantedKeys, wantedRows, n
2132
2132
  }
2133
2133
  return null;
2134
2134
  }
2135
+ function choiceWordsOwed(existing, wanted) {
2136
+ const idOf = new Map(existing.map((f) => [f.key, f.id]));
2137
+ const owed = [];
2138
+ for (const f of wanted) {
2139
+ const fieldId = idOf.get(f.key);
2140
+ const words = [...new Set((f.options ?? []).map((w) => w.trim()).filter(Boolean))];
2141
+ if (f.type === "select" && fieldId && words.length > 0) owed.push({ fieldId, words });
2142
+ }
2143
+ return owed;
2144
+ }
2135
2145
  var UNFINISHED_WINDOW_MS, FILLED_WINDOW_MS;
2136
2146
  var init_unfinishedTable = __esm({
2137
2147
  "src/unfinishedTable.ts"() {
@@ -4021,7 +4031,7 @@ var init_ImportWizard = __esm({
4021
4031
  }
4022
4032
  });
4023
4033
 
4024
- // src/TablesHome.tsx
4034
+ // src/tableLanes.ts
4025
4035
  function platformOwned(table) {
4026
4036
  const t = table;
4027
4037
  return t.platform_owned === true || t.kept_by_the_app === true;
@@ -4041,7 +4051,16 @@ function shownToOnlyMe(table) {
4041
4051
  if (table.shown_to !== void 0) return table.shown_to === "only_me";
4042
4052
  return table.visibility === "personal";
4043
4053
  }
4044
- var import_react43, import_react44, import_core7, import_records16, import_design_system24, import_jsx_runtime26, PLATFORM_TABLE_PREFIX2;
4054
+ var PLATFORM_TABLE_PREFIX2;
4055
+ var init_tableLanes = __esm({
4056
+ "src/tableLanes.ts"() {
4057
+ "use strict";
4058
+ PLATFORM_TABLE_PREFIX2 = "records_ui_";
4059
+ }
4060
+ });
4061
+
4062
+ // src/TablesHome.tsx
4063
+ var import_react43, import_react44, import_core7, import_records16, import_design_system24, import_jsx_runtime26;
4045
4064
  var init_TablesHome = __esm({
4046
4065
  "src/TablesHome.tsx"() {
4047
4066
  "use strict";
@@ -4051,8 +4070,8 @@ var init_TablesHome = __esm({
4051
4070
  import_core7 = require("@ai-matrx/records/core");
4052
4071
  import_records16 = require("@ai-matrx/records");
4053
4072
  import_design_system24 = require("@ai-matrx/design-system");
4073
+ init_tableLanes();
4054
4074
  import_jsx_runtime26 = require("react/jsx-runtime");
4055
- PLATFORM_TABLE_PREFIX2 = "records_ui_";
4056
4075
  }
4057
4076
  });
4058
4077
 
@@ -4208,6 +4227,17 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
4208
4227
  setPhase("ready");
4209
4228
  return;
4210
4229
  }
4230
+ const present = await client.fields({ table_id: newId });
4231
+ if (present.ok) {
4232
+ for (const owed of choiceWordsOwed(present.data, fields)) {
4233
+ const topped = await client.fieldUpdate({ field_id: owed.fieldId, patch: { options_add: owed.words } });
4234
+ if (!topped.ok) {
4235
+ setProblem(topped.error);
4236
+ setPhase("ready");
4237
+ return;
4238
+ }
4239
+ }
4240
+ }
4211
4241
  } else {
4212
4242
  tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
4213
4243
  const born = await (0, import_field_kinds5.declareTable)(client, { name: tableName2, fields });
@@ -4899,7 +4929,7 @@ function AddChoicesInline({ field, onAdded, disabled = false }) {
4899
4929
 
4900
4930
  // src/editors.tsx
4901
4931
  var import_react67 = require("react");
4902
- var import_records28 = require("@ai-matrx/records");
4932
+ var import_records29 = require("@ai-matrx/records");
4903
4933
  var import_react68 = require("@ai-matrx/records/react");
4904
4934
  var import_design_system39 = require("@ai-matrx/design-system");
4905
4935
  init_dates();
@@ -5544,7 +5574,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
5544
5574
  var import_react62 = require("react");
5545
5575
  var import_design_system36 = require("@ai-matrx/design-system");
5546
5576
  var import_data_table6 = require("@ai-matrx/design-system/data-table");
5547
- var import_records26 = require("@ai-matrx/records");
5577
+ var import_records27 = require("@ai-matrx/records");
5548
5578
  var import_react63 = require("@ai-matrx/records/react");
5549
5579
  init_Refusal();
5550
5580
 
@@ -5942,7 +5972,6 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
5942
5972
  "fx.sub",
5943
5973
  "fx.mul",
5944
5974
  "fx.div",
5945
- "fx.mod",
5946
5975
  "fx.neg",
5947
5976
  "fx.eq",
5948
5977
  "fx.ne",
@@ -10131,7 +10160,7 @@ function nextFieldSort(fields) {
10131
10160
 
10132
10161
  // src/FieldEditor.tsx
10133
10162
  init_enumLabels();
10134
- var import_records24 = require("@ai-matrx/records");
10163
+ var import_records25 = require("@ai-matrx/records");
10135
10164
 
10136
10165
  // src/ButtonSettings.tsx
10137
10166
  var import_react58 = require("react");
@@ -10392,11 +10421,30 @@ function NewRowAction({
10392
10421
  }
10393
10422
 
10394
10423
  // src/FieldEditor.tsx
10395
- var import_records25 = require("@ai-matrx/records");
10424
+ var import_records26 = require("@ai-matrx/records");
10425
+
10426
+ // src/standardFieldChoices.ts
10427
+ var import_records24 = require("@ai-matrx/records");
10428
+ init_fieldTypes();
10429
+ var STORE_BEHAVIOUR = new Map(import_records24.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
10430
+ function holdsAValueOnAStandardTable(kind) {
10431
+ if (isSystemFieldKind(kind)) return false;
10432
+ const behaviour = STORE_BEHAVIOUR.get(kind);
10433
+ return behaviour !== void 0 && behaviour !== "formula";
10434
+ }
10435
+ var STANDARD_TABLE_FIELD_CHOICES = FIELD_TYPE_CHOICES.filter(
10436
+ (c) => holdsAValueOnAStandardTable(c.id)
10437
+ );
10438
+ var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
10439
+ value: choice.id,
10440
+ label: choice.label
10441
+ }));
10442
+
10443
+ // src/FieldEditor.tsx
10396
10444
  var import_jsx_runtime38 = require("react/jsx-runtime");
10397
10445
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
10398
- var SENSITIVITIES = import_records25.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
10399
- var AGENT_VISIBILITY = import_records25.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
10446
+ var SENSITIVITIES = import_records26.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
10447
+ var AGENT_VISIBILITY = import_records26.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
10400
10448
  var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
10401
10449
  value,
10402
10450
  label: ROLLUP_AGG_LABEL[value]
@@ -10409,15 +10457,6 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
10409
10457
  label: FORMULA_OP_LABEL[value],
10410
10458
  joins: FORMULA_OP_JOINS[value]
10411
10459
  }));
10412
- var STORE_BEHAVIOUR = new Map(import_records25.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
10413
- function holdsAValueOnAStandardTable(kind) {
10414
- if (isSystemFieldKind(kind)) return false;
10415
- const behaviour = STORE_BEHAVIOUR.get(kind);
10416
- return behaviour !== void 0 && behaviour !== "formula";
10417
- }
10418
- var STANDARD_TABLE_FIELD_CHOICES = FIELD_TYPE_CHOICES.filter(
10419
- (c) => holdsAValueOnAStandardTable(c.id)
10420
- );
10421
10460
  var ADD_STANDARD_FIELD_SAVE_LABEL = "Create field";
10422
10461
  var KINDS_WITH_A_DEFAULT = /* @__PURE__ */ new Set([
10423
10462
  "text",
@@ -10515,20 +10554,20 @@ function FieldEditor(props) {
10515
10554
  const [contextPolicy, setContextPolicy] = (0, import_react60.useState)(String(start?.context_policy ?? "include"));
10516
10555
  const [rules, setRules] = (0, import_react60.useState)(start?.rules ?? []);
10517
10556
  const [startsWith, setStartsWith] = (0, import_react60.useState)(start?.default ?? null);
10518
- const [ratingMax, setRatingMax] = (0, import_react60.useState)(() => start ? (0, import_records25.ratingMaxOf)(start) : 5);
10557
+ const [ratingMax, setRatingMax] = (0, import_react60.useState)(() => start ? (0, import_records26.ratingMaxOf)(start) : 5);
10519
10558
  const savedRules = (0, import_react60.useMemo)(
10520
- () => field ? type === "rating" ? (0, import_records25.rulesWithTopStar)(field.rules ?? [], (0, import_records25.ratingMaxOf)(field)) : field.rules ?? [] : [],
10559
+ () => field ? type === "rating" ? (0, import_records26.rulesWithTopStar)(field.rules ?? [], (0, import_records26.ratingMaxOf)(field)) : field.rules ?? [] : [],
10521
10560
  [field, type]
10522
10561
  );
10523
- const editedRules = (0, import_react60.useMemo)(() => type === "rating" ? (0, import_records25.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
10562
+ const editedRules = (0, import_react60.useMemo)(() => type === "rating" ? (0, import_records26.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
10524
10563
  const [statusGroups, setStatusGroups] = (0, import_react60.useState)({});
10525
10564
  const [statusKeys, setStatusKeys] = (0, import_react60.useState)({});
10526
10565
  const [symbology, setSymbology] = (0, import_react60.useState)(String(start?.config?.["symbology"] ?? ""));
10527
10566
  const descriptionStart = String(start?.config?.["description"] ?? "");
10528
10567
  const [description, setDescription] = (0, import_react60.useState)(descriptionStart);
10529
- const buttonStart = (0, import_react60.useMemo)(() => (0, import_records24.buttonOf)(start) ?? { label: "" }, [start]);
10568
+ const buttonStart = (0, import_react60.useMemo)(() => (0, import_records25.buttonOf)(start) ?? { label: "" }, [start]);
10530
10569
  const [buttonSettings, setButtonSettings] = (0, import_react60.useState)(buttonStart);
10531
- const prefixStart = (0, import_records24.autonumberPrefixOf)(start);
10570
+ const prefixStart = (0, import_records25.autonumberPrefixOf)(start);
10532
10571
  const [numberPrefix, setNumberPrefix] = (0, import_react60.useState)(prefixStart);
10533
10572
  const dependencyStart = start?.config?.["dependency"] === true;
10534
10573
  const [dependency, setDependency] = (0, import_react60.useState)(dependencyStart);
@@ -10536,7 +10575,7 @@ function FieldEditor(props) {
10536
10575
  if (!field || type !== "status") return;
10537
10576
  let live = true;
10538
10577
  void client.fieldOptions({ field_id: field.id }).then((got) => {
10539
- if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records25.optionKey)(o)])));
10578
+ if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records26.optionKey)(o)])));
10540
10579
  });
10541
10580
  return () => {
10542
10581
  live = false;
@@ -10659,7 +10698,7 @@ function FieldEditor(props) {
10659
10698
  const nameTaken = columnNameTakenBy(label, others.map(fieldName));
10660
10699
  const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
10661
10700
  const listsChoices = type === "select" || type === "multi_select" || type === "status";
10662
- const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records24.buttonNeeds)(buttonSettings) : null;
10701
+ const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records25.buttonNeeds)(buttonSettings) : null;
10663
10702
  const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
10664
10703
  type === "count" ? { type: "rollup", label, options, via, pick, agg: "count", of, relations: totalSources, formulaFields, relationTarget, allowedTypes, noun } : { type, label, options, via, pick, agg, of, relations: sourcesFor(type), formulaFields, relationTarget, allowedTypes, noun }
10665
10704
  )));
@@ -10701,7 +10740,7 @@ function FieldEditor(props) {
10701
10740
  ...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
10702
10741
  // V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
10703
10742
  // custom.field_declare does; the store writes the max Rule and sets aside any score above it.
10704
- ...type === "rating" && ratingMax !== (0, import_records25.ratingMaxOf)(field) ? { max: ratingMax } : {},
10743
+ ...type === "rating" && ratingMax !== (0, import_records26.ratingMaxOf)(field) ? { max: ratingMax } : {},
10705
10744
  ...type === "barcode" && symbology !== String(field.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
10706
10745
  ...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
10707
10746
  ...field.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
@@ -11748,7 +11787,7 @@ function runAnswer(label, run) {
11748
11787
  var stop2 = (event) => event.stopPropagation();
11749
11788
  function ButtonValue({ field, recordId, inCell }) {
11750
11789
  const client = (0, import_react63.useOptionalRecordsClient)();
11751
- const b = (0, import_records26.buttonOf)(field);
11790
+ const b = (0, import_records27.buttonOf)(field);
11752
11791
  const [busy, setBusy] = (0, import_react62.useState)(false);
11753
11792
  const [said2, setSaid] = (0, import_react62.useState)(null);
11754
11793
  const [settingUp, setSettingUp] = (0, import_react62.useState)(false);
@@ -11756,7 +11795,7 @@ function ButtonValue({ field, recordId, inCell }) {
11756
11795
  (0, import_react62.useEffect)(() => () => void (waitingOn.current += 1), []);
11757
11796
  if (!b) return null;
11758
11797
  const color = (0, import_data_table6.isStyleColor)(b.color) ? import_data_table6.CHOICE_CHIP_CLASS[b.color] : import_data_table6.NEUTRAL_CHIP_CLASS;
11759
- const needs = (0, import_records26.buttonNeeds)(b);
11798
+ const needs = (0, import_records27.buttonNeeds)(b);
11760
11799
  const tableId = field.entity_definition_id;
11761
11800
  const press = async () => {
11762
11801
  if (!client || !recordId) return setSaid({ kind: "public" });
@@ -12050,7 +12089,7 @@ function formatControl(args) {
12050
12089
  // src/typedDateHelper.tsx
12051
12090
  var import_react66 = require("react");
12052
12091
  var import_design_system38 = require("@ai-matrx/design-system");
12053
- var import_records27 = require("@ai-matrx/records");
12092
+ var import_records28 = require("@ai-matrx/records");
12054
12093
  var import_jsx_runtime42 = require("react/jsx-runtime");
12055
12094
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
12056
12095
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
@@ -12059,12 +12098,12 @@ function pad(n) {
12059
12098
  }
12060
12099
  function readBox(text, kind) {
12061
12100
  if (kind === "time") {
12062
- const t = (0, import_records27.readTypedTime)(text);
12101
+ const t = (0, import_records28.readTypedTime)(text);
12063
12102
  if (!t.ok) return { day: null, time: null };
12064
12103
  const [h, m] = t.value.split(":").map(Number);
12065
12104
  return { day: null, time: { h, m } };
12066
12105
  }
12067
- const read = (0, import_records27.readTypedDate)(text, { withTime: kind === "datetime" });
12106
+ const read = (0, import_records28.readTypedDate)(text, { withTime: kind === "datetime" });
12068
12107
  if (!read.ok) return { day: null, time: null };
12069
12108
  if (kind === "datetime" && read.instant) {
12070
12109
  const at = new Date(read.instant);
@@ -12073,10 +12112,10 @@ function readBox(text, kind) {
12073
12112
  return { day: read.day, time: null };
12074
12113
  }
12075
12114
  function wordsFor2(kind, day, time) {
12076
- if (kind === "time") return time ? (0, import_records27.typedTimeText)(time.h, time.m) : "";
12115
+ if (kind === "time") return time ? (0, import_records28.typedTimeText)(time.h, time.m) : "";
12077
12116
  if (!day) return "";
12078
- const dayText = (0, import_records27.typedDateText)(day);
12079
- return kind === "datetime" && time ? `${dayText} ${(0, import_records27.typedTimeText)(time.h, time.m)}` : dayText;
12117
+ const dayText = (0, import_records28.typedDateText)(day);
12118
+ return kind === "datetime" && time ? `${dayText} ${(0, import_records28.typedTimeText)(time.h, time.m)}` : dayText;
12080
12119
  }
12081
12120
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
12082
12121
  function CalendarGlyph() {
@@ -12198,7 +12237,7 @@ function TypedDateHelper({
12198
12237
  held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
12199
12238
  ),
12200
12239
  onClick: () => pickTime(t),
12201
- children: (0, import_records27.typedTimeText)(t.h, t.m)
12240
+ children: (0, import_records28.typedTimeText)(t.h, t.m)
12202
12241
  },
12203
12242
  `${t.h}:${t.m}`
12204
12243
  )) })
@@ -12269,21 +12308,21 @@ function judgeTyped(field, text, choices, nudge) {
12269
12308
  const format = formatForField(field);
12270
12309
  if (trimmed === "") return { value: null };
12271
12310
  if (format && format.id === "time") {
12272
- const read2 = (0, import_records28.readTypedTime)(trimmed);
12311
+ const read2 = (0, import_records29.readTypedTime)(trimmed);
12273
12312
  return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field)} holds a time of day, and ${read2.why}` };
12274
12313
  }
12275
12314
  if (kind === "select" || kind === "multi_select") {
12276
12315
  if (!choices || nudge === null) return null;
12277
12316
  const several = field.multi || kind === "multi_select";
12278
12317
  const words = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
12279
- const allowOther = (0, import_records28.allowsOtherValues)(field);
12318
+ const allowOther = (0, import_records29.allowsOtherValues)(field);
12280
12319
  const parts = [];
12281
12320
  const add = [];
12282
12321
  const ask = [];
12283
12322
  const notChoices = [];
12284
12323
  let keepOffered = allowOther;
12285
12324
  for (const word of words) {
12286
- const decided = (0, import_records28.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
12325
+ const decided = (0, import_records29.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
12287
12326
  if (decided.decision === "empty") continue;
12288
12327
  if (decided.decision === "chosen") parts.push(decided.key);
12289
12328
  else {
@@ -12316,7 +12355,7 @@ function judgeTyped(field, text, choices, nudge) {
12316
12355
  return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
12317
12356
  }
12318
12357
  const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
12319
- const read = (0, import_records28.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
12358
+ const read = (0, import_records29.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
12320
12359
  if ("refusal" in read) {
12321
12360
  if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
12322
12361
  const short = kind === "datetime" ? SHORT_REFUSAL.date : kind === "number" || kind === "currency" || kind === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
@@ -12337,12 +12376,12 @@ function openingText(field, value) {
12337
12376
  if (value === null || value === void 0 || value === "") return "";
12338
12377
  const helper = dateHelperKind(field, value);
12339
12378
  if (helper === "time") {
12340
- const read = (0, import_records28.readTypedTime)(String(value));
12379
+ const read = (0, import_records29.readTypedTime)(String(value));
12341
12380
  if (!read.ok) return String(value);
12342
12381
  const [h, m] = read.value.split(":").map(Number);
12343
- return (0, import_records28.typedTimeText)(h, m);
12382
+ return (0, import_records29.typedTimeText)(h, m);
12344
12383
  }
12345
- if (helper) return (0, import_records28.typedDateText)(value, { withTime: helper === "datetime" });
12384
+ if (helper) return (0, import_records29.typedDateText)(value, { withTime: helper === "datetime" });
12346
12385
  const format = formatForField(field);
12347
12386
  return format ? typedText(format, value) : String(value);
12348
12387
  }
@@ -12431,7 +12470,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
12431
12470
  " ",
12432
12471
  needsChoices ? String(
12433
12472
  (Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
12434
- const option = choices?.find((o) => (0, import_records28.optionKey)(o) === k);
12473
+ const option = choices?.find((o) => (0, import_records29.optionKey)(o) === k);
12435
12474
  return option ? recordName(option.data, null, String(k)) : String(k);
12436
12475
  }).join(", ")
12437
12476
  ) : (() => {
@@ -12452,7 +12491,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
12452
12491
  const ownDetails = (0, import_react68.useOptionalRecordsClient)() === null;
12453
12492
  if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
12454
12493
  if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
12455
- if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ButtonValue, { field });
12494
+ if ((0, import_records29.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ButtonValue, { field });
12456
12495
  const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
12457
12496
  if (newerControl !== void 0) return newerControl;
12458
12497
  const format = formatForField(field);
@@ -12622,7 +12661,7 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
12622
12661
  function typedDatePlaceholder(helper) {
12623
12662
  const time = "h:mm AM";
12624
12663
  if (helper === "time") return time;
12625
- const pattern = (0, import_records28.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
12664
+ const pattern = (0, import_records29.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
12626
12665
  return helper === "datetime" ? `${pattern} ${time}` : pattern;
12627
12666
  }
12628
12667
  function CheckboxControl({ field, value, onChange, disabled, id }) {
@@ -12792,15 +12831,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12792
12831
  ChoiceAnswer,
12793
12832
  {
12794
12833
  field,
12795
- choices: options.map((option) => ({ key: (0, import_records28.optionKey)(option), label: titled(option) })),
12834
+ choices: options.map((option) => ({ key: (0, import_records29.optionKey)(option), label: titled(option) })),
12796
12835
  value,
12797
12836
  onChange,
12798
12837
  disabled,
12799
12838
  id,
12800
12839
  onChosen,
12801
12840
  isChosen: (choice, v) => {
12802
- const option = options.find((o) => (0, import_records28.optionKey)(o) === choice.key);
12803
- return option ? (0, import_records28.isTheChosen)(option, v) : false;
12841
+ const option = options.find((o) => (0, import_records29.optionKey)(o) === choice.key);
12842
+ return option ? (0, import_records29.isTheChosen)(option, v) : false;
12804
12843
  }
12805
12844
  }
12806
12845
  );
@@ -12833,7 +12872,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12833
12872
  onCancel,
12834
12873
  initialSearch,
12835
12874
  addsChoices,
12836
- allowOther: (0, import_records28.allowsOtherValues)(field),
12875
+ allowOther: (0, import_records29.allowsOtherValues)(field),
12837
12876
  onChoicesChanged: () => {
12838
12877
  if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field.id}`);
12839
12878
  setReread((n) => n + 1);
@@ -12847,19 +12886,19 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12847
12886
  }
12848
12887
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
12849
12888
  if (field.multi) {
12850
- const chosen = options.filter((option) => (0, import_records28.choiceValuesOf)(value).some((v) => (0, import_records28.isTheChosen)(option, v)));
12851
- const picked = new Set(chosen.map((option) => (0, import_records28.optionKey)(option)));
12889
+ const chosen = options.filter((option) => (0, import_records29.choiceValuesOf)(value).some((v) => (0, import_records29.isTheChosen)(option, v)));
12890
+ const picked = new Set(chosen.map((option) => (0, import_records29.optionKey)(option)));
12852
12891
  const toggles = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12853
12892
  import_design_system39.Button,
12854
12893
  {
12855
12894
  type: "button",
12856
12895
  size: "sm",
12857
- variant: picked.has((0, import_records28.optionKey)(option)) ? "default" : "outline",
12896
+ variant: picked.has((0, import_records29.optionKey)(option)) ? "default" : "outline",
12858
12897
  disabled,
12859
12898
  onClick: () => {
12860
12899
  const next = new Set(picked);
12861
- if (next.has((0, import_records28.optionKey)(option))) next.delete((0, import_records28.optionKey)(option));
12862
- else next.add((0, import_records28.optionKey)(option));
12900
+ if (next.has((0, import_records29.optionKey)(option))) next.delete((0, import_records29.optionKey)(option));
12901
+ else next.add((0, import_records29.optionKey)(option));
12863
12902
  onChange(next.size === 0 ? null : [...next]);
12864
12903
  },
12865
12904
  children: titleOf(option)
@@ -12881,11 +12920,11 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12881
12920
  }
12882
12921
  );
12883
12922
  }
12884
- const current = options.find((option) => (0, import_records28.isTheChosen)(option, value));
12923
+ const current = options.find((option) => (0, import_records29.isTheChosen)(option, value));
12885
12924
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
12886
12925
  import_design_system39.Select,
12887
12926
  {
12888
- value: current ? (0, import_records28.optionKey)(current) : "",
12927
+ value: current ? (0, import_records29.optionKey)(current) : "",
12889
12928
  disabled: disabled ?? false,
12890
12929
  onValueChange: (next) => onChange(next === "" ? null : next),
12891
12930
  ...autoOpen ? {
@@ -12897,7 +12936,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12897
12936
  } : {},
12898
12937
  children: [
12899
12938
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectValue, { placeholder: "Choose" }) }),
12900
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectItem, { value: (0, import_records28.optionKey)(option), children: titleOf(option) }, option.id)) })
12939
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectItem, { value: (0, import_records29.optionKey)(option), children: titleOf(option) }, option.id)) })
12901
12940
  ]
12902
12941
  }
12903
12942
  );
@@ -12931,23 +12970,23 @@ function OpenChoicePicker({
12931
12970
  const [addRefused, setAddRefused] = (0, import_react67.useState)(null);
12932
12971
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
12933
12972
  const held = withoutAddition(value);
12934
- const current = (0, import_records28.choiceValuesOf)(held.value);
12973
+ const current = (0, import_records29.choiceValuesOf)(held.value);
12935
12974
  const pickedWords = current.map((v) => {
12936
- const option = options.find((o) => (0, import_records28.isTheChosen)(o, v));
12975
+ const option = options.find((o) => (0, import_records29.isTheChosen)(o, v));
12937
12976
  return option ? titleOf(option) : String(v);
12938
12977
  });
12939
- const chipOf = (option, word) => option ? choiceChipLookOf(field, (0, import_records28.optionKey)(option), titleOf(option)) : choiceChipLookOf(field, word);
12978
+ const chipOf = (option, word) => option ? choiceChipLookOf(field, (0, import_records29.optionKey)(option), titleOf(option)) : choiceChipLookOf(field, word);
12940
12979
  const q = search.trim();
12941
- const visible = (0, import_records28.rankTypedMatches)(options, q, titleOf);
12942
- const decided = (0, import_records28.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
12980
+ const visible = (0, import_records29.rankTypedMatches)(options, q, titleOf);
12981
+ const decided = (0, import_records29.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
12943
12982
  const choose = (word, addingIt = false) => {
12944
12983
  const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
12945
12984
  let next;
12946
12985
  let add2 = [...pending];
12947
12986
  if (field.multi) {
12948
12987
  const existing = current.map((v) => {
12949
- const option = options.find((o) => (0, import_records28.isTheChosen)(o, v));
12950
- return option ? (0, import_records28.optionKey)(option) : String(v);
12988
+ const option = options.find((o) => (0, import_records29.isTheChosen)(o, v));
12989
+ return option ? (0, import_records29.optionKey)(option) : String(v);
12951
12990
  });
12952
12991
  const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
12953
12992
  const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
@@ -12983,7 +13022,7 @@ function OpenChoicePicker({
12983
13022
  const foot = null;
12984
13023
  const add = offList && (decided.decision === "ask" || decided.decision === "add") ? { label: `Create \u201C${q}\u201D`, onAdd: addTyped, disabled: adding } : offList && decided.decision === "keep_as_typed" ? { label: `Use \u201C${q}\u201D`, onAdd: () => choose(q) } : null;
12985
13024
  const listed = visible;
12986
- const pickedOptions = current.map((v) => options.find((o) => (0, import_records28.isTheChosen)(o, v)));
13025
+ const pickedOptions = current.map((v) => options.find((o) => (0, import_records29.isTheChosen)(o, v)));
12987
13026
  const cellChips = pickedWords.map((word, i) => {
12988
13027
  const chip = chipOf(pickedOptions[i], word);
12989
13028
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.Badge, { variant: "outline", className: (0, import_design_system39.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
@@ -12995,7 +13034,7 @@ function OpenChoicePicker({
12995
13034
  label: word,
12996
13035
  chip: chipOf(option, word).className,
12997
13036
  onRemove: () => {
12998
- if (field.multi) choose(option ? (0, import_records28.optionKey)(option) : String(current[i]));
13037
+ if (field.multi) choose(option ? (0, import_records29.optionKey)(option) : String(current[i]));
12999
13038
  else onChange(null);
13000
13039
  }
13001
13040
  };
@@ -13026,11 +13065,11 @@ function OpenChoicePicker({
13026
13065
  id: option.id,
13027
13066
  label: titleOf(option),
13028
13067
  chip: chipOf(option, titleOf(option)).className,
13029
- picked: current.some((v) => (0, import_records28.isTheChosen)(option, v))
13068
+ picked: current.some((v) => (0, import_records29.isTheChosen)(option, v))
13030
13069
  })),
13031
13070
  onPick: (optionId) => {
13032
13071
  const option = options.find((o) => o.id === optionId);
13033
- if (option) choose((0, import_records28.optionKey)(option));
13072
+ if (option) choose((0, import_records29.optionKey)(option));
13034
13073
  },
13035
13074
  empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
13036
13075
  add,
@@ -13086,7 +13125,7 @@ function ChoiceAnswer({
13086
13125
  onChosen
13087
13126
  }) {
13088
13127
  const [search, setSearch] = (0, import_react67.useState)("");
13089
- const held = field.multi ? (0, import_records28.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
13128
+ const held = field.multi ? (0, import_records29.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
13090
13129
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
13091
13130
  const press = (choice) => {
13092
13131
  if (!field.multi) {
@@ -13436,7 +13475,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
13436
13475
 
13437
13476
  // src/DataBindingPicker.tsx
13438
13477
  var import_react73 = require("react");
13439
- var import_records29 = require("@ai-matrx/records");
13478
+ var import_records30 = require("@ai-matrx/records");
13440
13479
  var import_react74 = require("@ai-matrx/records/react");
13441
13480
  var import_design_system41 = require("@ai-matrx/design-system");
13442
13481
  init_names();
@@ -13471,7 +13510,7 @@ function isCompleteDataBinding(binding) {
13471
13510
  }
13472
13511
  function bindingPlaceholdersFor(field) {
13473
13512
  const label = fieldName(field);
13474
- if ((0, import_records29.isEntityReferenceConfig)(field.config)) {
13513
+ if ((0, import_records30.isEntityReferenceConfig)(field.config)) {
13475
13514
  return [
13476
13515
  { token: `{${field.key}.name}`, label: `${label} \xB7 name` },
13477
13516
  { token: `{${field.key}.id}`, label: `${label} \xB7 id` }