@oondemand/oon-core-front 0.3.53 → 0.3.54
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/index.js +653 -599
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ function normalizeError(err) {
|
|
|
19
19
|
if (axios.isAxiosError(err)) {
|
|
20
20
|
const status = err.response?.status;
|
|
21
21
|
const data = err.response?.data;
|
|
22
|
+
const responseRequestId = err.response?.headers?.["x-request-id"] ?? err.response?.headers?.["x-correlation-id"];
|
|
22
23
|
const contentType = String(err.response?.headers?.["content-type"] || "");
|
|
23
24
|
const isTextPayload = typeof data === "string";
|
|
24
25
|
const isProbablyHtml = isTextPayload && /<html|<!doctype/i.test(data);
|
|
@@ -28,17 +29,19 @@ function normalizeError(err) {
|
|
|
28
29
|
message: nonJsonMessage(status, err.config?.url, isProbablyHtml),
|
|
29
30
|
status,
|
|
30
31
|
details: isProbablyHtml ? void 0 : data,
|
|
31
|
-
requestId:
|
|
32
|
+
requestId: responseRequestId
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
const
|
|
35
|
+
const rawError = data?.error;
|
|
36
|
+
const envelope = rawError && typeof rawError === "object" ? rawError : void 0;
|
|
35
37
|
const legacyDetails = envelope && envelope.details === void 0 && envelope.field ? envelope : void 0;
|
|
38
|
+
const rawTechnicalDetails = typeof rawError === "string" ? { technicalMessage: rawError } : void 0;
|
|
36
39
|
return {
|
|
37
|
-
code: envelope?.code || codeFromStatus(status),
|
|
40
|
+
code: envelope?.code || data?.code || codeFromStatus(status),
|
|
38
41
|
message: envelope?.message || data?.message || err.message || "Erro inesperado.",
|
|
39
42
|
status,
|
|
40
|
-
details: envelope?.details ?? legacyDetails,
|
|
41
|
-
requestId: envelope?.requestId ||
|
|
43
|
+
details: envelope?.details ?? legacyDetails ?? data?.details ?? rawTechnicalDetails,
|
|
44
|
+
requestId: envelope?.requestId || data?.requestId || responseRequestId
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
47
|
if (err instanceof Error) {
|
|
@@ -646,7 +649,7 @@ function OonProviders({ config, http, storage, children }) {
|
|
|
646
649
|
|
|
647
650
|
// src/components/CoreCollection.tsx
|
|
648
651
|
import { useState as useState10 } from "react";
|
|
649
|
-
import { Box as
|
|
652
|
+
import { Box as Box11, Heading as Heading4, Stack as Stack4, Text as Text12 } from "@chakra-ui/react";
|
|
650
653
|
import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
651
654
|
|
|
652
655
|
// src/components/internal/fieldUtils.ts
|
|
@@ -981,7 +984,7 @@ function DataGrid({
|
|
|
981
984
|
|
|
982
985
|
// src/components/internal/DynamicForm.tsx
|
|
983
986
|
import { useEffect as useEffect4, useMemo as useMemo4, useState as useState5 } from "react";
|
|
984
|
-
import { Box as
|
|
987
|
+
import { Box as Box5, Button as Button4, Flex as Flex4, Heading as Heading2, Input as Input3, NativeSelect as NativeSelect2, SimpleGrid, Stack as Stack2, Text as Text6, Textarea } from "@chakra-ui/react";
|
|
985
988
|
|
|
986
989
|
// src/domain/domainExpressions.ts
|
|
987
990
|
var DomainExpressionError = class extends Error {
|
|
@@ -1646,6 +1649,127 @@ function ReferenceSelect({
|
|
|
1646
1649
|
] });
|
|
1647
1650
|
}
|
|
1648
1651
|
|
|
1652
|
+
// src/components/internal/CoreErrorAlert.tsx
|
|
1653
|
+
import { Box as Box4, Text as Text5 } from "@chakra-ui/react";
|
|
1654
|
+
|
|
1655
|
+
// src/components/internal/actionError.ts
|
|
1656
|
+
function asRecord(value2) {
|
|
1657
|
+
return value2 && typeof value2 === "object" ? value2 : void 0;
|
|
1658
|
+
}
|
|
1659
|
+
function firstText(...values) {
|
|
1660
|
+
return values.find((value2) => typeof value2 === "string" && value2.trim().length > 0)?.trim();
|
|
1661
|
+
}
|
|
1662
|
+
function firstNumber(...values) {
|
|
1663
|
+
return values.find((value2) => typeof value2 === "number" && Number.isFinite(value2));
|
|
1664
|
+
}
|
|
1665
|
+
function collectDetailMessages(value2, visited = /* @__PURE__ */ new WeakSet(), depth = 0) {
|
|
1666
|
+
if (depth > 4 || value2 == null) return [];
|
|
1667
|
+
if (typeof value2 === "string") return value2.trim() ? [value2.trim()] : [];
|
|
1668
|
+
if (Array.isArray(value2)) {
|
|
1669
|
+
return value2.flatMap((item) => collectDetailMessages(item, visited, depth + 1));
|
|
1670
|
+
}
|
|
1671
|
+
if (typeof value2 !== "object" || visited.has(value2)) return [];
|
|
1672
|
+
visited.add(value2);
|
|
1673
|
+
const record = value2;
|
|
1674
|
+
const field = firstText(record.field, record.path, record.property, record.name);
|
|
1675
|
+
const message = firstText(record.message, record.msg, record.reason);
|
|
1676
|
+
const technicalMessage = firstText(record.technicalMessage);
|
|
1677
|
+
const index = firstText(record.index);
|
|
1678
|
+
const direct = [
|
|
1679
|
+
message ? field ? `${field}: ${message}` : message : void 0,
|
|
1680
|
+
technicalMessage,
|
|
1681
|
+
index ? `\xCDndice: ${index}` : void 0
|
|
1682
|
+
].filter((item) => Boolean(item));
|
|
1683
|
+
const nestedKeys = ["details", "errors", "validation", "fields"];
|
|
1684
|
+
const nested = nestedKeys.flatMap((key) => collectDetailMessages(record[key], visited, depth + 1));
|
|
1685
|
+
if (direct.length || nested.length) return [...direct, ...nested];
|
|
1686
|
+
return Object.entries(record).filter(([key]) => !["code", "status", "statusCode", "requestId"].includes(key)).flatMap(([, nestedValue]) => collectDetailMessages(nestedValue, visited, depth + 1));
|
|
1687
|
+
}
|
|
1688
|
+
function unique(values) {
|
|
1689
|
+
return [...new Set(values.map((value2) => value2.trim()).filter(Boolean))];
|
|
1690
|
+
}
|
|
1691
|
+
function describeActionError(error) {
|
|
1692
|
+
if (error instanceof Error) return { message: error.message };
|
|
1693
|
+
if (typeof error === "string") return { message: error };
|
|
1694
|
+
const record = asRecord(error);
|
|
1695
|
+
if (!record) return { message: "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o." };
|
|
1696
|
+
const nestedEnvelope = asRecord(record.error);
|
|
1697
|
+
const envelope = nestedEnvelope ?? record;
|
|
1698
|
+
const message = firstText(envelope.message, record.message) ?? "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o.";
|
|
1699
|
+
const rawError = typeof record.error === "string" ? record.error : void 0;
|
|
1700
|
+
const details = unique(collectDetailMessages(envelope.details ?? record.details ?? rawError)).filter((detail) => detail !== message).slice(0, 5);
|
|
1701
|
+
const code = firstText(envelope.code, record.code);
|
|
1702
|
+
const status = firstNumber(envelope.status, envelope.statusCode, record.status, record.statusCode);
|
|
1703
|
+
const requestId = firstText(envelope.requestId, record.requestId);
|
|
1704
|
+
const technical = [
|
|
1705
|
+
code ? `C\xF3digo: ${code}` : void 0,
|
|
1706
|
+
status ? `HTTP: ${status}` : void 0,
|
|
1707
|
+
requestId ? `ID da requisi\xE7\xE3o: ${requestId}` : void 0
|
|
1708
|
+
].filter((value2) => Boolean(value2));
|
|
1709
|
+
const contextParts = [...details, ...technical];
|
|
1710
|
+
return {
|
|
1711
|
+
message,
|
|
1712
|
+
...contextParts.length ? { context: contextParts.join(" \u2022 ") } : {}
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// src/components/internal/CoreErrorAlert.tsx
|
|
1717
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1718
|
+
function CoreErrorAlert({
|
|
1719
|
+
error,
|
|
1720
|
+
mt
|
|
1721
|
+
}) {
|
|
1722
|
+
const description = describeActionError(error);
|
|
1723
|
+
const details = description.context?.split(" \u2022 ").filter(Boolean) ?? [];
|
|
1724
|
+
return /* @__PURE__ */ jsxs5(
|
|
1725
|
+
Box4,
|
|
1726
|
+
{
|
|
1727
|
+
role: "alert",
|
|
1728
|
+
mt,
|
|
1729
|
+
p: "10px 12px",
|
|
1730
|
+
color: "#B42318",
|
|
1731
|
+
bg: "#FEF3F2",
|
|
1732
|
+
borderWidth: "1px",
|
|
1733
|
+
borderColor: "#FECDCA",
|
|
1734
|
+
borderRadius: "7px",
|
|
1735
|
+
fontSize: "11px",
|
|
1736
|
+
children: [
|
|
1737
|
+
/* @__PURE__ */ jsx9(Text5, { fontSize: "11px", fontWeight: "500", children: description.message }),
|
|
1738
|
+
details.length ? /* @__PURE__ */ jsxs5(Box4, { as: "details", mt: "5px", children: [
|
|
1739
|
+
/* @__PURE__ */ jsx9(
|
|
1740
|
+
Box4,
|
|
1741
|
+
{
|
|
1742
|
+
as: "summary",
|
|
1743
|
+
w: "fit-content",
|
|
1744
|
+
color: "#9B1C1C",
|
|
1745
|
+
cursor: "pointer",
|
|
1746
|
+
fontSize: "10px",
|
|
1747
|
+
fontWeight: "600",
|
|
1748
|
+
textDecoration: "underline",
|
|
1749
|
+
children: "Detalhes"
|
|
1750
|
+
}
|
|
1751
|
+
),
|
|
1752
|
+
/* @__PURE__ */ jsx9(
|
|
1753
|
+
Box4,
|
|
1754
|
+
{
|
|
1755
|
+
as: "ul",
|
|
1756
|
+
mt: "6px",
|
|
1757
|
+
mb: 0,
|
|
1758
|
+
pl: "18px",
|
|
1759
|
+
color: "#7A271A",
|
|
1760
|
+
fontFamily: "mono",
|
|
1761
|
+
fontSize: "9px",
|
|
1762
|
+
lineHeight: "1.45",
|
|
1763
|
+
overflowWrap: "anywhere",
|
|
1764
|
+
children: details.map((detail) => /* @__PURE__ */ jsx9("li", { children: detail }, detail))
|
|
1765
|
+
}
|
|
1766
|
+
)
|
|
1767
|
+
] }) : null
|
|
1768
|
+
]
|
|
1769
|
+
}
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1649
1773
|
// src/components/internal/inputMasks.ts
|
|
1650
1774
|
var digitsOnly = (value2) => String(value2 ?? "").replace(/\D/g, "");
|
|
1651
1775
|
var normalizedName = (value2) => String(value2 ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -1752,23 +1876,23 @@ function maxLengthForMask(mask) {
|
|
|
1752
1876
|
}
|
|
1753
1877
|
|
|
1754
1878
|
// src/components/internal/DynamicForm.tsx
|
|
1755
|
-
import { jsx as
|
|
1879
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1756
1880
|
var idFor = (field) => `oon-form-field-${field.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
1757
1881
|
var errorIdFor = (field) => `${idFor(field)}-error`;
|
|
1758
1882
|
var normalize = (value2) => String(value2 ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1759
1883
|
function CloseIcon() {
|
|
1760
|
-
return /* @__PURE__ */
|
|
1884
|
+
return /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("path", { d: "m6 6 8 8M14 6l-8 8", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) });
|
|
1761
1885
|
}
|
|
1762
1886
|
function CheckIcon() {
|
|
1763
|
-
return /* @__PURE__ */
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1887
|
+
return /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 20 20", width: "16", height: "16", "aria-hidden": "true", children: [
|
|
1888
|
+
/* @__PURE__ */ jsx10("circle", { cx: "10", cy: "10", r: "7", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1889
|
+
/* @__PURE__ */ jsx10("path", { d: "m6.8 10.1 2 2 4.3-4.4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1766
1890
|
] });
|
|
1767
1891
|
}
|
|
1768
1892
|
function AlertIcon() {
|
|
1769
|
-
return /* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
1893
|
+
return /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 20 20", width: "17", height: "17", "aria-hidden": "true", children: [
|
|
1894
|
+
/* @__PURE__ */ jsx10("circle", { cx: "10", cy: "10", r: "7", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1895
|
+
/* @__PURE__ */ jsx10("path", { d: "M10 6.5v4.2M10 13.5v.1", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
|
|
1772
1896
|
] });
|
|
1773
1897
|
}
|
|
1774
1898
|
function toValue(value2, kind) {
|
|
@@ -1850,14 +1974,14 @@ function isMultiline(field) {
|
|
|
1850
1974
|
return field.multiline === true || /observa|descricao|mensagem|detalhe|necessidade/i.test(field.field);
|
|
1851
1975
|
}
|
|
1852
1976
|
function Label({ id, label, required, readonly }) {
|
|
1853
|
-
return /* @__PURE__ */
|
|
1977
|
+
return /* @__PURE__ */ jsx10("label", { htmlFor: id, children: /* @__PURE__ */ jsxs6(Text6, { as: "span", display: "block", mb: "6px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
|
|
1854
1978
|
label,
|
|
1855
|
-
required && !readonly ? /* @__PURE__ */
|
|
1856
|
-
readonly ? /* @__PURE__ */
|
|
1979
|
+
required && !readonly ? /* @__PURE__ */ jsx10(Text6, { as: "span", color: "#DC2626", children: " *" }) : null,
|
|
1980
|
+
readonly ? /* @__PURE__ */ jsx10(Text6, { as: "span", ml: "5px", color: "#98A2B3", fontSize: "9px", fontWeight: "500", children: "somente leitura" }) : null
|
|
1857
1981
|
] }) });
|
|
1858
1982
|
}
|
|
1859
1983
|
function ErrorText({ id, text }) {
|
|
1860
|
-
return text ? /* @__PURE__ */
|
|
1984
|
+
return text ? /* @__PURE__ */ jsx10(Text6, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: text }) : null;
|
|
1861
1985
|
}
|
|
1862
1986
|
var controlProps = (invalid, readonly = false) => ({
|
|
1863
1987
|
minH: "37px",
|
|
@@ -1968,21 +2092,21 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
|
|
|
1968
2092
|
const multiline = isMultiline(field);
|
|
1969
2093
|
const span = field.span === 2 || multiline;
|
|
1970
2094
|
const readonly = Boolean(field.readonly || field.computed);
|
|
1971
|
-
const wrap = (control, showLabel = true) => /* @__PURE__ */
|
|
1972
|
-
showLabel ? /* @__PURE__ */
|
|
2095
|
+
const wrap = (control, showLabel = true) => /* @__PURE__ */ jsxs6(Box5, { minW: grouped ? "150px" : void 0, flex: grouped ? "0 1 auto" : void 0, gridColumn: !grouped && span ? "1 / -1" : void 0, children: [
|
|
2096
|
+
showLabel ? /* @__PURE__ */ jsx10(Label, { id, label, required: field.required, readonly }) : null,
|
|
1973
2097
|
control,
|
|
1974
|
-
/* @__PURE__ */
|
|
2098
|
+
/* @__PURE__ */ jsx10(ErrorText, { id: errorId, text: message })
|
|
1975
2099
|
] }, field.field);
|
|
1976
2100
|
if (field.widget === "checkbox") {
|
|
1977
2101
|
const checkedValue = String(field.checkedValue ?? true);
|
|
1978
2102
|
const uncheckedValue = String(field.uncheckedValue ?? false);
|
|
1979
2103
|
const checked = (values[field.field] ?? uncheckedValue) === checkedValue;
|
|
1980
2104
|
return wrap(
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
/* @__PURE__ */
|
|
1983
|
-
/* @__PURE__ */
|
|
2105
|
+
/* @__PURE__ */ jsxs6(Box5, { as: "label", display: "flex", minH: "37px", px: "11px", alignItems: "center", gap: "8px", color: "#344054", bg: readonly ? "#F8FAFC" : checked ? "#F0F7FF" : "white", borderWidth: "1px", borderColor: message ? "#DC2626" : checked ? "#8FC9E7" : "#D5DDE3", borderRadius: "7px", cursor: readonly ? "not-allowed" : "pointer", transition: "background .15s ease, border-color .15s ease", children: [
|
|
2106
|
+
/* @__PURE__ */ jsx10("input", { id, type: "checkbox", checked, disabled: readonly, "aria-invalid": !!message, "aria-describedby": errorId, style: { width: 16, height: 16, accentColor: "#0474AF", cursor: readonly ? "not-allowed" : "pointer" }, onChange: (event) => change(field.field, event.currentTarget.checked ? checkedValue : uncheckedValue) }),
|
|
2107
|
+
/* @__PURE__ */ jsxs6(Text6, { as: "span", fontSize: "11px", fontWeight: "600", children: [
|
|
1984
2108
|
label,
|
|
1985
|
-
field.required && !readonly ? /* @__PURE__ */
|
|
2109
|
+
field.required && !readonly ? /* @__PURE__ */ jsx10(Text6, { as: "span", color: "#DC2626", children: " *" }) : null
|
|
1986
2110
|
] })
|
|
1987
2111
|
] }),
|
|
1988
2112
|
false
|
|
@@ -1990,77 +2114,74 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
|
|
|
1990
2114
|
}
|
|
1991
2115
|
if (field.kind === "ref" && field.ref) {
|
|
1992
2116
|
const reference = resolveReference(field, values);
|
|
1993
|
-
return wrap(/* @__PURE__ */
|
|
2117
|
+
return wrap(/* @__PURE__ */ jsx10(ReferenceSelect, { field: field.field, inputId: id, errorId, label, refModel: field.ref, value: values[field.field] ?? "", initialValue: initialValues?.[field.field], required: field.required && !readonly, invalid: !!message, error: message, filters: reference.filters, emptyFields: field.referenceEmptyFields, disabled: readonly || reference.disabled, disabledMessage: field.referenceDisabledMessage, onChange: (value3) => change(field.field, value3) }));
|
|
1994
2118
|
}
|
|
1995
|
-
if (field.kind === "enum" && field.options?.length) return wrap(/* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
field.options.map((option) => /* @__PURE__ */
|
|
2119
|
+
if (field.kind === "enum" && field.options?.length) return wrap(/* @__PURE__ */ jsxs6(NativeSelect2.Root, { size: "sm", disabled: readonly, children: [
|
|
2120
|
+
/* @__PURE__ */ jsxs6(NativeSelect2.Field, { id, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message, readonly), onChange: (event) => change(field.field, event.currentTarget.value), children: [
|
|
2121
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2122
|
+
field.options.map((option) => /* @__PURE__ */ jsx10("option", { value: option, children: option }, option))
|
|
1999
2123
|
] }),
|
|
2000
|
-
/* @__PURE__ */
|
|
2124
|
+
/* @__PURE__ */ jsx10(NativeSelect2.Indicator, {})
|
|
2001
2125
|
] }));
|
|
2002
|
-
if (field.kind === "boolean") return wrap(/* @__PURE__ */
|
|
2003
|
-
/* @__PURE__ */
|
|
2004
|
-
/* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */
|
|
2126
|
+
if (field.kind === "boolean") return wrap(/* @__PURE__ */ jsxs6(NativeSelect2.Root, { size: "sm", disabled: readonly, children: [
|
|
2127
|
+
/* @__PURE__ */ jsxs6(NativeSelect2.Field, { id, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message, readonly), onChange: (event) => change(field.field, event.currentTarget.value), children: [
|
|
2128
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2129
|
+
/* @__PURE__ */ jsx10("option", { value: "true", children: "Sim" }),
|
|
2130
|
+
/* @__PURE__ */ jsx10("option", { value: "false", children: "N\xE3o" })
|
|
2007
2131
|
] }),
|
|
2008
|
-
/* @__PURE__ */
|
|
2132
|
+
/* @__PURE__ */ jsx10(NativeSelect2.Indicator, {})
|
|
2009
2133
|
] }));
|
|
2010
|
-
if (multiline) return wrap(/* @__PURE__ */
|
|
2134
|
+
if (multiline) return wrap(/* @__PURE__ */ jsx10(Textarea, { id, rows: field.rows ?? 4, resize: "vertical", readOnly: readonly, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message, readonly), lineHeight: "1.5", onChange: (event) => change(field.field, event.currentTarget.value) }));
|
|
2011
2135
|
const mask = resolveInputMask(field);
|
|
2012
2136
|
const numeric = ["number", "currency", "currencyConverted"].includes(field.kind ?? "");
|
|
2013
2137
|
const type = mask ? "text" : field.kind === "date" ? "date" : numeric ? "number" : "text";
|
|
2014
2138
|
const value2 = values[field.field] ?? "";
|
|
2015
2139
|
return wrap(
|
|
2016
|
-
/* @__PURE__ */
|
|
2140
|
+
/* @__PURE__ */ jsx10(Input3, { id, type, step: type === "number" ? "any" : void 0, inputMode: inputModeForMask(mask), maxLength: maxLengthForMask(mask), autoComplete: "off", readOnly: readonly, "aria-invalid": !!message, "aria-describedby": errorId, value: mask ? formatMaskedValue(value2, mask) : value2, ...controlProps(!!message, readonly), onChange: (event) => change(field.field, parseMaskedInput(event.currentTarget.value, mask)) })
|
|
2017
2141
|
);
|
|
2018
2142
|
};
|
|
2019
2143
|
const combinedErrors = { ...formulaErrors, ...errors };
|
|
2020
2144
|
const invalid = fields.filter((field) => combinedErrors[field.field]);
|
|
2021
2145
|
const generic = dismissed ? null : messageOf(error);
|
|
2022
|
-
return /* @__PURE__ */
|
|
2146
|
+
return /* @__PURE__ */ jsx10(Flex4, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: { base: 2, md: 6 }, bg: "rgba(15,23,42,.48)", backdropFilter: "blur(2px)", onMouseDown: (event) => {
|
|
2023
2147
|
if (event.currentTarget === event.target && !submitting) onCancel();
|
|
2024
|
-
}, children: /* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2148
|
+
}, children: /* @__PURE__ */ jsxs6(Box5, { role: "dialog", "aria-modal": "true", "aria-label": title, w: "min(860px, 96vw)", maxH: "min(880px, 94vh)", overflow: "hidden", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "14px", boxShadow: "0 24px 70px rgba(15,23,42,.24)", children: [
|
|
2149
|
+
/* @__PURE__ */ jsxs6(Flex4, { minH: "76px", px: "20px", py: "16px", align: "center", justify: "space-between", borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
|
|
2150
|
+
/* @__PURE__ */ jsxs6(Box5, { children: [
|
|
2151
|
+
/* @__PURE__ */ jsx10(Text6, { color: "#0474AF", fontSize: "10px", fontWeight: "600", letterSpacing: ".07em", textTransform: "uppercase", children: eyebrow }),
|
|
2152
|
+
/* @__PURE__ */ jsx10(Heading2, { mt: "3px", color: "#344054", fontSize: "18px", fontWeight: "600", children: title })
|
|
2029
2153
|
] }),
|
|
2030
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ jsx10(Button4, { type: "button", "aria-label": "Fechar", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", disabled: submitting, onClick: onCancel, _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx10(CloseIcon, {}) })
|
|
2031
2155
|
] }),
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
invalid.length ? /* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsxs6("form", { noValidate: true, onSubmit: submit, children: [
|
|
2157
|
+
/* @__PURE__ */ jsx10(Box5, { maxH: "calc(94vh - 148px)", px: "20px", pt: "18px", pb: "24px", overflowY: "auto", children: /* @__PURE__ */ jsxs6(Stack2, { gap: 4, children: [
|
|
2158
|
+
invalid.length ? /* @__PURE__ */ jsxs6(Box5, { role: "alert", p: "11px 13px", color: "#9B1C1C", bg: "#FFF5F5", borderWidth: "1px", borderColor: "#FECACA", borderLeftWidth: "4px", borderLeftColor: "#DC2626", borderRadius: "8px", fontSize: "11px", children: [
|
|
2159
|
+
/* @__PURE__ */ jsxs6(Flex4, { align: "center", gap: "7px", children: [
|
|
2160
|
+
/* @__PURE__ */ jsx10(AlertIcon, {}),
|
|
2161
|
+
/* @__PURE__ */ jsx10(Text6, { as: "strong", children: "Revise os campos abaixo:" })
|
|
2038
2162
|
] }),
|
|
2039
|
-
/* @__PURE__ */
|
|
2163
|
+
/* @__PURE__ */ jsx10(Box5, { as: "ul", mt: "7px", mb: 0, pl: "20px", display: "grid", gap: "3px", children: invalid.map((field) => /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsxs6(Button4, { type: "button", variant: "plain", minH: "auto", h: "auto", p: 0, color: "#B42318", fontSize: "10px", fontWeight: "400", textDecoration: "underline", onClick: () => focusField(field.field), children: [
|
|
2040
2164
|
fieldLabel({ name: field.field, label: field.label }),
|
|
2041
2165
|
": ",
|
|
2042
2166
|
combinedErrors[field.field]
|
|
2043
2167
|
] }) }, field.field)) })
|
|
2044
2168
|
] }) : null,
|
|
2045
|
-
generic && !invalid.length ? /* @__PURE__ */
|
|
2046
|
-
|
|
2047
|
-
generic
|
|
2048
|
-
] }) : null,
|
|
2049
|
-
/* @__PURE__ */ jsx9(SimpleGrid, { columns: { base: 1, lg: 2 }, gapX: "16px", gapY: "15px", children: items.map((item) => {
|
|
2169
|
+
generic && !invalid.length ? /* @__PURE__ */ jsx10(CoreErrorAlert, { error }) : null,
|
|
2170
|
+
/* @__PURE__ */ jsx10(SimpleGrid, { columns: { base: 1, lg: 2 }, gapX: "16px", gapY: "15px", children: items.map((item) => {
|
|
2050
2171
|
if (item.type === "field") return renderField(item.field);
|
|
2051
2172
|
const first = item.fields[0];
|
|
2052
2173
|
const inline = item.fields.some((field) => field.inline !== false);
|
|
2053
|
-
return /* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
first.groupDescription ? /* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2174
|
+
return /* @__PURE__ */ jsxs6(Box5, { gridColumn: "1 / -1", p: "12px", bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
|
|
2175
|
+
/* @__PURE__ */ jsx10(Text6, { color: "#344054", fontSize: "11px", fontWeight: "700", children: first.groupLabel ?? item.id }),
|
|
2176
|
+
first.groupDescription ? /* @__PURE__ */ jsx10(Text6, { mt: "2px", mb: "10px", color: "#667085", fontSize: "10px", children: first.groupDescription }) : /* @__PURE__ */ jsx10(Box5, { h: "8px" }),
|
|
2177
|
+
/* @__PURE__ */ jsx10(Flex4, { direction: inline ? "row" : "column", wrap: "wrap", gap: "9px", children: item.fields.map((field) => renderField(field, true)) })
|
|
2057
2178
|
] }, item.id);
|
|
2058
2179
|
}) })
|
|
2059
2180
|
] }) }),
|
|
2060
|
-
/* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
/* @__PURE__ */
|
|
2181
|
+
/* @__PURE__ */ jsxs6(Flex4, { minH: "68px", px: "20px", py: "14px", justify: "flex-end", gap: "9px", borderTopWidth: "1px", borderColor: "#E5E9ED", children: [
|
|
2182
|
+
/* @__PURE__ */ jsx10(Button4, { type: "button", minH: "35px", px: "13px", color: "#475467", bg: "white", borderWidth: "1px", borderColor: "#D5DDE3", borderRadius: "6px", fontSize: "11px", fontWeight: "600", disabled: submitting, onClick: onCancel, children: "Cancelar" }),
|
|
2183
|
+
/* @__PURE__ */ jsxs6(Button4, { type: "submit", minH: "35px", px: "13px", colorPalette: "brand", borderRadius: "6px", fontSize: "11px", fontWeight: "600", loading: submitting, children: [
|
|
2184
|
+
/* @__PURE__ */ jsx10(CheckIcon, {}),
|
|
2064
2185
|
" Salvar"
|
|
2065
2186
|
] })
|
|
2066
2187
|
] })
|
|
@@ -2070,15 +2191,15 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
|
|
|
2070
2191
|
|
|
2071
2192
|
// src/components/internal/CoreDetailModal.tsx
|
|
2072
2193
|
import { useEffect as useEffect6, useMemo as useMemo7, useRef as useRef2, useState as useState9 } from "react";
|
|
2073
|
-
import { Box as
|
|
2194
|
+
import { Box as Box10, Button as Button8, Flex as Flex7, Heading as Heading3, IconButton, Text as Text11 } from "@chakra-ui/react";
|
|
2074
2195
|
import { useQuery as useQuery6, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
2075
2196
|
|
|
2076
2197
|
// src/components/internal/CoreTabbedDetail.tsx
|
|
2077
2198
|
import { useEffect as useEffect5, useMemo as useMemo6, useState as useState8 } from "react";
|
|
2078
|
-
import { Box as
|
|
2199
|
+
import { Box as Box9, Button as Button7, Flex as Flex6, Input as Input5, NativeSelect as NativeSelect4, SimpleGrid as SimpleGrid3, Stack as Stack3, Text as Text10, Textarea as Textarea3 } from "@chakra-ui/react";
|
|
2079
2200
|
|
|
2080
2201
|
// src/components/internal/CoreSummaryCards.tsx
|
|
2081
|
-
import { SimpleGrid as SimpleGrid2, Box as
|
|
2202
|
+
import { SimpleGrid as SimpleGrid2, Box as Box6, Text as Text7, Badge as Badge2 } from "@chakra-ui/react";
|
|
2082
2203
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2083
2204
|
|
|
2084
2205
|
// src/components/internal/manifestUtils.ts
|
|
@@ -2108,7 +2229,7 @@ function resolveInitialDetailTab(config, recordId, initialTab) {
|
|
|
2108
2229
|
}
|
|
2109
2230
|
|
|
2110
2231
|
// src/components/internal/CoreSummaryCards.tsx
|
|
2111
|
-
import { Fragment, jsx as
|
|
2232
|
+
import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2112
2233
|
function format(value2, format2) {
|
|
2113
2234
|
if (format2 === "currency") return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value2 ?? 0));
|
|
2114
2235
|
if (format2 === "percent") return `${Number(value2 ?? 0).toLocaleString("pt-BR")}%`;
|
|
@@ -2124,27 +2245,27 @@ function RelatedMetric({ card, relation, parent }) {
|
|
|
2124
2245
|
let value2 = rows.length;
|
|
2125
2246
|
if (card.source === "relatedSum") value2 = rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0);
|
|
2126
2247
|
if (card.source === "relatedAvg") value2 = rows.length ? rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0) / rows.length : 0;
|
|
2127
|
-
return /* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ jsx11(Fragment, { children: query.isLoading ? "..." : format(value2, card.format) });
|
|
2128
2249
|
}
|
|
2129
2250
|
function CoreSummaryCards({ cards = [], parent, relations }) {
|
|
2130
|
-
return /* @__PURE__ */
|
|
2251
|
+
return /* @__PURE__ */ jsx11(SimpleGrid2, { columns: { base: 1, md: 3 }, gap: 3, children: cards.map((card, index) => {
|
|
2131
2252
|
const relation = card.relation ? relationFrom(card.relation, relations) : void 0;
|
|
2132
|
-
const content = relation && card.source?.startsWith("related") ? /* @__PURE__ */
|
|
2133
|
-
return /* @__PURE__ */
|
|
2134
|
-
/* @__PURE__ */
|
|
2135
|
-
/* @__PURE__ */
|
|
2253
|
+
const content = relation && card.source?.startsWith("related") ? /* @__PURE__ */ jsx11(RelatedMetric, { card, relation, parent }) : format(parent[card.field ?? ""], card.format);
|
|
2254
|
+
return /* @__PURE__ */ jsxs7(Box6, { p: "14px", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
|
|
2255
|
+
/* @__PURE__ */ jsx11(Text7, { color: "#667085", fontSize: "10px", fontWeight: "600", children: card.label }),
|
|
2256
|
+
/* @__PURE__ */ jsx11(Text7, { mt: "6px", color: "#24323A", fontSize: "20px", fontWeight: "700", children: card.format === "badge" ? /* @__PURE__ */ jsx11(Badge2, { children: content }) : content })
|
|
2136
2257
|
] }, `${card.label}-${index}`);
|
|
2137
2258
|
}) });
|
|
2138
2259
|
}
|
|
2139
2260
|
|
|
2140
2261
|
// src/components/internal/CoreRelatedGrid.tsx
|
|
2141
2262
|
import { useMemo as useMemo5, useState as useState7 } from "react";
|
|
2142
|
-
import { Badge as Badge3, Box as
|
|
2263
|
+
import { Badge as Badge3, Box as Box8, Button as Button6, Flex as Flex5, Table as Table2, Text as Text9 } from "@chakra-ui/react";
|
|
2143
2264
|
import { useMutation, useQuery as useQuery5, useQueryClient } from "@tanstack/react-query";
|
|
2144
2265
|
|
|
2145
2266
|
// src/components/internal/CoreInlineEditableCell.tsx
|
|
2146
2267
|
import { Input as Input4, NativeSelect as NativeSelect3, Textarea as Textarea2 } from "@chakra-ui/react";
|
|
2147
|
-
import { jsx as
|
|
2268
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2148
2269
|
function CoreInlineEditableCell({ column, meta, value: value2, onChange }) {
|
|
2149
2270
|
const kind = column.editor ?? meta?.kind ?? column.kind ?? "string";
|
|
2150
2271
|
const plainValue = value2 == null ? "" : String(value2);
|
|
@@ -2154,25 +2275,25 @@ function CoreInlineEditableCell({ column, meta, value: value2, onChange }) {
|
|
|
2154
2275
|
value: plainValue,
|
|
2155
2276
|
onChange: (event) => onChange(event.currentTarget.value)
|
|
2156
2277
|
};
|
|
2157
|
-
if (kind === "boolean") return /* @__PURE__ */
|
|
2158
|
-
/* @__PURE__ */
|
|
2159
|
-
/* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */
|
|
2161
|
-
/* @__PURE__ */
|
|
2278
|
+
if (kind === "boolean") return /* @__PURE__ */ jsxs8(NativeSelect3.Root, { size: "xs", children: [
|
|
2279
|
+
/* @__PURE__ */ jsxs8(NativeSelect3.Field, { ...common, children: [
|
|
2280
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: "\u2014" }),
|
|
2281
|
+
/* @__PURE__ */ jsx12("option", { value: "true", children: "Sim" }),
|
|
2282
|
+
/* @__PURE__ */ jsx12("option", { value: "false", children: "N\xE3o" })
|
|
2162
2283
|
] }),
|
|
2163
|
-
/* @__PURE__ */
|
|
2284
|
+
/* @__PURE__ */ jsx12(NativeSelect3.Indicator, {})
|
|
2164
2285
|
] });
|
|
2165
|
-
if ((kind === "enum" || kind === "select") && meta?.options?.length) return /* @__PURE__ */
|
|
2166
|
-
/* @__PURE__ */
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
meta.options.map((option) => /* @__PURE__ */
|
|
2286
|
+
if ((kind === "enum" || kind === "select") && meta?.options?.length) return /* @__PURE__ */ jsxs8(NativeSelect3.Root, { size: "xs", children: [
|
|
2287
|
+
/* @__PURE__ */ jsxs8(NativeSelect3.Field, { ...common, children: [
|
|
2288
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: "\u2014" }),
|
|
2289
|
+
meta.options.map((option) => /* @__PURE__ */ jsx12("option", { value: option, children: option }, option))
|
|
2169
2290
|
] }),
|
|
2170
|
-
/* @__PURE__ */
|
|
2291
|
+
/* @__PURE__ */ jsx12(NativeSelect3.Indicator, {})
|
|
2171
2292
|
] });
|
|
2172
|
-
if (kind === "textarea") return /* @__PURE__ */
|
|
2293
|
+
if (kind === "textarea") return /* @__PURE__ */ jsx12(Textarea2, { ...common, rows: 2 });
|
|
2173
2294
|
const mask = resolveInputMask({ field: column.field, kind });
|
|
2174
2295
|
const type = mask ? "text" : kind === "date" ? "date" : kind === "number" ? "number" : "text";
|
|
2175
|
-
return /* @__PURE__ */
|
|
2296
|
+
return /* @__PURE__ */ jsx12(
|
|
2176
2297
|
Input4,
|
|
2177
2298
|
{
|
|
2178
2299
|
size: "xs",
|
|
@@ -2189,60 +2310,7 @@ function CoreInlineEditableCell({ column, meta, value: value2, onChange }) {
|
|
|
2189
2310
|
|
|
2190
2311
|
// src/components/internal/CoreRowAction.tsx
|
|
2191
2312
|
import { useState as useState6 } from "react";
|
|
2192
|
-
import { Box as
|
|
2193
|
-
|
|
2194
|
-
// src/components/internal/actionError.ts
|
|
2195
|
-
function asRecord(value2) {
|
|
2196
|
-
return value2 && typeof value2 === "object" ? value2 : void 0;
|
|
2197
|
-
}
|
|
2198
|
-
function firstText(...values) {
|
|
2199
|
-
return values.find((value2) => typeof value2 === "string" && value2.trim().length > 0)?.trim();
|
|
2200
|
-
}
|
|
2201
|
-
function firstNumber(...values) {
|
|
2202
|
-
return values.find((value2) => typeof value2 === "number" && Number.isFinite(value2));
|
|
2203
|
-
}
|
|
2204
|
-
function collectDetailMessages(value2, visited = /* @__PURE__ */ new WeakSet(), depth = 0) {
|
|
2205
|
-
if (depth > 4 || value2 == null) return [];
|
|
2206
|
-
if (typeof value2 === "string") return value2.trim() ? [value2.trim()] : [];
|
|
2207
|
-
if (Array.isArray(value2)) {
|
|
2208
|
-
return value2.flatMap((item) => collectDetailMessages(item, visited, depth + 1));
|
|
2209
|
-
}
|
|
2210
|
-
if (typeof value2 !== "object" || visited.has(value2)) return [];
|
|
2211
|
-
visited.add(value2);
|
|
2212
|
-
const record = value2;
|
|
2213
|
-
const field = firstText(record.field, record.path, record.property, record.name);
|
|
2214
|
-
const message = firstText(record.message, record.msg, record.reason);
|
|
2215
|
-
const direct = message ? [field ? `${field}: ${message}` : message] : [];
|
|
2216
|
-
const nestedKeys = ["details", "errors", "validation", "fields"];
|
|
2217
|
-
const nested = nestedKeys.flatMap((key) => collectDetailMessages(record[key], visited, depth + 1));
|
|
2218
|
-
if (direct.length || nested.length) return [...direct, ...nested];
|
|
2219
|
-
return Object.entries(record).filter(([key]) => !["code", "status", "statusCode", "requestId"].includes(key)).flatMap(([, nestedValue]) => collectDetailMessages(nestedValue, visited, depth + 1));
|
|
2220
|
-
}
|
|
2221
|
-
function unique(values) {
|
|
2222
|
-
return [...new Set(values.map((value2) => value2.trim()).filter(Boolean))];
|
|
2223
|
-
}
|
|
2224
|
-
function describeActionError(error) {
|
|
2225
|
-
if (error instanceof Error) return { message: error.message };
|
|
2226
|
-
if (typeof error === "string") return { message: error };
|
|
2227
|
-
const record = asRecord(error);
|
|
2228
|
-
if (!record) return { message: "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o." };
|
|
2229
|
-
const envelope = asRecord(record.error) ?? record;
|
|
2230
|
-
const message = firstText(envelope.message, record.message) ?? "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o.";
|
|
2231
|
-
const details = unique(collectDetailMessages(envelope.details ?? record.details)).filter((detail) => detail !== message).slice(0, 3);
|
|
2232
|
-
const code = firstText(envelope.code, record.code);
|
|
2233
|
-
const status = firstNumber(envelope.status, envelope.statusCode, record.status, record.statusCode);
|
|
2234
|
-
const requestId = firstText(envelope.requestId, record.requestId);
|
|
2235
|
-
const technical = [
|
|
2236
|
-
code ? `C\xF3digo: ${code}` : void 0,
|
|
2237
|
-
status ? `HTTP: ${status}` : void 0,
|
|
2238
|
-
requestId ? `ID da requisi\xE7\xE3o: ${requestId}` : void 0
|
|
2239
|
-
].filter((value2) => Boolean(value2));
|
|
2240
|
-
const contextParts = [...details, ...technical];
|
|
2241
|
-
return {
|
|
2242
|
-
message,
|
|
2243
|
-
...contextParts.length ? { context: contextParts.join(" \u2022 ") } : {}
|
|
2244
|
-
};
|
|
2245
|
-
}
|
|
2313
|
+
import { Box as Box7, Button as Button5, Text as Text8 } from "@chakra-ui/react";
|
|
2246
2314
|
|
|
2247
2315
|
// src/components/internal/conditions.ts
|
|
2248
2316
|
function valueAt(source, path) {
|
|
@@ -2278,14 +2346,14 @@ function interpolateEndpoint(endpoint, row, parent) {
|
|
|
2278
2346
|
|
|
2279
2347
|
// src/components/internal/DetailRecordContext.tsx
|
|
2280
2348
|
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
2281
|
-
import { jsx as
|
|
2349
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2282
2350
|
var DetailRecordContext = createContext4(null);
|
|
2283
2351
|
function DetailRecordProvider({
|
|
2284
2352
|
record,
|
|
2285
2353
|
setRecord,
|
|
2286
2354
|
children
|
|
2287
2355
|
}) {
|
|
2288
|
-
return /* @__PURE__ */
|
|
2356
|
+
return /* @__PURE__ */ jsx13(DetailRecordContext.Provider, { value: { record, setRecord }, children });
|
|
2289
2357
|
}
|
|
2290
2358
|
function useDetailRecord() {
|
|
2291
2359
|
return useContext4(DetailRecordContext);
|
|
@@ -2296,7 +2364,7 @@ function mergeDetailRecord(current, saved, changes = {}) {
|
|
|
2296
2364
|
}
|
|
2297
2365
|
|
|
2298
2366
|
// src/components/internal/CoreRowAction.tsx
|
|
2299
|
-
import { jsx as
|
|
2367
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2300
2368
|
var ACTION_TONES = {
|
|
2301
2369
|
success: { bg: "#DCFCE7", color: "#166534", border: "#BBF7D0", hover: "#D1FAE5" },
|
|
2302
2370
|
danger: { bg: "#FEE2E2", color: "#991B1B", border: "#FECACA", hover: "#FDE2E2" },
|
|
@@ -2306,8 +2374,8 @@ var ACTION_TONES = {
|
|
|
2306
2374
|
};
|
|
2307
2375
|
function ActionErrorMessage({ error }) {
|
|
2308
2376
|
const description = describeActionError(error);
|
|
2309
|
-
return /* @__PURE__ */
|
|
2310
|
-
|
|
2377
|
+
return /* @__PURE__ */ jsxs9(
|
|
2378
|
+
Box7,
|
|
2311
2379
|
{
|
|
2312
2380
|
role: "alert",
|
|
2313
2381
|
mt: "5px",
|
|
@@ -2318,8 +2386,8 @@ function ActionErrorMessage({ error }) {
|
|
|
2318
2386
|
borderColor: "#FECDCA",
|
|
2319
2387
|
borderRadius: "6px",
|
|
2320
2388
|
children: [
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
description.context ? /* @__PURE__ */
|
|
2389
|
+
/* @__PURE__ */ jsx14(Text8, { color: "#B42318", fontSize: "10px", fontWeight: "600", lineHeight: "1.35", children: description.message }),
|
|
2390
|
+
description.context ? /* @__PURE__ */ jsx14(Text8, { mt: "2px", color: "#7A271A", fontSize: "9px", lineHeight: "1.35", children: description.context }) : null
|
|
2323
2391
|
]
|
|
2324
2392
|
}
|
|
2325
2393
|
);
|
|
@@ -2420,8 +2488,8 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2420
2488
|
setLoading(false);
|
|
2421
2489
|
}
|
|
2422
2490
|
};
|
|
2423
|
-
return /* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2491
|
+
return /* @__PURE__ */ jsxs9("span", { style: { display: "inline-flex", flexDirection: "column" }, children: [
|
|
2492
|
+
/* @__PURE__ */ jsxs9(
|
|
2425
2493
|
Button5,
|
|
2426
2494
|
{
|
|
2427
2495
|
type: "button",
|
|
@@ -2444,13 +2512,13 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2444
2512
|
_hover: tone ? { bg: tone.hover, borderColor: tone.border } : void 0,
|
|
2445
2513
|
_disabled: tone ? { opacity: isSelected ? 1 : 0.55, cursor: "not-allowed" } : void 0,
|
|
2446
2514
|
children: [
|
|
2447
|
-
isWorkStatus ? /* @__PURE__ */
|
|
2515
|
+
isWorkStatus ? /* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: { width: 8, height: 8, display: "inline-block", marginRight: 7, borderRadius: "999px", background: tone?.color ?? "#64748B", boxShadow: isSelected ? "0 0 0 2px rgba(255,255,255,.9)" : "none" } }) : null,
|
|
2448
2516
|
action.label
|
|
2449
2517
|
]
|
|
2450
2518
|
}
|
|
2451
2519
|
),
|
|
2452
|
-
error ? /* @__PURE__ */
|
|
2453
|
-
formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */
|
|
2520
|
+
error ? /* @__PURE__ */ jsx14(ActionErrorMessage, { error }) : null,
|
|
2521
|
+
formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */ jsx14(
|
|
2454
2522
|
DynamicForm,
|
|
2455
2523
|
{
|
|
2456
2524
|
title: pipelineAction.title ?? pipelineAction.label,
|
|
@@ -2485,7 +2553,7 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2485
2553
|
}
|
|
2486
2554
|
|
|
2487
2555
|
// src/components/internal/CoreRelatedGrid.tsx
|
|
2488
|
-
import { Fragment as Fragment2, jsx as
|
|
2556
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2489
2557
|
function parentValueAt(parent, path) {
|
|
2490
2558
|
return path.split(".").reduce((current, part) => {
|
|
2491
2559
|
if (!current || typeof current !== "object") return void 0;
|
|
@@ -2566,38 +2634,38 @@ function CoreRelatedGrid({
|
|
|
2566
2634
|
mutationFn: (id) => resource.delete(id),
|
|
2567
2635
|
onSuccess: invalidate
|
|
2568
2636
|
});
|
|
2569
|
-
if (!relation) return /* @__PURE__ */
|
|
2570
|
-
if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */
|
|
2637
|
+
if (!relation) return /* @__PURE__ */ jsx15(Text9, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
|
|
2638
|
+
if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */ jsx15(Text9, { color: "#667085", children: "Carregando..." });
|
|
2571
2639
|
const rows = query.data?.results ?? [];
|
|
2572
2640
|
const setDraft = (id, field, value2) => setDrafts((current) => ({
|
|
2573
2641
|
...current,
|
|
2574
2642
|
[id]: { ...current[id] ?? {}, [field]: value2 }
|
|
2575
2643
|
}));
|
|
2576
|
-
return /* @__PURE__ */
|
|
2577
|
-
canCreate ? /* @__PURE__ */
|
|
2644
|
+
return /* @__PURE__ */ jsxs10(Box8, { children: [
|
|
2645
|
+
canCreate ? /* @__PURE__ */ jsx15(Flex5, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx15(Button6, { size: "sm", colorPalette: "brand", onClick: () => {
|
|
2578
2646
|
setCreateError(null);
|
|
2579
2647
|
setCreating(true);
|
|
2580
2648
|
}, children: tab.create?.label ?? "Novo registro" }) }) : null,
|
|
2581
|
-
/* @__PURE__ */
|
|
2582
|
-
/* @__PURE__ */
|
|
2583
|
-
columns.map((column) => /* @__PURE__ */
|
|
2584
|
-
hasActions ? /* @__PURE__ */
|
|
2649
|
+
/* @__PURE__ */ jsx15(Box8, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs10(Table2.Root, { size: "sm", minW: "760px", children: [
|
|
2650
|
+
/* @__PURE__ */ jsx15(Table2.Header, { children: /* @__PURE__ */ jsxs10(Table2.Row, { bg: "#F4F7F9", children: [
|
|
2651
|
+
columns.map((column) => /* @__PURE__ */ jsx15(Table2.ColumnHeader, { fontSize: "10px", children: column.label ?? column.field }, column.field)),
|
|
2652
|
+
hasActions ? /* @__PURE__ */ jsx15(Table2.ColumnHeader, { children: "A\xE7\xF5es" }) : null
|
|
2585
2653
|
] }) }),
|
|
2586
|
-
/* @__PURE__ */
|
|
2654
|
+
/* @__PURE__ */ jsxs10(Table2.Body, { children: [
|
|
2587
2655
|
rows.map((row, index) => {
|
|
2588
2656
|
const id = String(row._id ?? row.id ?? index);
|
|
2589
2657
|
const draft = drafts[id] ?? {};
|
|
2590
2658
|
const dirty = Object.keys(draft).length > 0;
|
|
2591
|
-
return /* @__PURE__ */
|
|
2659
|
+
return /* @__PURE__ */ jsxs10(Table2.Row, { bg: dirty ? "#FFFBEB" : index % 2 ? "#FBFCFD" : "white", children: [
|
|
2592
2660
|
columns.map((column) => {
|
|
2593
2661
|
const value2 = column.field in draft ? draft[column.field] : row[column.field];
|
|
2594
2662
|
const meta = schema?.fields.find((field) => field.name === column.field);
|
|
2595
2663
|
const canEdit = editable && column.readonly !== true && (column.editable === true || !column.readonly);
|
|
2596
|
-
return /* @__PURE__ */
|
|
2664
|
+
return /* @__PURE__ */ jsx15(Table2.Cell, { fontSize: "11px", children: canEdit ? /* @__PURE__ */ jsx15(CoreInlineEditableCell, { column, meta, value: value2, onChange: (next) => setDraft(id, column.field, next) }) : column.display === "badgeExists" ? /* @__PURE__ */ jsx15(Badge3, { colorPalette: value2 ? "green" : "gray", children: value2 ? "Sim" : "N\xE3o" }) : formatCell(value2, column.kind) }, column.field);
|
|
2597
2665
|
}),
|
|
2598
|
-
hasActions ? /* @__PURE__ */
|
|
2599
|
-
dirty ? /* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2666
|
+
hasActions ? /* @__PURE__ */ jsx15(Table2.Cell, { children: /* @__PURE__ */ jsxs10(Flex5, { gap: "5px", align: "center", wrap: "wrap", children: [
|
|
2667
|
+
dirty ? /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2668
|
+
/* @__PURE__ */ jsx15(
|
|
2601
2669
|
Button6,
|
|
2602
2670
|
{
|
|
2603
2671
|
size: "xs",
|
|
@@ -2616,14 +2684,14 @@ function CoreRelatedGrid({
|
|
|
2616
2684
|
children: "Salvar"
|
|
2617
2685
|
}
|
|
2618
2686
|
),
|
|
2619
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ jsx15(Button6, { size: "xs", variant: "outline", onClick: () => setDrafts((current) => {
|
|
2620
2688
|
const next = { ...current };
|
|
2621
2689
|
delete next[id];
|
|
2622
2690
|
return next;
|
|
2623
2691
|
}), children: "Cancelar" })
|
|
2624
2692
|
] }) : null,
|
|
2625
|
-
tab.rowActions?.map((action) => /* @__PURE__ */
|
|
2626
|
-
canDelete ? /* @__PURE__ */
|
|
2693
|
+
tab.rowActions?.map((action) => /* @__PURE__ */ jsx15(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
|
|
2694
|
+
canDelete ? /* @__PURE__ */ jsx15(
|
|
2627
2695
|
Button6,
|
|
2628
2696
|
{
|
|
2629
2697
|
size: "xs",
|
|
@@ -2636,14 +2704,14 @@ function CoreRelatedGrid({
|
|
|
2636
2704
|
children: "Excluir"
|
|
2637
2705
|
}
|
|
2638
2706
|
) : null,
|
|
2639
|
-
errors[id] ? /* @__PURE__ */
|
|
2707
|
+
errors[id] ? /* @__PURE__ */ jsx15(Text9, { color: "#B42318", fontSize: "9px", children: "Erro ao salvar." }) : null
|
|
2640
2708
|
] }) }) : null
|
|
2641
2709
|
] }, id);
|
|
2642
2710
|
}),
|
|
2643
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
2711
|
+
rows.length === 0 ? /* @__PURE__ */ jsx15(Table2.Row, { children: /* @__PURE__ */ jsx15(Table2.Cell, { colSpan: columns.length + (hasActions ? 1 : 0), children: /* @__PURE__ */ jsx15(Text9, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
|
|
2644
2712
|
] })
|
|
2645
2713
|
] }) }),
|
|
2646
|
-
creating ? /* @__PURE__ */
|
|
2714
|
+
creating ? /* @__PURE__ */ jsx15(
|
|
2647
2715
|
DynamicForm,
|
|
2648
2716
|
{
|
|
2649
2717
|
title: tab.create?.label ?? `Novo ${schema?.singular ?? relation.model}`,
|
|
@@ -2663,7 +2731,7 @@ function CoreRelatedGrid({
|
|
|
2663
2731
|
}
|
|
2664
2732
|
|
|
2665
2733
|
// src/components/internal/CoreTabbedDetail.tsx
|
|
2666
|
-
import { jsx as
|
|
2734
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2667
2735
|
function toValue2(value2, kind) {
|
|
2668
2736
|
if (value2 == null) return "";
|
|
2669
2737
|
if (kind === "date") {
|
|
@@ -2689,20 +2757,6 @@ function initialReactiveValues2(fields, parent) {
|
|
|
2689
2757
|
function isMultiline2(field) {
|
|
2690
2758
|
return /observa|descricao|mensagem|detalhe|necessidade/i.test(field.field);
|
|
2691
2759
|
}
|
|
2692
|
-
function messageOf2(error) {
|
|
2693
|
-
if (!error) return null;
|
|
2694
|
-
if (typeof error === "string") return error;
|
|
2695
|
-
if (error instanceof Error) return error.message;
|
|
2696
|
-
if (typeof error === "object") {
|
|
2697
|
-
const record = error;
|
|
2698
|
-
if (typeof record.message === "string") return record.message;
|
|
2699
|
-
if (record.error && typeof record.error === "object") {
|
|
2700
|
-
const nested = record.error;
|
|
2701
|
-
if (typeof nested.message === "string") return nested.message;
|
|
2702
|
-
}
|
|
2703
|
-
}
|
|
2704
|
-
return "N\xE3o foi poss\xEDvel salvar o registro.";
|
|
2705
|
-
}
|
|
2706
2760
|
function fieldErrorsOf(error) {
|
|
2707
2761
|
if (!error || typeof error !== "object") return {};
|
|
2708
2762
|
const record = error;
|
|
@@ -2749,14 +2803,14 @@ function resolveReference2(field, values) {
|
|
|
2749
2803
|
function FieldLabel({ field, htmlFor }) {
|
|
2750
2804
|
const label = fieldLabel({ name: field.field, label: field.label });
|
|
2751
2805
|
const readonly = Boolean(field.readonly || field.computed);
|
|
2752
|
-
return /* @__PURE__ */
|
|
2806
|
+
return /* @__PURE__ */ jsx16("label", { htmlFor, children: /* @__PURE__ */ jsxs11(Text10, { as: "span", display: "block", mb: "5px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
|
|
2753
2807
|
label,
|
|
2754
|
-
field.required && !readonly ? /* @__PURE__ */
|
|
2755
|
-
readonly ? /* @__PURE__ */
|
|
2808
|
+
field.required && !readonly ? /* @__PURE__ */ jsx16(Text10, { as: "span", color: "#DC2626", children: " *" }) : null,
|
|
2809
|
+
readonly ? /* @__PURE__ */ jsx16(Text10, { as: "span", ml: "5px", color: "#98A2B3", fontSize: "9px", fontWeight: "500", children: "somente leitura" }) : null
|
|
2756
2810
|
] }) });
|
|
2757
2811
|
}
|
|
2758
2812
|
function ErrorText2({ id, message }) {
|
|
2759
|
-
return message ? /* @__PURE__ */
|
|
2813
|
+
return message ? /* @__PURE__ */ jsx16(Text10, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: message }) : null;
|
|
2760
2814
|
}
|
|
2761
2815
|
function FieldControl({
|
|
2762
2816
|
field,
|
|
@@ -2781,9 +2835,9 @@ function FieldControl({
|
|
|
2781
2835
|
const checkedValue = String(field.checkedValue ?? true);
|
|
2782
2836
|
const uncheckedValue = String(field.uncheckedValue ?? false);
|
|
2783
2837
|
const checked = (value2 || uncheckedValue) === checkedValue;
|
|
2784
|
-
return /* @__PURE__ */
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
|
|
2838
|
+
return /* @__PURE__ */ jsxs11(Box9, { children: [
|
|
2839
|
+
/* @__PURE__ */ jsxs11(
|
|
2840
|
+
Box9,
|
|
2787
2841
|
{
|
|
2788
2842
|
as: "label",
|
|
2789
2843
|
display: "flex",
|
|
@@ -2798,7 +2852,7 @@ function FieldControl({
|
|
|
2798
2852
|
borderRadius: "7px",
|
|
2799
2853
|
cursor: readonly ? "not-allowed" : "pointer",
|
|
2800
2854
|
children: [
|
|
2801
|
-
/* @__PURE__ */
|
|
2855
|
+
/* @__PURE__ */ jsx16(
|
|
2802
2856
|
"input",
|
|
2803
2857
|
{
|
|
2804
2858
|
id: inputId,
|
|
@@ -2811,18 +2865,18 @@ function FieldControl({
|
|
|
2811
2865
|
onChange: (event) => onChange(event.currentTarget.checked ? checkedValue : uncheckedValue)
|
|
2812
2866
|
}
|
|
2813
2867
|
),
|
|
2814
|
-
/* @__PURE__ */
|
|
2868
|
+
/* @__PURE__ */ jsx16(Text10, { as: "span", fontSize: "11px", fontWeight: "600", children: label })
|
|
2815
2869
|
]
|
|
2816
2870
|
}
|
|
2817
2871
|
),
|
|
2818
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ jsx16(ErrorText2, { id: errorId, message: error })
|
|
2819
2873
|
] });
|
|
2820
2874
|
}
|
|
2821
2875
|
if (field.kind === "ref" && field.ref) {
|
|
2822
2876
|
const reference = resolveReference2(field, values);
|
|
2823
|
-
return /* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
/* @__PURE__ */
|
|
2877
|
+
return /* @__PURE__ */ jsxs11(Box9, { children: [
|
|
2878
|
+
/* @__PURE__ */ jsx16(FieldLabel, { field, htmlFor: inputId }),
|
|
2879
|
+
/* @__PURE__ */ jsx16(
|
|
2826
2880
|
ReferenceSelect,
|
|
2827
2881
|
{
|
|
2828
2882
|
field: field.field,
|
|
@@ -2845,20 +2899,20 @@ function FieldControl({
|
|
|
2845
2899
|
] });
|
|
2846
2900
|
}
|
|
2847
2901
|
const mask = resolveInputMask(field);
|
|
2848
|
-
const control = field.kind === "enum" && field.options?.length ? /* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
/* @__PURE__ */
|
|
2851
|
-
field.options.map((option) => /* @__PURE__ */
|
|
2902
|
+
const control = field.kind === "enum" && field.options?.length ? /* @__PURE__ */ jsxs11(NativeSelect4.Root, { size: "sm", disabled: readonly, children: [
|
|
2903
|
+
/* @__PURE__ */ jsxs11(NativeSelect4.Field, { id: inputId, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
|
|
2904
|
+
/* @__PURE__ */ jsx16("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2905
|
+
field.options.map((option) => /* @__PURE__ */ jsx16("option", { value: option, children: option }, option))
|
|
2852
2906
|
] }),
|
|
2853
|
-
/* @__PURE__ */
|
|
2854
|
-
] }) : field.kind === "boolean" ? /* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
2907
|
+
/* @__PURE__ */ jsx16(NativeSelect4.Indicator, {})
|
|
2908
|
+
] }) : field.kind === "boolean" ? /* @__PURE__ */ jsxs11(NativeSelect4.Root, { size: "sm", disabled: readonly, children: [
|
|
2909
|
+
/* @__PURE__ */ jsxs11(NativeSelect4.Field, { id: inputId, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
|
|
2910
|
+
/* @__PURE__ */ jsx16("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2911
|
+
/* @__PURE__ */ jsx16("option", { value: "true", children: "Sim" }),
|
|
2912
|
+
/* @__PURE__ */ jsx16("option", { value: "false", children: "N\xE3o" })
|
|
2859
2913
|
] }),
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
] }) : isMultiline2(field) ? /* @__PURE__ */
|
|
2914
|
+
/* @__PURE__ */ jsx16(NativeSelect4.Indicator, {})
|
|
2915
|
+
] }) : isMultiline2(field) ? /* @__PURE__ */ jsx16(Textarea3, { id: inputId, rows: 4, resize: "vertical", readOnly: readonly, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value) }) : /* @__PURE__ */ jsx16(
|
|
2862
2916
|
Input5,
|
|
2863
2917
|
{
|
|
2864
2918
|
id: inputId,
|
|
@@ -2873,10 +2927,10 @@ function FieldControl({
|
|
|
2873
2927
|
onChange: (event) => onChange(parseMaskedInput(event.currentTarget.value, mask))
|
|
2874
2928
|
}
|
|
2875
2929
|
);
|
|
2876
|
-
return /* @__PURE__ */
|
|
2877
|
-
/* @__PURE__ */
|
|
2930
|
+
return /* @__PURE__ */ jsxs11(Box9, { children: [
|
|
2931
|
+
/* @__PURE__ */ jsx16(FieldLabel, { field, htmlFor: inputId }),
|
|
2878
2932
|
control,
|
|
2879
|
-
/* @__PURE__ */
|
|
2933
|
+
/* @__PURE__ */ jsx16(ErrorText2, { id: errorId, message: error })
|
|
2880
2934
|
] });
|
|
2881
2935
|
}
|
|
2882
2936
|
function GroupSection({
|
|
@@ -2889,10 +2943,10 @@ function GroupSection({
|
|
|
2889
2943
|
}) {
|
|
2890
2944
|
if (!fields.length) return null;
|
|
2891
2945
|
const columns = group.columns ?? 2;
|
|
2892
|
-
return /* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2894
|
-
group.description ? /* @__PURE__ */
|
|
2895
|
-
/* @__PURE__ */
|
|
2946
|
+
return /* @__PURE__ */ jsxs11(Box9, { p: { base: "12px", md: "14px" }, bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
|
|
2947
|
+
/* @__PURE__ */ jsx16(Text10, { color: "#344054", fontSize: "12px", fontWeight: "700", children: group.label }),
|
|
2948
|
+
group.description ? /* @__PURE__ */ jsx16(Text10, { mt: "2px", mb: "12px", color: "#667085", fontSize: "10px", children: group.description }) : /* @__PURE__ */ jsx16(Box9, { h: "10px" }),
|
|
2949
|
+
/* @__PURE__ */ jsx16(SimpleGrid3, { columns: { base: 1, md: Math.min(columns, 2), xl: columns }, gapX: "16px", gapY: "14px", children: fields.map((field) => /* @__PURE__ */ jsx16(
|
|
2896
2950
|
FieldControl,
|
|
2897
2951
|
{
|
|
2898
2952
|
field,
|
|
@@ -2980,7 +3034,7 @@ function InlineParentForm({
|
|
|
2980
3034
|
const combinedErrors = { ...formulaErrors, ...fieldErrors };
|
|
2981
3035
|
const renderFields = () => {
|
|
2982
3036
|
if (groups?.length) {
|
|
2983
|
-
return /* @__PURE__ */
|
|
3037
|
+
return /* @__PURE__ */ jsx16(Stack3, { gap: "14px", children: groups.map((group) => /* @__PURE__ */ jsx16(
|
|
2984
3038
|
GroupSection,
|
|
2985
3039
|
{
|
|
2986
3040
|
group,
|
|
@@ -2993,7 +3047,7 @@ function InlineParentForm({
|
|
|
2993
3047
|
`${group.label}-${group.fields.join("-")}`
|
|
2994
3048
|
)) });
|
|
2995
3049
|
}
|
|
2996
|
-
return /* @__PURE__ */
|
|
3050
|
+
return /* @__PURE__ */ jsx16(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: "14px", children: visibleFields.map((field) => /* @__PURE__ */ jsx16(
|
|
2997
3051
|
FieldControl,
|
|
2998
3052
|
{
|
|
2999
3053
|
field,
|
|
@@ -3006,7 +3060,7 @@ function InlineParentForm({
|
|
|
3006
3060
|
field.field
|
|
3007
3061
|
)) });
|
|
3008
3062
|
};
|
|
3009
|
-
return /* @__PURE__ */
|
|
3063
|
+
return /* @__PURE__ */ jsx16(
|
|
3010
3064
|
"form",
|
|
3011
3065
|
{
|
|
3012
3066
|
id: formId,
|
|
@@ -3036,10 +3090,10 @@ function InlineParentForm({
|
|
|
3036
3090
|
setSaving(false);
|
|
3037
3091
|
}
|
|
3038
3092
|
},
|
|
3039
|
-
children: /* @__PURE__ */
|
|
3040
|
-
error ? /* @__PURE__ */
|
|
3093
|
+
children: /* @__PURE__ */ jsxs11(Stack3, { gap: "16px", children: [
|
|
3094
|
+
error ? /* @__PURE__ */ jsx16(CoreErrorAlert, { error }) : null,
|
|
3041
3095
|
renderFields(),
|
|
3042
|
-
!externalSubmit ? /* @__PURE__ */
|
|
3096
|
+
!externalSubmit ? /* @__PURE__ */ jsx16(Flex6, { justify: "flex-end", children: /* @__PURE__ */ jsx16(Button7, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) }) : null
|
|
3043
3097
|
] })
|
|
3044
3098
|
}
|
|
3045
3099
|
);
|
|
@@ -3065,10 +3119,10 @@ function CoreTabbedDetail({
|
|
|
3065
3119
|
const draftFields = useMemo6(() => fieldsForFormTabs(formFields, tabs), [formFields, tabs]);
|
|
3066
3120
|
const formParent = useMemo6(() => parent ?? {}, [parent]);
|
|
3067
3121
|
const hasFormTab = draftFields.length > 0;
|
|
3068
|
-
return /* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3122
|
+
return /* @__PURE__ */ jsxs11(Stack3, { gap: 4, children: [
|
|
3123
|
+
/* @__PURE__ */ jsx16(Flex6, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
|
|
3070
3124
|
const disabled = !parent?._id && (tab.type === "relatedGrid" || tab.type === "readonlyGrid" || tab.type === "summary");
|
|
3071
|
-
return /* @__PURE__ */
|
|
3125
|
+
return /* @__PURE__ */ jsx16(
|
|
3072
3126
|
Button7,
|
|
3073
3127
|
{
|
|
3074
3128
|
type: "button",
|
|
@@ -3081,8 +3135,8 @@ function CoreTabbedDetail({
|
|
|
3081
3135
|
tab.id
|
|
3082
3136
|
);
|
|
3083
3137
|
}) }),
|
|
3084
|
-
/* @__PURE__ */
|
|
3085
|
-
hasFormTab ? /* @__PURE__ */
|
|
3138
|
+
/* @__PURE__ */ jsxs11(Box9, { children: [
|
|
3139
|
+
hasFormTab ? /* @__PURE__ */ jsx16(Box9, { display: activeForm ? "block" : "none", children: /* @__PURE__ */ jsx16(
|
|
3086
3140
|
InlineParentForm,
|
|
3087
3141
|
{
|
|
3088
3142
|
fields: draftFields,
|
|
@@ -3097,7 +3151,7 @@ function CoreTabbedDetail({
|
|
|
3097
3151
|
externalSubmit
|
|
3098
3152
|
}
|
|
3099
3153
|
) }) : null,
|
|
3100
|
-
!active || active.type === "form" ? null : active.type === "summary" && parent ? /* @__PURE__ */
|
|
3154
|
+
!active || active.type === "form" ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx16(CoreSummaryCards, { cards: active.cards, parent, relations }) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx16(
|
|
3101
3155
|
CoreRelatedGrid,
|
|
3102
3156
|
{
|
|
3103
3157
|
tab: active,
|
|
@@ -3106,16 +3160,16 @@ function CoreTabbedDetail({
|
|
|
3106
3160
|
refreshToken: refreshTokens[active.id],
|
|
3107
3161
|
onRefresh
|
|
3108
3162
|
}
|
|
3109
|
-
) : active.type === "customComponent" ? /* @__PURE__ */
|
|
3163
|
+
) : active.type === "customComponent" ? /* @__PURE__ */ jsxs11(Text10, { color: "#667085", children: [
|
|
3110
3164
|
"Componente customizado: ",
|
|
3111
3165
|
active.component
|
|
3112
|
-
] }) : /* @__PURE__ */
|
|
3166
|
+
] }) : /* @__PURE__ */ jsx16(Text10, { color: "#667085", children: "Salve o registro principal para liberar esta aba." })
|
|
3113
3167
|
] })
|
|
3114
3168
|
] });
|
|
3115
3169
|
}
|
|
3116
3170
|
|
|
3117
3171
|
// src/components/internal/CoreDetailModal.tsx
|
|
3118
|
-
import { jsx as
|
|
3172
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3119
3173
|
function CoreDetailModal({ model, title, config, formFields, recordId, initialRecord, initialTab, relations, topActions, bottomActions, onClose, onSaved }) {
|
|
3120
3174
|
const schemaQuery = useModelSchema(model);
|
|
3121
3175
|
const schema = schemaQuery.data;
|
|
@@ -3175,19 +3229,19 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
|
|
|
3175
3229
|
setConfirmingClose(false);
|
|
3176
3230
|
form.requestSubmit();
|
|
3177
3231
|
};
|
|
3178
|
-
return /* @__PURE__ */
|
|
3179
|
-
/* @__PURE__ */
|
|
3180
|
-
/* @__PURE__ */
|
|
3181
|
-
/* @__PURE__ */
|
|
3182
|
-
/* @__PURE__ */
|
|
3183
|
-
/* @__PURE__ */
|
|
3232
|
+
return /* @__PURE__ */ jsx17(DetailRecordProvider, { record: parent, setRecord: setParent, children: /* @__PURE__ */ jsxs12(Flex7, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.48)", children: [
|
|
3233
|
+
/* @__PURE__ */ jsxs12(Box10, { role: "dialog", "aria-modal": "true", display: "flex", flexDirection: "column", w: `min(${width}, 98vw)`, h: "94vh", maxH: "94vh", overflow: "hidden", bg: "white", borderRadius: "14px", boxShadow: "0 24px 70px rgba(15,23,42,.24)", children: [
|
|
3234
|
+
/* @__PURE__ */ jsxs12(Flex7, { minH: "72px", px: "20px", py: "10px", align: "center", justify: "space-between", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
|
|
3235
|
+
/* @__PURE__ */ jsxs12(Box10, { minW: "160px", children: [
|
|
3236
|
+
/* @__PURE__ */ jsx17(Text11, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
|
|
3237
|
+
/* @__PURE__ */ jsx17(Heading3, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
|
|
3184
3238
|
] }),
|
|
3185
|
-
/* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ jsxs12(Flex7, { flex: "1", align: "center", justify: "flex-end", gap: "8px", wrap: "wrap", children: [
|
|
3186
3240
|
recordId ? topActions : null,
|
|
3187
|
-
/* @__PURE__ */
|
|
3241
|
+
/* @__PURE__ */ jsx17(IconButton, { "aria-label": "Fechar", title: "Fechar", size: "sm", minW: "32px", h: "32px", borderRadius: "full", variant: "ghost", color: "#475569", fontSize: "21px", fontWeight: "400", lineHeight: "1", onClick: requestClose, _hover: { bg: "#F1F5F9", color: "#0F172A" }, children: "\xD7" })
|
|
3188
3242
|
] })
|
|
3189
3243
|
] }),
|
|
3190
|
-
/* @__PURE__ */
|
|
3244
|
+
/* @__PURE__ */ jsx17(Box10, { flex: "1", minH: 0, p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx17(Text11, { children: "Carregando..." }) : /* @__PURE__ */ jsx17(
|
|
3191
3245
|
CoreTabbedDetail,
|
|
3192
3246
|
{
|
|
3193
3247
|
tabs: config.tabs,
|
|
@@ -3217,32 +3271,32 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
|
|
|
3217
3271
|
}
|
|
3218
3272
|
}
|
|
3219
3273
|
) }),
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3222
|
-
/* @__PURE__ */
|
|
3274
|
+
/* @__PURE__ */ jsxs12(Flex7, { flex: "0 0 auto", minH: "64px", px: "20px", py: "10px", align: "center", justify: "space-between", gap: "12px", bg: "white", borderTopWidth: "1px", borderColor: "#E5E9ED", boxShadow: "0 -8px 24px rgba(15,23,42,.06)", children: [
|
|
3275
|
+
/* @__PURE__ */ jsx17(Box10, { children: recordId ? bottomActions : null }),
|
|
3276
|
+
/* @__PURE__ */ jsx17(Button8, { type: "submit", form: formId, colorPalette: "brand", disabled: !hasFormTab || !activeIsForm && !dirty || schemaQuery.isLoading || parentQuery.isLoading, children: "Salvar" })
|
|
3223
3277
|
] })
|
|
3224
3278
|
] }),
|
|
3225
|
-
confirmingClose ? /* @__PURE__ */
|
|
3226
|
-
/* @__PURE__ */
|
|
3227
|
-
/* @__PURE__ */
|
|
3228
|
-
/* @__PURE__ */
|
|
3229
|
-
/* @__PURE__ */
|
|
3279
|
+
confirmingClose ? /* @__PURE__ */ jsx17(Flex7, { position: "fixed", inset: 0, zIndex: 1100, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.58)", children: /* @__PURE__ */ jsxs12(Box10, { role: "alertdialog", "aria-modal": "true", "aria-labelledby": "oon-unsaved-title", w: "min(520px, 94vw)", p: "22px", bg: "white", borderRadius: "12px", boxShadow: "0 24px 70px rgba(15,23,42,.28)", children: [
|
|
3280
|
+
/* @__PURE__ */ jsx17(Heading3, { id: "oon-unsaved-title", size: "md", children: "Altera\xE7\xF5es n\xE3o salvas" }),
|
|
3281
|
+
/* @__PURE__ */ jsx17(Text11, { mt: "8px", color: "#667085", fontSize: "13px", children: "As informa\xE7\xF5es preenchidas ainda n\xE3o foram salvas. Voc\xEA pode continuar editando, sair sem salvar ou salvar antes de fechar." }),
|
|
3282
|
+
/* @__PURE__ */ jsxs12(Flex7, { mt: "22px", justify: "flex-end", gap: "10px", wrap: "wrap", children: [
|
|
3283
|
+
/* @__PURE__ */ jsx17(Button8, { variant: "ghost", onClick: () => {
|
|
3230
3284
|
closeAfterSaveRef.current = false;
|
|
3231
3285
|
setConfirmingClose(false);
|
|
3232
3286
|
}, children: "Continuar editando" }),
|
|
3233
|
-
/* @__PURE__ */
|
|
3287
|
+
/* @__PURE__ */ jsx17(Button8, { variant: "outline", colorPalette: "red", onClick: () => {
|
|
3234
3288
|
closeAfterSaveRef.current = false;
|
|
3235
3289
|
setConfirmingClose(false);
|
|
3236
3290
|
onClose();
|
|
3237
3291
|
}, children: "Sair sem salvar" }),
|
|
3238
|
-
/* @__PURE__ */
|
|
3292
|
+
/* @__PURE__ */ jsx17(Button8, { colorPalette: "brand", onClick: saveAndClose, children: "Salvar e sair" })
|
|
3239
3293
|
] })
|
|
3240
3294
|
] }) }) : null
|
|
3241
3295
|
] }) });
|
|
3242
3296
|
}
|
|
3243
3297
|
|
|
3244
3298
|
// src/components/CoreCollection.tsx
|
|
3245
|
-
import { jsx as
|
|
3299
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3246
3300
|
function mergeFormFields(metadataFields, overrides) {
|
|
3247
3301
|
if (!overrides?.length) return metadataFields;
|
|
3248
3302
|
const byField = new Map(overrides.map((field) => [field.field, field]));
|
|
@@ -3284,16 +3338,16 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3284
3338
|
mutationFn: (row) => resource.delete(row._id),
|
|
3285
3339
|
onSuccess: invalidate
|
|
3286
3340
|
});
|
|
3287
|
-
if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */
|
|
3288
|
-
if (needsSchema && schemaQuery.isError) return /* @__PURE__ */
|
|
3341
|
+
if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx18(LoadingScreen, {});
|
|
3342
|
+
if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx18(ErrorState, { error: schemaQuery.error });
|
|
3289
3343
|
const title = label ?? schema?.name ?? model;
|
|
3290
|
-
return /* @__PURE__ */
|
|
3291
|
-
/* @__PURE__ */
|
|
3292
|
-
/* @__PURE__ */
|
|
3293
|
-
/* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */
|
|
3344
|
+
return /* @__PURE__ */ jsxs13(Stack4, { gap: 5, children: [
|
|
3345
|
+
/* @__PURE__ */ jsxs13(Box11, { children: [
|
|
3346
|
+
/* @__PURE__ */ jsx18(Text12, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
|
|
3347
|
+
/* @__PURE__ */ jsx18(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
|
|
3348
|
+
/* @__PURE__ */ jsx18(Text12, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
|
|
3295
3349
|
] }),
|
|
3296
|
-
/* @__PURE__ */
|
|
3350
|
+
/* @__PURE__ */ jsx18(
|
|
3297
3351
|
DataGrid,
|
|
3298
3352
|
{
|
|
3299
3353
|
resource,
|
|
@@ -3314,7 +3368,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3314
3368
|
onDelete: (row) => {
|
|
3315
3369
|
if (window.confirm("Excluir este registro?")) deleteMutation.mutate(row);
|
|
3316
3370
|
},
|
|
3317
|
-
renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */
|
|
3371
|
+
renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx18(
|
|
3318
3372
|
CoreRowAction,
|
|
3319
3373
|
{
|
|
3320
3374
|
action,
|
|
@@ -3326,7 +3380,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3326
3380
|
)) : void 0
|
|
3327
3381
|
}
|
|
3328
3382
|
),
|
|
3329
|
-
formState.open ? /* @__PURE__ */
|
|
3383
|
+
formState.open ? /* @__PURE__ */ jsx18(
|
|
3330
3384
|
DynamicForm,
|
|
3331
3385
|
{
|
|
3332
3386
|
title: formState.row ? `Editar ${title}` : `Novo ${title}`,
|
|
@@ -3347,7 +3401,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3347
3401
|
}
|
|
3348
3402
|
) : null,
|
|
3349
3403
|
importExport ? null : null,
|
|
3350
|
-
detailState.open && detailModal?.enabled ? /* @__PURE__ */
|
|
3404
|
+
detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx18(
|
|
3351
3405
|
CoreDetailModal,
|
|
3352
3406
|
{
|
|
3353
3407
|
model,
|
|
@@ -3366,9 +3420,9 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3366
3420
|
}
|
|
3367
3421
|
|
|
3368
3422
|
// src/components/CoreDocument.tsx
|
|
3369
|
-
import { jsx as
|
|
3423
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3370
3424
|
function CoreDocument({ model, label, endpoint, columns, form }) {
|
|
3371
|
-
return /* @__PURE__ */
|
|
3425
|
+
return /* @__PURE__ */ jsx19(
|
|
3372
3426
|
CoreCollection,
|
|
3373
3427
|
{
|
|
3374
3428
|
model,
|
|
@@ -3383,7 +3437,7 @@ function CoreDocument({ model, label, endpoint, columns, form }) {
|
|
|
3383
3437
|
|
|
3384
3438
|
// src/components/CorePipeline.tsx
|
|
3385
3439
|
import { useEffect as useEffect7, useRef as useRef3, useState as useState11 } from "react";
|
|
3386
|
-
import { Badge as Badge4, Box as
|
|
3440
|
+
import { Badge as Badge4, Box as Box12, Button as Button9, Flex as Flex8, Heading as Heading5, Input as Input6, NativeSelect as NativeSelect5, Stack as Stack5, Text as Text13 } from "@chakra-ui/react";
|
|
3387
3441
|
import { useMutation as useMutation3, useQuery as useQuery7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
3388
3442
|
|
|
3389
3443
|
// src/pipelineTicket.ts
|
|
@@ -3525,7 +3579,7 @@ function pipelineBoardScrollStep(clientWidth) {
|
|
|
3525
3579
|
}
|
|
3526
3580
|
|
|
3527
3581
|
// src/components/CorePipeline.tsx
|
|
3528
|
-
import { jsx as
|
|
3582
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3529
3583
|
function ticketId(row) {
|
|
3530
3584
|
const id = row._id ?? row.id;
|
|
3531
3585
|
return id == null ? void 0 : String(id);
|
|
@@ -3549,7 +3603,7 @@ function workStatusColor(value2) {
|
|
|
3549
3603
|
}
|
|
3550
3604
|
function PipelineArrowIcon({ direction }) {
|
|
3551
3605
|
const path = direction === "left" ? "M12.5 5 7.5 10l5 5" : "m7.5 5 5 5-5 5";
|
|
3552
|
-
return /* @__PURE__ */
|
|
3606
|
+
return /* @__PURE__ */ jsx20("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx20("path", { d: path, fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3553
3607
|
}
|
|
3554
3608
|
function PipelineFilterControl({
|
|
3555
3609
|
filter,
|
|
@@ -3558,7 +3612,7 @@ function PipelineFilterControl({
|
|
|
3558
3612
|
onChange
|
|
3559
3613
|
}) {
|
|
3560
3614
|
if (filter.type === "ref" && meta?.ref) {
|
|
3561
|
-
return /* @__PURE__ */
|
|
3615
|
+
return /* @__PURE__ */ jsx20(Box12, { w: "220px", children: /* @__PURE__ */ jsx20(
|
|
3562
3616
|
ReferenceSelect,
|
|
3563
3617
|
{
|
|
3564
3618
|
field: filter.field,
|
|
@@ -3576,12 +3630,12 @@ function PipelineFilterControl({
|
|
|
3576
3630
|
) });
|
|
3577
3631
|
}
|
|
3578
3632
|
if (filter.type === "select") {
|
|
3579
|
-
return /* @__PURE__ */
|
|
3580
|
-
/* @__PURE__ */
|
|
3581
|
-
/* @__PURE__ */
|
|
3633
|
+
return /* @__PURE__ */ jsxs14(NativeSelect5.Root, { size: "sm", w: "190px", children: [
|
|
3634
|
+
/* @__PURE__ */ jsx20(NativeSelect5.Field, { value: String(value2 ?? ""), onChange: (event) => onChange(event.currentTarget.value), children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx20("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
|
|
3635
|
+
/* @__PURE__ */ jsx20(NativeSelect5.Indicator, {})
|
|
3582
3636
|
] });
|
|
3583
3637
|
}
|
|
3584
|
-
return /* @__PURE__ */
|
|
3638
|
+
return /* @__PURE__ */ jsx20(
|
|
3585
3639
|
Input6,
|
|
3586
3640
|
{
|
|
3587
3641
|
w: "190px",
|
|
@@ -3672,9 +3726,9 @@ function CorePipeline({
|
|
|
3672
3726
|
},
|
|
3673
3727
|
onError: (error) => setFormError(error)
|
|
3674
3728
|
});
|
|
3675
|
-
if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */
|
|
3676
|
-
if (schemaQuery.isError) return /* @__PURE__ */
|
|
3677
|
-
if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */
|
|
3729
|
+
if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */ jsx20(LoadingScreen, {});
|
|
3730
|
+
if (schemaQuery.isError) return /* @__PURE__ */ jsx20(ErrorState, { error: schemaQuery.error });
|
|
3731
|
+
if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */ jsx20(ErrorState, { error: listQuery.error });
|
|
3678
3732
|
const stageFieldMeta = schema?.fields.find((field) => field.name === stageField);
|
|
3679
3733
|
const resolvedStages = stages ?? (stageFieldMeta?.options ?? []).map((option) => ({ id: option, label: option }));
|
|
3680
3734
|
const defaultActionsConfig = defaultActions === false ? void 0 : defaultActions;
|
|
@@ -3715,7 +3769,7 @@ function CorePipeline({
|
|
|
3715
3769
|
const step = pipelineBoardScrollStep(board.clientWidth);
|
|
3716
3770
|
board.scrollBy({ left: direction === "left" ? -step : step, behavior: "smooth" });
|
|
3717
3771
|
};
|
|
3718
|
-
const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */
|
|
3772
|
+
const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */ jsx20(
|
|
3719
3773
|
CoreRowAction,
|
|
3720
3774
|
{
|
|
3721
3775
|
action,
|
|
@@ -3734,29 +3788,29 @@ function CorePipeline({
|
|
|
3734
3788
|
},
|
|
3735
3789
|
action.id ?? `${action.label}-${index}`
|
|
3736
3790
|
) : null;
|
|
3737
|
-
const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */
|
|
3738
|
-
const modalBottomActions = selectedTicket && !creating ? /* @__PURE__ */
|
|
3739
|
-
groupedTicketActions.approval.length ? /* @__PURE__ */
|
|
3740
|
-
groupedTicketActions.custom.length ? /* @__PURE__ */
|
|
3791
|
+
const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */ jsx20(Flex8, { role: "group", "aria-label": "Status da atividade", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.workStatus.map(renderModalAction) }) : null;
|
|
3792
|
+
const modalBottomActions = selectedTicket && !creating ? /* @__PURE__ */ jsxs14(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
|
|
3793
|
+
groupedTicketActions.approval.length ? /* @__PURE__ */ jsx20(Flex8, { role: "group", "aria-label": "Aprova\xE7\xE3o do ticket", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.approval.map(renderModalAction) }) : null,
|
|
3794
|
+
groupedTicketActions.custom.length ? /* @__PURE__ */ jsx20(Flex8, { role: "group", "aria-label": "A\xE7\xF5es do neg\xF3cio", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.custom.map(renderModalAction) }) : null
|
|
3741
3795
|
] }) : null;
|
|
3742
|
-
return /* @__PURE__ */
|
|
3743
|
-
/* @__PURE__ */
|
|
3744
|
-
/* @__PURE__ */
|
|
3745
|
-
/* @__PURE__ */
|
|
3746
|
-
/* @__PURE__ */
|
|
3747
|
-
/* @__PURE__ */
|
|
3796
|
+
return /* @__PURE__ */ jsxs14(Stack5, { gap: 5, children: [
|
|
3797
|
+
/* @__PURE__ */ jsxs14(Flex8, { align: { base: "stretch", md: "flex-end" }, justify: "space-between", gap: 4, direction: { base: "column", md: "row" }, children: [
|
|
3798
|
+
/* @__PURE__ */ jsxs14(Box12, { children: [
|
|
3799
|
+
/* @__PURE__ */ jsx20(Text13, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
|
|
3800
|
+
/* @__PURE__ */ jsx20(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
|
|
3801
|
+
/* @__PURE__ */ jsx20(Text13, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
|
|
3748
3802
|
] }),
|
|
3749
|
-
/* @__PURE__ */
|
|
3750
|
-
allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */
|
|
3751
|
-
create?.enabled ? /* @__PURE__ */
|
|
3803
|
+
/* @__PURE__ */ jsxs14(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
|
|
3804
|
+
allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */ jsx20(Button9, { size: "sm", variant: viewMode === mode ? "solid" : "outline", colorPalette: "brand", onClick: () => setViewMode(mode), children: mode === "board" ? "Quadro" : "Lista" }, mode)) : null,
|
|
3805
|
+
create?.enabled ? /* @__PURE__ */ jsx20(Button9, { size: "sm", colorPalette: "brand", onClick: openCreate, children: create.label ?? "Novo ticket" }) : null
|
|
3752
3806
|
] })
|
|
3753
3807
|
] }),
|
|
3754
|
-
filters.length ? /* @__PURE__ */
|
|
3808
|
+
filters.length ? /* @__PURE__ */ jsxs14(Flex8, { p: "12px", gap: "10px", align: "flex-end", wrap: "wrap", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
|
|
3755
3809
|
filters.map((filter) => {
|
|
3756
3810
|
const meta = schema?.fields.find((field) => field.name === filter.field);
|
|
3757
|
-
return /* @__PURE__ */
|
|
3758
|
-
/* @__PURE__ */
|
|
3759
|
-
/* @__PURE__ */
|
|
3811
|
+
return /* @__PURE__ */ jsxs14(Box12, { children: [
|
|
3812
|
+
/* @__PURE__ */ jsx20(Text13, { mb: "4px", fontSize: "10px", color: "#667085", fontWeight: "600", children: filter.label ?? fieldLabel({ name: filter.field }) }),
|
|
3813
|
+
/* @__PURE__ */ jsx20(
|
|
3760
3814
|
PipelineFilterControl,
|
|
3761
3815
|
{
|
|
3762
3816
|
filter,
|
|
@@ -3767,7 +3821,7 @@ function CorePipeline({
|
|
|
3767
3821
|
)
|
|
3768
3822
|
] }, filter.field);
|
|
3769
3823
|
}),
|
|
3770
|
-
/* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ jsx20(
|
|
3771
3825
|
Button9,
|
|
3772
3826
|
{
|
|
3773
3827
|
size: "sm",
|
|
@@ -3777,7 +3831,7 @@ function CorePipeline({
|
|
|
3777
3831
|
}
|
|
3778
3832
|
)
|
|
3779
3833
|
] }) : null,
|
|
3780
|
-
viewMode === "list" ? /* @__PURE__ */
|
|
3834
|
+
viewMode === "list" ? /* @__PURE__ */ jsx20(
|
|
3781
3835
|
DataGrid,
|
|
3782
3836
|
{
|
|
3783
3837
|
resource,
|
|
@@ -3790,8 +3844,8 @@ function CorePipeline({
|
|
|
3790
3844
|
setSelectedTicket(row);
|
|
3791
3845
|
}
|
|
3792
3846
|
}
|
|
3793
|
-
) : /* @__PURE__ */
|
|
3794
|
-
/* @__PURE__ */
|
|
3847
|
+
) : /* @__PURE__ */ jsxs14(Box12, { position: "relative", children: [
|
|
3848
|
+
/* @__PURE__ */ jsx20(
|
|
3795
3849
|
Flex8,
|
|
3796
3850
|
{
|
|
3797
3851
|
ref: boardRef,
|
|
@@ -3809,14 +3863,14 @@ function CorePipeline({
|
|
|
3809
3863
|
overscrollBehaviorX: "contain",
|
|
3810
3864
|
children: Array.from(byStage.entries()).map(([stageId, items]) => {
|
|
3811
3865
|
const stageLabel = resolvedStages.find((stage) => stage.id === stageId)?.label ?? (stageId || "Sem etapa");
|
|
3812
|
-
return /* @__PURE__ */
|
|
3813
|
-
/* @__PURE__ */
|
|
3814
|
-
/* @__PURE__ */
|
|
3815
|
-
/* @__PURE__ */
|
|
3866
|
+
return /* @__PURE__ */ jsxs14(Box12, { minW: "300px", maxW: "340px", flex: "1 0 300px", bg: "#E8ECEF", borderRadius: "12px", p: 3, borderWidth: "1px", borderColor: "#DDE3E7", children: [
|
|
3867
|
+
/* @__PURE__ */ jsxs14(Flex8, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
|
|
3868
|
+
/* @__PURE__ */ jsx20(Text13, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
|
|
3869
|
+
/* @__PURE__ */ jsx20(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
|
|
3816
3870
|
] }),
|
|
3817
|
-
/* @__PURE__ */
|
|
3871
|
+
/* @__PURE__ */ jsx20(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx20(Box12, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx20(Text13, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
|
|
3818
3872
|
const ticketTitle = formatCell(row[resolvedTitleField], "string");
|
|
3819
|
-
return /* @__PURE__ */
|
|
3873
|
+
return /* @__PURE__ */ jsxs14(
|
|
3820
3874
|
Button9,
|
|
3821
3875
|
{
|
|
3822
3876
|
type: "button",
|
|
@@ -3841,10 +3895,10 @@ function CorePipeline({
|
|
|
3841
3895
|
},
|
|
3842
3896
|
_hover: { borderColor: "brand.300", transform: "translateY(-1px)", boxShadow: "0 7px 18px rgba(7, 38, 46, 0.09)" },
|
|
3843
3897
|
children: [
|
|
3844
|
-
/* @__PURE__ */
|
|
3845
|
-
/* @__PURE__ */
|
|
3846
|
-
/* @__PURE__ */
|
|
3847
|
-
|
|
3898
|
+
/* @__PURE__ */ jsxs14(Flex8, { align: "flex-start", justify: "space-between", gap: "8px", mb: 2, children: [
|
|
3899
|
+
/* @__PURE__ */ jsx20(Text13, { fontSize: "13px", fontWeight: "700", color: "#24323A", lineClamp: 2, children: ticketTitle }),
|
|
3900
|
+
/* @__PURE__ */ jsx20(
|
|
3901
|
+
Box12,
|
|
3848
3902
|
{
|
|
3849
3903
|
as: "span",
|
|
3850
3904
|
title: `Status da atividade: ${String(row[workStatusField] ?? "N\xE3o informado")}`,
|
|
@@ -3859,9 +3913,9 @@ function CorePipeline({
|
|
|
3859
3913
|
}
|
|
3860
3914
|
)
|
|
3861
3915
|
] }),
|
|
3862
|
-
/* @__PURE__ */
|
|
3863
|
-
/* @__PURE__ */
|
|
3864
|
-
/* @__PURE__ */
|
|
3916
|
+
/* @__PURE__ */ jsx20(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs14(Flex8, { gap: 2, align: "baseline", justify: "space-between", children: [
|
|
3917
|
+
/* @__PURE__ */ jsx20(Text13, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
|
|
3918
|
+
/* @__PURE__ */ jsx20(Text13, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
|
|
3865
3919
|
] }, field.name)) })
|
|
3866
3920
|
]
|
|
3867
3921
|
},
|
|
@@ -3872,7 +3926,7 @@ function CorePipeline({
|
|
|
3872
3926
|
})
|
|
3873
3927
|
}
|
|
3874
3928
|
),
|
|
3875
|
-
/* @__PURE__ */
|
|
3929
|
+
/* @__PURE__ */ jsx20(
|
|
3876
3930
|
Button9,
|
|
3877
3931
|
{
|
|
3878
3932
|
type: "button",
|
|
@@ -3896,10 +3950,10 @@ function CorePipeline({
|
|
|
3896
3950
|
onClick: () => scrollBoard("left"),
|
|
3897
3951
|
_hover: { bg: "white", borderColor: "brand.400" },
|
|
3898
3952
|
_disabled: { opacity: 0.25, cursor: "not-allowed" },
|
|
3899
|
-
children: /* @__PURE__ */
|
|
3953
|
+
children: /* @__PURE__ */ jsx20(PipelineArrowIcon, { direction: "left" })
|
|
3900
3954
|
}
|
|
3901
3955
|
),
|
|
3902
|
-
/* @__PURE__ */
|
|
3956
|
+
/* @__PURE__ */ jsx20(
|
|
3903
3957
|
Button9,
|
|
3904
3958
|
{
|
|
3905
3959
|
type: "button",
|
|
@@ -3923,11 +3977,11 @@ function CorePipeline({
|
|
|
3923
3977
|
onClick: () => scrollBoard("right"),
|
|
3924
3978
|
_hover: { bg: "white", borderColor: "brand.400" },
|
|
3925
3979
|
_disabled: { opacity: 0.25, cursor: "not-allowed" },
|
|
3926
|
-
children: /* @__PURE__ */
|
|
3980
|
+
children: /* @__PURE__ */ jsx20(PipelineArrowIcon, { direction: "right" })
|
|
3927
3981
|
}
|
|
3928
3982
|
)
|
|
3929
3983
|
] }),
|
|
3930
|
-
selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */
|
|
3984
|
+
selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */ jsx20(
|
|
3931
3985
|
CoreDetailModal,
|
|
3932
3986
|
{
|
|
3933
3987
|
model,
|
|
@@ -3953,7 +4007,7 @@ function CorePipeline({
|
|
|
3953
4007
|
}
|
|
3954
4008
|
}
|
|
3955
4009
|
}
|
|
3956
|
-
) : selectedTicket ? /* @__PURE__ */
|
|
4010
|
+
) : selectedTicket ? /* @__PURE__ */ jsx20(
|
|
3957
4011
|
DynamicForm,
|
|
3958
4012
|
{
|
|
3959
4013
|
title: `${creating ? "Novo" : "Editar"} ${schema?.singular ?? label ?? model}`,
|
|
@@ -3980,9 +4034,9 @@ function CorePipeline({
|
|
|
3980
4034
|
}
|
|
3981
4035
|
|
|
3982
4036
|
// src/components/CoreDashboard.tsx
|
|
3983
|
-
import { Box as
|
|
4037
|
+
import { Box as Box13, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text14 } from "@chakra-ui/react";
|
|
3984
4038
|
import { useQueries } from "@tanstack/react-query";
|
|
3985
|
-
import { jsx as
|
|
4039
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3986
4040
|
function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
3987
4041
|
const { resource } = useOonApi();
|
|
3988
4042
|
const queries = useQueries({
|
|
@@ -3999,17 +4053,17 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
|
3999
4053
|
}))
|
|
4000
4054
|
});
|
|
4001
4055
|
let queryIdx = 0;
|
|
4002
|
-
return /* @__PURE__ */
|
|
4003
|
-
/* @__PURE__ */
|
|
4004
|
-
/* @__PURE__ */
|
|
4056
|
+
return /* @__PURE__ */ jsxs15(Stack6, { gap: 6, children: [
|
|
4057
|
+
/* @__PURE__ */ jsx21(Heading6, { size: "lg", children: label }),
|
|
4058
|
+
/* @__PURE__ */ jsx21(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
|
|
4005
4059
|
if (w.kind === "custom" && w.render) {
|
|
4006
|
-
return /* @__PURE__ */
|
|
4060
|
+
return /* @__PURE__ */ jsx21(Box13, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
|
|
4007
4061
|
}
|
|
4008
4062
|
const q = queries[queryIdx++];
|
|
4009
4063
|
const value2 = q?.isLoading ? "\u2026" : q?.isError ? "\u2014" : formatWidget(q?.data, w.kind, w.field);
|
|
4010
|
-
return /* @__PURE__ */
|
|
4011
|
-
/* @__PURE__ */
|
|
4012
|
-
/* @__PURE__ */
|
|
4064
|
+
return /* @__PURE__ */ jsxs15(Box13, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
|
|
4065
|
+
/* @__PURE__ */ jsx21(Text14, { fontSize: "sm", color: "gray.500", children: w.label }),
|
|
4066
|
+
/* @__PURE__ */ jsx21(Heading6, { size: "xl", mt: 1, children: value2 })
|
|
4013
4067
|
] }, w.id);
|
|
4014
4068
|
}) })
|
|
4015
4069
|
] });
|
|
@@ -4023,22 +4077,22 @@ function formatWidget(value2, kind, field) {
|
|
|
4023
4077
|
}
|
|
4024
4078
|
|
|
4025
4079
|
// src/components/ui-v2/CorePage.tsx
|
|
4026
|
-
import { Box as
|
|
4080
|
+
import { Box as Box16, Heading as Heading8, Stack as Stack7, Text as Text17 } from "@chakra-ui/react";
|
|
4027
4081
|
|
|
4028
4082
|
// src/security/PermissionGate.tsx
|
|
4029
|
-
import { Fragment as Fragment3, jsx as
|
|
4083
|
+
import { Fragment as Fragment3, jsx as jsx22 } from "react/jsx-runtime";
|
|
4030
4084
|
function PermissionGate({
|
|
4031
4085
|
permission,
|
|
4032
4086
|
fallback = null,
|
|
4033
4087
|
children
|
|
4034
4088
|
}) {
|
|
4035
4089
|
const { hasPermission } = useOonAuth();
|
|
4036
|
-
return /* @__PURE__ */
|
|
4090
|
+
return /* @__PURE__ */ jsx22(Fragment3, { children: hasPermission(permission) ? children : fallback });
|
|
4037
4091
|
}
|
|
4038
4092
|
|
|
4039
4093
|
// src/app/componentRegistry.tsx
|
|
4040
|
-
import { Box as
|
|
4041
|
-
import { Fragment as Fragment4, jsx as
|
|
4094
|
+
import { Box as Box14, Text as Text15 } from "@chakra-ui/react";
|
|
4095
|
+
import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4042
4096
|
var PREFIX_BUCKETS = {
|
|
4043
4097
|
"custom": "pageComponents",
|
|
4044
4098
|
"fields": "fieldRenderers",
|
|
@@ -4058,12 +4112,12 @@ function resolveComponent(registry, key, bucket) {
|
|
|
4058
4112
|
return registry?.[targetBucket]?.[normalized2] ?? registry?.[targetBucket]?.[key] ?? null;
|
|
4059
4113
|
}
|
|
4060
4114
|
function MissingRenderer({ renderer, children }) {
|
|
4061
|
-
if (import.meta.env?.MODE === "production") return /* @__PURE__ */
|
|
4062
|
-
return /* @__PURE__ */
|
|
4063
|
-
/* @__PURE__ */
|
|
4064
|
-
/* @__PURE__ */
|
|
4115
|
+
if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx23(Fragment4, { children: children ?? null });
|
|
4116
|
+
return /* @__PURE__ */ jsxs16(Box14, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
|
|
4117
|
+
/* @__PURE__ */ jsx23(Text15, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
|
|
4118
|
+
/* @__PURE__ */ jsxs16(Text15, { fontSize: "xs", children: [
|
|
4065
4119
|
"Registre a chave ",
|
|
4066
|
-
renderer ? /* @__PURE__ */
|
|
4120
|
+
renderer ? /* @__PURE__ */ jsx23("code", { children: renderer }) : "solicitada",
|
|
4067
4121
|
" no registry da UI."
|
|
4068
4122
|
] }),
|
|
4069
4123
|
children
|
|
@@ -4071,61 +4125,61 @@ function MissingRenderer({ renderer, children }) {
|
|
|
4071
4125
|
}
|
|
4072
4126
|
|
|
4073
4127
|
// src/components/ui-v2/CorePrimitives.tsx
|
|
4074
|
-
import { Box as
|
|
4075
|
-
import { jsx as
|
|
4128
|
+
import { Box as Box15, Button as Button10, Flex as Flex9, Heading as Heading7, Spinner as Spinner3, Text as Text16 } from "@chakra-ui/react";
|
|
4129
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4076
4130
|
function CorePage({ children }) {
|
|
4077
|
-
return /* @__PURE__ */
|
|
4131
|
+
return /* @__PURE__ */ jsx24(Box15, { children });
|
|
4078
4132
|
}
|
|
4079
4133
|
function CorePageHeader({ title, description, actions }) {
|
|
4080
|
-
return /* @__PURE__ */
|
|
4081
|
-
/* @__PURE__ */
|
|
4082
|
-
title ? /* @__PURE__ */
|
|
4083
|
-
description ? /* @__PURE__ */
|
|
4134
|
+
return /* @__PURE__ */ jsxs17(Flex9, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
|
|
4135
|
+
/* @__PURE__ */ jsxs17(Box15, { children: [
|
|
4136
|
+
title ? /* @__PURE__ */ jsx24(Heading7, { size: "lg", children: title }) : null,
|
|
4137
|
+
description ? /* @__PURE__ */ jsx24(Text16, { color: "gray.600", mt: 1, children: description }) : null
|
|
4084
4138
|
] }),
|
|
4085
4139
|
actions
|
|
4086
4140
|
] });
|
|
4087
4141
|
}
|
|
4088
4142
|
function CoreToolbar({ children }) {
|
|
4089
|
-
return /* @__PURE__ */
|
|
4143
|
+
return /* @__PURE__ */ jsx24(Flex9, { align: "center", gap: 2, mb: 4, children });
|
|
4090
4144
|
}
|
|
4091
4145
|
function CoreDataGrid(props) {
|
|
4092
|
-
return /* @__PURE__ */
|
|
4146
|
+
return /* @__PURE__ */ jsx24(CoreCollection, { ...props });
|
|
4093
4147
|
}
|
|
4094
4148
|
function CoreCards(props) {
|
|
4095
|
-
return /* @__PURE__ */
|
|
4149
|
+
return /* @__PURE__ */ jsx24(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
|
|
4096
4150
|
}
|
|
4097
4151
|
function CoreForm(props) {
|
|
4098
|
-
return /* @__PURE__ */
|
|
4152
|
+
return /* @__PURE__ */ jsx24(Box15, { children: props.children });
|
|
4099
4153
|
}
|
|
4100
4154
|
function CoreField({ label, children }) {
|
|
4101
|
-
return /* @__PURE__ */
|
|
4102
|
-
/* @__PURE__ */
|
|
4155
|
+
return /* @__PURE__ */ jsxs17(Box15, { children: [
|
|
4156
|
+
/* @__PURE__ */ jsx24(Text16, { fontSize: "sm", fontWeight: "600", children: label }),
|
|
4103
4157
|
children
|
|
4104
4158
|
] });
|
|
4105
4159
|
}
|
|
4106
4160
|
function CoreRelationField(props) {
|
|
4107
|
-
return /* @__PURE__ */
|
|
4161
|
+
return /* @__PURE__ */ jsx24(CoreField, { ...props });
|
|
4108
4162
|
}
|
|
4109
4163
|
function CoreActions({ children }) {
|
|
4110
|
-
return /* @__PURE__ */
|
|
4164
|
+
return /* @__PURE__ */ jsx24(Flex9, { gap: 2, children });
|
|
4111
4165
|
}
|
|
4112
4166
|
function CoreEmptyState({ title = "Nenhum dado encontrado", actionLabel, onAction }) {
|
|
4113
|
-
return /* @__PURE__ */
|
|
4114
|
-
/* @__PURE__ */
|
|
4115
|
-
actionLabel ? /* @__PURE__ */
|
|
4167
|
+
return /* @__PURE__ */ jsxs17(Box15, { textAlign: "center", py: 10, children: [
|
|
4168
|
+
/* @__PURE__ */ jsx24(Text16, { children: title }),
|
|
4169
|
+
actionLabel ? /* @__PURE__ */ jsx24(Button10, { mt: 3, onClick: onAction, children: actionLabel }) : null
|
|
4116
4170
|
] });
|
|
4117
4171
|
}
|
|
4118
4172
|
function CoreLoadingState({ label = "Carregando..." }) {
|
|
4119
|
-
return /* @__PURE__ */
|
|
4120
|
-
/* @__PURE__ */
|
|
4121
|
-
/* @__PURE__ */
|
|
4173
|
+
return /* @__PURE__ */ jsxs17(Flex9, { align: "center", gap: 3, children: [
|
|
4174
|
+
/* @__PURE__ */ jsx24(Spinner3, { size: "sm" }),
|
|
4175
|
+
/* @__PURE__ */ jsx24(Text16, { children: label })
|
|
4122
4176
|
] });
|
|
4123
4177
|
}
|
|
4124
4178
|
|
|
4125
4179
|
// src/components/ui-v2/CorePage.tsx
|
|
4126
|
-
import { jsx as
|
|
4180
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4127
4181
|
function renderMarkdown(content) {
|
|
4128
|
-
return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */
|
|
4182
|
+
return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx25(Text17, { whiteSpace: "pre-wrap", children: paragraph }, index));
|
|
4129
4183
|
}
|
|
4130
4184
|
function requiredAccess(source) {
|
|
4131
4185
|
const values = [...source.permissions ?? [], ...source.capabilities ?? []].filter(Boolean);
|
|
@@ -4137,38 +4191,38 @@ function CoreBlock({ block, registry }) {
|
|
|
4137
4191
|
switch (block.type) {
|
|
4138
4192
|
case "custom": {
|
|
4139
4193
|
const Component = resolveComponent(registry, block.component, "pageComponents");
|
|
4140
|
-
return Component ? /* @__PURE__ */
|
|
4194
|
+
return Component ? /* @__PURE__ */ jsx25(Component, { block, ...block.props }) : /* @__PURE__ */ jsx25(MissingRenderer, { renderer: block.component });
|
|
4141
4195
|
}
|
|
4142
4196
|
case "collection.datagrid":
|
|
4143
|
-
return /* @__PURE__ */
|
|
4197
|
+
return /* @__PURE__ */ jsx25(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
|
|
4144
4198
|
case "collection.cards": {
|
|
4145
4199
|
const Component = resolveComponent(registry, block.renderer, "cardRenderers");
|
|
4146
|
-
return Component ? /* @__PURE__ */
|
|
4200
|
+
return Component ? /* @__PURE__ */ jsx25(Component, { block, model: block.model }) : /* @__PURE__ */ jsx25(CoreCards, { model: block.model, renderer: block.renderer });
|
|
4147
4201
|
}
|
|
4148
4202
|
case "section":
|
|
4149
|
-
return /* @__PURE__ */
|
|
4150
|
-
/* @__PURE__ */
|
|
4151
|
-
block.description ? /* @__PURE__ */
|
|
4152
|
-
/* @__PURE__ */
|
|
4203
|
+
return /* @__PURE__ */ jsxs18(Box16, { children: [
|
|
4204
|
+
/* @__PURE__ */ jsx25(Heading8, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
|
|
4205
|
+
block.description ? /* @__PURE__ */ jsx25(Text17, { color: "gray.600", mb: 4, children: block.description }) : null,
|
|
4206
|
+
/* @__PURE__ */ jsx25(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx25(CoreBlock, { block: child, registry }, child.id ?? index)) })
|
|
4153
4207
|
] });
|
|
4154
4208
|
case "markdown":
|
|
4155
|
-
return /* @__PURE__ */
|
|
4209
|
+
return /* @__PURE__ */ jsx25(Stack7, { gap: 2, children: renderMarkdown(block.content) });
|
|
4156
4210
|
default:
|
|
4157
|
-
return /* @__PURE__ */
|
|
4211
|
+
return /* @__PURE__ */ jsx25(MissingRenderer, { renderer: block.type });
|
|
4158
4212
|
}
|
|
4159
4213
|
})();
|
|
4160
|
-
return /* @__PURE__ */
|
|
4214
|
+
return /* @__PURE__ */ jsx25(PermissionGate, { permission: requiredAccess(block), children: content });
|
|
4161
4215
|
}
|
|
4162
4216
|
function CorePage2({ page, registry }) {
|
|
4163
4217
|
const Component = resolveComponent(registry, page.component, "pageComponents");
|
|
4164
|
-
return /* @__PURE__ */
|
|
4165
|
-
/* @__PURE__ */
|
|
4166
|
-
/* @__PURE__ */
|
|
4218
|
+
return /* @__PURE__ */ jsx25(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx25(Component, { page }) : /* @__PURE__ */ jsxs18(CorePage, { children: [
|
|
4219
|
+
/* @__PURE__ */ jsx25(CorePageHeader, { title: page.title ?? page.label }),
|
|
4220
|
+
/* @__PURE__ */ jsx25(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx25(CoreBlock, { block, registry }, block.id ?? index)) })
|
|
4167
4221
|
] }) });
|
|
4168
4222
|
}
|
|
4169
4223
|
|
|
4170
4224
|
// src/app/moduleRegistry.tsx
|
|
4171
|
-
import { jsx as
|
|
4225
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
4172
4226
|
function slug2(value2) {
|
|
4173
4227
|
return value2.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
4174
4228
|
}
|
|
@@ -4195,7 +4249,7 @@ function renderView(view, registry) {
|
|
|
4195
4249
|
switch (view.type) {
|
|
4196
4250
|
case "collection": {
|
|
4197
4251
|
const v = view;
|
|
4198
|
-
return /* @__PURE__ */
|
|
4252
|
+
return /* @__PURE__ */ jsx26(
|
|
4199
4253
|
CoreCollection,
|
|
4200
4254
|
{
|
|
4201
4255
|
model: v.model,
|
|
@@ -4214,11 +4268,11 @@ function renderView(view, registry) {
|
|
|
4214
4268
|
}
|
|
4215
4269
|
case "document": {
|
|
4216
4270
|
const v = view;
|
|
4217
|
-
return /* @__PURE__ */
|
|
4271
|
+
return /* @__PURE__ */ jsx26(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
|
|
4218
4272
|
}
|
|
4219
4273
|
case "pipeline": {
|
|
4220
4274
|
const v = view;
|
|
4221
|
-
return /* @__PURE__ */
|
|
4275
|
+
return /* @__PURE__ */ jsx26(
|
|
4222
4276
|
CorePipeline,
|
|
4223
4277
|
{
|
|
4224
4278
|
model: v.model,
|
|
@@ -4241,7 +4295,7 @@ function renderView(view, registry) {
|
|
|
4241
4295
|
}
|
|
4242
4296
|
case "dashboard": {
|
|
4243
4297
|
const v = view;
|
|
4244
|
-
return /* @__PURE__ */
|
|
4298
|
+
return /* @__PURE__ */ jsx26(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
|
|
4245
4299
|
}
|
|
4246
4300
|
default:
|
|
4247
4301
|
return null;
|
|
@@ -4255,7 +4309,7 @@ function viewToRoute(view, registry) {
|
|
|
4255
4309
|
};
|
|
4256
4310
|
}
|
|
4257
4311
|
function pageToRoute(page, registry) {
|
|
4258
|
-
return { path: page.path, element: /* @__PURE__ */
|
|
4312
|
+
return { path: page.path, element: /* @__PURE__ */ jsx26(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
|
|
4259
4313
|
}
|
|
4260
4314
|
function pageToMenu(page) {
|
|
4261
4315
|
if (page.hidden || !page.label) return null;
|
|
@@ -4317,13 +4371,13 @@ import {
|
|
|
4317
4371
|
} from "react-router-dom";
|
|
4318
4372
|
|
|
4319
4373
|
// src/shell/DefaultShell.tsx
|
|
4320
|
-
import { Box as
|
|
4374
|
+
import { Box as Box18, Button as Button11, Flex as Flex11, Spacer as Spacer2, Text as Text19 } from "@chakra-ui/react";
|
|
4321
4375
|
import { Outlet } from "react-router-dom";
|
|
4322
4376
|
|
|
4323
4377
|
// src/shell/Sidebar.tsx
|
|
4324
|
-
import { Box as
|
|
4378
|
+
import { Box as Box17, Flex as Flex10, Image, Stack as Stack8, Text as Text18 } from "@chakra-ui/react";
|
|
4325
4379
|
import { NavLink } from "react-router-dom";
|
|
4326
|
-
import { jsx as
|
|
4380
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4327
4381
|
function groupBySection(items) {
|
|
4328
4382
|
const groups = /* @__PURE__ */ new Map();
|
|
4329
4383
|
for (const item of items) {
|
|
@@ -4336,8 +4390,8 @@ function groupBySection(items) {
|
|
|
4336
4390
|
function Sidebar({ app, menu, registry }) {
|
|
4337
4391
|
const { hasPermission } = useOonAuth();
|
|
4338
4392
|
const visible = menu.filter((item) => !item.hidden && hasPermission(item.permissions));
|
|
4339
|
-
return /* @__PURE__ */
|
|
4340
|
-
|
|
4393
|
+
return /* @__PURE__ */ jsxs19(
|
|
4394
|
+
Box17,
|
|
4341
4395
|
{
|
|
4342
4396
|
as: "nav",
|
|
4343
4397
|
w: { base: "76px", lg: "248px" },
|
|
@@ -4352,8 +4406,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4352
4406
|
alignSelf: "flex-start",
|
|
4353
4407
|
overflowY: "auto",
|
|
4354
4408
|
children: [
|
|
4355
|
-
/* @__PURE__ */
|
|
4356
|
-
app.logo ? /* @__PURE__ */
|
|
4409
|
+
/* @__PURE__ */ jsxs19(Flex10, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
|
|
4410
|
+
app.logo ? /* @__PURE__ */ jsx27(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx27(
|
|
4357
4411
|
Flex10,
|
|
4358
4412
|
{
|
|
4359
4413
|
w: "38px",
|
|
@@ -4369,14 +4423,14 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4369
4423
|
children: "O"
|
|
4370
4424
|
}
|
|
4371
4425
|
),
|
|
4372
|
-
/* @__PURE__ */
|
|
4373
|
-
/* @__PURE__ */
|
|
4374
|
-
/* @__PURE__ */
|
|
4426
|
+
/* @__PURE__ */ jsxs19(Box17, { display: { base: "none", lg: "block" }, minW: 0, children: [
|
|
4427
|
+
/* @__PURE__ */ jsx27(Text18, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
|
|
4428
|
+
/* @__PURE__ */ jsx27(Text18, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
|
|
4375
4429
|
] })
|
|
4376
4430
|
] }),
|
|
4377
|
-
/* @__PURE__ */
|
|
4378
|
-
/* @__PURE__ */
|
|
4379
|
-
|
|
4431
|
+
/* @__PURE__ */ jsx27(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs19(Stack8, { gap: 1, children: [
|
|
4432
|
+
/* @__PURE__ */ jsx27(
|
|
4433
|
+
Text18,
|
|
4380
4434
|
{
|
|
4381
4435
|
display: { base: "none", lg: "block" },
|
|
4382
4436
|
fontSize: "10px",
|
|
@@ -4391,8 +4445,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4391
4445
|
),
|
|
4392
4446
|
items.map((item) => {
|
|
4393
4447
|
const CustomMenuItem = resolveComponent(registry, item.renderer, "menuRenderers");
|
|
4394
|
-
if (CustomMenuItem) return /* @__PURE__ */
|
|
4395
|
-
return /* @__PURE__ */
|
|
4448
|
+
if (CustomMenuItem) return /* @__PURE__ */ jsx27(CustomMenuItem, { item }, item.href);
|
|
4449
|
+
return /* @__PURE__ */ jsx27(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs19(
|
|
4396
4450
|
Flex10,
|
|
4397
4451
|
{
|
|
4398
4452
|
align: "center",
|
|
@@ -4410,8 +4464,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4410
4464
|
transition: "all 0.15s ease",
|
|
4411
4465
|
_hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
|
|
4412
4466
|
children: [
|
|
4413
|
-
item.icon ? /* @__PURE__ */
|
|
4414
|
-
/* @__PURE__ */
|
|
4467
|
+
item.icon ? /* @__PURE__ */ jsx27(Box17, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx27(Box17, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
|
|
4468
|
+
/* @__PURE__ */ jsx27(Text18, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
|
|
4415
4469
|
]
|
|
4416
4470
|
}
|
|
4417
4471
|
) }, item.href);
|
|
@@ -4425,7 +4479,7 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4425
4479
|
// package.json
|
|
4426
4480
|
var package_default = {
|
|
4427
4481
|
name: "@oondemand/oon-core-front",
|
|
4428
|
-
version: "0.3.
|
|
4482
|
+
version: "0.3.54",
|
|
4429
4483
|
repository: {
|
|
4430
4484
|
type: "git",
|
|
4431
4485
|
url: "git+https://github.com/oondemand/oon-platform.git",
|
|
@@ -4544,7 +4598,7 @@ function shortCommit(commit) {
|
|
|
4544
4598
|
}
|
|
4545
4599
|
|
|
4546
4600
|
// src/shell/DefaultShell.tsx
|
|
4547
|
-
import { jsx as
|
|
4601
|
+
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4548
4602
|
function CoreTopbar({ app }) {
|
|
4549
4603
|
const { user, logout } = useOonAuth();
|
|
4550
4604
|
const metadataQuery = useCoreMetadata();
|
|
@@ -4567,7 +4621,7 @@ function CoreTopbar({ app }) {
|
|
|
4567
4621
|
runtime.releaseId ? `Release ${runtime.releaseId}` : void 0,
|
|
4568
4622
|
runtime.startedAt ? `Backend iniciado ${formatRuntimeDate(runtime.startedAt)}` : void 0
|
|
4569
4623
|
].filter(Boolean).join(" \xB7 ");
|
|
4570
|
-
return /* @__PURE__ */
|
|
4624
|
+
return /* @__PURE__ */ jsxs20(
|
|
4571
4625
|
Flex11,
|
|
4572
4626
|
{
|
|
4573
4627
|
as: "header",
|
|
@@ -4583,9 +4637,9 @@ function CoreTopbar({ app }) {
|
|
|
4583
4637
|
top: 0,
|
|
4584
4638
|
zIndex: 10,
|
|
4585
4639
|
children: [
|
|
4586
|
-
/* @__PURE__ */
|
|
4587
|
-
/* @__PURE__ */
|
|
4588
|
-
|
|
4640
|
+
/* @__PURE__ */ jsxs20(Box18, { minW: 0, title: details, children: [
|
|
4641
|
+
/* @__PURE__ */ jsx28(
|
|
4642
|
+
Text19,
|
|
4589
4643
|
{
|
|
4590
4644
|
fontSize: "xs",
|
|
4591
4645
|
fontWeight: "600",
|
|
@@ -4595,8 +4649,8 @@ function CoreTopbar({ app }) {
|
|
|
4595
4649
|
children: "Central Oon"
|
|
4596
4650
|
}
|
|
4597
4651
|
),
|
|
4598
|
-
/* @__PURE__ */
|
|
4599
|
-
/* @__PURE__ */
|
|
4652
|
+
/* @__PURE__ */ jsx28(Text19, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name }),
|
|
4653
|
+
/* @__PURE__ */ jsxs20(Text19, { fontSize: "10px", color: "gray.600", lineHeight: "1.35", children: [
|
|
4600
4654
|
"Central ",
|
|
4601
4655
|
centralVersion,
|
|
4602
4656
|
" \xB7 Front ",
|
|
@@ -4604,15 +4658,15 @@ function CoreTopbar({ app }) {
|
|
|
4604
4658
|
" \xB7 Back ",
|
|
4605
4659
|
backendVersion
|
|
4606
4660
|
] }),
|
|
4607
|
-
publicationParts.length ? /* @__PURE__ */
|
|
4661
|
+
publicationParts.length ? /* @__PURE__ */ jsx28(Text19, { fontSize: "10px", color: "gray.500", lineHeight: "1.35", children: publicationParts.join(" \xB7 ") }) : null
|
|
4608
4662
|
] }),
|
|
4609
|
-
/* @__PURE__ */
|
|
4610
|
-
user ? /* @__PURE__ */
|
|
4611
|
-
/* @__PURE__ */
|
|
4612
|
-
/* @__PURE__ */
|
|
4613
|
-
user.email ? /* @__PURE__ */
|
|
4663
|
+
/* @__PURE__ */ jsx28(Spacer2, {}),
|
|
4664
|
+
user ? /* @__PURE__ */ jsxs20(Flex11, { align: "center", gap: 3, children: [
|
|
4665
|
+
/* @__PURE__ */ jsxs20(Box18, { textAlign: "right", display: { base: "none", md: "block" }, children: [
|
|
4666
|
+
/* @__PURE__ */ jsx28(Text19, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
|
|
4667
|
+
user.email ? /* @__PURE__ */ jsx28(Text19, { fontSize: "xs", color: "gray.500", children: user.email }) : null
|
|
4614
4668
|
] }),
|
|
4615
|
-
/* @__PURE__ */
|
|
4669
|
+
/* @__PURE__ */ jsx28(
|
|
4616
4670
|
Button11,
|
|
4617
4671
|
{
|
|
4618
4672
|
size: "sm",
|
|
@@ -4638,12 +4692,12 @@ function Slot({
|
|
|
4638
4692
|
if (slot === "none") return null;
|
|
4639
4693
|
if (slot?.startsWith("custom:")) {
|
|
4640
4694
|
const Component = resolveComponent(registry, slot, "layoutSlots");
|
|
4641
|
-
return Component ? /* @__PURE__ */
|
|
4695
|
+
return Component ? /* @__PURE__ */ jsx28(Component, { app, menu }) : /* @__PURE__ */ jsx28(MissingRenderer, { renderer: slot });
|
|
4642
4696
|
}
|
|
4643
|
-
if (name === "sidebar") return /* @__PURE__ */
|
|
4644
|
-
if (name === "topbar") return /* @__PURE__ */
|
|
4697
|
+
if (name === "sidebar") return /* @__PURE__ */ jsx28(Sidebar, { app, menu, registry });
|
|
4698
|
+
if (name === "topbar") return /* @__PURE__ */ jsx28(CoreTopbar, { app });
|
|
4645
4699
|
if (name === "footer" && slot === "core") {
|
|
4646
|
-
return /* @__PURE__ */
|
|
4700
|
+
return /* @__PURE__ */ jsx28(Box18, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
|
|
4647
4701
|
}
|
|
4648
4702
|
return null;
|
|
4649
4703
|
}
|
|
@@ -4655,8 +4709,8 @@ function DefaultShell({
|
|
|
4655
4709
|
}) {
|
|
4656
4710
|
const portal = layout?.shell === "portal" || layout?.shell === "content-only";
|
|
4657
4711
|
const mainPadding = portal ? { base: 4, lg: 10 } : { base: 4, lg: 6 };
|
|
4658
|
-
return /* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4712
|
+
return /* @__PURE__ */ jsxs20(Flex11, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
|
|
4713
|
+
/* @__PURE__ */ jsx28(
|
|
4660
4714
|
Slot,
|
|
4661
4715
|
{
|
|
4662
4716
|
name: "sidebar",
|
|
@@ -4666,8 +4720,8 @@ function DefaultShell({
|
|
|
4666
4720
|
menu
|
|
4667
4721
|
}
|
|
4668
4722
|
),
|
|
4669
|
-
/* @__PURE__ */
|
|
4670
|
-
/* @__PURE__ */
|
|
4723
|
+
/* @__PURE__ */ jsxs20(Flex11, { direction: "column", flex: "1", minW: 0, children: [
|
|
4724
|
+
/* @__PURE__ */ jsx28(
|
|
4671
4725
|
Slot,
|
|
4672
4726
|
{
|
|
4673
4727
|
name: "topbar",
|
|
@@ -4677,9 +4731,9 @@ function DefaultShell({
|
|
|
4677
4731
|
menu
|
|
4678
4732
|
}
|
|
4679
4733
|
),
|
|
4680
|
-
/* @__PURE__ */
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
/* @__PURE__ */
|
|
4734
|
+
/* @__PURE__ */ jsx28(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
|
|
4735
|
+
/* @__PURE__ */ jsx28(Box18, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx28(Box18, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx28(Outlet, {}) }) }),
|
|
4736
|
+
/* @__PURE__ */ jsx28(
|
|
4683
4737
|
Slot,
|
|
4684
4738
|
{
|
|
4685
4739
|
name: "footer",
|
|
@@ -4693,24 +4747,24 @@ function DefaultShell({
|
|
|
4693
4747
|
] });
|
|
4694
4748
|
}
|
|
4695
4749
|
function PortalShell(props) {
|
|
4696
|
-
return /* @__PURE__ */
|
|
4750
|
+
return /* @__PURE__ */ jsx28(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
|
|
4697
4751
|
}
|
|
4698
4752
|
|
|
4699
4753
|
// src/shell/AuthenticatedLayout.tsx
|
|
4700
|
-
import { jsx as
|
|
4754
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4701
4755
|
function AuthenticatedLayout({ app, menu, layout, registry }) {
|
|
4702
4756
|
if (layout?.shell?.startsWith("custom:")) {
|
|
4703
4757
|
const CustomShell = resolveComponent(registry, layout.shell, "layoutSlots");
|
|
4704
|
-
return CustomShell ? /* @__PURE__ */
|
|
4758
|
+
return CustomShell ? /* @__PURE__ */ jsx29(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx29(MissingRenderer, { renderer: layout.shell });
|
|
4705
4759
|
}
|
|
4706
|
-
if (layout?.shell === "portal") return /* @__PURE__ */
|
|
4707
|
-
return /* @__PURE__ */
|
|
4760
|
+
if (layout?.shell === "portal") return /* @__PURE__ */ jsx29(PortalShell, { app, menu, layout, registry });
|
|
4761
|
+
return /* @__PURE__ */ jsx29(DefaultShell, { app, menu, layout, registry });
|
|
4708
4762
|
}
|
|
4709
4763
|
|
|
4710
4764
|
// src/security/AccessDeniedPage.tsx
|
|
4711
|
-
import { Box as
|
|
4765
|
+
import { Box as Box19, Button as Button12, Flex as Flex12, Heading as Heading9, Text as Text20, VStack } from "@chakra-ui/react";
|
|
4712
4766
|
import { useNavigate } from "react-router-dom";
|
|
4713
|
-
import { jsx as
|
|
4767
|
+
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4714
4768
|
function AccessDeniedPage({ app }) {
|
|
4715
4769
|
const { logout } = useOonAuth();
|
|
4716
4770
|
const navigate = useNavigate();
|
|
@@ -4718,8 +4772,8 @@ function AccessDeniedPage({ app }) {
|
|
|
4718
4772
|
logout();
|
|
4719
4773
|
navigate("/login", { replace: true });
|
|
4720
4774
|
}
|
|
4721
|
-
return /* @__PURE__ */
|
|
4722
|
-
|
|
4775
|
+
return /* @__PURE__ */ jsx30(Flex12, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx30(
|
|
4776
|
+
Box19,
|
|
4723
4777
|
{
|
|
4724
4778
|
width: "100%",
|
|
4725
4779
|
maxW: "560px",
|
|
@@ -4729,9 +4783,9 @@ function AccessDeniedPage({ app }) {
|
|
|
4729
4783
|
borderRadius: "18px",
|
|
4730
4784
|
boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
|
|
4731
4785
|
p: { base: 6, md: 10 },
|
|
4732
|
-
children: /* @__PURE__ */
|
|
4733
|
-
/* @__PURE__ */
|
|
4734
|
-
|
|
4786
|
+
children: /* @__PURE__ */ jsxs21(VStack, { align: "stretch", gap: 6, children: [
|
|
4787
|
+
/* @__PURE__ */ jsx30(
|
|
4788
|
+
Box19,
|
|
4735
4789
|
{
|
|
4736
4790
|
width: "56px",
|
|
4737
4791
|
height: "56px",
|
|
@@ -4747,9 +4801,9 @@ function AccessDeniedPage({ app }) {
|
|
|
4747
4801
|
children: "!"
|
|
4748
4802
|
}
|
|
4749
4803
|
),
|
|
4750
|
-
/* @__PURE__ */
|
|
4751
|
-
/* @__PURE__ */
|
|
4752
|
-
|
|
4804
|
+
/* @__PURE__ */ jsxs21(Box19, { children: [
|
|
4805
|
+
/* @__PURE__ */ jsx30(
|
|
4806
|
+
Text20,
|
|
4753
4807
|
{
|
|
4754
4808
|
color: "#39BFED",
|
|
4755
4809
|
fontSize: "xs",
|
|
@@ -4759,14 +4813,14 @@ function AccessDeniedPage({ app }) {
|
|
|
4759
4813
|
children: "Acesso negado"
|
|
4760
4814
|
}
|
|
4761
4815
|
),
|
|
4762
|
-
/* @__PURE__ */
|
|
4763
|
-
/* @__PURE__ */
|
|
4816
|
+
/* @__PURE__ */ jsx30(Heading9, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
|
|
4817
|
+
/* @__PURE__ */ jsxs21(Text20, { mt: 3, color: "gray.600", children: [
|
|
4764
4818
|
"Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
|
|
4765
4819
|
app.title ?? app.name,
|
|
4766
4820
|
". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
|
|
4767
4821
|
] })
|
|
4768
4822
|
] }),
|
|
4769
|
-
/* @__PURE__ */
|
|
4823
|
+
/* @__PURE__ */ jsx30(
|
|
4770
4824
|
Button12,
|
|
4771
4825
|
{
|
|
4772
4826
|
alignSelf: "flex-start",
|
|
@@ -4784,7 +4838,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4784
4838
|
|
|
4785
4839
|
// src/security/AppAccessGuard.tsx
|
|
4786
4840
|
import { Navigate, useLocation } from "react-router-dom";
|
|
4787
|
-
import { Fragment as Fragment5, jsx as
|
|
4841
|
+
import { Fragment as Fragment5, jsx as jsx31 } from "react/jsx-runtime";
|
|
4788
4842
|
function loginRedirect(pathname, search) {
|
|
4789
4843
|
const destination = `${pathname}${search}`;
|
|
4790
4844
|
return `/login?redirect=${encodeURIComponent(destination)}`;
|
|
@@ -4792,9 +4846,9 @@ function loginRedirect(pathname, search) {
|
|
|
4792
4846
|
function AppAccessGuard({ children }) {
|
|
4793
4847
|
const { status, retry } = useOonAuth();
|
|
4794
4848
|
const location = useLocation();
|
|
4795
|
-
if (status === "loading") return /* @__PURE__ */
|
|
4849
|
+
if (status === "loading") return /* @__PURE__ */ jsx31(LoadingScreen, {});
|
|
4796
4850
|
if (status === "unauthenticated") {
|
|
4797
|
-
return /* @__PURE__ */
|
|
4851
|
+
return /* @__PURE__ */ jsx31(
|
|
4798
4852
|
Navigate,
|
|
4799
4853
|
{
|
|
4800
4854
|
to: loginRedirect(location.pathname, location.search),
|
|
@@ -4803,10 +4857,10 @@ function AppAccessGuard({ children }) {
|
|
|
4803
4857
|
);
|
|
4804
4858
|
}
|
|
4805
4859
|
if (status === "forbidden") {
|
|
4806
|
-
return /* @__PURE__ */
|
|
4860
|
+
return /* @__PURE__ */ jsx31(Navigate, { to: "/acesso-negado", replace: true });
|
|
4807
4861
|
}
|
|
4808
4862
|
if (status === "error") {
|
|
4809
|
-
return /* @__PURE__ */
|
|
4863
|
+
return /* @__PURE__ */ jsx31(
|
|
4810
4864
|
LoadingScreen,
|
|
4811
4865
|
{
|
|
4812
4866
|
message: "N\xE3o foi poss\xEDvel validar seu acesso. Tente novamente.",
|
|
@@ -4817,22 +4871,22 @@ function AppAccessGuard({ children }) {
|
|
|
4817
4871
|
}
|
|
4818
4872
|
);
|
|
4819
4873
|
}
|
|
4820
|
-
return /* @__PURE__ */
|
|
4874
|
+
return /* @__PURE__ */ jsx31(Fragment5, { children });
|
|
4821
4875
|
}
|
|
4822
4876
|
|
|
4823
4877
|
// src/security/LoginPage.tsx
|
|
4824
4878
|
import { useState as useState12 } from "react";
|
|
4825
4879
|
import {
|
|
4826
|
-
Box as
|
|
4880
|
+
Box as Box20,
|
|
4827
4881
|
Button as Button13,
|
|
4828
4882
|
Flex as Flex13,
|
|
4829
4883
|
Heading as Heading10,
|
|
4830
4884
|
Input as Input7,
|
|
4831
|
-
Text as
|
|
4885
|
+
Text as Text21,
|
|
4832
4886
|
VStack as VStack2
|
|
4833
4887
|
} from "@chakra-ui/react";
|
|
4834
4888
|
import { Navigate as Navigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
4835
|
-
import { jsx as
|
|
4889
|
+
import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4836
4890
|
function safeRedirect(search) {
|
|
4837
4891
|
const value2 = new URLSearchParams(search).get("redirect") || "/";
|
|
4838
4892
|
if (!value2.startsWith("/") || value2.startsWith("//")) return "/";
|
|
@@ -4850,10 +4904,10 @@ function LoginPage({ app }) {
|
|
|
4850
4904
|
const [message, setMessage] = useState12(null);
|
|
4851
4905
|
const redirect = safeRedirect(location.search);
|
|
4852
4906
|
if (status === "authenticated") {
|
|
4853
|
-
return /* @__PURE__ */
|
|
4907
|
+
return /* @__PURE__ */ jsx32(Navigate2, { to: redirect, replace: true });
|
|
4854
4908
|
}
|
|
4855
4909
|
if (status === "forbidden") {
|
|
4856
|
-
return /* @__PURE__ */
|
|
4910
|
+
return /* @__PURE__ */ jsx32(Navigate2, { to: "/acesso-negado", replace: true });
|
|
4857
4911
|
}
|
|
4858
4912
|
async function handleSubmit(event) {
|
|
4859
4913
|
event.preventDefault();
|
|
@@ -4871,8 +4925,8 @@ function LoginPage({ app }) {
|
|
|
4871
4925
|
setSubmitting(false);
|
|
4872
4926
|
}
|
|
4873
4927
|
}
|
|
4874
|
-
return /* @__PURE__ */
|
|
4875
|
-
|
|
4928
|
+
return /* @__PURE__ */ jsx32(Flex13, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx32(
|
|
4929
|
+
Box20,
|
|
4876
4930
|
{
|
|
4877
4931
|
width: "100%",
|
|
4878
4932
|
maxW: "440px",
|
|
@@ -4882,10 +4936,10 @@ function LoginPage({ app }) {
|
|
|
4882
4936
|
borderRadius: "18px",
|
|
4883
4937
|
boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
|
|
4884
4938
|
p: { base: 6, md: 9 },
|
|
4885
|
-
children: /* @__PURE__ */
|
|
4886
|
-
/* @__PURE__ */
|
|
4887
|
-
/* @__PURE__ */
|
|
4888
|
-
|
|
4939
|
+
children: /* @__PURE__ */ jsx32("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs22(VStack2, { align: "stretch", gap: 6, children: [
|
|
4940
|
+
/* @__PURE__ */ jsxs22(Box20, { children: [
|
|
4941
|
+
/* @__PURE__ */ jsx32(
|
|
4942
|
+
Text21,
|
|
4889
4943
|
{
|
|
4890
4944
|
color: "#39BFED",
|
|
4891
4945
|
fontSize: "xs",
|
|
@@ -4895,13 +4949,13 @@ function LoginPage({ app }) {
|
|
|
4895
4949
|
children: "Central Oon"
|
|
4896
4950
|
}
|
|
4897
4951
|
),
|
|
4898
|
-
/* @__PURE__ */
|
|
4899
|
-
/* @__PURE__ */
|
|
4952
|
+
/* @__PURE__ */ jsx32(Heading10, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
|
|
4953
|
+
/* @__PURE__ */ jsx32(Text21, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
|
|
4900
4954
|
] }),
|
|
4901
|
-
/* @__PURE__ */
|
|
4902
|
-
/* @__PURE__ */
|
|
4903
|
-
/* @__PURE__ */
|
|
4904
|
-
/* @__PURE__ */
|
|
4955
|
+
/* @__PURE__ */ jsxs22(VStack2, { align: "stretch", gap: 4, children: [
|
|
4956
|
+
/* @__PURE__ */ jsxs22(Box20, { children: [
|
|
4957
|
+
/* @__PURE__ */ jsx32(Text21, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
|
|
4958
|
+
/* @__PURE__ */ jsx32(
|
|
4905
4959
|
Input7,
|
|
4906
4960
|
{
|
|
4907
4961
|
type: "email",
|
|
@@ -4913,9 +4967,9 @@ function LoginPage({ app }) {
|
|
|
4913
4967
|
}
|
|
4914
4968
|
)
|
|
4915
4969
|
] }),
|
|
4916
|
-
/* @__PURE__ */
|
|
4917
|
-
/* @__PURE__ */
|
|
4918
|
-
/* @__PURE__ */
|
|
4970
|
+
/* @__PURE__ */ jsxs22(Box20, { children: [
|
|
4971
|
+
/* @__PURE__ */ jsx32(Text21, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
|
|
4972
|
+
/* @__PURE__ */ jsx32(
|
|
4919
4973
|
Input7,
|
|
4920
4974
|
{
|
|
4921
4975
|
type: "password",
|
|
@@ -4928,8 +4982,8 @@ function LoginPage({ app }) {
|
|
|
4928
4982
|
)
|
|
4929
4983
|
] })
|
|
4930
4984
|
] }),
|
|
4931
|
-
message ? /* @__PURE__ */
|
|
4932
|
-
|
|
4985
|
+
message ? /* @__PURE__ */ jsx32(
|
|
4986
|
+
Box20,
|
|
4933
4987
|
{
|
|
4934
4988
|
role: "alert",
|
|
4935
4989
|
borderRadius: "10px",
|
|
@@ -4941,7 +4995,7 @@ function LoginPage({ app }) {
|
|
|
4941
4995
|
children: message
|
|
4942
4996
|
}
|
|
4943
4997
|
) : null,
|
|
4944
|
-
/* @__PURE__ */
|
|
4998
|
+
/* @__PURE__ */ jsx32(
|
|
4945
4999
|
Button13,
|
|
4946
5000
|
{
|
|
4947
5001
|
type: "submit",
|
|
@@ -4959,8 +5013,8 @@ function LoginPage({ app }) {
|
|
|
4959
5013
|
|
|
4960
5014
|
// src/security/ActivationPage.tsx
|
|
4961
5015
|
import { useEffect as useEffect8, useState as useState13 } from "react";
|
|
4962
|
-
import { Box as
|
|
4963
|
-
import { Fragment as Fragment6, jsx as
|
|
5016
|
+
import { Box as Box21, Button as Button14, Heading as Heading11, Input as Input8, Text as Text22, VStack as VStack3 } from "@chakra-ui/react";
|
|
5017
|
+
import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4964
5018
|
function encodeBasicCredentials2(email, password) {
|
|
4965
5019
|
const bytes = new TextEncoder().encode(`${email}:${password}`);
|
|
4966
5020
|
let binary = "";
|
|
@@ -5094,12 +5148,12 @@ function ActivationPage() {
|
|
|
5094
5148
|
}
|
|
5095
5149
|
}
|
|
5096
5150
|
function renderField(field, values, setValues) {
|
|
5097
|
-
return /* @__PURE__ */
|
|
5098
|
-
/* @__PURE__ */
|
|
5151
|
+
return /* @__PURE__ */ jsxs23(Box21, { w: "100%", children: [
|
|
5152
|
+
/* @__PURE__ */ jsxs23(Text22, { fontWeight: "medium", children: [
|
|
5099
5153
|
field.label,
|
|
5100
5154
|
field.required ? " *" : ""
|
|
5101
5155
|
] }),
|
|
5102
|
-
/* @__PURE__ */
|
|
5156
|
+
/* @__PURE__ */ jsx33(
|
|
5103
5157
|
Input8,
|
|
5104
5158
|
{
|
|
5105
5159
|
type: field.type === "password" || field.type === "secret" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : field.type === "number" || field.type === "integer" ? "number" : "text",
|
|
@@ -5111,15 +5165,15 @@ function ActivationPage() {
|
|
|
5111
5165
|
onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
|
|
5112
5166
|
}
|
|
5113
5167
|
),
|
|
5114
|
-
field.helpText ? /* @__PURE__ */
|
|
5168
|
+
field.helpText ? /* @__PURE__ */ jsx33(Text22, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
|
|
5115
5169
|
] }, field.name);
|
|
5116
5170
|
}
|
|
5117
5171
|
function renderDevLocalActivation() {
|
|
5118
|
-
return /* @__PURE__ */
|
|
5119
|
-
/* @__PURE__ */
|
|
5120
|
-
/* @__PURE__ */
|
|
5121
|
-
/* @__PURE__ */
|
|
5122
|
-
/* @__PURE__ */
|
|
5172
|
+
return /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5173
|
+
/* @__PURE__ */ jsx33(Text22, { color: "gray.700", children: "Entre com seu e-mail e senha para ativar esta Central em ambiente de desenvolvimento. Se o e-mail ainda n\xE3o existir na Central de Ativa\xE7\xF5es, o usu\xE1rio ser\xE1 criado automaticamente com perfil de desenvolvedor." }),
|
|
5174
|
+
/* @__PURE__ */ jsxs23(Box21, { w: "100%", children: [
|
|
5175
|
+
/* @__PURE__ */ jsx33(Text22, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
|
|
5176
|
+
/* @__PURE__ */ jsx33(
|
|
5123
5177
|
Input8,
|
|
5124
5178
|
{
|
|
5125
5179
|
value: devName,
|
|
@@ -5129,9 +5183,9 @@ function ActivationPage() {
|
|
|
5129
5183
|
}
|
|
5130
5184
|
)
|
|
5131
5185
|
] }),
|
|
5132
|
-
/* @__PURE__ */
|
|
5133
|
-
/* @__PURE__ */
|
|
5134
|
-
/* @__PURE__ */
|
|
5186
|
+
/* @__PURE__ */ jsxs23(Box21, { w: "100%", children: [
|
|
5187
|
+
/* @__PURE__ */ jsx33(Text22, { fontWeight: "medium", children: "E-mail *" }),
|
|
5188
|
+
/* @__PURE__ */ jsx33(
|
|
5135
5189
|
Input8,
|
|
5136
5190
|
{
|
|
5137
5191
|
type: "email",
|
|
@@ -5142,9 +5196,9 @@ function ActivationPage() {
|
|
|
5142
5196
|
}
|
|
5143
5197
|
)
|
|
5144
5198
|
] }),
|
|
5145
|
-
/* @__PURE__ */
|
|
5146
|
-
/* @__PURE__ */
|
|
5147
|
-
/* @__PURE__ */
|
|
5199
|
+
/* @__PURE__ */ jsxs23(Box21, { w: "100%", children: [
|
|
5200
|
+
/* @__PURE__ */ jsx33(Text22, { fontWeight: "medium", children: "Senha *" }),
|
|
5201
|
+
/* @__PURE__ */ jsx33(
|
|
5148
5202
|
Input8,
|
|
5149
5203
|
{
|
|
5150
5204
|
type: "password",
|
|
@@ -5156,7 +5210,7 @@ function ActivationPage() {
|
|
|
5156
5210
|
}
|
|
5157
5211
|
)
|
|
5158
5212
|
] }),
|
|
5159
|
-
/* @__PURE__ */
|
|
5213
|
+
/* @__PURE__ */ jsx33(
|
|
5160
5214
|
Button14,
|
|
5161
5215
|
{
|
|
5162
5216
|
colorPalette: "blue",
|
|
@@ -5166,7 +5220,7 @@ function ActivationPage() {
|
|
|
5166
5220
|
children: "Ativar ambiente de desenvolvimento"
|
|
5167
5221
|
}
|
|
5168
5222
|
),
|
|
5169
|
-
/* @__PURE__ */
|
|
5223
|
+
/* @__PURE__ */ jsx33(
|
|
5170
5224
|
Button14,
|
|
5171
5225
|
{
|
|
5172
5226
|
variant: "outline",
|
|
@@ -5180,7 +5234,7 @@ function ActivationPage() {
|
|
|
5180
5234
|
const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
|
|
5181
5235
|
const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
|
|
5182
5236
|
if (activation.status === "loading" || !config) {
|
|
5183
|
-
return /* @__PURE__ */
|
|
5237
|
+
return /* @__PURE__ */ jsx33(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs23(
|
|
5184
5238
|
VStack3,
|
|
5185
5239
|
{
|
|
5186
5240
|
maxW: "760px",
|
|
@@ -5191,14 +5245,14 @@ function ActivationPage() {
|
|
|
5191
5245
|
align: "stretch",
|
|
5192
5246
|
gap: 5,
|
|
5193
5247
|
children: [
|
|
5194
|
-
/* @__PURE__ */
|
|
5195
|
-
error ? /* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ jsx33(Heading11, { children: "Preparando ativa\xE7\xE3o..." }),
|
|
5249
|
+
error ? /* @__PURE__ */ jsx33(Text22, { color: "red.600", children: error }) : null
|
|
5196
5250
|
]
|
|
5197
5251
|
}
|
|
5198
5252
|
) });
|
|
5199
5253
|
}
|
|
5200
5254
|
if (rootMode) {
|
|
5201
|
-
return /* @__PURE__ */
|
|
5255
|
+
return /* @__PURE__ */ jsx33(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs23(
|
|
5202
5256
|
VStack3,
|
|
5203
5257
|
{
|
|
5204
5258
|
maxW: "560px",
|
|
@@ -5209,20 +5263,20 @@ function ActivationPage() {
|
|
|
5209
5263
|
align: "stretch",
|
|
5210
5264
|
gap: 5,
|
|
5211
5265
|
children: [
|
|
5212
|
-
/* @__PURE__ */
|
|
5213
|
-
/* @__PURE__ */
|
|
5214
|
-
/* @__PURE__ */
|
|
5266
|
+
/* @__PURE__ */ jsx33(Heading11, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
|
|
5267
|
+
/* @__PURE__ */ jsx33(Text22, { color: "gray.600", children: "Esta \xE9 a aplica\xE7\xE3o root do ecossistema. Informe somente o e-mail e a senha do primeiro administrador. O Core criar\xE1 a estrutura m\xEDnima necess\xE1ria para liberar o primeiro login." }),
|
|
5268
|
+
/* @__PURE__ */ jsxs23(Text22, { fontSize: "sm", color: "gray.500", children: [
|
|
5215
5269
|
"App: ",
|
|
5216
5270
|
config.technical.appCode,
|
|
5217
5271
|
" \xB7 Ambiente:",
|
|
5218
5272
|
" ",
|
|
5219
5273
|
config.technical.ambiente
|
|
5220
5274
|
] }),
|
|
5221
|
-
error ? /* @__PURE__ */
|
|
5222
|
-
step !== 6 ? /* @__PURE__ */
|
|
5223
|
-
/* @__PURE__ */
|
|
5224
|
-
/* @__PURE__ */
|
|
5225
|
-
/* @__PURE__ */
|
|
5275
|
+
error ? /* @__PURE__ */ jsx33(Text22, { color: "red.600", children: error }) : null,
|
|
5276
|
+
step !== 6 ? /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5277
|
+
/* @__PURE__ */ jsxs23(Box21, { w: "100%", children: [
|
|
5278
|
+
/* @__PURE__ */ jsx33(Text22, { fontWeight: "medium", children: "E-mail do administrador *" }),
|
|
5279
|
+
/* @__PURE__ */ jsx33(
|
|
5226
5280
|
Input8,
|
|
5227
5281
|
{
|
|
5228
5282
|
type: "email",
|
|
@@ -5233,9 +5287,9 @@ function ActivationPage() {
|
|
|
5233
5287
|
}
|
|
5234
5288
|
)
|
|
5235
5289
|
] }),
|
|
5236
|
-
/* @__PURE__ */
|
|
5237
|
-
/* @__PURE__ */
|
|
5238
|
-
/* @__PURE__ */
|
|
5290
|
+
/* @__PURE__ */ jsxs23(Box21, { w: "100%", children: [
|
|
5291
|
+
/* @__PURE__ */ jsx33(Text22, { fontWeight: "medium", children: "Senha *" }),
|
|
5292
|
+
/* @__PURE__ */ jsx33(
|
|
5239
5293
|
Input8,
|
|
5240
5294
|
{
|
|
5241
5295
|
type: "password",
|
|
@@ -5247,7 +5301,7 @@ function ActivationPage() {
|
|
|
5247
5301
|
}
|
|
5248
5302
|
)
|
|
5249
5303
|
] }),
|
|
5250
|
-
/* @__PURE__ */
|
|
5304
|
+
/* @__PURE__ */ jsx33(
|
|
5251
5305
|
Button14,
|
|
5252
5306
|
{
|
|
5253
5307
|
colorPalette: "blue",
|
|
@@ -5257,15 +5311,15 @@ function ActivationPage() {
|
|
|
5257
5311
|
children: "Criar ecossistema e ativar"
|
|
5258
5312
|
}
|
|
5259
5313
|
)
|
|
5260
|
-
] }) : /* @__PURE__ */
|
|
5261
|
-
/* @__PURE__ */
|
|
5262
|
-
/* @__PURE__ */
|
|
5314
|
+
] }) : /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5315
|
+
/* @__PURE__ */ jsx33(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
5316
|
+
/* @__PURE__ */ jsx33(Text22, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
|
|
5263
5317
|
] })
|
|
5264
5318
|
]
|
|
5265
5319
|
}
|
|
5266
5320
|
) });
|
|
5267
5321
|
}
|
|
5268
|
-
return /* @__PURE__ */
|
|
5322
|
+
return /* @__PURE__ */ jsx33(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs23(
|
|
5269
5323
|
VStack3,
|
|
5270
5324
|
{
|
|
5271
5325
|
maxW: "760px",
|
|
@@ -5276,8 +5330,8 @@ function ActivationPage() {
|
|
|
5276
5330
|
align: "stretch",
|
|
5277
5331
|
gap: 5,
|
|
5278
5332
|
children: [
|
|
5279
|
-
/* @__PURE__ */
|
|
5280
|
-
/* @__PURE__ */
|
|
5333
|
+
/* @__PURE__ */ jsx33(Heading11, { children: "Ativa\xE7\xE3o da Central Oon" }),
|
|
5334
|
+
/* @__PURE__ */ jsxs23(Text22, { children: [
|
|
5281
5335
|
"App: ",
|
|
5282
5336
|
config.technical.appCode,
|
|
5283
5337
|
" \xB7 Ambiente:",
|
|
@@ -5287,11 +5341,11 @@ function ActivationPage() {
|
|
|
5287
5341
|
" ",
|
|
5288
5342
|
config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
|
|
5289
5343
|
] }),
|
|
5290
|
-
error ? /* @__PURE__ */
|
|
5344
|
+
error ? /* @__PURE__ */ jsx33(Text22, { color: "red.600", children: error }) : null,
|
|
5291
5345
|
step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
|
|
5292
|
-
step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */
|
|
5293
|
-
/* @__PURE__ */
|
|
5294
|
-
/* @__PURE__ */
|
|
5346
|
+
step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5347
|
+
/* @__PURE__ */ jsx33(Text22, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
|
|
5348
|
+
/* @__PURE__ */ jsx33(
|
|
5295
5349
|
Input8,
|
|
5296
5350
|
{
|
|
5297
5351
|
"aria-label": "C\xF3digo de ativa\xE7\xE3o",
|
|
@@ -5300,7 +5354,7 @@ function ActivationPage() {
|
|
|
5300
5354
|
placeholder: "OON-XXXX"
|
|
5301
5355
|
}
|
|
5302
5356
|
),
|
|
5303
|
-
/* @__PURE__ */
|
|
5357
|
+
/* @__PURE__ */ jsx33(
|
|
5304
5358
|
Button14,
|
|
5305
5359
|
{
|
|
5306
5360
|
onClick: validateCode,
|
|
@@ -5309,7 +5363,7 @@ function ActivationPage() {
|
|
|
5309
5363
|
children: "Validar c\xF3digo"
|
|
5310
5364
|
}
|
|
5311
5365
|
),
|
|
5312
|
-
isDevelopmentMember ? /* @__PURE__ */
|
|
5366
|
+
isDevelopmentMember ? /* @__PURE__ */ jsx33(
|
|
5313
5367
|
Button14,
|
|
5314
5368
|
{
|
|
5315
5369
|
variant: "outline",
|
|
@@ -5319,24 +5373,24 @@ function ActivationPage() {
|
|
|
5319
5373
|
}
|
|
5320
5374
|
) : null
|
|
5321
5375
|
] }),
|
|
5322
|
-
step === 2 && /* @__PURE__ */
|
|
5323
|
-
/* @__PURE__ */
|
|
5324
|
-
/* @__PURE__ */
|
|
5325
|
-
/* @__PURE__ */
|
|
5376
|
+
step === 2 && /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5377
|
+
/* @__PURE__ */ jsx33(Heading11, { size: "md", children: "Confirma\xE7\xE3o" }),
|
|
5378
|
+
/* @__PURE__ */ jsx33("pre", { children: JSON.stringify(preview, null, 2) }),
|
|
5379
|
+
/* @__PURE__ */ jsx33(Button14, { onClick: () => setStep(3), children: "Continuar" })
|
|
5326
5380
|
] }),
|
|
5327
|
-
step === 3 && /* @__PURE__ */
|
|
5381
|
+
step === 3 && /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5328
5382
|
config.globalFields.map(
|
|
5329
5383
|
(field) => renderField(field, global, setGlobal)
|
|
5330
5384
|
),
|
|
5331
|
-
/* @__PURE__ */
|
|
5385
|
+
/* @__PURE__ */ jsx33(Button14, { onClick: () => setStep(4), children: "Continuar" })
|
|
5332
5386
|
] }),
|
|
5333
|
-
step === 4 && /* @__PURE__ */
|
|
5334
|
-
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */
|
|
5335
|
-
/* @__PURE__ */
|
|
5387
|
+
step === 4 && /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5388
|
+
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx33(Text22, { children: "Nenhum par\xE2metro adicional declarado." }),
|
|
5389
|
+
/* @__PURE__ */ jsx33(Button14, { onClick: () => setStep(5), children: "Revisar" })
|
|
5336
5390
|
] }),
|
|
5337
|
-
step === 5 && /* @__PURE__ */
|
|
5338
|
-
/* @__PURE__ */
|
|
5339
|
-
/* @__PURE__ */
|
|
5391
|
+
step === 5 && /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5392
|
+
/* @__PURE__ */ jsx33(Text22, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
|
|
5393
|
+
/* @__PURE__ */ jsx33(
|
|
5340
5394
|
Button14,
|
|
5341
5395
|
{
|
|
5342
5396
|
colorPalette: "blue",
|
|
@@ -5347,14 +5401,14 @@ function ActivationPage() {
|
|
|
5347
5401
|
}
|
|
5348
5402
|
)
|
|
5349
5403
|
] }),
|
|
5350
|
-
step === 6 && /* @__PURE__ */
|
|
5351
|
-
/* @__PURE__ */
|
|
5352
|
-
devResult?.appCode ? /* @__PURE__ */
|
|
5404
|
+
step === 6 && /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
5405
|
+
/* @__PURE__ */ jsx33(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
5406
|
+
devResult?.appCode ? /* @__PURE__ */ jsxs23(Text22, { children: [
|
|
5353
5407
|
"C\xF3digo do app: ",
|
|
5354
5408
|
devResult.appCode,
|
|
5355
5409
|
". Redirecionando para a Central em desenvolvimento..."
|
|
5356
|
-
] }) : /* @__PURE__ */
|
|
5357
|
-
devResult?.instrucoes?.env ? /* @__PURE__ */
|
|
5410
|
+
] }) : /* @__PURE__ */ jsx33(Text22, { children: "Redirecionando para o login..." }),
|
|
5411
|
+
devResult?.instrucoes?.env ? /* @__PURE__ */ jsx33(Text22, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
|
|
5358
5412
|
] })
|
|
5359
5413
|
]
|
|
5360
5414
|
}
|
|
@@ -5364,47 +5418,47 @@ function InstanceBlockedPage({
|
|
|
5364
5418
|
title,
|
|
5365
5419
|
message
|
|
5366
5420
|
}) {
|
|
5367
|
-
return /* @__PURE__ */
|
|
5368
|
-
/* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5421
|
+
return /* @__PURE__ */ jsxs23(Box21, { p: 8, children: [
|
|
5422
|
+
/* @__PURE__ */ jsx33(Heading11, { children: title }),
|
|
5423
|
+
/* @__PURE__ */ jsx33(Text22, { children: message })
|
|
5370
5424
|
] });
|
|
5371
5425
|
}
|
|
5372
5426
|
|
|
5373
5427
|
// src/security/RouteGuard.tsx
|
|
5374
|
-
import { Fragment as Fragment7, jsx as
|
|
5428
|
+
import { Fragment as Fragment7, jsx as jsx34 } from "react/jsx-runtime";
|
|
5375
5429
|
function RouteGuard({
|
|
5376
5430
|
permission,
|
|
5377
5431
|
children
|
|
5378
5432
|
}) {
|
|
5379
5433
|
const { status, hasPermission } = useOonAuth();
|
|
5380
|
-
if (status === "loading") return /* @__PURE__ */
|
|
5381
|
-
if (status === "unauthenticated") return /* @__PURE__ */
|
|
5434
|
+
if (status === "loading") return /* @__PURE__ */ jsx34(LoadingScreen, {});
|
|
5435
|
+
if (status === "unauthenticated") return /* @__PURE__ */ jsx34(LoadingScreen, { message: "Redirecionando para o login..." });
|
|
5382
5436
|
if (!hasPermission(permission)) {
|
|
5383
|
-
return /* @__PURE__ */
|
|
5437
|
+
return /* @__PURE__ */ jsx34(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
|
|
5384
5438
|
}
|
|
5385
|
-
return /* @__PURE__ */
|
|
5439
|
+
return /* @__PURE__ */ jsx34(Fragment7, { children });
|
|
5386
5440
|
}
|
|
5387
5441
|
|
|
5388
5442
|
// src/security/ActivationGuard.tsx
|
|
5389
5443
|
import { Navigate as Navigate3 } from "react-router-dom";
|
|
5390
|
-
import { jsx as
|
|
5444
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5391
5445
|
function ActivationGuard({ children }) {
|
|
5392
5446
|
const { status } = useActivation();
|
|
5393
5447
|
if (status === "loading") return null;
|
|
5394
|
-
if (status === "suspended") return /* @__PURE__ */
|
|
5395
|
-
if (status === "revoked") return /* @__PURE__ */
|
|
5396
|
-
if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */
|
|
5448
|
+
if (status === "suspended") return /* @__PURE__ */ jsx35(Navigate3, { to: "/instancia-suspensa", replace: true });
|
|
5449
|
+
if (status === "revoked") return /* @__PURE__ */ jsx35(Navigate3, { to: "/instancia-revogada", replace: true });
|
|
5450
|
+
if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx35(Navigate3, { to: "/ativacao", replace: true });
|
|
5397
5451
|
return children;
|
|
5398
5452
|
}
|
|
5399
5453
|
|
|
5400
5454
|
// src/app/createOonRouter.tsx
|
|
5401
|
-
import { jsx as
|
|
5455
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5402
5456
|
function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
5403
5457
|
const guardEnabled = security?.enableRouteGuard !== false;
|
|
5404
5458
|
const publicRoutes = routes.filter((route) => route.public).map((route) => ({ path: route.path, element: route.element }));
|
|
5405
5459
|
const privateSource = routes.filter((route) => !route.public);
|
|
5406
5460
|
const privateRoutes = privateSource.map((route) => {
|
|
5407
|
-
const element = guardEnabled ? /* @__PURE__ */
|
|
5461
|
+
const element = guardEnabled ? /* @__PURE__ */ jsx36(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
|
|
5408
5462
|
return route.path === "/" ? { index: true, element } : { path: route.path.replace(/^\//, ""), element };
|
|
5409
5463
|
});
|
|
5410
5464
|
const hasIndexRoute = privateSource.some((route) => route.path === "/");
|
|
@@ -5412,7 +5466,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5412
5466
|
if (!hasIndexRoute && firstRoute) {
|
|
5413
5467
|
privateRoutes.unshift({
|
|
5414
5468
|
index: true,
|
|
5415
|
-
element: /* @__PURE__ */
|
|
5469
|
+
element: /* @__PURE__ */ jsx36(Navigate4, { to: firstRoute.path, replace: true })
|
|
5416
5470
|
});
|
|
5417
5471
|
}
|
|
5418
5472
|
const customPaths = new Set(publicRoutes.map((route) => route.path));
|
|
@@ -5420,19 +5474,19 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5420
5474
|
if (!customPaths.has("/login")) {
|
|
5421
5475
|
builtInPublicRoutes.push({
|
|
5422
5476
|
path: "/login",
|
|
5423
|
-
element: /* @__PURE__ */
|
|
5477
|
+
element: /* @__PURE__ */ jsx36(ActivationGuard, { children: /* @__PURE__ */ jsx36(LoginPage, { app }) })
|
|
5424
5478
|
});
|
|
5425
5479
|
}
|
|
5426
5480
|
if (!customPaths.has("/ativacao")) {
|
|
5427
5481
|
builtInPublicRoutes.push({
|
|
5428
5482
|
path: "/ativacao",
|
|
5429
|
-
element: /* @__PURE__ */
|
|
5483
|
+
element: /* @__PURE__ */ jsx36(ActivationPage, {})
|
|
5430
5484
|
});
|
|
5431
5485
|
}
|
|
5432
5486
|
if (!customPaths.has("/instancia-suspensa")) {
|
|
5433
5487
|
builtInPublicRoutes.push({
|
|
5434
5488
|
path: "/instancia-suspensa",
|
|
5435
|
-
element: /* @__PURE__ */
|
|
5489
|
+
element: /* @__PURE__ */ jsx36(
|
|
5436
5490
|
InstanceBlockedPage,
|
|
5437
5491
|
{
|
|
5438
5492
|
title: "Inst\xE2ncia suspensa",
|
|
@@ -5444,7 +5498,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5444
5498
|
if (!customPaths.has("/instancia-revogada")) {
|
|
5445
5499
|
builtInPublicRoutes.push({
|
|
5446
5500
|
path: "/instancia-revogada",
|
|
5447
|
-
element: /* @__PURE__ */
|
|
5501
|
+
element: /* @__PURE__ */ jsx36(
|
|
5448
5502
|
InstanceBlockedPage,
|
|
5449
5503
|
{
|
|
5450
5504
|
title: "Inst\xE2ncia revogada",
|
|
@@ -5456,7 +5510,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5456
5510
|
if (!customPaths.has("/acesso-negado")) {
|
|
5457
5511
|
builtInPublicRoutes.push({
|
|
5458
5512
|
path: "/acesso-negado",
|
|
5459
|
-
element: /* @__PURE__ */
|
|
5513
|
+
element: /* @__PURE__ */ jsx36(AccessDeniedPage, { app })
|
|
5460
5514
|
});
|
|
5461
5515
|
}
|
|
5462
5516
|
const tree = [
|
|
@@ -5464,7 +5518,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5464
5518
|
...publicRoutes,
|
|
5465
5519
|
{
|
|
5466
5520
|
path: "/",
|
|
5467
|
-
element: /* @__PURE__ */
|
|
5521
|
+
element: /* @__PURE__ */ jsx36(ActivationGuard, { children: /* @__PURE__ */ jsx36(AppAccessGuard, { children: /* @__PURE__ */ jsx36(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
|
|
5468
5522
|
children: privateRoutes
|
|
5469
5523
|
}
|
|
5470
5524
|
];
|
|
@@ -5472,7 +5526,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5472
5526
|
}
|
|
5473
5527
|
|
|
5474
5528
|
// src/app/OonApp.tsx
|
|
5475
|
-
import { jsx as
|
|
5529
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
5476
5530
|
function localLoginUrl() {
|
|
5477
5531
|
const current = `${window.location.pathname}${window.location.search}`;
|
|
5478
5532
|
return `/login?redirect=${encodeURIComponent(current)}`;
|
|
@@ -5507,7 +5561,7 @@ function OonApp({ config }) {
|
|
|
5507
5561
|
});
|
|
5508
5562
|
return { http: http2, storage: storage2, router: router2 };
|
|
5509
5563
|
}, [config]);
|
|
5510
|
-
return /* @__PURE__ */
|
|
5564
|
+
return /* @__PURE__ */ jsx37(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx37(RouterProvider, { router }) });
|
|
5511
5565
|
}
|
|
5512
5566
|
|
|
5513
5567
|
// src/components/internal/pipelineBoardLayout.ts
|
|
@@ -5565,7 +5619,7 @@ function installPipelineBoardLayoutStyles(targetDocument = document) {
|
|
|
5565
5619
|
}
|
|
5566
5620
|
|
|
5567
5621
|
// src/start.tsx
|
|
5568
|
-
import { jsx as
|
|
5622
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
5569
5623
|
function validateConfig(config) {
|
|
5570
5624
|
if (!config?.app?.id) throw new Error("oonCoreFront.start: config.app.id \xE9 obrigat\xF3rio.");
|
|
5571
5625
|
if (!config?.api?.baseUrl) throw new Error("oonCoreFront.start: config.api.baseUrl \xE9 obrigat\xF3rio.");
|
|
@@ -5600,7 +5654,7 @@ function start(config) {
|
|
|
5600
5654
|
const el = document.getElementById(rootId);
|
|
5601
5655
|
if (!el) throw new Error(`oonCoreFront.start: elemento #${rootId} n\xE3o encontrado no DOM.`);
|
|
5602
5656
|
createRoot(el).render(
|
|
5603
|
-
/* @__PURE__ */
|
|
5657
|
+
/* @__PURE__ */ jsx38(StrictMode, { children: /* @__PURE__ */ jsx38(OonApp, { config }) })
|
|
5604
5658
|
);
|
|
5605
5659
|
}
|
|
5606
5660
|
var oonCoreFront = { start };
|
|
@@ -5758,34 +5812,34 @@ function defineOonModule(mod) {
|
|
|
5758
5812
|
}
|
|
5759
5813
|
|
|
5760
5814
|
// src/components/CoreIntegration.tsx
|
|
5761
|
-
import { Badge as Badge5, Box as
|
|
5815
|
+
import { Badge as Badge5, Box as Box22, Button as Button15, Flex as Flex14, Heading as Heading12, Stack as Stack9, Text as Text23 } from "@chakra-ui/react";
|
|
5762
5816
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
5763
|
-
import { jsx as
|
|
5817
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5764
5818
|
function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
5765
5819
|
const { http } = useOonApi();
|
|
5766
5820
|
const metadata = useCoreMetadata();
|
|
5767
5821
|
const reprocess = useMutation4({
|
|
5768
5822
|
mutationFn: () => http.post("/integrations/actions/process-active", {}, { headers: { "x-oon-origin": "integration" } })
|
|
5769
5823
|
});
|
|
5770
|
-
if (metadata.isLoading) return /* @__PURE__ */
|
|
5771
|
-
if (metadata.isError) return /* @__PURE__ */
|
|
5824
|
+
if (metadata.isLoading) return /* @__PURE__ */ jsx39(LoadingScreen, {});
|
|
5825
|
+
if (metadata.isError) return /* @__PURE__ */ jsx39(ErrorState, { error: metadata.error });
|
|
5772
5826
|
const integrations = metadata.data?.integrations ?? [];
|
|
5773
|
-
return /* @__PURE__ */
|
|
5774
|
-
/* @__PURE__ */
|
|
5775
|
-
/* @__PURE__ */
|
|
5776
|
-
/* @__PURE__ */
|
|
5827
|
+
return /* @__PURE__ */ jsxs24(Stack9, { gap: 6, children: [
|
|
5828
|
+
/* @__PURE__ */ jsxs24(Flex14, { align: "center", justify: "space-between", children: [
|
|
5829
|
+
/* @__PURE__ */ jsx39(Heading12, { size: "lg", children: label }),
|
|
5830
|
+
/* @__PURE__ */ jsx39(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
|
|
5777
5831
|
] }),
|
|
5778
|
-
/* @__PURE__ */
|
|
5779
|
-
|
|
5832
|
+
/* @__PURE__ */ jsx39(Stack9, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx39(Text23, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx39(
|
|
5833
|
+
Box22,
|
|
5780
5834
|
{
|
|
5781
5835
|
borderWidth: "1px",
|
|
5782
5836
|
borderColor: "gray.200",
|
|
5783
5837
|
borderRadius: "md",
|
|
5784
5838
|
bg: "white",
|
|
5785
5839
|
p: 4,
|
|
5786
|
-
children: /* @__PURE__ */
|
|
5787
|
-
/* @__PURE__ */
|
|
5788
|
-
/* @__PURE__ */
|
|
5840
|
+
children: /* @__PURE__ */ jsxs24(Flex14, { align: "center", justify: "space-between", children: [
|
|
5841
|
+
/* @__PURE__ */ jsx39(Text23, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
|
|
5842
|
+
/* @__PURE__ */ jsx39(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
|
|
5789
5843
|
] })
|
|
5790
5844
|
},
|
|
5791
5845
|
it.id ?? it.name ?? idx
|
|
@@ -5794,9 +5848,9 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
5794
5848
|
}
|
|
5795
5849
|
|
|
5796
5850
|
// src/components/CoreCurrency.tsx
|
|
5797
|
-
import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as
|
|
5851
|
+
import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as Text24 } from "@chakra-ui/react";
|
|
5798
5852
|
import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
5799
|
-
import { jsx as
|
|
5853
|
+
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5800
5854
|
function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
|
|
5801
5855
|
const { http } = useOonApi();
|
|
5802
5856
|
const queryClient = useQueryClient5();
|
|
@@ -5804,21 +5858,21 @@ function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/mo
|
|
|
5804
5858
|
mutationFn: () => http.post(`${endpoint}/actions/update-rates`, {}, { headers: { "x-oon-origin": "integration" } }),
|
|
5805
5859
|
onSuccess: () => queryClient.invalidateQueries({ queryKey: ["oon", "list", endpoint] })
|
|
5806
5860
|
});
|
|
5807
|
-
return /* @__PURE__ */
|
|
5808
|
-
/* @__PURE__ */
|
|
5809
|
-
/* @__PURE__ */
|
|
5810
|
-
/* @__PURE__ */
|
|
5861
|
+
return /* @__PURE__ */ jsxs25(Stack10, { gap: 6, children: [
|
|
5862
|
+
/* @__PURE__ */ jsxs25(Flex15, { align: "center", justify: "space-between", children: [
|
|
5863
|
+
/* @__PURE__ */ jsx40(Heading13, { size: "lg", children: label }),
|
|
5864
|
+
/* @__PURE__ */ jsx40(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
|
|
5811
5865
|
] }),
|
|
5812
|
-
updateRates.isError ? /* @__PURE__ */
|
|
5813
|
-
/* @__PURE__ */
|
|
5866
|
+
updateRates.isError ? /* @__PURE__ */ jsx40(Text24, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
|
|
5867
|
+
/* @__PURE__ */ jsx40(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
|
|
5814
5868
|
] });
|
|
5815
5869
|
}
|
|
5816
5870
|
|
|
5817
5871
|
// src/components/CoreAssistant.tsx
|
|
5818
5872
|
import { useState as useState14 } from "react";
|
|
5819
|
-
import { Box as
|
|
5873
|
+
import { Box as Box23, Button as Button17, Flex as Flex16, Heading as Heading14, Input as Input9, Stack as Stack11, Text as Text25 } from "@chakra-ui/react";
|
|
5820
5874
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
5821
|
-
import { jsx as
|
|
5875
|
+
import { jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5822
5876
|
function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
|
|
5823
5877
|
const { http } = useOonApi();
|
|
5824
5878
|
const [messages, setMessages] = useState14([]);
|
|
@@ -5847,11 +5901,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5847
5901
|
setInput("");
|
|
5848
5902
|
ask.mutate(text);
|
|
5849
5903
|
};
|
|
5850
|
-
return /* @__PURE__ */
|
|
5851
|
-
/* @__PURE__ */
|
|
5852
|
-
/* @__PURE__ */
|
|
5853
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
5854
|
-
|
|
5904
|
+
return /* @__PURE__ */ jsxs26(Stack11, { gap: 4, maxW: "560px", children: [
|
|
5905
|
+
/* @__PURE__ */ jsx41(Heading14, { size: "md", children: label }),
|
|
5906
|
+
/* @__PURE__ */ jsx41(Box23, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs26(Stack11, { gap: 3, children: [
|
|
5907
|
+
messages.length === 0 ? /* @__PURE__ */ jsx41(Text25, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx41(Flex16, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx41(
|
|
5908
|
+
Box23,
|
|
5855
5909
|
{
|
|
5856
5910
|
bg: m.role === "user" ? "brand.500" : "gray.100",
|
|
5857
5911
|
color: m.role === "user" ? "white" : "gray.800",
|
|
@@ -5863,11 +5917,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5863
5917
|
children: m.content
|
|
5864
5918
|
}
|
|
5865
5919
|
) }, idx)),
|
|
5866
|
-
ask.isPending ? /* @__PURE__ */
|
|
5867
|
-
ask.isError ? /* @__PURE__ */
|
|
5920
|
+
ask.isPending ? /* @__PURE__ */ jsx41(Text25, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
|
|
5921
|
+
ask.isError ? /* @__PURE__ */ jsx41(Text25, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
|
|
5868
5922
|
] }) }),
|
|
5869
|
-
/* @__PURE__ */
|
|
5870
|
-
/* @__PURE__ */
|
|
5923
|
+
/* @__PURE__ */ jsxs26(Flex16, { gap: 2, children: [
|
|
5924
|
+
/* @__PURE__ */ jsx41(
|
|
5871
5925
|
Input9,
|
|
5872
5926
|
{
|
|
5873
5927
|
size: "sm",
|
|
@@ -5879,7 +5933,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5879
5933
|
}
|
|
5880
5934
|
}
|
|
5881
5935
|
),
|
|
5882
|
-
/* @__PURE__ */
|
|
5936
|
+
/* @__PURE__ */ jsx41(Button17, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
|
|
5883
5937
|
] })
|
|
5884
5938
|
] });
|
|
5885
5939
|
}
|