@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/runtime/index.js
CHANGED
|
@@ -32569,6 +32569,33 @@ var init_Lightbox = __esm({
|
|
|
32569
32569
|
Lightbox.displayName = "Lightbox";
|
|
32570
32570
|
}
|
|
32571
32571
|
});
|
|
32572
|
+
|
|
32573
|
+
// lib/relationLabel.ts
|
|
32574
|
+
function relationLabel(value) {
|
|
32575
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || value instanceof Date)
|
|
32576
|
+
return null;
|
|
32577
|
+
for (const key of ["name", "title", "label"]) {
|
|
32578
|
+
const candidate = value[key];
|
|
32579
|
+
if (typeof candidate === "string" && candidate !== "") return candidate;
|
|
32580
|
+
}
|
|
32581
|
+
const id = value.id;
|
|
32582
|
+
return id !== void 0 && id !== null ? String(id) : null;
|
|
32583
|
+
}
|
|
32584
|
+
function relationDisplayLabels(value, options) {
|
|
32585
|
+
if (value === void 0 || value === null || value === "") return [];
|
|
32586
|
+
if (Array.isArray(value)) {
|
|
32587
|
+
return value.flatMap((item) => relationDisplayLabels(item, options));
|
|
32588
|
+
}
|
|
32589
|
+
const hydrated = relationLabel(value);
|
|
32590
|
+
if (hydrated !== null) return [hydrated];
|
|
32591
|
+
const raw = String(value);
|
|
32592
|
+
const match = options?.find((opt) => opt.value === raw);
|
|
32593
|
+
return [match ? match.label : raw];
|
|
32594
|
+
}
|
|
32595
|
+
var init_relationLabel = __esm({
|
|
32596
|
+
"lib/relationLabel.ts"() {
|
|
32597
|
+
}
|
|
32598
|
+
});
|
|
32572
32599
|
function renderIconInput3(icon, props) {
|
|
32573
32600
|
return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
|
|
32574
32601
|
}
|
|
@@ -32886,6 +32913,7 @@ var init_TableView = __esm({
|
|
|
32886
32913
|
"use client";
|
|
32887
32914
|
init_cn();
|
|
32888
32915
|
init_format();
|
|
32916
|
+
init_relationLabel();
|
|
32889
32917
|
init_getNestedValue();
|
|
32890
32918
|
init_useEventBus();
|
|
32891
32919
|
init_Box();
|
|
@@ -32899,7 +32927,13 @@ var init_TableView = __esm({
|
|
|
32899
32927
|
init_Menu();
|
|
32900
32928
|
init_useDataDnd();
|
|
32901
32929
|
tableViewLog = createLogger("almadar:ui:table-view");
|
|
32902
|
-
formatCell = (value, format) =>
|
|
32930
|
+
formatCell = (value, format) => {
|
|
32931
|
+
if (value !== null && value !== void 0 && typeof value === "object" && !(value instanceof Date)) {
|
|
32932
|
+
const labels = relationDisplayLabels(value);
|
|
32933
|
+
if (labels.length > 0) return labels.join(", ");
|
|
32934
|
+
}
|
|
32935
|
+
return formatValue(value, format);
|
|
32936
|
+
};
|
|
32903
32937
|
MAX_MEASURED_COL_CH = 32;
|
|
32904
32938
|
BADGE_CHROME_CH = 4;
|
|
32905
32939
|
alignClass = {
|
|
@@ -36376,6 +36410,13 @@ var init_RichTextEditor = __esm({
|
|
|
36376
36410
|
document.execCommand("createLink", false, safe);
|
|
36377
36411
|
afterEdit();
|
|
36378
36412
|
}, [afterEdit, t, toolbar.link]);
|
|
36413
|
+
const execImage = useCallback(() => {
|
|
36414
|
+
const url = window.prompt(t("richTextEditor.imagePrompt"));
|
|
36415
|
+
if (!url) return;
|
|
36416
|
+
const safe = safeUrl(url, ["http://", "https://", "data:image/"]) ?? `https://${url}`;
|
|
36417
|
+
document.execCommand("insertImage", false, safe);
|
|
36418
|
+
afterEdit();
|
|
36419
|
+
}, [afterEdit, t]);
|
|
36379
36420
|
const execRule = useCallback(() => {
|
|
36380
36421
|
document.execCommand("insertHorizontalRule", false);
|
|
36381
36422
|
afterEdit();
|
|
@@ -36413,6 +36454,7 @@ var init_RichTextEditor = __esm({
|
|
|
36413
36454
|
/* @__PURE__ */ jsx(ToolbarButton, { icon: Quote, label: t("richTextEditor.quote"), active: toolbar.block === "blockquote", onExec: () => execBlock("blockquote") }),
|
|
36414
36455
|
/* @__PURE__ */ jsx(ToolbarButton, { icon: Code, label: t("richTextEditor.code"), active: toolbar.block === "pre", onExec: () => execBlock("pre") }),
|
|
36415
36456
|
/* @__PURE__ */ jsx(ToolbarButton, { icon: Link$1, label: toolbar.link ? t("richTextEditor.removeLink") : t("richTextEditor.link"), active: toolbar.link, onExec: execLink }),
|
|
36457
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: Image$1, label: t("richTextEditor.image"), onExec: execImage }),
|
|
36416
36458
|
/* @__PURE__ */ jsx(ToolbarButton, { icon: Minus, label: t("richTextEditor.divider"), onExec: execRule })
|
|
36417
36459
|
]
|
|
36418
36460
|
}
|
|
@@ -36453,6 +36495,8 @@ function DocumentPanel({
|
|
|
36453
36495
|
id,
|
|
36454
36496
|
title,
|
|
36455
36497
|
subtitle,
|
|
36498
|
+
coverImage,
|
|
36499
|
+
icon,
|
|
36456
36500
|
value,
|
|
36457
36501
|
actions,
|
|
36458
36502
|
maxInlineActions,
|
|
@@ -36528,62 +36572,74 @@ function DocumentPanel({
|
|
|
36528
36572
|
const emitWithId = (event) => () => {
|
|
36529
36573
|
if (event) eventBus.emit(`UI:${event}`, { id: recordId });
|
|
36530
36574
|
};
|
|
36531
|
-
return /* @__PURE__ */
|
|
36532
|
-
/* @__PURE__ */
|
|
36533
|
-
|
|
36534
|
-
titleNode,
|
|
36535
|
-
subtitle ? /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: subtitle }) : null
|
|
36536
|
-
] }),
|
|
36537
|
-
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0 pt-1 items-center", children: editing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36538
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "hidden sm:block", children: autosaveHint ?? (t("documentPanel.autosaveHint") || "") }),
|
|
36539
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: emitWithId(doneEvent), "data-testid": "document-done", children: doneLabel ?? (t("documentPanel.done") || "Done") })
|
|
36540
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36541
|
-
editEvent && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: emitWithId(editEvent), "data-testid": "document-edit", children: [
|
|
36542
|
-
/* @__PURE__ */ jsx(Icon, { name: "edit", size: "xs", className: "mr-1" }),
|
|
36543
|
-
editLabel ?? (t("documentPanel.edit") || "Edit")
|
|
36544
|
-
] }),
|
|
36545
|
-
inlineActions.map((action, idx) => /* @__PURE__ */ jsxs(
|
|
36546
|
-
Button,
|
|
36547
|
-
{
|
|
36548
|
-
variant: "primary",
|
|
36549
|
-
size: "sm",
|
|
36550
|
-
onClick: () => fireAction(action),
|
|
36551
|
-
"data-testid": `action-${action.event}`,
|
|
36552
|
-
children: [
|
|
36553
|
-
action.icon && renderIconInput4(action.icon, { size: "xs", className: "mr-1" }),
|
|
36554
|
-
action.label
|
|
36555
|
-
]
|
|
36556
|
-
},
|
|
36557
|
-
idx
|
|
36558
|
-
)),
|
|
36559
|
-
menuActions.length > 0 && /* @__PURE__ */ jsx(
|
|
36560
|
-
Menu,
|
|
36561
|
-
{
|
|
36562
|
-
position: "bottom-end",
|
|
36563
|
-
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" }) }),
|
|
36564
|
-
items: menuActions.map((action) => ({
|
|
36565
|
-
label: action.label,
|
|
36566
|
-
icon: action.icon,
|
|
36567
|
-
variant: action.variant === "danger" ? "danger" : "default",
|
|
36568
|
-
onClick: () => fireAction(action)
|
|
36569
|
-
}))
|
|
36570
|
-
}
|
|
36571
|
-
)
|
|
36572
|
-
] }) })
|
|
36573
|
-
] }),
|
|
36574
|
-
editing ? /* @__PURE__ */ jsx(RichTextEditor, { value, changeEvent: contentChangeEvent, placeholder }) : /* @__PURE__ */ jsx(
|
|
36575
|
-
Box,
|
|
36575
|
+
return /* @__PURE__ */ jsxs(Card, { variant: "elevated", className: cn("w-full overflow-hidden", className), children: [
|
|
36576
|
+
coverImage ? /* @__PURE__ */ jsx(Box, { className: "h-44 w-full sm:h-52", "data-testid": "document-cover", children: /* @__PURE__ */ jsx(
|
|
36577
|
+
"img",
|
|
36576
36578
|
{
|
|
36577
|
-
|
|
36578
|
-
|
|
36579
|
-
|
|
36580
|
-
|
|
36581
|
-
|
|
36582
|
-
|
|
36583
|
-
|
|
36584
|
-
|
|
36585
|
-
|
|
36586
|
-
|
|
36579
|
+
src: coverImage,
|
|
36580
|
+
alt: "",
|
|
36581
|
+
"aria-hidden": "true",
|
|
36582
|
+
className: "h-full w-full object-cover"
|
|
36583
|
+
}
|
|
36584
|
+
) }) : null,
|
|
36585
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "p-6 sm:p-8", children: [
|
|
36586
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
|
|
36587
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
|
|
36588
|
+
icon ? /* @__PURE__ */ jsx(Box, { className: "text-muted-foreground", "data-testid": "document-icon", children: renderIconInput4(icon, { size: "lg" }) }) : null,
|
|
36589
|
+
titleNode,
|
|
36590
|
+
subtitle ? /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: subtitle }) : null
|
|
36591
|
+
] }),
|
|
36592
|
+
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0 pt-1 items-center", children: editing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36593
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "hidden sm:block", children: autosaveHint ?? (t("documentPanel.autosaveHint") || "") }),
|
|
36594
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: emitWithId(doneEvent), "data-testid": "document-done", children: doneLabel ?? (t("documentPanel.done") || "Done") })
|
|
36595
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36596
|
+
editEvent && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: emitWithId(editEvent), "data-testid": "document-edit", children: [
|
|
36597
|
+
/* @__PURE__ */ jsx(Icon, { name: "edit", size: "xs", className: "mr-1" }),
|
|
36598
|
+
editLabel ?? (t("documentPanel.edit") || "Edit")
|
|
36599
|
+
] }),
|
|
36600
|
+
inlineActions.map((action, idx) => /* @__PURE__ */ jsxs(
|
|
36601
|
+
Button,
|
|
36602
|
+
{
|
|
36603
|
+
variant: "primary",
|
|
36604
|
+
size: "sm",
|
|
36605
|
+
onClick: () => fireAction(action),
|
|
36606
|
+
"data-testid": `action-${action.event}`,
|
|
36607
|
+
children: [
|
|
36608
|
+
action.icon && renderIconInput4(action.icon, { size: "xs", className: "mr-1" }),
|
|
36609
|
+
action.label
|
|
36610
|
+
]
|
|
36611
|
+
},
|
|
36612
|
+
idx
|
|
36613
|
+
)),
|
|
36614
|
+
menuActions.length > 0 && /* @__PURE__ */ jsx(
|
|
36615
|
+
Menu,
|
|
36616
|
+
{
|
|
36617
|
+
position: "bottom-end",
|
|
36618
|
+
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" }) }),
|
|
36619
|
+
items: menuActions.map((action) => ({
|
|
36620
|
+
label: action.label,
|
|
36621
|
+
icon: action.icon,
|
|
36622
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
36623
|
+
onClick: () => fireAction(action)
|
|
36624
|
+
}))
|
|
36625
|
+
}
|
|
36626
|
+
)
|
|
36627
|
+
] }) })
|
|
36628
|
+
] }),
|
|
36629
|
+
editing ? /* @__PURE__ */ jsx(RichTextEditor, { value, changeEvent: contentChangeEvent, placeholder }) : /* @__PURE__ */ jsx(
|
|
36630
|
+
Box,
|
|
36631
|
+
{
|
|
36632
|
+
onClick: emitWithId(editEvent),
|
|
36633
|
+
className: cn(
|
|
36634
|
+
"rounded-md px-1 -mx-1 min-h-[16rem]",
|
|
36635
|
+
editEvent && "cursor-text transition-colors hover:bg-muted/30"
|
|
36636
|
+
),
|
|
36637
|
+
"data-testid": "document-body",
|
|
36638
|
+
children: value && value !== "" ? /* @__PURE__ */ jsx(RichTextEditor, { value, readOnly: true }) : /* @__PURE__ */ jsx(Typography, { variant: "body", color: "muted", children: placeholder ?? (t("documentPanel.placeholder") || "") })
|
|
36639
|
+
}
|
|
36640
|
+
)
|
|
36641
|
+
] })
|
|
36642
|
+
] });
|
|
36587
36643
|
}
|
|
36588
36644
|
var init_DocumentPanel = __esm({
|
|
36589
36645
|
"components/core/molecules/DocumentPanel.tsx"() {
|
|
@@ -36607,17 +36663,16 @@ function renderIconInput5(icon, props) {
|
|
|
36607
36663
|
function fieldName(field) {
|
|
36608
36664
|
return field.name ?? field.key ?? "";
|
|
36609
36665
|
}
|
|
36610
|
-
function
|
|
36611
|
-
if (value
|
|
36612
|
-
|
|
36613
|
-
|
|
36614
|
-
if (typeof candidate === "string" && candidate !== "") return candidate;
|
|
36666
|
+
function relationId(value) {
|
|
36667
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date)) {
|
|
36668
|
+
const id = value.id;
|
|
36669
|
+
if (id !== void 0 && id !== null) return String(id);
|
|
36615
36670
|
}
|
|
36616
|
-
|
|
36617
|
-
return id !== void 0 && id !== null ? String(id) : null;
|
|
36671
|
+
return String(value);
|
|
36618
36672
|
}
|
|
36619
36673
|
function fieldKind(field, value) {
|
|
36620
36674
|
if (field.kind) return field.kind;
|
|
36675
|
+
if (field.type === "image") return "image";
|
|
36621
36676
|
if (field.options && field.options.length > 0) return "select";
|
|
36622
36677
|
if (typeof value === "boolean" || field.format === "boolean") return "boolean";
|
|
36623
36678
|
if (Array.isArray(value) || relationLabel(value ?? null) !== null) return "readonly";
|
|
@@ -36627,6 +36682,7 @@ function DocumentDetails({
|
|
|
36627
36682
|
entity,
|
|
36628
36683
|
fields,
|
|
36629
36684
|
metaCommitEvent,
|
|
36685
|
+
relationEvent,
|
|
36630
36686
|
title,
|
|
36631
36687
|
className
|
|
36632
36688
|
}) {
|
|
@@ -36641,11 +36697,51 @@ function DocumentDetails({
|
|
|
36641
36697
|
if (!metaCommitEvent || next === current) return;
|
|
36642
36698
|
eventBus.emit(`UI:${metaCommitEvent}`, { id: recordId, patch: { id: recordId, [name]: next } });
|
|
36643
36699
|
};
|
|
36700
|
+
const relationChip = (item, name, key) => {
|
|
36701
|
+
const label = relationLabel(item) ?? humanizeEnumValue(String(item));
|
|
36702
|
+
if (!relationEvent) {
|
|
36703
|
+
return /* @__PURE__ */ jsx(Badge, { variant: "default", children: label }, key);
|
|
36704
|
+
}
|
|
36705
|
+
const emitClick = () => eventBus.emit(`UI:${relationEvent}`, { field: name, id: relationId(item), name: label });
|
|
36706
|
+
return /* @__PURE__ */ jsx(
|
|
36707
|
+
Badge,
|
|
36708
|
+
{
|
|
36709
|
+
variant: "default",
|
|
36710
|
+
role: "button",
|
|
36711
|
+
tabIndex: 0,
|
|
36712
|
+
className: "cursor-pointer transition-colors hover:bg-accent",
|
|
36713
|
+
onClick: emitClick,
|
|
36714
|
+
onKeyDown: (e) => {
|
|
36715
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
36716
|
+
e.preventDefault();
|
|
36717
|
+
emitClick();
|
|
36718
|
+
}
|
|
36719
|
+
},
|
|
36720
|
+
"data-testid": `relation-chip-${name}`,
|
|
36721
|
+
children: label
|
|
36722
|
+
},
|
|
36723
|
+
key
|
|
36724
|
+
);
|
|
36725
|
+
};
|
|
36644
36726
|
const renderValue = (field) => {
|
|
36645
36727
|
const name = fieldName(field);
|
|
36646
36728
|
const raw = getNestedValue(entity ?? {}, name);
|
|
36647
36729
|
const kind = fieldKind(field, raw);
|
|
36648
36730
|
const label = field.label ?? field.header ?? humanizeFieldName(name);
|
|
36731
|
+
if (kind === "image") {
|
|
36732
|
+
const url = typeof raw === "string" ? raw : "";
|
|
36733
|
+
if (!url) return /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: "\u2014" });
|
|
36734
|
+
return /* @__PURE__ */ jsx(
|
|
36735
|
+
"img",
|
|
36736
|
+
{
|
|
36737
|
+
src: url,
|
|
36738
|
+
alt: label,
|
|
36739
|
+
loading: "lazy",
|
|
36740
|
+
className: "max-h-32 w-full rounded-md border border-border object-cover",
|
|
36741
|
+
"data-testid": `document-property-image-${name}`
|
|
36742
|
+
}
|
|
36743
|
+
);
|
|
36744
|
+
}
|
|
36649
36745
|
if (kind === "boolean") {
|
|
36650
36746
|
return /* @__PURE__ */ jsx(
|
|
36651
36747
|
Switch,
|
|
@@ -36675,9 +36771,12 @@ function DocumentDetails({
|
|
|
36675
36771
|
if (raw.length === 0) {
|
|
36676
36772
|
return /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: "\u2014" });
|
|
36677
36773
|
}
|
|
36678
|
-
return /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: raw.map((item, i) =>
|
|
36774
|
+
return /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: raw.map((item, i) => relationChip(item, name, i)) });
|
|
36679
36775
|
}
|
|
36680
|
-
|
|
36776
|
+
if (raw !== void 0 && raw !== null && raw !== "" && relationLabel(raw) !== null) {
|
|
36777
|
+
return relationChip(raw, name);
|
|
36778
|
+
}
|
|
36779
|
+
const shown2 = raw === void 0 || raw === null || raw === "" ? "\u2014" : formatValue(raw, field.format);
|
|
36681
36780
|
return /* @__PURE__ */ jsx(Typography, { variant: "small", className: "break-words", children: shown2 });
|
|
36682
36781
|
}
|
|
36683
36782
|
if (fieldDraft?.name === name) {
|
|
@@ -36746,6 +36845,7 @@ var init_DocumentDetails = __esm({
|
|
|
36746
36845
|
init_cn();
|
|
36747
36846
|
init_format();
|
|
36748
36847
|
init_getNestedValue();
|
|
36848
|
+
init_relationLabel();
|
|
36749
36849
|
init_useEventBus();
|
|
36750
36850
|
init_Box();
|
|
36751
36851
|
init_Stack();
|
|
@@ -41740,7 +41840,18 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
|
|
|
41740
41840
|
if (value === void 0 || value === null) return "\u2014";
|
|
41741
41841
|
const str = String(value);
|
|
41742
41842
|
switch (fieldType) {
|
|
41743
|
-
case "image":
|
|
41843
|
+
case "image": {
|
|
41844
|
+
if (!str) return "\u2014";
|
|
41845
|
+
return /* @__PURE__ */ jsx(Box, { className: "mt-1 max-w-full", children: /* @__PURE__ */ jsx(
|
|
41846
|
+
"img",
|
|
41847
|
+
{
|
|
41848
|
+
src: str,
|
|
41849
|
+
alt: formatFieldLabel(fieldName2),
|
|
41850
|
+
className: "max-w-full max-h-64 rounded-md object-contain",
|
|
41851
|
+
loading: "lazy"
|
|
41852
|
+
}
|
|
41853
|
+
) });
|
|
41854
|
+
}
|
|
41744
41855
|
case "url": {
|
|
41745
41856
|
if (str.match(/\.(png|jpe?g|gif|svg|webp|avif)(\?|$)/i) || str.startsWith("data:image/")) {
|
|
41746
41857
|
return /* @__PURE__ */ jsx(Box, { className: "mt-1 max-w-full", children: /* @__PURE__ */ jsx(
|
|
@@ -41753,7 +41864,7 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
|
|
|
41753
41864
|
}
|
|
41754
41865
|
) });
|
|
41755
41866
|
}
|
|
41756
|
-
if (
|
|
41867
|
+
if (/^https?:\/\//i.test(str)) {
|
|
41757
41868
|
return /* @__PURE__ */ jsx(
|
|
41758
41869
|
"a",
|
|
41759
41870
|
{
|
|
@@ -41839,8 +41950,10 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
|
|
|
41839
41950
|
return str;
|
|
41840
41951
|
}
|
|
41841
41952
|
case "relation": {
|
|
41842
|
-
const
|
|
41843
|
-
|
|
41953
|
+
const labels = relationDisplayLabels(value, meta?.options);
|
|
41954
|
+
if (labels.length === 0) return "\u2014";
|
|
41955
|
+
if (labels.length === 1) return labels[0];
|
|
41956
|
+
return /* @__PURE__ */ jsx(HStack, { gap: "xs", wrap: true, children: labels.map((label, i) => /* @__PURE__ */ jsx(Badge, { variant: "default", children: label }, i)) });
|
|
41844
41957
|
}
|
|
41845
41958
|
case "file": {
|
|
41846
41959
|
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -41942,6 +42055,7 @@ var init_DetailPanel = __esm({
|
|
|
41942
42055
|
init_cn();
|
|
41943
42056
|
init_format();
|
|
41944
42057
|
init_getNestedValue();
|
|
42058
|
+
init_relationLabel();
|
|
41945
42059
|
init_useEventBus();
|
|
41946
42060
|
init_UploadDropZone();
|
|
41947
42061
|
formatFieldLabel = humanizeFieldName;
|
|
@@ -42600,6 +42714,8 @@ function determineInputType(field) {
|
|
|
42600
42714
|
return "url";
|
|
42601
42715
|
case "file":
|
|
42602
42716
|
return "file";
|
|
42717
|
+
case "image":
|
|
42718
|
+
return "image";
|
|
42603
42719
|
case "money":
|
|
42604
42720
|
return "currency";
|
|
42605
42721
|
case "number":
|
|
@@ -43199,6 +43315,49 @@ var init_Form = __esm({
|
|
|
43199
43315
|
}
|
|
43200
43316
|
}
|
|
43201
43317
|
);
|
|
43318
|
+
case "image": {
|
|
43319
|
+
const imageUrl = typeof currentValue === "string" ? currentValue : "";
|
|
43320
|
+
return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
43321
|
+
imageUrl ? /* @__PURE__ */ jsx(
|
|
43322
|
+
"img",
|
|
43323
|
+
{
|
|
43324
|
+
src: imageUrl,
|
|
43325
|
+
alt: "",
|
|
43326
|
+
"aria-hidden": "true",
|
|
43327
|
+
className: "h-24 w-full max-w-xs rounded-md border border-border object-cover",
|
|
43328
|
+
"data-testid": `image-preview-${fieldName2}`
|
|
43329
|
+
}
|
|
43330
|
+
) : null,
|
|
43331
|
+
/* @__PURE__ */ jsx(
|
|
43332
|
+
Input,
|
|
43333
|
+
{
|
|
43334
|
+
...commonProps,
|
|
43335
|
+
type: "url",
|
|
43336
|
+
value: imageUrl,
|
|
43337
|
+
onChange: (e) => handleChange(fieldName2, e.target.value)
|
|
43338
|
+
}
|
|
43339
|
+
),
|
|
43340
|
+
/* @__PURE__ */ jsx(
|
|
43341
|
+
UploadDropZone,
|
|
43342
|
+
{
|
|
43343
|
+
accept: "image/*",
|
|
43344
|
+
maxFiles: 1,
|
|
43345
|
+
maxSize: 2 * 1024 * 1024,
|
|
43346
|
+
disabled: isLoading,
|
|
43347
|
+
onFiles: (files) => {
|
|
43348
|
+
const f3 = files[0];
|
|
43349
|
+
if (!f3) return;
|
|
43350
|
+
const reader = new FileReader();
|
|
43351
|
+
reader.onload = () => handleChange(
|
|
43352
|
+
fieldName2,
|
|
43353
|
+
typeof reader.result === "string" ? reader.result : ""
|
|
43354
|
+
);
|
|
43355
|
+
reader.readAsDataURL(f3);
|
|
43356
|
+
}
|
|
43357
|
+
}
|
|
43358
|
+
)
|
|
43359
|
+
] });
|
|
43360
|
+
}
|
|
43202
43361
|
case "date":
|
|
43203
43362
|
return /* @__PURE__ */ jsx(
|
|
43204
43363
|
Input,
|
package/locales/ar.json
CHANGED
|
@@ -525,12 +525,12 @@
|
|
|
525
525
|
"td.victory": "انتصار!",
|
|
526
526
|
"td.wave": "موجة",
|
|
527
527
|
"td.waveInProgress": "الموجة قيد التقدم…",
|
|
528
|
-
"documentDetails.title": "
|
|
529
|
-
"documentPanel.untitled": "
|
|
530
|
-
"documentPanel.edit": "
|
|
531
|
-
"documentPanel.done": "
|
|
532
|
-
"documentPanel.autosaveHint": "
|
|
533
|
-
"documentPanel.placeholder": "
|
|
528
|
+
"documentDetails.title": "التفاصيل",
|
|
529
|
+
"documentPanel.untitled": "بدون عنوان",
|
|
530
|
+
"documentPanel.edit": "تحرير",
|
|
531
|
+
"documentPanel.done": "تم",
|
|
532
|
+
"documentPanel.autosaveHint": "يُحفظ أثناء الكتابة",
|
|
533
|
+
"documentPanel.placeholder": "ابدأ الكتابة…",
|
|
534
534
|
"richTextEditor.editorToolbar": "شريط التنسيق",
|
|
535
535
|
"richTextEditor.editorSurface": "محرر النصوص",
|
|
536
536
|
"richTextEditor.bold": "غامق",
|
|
@@ -548,5 +548,7 @@
|
|
|
548
548
|
"richTextEditor.removeLink": "إزالة الرابط",
|
|
549
549
|
"richTextEditor.divider": "فاصل",
|
|
550
550
|
"richTextEditor.linkPrompt": "عنوان الرابط",
|
|
551
|
+
"richTextEditor.image": "إدراج صورة",
|
|
552
|
+
"richTextEditor.imagePrompt": "رابط الصورة",
|
|
551
553
|
"richTextEditor.placeholder": "ابدأ الكتابة…"
|
|
552
554
|
}
|
package/locales/en.json
CHANGED
|
@@ -530,7 +530,7 @@
|
|
|
530
530
|
"documentPanel.edit": "Edit",
|
|
531
531
|
"documentPanel.done": "Done",
|
|
532
532
|
"documentPanel.autosaveHint": "Saves as you type",
|
|
533
|
-
"documentPanel.placeholder": "Start writing
|
|
533
|
+
"documentPanel.placeholder": "Start writing…",
|
|
534
534
|
"richTextEditor.editorToolbar": "Formatting toolbar",
|
|
535
535
|
"richTextEditor.editorSurface": "Rich text editor",
|
|
536
536
|
"richTextEditor.bold": "Bold",
|
|
@@ -548,5 +548,7 @@
|
|
|
548
548
|
"richTextEditor.removeLink": "Remove link",
|
|
549
549
|
"richTextEditor.divider": "Divider",
|
|
550
550
|
"richTextEditor.linkPrompt": "Link address",
|
|
551
|
+
"richTextEditor.image": "Insert image",
|
|
552
|
+
"richTextEditor.imagePrompt": "Image URL",
|
|
551
553
|
"richTextEditor.placeholder": "Start writing…"
|
|
552
554
|
}
|
package/locales/sl.json
CHANGED
|
@@ -530,7 +530,7 @@
|
|
|
530
530
|
"documentPanel.edit": "Uredi",
|
|
531
531
|
"documentPanel.done": "Konec",
|
|
532
532
|
"documentPanel.autosaveHint": "Shranjuje se med tipkanjem",
|
|
533
|
-
"documentPanel.placeholder": "
|
|
533
|
+
"documentPanel.placeholder": "Začni pisati…",
|
|
534
534
|
"richTextEditor.editorToolbar": "Orodna vrstica za oblikovanje",
|
|
535
535
|
"richTextEditor.editorSurface": "Urejevalnik obogatenega besedila",
|
|
536
536
|
"richTextEditor.bold": "Krepko",
|
|
@@ -548,5 +548,7 @@
|
|
|
548
548
|
"richTextEditor.removeLink": "Odstrani povezavo",
|
|
549
549
|
"richTextEditor.divider": "Ločilo",
|
|
550
550
|
"richTextEditor.linkPrompt": "Naslov povezave",
|
|
551
|
+
"richTextEditor.image": "Vstavi sliko",
|
|
552
|
+
"richTextEditor.imagePrompt": "URL slike",
|
|
551
553
|
"richTextEditor.placeholder": "Začnite pisati …"
|
|
552
554
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.163.0",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
"access": "public"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
|
-
"@almadar/core": "^10.
|
|
121
|
+
"@almadar/core": "^10.73.0",
|
|
122
122
|
"@almadar/evaluator": "^2.42.0",
|
|
123
123
|
"@almadar/logger": "^1.11.0",
|
|
124
|
-
"@almadar/runtime": "^6.
|
|
125
|
-
"@almadar/std": "^16.
|
|
124
|
+
"@almadar/runtime": "^6.63.0",
|
|
125
|
+
"@almadar/std": "^16.192.0",
|
|
126
126
|
"@almadar/syntax": "^1.15.0",
|
|
127
127
|
"@dnd-kit/core": "^6.3.1",
|
|
128
128
|
"@dnd-kit/sortable": "^10.0.0",
|