@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/index.js
CHANGED
|
@@ -13993,9 +13993,8 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
13993
13993
|
if (Array.isArray(value)) {
|
|
13994
13994
|
return /* @__PURE__ */ jsx44("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx44(Badge8, { variant: "secondary", className: "text-[11px]", children: scalarText(field2, item, labels) }, `${String(item)}-${i}`)) });
|
|
13995
13995
|
}
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
}
|
|
13996
|
+
const pictureAt = imageAddressOf(field2, value);
|
|
13997
|
+
if (pictureAt) return /* @__PURE__ */ jsx44(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
|
|
13999
13998
|
if (kind2 === "url" && typeof value === "string") {
|
|
14000
13999
|
const href = value.includes("://") ? value : `https://${value}`;
|
|
14001
14000
|
return /* @__PURE__ */ jsx44(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs39(
|
|
@@ -14045,6 +14044,15 @@ function isImageUrl2(value) {
|
|
|
14045
14044
|
}
|
|
14046
14045
|
return /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)$/i.test(url.pathname) || /\/(images?|img)\//i.test(url.pathname);
|
|
14047
14046
|
}
|
|
14047
|
+
function imageAddressOf(field2, value) {
|
|
14048
|
+
if (typeof value !== "string") return null;
|
|
14049
|
+
const kind2 = editorKindFor(field2);
|
|
14050
|
+
if (kind2 !== "text" && kind2 !== "url") return null;
|
|
14051
|
+
const text = value.trim();
|
|
14052
|
+
if (isImageUrl2(text)) return text;
|
|
14053
|
+
const named = /(^|[^a-z])(logo|image|img|photo|picture|avatar|thumbnail|headshot)s?([^a-z]|$)/i.test(`${field2.label ?? ""} ${field2.key}`);
|
|
14054
|
+
return named && /^https?:\/\/[^\s]+$/i.test(text) ? text : null;
|
|
14055
|
+
}
|
|
14048
14056
|
function ImageUrlValue({ url, alt, room }) {
|
|
14049
14057
|
const host = useRecordsUi();
|
|
14050
14058
|
const box = room === "full" ? "size-24" : "size-6";
|
|
@@ -14184,6 +14192,8 @@ function RecordValue({
|
|
|
14184
14192
|
}
|
|
14185
14193
|
}
|
|
14186
14194
|
}
|
|
14195
|
+
const pictureAt = value !== null && value !== void 0 && !wholeValueOf(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent ? imageAddressOf(field2, value) : null;
|
|
14196
|
+
if (pictureAt) return /* @__PURE__ */ jsx44(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
|
|
14187
14197
|
const shown5 = format ?? formatForField(field2);
|
|
14188
14198
|
const shape = shown5 && (shown5.id === "date" || shown5.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
|
|
14189
14199
|
const dated = shape ? { ...shape, ...shown5?.options ? { options: shown5.options } : {} } : void 0;
|