@ai-matrx/records-ui 0.113.22 → 0.113.24

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,9 +1,15 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
- ## 0.113.22
3
+ ## 0.113.24
4
4
 
5
5
  Automatic changed-only republish (docs/metadata drift since the last tag — see
6
- `git diff npm/records-ui/v0.113.21..npm/records-ui/v0.113.22 -- apps/shared/records-ui`).
6
+ `git diff npm/records-ui/v0.113.23..npm/records-ui/v0.113.24 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.113.20
10
+
11
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
12
+ `git diff npm/records-ui/v0.113.19..npm/records-ui/v0.113.20 -- apps/shared/records-ui`).
7
13
  No source changes intended and no consumer action required.
8
14
 
9
15
  ## 0.113.19
package/dist/index.cjs CHANGED
@@ -13654,7 +13654,7 @@ var import_react128 = require("@ai-matrx/records/react");
13654
13654
  var import_records44 = require("@ai-matrx/records");
13655
13655
  var import_records45 = require("@ai-matrx/records");
13656
13656
  var import_data_table16 = require("@ai-matrx/design-system/data-table");
13657
- var import_core18 = require("@ai-matrx/records/core");
13657
+ var import_core19 = require("@ai-matrx/records/core");
13658
13658
 
13659
13659
  // src/tableDecorations.ts
13660
13660
  var import_react69 = require("react");
@@ -13756,6 +13756,7 @@ function EmptyRecords({ words: words2 }) {
13756
13756
 
13757
13757
  // src/gridControls.tsx
13758
13758
  var import_clipboard = require("@ai-matrx/kit/clipboard");
13759
+ var import_core11 = require("@ai-matrx/records/core");
13759
13760
  var import_react90 = require("react");
13760
13761
  var import_react91 = require("@ai-matrx/records/react");
13761
13762
  var import_design_system50 = require("@ai-matrx/design-system");
@@ -16265,7 +16266,7 @@ function gridRefusalForPastedCell(field2, value) {
16265
16266
 
16266
16267
  // src/gridControls.tsx
16267
16268
  var import_jsx_runtime57 = require("react/jsx-runtime");
16268
- var VALUE_COUNTS_FRESH_MS = 1500;
16269
+ var VALUE_COUNTS_FRESH_MS = 1e4;
16269
16270
  var CLEAN_TABLE_LABEL = "Clean table\u2026";
16270
16271
  function filterForValue(field2, value) {
16271
16272
  const empty = value === null || value === void 0 || value === "";
@@ -16388,6 +16389,7 @@ function useMergedGridControls(args) {
16388
16389
  const fieldsRef = (0, import_react90.useRef)(fields);
16389
16390
  fieldsRef.current = fields;
16390
16391
  const [choiceCounts, setChoiceCounts] = (0, import_react90.useState)({});
16392
+ (0, import_react90.useEffect)(() => (0, import_core11.onRecordChanged)(() => forgetAsked(client, `value_counts:${tableId}:`)), [client, tableId]);
16391
16393
  (0, import_react90.useEffect)(() => {
16392
16394
  if (!enabled || choiceKeys.length === 0) {
16393
16395
  setChoiceCounts({});
@@ -17044,7 +17046,7 @@ var import_design_system54 = require("@ai-matrx/design-system");
17044
17046
  // src/RecordForm.tsx
17045
17047
  var import_react96 = require("react");
17046
17048
  var import_react97 = require("@ai-matrx/records/react");
17047
- var import_core12 = require("@ai-matrx/records/core");
17049
+ var import_core13 = require("@ai-matrx/records/core");
17048
17050
  var import_design_system53 = require("@ai-matrx/design-system");
17049
17051
  var import_text_case6 = require("@ai-matrx/kit/text-case");
17050
17052
 
@@ -17057,7 +17059,7 @@ var import_design_system52 = require("@ai-matrx/design-system");
17057
17059
  var import_react92 = require("react");
17058
17060
  var import_react93 = require("@ai-matrx/records/react");
17059
17061
  var import_design_system51 = require("@ai-matrx/design-system");
17060
- var import_core11 = require("@ai-matrx/records/core");
17062
+ var import_core12 = require("@ai-matrx/records/core");
17061
17063
  var import_jsx_runtime58 = require("react/jsx-runtime");
17062
17064
  function isEmptyValue(value) {
17063
17065
  return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
@@ -17129,7 +17131,7 @@ async function writeStandardRowValues(client, args) {
17129
17131
  { schema: config.schema ?? "custom" }
17130
17132
  );
17131
17133
  if (!old.error) return { ok: true };
17132
- const error = (0, import_core11.mapPgError)(old.error, "entityValueWrite");
17134
+ const error = (0, import_core12.mapPgError)(old.error, "entityValueWrite");
17133
17135
  return { ok: false, error: doorIsAbsent(error) && first && first.error.code !== "door_absent" ? first.error : error };
17134
17136
  }
17135
17137
  function doorIsAbsent(error) {
@@ -17710,7 +17712,7 @@ function CustomRecordForm({
17710
17712
  return out;
17711
17713
  }, [draft]);
17712
17714
  const predicted = (0, import_react96.useMemo)(
17713
- () => fields.data ? (0, import_core12.predictWriteRefusals)({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
17715
+ () => fields.data ? (0, import_core13.predictWriteRefusals)({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
17714
17716
  [fields.data, document2, recordType]
17715
17717
  );
17716
17718
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(RefusalNotice, { error: fields.error, className });
@@ -17760,7 +17762,7 @@ function CustomRecordForm({
17760
17762
  setEdit({
17761
17763
  saving: false,
17762
17764
  error: answered2.ok ? null : answered2.error,
17763
- conflict: answered2.ok ? null : (0, import_core12.asWriteConflict)(answered2.error, recordId)
17765
+ conflict: answered2.ok ? null : (0, import_core13.asWriteConflict)(answered2.error, recordId)
17764
17766
  });
17765
17767
  const moved = answered2.ok ? answered2.data : null;
17766
17768
  if (moved !== null) {
@@ -17869,7 +17871,7 @@ function FieldRow({
17869
17871
  }) {
17870
17872
  const id = `field-${field2.id}`;
17871
17873
  const storedWords = document2?.[field2.key];
17872
- const whole = typeof storedWords === "string" ? (0, import_core12.wholeValueOf)(document2, field2.key) : null;
17874
+ const whole = typeof storedWords === "string" ? (0, import_core13.wholeValueOf)(document2, field2.key) : null;
17873
17875
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: (0, import_design_system53.cn)("flex min-w-0 flex-col gap-1", whole && "sm:col-span-2"), children: [
17874
17876
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FieldLabel, { field: field2, htmlFor: id, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ProvenanceBadge, { document: document2, fieldKey: field2.key }) }),
17875
17877
  whole ? (
@@ -20118,12 +20120,12 @@ function withOpenRecord(columns, onOpen, nameOf2, place = "end", hrefOf) {
20118
20120
  // src/ImportWizard.tsx
20119
20121
  var import_react109 = require("react");
20120
20122
  var import_react110 = require("@ai-matrx/records/react");
20121
- var import_core14 = require("@ai-matrx/records/core");
20123
+ var import_core15 = require("@ai-matrx/records/core");
20122
20124
  var import_design_system59 = require("@ai-matrx/design-system");
20123
20125
  var import_records41 = require("@ai-matrx/records");
20124
20126
 
20125
20127
  // src/importRuleCheck.ts
20126
- var import_core13 = require("@ai-matrx/records/core");
20128
+ var import_core14 = require("@ai-matrx/records/core");
20127
20129
  function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
20128
20130
  const byKey = new Map(fields.map((f) => [f.key, f]));
20129
20131
  const verdicts = [];
@@ -20149,7 +20151,7 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
20149
20151
  if ("unmatchedNames" in meant) return;
20150
20152
  if ("refusal" in meant) why = meant.refusal;
20151
20153
  else {
20152
- const predicted = (0, import_core13.predictValueRefusals)([field2], { [key]: meant.value }).filter(
20154
+ const predicted = (0, import_core14.predictValueRefusals)([field2], { [key]: meant.value }).filter(
20153
20155
  (p) => p.field_key === void 0 || p.field_key === key
20154
20156
  );
20155
20157
  if (predicted.length > 0) why = predicted[0].message;
@@ -20653,7 +20655,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20653
20655
  try {
20654
20656
  const xlsx = file.name.toLowerCase().endsWith(".xlsx");
20655
20657
  const bytes = await file.arrayBuffer();
20656
- const result = xlsx ? await (0, import_core14.importXlsx)(bytes) : (0, import_core14.importCsv)(new TextDecoder().decode(bytes));
20658
+ const result = xlsx ? await (0, import_core15.importXlsx)(bytes) : (0, import_core15.importCsv)(new TextDecoder().decode(bytes));
20657
20659
  await planFrom(result, { name: file.name, bytes: file.size, hash: await sha256(bytes), format: xlsx ? "xlsx" : "csv" });
20658
20660
  } catch (thrown) {
20659
20661
  setProblem(
@@ -22662,7 +22664,7 @@ function useGroupLabel(fields, groupKey) {
22662
22664
  // src/gridUndo.tsx
22663
22665
  var import_react117 = require("react");
22664
22666
  var import_react118 = require("@ai-matrx/records/react");
22665
- var import_core15 = require("@ai-matrx/records/core");
22667
+ var import_core16 = require("@ai-matrx/records/core");
22666
22668
  var import_design_system61 = require("@ai-matrx/design-system");
22667
22669
  var import_data_table15 = require("@ai-matrx/design-system/data-table");
22668
22670
  var import_jsx_runtime72 = require("react/jsx-runtime");
@@ -22756,7 +22758,7 @@ function useGridUndo(args) {
22756
22758
  }
22757
22759
  forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
22758
22760
  for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
22759
- (0, import_core15.announceRecordChanged)(id);
22761
+ (0, import_core16.announceRecordChanged)(id);
22760
22762
  }
22761
22763
  setHeld(() => {
22762
22764
  let stack = taken.stack;
@@ -23144,7 +23146,7 @@ function holdKeys() {
23144
23146
  // src/gridAssist.tsx
23145
23147
  var import_clipboard2 = require("@ai-matrx/kit/clipboard");
23146
23148
  var import_react121 = require("react");
23147
- var import_core16 = require("@ai-matrx/records/core");
23149
+ var import_core17 = require("@ai-matrx/records/core");
23148
23150
  var import_workspace = require("@ai-matrx/alchemy/react/workspace");
23149
23151
 
23150
23152
  // src/gridAgentContext.ts
@@ -23274,7 +23276,7 @@ function useGridAssist(args) {
23274
23276
  const copyRecordReference = (0, import_react121.useCallback)(
23275
23277
  (rowId) => {
23276
23278
  void (async () => {
23277
- const text2 = JSON.stringify({ __kind: (0, import_core16.tableKindSlug)(tableId), _record_id: rowId });
23279
+ const text2 = JSON.stringify({ __kind: (0, import_core17.tableKindSlug)(tableId), _record_id: rowId });
23278
23280
  if (!await (0, import_clipboard2.copyText)(text2)) {
23279
23281
  say2(false, "This browser did not let the page write to the clipboard.");
23280
23282
  return;
@@ -23330,7 +23332,7 @@ function useGridAssist(args) {
23330
23332
  if (!row) return;
23331
23333
  const document2 = row.document ?? {};
23332
23334
  const value = editing.valueFor(row, fieldOf2(key));
23333
- const pointer = typeof document2[key] === "string" ? (0, import_core16.wholeValueOf)(document2, key) : null;
23335
+ const pointer = typeof document2[key] === "string" ? (0, import_core17.wholeValueOf)(document2, key) : null;
23334
23336
  setWhole({ rowId, key, rowTitle: titleOf(row), value, pointer });
23335
23337
  },
23336
23338
  [rowOf, fieldOf2, titleOf, editing]
@@ -23426,7 +23428,7 @@ function useGridAssist(args) {
23426
23428
  // src/gridBulk.tsx
23427
23429
  var import_react122 = require("react");
23428
23430
  var import_react123 = require("@ai-matrx/records/react");
23429
- var import_core17 = require("@ai-matrx/records/core");
23431
+ var import_core18 = require("@ai-matrx/records/core");
23430
23432
  var import_design_system62 = require("@ai-matrx/design-system");
23431
23433
  var import_jsx_runtime74 = require("react/jsx-runtime");
23432
23434
  function countOf(n, one, many) {
@@ -23492,7 +23494,7 @@ function useGridBulk(args) {
23492
23494
  return null;
23493
23495
  }
23494
23496
  for (const result of done.data ?? []) if (result.op === "update") versions.wrote(result.id, result.version);
23495
- for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core17.announceRecordChanged)(change.record_id);
23497
+ for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core18.announceRecordChanged)(change.record_id);
23496
23498
  return done.data;
23497
23499
  },
23498
23500
  [client, tableId, versions, reload]
@@ -24680,7 +24682,7 @@ function GridBody({
24680
24682
  }))
24681
24683
  );
24682
24684
  editing.forget(cells);
24683
- for (const u of updates) (0, import_core18.announceRecordChanged)(u.row.recordId);
24685
+ for (const u of updates) (0, import_core19.announceRecordChanged)(u.row.recordId);
24684
24686
  const lines = updates.length + creates.length;
24685
24687
  undo.push({ label: `Pasted ${lines} ${lines === 1 ? "row" : "rows"}`, cells, created });
24686
24688
  const expected = [
@@ -24960,7 +24962,7 @@ function GridBody({
24960
24962
  const addRowHere = (0, import_react127.useCallback)(async (values) => {
24961
24963
  setAddRefused(null);
24962
24964
  if (formHosted && fields.data) {
24963
- const wouldRefuse = (0, import_core18.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
24965
+ const wouldRefuse = (0, import_core19.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
24964
24966
  if (wouldRefuse.length > 0) {
24965
24967
  setFormAsk((held) => ({ n: (held?.n ?? 0) + 1, initial: { ...values ?? {} } }));
24966
24968
  return;
@@ -26454,7 +26456,7 @@ function ConnectedRecordsTableCard({
26454
26456
  var import_download2 = require("@ai-matrx/kit/download");
26455
26457
  var import_react133 = require("react");
26456
26458
  var import_react134 = require("@ai-matrx/records/react");
26457
- var import_core19 = require("@ai-matrx/records/core");
26459
+ var import_core20 = require("@ai-matrx/records/core");
26458
26460
 
26459
26461
  // src/viewExport.ts
26460
26462
  var import_format6 = require("@ai-matrx/kit/format");
@@ -26527,7 +26529,7 @@ function toRows(fields, records, labels) {
26527
26529
  absent_reason: envelope?.absent ?? null,
26528
26530
  // A VALUE KEPT AS A FILE carries its pointer, so the export writes the whole text
26529
26531
  // (`withWholeValues`), never the first words passed off as the value.
26530
- source: (0, import_core19.wholeValueOf)(document2, field2.key)
26532
+ source: (0, import_core20.wholeValueOf)(document2, field2.key)
26531
26533
  };
26532
26534
  }
26533
26535
  return row;
@@ -26558,7 +26560,7 @@ async function rowsForFile(args) {
26558
26560
  );
26559
26561
  const lookup = ((field2, id) => labels(field2, id) ?? learned.get(`${field2.id}:${id}`) ?? null);
26560
26562
  const read = host.readFileText;
26561
- return (0, import_core19.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
26563
+ return (0, import_core20.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
26562
26564
  }
26563
26565
  function ExportMenu({ tableId, rows, label, className, view }) {
26564
26566
  const client = (0, import_react134.useRecordsClient)();
@@ -26597,7 +26599,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
26597
26599
  {
26598
26600
  size: "sm",
26599
26601
  variant: "outline",
26600
- onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core19.exportCsv)(columns, rows2))).catch(
26602
+ onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core20.exportCsv)(columns, rows2))).catch(
26601
26603
  (thrown) => setFailure(refusalFromThrown(thrown, "The CSV could not be written.", "Try again in a moment."))
26602
26604
  ),
26603
26605
  children: "CSV"
@@ -26618,7 +26620,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
26618
26620
  );
26619
26621
  setFailure(null);
26620
26622
  try {
26621
- exported().then((rows2) => (0, import_core19.exportXlsx)(columns, rows2, name)).then(
26623
+ exported().then((rows2) => (0, import_core20.exportXlsx)(columns, rows2, name)).then(
26622
26624
  (bytes) => download(
26623
26625
  `${name}.xlsx`,
26624
26626
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
@@ -26639,7 +26641,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
26639
26641
  sourceId: `records:${tableId}`,
26640
26642
  size: "xs",
26641
26643
  json: () => records.map((r) => r.document),
26642
- human: () => (0, import_core19.exportCsv)(columns, toRows(columns, records, labels))
26644
+ human: () => (0, import_core20.exportCsv)(columns, toRows(columns, records, labels))
26643
26645
  }
26644
26646
  ),
26645
26647
  viewHeld && "rows" in viewHeld && viewHeld.cut ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "text-xs text-muted-foreground", children: cutWords(viewHeld.rows.length) }) : null,
@@ -26759,7 +26761,7 @@ var import_design_system77 = require("@ai-matrx/design-system");
26759
26761
  // src/TablesHome.tsx
26760
26762
  var import_react147 = require("react");
26761
26763
  var import_react148 = require("@ai-matrx/records/react");
26762
- var import_core20 = require("@ai-matrx/records/core");
26764
+ var import_core21 = require("@ai-matrx/records/core");
26763
26765
  var import_records50 = require("@ai-matrx/records");
26764
26766
  var import_design_system76 = require("@ai-matrx/design-system");
26765
26767
 
@@ -28496,7 +28498,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
28496
28498
  };
28497
28499
  }, [client]);
28498
28500
  const listed = facts.phase === "read" ? (0, import_records50.withTablePlacement)(
28499
- (0, import_core20.withTableFacts)(tables.data ?? [], facts.rows, me),
28501
+ (0, import_core21.withTableFacts)(tables.data ?? [], facts.rows, me),
28500
28502
  facts.rows
28501
28503
  ) : tables.data ?? [];
28502
28504
  const [showEverything, setShowEverything] = (0, import_react147.useState)(false);
@@ -39141,7 +39143,7 @@ var import_design_system109 = require("@ai-matrx/design-system");
39141
39143
  var import_react223 = require("react");
39142
39144
  var import_recharts = require("recharts");
39143
39145
  var import_records60 = require("@ai-matrx/records");
39144
- var import_core21 = require("@ai-matrx/records/core");
39146
+ var import_core22 = require("@ai-matrx/records/core");
39145
39147
  var import_design_system108 = require("@ai-matrx/design-system");
39146
39148
  var import_format11 = require("@ai-matrx/kit/format");
39147
39149
 
@@ -39603,7 +39605,7 @@ function pretty(n) {
39603
39605
  return Number.isInteger(n) ? n.toLocaleString() : n.toLocaleString(void 0, { maximumFractionDigits: 2 });
39604
39606
  }
39605
39607
  function asRefusal2(block) {
39606
- return (0, import_core21.mapPgError)(
39608
+ return (0, import_core22.mapPgError)(
39607
39609
  {
39608
39610
  message: block.refused ?? "",
39609
39611
  ...block.sqlstate ? { code: block.sqlstate } : {}
@@ -42474,7 +42476,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
42474
42476
  var import_clipboard9 = require("@ai-matrx/kit/clipboard");
42475
42477
  var import_design_system120 = require("@ai-matrx/design-system");
42476
42478
  var import_react241 = require("react");
42477
- var import_core22 = require("@dnd-kit/core");
42479
+ var import_core23 = require("@dnd-kit/core");
42478
42480
  var import_sortable = require("@dnd-kit/sortable");
42479
42481
  var import_utilities = require("@dnd-kit/utilities");
42480
42482
  var import_react242 = require("@ai-matrx/records/react");
@@ -44104,9 +44106,9 @@ function QuestionList({
44104
44106
  onQuestions,
44105
44107
  onQuestion
44106
44108
  }) {
44107
- const sensors = (0, import_core22.useSensors)(
44108
- (0, import_core22.useSensor)(import_core22.PointerSensor, { activationConstraint: { distance: 4 } }),
44109
- (0, import_core22.useSensor)(import_core22.KeyboardSensor, { coordinateGetter: import_sortable.sortableKeyboardCoordinates })
44109
+ const sensors = (0, import_core23.useSensors)(
44110
+ (0, import_core23.useSensor)(import_core23.PointerSensor, { activationConstraint: { distance: 4 } }),
44111
+ (0, import_core23.useSensor)(import_core23.KeyboardSensor, { coordinateGetter: import_sortable.sortableKeyboardCoordinates })
44110
44112
  );
44111
44113
  const askable = askableFields([...fields]);
44112
44114
  const unasked = askable.filter((f) => !draft.questions.some((q) => q.field === f.key));
@@ -44128,7 +44130,7 @@ function QuestionList({
44128
44130
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { className: "font-medium text-foreground", children: "Questions" }),
44129
44131
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { className: "tabular-nums", children: draft.questions.length })
44130
44132
  ] }),
44131
- /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_core22.DndContext, { sensors, collisionDetection: import_core22.closestCenter, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_sortable.SortableContext, { items: draft.questions.map((q) => q.field), strategy: import_sortable.verticalListSortingStrategy, children: draft.questions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
44133
+ /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_core23.DndContext, { sensors, collisionDetection: import_core23.closestCenter, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_sortable.SortableContext, { items: draft.questions.map((q) => q.field), strategy: import_sortable.verticalListSortingStrategy, children: draft.questions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
44132
44134
  QuestionRow,
44133
44135
  {
44134
44136
  index,
@@ -45124,7 +45126,7 @@ var import_react259 = require("@ai-matrx/records/react");
45124
45126
  var import_design_system129 = require("@ai-matrx/design-system");
45125
45127
 
45126
45128
  // src/DashboardGrid.tsx
45127
- var import_core23 = require("@dnd-kit/core");
45129
+ var import_core24 = require("@dnd-kit/core");
45128
45130
  var import_sortable2 = require("@dnd-kit/sortable");
45129
45131
  var import_utilities2 = require("@dnd-kit/utilities");
45130
45132
  var import_design_system126 = require("@ai-matrx/design-system");
@@ -45180,7 +45182,7 @@ function withBlockIds(blocks) {
45180
45182
  // src/DashboardGrid.tsx
45181
45183
  var import_jsx_runtime142 = require("react/jsx-runtime");
45182
45184
  var dashboardCollision = (args) => {
45183
- const under = (0, import_core23.pointerWithin)(args);
45185
+ const under = (0, import_core24.pointerWithin)(args);
45184
45186
  if (under.length > 0) return under;
45185
45187
  const at = args.collisionRect;
45186
45188
  return args.droppableContainers.flatMap((container) => {
@@ -45190,9 +45192,9 @@ var dashboardCollision = (args) => {
45190
45192
  }).sort((a, b) => a.data.value - b.data.value);
45191
45193
  };
45192
45194
  function DashboardGrid({ items, arranging, onMove, onSpan }) {
45193
- const sensors = (0, import_core23.useSensors)(
45194
- (0, import_core23.useSensor)(import_core23.PointerSensor, { activationConstraint: { distance: 4 } }),
45195
- (0, import_core23.useSensor)(import_core23.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
45195
+ const sensors = (0, import_core24.useSensors)(
45196
+ (0, import_core24.useSensor)(import_core24.PointerSensor, { activationConstraint: { distance: 4 } }),
45197
+ (0, import_core24.useSensor)(import_core24.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
45196
45198
  );
45197
45199
  const ids = items.map((item) => item.id);
45198
45200
  function dragEnd(event) {
@@ -45202,7 +45204,7 @@ function DashboardGrid({ items, arranging, onMove, onSpan }) {
45202
45204
  }
45203
45205
  const grid = /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-12", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(GridCell2, { item, index, arranging, onSpan }, item.id)) });
45204
45206
  if (!arranging) return grid;
45205
- return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_core23.DndContext, { sensors, collisionDetection: dashboardCollision, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_sortable2.SortableContext, { items: ids, strategy: import_sortable2.rectSortingStrategy, children: grid }) });
45207
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_core24.DndContext, { sensors, collisionDetection: dashboardCollision, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_sortable2.SortableContext, { items: ids, strategy: import_sortable2.rectSortingStrategy, children: grid }) });
45206
45208
  }
45207
45209
  function GridCell2({
45208
45210
  item,
@@ -46415,7 +46417,7 @@ var import_react261 = require("@ai-matrx/records/react");
46415
46417
 
46416
46418
  // src/question.ts
46417
46419
  var import_records67 = require("@ai-matrx/records");
46418
- var import_core24 = require("@ai-matrx/records/core");
46420
+ var import_core25 = require("@ai-matrx/records/core");
46419
46421
  var QUESTION_OPS = ["count", "sum", "avg", "min", "max"];
46420
46422
  var QUESTION_LIMIT_DEFAULT = 25;
46421
46423
  var QUESTION_GROUP_CEILING = 200;
@@ -46667,7 +46669,7 @@ async function askAsOf(client, tableId, spec, fields, measures, keys) {
46667
46669
  },
46668
46670
  { schema: config.schema ?? "custom" }
46669
46671
  );
46670
- if (response.error) return { ok: false, error: (0, import_core24.mapPgError)(response.error, "askQuestion.asOf") };
46672
+ if (response.error) return { ok: false, error: (0, import_core25.mapPgError)(response.error, "askQuestion.asOf") };
46671
46673
  const rows2 = Array.isArray(response.data) ? response.data : [];
46672
46674
  const bad = rows2.find((r) => Number(r.not_numbers ?? 0) > 0);
46673
46675
  if (bad && m.op !== "count") {
@@ -46738,7 +46740,7 @@ function savedOf(row) {
46738
46740
  }
46739
46741
  async function questionsOf(client, tableId) {
46740
46742
  const response = await client.config.dataSource.schema("platform").from("saved_view").select("id, name, definition, visibility, version, created_by").eq("surface_key", QUESTION_SURFACE).eq("subject_id", tableId).is("deleted_at", null).order("name", { ascending: true });
46741
- if (response.error) return { ok: false, error: (0, import_core24.mapPgError)(response.error, "questionsOf") };
46743
+ if (response.error) return { ok: false, error: (0, import_core25.mapPgError)(response.error, "questionsOf") };
46742
46744
  const me = client.config.actor?.user_id ?? null;
46743
46745
  return {
46744
46746
  ok: true,
@@ -46767,7 +46769,7 @@ async function questionSave(client, args) {
46767
46769
  if (response.error.code === "23505") {
46768
46770
  return { ok: false, error: { code: "already_exists", message: `You already have a question called \u201C${name}\u201D.` } };
46769
46771
  }
46770
- return { ok: false, error: (0, import_core24.mapPgError)(response.error, "questionSave") };
46772
+ return { ok: false, error: (0, import_core25.mapPgError)(response.error, "questionSave") };
46771
46773
  }
46772
46774
  return { ok: true, data: response.data ? savedOf(response.data) : null };
46773
46775
  }
@@ -46777,7 +46779,7 @@ async function questionArchive(client, id, version) {
46777
46779
  { p_surface_key: QUESTION_SURFACE, p_id: id, ...version !== void 0 ? { p_expected_version: version } : {} },
46778
46780
  { schema: "public" }
46779
46781
  );
46780
- if (response.error) return { ok: false, error: (0, import_core24.mapPgError)(response.error, "questionArchive") };
46782
+ if (response.error) return { ok: false, error: (0, import_core25.mapPgError)(response.error, "questionArchive") };
46781
46783
  return { ok: true, data: response.data !== null };
46782
46784
  }
46783
46785
 
@@ -47636,7 +47638,7 @@ function TableAsk({ tableId, onOpenInQuestions }) {
47636
47638
  // src/PageScreen.tsx
47637
47639
  var import_react264 = require("react");
47638
47640
  var import_react265 = require("@ai-matrx/records/react");
47639
- var import_core25 = require("@ai-matrx/records/core");
47641
+ var import_core26 = require("@ai-matrx/records/core");
47640
47642
  var import_design_system132 = require("@ai-matrx/design-system");
47641
47643
  var import_jsx_runtime149 = require("react/jsx-runtime");
47642
47644
  var EDIT_LEVELS = /* @__PURE__ */ new Set(["edit_content", "editor", "admin", "owner"]);
@@ -48052,7 +48054,7 @@ function ListBlockView({
48052
48054
  ...sort.length > 0 ? { sort } : {}
48053
48055
  });
48054
48056
  const reload = page.reload;
48055
- (0, import_react264.useEffect)(() => (0, import_core25.onRecordChanged)(() => reload()), [reload]);
48057
+ (0, import_react264.useEffect)(() => (0, import_core26.onRecordChanged)(() => reload()), [reload]);
48056
48058
  const rows = nobodyIsMe ? [] : page.data?.rows ?? [];
48057
48059
  const columns = block.columns && block.columns.length > 0 ? block.columns.map((k) => all.find((f) => f.key === k)).filter((f) => !!f) : [...all].sort((a, b) => (a.sort ?? 100) - (b.sort ?? 100)).slice(0, DEFAULT_COLUMNS);
48058
48060
  const firstId = rows[0]?.id ?? null;
@@ -49587,7 +49589,7 @@ var import_design_system145 = require("@ai-matrx/design-system");
49587
49589
  var import_text_case19 = require("@ai-matrx/kit/text-case");
49588
49590
 
49589
49591
  // src/viewShare.ts
49590
- var import_core26 = require("@ai-matrx/records/core");
49592
+ var import_core27 = require("@ai-matrx/records/core");
49591
49593
  var NO_VIEW_REASON = "No saved view yet";
49592
49594
  function viewLink(tableId, viewId, origin) {
49593
49595
  return `${tableLink(tableId, origin)}?view=${encodeURIComponent(viewId)}`;
@@ -49623,7 +49625,7 @@ async function downloadViewCsv(args) {
49623
49625
  const columns = viewColumns(fields, view.presentation);
49624
49626
  const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
49625
49627
  const name = fileNameOf(args.tableName) || "records";
49626
- download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core26.exportCsv)(columns, rows));
49628
+ download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core27.exportCsv)(columns, rows));
49627
49629
  host.notify?.success(read.cut ? cutWords(read.rows.length) : "CSV downloaded");
49628
49630
  }
49629
49631