@ai-matrx/records-ui 0.93.28 → 0.93.29

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.93.29
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.93.28..npm/records-ui/v0.93.29 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.93.28
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -1710,6 +1710,13 @@ function isId(value) {
1710
1710
  function pointsAtRecords(field2) {
1711
1711
  return field2.type === "list" || field2.type === "relation";
1712
1712
  }
1713
+ function shownValue(field2, value, labels) {
1714
+ if (!labels || !pointsAtRecords(field2)) return value;
1715
+ const ids = idsOf(value);
1716
+ if (ids.length === 0) return value;
1717
+ const words2 = ids.map((id) => labels(field2, id) ?? id);
1718
+ return Array.isArray(value) ? words2 : words2[0];
1719
+ }
1713
1720
  function RecordLabelProvider({ children }) {
1714
1721
  const client = (0, import_react9.useRecordsClient)();
1715
1722
  const [names, setNames] = (0, import_react8.useState)({});
@@ -6534,12 +6541,12 @@ function measuresFor(field2, storeOps, firstColumn) {
6534
6541
  });
6535
6542
  }
6536
6543
  function gridCopyConfig(args) {
6537
- const { tableId, tableName: tableName2, fields, rowLabel } = args;
6544
+ const { tableId, tableName: tableName2, fields, rowLabel, labels } = args;
6538
6545
  const shown3 = (row) => {
6539
6546
  const document2 = row.document ?? {};
6540
6547
  const out = {};
6541
6548
  for (const field2 of fields) {
6542
- if (document2[field2.key] !== void 0) out[fieldName(field2)] = document2[field2.key];
6549
+ if (document2[field2.key] !== void 0) out[fieldName(field2)] = shownValue(field2, document2[field2.key], labels);
6543
6550
  }
6544
6551
  return out;
6545
6552
  };
@@ -13179,9 +13186,19 @@ function Grid({
13179
13186
  records.reload();
13180
13187
  }, [added, controls.columns, columnIds, fields.data, editing, records]);
13181
13188
  addRowRef.current = () => void addRowHere();
13189
+ const labels = useRecordLabels(ordered);
13190
+ const labelsNow = (0, import_react72.useRef)(labels);
13191
+ labelsNow.current = labels;
13192
+ const labelFor = (0, import_react72.useCallback)((field2, id) => labelsNow.current(field2, id), []);
13193
+ (0, import_react72.useEffect)(() => {
13194
+ for (const field2 of ordered) {
13195
+ if (!pointsAtRecords(field2)) continue;
13196
+ for (const row of rows) for (const id of idsOf(row.document?.[field2.key])) labels(field2, id);
13197
+ }
13198
+ }, [ordered, rows, labels]);
13182
13199
  const fieldColumns = (0, import_react72.useMemo)(
13183
- () => ordered.map(
13184
- (field2) => columnForField(
13200
+ () => ordered.map((field2) => ({
13201
+ ...columnForField(
13185
13202
  // A formula's hover text names its columns as they are called NOW (review 2, C3).
13186
13203
  // …and shows as its inputs do (money in, money out), blank when it has nothing to work on.
13187
13204
  withFormulaDisplayNow(field2, ordered, (f) => String(editorKindFor(f)), currencyCodeFor),
@@ -13199,8 +13216,9 @@ function Grid({
13199
13216
  cellFor: (recordId) => enrichCells.get(`${recordId}:${field2.key}`),
13200
13217
  onPin: canWrite ? pinCell : void 0
13201
13218
  }
13202
- )
13203
- ),
13219
+ ),
13220
+ ...pointsAtRecords(field2) ? { copyValue: (row) => shownValue(field2, row.document?.[field2.key], labelFor) } : {}
13221
+ })),
13204
13222
  [
13205
13223
  ordered,
13206
13224
  canWrite,
@@ -13270,9 +13288,10 @@ function Grid({
13270
13288
  tableId,
13271
13289
  tableName: tableName(table.data),
13272
13290
  fields: ordered,
13273
- rowLabel: (row) => recordNameIn(table.data, row.document ?? {})
13291
+ rowLabel: (row) => recordNameIn(table.data, row.document ?? {}),
13292
+ labels: labelFor
13274
13293
  }) : null,
13275
- [tableId, table.data, ordered]
13294
+ [tableId, table.data, ordered, labelFor]
13276
13295
  );
13277
13296
  const tableStyleProp = (0, import_react72.useMemo)(
13278
13297
  () => (0, import_data_table9.tableStyleIsEmpty)(paint.style) ? null : {
@@ -14165,13 +14184,6 @@ function toRows(fields, records, labels) {
14165
14184
  return row;
14166
14185
  });
14167
14186
  }
14168
- function shownValue(field2, value, labels) {
14169
- if (!labels || !pointsAtRecords(field2)) return value;
14170
- const ids = idsOf(value);
14171
- if (ids.length === 0) return value;
14172
- const words2 = ids.map((id) => labels(field2, id) ?? id);
14173
- return Array.isArray(value) ? words2 : words2[0];
14174
- }
14175
14187
  function download(name, mime, bytes) {
14176
14188
  const url = URL.createObjectURL(new Blob([bytes], { type: mime }));
14177
14189
  const anchor = document.createElement("a");