@ai-matrx/records-ui 0.115.99 → 0.115.101
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 +30 -1
- package/dist/index.cjs +3115 -3079
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +946 -910
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +37 -0
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +37 -0
- package/dist/pickers.js.map +1 -1
- package/package.json +3 -3
package/dist/pickers.js
CHANGED
|
@@ -8538,6 +8538,8 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
|
|
|
8538
8538
|
if (Array.isArray(value)) {
|
|
8539
8539
|
return /* @__PURE__ */ jsx29("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx29(Badge7, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
|
|
8540
8540
|
}
|
|
8541
|
+
const pictureAt = imageAddressOf(field, value);
|
|
8542
|
+
if (pictureAt) return /* @__PURE__ */ jsx29(ImageUrlValue, { url: pictureAt, alt: field.label || field.key, room });
|
|
8541
8543
|
if (kind === "url" && typeof value === "string") {
|
|
8542
8544
|
const href = value.includes("://") ? value : `https://${value}`;
|
|
8543
8545
|
return /* @__PURE__ */ jsx29(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs27(
|
|
@@ -8576,6 +8578,41 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
|
|
|
8576
8578
|
}
|
|
8577
8579
|
return /* @__PURE__ */ jsx29("span", { className: cn24("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
|
|
8578
8580
|
}
|
|
8581
|
+
function isImageUrl2(value) {
|
|
8582
|
+
const text = value.trim();
|
|
8583
|
+
if (!/^https?:\/\/[^\s]+$/i.test(text)) return false;
|
|
8584
|
+
let url;
|
|
8585
|
+
try {
|
|
8586
|
+
url = new URL(text);
|
|
8587
|
+
} catch {
|
|
8588
|
+
return false;
|
|
8589
|
+
}
|
|
8590
|
+
return /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)$/i.test(url.pathname) || /\/(images?|img)\//i.test(url.pathname);
|
|
8591
|
+
}
|
|
8592
|
+
function imageAddressOf(field, value) {
|
|
8593
|
+
if (typeof value !== "string") return null;
|
|
8594
|
+
const kind = editorKindFor(field);
|
|
8595
|
+
if (kind !== "text" && kind !== "url") return null;
|
|
8596
|
+
const text = value.trim();
|
|
8597
|
+
if (isImageUrl2(text)) return text;
|
|
8598
|
+
const named = /(^|[^a-z])(logo|image|img|photo|picture|avatar|thumbnail|headshot)s?([^a-z]|$)/i.test(`${field.label ?? ""} ${field.key}`);
|
|
8599
|
+
return named && /^https?:\/\/[^\s]+$/i.test(text) ? text : null;
|
|
8600
|
+
}
|
|
8601
|
+
function ImageUrlValue({ url, alt, room }) {
|
|
8602
|
+
const host = useRecordsUi();
|
|
8603
|
+
const box = room === "full" ? "size-24" : "size-6";
|
|
8604
|
+
return /* @__PURE__ */ jsx29(
|
|
8605
|
+
OutboundLink6,
|
|
8606
|
+
{
|
|
8607
|
+
className: cn24("inline-flex shrink-0 overflow-hidden rounded-md border border-border bg-muted/40", host.fileImage ? box : "min-w-0 max-w-full items-center gap-1 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent"),
|
|
8608
|
+
href: url,
|
|
8609
|
+
title: url,
|
|
8610
|
+
"data-records-image-url": "",
|
|
8611
|
+
onClick: (event) => event.stopPropagation(),
|
|
8612
|
+
children: host.fileImage ? host.fileImage({ fileId: url, alt }) : /* @__PURE__ */ jsx29("span", { className: "truncate", children: linkChipText(url) })
|
|
8613
|
+
}
|
|
8614
|
+
);
|
|
8615
|
+
}
|
|
8579
8616
|
function LivePersonChip({ id, name }) {
|
|
8580
8617
|
const open = useRecordsUi().openPerson;
|
|
8581
8618
|
return /* @__PURE__ */ jsx29(PersonChip, { name, ...open ? { onOpen: () => void openStoredPerson(id, open) } : {} });
|