@almadar/ui 5.162.0 → 5.163.0
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/dist/avl/index.cjs +228 -69
- package/dist/avl/index.js +228 -69
- package/dist/components/index.cjs +230 -69
- package/dist/components/index.d.cts +24 -5
- package/dist/components/index.d.ts +24 -5
- package/dist/components/index.js +230 -69
- package/dist/hooks/index.cjs +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/locales/index.cjs +6 -0
- package/dist/locales/index.js +6 -0
- package/dist/providers/index.cjs +228 -69
- package/dist/providers/index.js +228 -69
- package/dist/runtime/index.cjs +228 -69
- package/dist/runtime/index.js +228 -69
- package/locales/ar.json +8 -6
- package/locales/en.json +3 -1
- package/locales/sl.json +3 -1
- package/package.json +4 -4
package/dist/components/index.js
CHANGED
|
@@ -34105,6 +34105,33 @@ var init_Lightbox = __esm({
|
|
|
34105
34105
|
Lightbox.displayName = "Lightbox";
|
|
34106
34106
|
}
|
|
34107
34107
|
});
|
|
34108
|
+
|
|
34109
|
+
// lib/relationLabel.ts
|
|
34110
|
+
function relationLabel(value) {
|
|
34111
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || value instanceof Date)
|
|
34112
|
+
return null;
|
|
34113
|
+
for (const key of ["name", "title", "label"]) {
|
|
34114
|
+
const candidate = value[key];
|
|
34115
|
+
if (typeof candidate === "string" && candidate !== "") return candidate;
|
|
34116
|
+
}
|
|
34117
|
+
const id = value.id;
|
|
34118
|
+
return id !== void 0 && id !== null ? String(id) : null;
|
|
34119
|
+
}
|
|
34120
|
+
function relationDisplayLabels(value, options) {
|
|
34121
|
+
if (value === void 0 || value === null || value === "") return [];
|
|
34122
|
+
if (Array.isArray(value)) {
|
|
34123
|
+
return value.flatMap((item) => relationDisplayLabels(item, options));
|
|
34124
|
+
}
|
|
34125
|
+
const hydrated = relationLabel(value);
|
|
34126
|
+
if (hydrated !== null) return [hydrated];
|
|
34127
|
+
const raw = String(value);
|
|
34128
|
+
const match = options?.find((opt) => opt.value === raw);
|
|
34129
|
+
return [match ? match.label : raw];
|
|
34130
|
+
}
|
|
34131
|
+
var init_relationLabel = __esm({
|
|
34132
|
+
"lib/relationLabel.ts"() {
|
|
34133
|
+
}
|
|
34134
|
+
});
|
|
34108
34135
|
function renderIconInput3(icon, props) {
|
|
34109
34136
|
return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
|
|
34110
34137
|
}
|
|
@@ -34422,6 +34449,7 @@ var init_TableView = __esm({
|
|
|
34422
34449
|
"use client";
|
|
34423
34450
|
init_cn();
|
|
34424
34451
|
init_format();
|
|
34452
|
+
init_relationLabel();
|
|
34425
34453
|
init_getNestedValue();
|
|
34426
34454
|
init_useEventBus();
|
|
34427
34455
|
init_Box();
|
|
@@ -34435,7 +34463,13 @@ var init_TableView = __esm({
|
|
|
34435
34463
|
init_Menu();
|
|
34436
34464
|
init_useDataDnd();
|
|
34437
34465
|
tableViewLog = createLogger("almadar:ui:table-view");
|
|
34438
|
-
formatCell = (value, format) =>
|
|
34466
|
+
formatCell = (value, format) => {
|
|
34467
|
+
if (value !== null && value !== void 0 && typeof value === "object" && !(value instanceof Date)) {
|
|
34468
|
+
const labels = relationDisplayLabels(value);
|
|
34469
|
+
if (labels.length > 0) return labels.join(", ");
|
|
34470
|
+
}
|
|
34471
|
+
return formatValue(value, format);
|
|
34472
|
+
};
|
|
34439
34473
|
MAX_MEASURED_COL_CH = 32;
|
|
34440
34474
|
BADGE_CHROME_CH = 4;
|
|
34441
34475
|
alignClass = {
|
|
@@ -38050,6 +38084,13 @@ var init_RichTextEditor = __esm({
|
|
|
38050
38084
|
document.execCommand("createLink", false, safe);
|
|
38051
38085
|
afterEdit();
|
|
38052
38086
|
}, [afterEdit, t, toolbar.link]);
|
|
38087
|
+
const execImage = useCallback(() => {
|
|
38088
|
+
const url = window.prompt(t("richTextEditor.imagePrompt"));
|
|
38089
|
+
if (!url) return;
|
|
38090
|
+
const safe = safeUrl(url, ["http://", "https://", "data:image/"]) ?? `https://${url}`;
|
|
38091
|
+
document.execCommand("insertImage", false, safe);
|
|
38092
|
+
afterEdit();
|
|
38093
|
+
}, [afterEdit, t]);
|
|
38053
38094
|
const execRule = useCallback(() => {
|
|
38054
38095
|
document.execCommand("insertHorizontalRule", false);
|
|
38055
38096
|
afterEdit();
|
|
@@ -38087,6 +38128,7 @@ var init_RichTextEditor = __esm({
|
|
|
38087
38128
|
/* @__PURE__ */ jsx(ToolbarButton, { icon: Quote, label: t("richTextEditor.quote"), active: toolbar.block === "blockquote", onExec: () => execBlock("blockquote") }),
|
|
38088
38129
|
/* @__PURE__ */ jsx(ToolbarButton, { icon: Code, label: t("richTextEditor.code"), active: toolbar.block === "pre", onExec: () => execBlock("pre") }),
|
|
38089
38130
|
/* @__PURE__ */ jsx(ToolbarButton, { icon: Link$1, label: toolbar.link ? t("richTextEditor.removeLink") : t("richTextEditor.link"), active: toolbar.link, onExec: execLink }),
|
|
38131
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: Image$1, label: t("richTextEditor.image"), onExec: execImage }),
|
|
38090
38132
|
/* @__PURE__ */ jsx(ToolbarButton, { icon: Minus, label: t("richTextEditor.divider"), onExec: execRule })
|
|
38091
38133
|
]
|
|
38092
38134
|
}
|
|
@@ -38127,6 +38169,8 @@ function DocumentPanel({
|
|
|
38127
38169
|
id,
|
|
38128
38170
|
title,
|
|
38129
38171
|
subtitle,
|
|
38172
|
+
coverImage,
|
|
38173
|
+
icon,
|
|
38130
38174
|
value,
|
|
38131
38175
|
actions,
|
|
38132
38176
|
maxInlineActions,
|
|
@@ -38202,62 +38246,74 @@ function DocumentPanel({
|
|
|
38202
38246
|
const emitWithId = (event) => () => {
|
|
38203
38247
|
if (event) eventBus.emit(`UI:${event}`, { id: recordId });
|
|
38204
38248
|
};
|
|
38205
|
-
return /* @__PURE__ */
|
|
38206
|
-
/* @__PURE__ */
|
|
38207
|
-
|
|
38208
|
-
titleNode,
|
|
38209
|
-
subtitle ? /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: subtitle }) : null
|
|
38210
|
-
] }),
|
|
38211
|
-
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0 pt-1 items-center", children: editing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38212
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "hidden sm:block", children: autosaveHint ?? (t("documentPanel.autosaveHint") || "") }),
|
|
38213
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: emitWithId(doneEvent), "data-testid": "document-done", children: doneLabel ?? (t("documentPanel.done") || "Done") })
|
|
38214
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38215
|
-
editEvent && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: emitWithId(editEvent), "data-testid": "document-edit", children: [
|
|
38216
|
-
/* @__PURE__ */ jsx(Icon, { name: "edit", size: "xs", className: "mr-1" }),
|
|
38217
|
-
editLabel ?? (t("documentPanel.edit") || "Edit")
|
|
38218
|
-
] }),
|
|
38219
|
-
inlineActions.map((action, idx) => /* @__PURE__ */ jsxs(
|
|
38220
|
-
Button,
|
|
38221
|
-
{
|
|
38222
|
-
variant: "primary",
|
|
38223
|
-
size: "sm",
|
|
38224
|
-
onClick: () => fireAction(action),
|
|
38225
|
-
"data-testid": `action-${action.event}`,
|
|
38226
|
-
children: [
|
|
38227
|
-
action.icon && renderIconInput4(action.icon, { size: "xs", className: "mr-1" }),
|
|
38228
|
-
action.label
|
|
38229
|
-
]
|
|
38230
|
-
},
|
|
38231
|
-
idx
|
|
38232
|
-
)),
|
|
38233
|
-
menuActions.length > 0 && /* @__PURE__ */ jsx(
|
|
38234
|
-
Menu,
|
|
38235
|
-
{
|
|
38236
|
-
position: "bottom-end",
|
|
38237
|
-
trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
38238
|
-
items: menuActions.map((action) => ({
|
|
38239
|
-
label: action.label,
|
|
38240
|
-
icon: action.icon,
|
|
38241
|
-
variant: action.variant === "danger" ? "danger" : "default",
|
|
38242
|
-
onClick: () => fireAction(action)
|
|
38243
|
-
}))
|
|
38244
|
-
}
|
|
38245
|
-
)
|
|
38246
|
-
] }) })
|
|
38247
|
-
] }),
|
|
38248
|
-
editing ? /* @__PURE__ */ jsx(RichTextEditor, { value, changeEvent: contentChangeEvent, placeholder }) : /* @__PURE__ */ jsx(
|
|
38249
|
-
Box,
|
|
38249
|
+
return /* @__PURE__ */ jsxs(Card, { variant: "elevated", className: cn("w-full overflow-hidden", className), children: [
|
|
38250
|
+
coverImage ? /* @__PURE__ */ jsx(Box, { className: "h-44 w-full sm:h-52", "data-testid": "document-cover", children: /* @__PURE__ */ jsx(
|
|
38251
|
+
"img",
|
|
38250
38252
|
{
|
|
38251
|
-
|
|
38252
|
-
|
|
38253
|
-
|
|
38254
|
-
|
|
38255
|
-
|
|
38256
|
-
|
|
38257
|
-
|
|
38258
|
-
|
|
38259
|
-
|
|
38260
|
-
|
|
38253
|
+
src: coverImage,
|
|
38254
|
+
alt: "",
|
|
38255
|
+
"aria-hidden": "true",
|
|
38256
|
+
className: "h-full w-full object-cover"
|
|
38257
|
+
}
|
|
38258
|
+
) }) : null,
|
|
38259
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "p-6 sm:p-8", children: [
|
|
38260
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
|
|
38261
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
|
|
38262
|
+
icon ? /* @__PURE__ */ jsx(Box, { className: "text-muted-foreground", "data-testid": "document-icon", children: renderIconInput4(icon, { size: "lg" }) }) : null,
|
|
38263
|
+
titleNode,
|
|
38264
|
+
subtitle ? /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: subtitle }) : null
|
|
38265
|
+
] }),
|
|
38266
|
+
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0 pt-1 items-center", children: editing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38267
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "hidden sm:block", children: autosaveHint ?? (t("documentPanel.autosaveHint") || "") }),
|
|
38268
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: emitWithId(doneEvent), "data-testid": "document-done", children: doneLabel ?? (t("documentPanel.done") || "Done") })
|
|
38269
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38270
|
+
editEvent && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: emitWithId(editEvent), "data-testid": "document-edit", children: [
|
|
38271
|
+
/* @__PURE__ */ jsx(Icon, { name: "edit", size: "xs", className: "mr-1" }),
|
|
38272
|
+
editLabel ?? (t("documentPanel.edit") || "Edit")
|
|
38273
|
+
] }),
|
|
38274
|
+
inlineActions.map((action, idx) => /* @__PURE__ */ jsxs(
|
|
38275
|
+
Button,
|
|
38276
|
+
{
|
|
38277
|
+
variant: "primary",
|
|
38278
|
+
size: "sm",
|
|
38279
|
+
onClick: () => fireAction(action),
|
|
38280
|
+
"data-testid": `action-${action.event}`,
|
|
38281
|
+
children: [
|
|
38282
|
+
action.icon && renderIconInput4(action.icon, { size: "xs", className: "mr-1" }),
|
|
38283
|
+
action.label
|
|
38284
|
+
]
|
|
38285
|
+
},
|
|
38286
|
+
idx
|
|
38287
|
+
)),
|
|
38288
|
+
menuActions.length > 0 && /* @__PURE__ */ jsx(
|
|
38289
|
+
Menu,
|
|
38290
|
+
{
|
|
38291
|
+
position: "bottom-end",
|
|
38292
|
+
trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
38293
|
+
items: menuActions.map((action) => ({
|
|
38294
|
+
label: action.label,
|
|
38295
|
+
icon: action.icon,
|
|
38296
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
38297
|
+
onClick: () => fireAction(action)
|
|
38298
|
+
}))
|
|
38299
|
+
}
|
|
38300
|
+
)
|
|
38301
|
+
] }) })
|
|
38302
|
+
] }),
|
|
38303
|
+
editing ? /* @__PURE__ */ jsx(RichTextEditor, { value, changeEvent: contentChangeEvent, placeholder }) : /* @__PURE__ */ jsx(
|
|
38304
|
+
Box,
|
|
38305
|
+
{
|
|
38306
|
+
onClick: emitWithId(editEvent),
|
|
38307
|
+
className: cn(
|
|
38308
|
+
"rounded-md px-1 -mx-1 min-h-[16rem]",
|
|
38309
|
+
editEvent && "cursor-text transition-colors hover:bg-muted/30"
|
|
38310
|
+
),
|
|
38311
|
+
"data-testid": "document-body",
|
|
38312
|
+
children: value && value !== "" ? /* @__PURE__ */ jsx(RichTextEditor, { value, readOnly: true }) : /* @__PURE__ */ jsx(Typography, { variant: "body", color: "muted", children: placeholder ?? (t("documentPanel.placeholder") || "") })
|
|
38313
|
+
}
|
|
38314
|
+
)
|
|
38315
|
+
] })
|
|
38316
|
+
] });
|
|
38261
38317
|
}
|
|
38262
38318
|
var init_DocumentPanel = __esm({
|
|
38263
38319
|
"components/core/molecules/DocumentPanel.tsx"() {
|
|
@@ -38281,17 +38337,16 @@ function renderIconInput5(icon, props) {
|
|
|
38281
38337
|
function fieldName(field) {
|
|
38282
38338
|
return field.name ?? field.key ?? "";
|
|
38283
38339
|
}
|
|
38284
|
-
function
|
|
38285
|
-
if (value
|
|
38286
|
-
|
|
38287
|
-
|
|
38288
|
-
if (typeof candidate === "string" && candidate !== "") return candidate;
|
|
38340
|
+
function relationId(value) {
|
|
38341
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date)) {
|
|
38342
|
+
const id = value.id;
|
|
38343
|
+
if (id !== void 0 && id !== null) return String(id);
|
|
38289
38344
|
}
|
|
38290
|
-
|
|
38291
|
-
return id !== void 0 && id !== null ? String(id) : null;
|
|
38345
|
+
return String(value);
|
|
38292
38346
|
}
|
|
38293
38347
|
function fieldKind(field, value) {
|
|
38294
38348
|
if (field.kind) return field.kind;
|
|
38349
|
+
if (field.type === "image") return "image";
|
|
38295
38350
|
if (field.options && field.options.length > 0) return "select";
|
|
38296
38351
|
if (typeof value === "boolean" || field.format === "boolean") return "boolean";
|
|
38297
38352
|
if (Array.isArray(value) || relationLabel(value ?? null) !== null) return "readonly";
|
|
@@ -38301,6 +38356,7 @@ function DocumentDetails({
|
|
|
38301
38356
|
entity,
|
|
38302
38357
|
fields,
|
|
38303
38358
|
metaCommitEvent,
|
|
38359
|
+
relationEvent,
|
|
38304
38360
|
title,
|
|
38305
38361
|
className
|
|
38306
38362
|
}) {
|
|
@@ -38315,11 +38371,51 @@ function DocumentDetails({
|
|
|
38315
38371
|
if (!metaCommitEvent || next === current) return;
|
|
38316
38372
|
eventBus.emit(`UI:${metaCommitEvent}`, { id: recordId, patch: { id: recordId, [name]: next } });
|
|
38317
38373
|
};
|
|
38374
|
+
const relationChip = (item, name, key) => {
|
|
38375
|
+
const label = relationLabel(item) ?? humanizeEnumValue(String(item));
|
|
38376
|
+
if (!relationEvent) {
|
|
38377
|
+
return /* @__PURE__ */ jsx(Badge, { variant: "default", children: label }, key);
|
|
38378
|
+
}
|
|
38379
|
+
const emitClick = () => eventBus.emit(`UI:${relationEvent}`, { field: name, id: relationId(item), name: label });
|
|
38380
|
+
return /* @__PURE__ */ jsx(
|
|
38381
|
+
Badge,
|
|
38382
|
+
{
|
|
38383
|
+
variant: "default",
|
|
38384
|
+
role: "button",
|
|
38385
|
+
tabIndex: 0,
|
|
38386
|
+
className: "cursor-pointer transition-colors hover:bg-accent",
|
|
38387
|
+
onClick: emitClick,
|
|
38388
|
+
onKeyDown: (e) => {
|
|
38389
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
38390
|
+
e.preventDefault();
|
|
38391
|
+
emitClick();
|
|
38392
|
+
}
|
|
38393
|
+
},
|
|
38394
|
+
"data-testid": `relation-chip-${name}`,
|
|
38395
|
+
children: label
|
|
38396
|
+
},
|
|
38397
|
+
key
|
|
38398
|
+
);
|
|
38399
|
+
};
|
|
38318
38400
|
const renderValue = (field) => {
|
|
38319
38401
|
const name = fieldName(field);
|
|
38320
38402
|
const raw = getNestedValue(entity ?? {}, name);
|
|
38321
38403
|
const kind = fieldKind(field, raw);
|
|
38322
38404
|
const label = field.label ?? field.header ?? humanizeFieldName(name);
|
|
38405
|
+
if (kind === "image") {
|
|
38406
|
+
const url = typeof raw === "string" ? raw : "";
|
|
38407
|
+
if (!url) return /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: "\u2014" });
|
|
38408
|
+
return /* @__PURE__ */ jsx(
|
|
38409
|
+
"img",
|
|
38410
|
+
{
|
|
38411
|
+
src: url,
|
|
38412
|
+
alt: label,
|
|
38413
|
+
loading: "lazy",
|
|
38414
|
+
className: "max-h-32 w-full rounded-md border border-border object-cover",
|
|
38415
|
+
"data-testid": `document-property-image-${name}`
|
|
38416
|
+
}
|
|
38417
|
+
);
|
|
38418
|
+
}
|
|
38323
38419
|
if (kind === "boolean") {
|
|
38324
38420
|
return /* @__PURE__ */ jsx(
|
|
38325
38421
|
Switch,
|
|
@@ -38349,9 +38445,12 @@ function DocumentDetails({
|
|
|
38349
38445
|
if (raw.length === 0) {
|
|
38350
38446
|
return /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: "\u2014" });
|
|
38351
38447
|
}
|
|
38352
|
-
return /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: raw.map((item, i) =>
|
|
38448
|
+
return /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: raw.map((item, i) => relationChip(item, name, i)) });
|
|
38353
38449
|
}
|
|
38354
|
-
|
|
38450
|
+
if (raw !== void 0 && raw !== null && raw !== "" && relationLabel(raw) !== null) {
|
|
38451
|
+
return relationChip(raw, name);
|
|
38452
|
+
}
|
|
38453
|
+
const shown2 = raw === void 0 || raw === null || raw === "" ? "\u2014" : formatValue(raw, field.format);
|
|
38355
38454
|
return /* @__PURE__ */ jsx(Typography, { variant: "small", className: "break-words", children: shown2 });
|
|
38356
38455
|
}
|
|
38357
38456
|
if (fieldDraft?.name === name) {
|
|
@@ -38420,6 +38519,7 @@ var init_DocumentDetails = __esm({
|
|
|
38420
38519
|
init_cn();
|
|
38421
38520
|
init_format();
|
|
38422
38521
|
init_getNestedValue();
|
|
38522
|
+
init_relationLabel();
|
|
38423
38523
|
init_useEventBus();
|
|
38424
38524
|
init_Box();
|
|
38425
38525
|
init_Stack();
|
|
@@ -43641,7 +43741,18 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
|
|
|
43641
43741
|
if (value === void 0 || value === null) return "\u2014";
|
|
43642
43742
|
const str2 = String(value);
|
|
43643
43743
|
switch (fieldType) {
|
|
43644
|
-
case "image":
|
|
43744
|
+
case "image": {
|
|
43745
|
+
if (!str2) return "\u2014";
|
|
43746
|
+
return /* @__PURE__ */ jsx(Box, { className: "mt-1 max-w-full", children: /* @__PURE__ */ jsx(
|
|
43747
|
+
"img",
|
|
43748
|
+
{
|
|
43749
|
+
src: str2,
|
|
43750
|
+
alt: formatFieldLabel(fieldName2),
|
|
43751
|
+
className: "max-w-full max-h-64 rounded-md object-contain",
|
|
43752
|
+
loading: "lazy"
|
|
43753
|
+
}
|
|
43754
|
+
) });
|
|
43755
|
+
}
|
|
43645
43756
|
case "url": {
|
|
43646
43757
|
if (str2.match(/\.(png|jpe?g|gif|svg|webp|avif)(\?|$)/i) || str2.startsWith("data:image/")) {
|
|
43647
43758
|
return /* @__PURE__ */ jsx(Box, { className: "mt-1 max-w-full", children: /* @__PURE__ */ jsx(
|
|
@@ -43654,7 +43765,7 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
|
|
|
43654
43765
|
}
|
|
43655
43766
|
) });
|
|
43656
43767
|
}
|
|
43657
|
-
if (
|
|
43768
|
+
if (/^https?:\/\//i.test(str2)) {
|
|
43658
43769
|
return /* @__PURE__ */ jsx(
|
|
43659
43770
|
"a",
|
|
43660
43771
|
{
|
|
@@ -43740,8 +43851,10 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
|
|
|
43740
43851
|
return str2;
|
|
43741
43852
|
}
|
|
43742
43853
|
case "relation": {
|
|
43743
|
-
const
|
|
43744
|
-
|
|
43854
|
+
const labels = relationDisplayLabels(value, meta?.options);
|
|
43855
|
+
if (labels.length === 0) return "\u2014";
|
|
43856
|
+
if (labels.length === 1) return labels[0];
|
|
43857
|
+
return /* @__PURE__ */ jsx(HStack, { gap: "xs", wrap: true, children: labels.map((label, i) => /* @__PURE__ */ jsx(Badge, { variant: "default", children: label }, i)) });
|
|
43745
43858
|
}
|
|
43746
43859
|
case "file": {
|
|
43747
43860
|
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -43843,6 +43956,7 @@ var init_DetailPanel = __esm({
|
|
|
43843
43956
|
init_cn();
|
|
43844
43957
|
init_format();
|
|
43845
43958
|
init_getNestedValue();
|
|
43959
|
+
init_relationLabel();
|
|
43846
43960
|
init_useEventBus();
|
|
43847
43961
|
init_UploadDropZone();
|
|
43848
43962
|
formatFieldLabel = humanizeFieldName;
|
|
@@ -44501,6 +44615,8 @@ function determineInputType(field) {
|
|
|
44501
44615
|
return "url";
|
|
44502
44616
|
case "file":
|
|
44503
44617
|
return "file";
|
|
44618
|
+
case "image":
|
|
44619
|
+
return "image";
|
|
44504
44620
|
case "money":
|
|
44505
44621
|
return "currency";
|
|
44506
44622
|
case "number":
|
|
@@ -45100,6 +45216,49 @@ var init_Form = __esm({
|
|
|
45100
45216
|
}
|
|
45101
45217
|
}
|
|
45102
45218
|
);
|
|
45219
|
+
case "image": {
|
|
45220
|
+
const imageUrl = typeof currentValue2 === "string" ? currentValue2 : "";
|
|
45221
|
+
return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
45222
|
+
imageUrl ? /* @__PURE__ */ jsx(
|
|
45223
|
+
"img",
|
|
45224
|
+
{
|
|
45225
|
+
src: imageUrl,
|
|
45226
|
+
alt: "",
|
|
45227
|
+
"aria-hidden": "true",
|
|
45228
|
+
className: "h-24 w-full max-w-xs rounded-md border border-border object-cover",
|
|
45229
|
+
"data-testid": `image-preview-${fieldName2}`
|
|
45230
|
+
}
|
|
45231
|
+
) : null,
|
|
45232
|
+
/* @__PURE__ */ jsx(
|
|
45233
|
+
Input,
|
|
45234
|
+
{
|
|
45235
|
+
...commonProps,
|
|
45236
|
+
type: "url",
|
|
45237
|
+
value: imageUrl,
|
|
45238
|
+
onChange: (e) => handleChange(fieldName2, e.target.value)
|
|
45239
|
+
}
|
|
45240
|
+
),
|
|
45241
|
+
/* @__PURE__ */ jsx(
|
|
45242
|
+
UploadDropZone,
|
|
45243
|
+
{
|
|
45244
|
+
accept: "image/*",
|
|
45245
|
+
maxFiles: 1,
|
|
45246
|
+
maxSize: 2 * 1024 * 1024,
|
|
45247
|
+
disabled: isLoading,
|
|
45248
|
+
onFiles: (files) => {
|
|
45249
|
+
const f3 = files[0];
|
|
45250
|
+
if (!f3) return;
|
|
45251
|
+
const reader = new FileReader();
|
|
45252
|
+
reader.onload = () => handleChange(
|
|
45253
|
+
fieldName2,
|
|
45254
|
+
typeof reader.result === "string" ? reader.result : ""
|
|
45255
|
+
);
|
|
45256
|
+
reader.readAsDataURL(f3);
|
|
45257
|
+
}
|
|
45258
|
+
}
|
|
45259
|
+
)
|
|
45260
|
+
] });
|
|
45261
|
+
}
|
|
45103
45262
|
case "date":
|
|
45104
45263
|
return /* @__PURE__ */ jsx(
|
|
45105
45264
|
Input,
|
|
@@ -53866,6 +54025,8 @@ var en_default = {
|
|
|
53866
54025
|
"richTextEditor.removeLink": "Remove link",
|
|
53867
54026
|
"richTextEditor.divider": "Divider",
|
|
53868
54027
|
"richTextEditor.linkPrompt": "Link address",
|
|
54028
|
+
"richTextEditor.image": "Insert image",
|
|
54029
|
+
"richTextEditor.imagePrompt": "Image URL",
|
|
53869
54030
|
"richTextEditor.placeholder": "Start writing\u2026"
|
|
53870
54031
|
};
|
|
53871
54032
|
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -2212,6 +2212,8 @@ var en_default = {
|
|
|
2212
2212
|
"richTextEditor.removeLink": "Remove link",
|
|
2213
2213
|
"richTextEditor.divider": "Divider",
|
|
2214
2214
|
"richTextEditor.linkPrompt": "Link address",
|
|
2215
|
+
"richTextEditor.image": "Insert image",
|
|
2216
|
+
"richTextEditor.imagePrompt": "Image URL",
|
|
2215
2217
|
"richTextEditor.placeholder": "Start writing\u2026"
|
|
2216
2218
|
};
|
|
2217
2219
|
|
package/dist/hooks/index.js
CHANGED
|
@@ -2207,6 +2207,8 @@ var en_default = {
|
|
|
2207
2207
|
"richTextEditor.removeLink": "Remove link",
|
|
2208
2208
|
"richTextEditor.divider": "Divider",
|
|
2209
2209
|
"richTextEditor.linkPrompt": "Link address",
|
|
2210
|
+
"richTextEditor.image": "Insert image",
|
|
2211
|
+
"richTextEditor.imagePrompt": "Image URL",
|
|
2210
2212
|
"richTextEditor.placeholder": "Start writing\u2026"
|
|
2211
2213
|
};
|
|
2212
2214
|
|
package/dist/locales/index.cjs
CHANGED
|
@@ -551,6 +551,8 @@ var en_default = {
|
|
|
551
551
|
"richTextEditor.removeLink": "Remove link",
|
|
552
552
|
"richTextEditor.divider": "Divider",
|
|
553
553
|
"richTextEditor.linkPrompt": "Link address",
|
|
554
|
+
"richTextEditor.image": "Insert image",
|
|
555
|
+
"richTextEditor.imagePrompt": "Image URL",
|
|
554
556
|
"richTextEditor.placeholder": "Start writing\u2026"
|
|
555
557
|
};
|
|
556
558
|
|
|
@@ -1105,6 +1107,8 @@ var ar_default = {
|
|
|
1105
1107
|
"richTextEditor.removeLink": "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0627\u0628\u0637",
|
|
1106
1108
|
"richTextEditor.divider": "\u0641\u0627\u0635\u0644",
|
|
1107
1109
|
"richTextEditor.linkPrompt": "\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0631\u0627\u0628\u0637",
|
|
1110
|
+
"richTextEditor.image": "\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629",
|
|
1111
|
+
"richTextEditor.imagePrompt": "\u0631\u0627\u0628\u0637 \u0627\u0644\u0635\u0648\u0631\u0629",
|
|
1108
1112
|
"richTextEditor.placeholder": "\u0627\u0628\u062F\u0623 \u0627\u0644\u0643\u062A\u0627\u0628\u0629\u2026"
|
|
1109
1113
|
};
|
|
1110
1114
|
|
|
@@ -1659,6 +1663,8 @@ var sl_default = {
|
|
|
1659
1663
|
"richTextEditor.removeLink": "Odstrani povezavo",
|
|
1660
1664
|
"richTextEditor.divider": "Lo\u010Dilo",
|
|
1661
1665
|
"richTextEditor.linkPrompt": "Naslov povezave",
|
|
1666
|
+
"richTextEditor.image": "Vstavi sliko",
|
|
1667
|
+
"richTextEditor.imagePrompt": "URL slike",
|
|
1662
1668
|
"richTextEditor.placeholder": "Za\u010Dnite pisati \u2026"
|
|
1663
1669
|
};
|
|
1664
1670
|
|
package/dist/locales/index.js
CHANGED
|
@@ -549,6 +549,8 @@ var en_default = {
|
|
|
549
549
|
"richTextEditor.removeLink": "Remove link",
|
|
550
550
|
"richTextEditor.divider": "Divider",
|
|
551
551
|
"richTextEditor.linkPrompt": "Link address",
|
|
552
|
+
"richTextEditor.image": "Insert image",
|
|
553
|
+
"richTextEditor.imagePrompt": "Image URL",
|
|
552
554
|
"richTextEditor.placeholder": "Start writing\u2026"
|
|
553
555
|
};
|
|
554
556
|
|
|
@@ -1103,6 +1105,8 @@ var ar_default = {
|
|
|
1103
1105
|
"richTextEditor.removeLink": "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0627\u0628\u0637",
|
|
1104
1106
|
"richTextEditor.divider": "\u0641\u0627\u0635\u0644",
|
|
1105
1107
|
"richTextEditor.linkPrompt": "\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0631\u0627\u0628\u0637",
|
|
1108
|
+
"richTextEditor.image": "\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629",
|
|
1109
|
+
"richTextEditor.imagePrompt": "\u0631\u0627\u0628\u0637 \u0627\u0644\u0635\u0648\u0631\u0629",
|
|
1106
1110
|
"richTextEditor.placeholder": "\u0627\u0628\u062F\u0623 \u0627\u0644\u0643\u062A\u0627\u0628\u0629\u2026"
|
|
1107
1111
|
};
|
|
1108
1112
|
|
|
@@ -1657,6 +1661,8 @@ var sl_default = {
|
|
|
1657
1661
|
"richTextEditor.removeLink": "Odstrani povezavo",
|
|
1658
1662
|
"richTextEditor.divider": "Lo\u010Dilo",
|
|
1659
1663
|
"richTextEditor.linkPrompt": "Naslov povezave",
|
|
1664
|
+
"richTextEditor.image": "Vstavi sliko",
|
|
1665
|
+
"richTextEditor.imagePrompt": "URL slike",
|
|
1660
1666
|
"richTextEditor.placeholder": "Za\u010Dnite pisati \u2026"
|
|
1661
1667
|
};
|
|
1662
1668
|
|