@ai-matrx/records-ui 0.115.100 → 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 +13 -1
- package/dist/index.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +11 -3
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +11 -3
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/dist/pickers.js
CHANGED
|
@@ -8538,9 +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
|
-
|
|
8542
|
-
|
|
8543
|
-
}
|
|
8541
|
+
const pictureAt = imageAddressOf(field, value);
|
|
8542
|
+
if (pictureAt) return /* @__PURE__ */ jsx29(ImageUrlValue, { url: pictureAt, alt: field.label || field.key, room });
|
|
8544
8543
|
if (kind === "url" && typeof value === "string") {
|
|
8545
8544
|
const href = value.includes("://") ? value : `https://${value}`;
|
|
8546
8545
|
return /* @__PURE__ */ jsx29(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs27(
|
|
@@ -8590,6 +8589,15 @@ function isImageUrl2(value) {
|
|
|
8590
8589
|
}
|
|
8591
8590
|
return /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)$/i.test(url.pathname) || /\/(images?|img)\//i.test(url.pathname);
|
|
8592
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
|
+
}
|
|
8593
8601
|
function ImageUrlValue({ url, alt, room }) {
|
|
8594
8602
|
const host = useRecordsUi();
|
|
8595
8603
|
const box = room === "full" ? "size-24" : "size-6";
|