@oondemand/oon-core-front 0.3.53 → 0.3.55
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 +536 -488
- 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,9 +649,52 @@ 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
|
|
|
655
|
+
// src/components/internal/referenceUtils.ts
|
|
656
|
+
var COMMON_LABEL_FIELDS = [
|
|
657
|
+
"nome",
|
|
658
|
+
"razaoSocial",
|
|
659
|
+
"razao_social",
|
|
660
|
+
"descricao",
|
|
661
|
+
"numero",
|
|
662
|
+
"codigoIndividual",
|
|
663
|
+
"codigo_individual",
|
|
664
|
+
"codigo",
|
|
665
|
+
"label",
|
|
666
|
+
"email"
|
|
667
|
+
];
|
|
668
|
+
function primitiveText(value2) {
|
|
669
|
+
if (value2 == null || value2 === "") return null;
|
|
670
|
+
if (typeof value2 === "string" || typeof value2 === "number") return String(value2);
|
|
671
|
+
return null;
|
|
672
|
+
}
|
|
673
|
+
function referenceOptionLabel(row, searchableFields = []) {
|
|
674
|
+
const ordered = [...COMMON_LABEL_FIELDS, ...searchableFields];
|
|
675
|
+
const seenFields = /* @__PURE__ */ new Set();
|
|
676
|
+
const seenValues = /* @__PURE__ */ new Set();
|
|
677
|
+
const values = [];
|
|
678
|
+
for (const field of ordered) {
|
|
679
|
+
if (seenFields.has(field)) continue;
|
|
680
|
+
seenFields.add(field);
|
|
681
|
+
const text = primitiveText(row[field]);
|
|
682
|
+
if (!text || seenValues.has(text)) continue;
|
|
683
|
+
seenValues.add(text);
|
|
684
|
+
values.push(text);
|
|
685
|
+
if (values.length === 2) break;
|
|
686
|
+
}
|
|
687
|
+
if (values.length) return values.join(" \u2014 ");
|
|
688
|
+
return primitiveText(row._id) ?? primitiveText(row.id) ?? "Registro sem identifica\xE7\xE3o";
|
|
689
|
+
}
|
|
690
|
+
function initialReferenceLabel(value2) {
|
|
691
|
+
if (!value2 || typeof value2 !== "object") return "";
|
|
692
|
+
return referenceOptionLabel(value2);
|
|
693
|
+
}
|
|
694
|
+
function referenceId(row) {
|
|
695
|
+
return String(row._id ?? row.id ?? "");
|
|
696
|
+
}
|
|
697
|
+
|
|
652
698
|
// src/components/internal/fieldUtils.ts
|
|
653
699
|
var HIDDEN_FIELDS = /* @__PURE__ */ new Set(["__v", "_id", "createdAt", "updatedAt", "criadoEm", "atualizadoEm"]);
|
|
654
700
|
function isEditableField(meta) {
|
|
@@ -708,6 +754,9 @@ function formFieldsFromMeta(fields) {
|
|
|
708
754
|
}
|
|
709
755
|
function formatCell(value2, kind) {
|
|
710
756
|
if (value2 == null || value2 === "") return "\u2014";
|
|
757
|
+
if (value2 && typeof value2 === "object" && !Array.isArray(value2) && kind !== "date") {
|
|
758
|
+
return referenceOptionLabel(value2);
|
|
759
|
+
}
|
|
711
760
|
switch (kind) {
|
|
712
761
|
case "boolean":
|
|
713
762
|
return value2 ? "Sim" : "N\xE3o";
|
|
@@ -721,10 +770,6 @@ function formatCell(value2, kind) {
|
|
|
721
770
|
case "currencyConverted":
|
|
722
771
|
return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value2));
|
|
723
772
|
case "ref":
|
|
724
|
-
if (value2 && typeof value2 === "object") {
|
|
725
|
-
const object = value2;
|
|
726
|
-
return String(object.nome ?? object.label ?? object.descricao ?? object._id ?? "\u2014");
|
|
727
|
-
}
|
|
728
773
|
return String(value2);
|
|
729
774
|
default:
|
|
730
775
|
return String(value2);
|
|
@@ -981,7 +1026,7 @@ function DataGrid({
|
|
|
981
1026
|
|
|
982
1027
|
// src/components/internal/DynamicForm.tsx
|
|
983
1028
|
import { useEffect as useEffect4, useMemo as useMemo4, useState as useState5 } from "react";
|
|
984
|
-
import { Box as
|
|
1029
|
+
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
1030
|
|
|
986
1031
|
// src/domain/domainExpressions.ts
|
|
987
1032
|
var DomainExpressionError = class extends Error {
|
|
@@ -1245,51 +1290,6 @@ function buildDomainMutationPayload(fields, values) {
|
|
|
1245
1290
|
import { useEffect as useEffect3, useMemo as useMemo3, useRef, useState as useState4 } from "react";
|
|
1246
1291
|
import { Box as Box3, Button as Button3, Flex as Flex3, Input as Input2, Spinner as Spinner2, Stack, Text as Text4 } from "@chakra-ui/react";
|
|
1247
1292
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
1248
|
-
|
|
1249
|
-
// src/components/internal/referenceUtils.ts
|
|
1250
|
-
var COMMON_LABEL_FIELDS = [
|
|
1251
|
-
"nome",
|
|
1252
|
-
"razaoSocial",
|
|
1253
|
-
"razao_social",
|
|
1254
|
-
"descricao",
|
|
1255
|
-
"numero",
|
|
1256
|
-
"codigoIndividual",
|
|
1257
|
-
"codigo_individual",
|
|
1258
|
-
"codigo",
|
|
1259
|
-
"label",
|
|
1260
|
-
"email"
|
|
1261
|
-
];
|
|
1262
|
-
function primitiveText(value2) {
|
|
1263
|
-
if (value2 == null || value2 === "") return null;
|
|
1264
|
-
if (typeof value2 === "string" || typeof value2 === "number") return String(value2);
|
|
1265
|
-
return null;
|
|
1266
|
-
}
|
|
1267
|
-
function referenceOptionLabel(row, searchableFields = []) {
|
|
1268
|
-
const ordered = [...COMMON_LABEL_FIELDS, ...searchableFields];
|
|
1269
|
-
const seenFields = /* @__PURE__ */ new Set();
|
|
1270
|
-
const seenValues = /* @__PURE__ */ new Set();
|
|
1271
|
-
const values = [];
|
|
1272
|
-
for (const field of ordered) {
|
|
1273
|
-
if (seenFields.has(field)) continue;
|
|
1274
|
-
seenFields.add(field);
|
|
1275
|
-
const text = primitiveText(row[field]);
|
|
1276
|
-
if (!text || seenValues.has(text)) continue;
|
|
1277
|
-
seenValues.add(text);
|
|
1278
|
-
values.push(text);
|
|
1279
|
-
if (values.length === 2) break;
|
|
1280
|
-
}
|
|
1281
|
-
if (values.length) return values.join(" \u2014 ");
|
|
1282
|
-
return primitiveText(row._id) ?? primitiveText(row.id) ?? "Registro sem identifica\xE7\xE3o";
|
|
1283
|
-
}
|
|
1284
|
-
function initialReferenceLabel(value2) {
|
|
1285
|
-
if (!value2 || typeof value2 !== "object") return "";
|
|
1286
|
-
return referenceOptionLabel(value2);
|
|
1287
|
-
}
|
|
1288
|
-
function referenceId(row) {
|
|
1289
|
-
return String(row._id ?? row.id ?? "");
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
// src/components/internal/ReferenceSelect.tsx
|
|
1293
1293
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1294
1294
|
function SearchIcon2() {
|
|
1295
1295
|
return /* @__PURE__ */ jsxs4("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
|
|
@@ -1646,6 +1646,127 @@ function ReferenceSelect({
|
|
|
1646
1646
|
] });
|
|
1647
1647
|
}
|
|
1648
1648
|
|
|
1649
|
+
// src/components/internal/CoreErrorAlert.tsx
|
|
1650
|
+
import { Box as Box4, Text as Text5 } from "@chakra-ui/react";
|
|
1651
|
+
|
|
1652
|
+
// src/components/internal/actionError.ts
|
|
1653
|
+
function asRecord(value2) {
|
|
1654
|
+
return value2 && typeof value2 === "object" ? value2 : void 0;
|
|
1655
|
+
}
|
|
1656
|
+
function firstText(...values) {
|
|
1657
|
+
return values.find((value2) => typeof value2 === "string" && value2.trim().length > 0)?.trim();
|
|
1658
|
+
}
|
|
1659
|
+
function firstNumber(...values) {
|
|
1660
|
+
return values.find((value2) => typeof value2 === "number" && Number.isFinite(value2));
|
|
1661
|
+
}
|
|
1662
|
+
function collectDetailMessages(value2, visited = /* @__PURE__ */ new WeakSet(), depth = 0) {
|
|
1663
|
+
if (depth > 4 || value2 == null) return [];
|
|
1664
|
+
if (typeof value2 === "string") return value2.trim() ? [value2.trim()] : [];
|
|
1665
|
+
if (Array.isArray(value2)) {
|
|
1666
|
+
return value2.flatMap((item) => collectDetailMessages(item, visited, depth + 1));
|
|
1667
|
+
}
|
|
1668
|
+
if (typeof value2 !== "object" || visited.has(value2)) return [];
|
|
1669
|
+
visited.add(value2);
|
|
1670
|
+
const record = value2;
|
|
1671
|
+
const field = firstText(record.field, record.path, record.property, record.name);
|
|
1672
|
+
const message = firstText(record.message, record.msg, record.reason);
|
|
1673
|
+
const technicalMessage = firstText(record.technicalMessage);
|
|
1674
|
+
const index = firstText(record.index);
|
|
1675
|
+
const direct = [
|
|
1676
|
+
message ? field ? `${field}: ${message}` : message : void 0,
|
|
1677
|
+
technicalMessage,
|
|
1678
|
+
index ? `\xCDndice: ${index}` : void 0
|
|
1679
|
+
].filter((item) => Boolean(item));
|
|
1680
|
+
const nestedKeys = ["details", "errors", "validation", "fields"];
|
|
1681
|
+
const nested = nestedKeys.flatMap((key) => collectDetailMessages(record[key], visited, depth + 1));
|
|
1682
|
+
if (direct.length || nested.length) return [...direct, ...nested];
|
|
1683
|
+
return Object.entries(record).filter(([key]) => !["code", "status", "statusCode", "requestId"].includes(key)).flatMap(([, nestedValue]) => collectDetailMessages(nestedValue, visited, depth + 1));
|
|
1684
|
+
}
|
|
1685
|
+
function unique(values) {
|
|
1686
|
+
return [...new Set(values.map((value2) => value2.trim()).filter(Boolean))];
|
|
1687
|
+
}
|
|
1688
|
+
function describeActionError(error) {
|
|
1689
|
+
if (error instanceof Error) return { message: error.message };
|
|
1690
|
+
if (typeof error === "string") return { message: error };
|
|
1691
|
+
const record = asRecord(error);
|
|
1692
|
+
if (!record) return { message: "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o." };
|
|
1693
|
+
const nestedEnvelope = asRecord(record.error);
|
|
1694
|
+
const envelope = nestedEnvelope ?? record;
|
|
1695
|
+
const message = firstText(envelope.message, record.message) ?? "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o.";
|
|
1696
|
+
const rawError = typeof record.error === "string" ? record.error : void 0;
|
|
1697
|
+
const details = unique(collectDetailMessages(envelope.details ?? record.details ?? rawError)).filter((detail) => detail !== message).slice(0, 5);
|
|
1698
|
+
const code = firstText(envelope.code, record.code);
|
|
1699
|
+
const status = firstNumber(envelope.status, envelope.statusCode, record.status, record.statusCode);
|
|
1700
|
+
const requestId = firstText(envelope.requestId, record.requestId);
|
|
1701
|
+
const technical = [
|
|
1702
|
+
code ? `C\xF3digo: ${code}` : void 0,
|
|
1703
|
+
status ? `HTTP: ${status}` : void 0,
|
|
1704
|
+
requestId ? `ID da requisi\xE7\xE3o: ${requestId}` : void 0
|
|
1705
|
+
].filter((value2) => Boolean(value2));
|
|
1706
|
+
const contextParts = [...details, ...technical];
|
|
1707
|
+
return {
|
|
1708
|
+
message,
|
|
1709
|
+
...contextParts.length ? { context: contextParts.join(" \u2022 ") } : {}
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
// src/components/internal/CoreErrorAlert.tsx
|
|
1714
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1715
|
+
function CoreErrorAlert({
|
|
1716
|
+
error,
|
|
1717
|
+
mt
|
|
1718
|
+
}) {
|
|
1719
|
+
const description = describeActionError(error);
|
|
1720
|
+
const details = description.context?.split(" \u2022 ").filter(Boolean) ?? [];
|
|
1721
|
+
return /* @__PURE__ */ jsxs5(
|
|
1722
|
+
Box4,
|
|
1723
|
+
{
|
|
1724
|
+
role: "alert",
|
|
1725
|
+
mt,
|
|
1726
|
+
p: "10px 12px",
|
|
1727
|
+
color: "#B42318",
|
|
1728
|
+
bg: "#FEF3F2",
|
|
1729
|
+
borderWidth: "1px",
|
|
1730
|
+
borderColor: "#FECDCA",
|
|
1731
|
+
borderRadius: "7px",
|
|
1732
|
+
fontSize: "11px",
|
|
1733
|
+
children: [
|
|
1734
|
+
/* @__PURE__ */ jsx9(Text5, { fontSize: "11px", fontWeight: "500", children: description.message }),
|
|
1735
|
+
details.length ? /* @__PURE__ */ jsxs5(Box4, { as: "details", mt: "5px", children: [
|
|
1736
|
+
/* @__PURE__ */ jsx9(
|
|
1737
|
+
Box4,
|
|
1738
|
+
{
|
|
1739
|
+
as: "summary",
|
|
1740
|
+
w: "fit-content",
|
|
1741
|
+
color: "#9B1C1C",
|
|
1742
|
+
cursor: "pointer",
|
|
1743
|
+
fontSize: "10px",
|
|
1744
|
+
fontWeight: "600",
|
|
1745
|
+
textDecoration: "underline",
|
|
1746
|
+
children: "Detalhes"
|
|
1747
|
+
}
|
|
1748
|
+
),
|
|
1749
|
+
/* @__PURE__ */ jsx9(
|
|
1750
|
+
Box4,
|
|
1751
|
+
{
|
|
1752
|
+
as: "ul",
|
|
1753
|
+
mt: "6px",
|
|
1754
|
+
mb: 0,
|
|
1755
|
+
pl: "18px",
|
|
1756
|
+
color: "#7A271A",
|
|
1757
|
+
fontFamily: "mono",
|
|
1758
|
+
fontSize: "9px",
|
|
1759
|
+
lineHeight: "1.45",
|
|
1760
|
+
overflowWrap: "anywhere",
|
|
1761
|
+
children: details.map((detail) => /* @__PURE__ */ jsx9("li", { children: detail }, detail))
|
|
1762
|
+
}
|
|
1763
|
+
)
|
|
1764
|
+
] }) : null
|
|
1765
|
+
]
|
|
1766
|
+
}
|
|
1767
|
+
);
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1649
1770
|
// src/components/internal/inputMasks.ts
|
|
1650
1771
|
var digitsOnly = (value2) => String(value2 ?? "").replace(/\D/g, "");
|
|
1651
1772
|
var normalizedName = (value2) => String(value2 ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -1752,23 +1873,23 @@ function maxLengthForMask(mask) {
|
|
|
1752
1873
|
}
|
|
1753
1874
|
|
|
1754
1875
|
// src/components/internal/DynamicForm.tsx
|
|
1755
|
-
import { jsx as
|
|
1876
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1756
1877
|
var idFor = (field) => `oon-form-field-${field.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
1757
1878
|
var errorIdFor = (field) => `${idFor(field)}-error`;
|
|
1758
1879
|
var normalize = (value2) => String(value2 ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1759
1880
|
function CloseIcon() {
|
|
1760
|
-
return /* @__PURE__ */
|
|
1881
|
+
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
1882
|
}
|
|
1762
1883
|
function CheckIcon() {
|
|
1763
|
-
return /* @__PURE__ */
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1884
|
+
return /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 20 20", width: "16", height: "16", "aria-hidden": "true", children: [
|
|
1885
|
+
/* @__PURE__ */ jsx10("circle", { cx: "10", cy: "10", r: "7", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1886
|
+
/* @__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
1887
|
] });
|
|
1767
1888
|
}
|
|
1768
1889
|
function AlertIcon() {
|
|
1769
|
-
return /* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
1890
|
+
return /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 20 20", width: "17", height: "17", "aria-hidden": "true", children: [
|
|
1891
|
+
/* @__PURE__ */ jsx10("circle", { cx: "10", cy: "10", r: "7", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1892
|
+
/* @__PURE__ */ jsx10("path", { d: "M10 6.5v4.2M10 13.5v.1", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
|
|
1772
1893
|
] });
|
|
1773
1894
|
}
|
|
1774
1895
|
function toValue(value2, kind) {
|
|
@@ -1850,14 +1971,14 @@ function isMultiline(field) {
|
|
|
1850
1971
|
return field.multiline === true || /observa|descricao|mensagem|detalhe|necessidade/i.test(field.field);
|
|
1851
1972
|
}
|
|
1852
1973
|
function Label({ id, label, required, readonly }) {
|
|
1853
|
-
return /* @__PURE__ */
|
|
1974
|
+
return /* @__PURE__ */ jsx10("label", { htmlFor: id, children: /* @__PURE__ */ jsxs6(Text6, { as: "span", display: "block", mb: "6px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
|
|
1854
1975
|
label,
|
|
1855
|
-
required && !readonly ? /* @__PURE__ */
|
|
1856
|
-
readonly ? /* @__PURE__ */
|
|
1976
|
+
required && !readonly ? /* @__PURE__ */ jsx10(Text6, { as: "span", color: "#DC2626", children: " *" }) : null,
|
|
1977
|
+
readonly ? /* @__PURE__ */ jsx10(Text6, { as: "span", ml: "5px", color: "#98A2B3", fontSize: "9px", fontWeight: "500", children: "somente leitura" }) : null
|
|
1857
1978
|
] }) });
|
|
1858
1979
|
}
|
|
1859
1980
|
function ErrorText({ id, text }) {
|
|
1860
|
-
return text ? /* @__PURE__ */
|
|
1981
|
+
return text ? /* @__PURE__ */ jsx10(Text6, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: text }) : null;
|
|
1861
1982
|
}
|
|
1862
1983
|
var controlProps = (invalid, readonly = false) => ({
|
|
1863
1984
|
minH: "37px",
|
|
@@ -1968,21 +2089,21 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
|
|
|
1968
2089
|
const multiline = isMultiline(field);
|
|
1969
2090
|
const span = field.span === 2 || multiline;
|
|
1970
2091
|
const readonly = Boolean(field.readonly || field.computed);
|
|
1971
|
-
const wrap = (control, showLabel = true) => /* @__PURE__ */
|
|
1972
|
-
showLabel ? /* @__PURE__ */
|
|
2092
|
+
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: [
|
|
2093
|
+
showLabel ? /* @__PURE__ */ jsx10(Label, { id, label, required: field.required, readonly }) : null,
|
|
1973
2094
|
control,
|
|
1974
|
-
/* @__PURE__ */
|
|
2095
|
+
/* @__PURE__ */ jsx10(ErrorText, { id: errorId, text: message })
|
|
1975
2096
|
] }, field.field);
|
|
1976
2097
|
if (field.widget === "checkbox") {
|
|
1977
2098
|
const checkedValue = String(field.checkedValue ?? true);
|
|
1978
2099
|
const uncheckedValue = String(field.uncheckedValue ?? false);
|
|
1979
2100
|
const checked = (values[field.field] ?? uncheckedValue) === checkedValue;
|
|
1980
2101
|
return wrap(
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
/* @__PURE__ */
|
|
1983
|
-
/* @__PURE__ */
|
|
2102
|
+
/* @__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: [
|
|
2103
|
+
/* @__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) }),
|
|
2104
|
+
/* @__PURE__ */ jsxs6(Text6, { as: "span", fontSize: "11px", fontWeight: "600", children: [
|
|
1984
2105
|
label,
|
|
1985
|
-
field.required && !readonly ? /* @__PURE__ */
|
|
2106
|
+
field.required && !readonly ? /* @__PURE__ */ jsx10(Text6, { as: "span", color: "#DC2626", children: " *" }) : null
|
|
1986
2107
|
] })
|
|
1987
2108
|
] }),
|
|
1988
2109
|
false
|
|
@@ -1990,77 +2111,74 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
|
|
|
1990
2111
|
}
|
|
1991
2112
|
if (field.kind === "ref" && field.ref) {
|
|
1992
2113
|
const reference = resolveReference(field, values);
|
|
1993
|
-
return wrap(/* @__PURE__ */
|
|
2114
|
+
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
2115
|
}
|
|
1995
|
-
if (field.kind === "enum" && field.options?.length) return wrap(/* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
field.options.map((option) => /* @__PURE__ */
|
|
2116
|
+
if (field.kind === "enum" && field.options?.length) return wrap(/* @__PURE__ */ jsxs6(NativeSelect2.Root, { size: "sm", disabled: readonly, children: [
|
|
2117
|
+
/* @__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: [
|
|
2118
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2119
|
+
field.options.map((option) => /* @__PURE__ */ jsx10("option", { value: option, children: option }, option))
|
|
1999
2120
|
] }),
|
|
2000
|
-
/* @__PURE__ */
|
|
2121
|
+
/* @__PURE__ */ jsx10(NativeSelect2.Indicator, {})
|
|
2001
2122
|
] }));
|
|
2002
|
-
if (field.kind === "boolean") return wrap(/* @__PURE__ */
|
|
2003
|
-
/* @__PURE__ */
|
|
2004
|
-
/* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */
|
|
2123
|
+
if (field.kind === "boolean") return wrap(/* @__PURE__ */ jsxs6(NativeSelect2.Root, { size: "sm", disabled: readonly, children: [
|
|
2124
|
+
/* @__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: [
|
|
2125
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2126
|
+
/* @__PURE__ */ jsx10("option", { value: "true", children: "Sim" }),
|
|
2127
|
+
/* @__PURE__ */ jsx10("option", { value: "false", children: "N\xE3o" })
|
|
2007
2128
|
] }),
|
|
2008
|
-
/* @__PURE__ */
|
|
2129
|
+
/* @__PURE__ */ jsx10(NativeSelect2.Indicator, {})
|
|
2009
2130
|
] }));
|
|
2010
|
-
if (multiline) return wrap(/* @__PURE__ */
|
|
2131
|
+
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
2132
|
const mask = resolveInputMask(field);
|
|
2012
2133
|
const numeric = ["number", "currency", "currencyConverted"].includes(field.kind ?? "");
|
|
2013
2134
|
const type = mask ? "text" : field.kind === "date" ? "date" : numeric ? "number" : "text";
|
|
2014
2135
|
const value2 = values[field.field] ?? "";
|
|
2015
2136
|
return wrap(
|
|
2016
|
-
/* @__PURE__ */
|
|
2137
|
+
/* @__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
2138
|
);
|
|
2018
2139
|
};
|
|
2019
2140
|
const combinedErrors = { ...formulaErrors, ...errors };
|
|
2020
2141
|
const invalid = fields.filter((field) => combinedErrors[field.field]);
|
|
2021
2142
|
const generic = dismissed ? null : messageOf(error);
|
|
2022
|
-
return /* @__PURE__ */
|
|
2143
|
+
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
2144
|
if (event.currentTarget === event.target && !submitting) onCancel();
|
|
2024
|
-
}, children: /* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2145
|
+
}, 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: [
|
|
2146
|
+
/* @__PURE__ */ jsxs6(Flex4, { minH: "76px", px: "20px", py: "16px", align: "center", justify: "space-between", borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
|
|
2147
|
+
/* @__PURE__ */ jsxs6(Box5, { children: [
|
|
2148
|
+
/* @__PURE__ */ jsx10(Text6, { color: "#0474AF", fontSize: "10px", fontWeight: "600", letterSpacing: ".07em", textTransform: "uppercase", children: eyebrow }),
|
|
2149
|
+
/* @__PURE__ */ jsx10(Heading2, { mt: "3px", color: "#344054", fontSize: "18px", fontWeight: "600", children: title })
|
|
2029
2150
|
] }),
|
|
2030
|
-
/* @__PURE__ */
|
|
2151
|
+
/* @__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
2152
|
] }),
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
invalid.length ? /* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2153
|
+
/* @__PURE__ */ jsxs6("form", { noValidate: true, onSubmit: submit, children: [
|
|
2154
|
+
/* @__PURE__ */ jsx10(Box5, { maxH: "calc(94vh - 148px)", px: "20px", pt: "18px", pb: "24px", overflowY: "auto", children: /* @__PURE__ */ jsxs6(Stack2, { gap: 4, children: [
|
|
2155
|
+
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: [
|
|
2156
|
+
/* @__PURE__ */ jsxs6(Flex4, { align: "center", gap: "7px", children: [
|
|
2157
|
+
/* @__PURE__ */ jsx10(AlertIcon, {}),
|
|
2158
|
+
/* @__PURE__ */ jsx10(Text6, { as: "strong", children: "Revise os campos abaixo:" })
|
|
2038
2159
|
] }),
|
|
2039
|
-
/* @__PURE__ */
|
|
2160
|
+
/* @__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
2161
|
fieldLabel({ name: field.field, label: field.label }),
|
|
2041
2162
|
": ",
|
|
2042
2163
|
combinedErrors[field.field]
|
|
2043
2164
|
] }) }, field.field)) })
|
|
2044
2165
|
] }) : 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) => {
|
|
2166
|
+
generic && !invalid.length ? /* @__PURE__ */ jsx10(CoreErrorAlert, { error }) : null,
|
|
2167
|
+
/* @__PURE__ */ jsx10(SimpleGrid, { columns: { base: 1, lg: 2 }, gapX: "16px", gapY: "15px", children: items.map((item) => {
|
|
2050
2168
|
if (item.type === "field") return renderField(item.field);
|
|
2051
2169
|
const first = item.fields[0];
|
|
2052
2170
|
const inline = item.fields.some((field) => field.inline !== false);
|
|
2053
|
-
return /* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
first.groupDescription ? /* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2171
|
+
return /* @__PURE__ */ jsxs6(Box5, { gridColumn: "1 / -1", p: "12px", bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
|
|
2172
|
+
/* @__PURE__ */ jsx10(Text6, { color: "#344054", fontSize: "11px", fontWeight: "700", children: first.groupLabel ?? item.id }),
|
|
2173
|
+
first.groupDescription ? /* @__PURE__ */ jsx10(Text6, { mt: "2px", mb: "10px", color: "#667085", fontSize: "10px", children: first.groupDescription }) : /* @__PURE__ */ jsx10(Box5, { h: "8px" }),
|
|
2174
|
+
/* @__PURE__ */ jsx10(Flex4, { direction: inline ? "row" : "column", wrap: "wrap", gap: "9px", children: item.fields.map((field) => renderField(field, true)) })
|
|
2057
2175
|
] }, item.id);
|
|
2058
2176
|
}) })
|
|
2059
2177
|
] }) }),
|
|
2060
|
-
/* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
/* @__PURE__ */
|
|
2178
|
+
/* @__PURE__ */ jsxs6(Flex4, { minH: "68px", px: "20px", py: "14px", justify: "flex-end", gap: "9px", borderTopWidth: "1px", borderColor: "#E5E9ED", children: [
|
|
2179
|
+
/* @__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" }),
|
|
2180
|
+
/* @__PURE__ */ jsxs6(Button4, { type: "submit", minH: "35px", px: "13px", colorPalette: "brand", borderRadius: "6px", fontSize: "11px", fontWeight: "600", loading: submitting, children: [
|
|
2181
|
+
/* @__PURE__ */ jsx10(CheckIcon, {}),
|
|
2064
2182
|
" Salvar"
|
|
2065
2183
|
] })
|
|
2066
2184
|
] })
|
|
@@ -2070,15 +2188,15 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
|
|
|
2070
2188
|
|
|
2071
2189
|
// src/components/internal/CoreDetailModal.tsx
|
|
2072
2190
|
import { useEffect as useEffect6, useMemo as useMemo7, useRef as useRef2, useState as useState9 } from "react";
|
|
2073
|
-
import { Box as
|
|
2191
|
+
import { Box as Box10, Button as Button8, Flex as Flex7, Heading as Heading3, IconButton as IconButton2, Text as Text11 } from "@chakra-ui/react";
|
|
2074
2192
|
import { useQuery as useQuery6, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
2075
2193
|
|
|
2076
2194
|
// src/components/internal/CoreTabbedDetail.tsx
|
|
2077
2195
|
import { useEffect as useEffect5, useMemo as useMemo6, useState as useState8 } from "react";
|
|
2078
|
-
import { Box as
|
|
2196
|
+
import { Box as Box9, Button as Button7, Flex as Flex6, Input as Input4, NativeSelect as NativeSelect3, SimpleGrid as SimpleGrid3, Stack as Stack3, Text as Text10, Textarea as Textarea2 } from "@chakra-ui/react";
|
|
2079
2197
|
|
|
2080
2198
|
// src/components/internal/CoreSummaryCards.tsx
|
|
2081
|
-
import { SimpleGrid as SimpleGrid2, Box as
|
|
2199
|
+
import { SimpleGrid as SimpleGrid2, Box as Box6, Text as Text7, Badge as Badge2 } from "@chakra-ui/react";
|
|
2082
2200
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2083
2201
|
|
|
2084
2202
|
// src/components/internal/manifestUtils.ts
|
|
@@ -2108,7 +2226,7 @@ function resolveInitialDetailTab(config, recordId, initialTab) {
|
|
|
2108
2226
|
}
|
|
2109
2227
|
|
|
2110
2228
|
// src/components/internal/CoreSummaryCards.tsx
|
|
2111
|
-
import { Fragment, jsx as
|
|
2229
|
+
import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2112
2230
|
function format(value2, format2) {
|
|
2113
2231
|
if (format2 === "currency") return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value2 ?? 0));
|
|
2114
2232
|
if (format2 === "percent") return `${Number(value2 ?? 0).toLocaleString("pt-BR")}%`;
|
|
@@ -2124,125 +2242,27 @@ function RelatedMetric({ card, relation, parent }) {
|
|
|
2124
2242
|
let value2 = rows.length;
|
|
2125
2243
|
if (card.source === "relatedSum") value2 = rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0);
|
|
2126
2244
|
if (card.source === "relatedAvg") value2 = rows.length ? rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0) / rows.length : 0;
|
|
2127
|
-
return /* @__PURE__ */
|
|
2245
|
+
return /* @__PURE__ */ jsx11(Fragment, { children: query.isLoading ? "..." : format(value2, card.format) });
|
|
2128
2246
|
}
|
|
2129
2247
|
function CoreSummaryCards({ cards = [], parent, relations }) {
|
|
2130
|
-
return /* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ jsx11(SimpleGrid2, { columns: { base: 1, md: 3 }, gap: 3, children: cards.map((card, index) => {
|
|
2131
2249
|
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__ */
|
|
2250
|
+
const content = relation && card.source?.startsWith("related") ? /* @__PURE__ */ jsx11(RelatedMetric, { card, relation, parent }) : format(parent[card.field ?? ""], card.format);
|
|
2251
|
+
return /* @__PURE__ */ jsxs7(Box6, { p: "14px", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
|
|
2252
|
+
/* @__PURE__ */ jsx11(Text7, { color: "#667085", fontSize: "10px", fontWeight: "600", children: card.label }),
|
|
2253
|
+
/* @__PURE__ */ jsx11(Text7, { mt: "6px", color: "#24323A", fontSize: "20px", fontWeight: "700", children: card.format === "badge" ? /* @__PURE__ */ jsx11(Badge2, { children: content }) : content })
|
|
2136
2254
|
] }, `${card.label}-${index}`);
|
|
2137
2255
|
}) });
|
|
2138
2256
|
}
|
|
2139
2257
|
|
|
2140
2258
|
// src/components/internal/CoreRelatedGrid.tsx
|
|
2141
2259
|
import { useMemo as useMemo5, useState as useState7 } from "react";
|
|
2142
|
-
import { Badge as Badge3, Box as
|
|
2260
|
+
import { Badge as Badge3, Box as Box8, Button as Button6, Flex as Flex5, IconButton, Table as Table2, Text as Text9 } from "@chakra-ui/react";
|
|
2143
2261
|
import { useMutation, useQuery as useQuery5, useQueryClient } from "@tanstack/react-query";
|
|
2144
2262
|
|
|
2145
|
-
// src/components/internal/CoreInlineEditableCell.tsx
|
|
2146
|
-
import { Input as Input4, NativeSelect as NativeSelect3, Textarea as Textarea2 } from "@chakra-ui/react";
|
|
2147
|
-
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2148
|
-
function CoreInlineEditableCell({ column, meta, value: value2, onChange }) {
|
|
2149
|
-
const kind = column.editor ?? meta?.kind ?? column.kind ?? "string";
|
|
2150
|
-
const plainValue = value2 == null ? "" : String(value2);
|
|
2151
|
-
const common = {
|
|
2152
|
-
size: "xs",
|
|
2153
|
-
fontSize: "11px",
|
|
2154
|
-
value: plainValue,
|
|
2155
|
-
onChange: (event) => onChange(event.currentTarget.value)
|
|
2156
|
-
};
|
|
2157
|
-
if (kind === "boolean") return /* @__PURE__ */ jsxs7(NativeSelect3.Root, { size: "xs", children: [
|
|
2158
|
-
/* @__PURE__ */ jsxs7(NativeSelect3.Field, { ...common, children: [
|
|
2159
|
-
/* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
|
|
2160
|
-
/* @__PURE__ */ jsx11("option", { value: "true", children: "Sim" }),
|
|
2161
|
-
/* @__PURE__ */ jsx11("option", { value: "false", children: "N\xE3o" })
|
|
2162
|
-
] }),
|
|
2163
|
-
/* @__PURE__ */ jsx11(NativeSelect3.Indicator, {})
|
|
2164
|
-
] });
|
|
2165
|
-
if ((kind === "enum" || kind === "select") && meta?.options?.length) return /* @__PURE__ */ jsxs7(NativeSelect3.Root, { size: "xs", children: [
|
|
2166
|
-
/* @__PURE__ */ jsxs7(NativeSelect3.Field, { ...common, children: [
|
|
2167
|
-
/* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
|
|
2168
|
-
meta.options.map((option) => /* @__PURE__ */ jsx11("option", { value: option, children: option }, option))
|
|
2169
|
-
] }),
|
|
2170
|
-
/* @__PURE__ */ jsx11(NativeSelect3.Indicator, {})
|
|
2171
|
-
] });
|
|
2172
|
-
if (kind === "textarea") return /* @__PURE__ */ jsx11(Textarea2, { ...common, rows: 2 });
|
|
2173
|
-
const mask = resolveInputMask({ field: column.field, kind });
|
|
2174
|
-
const type = mask ? "text" : kind === "date" ? "date" : kind === "number" ? "number" : "text";
|
|
2175
|
-
return /* @__PURE__ */ jsx11(
|
|
2176
|
-
Input4,
|
|
2177
|
-
{
|
|
2178
|
-
size: "xs",
|
|
2179
|
-
fontSize: "11px",
|
|
2180
|
-
type,
|
|
2181
|
-
step: type === "number" ? "any" : void 0,
|
|
2182
|
-
inputMode: inputModeForMask(mask),
|
|
2183
|
-
maxLength: maxLengthForMask(mask),
|
|
2184
|
-
value: mask ? formatMaskedValue(plainValue, mask) : plainValue,
|
|
2185
|
-
onChange: (event) => onChange(parseMaskedInput(event.currentTarget.value, mask))
|
|
2186
|
-
}
|
|
2187
|
-
);
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
2263
|
// src/components/internal/CoreRowAction.tsx
|
|
2191
2264
|
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
|
-
}
|
|
2265
|
+
import { Box as Box7, Button as Button5, Text as Text8 } from "@chakra-ui/react";
|
|
2246
2266
|
|
|
2247
2267
|
// src/components/internal/conditions.ts
|
|
2248
2268
|
function valueAt(source, path) {
|
|
@@ -2307,7 +2327,7 @@ var ACTION_TONES = {
|
|
|
2307
2327
|
function ActionErrorMessage({ error }) {
|
|
2308
2328
|
const description = describeActionError(error);
|
|
2309
2329
|
return /* @__PURE__ */ jsxs8(
|
|
2310
|
-
|
|
2330
|
+
Box7,
|
|
2311
2331
|
{
|
|
2312
2332
|
role: "alert",
|
|
2313
2333
|
mt: "5px",
|
|
@@ -2318,8 +2338,8 @@ function ActionErrorMessage({ error }) {
|
|
|
2318
2338
|
borderColor: "#FECDCA",
|
|
2319
2339
|
borderRadius: "6px",
|
|
2320
2340
|
children: [
|
|
2321
|
-
/* @__PURE__ */ jsx13(
|
|
2322
|
-
description.context ? /* @__PURE__ */ jsx13(
|
|
2341
|
+
/* @__PURE__ */ jsx13(Text8, { color: "#B42318", fontSize: "10px", fontWeight: "600", lineHeight: "1.35", children: description.message }),
|
|
2342
|
+
description.context ? /* @__PURE__ */ jsx13(Text8, { mt: "2px", color: "#7A271A", fontSize: "9px", lineHeight: "1.35", children: description.context }) : null
|
|
2323
2343
|
]
|
|
2324
2344
|
}
|
|
2325
2345
|
);
|
|
@@ -2485,7 +2505,19 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2485
2505
|
}
|
|
2486
2506
|
|
|
2487
2507
|
// src/components/internal/CoreRelatedGrid.tsx
|
|
2488
|
-
import {
|
|
2508
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2509
|
+
function EditIcon2() {
|
|
2510
|
+
return /* @__PURE__ */ jsxs9("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
|
|
2511
|
+
/* @__PURE__ */ jsx14("path", { d: "M4 14.5V16h1.5L14.7 6.8l-1.5-1.5L4 14.5Z", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinejoin: "round" }),
|
|
2512
|
+
/* @__PURE__ */ jsx14("path", { d: "m12.5 6 1.5-1.5a1.05 1.05 0 0 1 1.5 0l.1.1a1.05 1.05 0 0 1 0 1.5L14.1 7.6", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinecap: "round" })
|
|
2513
|
+
] });
|
|
2514
|
+
}
|
|
2515
|
+
function TrashIcon2() {
|
|
2516
|
+
return /* @__PURE__ */ jsxs9("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
|
|
2517
|
+
/* @__PURE__ */ jsx14("path", { d: "M5.5 6.5h9l-.6 9H6.1l-.6-9Zm2-2h5l.7 2H6.8l.7-2Z", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinejoin: "round" }),
|
|
2518
|
+
/* @__PURE__ */ jsx14("path", { d: "M4.5 6.5h11", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinecap: "round" })
|
|
2519
|
+
] });
|
|
2520
|
+
}
|
|
2489
2521
|
function parentValueAt(parent, path) {
|
|
2490
2522
|
return path.split(".").reduce((current, part) => {
|
|
2491
2523
|
if (!current || typeof current !== "object") return void 0;
|
|
@@ -2498,6 +2530,22 @@ function mergeCreateFields(schemaFields, overrides, foreignKey) {
|
|
|
2498
2530
|
const byName = new Map(base.map((field) => [field.field, field]));
|
|
2499
2531
|
return overrides.map((override) => ({ ...byName.get(override.field) ?? {}, ...override }));
|
|
2500
2532
|
}
|
|
2533
|
+
function modalEditFields(schemaFields, tab, fallback, foreignKey) {
|
|
2534
|
+
const byName = new Map(schemaFields.map((field) => [field.field, field]));
|
|
2535
|
+
const configured = (tab.columns ?? []).filter((column) => typeof column !== "string" && column.editable === true && column.readonly !== true).map((column) => {
|
|
2536
|
+
if (typeof column === "string") return void 0;
|
|
2537
|
+
const base = byName.get(column.field);
|
|
2538
|
+
if (!base || column.field === foreignKey) return void 0;
|
|
2539
|
+
return {
|
|
2540
|
+
...base,
|
|
2541
|
+
field: column.field,
|
|
2542
|
+
...column.label ? { label: column.label } : {},
|
|
2543
|
+
...column.kind ? { kind: column.kind } : {},
|
|
2544
|
+
...column.required != null ? { required: column.required } : {}
|
|
2545
|
+
};
|
|
2546
|
+
}).filter((field) => Boolean(field));
|
|
2547
|
+
return configured.length ? configured : fallback;
|
|
2548
|
+
}
|
|
2501
2549
|
function CoreRelatedGrid({
|
|
2502
2550
|
tab: rawTab,
|
|
2503
2551
|
parent,
|
|
@@ -2527,27 +2575,36 @@ function CoreRelatedGrid({
|
|
|
2527
2575
|
() => mergeCreateFields(schemaFormFields, tab.create?.fields, relation?.foreignKey),
|
|
2528
2576
|
[schemaFormFields, tab.create?.fields, relation?.foreignKey]
|
|
2529
2577
|
);
|
|
2578
|
+
const editFields = useMemo5(
|
|
2579
|
+
() => modalEditFields(schemaFormFields, tab, createFields, relation?.foreignKey),
|
|
2580
|
+
[schemaFormFields, tab, createFields, relation?.foreignKey]
|
|
2581
|
+
);
|
|
2530
2582
|
const createInitialValues = useMemo5(() => {
|
|
2531
2583
|
const inherited = Object.fromEntries(
|
|
2532
2584
|
Object.entries(tab.create?.initialValuesFromParent ?? {}).map(([field, path]) => [field, parentValueAt(parent, path)])
|
|
2533
2585
|
);
|
|
2534
2586
|
return { ...tab.create?.initialValues ?? {}, ...inherited };
|
|
2535
2587
|
}, [tab.create?.initialValues, tab.create?.initialValuesFromParent, parent]);
|
|
2536
|
-
const [drafts, setDrafts] = useState7({});
|
|
2537
|
-
const [errors, setErrors] = useState7({});
|
|
2538
2588
|
const [creating, setCreating] = useState7(false);
|
|
2539
2589
|
const [createError, setCreateError] = useState7(null);
|
|
2540
|
-
const
|
|
2590
|
+
const [editing, setEditing] = useState7(null);
|
|
2591
|
+
const [editError, setEditError] = useState7(null);
|
|
2592
|
+
const canEdit = tab.type === "relatedGrid" && tab.editable === true;
|
|
2541
2593
|
const canCreate = tab.type === "relatedGrid" && tab.create?.enabled !== false && !!tab.create;
|
|
2542
2594
|
const canDelete = tab.type === "relatedGrid" && tab.delete?.enabled === true;
|
|
2543
|
-
const hasActions =
|
|
2595
|
+
const hasActions = canEdit || canDelete || !!tab.rowActions?.length;
|
|
2544
2596
|
const invalidate = async () => {
|
|
2545
2597
|
await queryClient.invalidateQueries({ queryKey: key });
|
|
2546
2598
|
onRefresh?.(["self"]);
|
|
2547
2599
|
};
|
|
2548
2600
|
const updateMutation = useMutation({
|
|
2549
2601
|
mutationFn: ({ id, values }) => resource.update(id, values),
|
|
2550
|
-
onSuccess:
|
|
2602
|
+
onSuccess: async () => {
|
|
2603
|
+
await invalidate();
|
|
2604
|
+
setEditing(null);
|
|
2605
|
+
setEditError(null);
|
|
2606
|
+
},
|
|
2607
|
+
onError: setEditError
|
|
2551
2608
|
});
|
|
2552
2609
|
const createMutation = useMutation({
|
|
2553
2610
|
mutationFn: (values) => resource.create({
|
|
@@ -2566,81 +2623,64 @@ function CoreRelatedGrid({
|
|
|
2566
2623
|
mutationFn: (id) => resource.delete(id),
|
|
2567
2624
|
onSuccess: invalidate
|
|
2568
2625
|
});
|
|
2569
|
-
if (!relation) return /* @__PURE__ */ jsx14(
|
|
2570
|
-
if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */ jsx14(
|
|
2626
|
+
if (!relation) return /* @__PURE__ */ jsx14(Text9, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
|
|
2627
|
+
if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */ jsx14(Text9, { color: "#667085", children: "Carregando..." });
|
|
2571
2628
|
const rows = query.data?.results ?? [];
|
|
2572
|
-
|
|
2573
|
-
...current,
|
|
2574
|
-
[id]: { ...current[id] ?? {}, [field]: value2 }
|
|
2575
|
-
}));
|
|
2576
|
-
return /* @__PURE__ */ jsxs9(Box7, { children: [
|
|
2629
|
+
return /* @__PURE__ */ jsxs9(Box8, { children: [
|
|
2577
2630
|
canCreate ? /* @__PURE__ */ jsx14(Flex5, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx14(Button6, { size: "sm", colorPalette: "brand", onClick: () => {
|
|
2578
2631
|
setCreateError(null);
|
|
2579
2632
|
setCreating(true);
|
|
2580
2633
|
}, children: tab.create?.label ?? "Novo registro" }) }) : null,
|
|
2581
|
-
/* @__PURE__ */ jsx14(
|
|
2634
|
+
/* @__PURE__ */ jsx14(Box8, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs9(Table2.Root, { size: "sm", minW: "760px", children: [
|
|
2582
2635
|
/* @__PURE__ */ jsx14(Table2.Header, { children: /* @__PURE__ */ jsxs9(Table2.Row, { bg: "#F4F7F9", children: [
|
|
2583
2636
|
columns.map((column) => /* @__PURE__ */ jsx14(Table2.ColumnHeader, { fontSize: "10px", children: column.label ?? column.field }, column.field)),
|
|
2584
|
-
hasActions ? /* @__PURE__ */ jsx14(Table2.ColumnHeader, { children: "A\xE7\xF5es" }) : null
|
|
2637
|
+
hasActions ? /* @__PURE__ */ jsx14(Table2.ColumnHeader, { w: "92px", textAlign: "center", children: "A\xE7\xF5es" }) : null
|
|
2585
2638
|
] }) }),
|
|
2586
2639
|
/* @__PURE__ */ jsxs9(Table2.Body, { children: [
|
|
2587
2640
|
rows.map((row, index) => {
|
|
2588
2641
|
const id = String(row._id ?? row.id ?? index);
|
|
2589
|
-
|
|
2590
|
-
const dirty = Object.keys(draft).length > 0;
|
|
2591
|
-
return /* @__PURE__ */ jsxs9(Table2.Row, { bg: dirty ? "#FFFBEB" : index % 2 ? "#FBFCFD" : "white", children: [
|
|
2642
|
+
return /* @__PURE__ */ jsxs9(Table2.Row, { bg: index % 2 ? "#FBFCFD" : "white", _hover: { bg: "#F0F7FF" }, children: [
|
|
2592
2643
|
columns.map((column) => {
|
|
2593
|
-
const value2 =
|
|
2594
|
-
|
|
2595
|
-
const canEdit = editable && column.readonly !== true && (column.editable === true || !column.readonly);
|
|
2596
|
-
return /* @__PURE__ */ jsx14(Table2.Cell, { fontSize: "11px", children: canEdit ? /* @__PURE__ */ jsx14(CoreInlineEditableCell, { column, meta, value: value2, onChange: (next) => setDraft(id, column.field, next) }) : column.display === "badgeExists" ? /* @__PURE__ */ jsx14(Badge3, { colorPalette: value2 ? "green" : "gray", children: value2 ? "Sim" : "N\xE3o" }) : formatCell(value2, column.kind) }, column.field);
|
|
2644
|
+
const value2 = row[column.field];
|
|
2645
|
+
return /* @__PURE__ */ jsx14(Table2.Cell, { fontSize: "11px", children: column.display === "badgeExists" ? /* @__PURE__ */ jsx14(Badge3, { colorPalette: value2 ? "green" : "gray", children: value2 ? "Sim" : "N\xE3o" }) : formatCell(value2, column.kind) }, column.field);
|
|
2597
2646
|
}),
|
|
2598
|
-
hasActions ? /* @__PURE__ */ jsx14(Table2.Cell, { children: /* @__PURE__ */ jsxs9(Flex5, { gap: "
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
});
|
|
2615
|
-
},
|
|
2616
|
-
children: "Salvar"
|
|
2617
|
-
}
|
|
2618
|
-
),
|
|
2619
|
-
/* @__PURE__ */ jsx14(Button6, { size: "xs", variant: "outline", onClick: () => setDrafts((current) => {
|
|
2620
|
-
const next = { ...current };
|
|
2621
|
-
delete next[id];
|
|
2622
|
-
return next;
|
|
2623
|
-
}), children: "Cancelar" })
|
|
2624
|
-
] }) : null,
|
|
2647
|
+
hasActions ? /* @__PURE__ */ jsx14(Table2.Cell, { children: /* @__PURE__ */ jsxs9(Flex5, { gap: "4px", align: "center", justify: "center", wrap: "wrap", children: [
|
|
2648
|
+
canEdit ? /* @__PURE__ */ jsx14(
|
|
2649
|
+
IconButton,
|
|
2650
|
+
{
|
|
2651
|
+
"aria-label": "Editar registro",
|
|
2652
|
+
title: "Editar",
|
|
2653
|
+
size: "xs",
|
|
2654
|
+
variant: "ghost",
|
|
2655
|
+
color: "#0474AF",
|
|
2656
|
+
onClick: () => {
|
|
2657
|
+
setEditError(null);
|
|
2658
|
+
setEditing(row);
|
|
2659
|
+
},
|
|
2660
|
+
children: /* @__PURE__ */ jsx14(EditIcon2, {})
|
|
2661
|
+
}
|
|
2662
|
+
) : null,
|
|
2625
2663
|
tab.rowActions?.map((action) => /* @__PURE__ */ jsx14(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
|
|
2626
2664
|
canDelete ? /* @__PURE__ */ jsx14(
|
|
2627
|
-
|
|
2665
|
+
IconButton,
|
|
2628
2666
|
{
|
|
2667
|
+
"aria-label": "Excluir registro",
|
|
2668
|
+
title: "Excluir",
|
|
2629
2669
|
size: "xs",
|
|
2630
|
-
variant: "
|
|
2670
|
+
variant: "ghost",
|
|
2671
|
+
color: "#B42318",
|
|
2631
2672
|
loading: deleteMutation.isPending,
|
|
2632
2673
|
onClick: () => {
|
|
2633
2674
|
const message = tab.delete?.confirm ?? "Excluir este registro relacionado?";
|
|
2634
2675
|
if (window.confirm(message)) deleteMutation.mutate(id);
|
|
2635
2676
|
},
|
|
2636
|
-
children:
|
|
2677
|
+
children: /* @__PURE__ */ jsx14(TrashIcon2, {})
|
|
2637
2678
|
}
|
|
2638
|
-
) : null
|
|
2639
|
-
errors[id] ? /* @__PURE__ */ jsx14(Text8, { color: "#B42318", fontSize: "9px", children: "Erro ao salvar." }) : null
|
|
2679
|
+
) : null
|
|
2640
2680
|
] }) }) : null
|
|
2641
2681
|
] }, id);
|
|
2642
2682
|
}),
|
|
2643
|
-
rows.length === 0 ? /* @__PURE__ */ jsx14(Table2.Row, { children: /* @__PURE__ */ jsx14(Table2.Cell, { colSpan: columns.length + (hasActions ? 1 : 0), children: /* @__PURE__ */ jsx14(
|
|
2683
|
+
rows.length === 0 ? /* @__PURE__ */ jsx14(Table2.Row, { children: /* @__PURE__ */ jsx14(Table2.Cell, { colSpan: columns.length + (hasActions ? 1 : 0), children: /* @__PURE__ */ jsx14(Text9, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
|
|
2644
2684
|
] })
|
|
2645
2685
|
] }) }),
|
|
2646
2686
|
creating ? /* @__PURE__ */ jsx14(
|
|
@@ -2658,6 +2698,25 @@ function CoreRelatedGrid({
|
|
|
2658
2698
|
if (!createMutation.isPending) setCreating(false);
|
|
2659
2699
|
}
|
|
2660
2700
|
}
|
|
2701
|
+
) : null,
|
|
2702
|
+
editing ? /* @__PURE__ */ jsx14(
|
|
2703
|
+
DynamicForm,
|
|
2704
|
+
{
|
|
2705
|
+
title: `Editar ${schema?.singular ?? relation.model}`,
|
|
2706
|
+
eyebrow: "Registro relacionado",
|
|
2707
|
+
fields: editFields,
|
|
2708
|
+
initialValues: editing,
|
|
2709
|
+
submitting: updateMutation.isPending,
|
|
2710
|
+
error: editError,
|
|
2711
|
+
onSubmit: (values) => {
|
|
2712
|
+
const id = String(editing._id ?? editing.id ?? "");
|
|
2713
|
+
if (id) updateMutation.mutate({ id, values });
|
|
2714
|
+
},
|
|
2715
|
+
onFieldChange: () => setEditError(null),
|
|
2716
|
+
onCancel: () => {
|
|
2717
|
+
if (!updateMutation.isPending) setEditing(null);
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2661
2720
|
) : null
|
|
2662
2721
|
] });
|
|
2663
2722
|
}
|
|
@@ -2689,20 +2748,6 @@ function initialReactiveValues2(fields, parent) {
|
|
|
2689
2748
|
function isMultiline2(field) {
|
|
2690
2749
|
return /observa|descricao|mensagem|detalhe|necessidade/i.test(field.field);
|
|
2691
2750
|
}
|
|
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
2751
|
function fieldErrorsOf(error) {
|
|
2707
2752
|
if (!error || typeof error !== "object") return {};
|
|
2708
2753
|
const record = error;
|
|
@@ -2749,14 +2794,14 @@ function resolveReference2(field, values) {
|
|
|
2749
2794
|
function FieldLabel({ field, htmlFor }) {
|
|
2750
2795
|
const label = fieldLabel({ name: field.field, label: field.label });
|
|
2751
2796
|
const readonly = Boolean(field.readonly || field.computed);
|
|
2752
|
-
return /* @__PURE__ */ jsx15("label", { htmlFor, children: /* @__PURE__ */ jsxs10(
|
|
2797
|
+
return /* @__PURE__ */ jsx15("label", { htmlFor, children: /* @__PURE__ */ jsxs10(Text10, { as: "span", display: "block", mb: "5px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
|
|
2753
2798
|
label,
|
|
2754
|
-
field.required && !readonly ? /* @__PURE__ */ jsx15(
|
|
2755
|
-
readonly ? /* @__PURE__ */ jsx15(
|
|
2799
|
+
field.required && !readonly ? /* @__PURE__ */ jsx15(Text10, { as: "span", color: "#DC2626", children: " *" }) : null,
|
|
2800
|
+
readonly ? /* @__PURE__ */ jsx15(Text10, { as: "span", ml: "5px", color: "#98A2B3", fontSize: "9px", fontWeight: "500", children: "somente leitura" }) : null
|
|
2756
2801
|
] }) });
|
|
2757
2802
|
}
|
|
2758
2803
|
function ErrorText2({ id, message }) {
|
|
2759
|
-
return message ? /* @__PURE__ */ jsx15(
|
|
2804
|
+
return message ? /* @__PURE__ */ jsx15(Text10, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: message }) : null;
|
|
2760
2805
|
}
|
|
2761
2806
|
function FieldControl({
|
|
2762
2807
|
field,
|
|
@@ -2781,9 +2826,9 @@ function FieldControl({
|
|
|
2781
2826
|
const checkedValue = String(field.checkedValue ?? true);
|
|
2782
2827
|
const uncheckedValue = String(field.uncheckedValue ?? false);
|
|
2783
2828
|
const checked = (value2 || uncheckedValue) === checkedValue;
|
|
2784
|
-
return /* @__PURE__ */ jsxs10(
|
|
2829
|
+
return /* @__PURE__ */ jsxs10(Box9, { children: [
|
|
2785
2830
|
/* @__PURE__ */ jsxs10(
|
|
2786
|
-
|
|
2831
|
+
Box9,
|
|
2787
2832
|
{
|
|
2788
2833
|
as: "label",
|
|
2789
2834
|
display: "flex",
|
|
@@ -2811,7 +2856,7 @@ function FieldControl({
|
|
|
2811
2856
|
onChange: (event) => onChange(event.currentTarget.checked ? checkedValue : uncheckedValue)
|
|
2812
2857
|
}
|
|
2813
2858
|
),
|
|
2814
|
-
/* @__PURE__ */ jsx15(
|
|
2859
|
+
/* @__PURE__ */ jsx15(Text10, { as: "span", fontSize: "11px", fontWeight: "600", children: label })
|
|
2815
2860
|
]
|
|
2816
2861
|
}
|
|
2817
2862
|
),
|
|
@@ -2820,7 +2865,7 @@ function FieldControl({
|
|
|
2820
2865
|
}
|
|
2821
2866
|
if (field.kind === "ref" && field.ref) {
|
|
2822
2867
|
const reference = resolveReference2(field, values);
|
|
2823
|
-
return /* @__PURE__ */ jsxs10(
|
|
2868
|
+
return /* @__PURE__ */ jsxs10(Box9, { children: [
|
|
2824
2869
|
/* @__PURE__ */ jsx15(FieldLabel, { field, htmlFor: inputId }),
|
|
2825
2870
|
/* @__PURE__ */ jsx15(
|
|
2826
2871
|
ReferenceSelect,
|
|
@@ -2845,21 +2890,21 @@ function FieldControl({
|
|
|
2845
2890
|
] });
|
|
2846
2891
|
}
|
|
2847
2892
|
const mask = resolveInputMask(field);
|
|
2848
|
-
const control = field.kind === "enum" && field.options?.length ? /* @__PURE__ */ jsxs10(
|
|
2849
|
-
/* @__PURE__ */ jsxs10(
|
|
2893
|
+
const control = field.kind === "enum" && field.options?.length ? /* @__PURE__ */ jsxs10(NativeSelect3.Root, { size: "sm", disabled: readonly, children: [
|
|
2894
|
+
/* @__PURE__ */ jsxs10(NativeSelect3.Field, { id: inputId, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
|
|
2850
2895
|
/* @__PURE__ */ jsx15("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2851
2896
|
field.options.map((option) => /* @__PURE__ */ jsx15("option", { value: option, children: option }, option))
|
|
2852
2897
|
] }),
|
|
2853
|
-
/* @__PURE__ */ jsx15(
|
|
2854
|
-
] }) : field.kind === "boolean" ? /* @__PURE__ */ jsxs10(
|
|
2855
|
-
/* @__PURE__ */ jsxs10(
|
|
2898
|
+
/* @__PURE__ */ jsx15(NativeSelect3.Indicator, {})
|
|
2899
|
+
] }) : field.kind === "boolean" ? /* @__PURE__ */ jsxs10(NativeSelect3.Root, { size: "sm", disabled: readonly, children: [
|
|
2900
|
+
/* @__PURE__ */ jsxs10(NativeSelect3.Field, { id: inputId, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
|
|
2856
2901
|
/* @__PURE__ */ jsx15("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2857
2902
|
/* @__PURE__ */ jsx15("option", { value: "true", children: "Sim" }),
|
|
2858
2903
|
/* @__PURE__ */ jsx15("option", { value: "false", children: "N\xE3o" })
|
|
2859
2904
|
] }),
|
|
2860
|
-
/* @__PURE__ */ jsx15(
|
|
2861
|
-
] }) : isMultiline2(field) ? /* @__PURE__ */ jsx15(
|
|
2862
|
-
|
|
2905
|
+
/* @__PURE__ */ jsx15(NativeSelect3.Indicator, {})
|
|
2906
|
+
] }) : isMultiline2(field) ? /* @__PURE__ */ jsx15(Textarea2, { id: inputId, rows: 4, resize: "vertical", readOnly: readonly, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value) }) : /* @__PURE__ */ jsx15(
|
|
2907
|
+
Input4,
|
|
2863
2908
|
{
|
|
2864
2909
|
id: inputId,
|
|
2865
2910
|
size: "sm",
|
|
@@ -2873,7 +2918,7 @@ function FieldControl({
|
|
|
2873
2918
|
onChange: (event) => onChange(parseMaskedInput(event.currentTarget.value, mask))
|
|
2874
2919
|
}
|
|
2875
2920
|
);
|
|
2876
|
-
return /* @__PURE__ */ jsxs10(
|
|
2921
|
+
return /* @__PURE__ */ jsxs10(Box9, { children: [
|
|
2877
2922
|
/* @__PURE__ */ jsx15(FieldLabel, { field, htmlFor: inputId }),
|
|
2878
2923
|
control,
|
|
2879
2924
|
/* @__PURE__ */ jsx15(ErrorText2, { id: errorId, message: error })
|
|
@@ -2889,9 +2934,9 @@ function GroupSection({
|
|
|
2889
2934
|
}) {
|
|
2890
2935
|
if (!fields.length) return null;
|
|
2891
2936
|
const columns = group.columns ?? 2;
|
|
2892
|
-
return /* @__PURE__ */ jsxs10(
|
|
2893
|
-
/* @__PURE__ */ jsx15(
|
|
2894
|
-
group.description ? /* @__PURE__ */ jsx15(
|
|
2937
|
+
return /* @__PURE__ */ jsxs10(Box9, { p: { base: "12px", md: "14px" }, bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
|
|
2938
|
+
/* @__PURE__ */ jsx15(Text10, { color: "#344054", fontSize: "12px", fontWeight: "700", children: group.label }),
|
|
2939
|
+
group.description ? /* @__PURE__ */ jsx15(Text10, { mt: "2px", mb: "12px", color: "#667085", fontSize: "10px", children: group.description }) : /* @__PURE__ */ jsx15(Box9, { h: "10px" }),
|
|
2895
2940
|
/* @__PURE__ */ jsx15(SimpleGrid3, { columns: { base: 1, md: Math.min(columns, 2), xl: columns }, gapX: "16px", gapY: "14px", children: fields.map((field) => /* @__PURE__ */ jsx15(
|
|
2896
2941
|
FieldControl,
|
|
2897
2942
|
{
|
|
@@ -3037,7 +3082,7 @@ function InlineParentForm({
|
|
|
3037
3082
|
}
|
|
3038
3083
|
},
|
|
3039
3084
|
children: /* @__PURE__ */ jsxs10(Stack3, { gap: "16px", children: [
|
|
3040
|
-
error ? /* @__PURE__ */ jsx15(
|
|
3085
|
+
error ? /* @__PURE__ */ jsx15(CoreErrorAlert, { error }) : null,
|
|
3041
3086
|
renderFields(),
|
|
3042
3087
|
!externalSubmit ? /* @__PURE__ */ jsx15(Flex6, { justify: "flex-end", children: /* @__PURE__ */ jsx15(Button7, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) }) : null
|
|
3043
3088
|
] })
|
|
@@ -3081,8 +3126,8 @@ function CoreTabbedDetail({
|
|
|
3081
3126
|
tab.id
|
|
3082
3127
|
);
|
|
3083
3128
|
}) }),
|
|
3084
|
-
/* @__PURE__ */ jsxs10(
|
|
3085
|
-
hasFormTab ? /* @__PURE__ */ jsx15(
|
|
3129
|
+
/* @__PURE__ */ jsxs10(Box9, { children: [
|
|
3130
|
+
hasFormTab ? /* @__PURE__ */ jsx15(Box9, { display: activeForm ? "block" : "none", children: /* @__PURE__ */ jsx15(
|
|
3086
3131
|
InlineParentForm,
|
|
3087
3132
|
{
|
|
3088
3133
|
fields: draftFields,
|
|
@@ -3106,10 +3151,10 @@ function CoreTabbedDetail({
|
|
|
3106
3151
|
refreshToken: refreshTokens[active.id],
|
|
3107
3152
|
onRefresh
|
|
3108
3153
|
}
|
|
3109
|
-
) : active.type === "customComponent" ? /* @__PURE__ */ jsxs10(
|
|
3154
|
+
) : active.type === "customComponent" ? /* @__PURE__ */ jsxs10(Text10, { color: "#667085", children: [
|
|
3110
3155
|
"Componente customizado: ",
|
|
3111
3156
|
active.component
|
|
3112
|
-
] }) : /* @__PURE__ */ jsx15(
|
|
3157
|
+
] }) : /* @__PURE__ */ jsx15(Text10, { color: "#667085", children: "Salve o registro principal para liberar esta aba." })
|
|
3113
3158
|
] })
|
|
3114
3159
|
] });
|
|
3115
3160
|
}
|
|
@@ -3160,7 +3205,9 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
|
|
|
3160
3205
|
});
|
|
3161
3206
|
};
|
|
3162
3207
|
const width = config.size === "full" ? "98vw" : config.size === "md" ? "760px" : config.size === "lg" ? "980px" : "1180px";
|
|
3163
|
-
const
|
|
3208
|
+
const titleField = config.titleField ?? "";
|
|
3209
|
+
const titleFieldMeta = schema?.fields.find((field) => field.name === titleField);
|
|
3210
|
+
const displayTitle = parent?.[titleField] != null ? formatCell(parent[titleField], titleFieldMeta?.kind) : title;
|
|
3164
3211
|
const activeIsForm = (config.tabs.find((tab) => tab.id === activeTab) ?? config.tabs[0])?.type === "form";
|
|
3165
3212
|
const hasFormTab = config.tabs.some((tab) => tab.type === "form");
|
|
3166
3213
|
const formId = `oon-detail-form-${model.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
@@ -3176,18 +3223,18 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
|
|
|
3176
3223
|
form.requestSubmit();
|
|
3177
3224
|
};
|
|
3178
3225
|
return /* @__PURE__ */ jsx16(DetailRecordProvider, { record: parent, setRecord: setParent, children: /* @__PURE__ */ jsxs11(Flex7, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.48)", children: [
|
|
3179
|
-
/* @__PURE__ */ jsxs11(
|
|
3226
|
+
/* @__PURE__ */ jsxs11(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: [
|
|
3180
3227
|
/* @__PURE__ */ jsxs11(Flex7, { minH: "72px", px: "20px", py: "10px", align: "center", justify: "space-between", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
|
|
3181
|
-
/* @__PURE__ */ jsxs11(
|
|
3182
|
-
/* @__PURE__ */ jsx16(
|
|
3228
|
+
/* @__PURE__ */ jsxs11(Box10, { minW: "160px", children: [
|
|
3229
|
+
/* @__PURE__ */ jsx16(Text11, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
|
|
3183
3230
|
/* @__PURE__ */ jsx16(Heading3, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
|
|
3184
3231
|
] }),
|
|
3185
3232
|
/* @__PURE__ */ jsxs11(Flex7, { flex: "1", align: "center", justify: "flex-end", gap: "8px", wrap: "wrap", children: [
|
|
3186
3233
|
recordId ? topActions : null,
|
|
3187
|
-
/* @__PURE__ */ jsx16(
|
|
3234
|
+
/* @__PURE__ */ jsx16(IconButton2, { "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
3235
|
] })
|
|
3189
3236
|
] }),
|
|
3190
|
-
/* @__PURE__ */ jsx16(
|
|
3237
|
+
/* @__PURE__ */ jsx16(Box10, { flex: "1", minH: 0, p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx16(Text11, { children: "Carregando..." }) : /* @__PURE__ */ jsx16(
|
|
3191
3238
|
CoreTabbedDetail,
|
|
3192
3239
|
{
|
|
3193
3240
|
tabs: config.tabs,
|
|
@@ -3218,13 +3265,13 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
|
|
|
3218
3265
|
}
|
|
3219
3266
|
) }),
|
|
3220
3267
|
/* @__PURE__ */ jsxs11(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: [
|
|
3221
|
-
/* @__PURE__ */ jsx16(
|
|
3268
|
+
/* @__PURE__ */ jsx16(Box10, { children: recordId ? bottomActions : null }),
|
|
3222
3269
|
/* @__PURE__ */ jsx16(Button8, { type: "submit", form: formId, colorPalette: "brand", disabled: !hasFormTab || !activeIsForm && !dirty || schemaQuery.isLoading || parentQuery.isLoading, children: "Salvar" })
|
|
3223
3270
|
] })
|
|
3224
3271
|
] }),
|
|
3225
|
-
confirmingClose ? /* @__PURE__ */ jsx16(Flex7, { position: "fixed", inset: 0, zIndex: 1100, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.58)", children: /* @__PURE__ */ jsxs11(
|
|
3272
|
+
confirmingClose ? /* @__PURE__ */ jsx16(Flex7, { position: "fixed", inset: 0, zIndex: 1100, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.58)", children: /* @__PURE__ */ jsxs11(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: [
|
|
3226
3273
|
/* @__PURE__ */ jsx16(Heading3, { id: "oon-unsaved-title", size: "md", children: "Altera\xE7\xF5es n\xE3o salvas" }),
|
|
3227
|
-
/* @__PURE__ */ jsx16(
|
|
3274
|
+
/* @__PURE__ */ jsx16(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." }),
|
|
3228
3275
|
/* @__PURE__ */ jsxs11(Flex7, { mt: "22px", justify: "flex-end", gap: "10px", wrap: "wrap", children: [
|
|
3229
3276
|
/* @__PURE__ */ jsx16(Button8, { variant: "ghost", onClick: () => {
|
|
3230
3277
|
closeAfterSaveRef.current = false;
|
|
@@ -3288,10 +3335,10 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3288
3335
|
if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx17(ErrorState, { error: schemaQuery.error });
|
|
3289
3336
|
const title = label ?? schema?.name ?? model;
|
|
3290
3337
|
return /* @__PURE__ */ jsxs12(Stack4, { gap: 5, children: [
|
|
3291
|
-
/* @__PURE__ */ jsxs12(
|
|
3292
|
-
/* @__PURE__ */ jsx17(
|
|
3338
|
+
/* @__PURE__ */ jsxs12(Box11, { children: [
|
|
3339
|
+
/* @__PURE__ */ jsx17(Text12, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
|
|
3293
3340
|
/* @__PURE__ */ jsx17(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
|
|
3294
|
-
/* @__PURE__ */ jsx17(
|
|
3341
|
+
/* @__PURE__ */ jsx17(Text12, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
|
|
3295
3342
|
] }),
|
|
3296
3343
|
/* @__PURE__ */ jsx17(
|
|
3297
3344
|
DataGrid,
|
|
@@ -3383,7 +3430,7 @@ function CoreDocument({ model, label, endpoint, columns, form }) {
|
|
|
3383
3430
|
|
|
3384
3431
|
// src/components/CorePipeline.tsx
|
|
3385
3432
|
import { useEffect as useEffect7, useRef as useRef3, useState as useState11 } from "react";
|
|
3386
|
-
import { Badge as Badge4, Box as
|
|
3433
|
+
import { Badge as Badge4, Box as Box12, Button as Button9, Flex as Flex8, Heading as Heading5, Input as Input5, NativeSelect as NativeSelect4, Stack as Stack5, Text as Text13 } from "@chakra-ui/react";
|
|
3387
3434
|
import { useMutation as useMutation3, useQuery as useQuery7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
3388
3435
|
|
|
3389
3436
|
// src/pipelineTicket.ts
|
|
@@ -3558,7 +3605,7 @@ function PipelineFilterControl({
|
|
|
3558
3605
|
onChange
|
|
3559
3606
|
}) {
|
|
3560
3607
|
if (filter.type === "ref" && meta?.ref) {
|
|
3561
|
-
return /* @__PURE__ */ jsx19(
|
|
3608
|
+
return /* @__PURE__ */ jsx19(Box12, { w: "220px", children: /* @__PURE__ */ jsx19(
|
|
3562
3609
|
ReferenceSelect,
|
|
3563
3610
|
{
|
|
3564
3611
|
field: filter.field,
|
|
@@ -3576,13 +3623,13 @@ function PipelineFilterControl({
|
|
|
3576
3623
|
) });
|
|
3577
3624
|
}
|
|
3578
3625
|
if (filter.type === "select") {
|
|
3579
|
-
return /* @__PURE__ */ jsxs13(
|
|
3580
|
-
/* @__PURE__ */ jsx19(
|
|
3581
|
-
/* @__PURE__ */ jsx19(
|
|
3626
|
+
return /* @__PURE__ */ jsxs13(NativeSelect4.Root, { size: "sm", w: "190px", children: [
|
|
3627
|
+
/* @__PURE__ */ jsx19(NativeSelect4.Field, { value: String(value2 ?? ""), onChange: (event) => onChange(event.currentTarget.value), children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx19("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
|
|
3628
|
+
/* @__PURE__ */ jsx19(NativeSelect4.Indicator, {})
|
|
3582
3629
|
] });
|
|
3583
3630
|
}
|
|
3584
3631
|
return /* @__PURE__ */ jsx19(
|
|
3585
|
-
|
|
3632
|
+
Input5,
|
|
3586
3633
|
{
|
|
3587
3634
|
w: "190px",
|
|
3588
3635
|
h: "35px",
|
|
@@ -3689,6 +3736,7 @@ function CorePipeline({
|
|
|
3689
3736
|
});
|
|
3690
3737
|
const groupedTicketActions = groupPipelineActions(resolvedTicketActions);
|
|
3691
3738
|
const resolvedTitleField = titleField ?? ticketModal?.titleField ?? schema?.fields.find((field) => field.kind === "string")?.name ?? schema?.searchable[0] ?? "_id";
|
|
3739
|
+
const resolvedTitleFieldMeta = schema?.fields.find((field) => field.name === resolvedTitleField);
|
|
3692
3740
|
const detailFields = (schema?.fields ?? []).filter((field) => field.name !== stageField && field.name !== resolvedTitleField && field.kind !== "raw").slice(0, 3);
|
|
3693
3741
|
const formFields = mergeFormFields2(formFieldsFromMeta(schema?.fields ?? []), form);
|
|
3694
3742
|
const resolvedListColumns = list?.columns?.length ? list.columns.map((column) => normalizeColumn(column, schema)) : columnsFromMeta(schema?.fields ?? []).slice(0, 10);
|
|
@@ -3741,10 +3789,10 @@ function CorePipeline({
|
|
|
3741
3789
|
] }) : null;
|
|
3742
3790
|
return /* @__PURE__ */ jsxs13(Stack5, { gap: 5, children: [
|
|
3743
3791
|
/* @__PURE__ */ jsxs13(Flex8, { align: { base: "stretch", md: "flex-end" }, justify: "space-between", gap: 4, direction: { base: "column", md: "row" }, children: [
|
|
3744
|
-
/* @__PURE__ */ jsxs13(
|
|
3745
|
-
/* @__PURE__ */ jsx19(
|
|
3792
|
+
/* @__PURE__ */ jsxs13(Box12, { children: [
|
|
3793
|
+
/* @__PURE__ */ jsx19(Text13, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
|
|
3746
3794
|
/* @__PURE__ */ jsx19(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
|
|
3747
|
-
/* @__PURE__ */ jsx19(
|
|
3795
|
+
/* @__PURE__ */ jsx19(Text13, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
|
|
3748
3796
|
] }),
|
|
3749
3797
|
/* @__PURE__ */ jsxs13(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
|
|
3750
3798
|
allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */ jsx19(Button9, { size: "sm", variant: viewMode === mode ? "solid" : "outline", colorPalette: "brand", onClick: () => setViewMode(mode), children: mode === "board" ? "Quadro" : "Lista" }, mode)) : null,
|
|
@@ -3754,8 +3802,8 @@ function CorePipeline({
|
|
|
3754
3802
|
filters.length ? /* @__PURE__ */ jsxs13(Flex8, { p: "12px", gap: "10px", align: "flex-end", wrap: "wrap", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
|
|
3755
3803
|
filters.map((filter) => {
|
|
3756
3804
|
const meta = schema?.fields.find((field) => field.name === filter.field);
|
|
3757
|
-
return /* @__PURE__ */ jsxs13(
|
|
3758
|
-
/* @__PURE__ */ jsx19(
|
|
3805
|
+
return /* @__PURE__ */ jsxs13(Box12, { children: [
|
|
3806
|
+
/* @__PURE__ */ jsx19(Text13, { mb: "4px", fontSize: "10px", color: "#667085", fontWeight: "600", children: filter.label ?? fieldLabel({ name: filter.field }) }),
|
|
3759
3807
|
/* @__PURE__ */ jsx19(
|
|
3760
3808
|
PipelineFilterControl,
|
|
3761
3809
|
{
|
|
@@ -3790,7 +3838,7 @@ function CorePipeline({
|
|
|
3790
3838
|
setSelectedTicket(row);
|
|
3791
3839
|
}
|
|
3792
3840
|
}
|
|
3793
|
-
) : /* @__PURE__ */ jsxs13(
|
|
3841
|
+
) : /* @__PURE__ */ jsxs13(Box12, { position: "relative", children: [
|
|
3794
3842
|
/* @__PURE__ */ jsx19(
|
|
3795
3843
|
Flex8,
|
|
3796
3844
|
{
|
|
@@ -3809,13 +3857,13 @@ function CorePipeline({
|
|
|
3809
3857
|
overscrollBehaviorX: "contain",
|
|
3810
3858
|
children: Array.from(byStage.entries()).map(([stageId, items]) => {
|
|
3811
3859
|
const stageLabel = resolvedStages.find((stage) => stage.id === stageId)?.label ?? (stageId || "Sem etapa");
|
|
3812
|
-
return /* @__PURE__ */ jsxs13(
|
|
3860
|
+
return /* @__PURE__ */ jsxs13(Box12, { minW: "300px", maxW: "340px", flex: "1 0 300px", bg: "#E8ECEF", borderRadius: "12px", p: 3, borderWidth: "1px", borderColor: "#DDE3E7", children: [
|
|
3813
3861
|
/* @__PURE__ */ jsxs13(Flex8, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
|
|
3814
|
-
/* @__PURE__ */ jsx19(
|
|
3862
|
+
/* @__PURE__ */ jsx19(Text13, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
|
|
3815
3863
|
/* @__PURE__ */ jsx19(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
|
|
3816
3864
|
] }),
|
|
3817
|
-
/* @__PURE__ */ jsx19(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx19(
|
|
3818
|
-
const ticketTitle = formatCell(row[resolvedTitleField],
|
|
3865
|
+
/* @__PURE__ */ jsx19(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx19(Box12, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx19(Text13, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
|
|
3866
|
+
const ticketTitle = formatCell(row[resolvedTitleField], resolvedTitleFieldMeta?.kind);
|
|
3819
3867
|
return /* @__PURE__ */ jsxs13(
|
|
3820
3868
|
Button9,
|
|
3821
3869
|
{
|
|
@@ -3842,9 +3890,9 @@ function CorePipeline({
|
|
|
3842
3890
|
_hover: { borderColor: "brand.300", transform: "translateY(-1px)", boxShadow: "0 7px 18px rgba(7, 38, 46, 0.09)" },
|
|
3843
3891
|
children: [
|
|
3844
3892
|
/* @__PURE__ */ jsxs13(Flex8, { align: "flex-start", justify: "space-between", gap: "8px", mb: 2, children: [
|
|
3845
|
-
/* @__PURE__ */ jsx19(
|
|
3893
|
+
/* @__PURE__ */ jsx19(Text13, { fontSize: "13px", fontWeight: "700", color: "#24323A", lineClamp: 2, children: ticketTitle }),
|
|
3846
3894
|
/* @__PURE__ */ jsx19(
|
|
3847
|
-
|
|
3895
|
+
Box12,
|
|
3848
3896
|
{
|
|
3849
3897
|
as: "span",
|
|
3850
3898
|
title: `Status da atividade: ${String(row[workStatusField] ?? "N\xE3o informado")}`,
|
|
@@ -3860,8 +3908,8 @@ function CorePipeline({
|
|
|
3860
3908
|
)
|
|
3861
3909
|
] }),
|
|
3862
3910
|
/* @__PURE__ */ jsx19(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs13(Flex8, { gap: 2, align: "baseline", justify: "space-between", children: [
|
|
3863
|
-
/* @__PURE__ */ jsx19(
|
|
3864
|
-
/* @__PURE__ */ jsx19(
|
|
3911
|
+
/* @__PURE__ */ jsx19(Text13, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
|
|
3912
|
+
/* @__PURE__ */ jsx19(Text13, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
|
|
3865
3913
|
] }, field.name)) })
|
|
3866
3914
|
]
|
|
3867
3915
|
},
|
|
@@ -3980,7 +4028,7 @@ function CorePipeline({
|
|
|
3980
4028
|
}
|
|
3981
4029
|
|
|
3982
4030
|
// src/components/CoreDashboard.tsx
|
|
3983
|
-
import { Box as
|
|
4031
|
+
import { Box as Box13, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text14 } from "@chakra-ui/react";
|
|
3984
4032
|
import { useQueries } from "@tanstack/react-query";
|
|
3985
4033
|
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3986
4034
|
function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
@@ -4003,12 +4051,12 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
|
4003
4051
|
/* @__PURE__ */ jsx20(Heading6, { size: "lg", children: label }),
|
|
4004
4052
|
/* @__PURE__ */ jsx20(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
|
|
4005
4053
|
if (w.kind === "custom" && w.render) {
|
|
4006
|
-
return /* @__PURE__ */ jsx20(
|
|
4054
|
+
return /* @__PURE__ */ jsx20(Box13, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
|
|
4007
4055
|
}
|
|
4008
4056
|
const q = queries[queryIdx++];
|
|
4009
4057
|
const value2 = q?.isLoading ? "\u2026" : q?.isError ? "\u2014" : formatWidget(q?.data, w.kind, w.field);
|
|
4010
|
-
return /* @__PURE__ */ jsxs14(
|
|
4011
|
-
/* @__PURE__ */ jsx20(
|
|
4058
|
+
return /* @__PURE__ */ jsxs14(Box13, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
|
|
4059
|
+
/* @__PURE__ */ jsx20(Text14, { fontSize: "sm", color: "gray.500", children: w.label }),
|
|
4012
4060
|
/* @__PURE__ */ jsx20(Heading6, { size: "xl", mt: 1, children: value2 })
|
|
4013
4061
|
] }, w.id);
|
|
4014
4062
|
}) })
|
|
@@ -4023,22 +4071,22 @@ function formatWidget(value2, kind, field) {
|
|
|
4023
4071
|
}
|
|
4024
4072
|
|
|
4025
4073
|
// src/components/ui-v2/CorePage.tsx
|
|
4026
|
-
import { Box as
|
|
4074
|
+
import { Box as Box16, Heading as Heading8, Stack as Stack7, Text as Text17 } from "@chakra-ui/react";
|
|
4027
4075
|
|
|
4028
4076
|
// src/security/PermissionGate.tsx
|
|
4029
|
-
import { Fragment as
|
|
4077
|
+
import { Fragment as Fragment2, jsx as jsx21 } from "react/jsx-runtime";
|
|
4030
4078
|
function PermissionGate({
|
|
4031
4079
|
permission,
|
|
4032
4080
|
fallback = null,
|
|
4033
4081
|
children
|
|
4034
4082
|
}) {
|
|
4035
4083
|
const { hasPermission } = useOonAuth();
|
|
4036
|
-
return /* @__PURE__ */ jsx21(
|
|
4084
|
+
return /* @__PURE__ */ jsx21(Fragment2, { children: hasPermission(permission) ? children : fallback });
|
|
4037
4085
|
}
|
|
4038
4086
|
|
|
4039
4087
|
// src/app/componentRegistry.tsx
|
|
4040
|
-
import { Box as
|
|
4041
|
-
import { Fragment as
|
|
4088
|
+
import { Box as Box14, Text as Text15 } from "@chakra-ui/react";
|
|
4089
|
+
import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4042
4090
|
var PREFIX_BUCKETS = {
|
|
4043
4091
|
"custom": "pageComponents",
|
|
4044
4092
|
"fields": "fieldRenderers",
|
|
@@ -4058,10 +4106,10 @@ function resolveComponent(registry, key, bucket) {
|
|
|
4058
4106
|
return registry?.[targetBucket]?.[normalized2] ?? registry?.[targetBucket]?.[key] ?? null;
|
|
4059
4107
|
}
|
|
4060
4108
|
function MissingRenderer({ renderer, children }) {
|
|
4061
|
-
if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx22(
|
|
4062
|
-
return /* @__PURE__ */ jsxs15(
|
|
4063
|
-
/* @__PURE__ */ jsx22(
|
|
4064
|
-
/* @__PURE__ */ jsxs15(
|
|
4109
|
+
if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx22(Fragment3, { children: children ?? null });
|
|
4110
|
+
return /* @__PURE__ */ jsxs15(Box14, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
|
|
4111
|
+
/* @__PURE__ */ jsx22(Text15, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
|
|
4112
|
+
/* @__PURE__ */ jsxs15(Text15, { fontSize: "xs", children: [
|
|
4065
4113
|
"Registre a chave ",
|
|
4066
4114
|
renderer ? /* @__PURE__ */ jsx22("code", { children: renderer }) : "solicitada",
|
|
4067
4115
|
" no registry da UI."
|
|
@@ -4071,16 +4119,16 @@ function MissingRenderer({ renderer, children }) {
|
|
|
4071
4119
|
}
|
|
4072
4120
|
|
|
4073
4121
|
// src/components/ui-v2/CorePrimitives.tsx
|
|
4074
|
-
import { Box as
|
|
4122
|
+
import { Box as Box15, Button as Button10, Flex as Flex9, Heading as Heading7, Spinner as Spinner3, Text as Text16 } from "@chakra-ui/react";
|
|
4075
4123
|
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4076
4124
|
function CorePage({ children }) {
|
|
4077
|
-
return /* @__PURE__ */ jsx23(
|
|
4125
|
+
return /* @__PURE__ */ jsx23(Box15, { children });
|
|
4078
4126
|
}
|
|
4079
4127
|
function CorePageHeader({ title, description, actions }) {
|
|
4080
4128
|
return /* @__PURE__ */ jsxs16(Flex9, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
|
|
4081
|
-
/* @__PURE__ */ jsxs16(
|
|
4129
|
+
/* @__PURE__ */ jsxs16(Box15, { children: [
|
|
4082
4130
|
title ? /* @__PURE__ */ jsx23(Heading7, { size: "lg", children: title }) : null,
|
|
4083
|
-
description ? /* @__PURE__ */ jsx23(
|
|
4131
|
+
description ? /* @__PURE__ */ jsx23(Text16, { color: "gray.600", mt: 1, children: description }) : null
|
|
4084
4132
|
] }),
|
|
4085
4133
|
actions
|
|
4086
4134
|
] });
|
|
@@ -4095,11 +4143,11 @@ function CoreCards(props) {
|
|
|
4095
4143
|
return /* @__PURE__ */ jsx23(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
|
|
4096
4144
|
}
|
|
4097
4145
|
function CoreForm(props) {
|
|
4098
|
-
return /* @__PURE__ */ jsx23(
|
|
4146
|
+
return /* @__PURE__ */ jsx23(Box15, { children: props.children });
|
|
4099
4147
|
}
|
|
4100
4148
|
function CoreField({ label, children }) {
|
|
4101
|
-
return /* @__PURE__ */ jsxs16(
|
|
4102
|
-
/* @__PURE__ */ jsx23(
|
|
4149
|
+
return /* @__PURE__ */ jsxs16(Box15, { children: [
|
|
4150
|
+
/* @__PURE__ */ jsx23(Text16, { fontSize: "sm", fontWeight: "600", children: label }),
|
|
4103
4151
|
children
|
|
4104
4152
|
] });
|
|
4105
4153
|
}
|
|
@@ -4110,22 +4158,22 @@ function CoreActions({ children }) {
|
|
|
4110
4158
|
return /* @__PURE__ */ jsx23(Flex9, { gap: 2, children });
|
|
4111
4159
|
}
|
|
4112
4160
|
function CoreEmptyState({ title = "Nenhum dado encontrado", actionLabel, onAction }) {
|
|
4113
|
-
return /* @__PURE__ */ jsxs16(
|
|
4114
|
-
/* @__PURE__ */ jsx23(
|
|
4161
|
+
return /* @__PURE__ */ jsxs16(Box15, { textAlign: "center", py: 10, children: [
|
|
4162
|
+
/* @__PURE__ */ jsx23(Text16, { children: title }),
|
|
4115
4163
|
actionLabel ? /* @__PURE__ */ jsx23(Button10, { mt: 3, onClick: onAction, children: actionLabel }) : null
|
|
4116
4164
|
] });
|
|
4117
4165
|
}
|
|
4118
4166
|
function CoreLoadingState({ label = "Carregando..." }) {
|
|
4119
4167
|
return /* @__PURE__ */ jsxs16(Flex9, { align: "center", gap: 3, children: [
|
|
4120
4168
|
/* @__PURE__ */ jsx23(Spinner3, { size: "sm" }),
|
|
4121
|
-
/* @__PURE__ */ jsx23(
|
|
4169
|
+
/* @__PURE__ */ jsx23(Text16, { children: label })
|
|
4122
4170
|
] });
|
|
4123
4171
|
}
|
|
4124
4172
|
|
|
4125
4173
|
// src/components/ui-v2/CorePage.tsx
|
|
4126
4174
|
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4127
4175
|
function renderMarkdown(content) {
|
|
4128
|
-
return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx24(
|
|
4176
|
+
return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx24(Text17, { whiteSpace: "pre-wrap", children: paragraph }, index));
|
|
4129
4177
|
}
|
|
4130
4178
|
function requiredAccess(source) {
|
|
4131
4179
|
const values = [...source.permissions ?? [], ...source.capabilities ?? []].filter(Boolean);
|
|
@@ -4146,9 +4194,9 @@ function CoreBlock({ block, registry }) {
|
|
|
4146
4194
|
return Component ? /* @__PURE__ */ jsx24(Component, { block, model: block.model }) : /* @__PURE__ */ jsx24(CoreCards, { model: block.model, renderer: block.renderer });
|
|
4147
4195
|
}
|
|
4148
4196
|
case "section":
|
|
4149
|
-
return /* @__PURE__ */ jsxs17(
|
|
4197
|
+
return /* @__PURE__ */ jsxs17(Box16, { children: [
|
|
4150
4198
|
/* @__PURE__ */ jsx24(Heading8, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
|
|
4151
|
-
block.description ? /* @__PURE__ */ jsx24(
|
|
4199
|
+
block.description ? /* @__PURE__ */ jsx24(Text17, { color: "gray.600", mb: 4, children: block.description }) : null,
|
|
4152
4200
|
/* @__PURE__ */ jsx24(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx24(CoreBlock, { block: child, registry }, child.id ?? index)) })
|
|
4153
4201
|
] });
|
|
4154
4202
|
case "markdown":
|
|
@@ -4317,11 +4365,11 @@ import {
|
|
|
4317
4365
|
} from "react-router-dom";
|
|
4318
4366
|
|
|
4319
4367
|
// src/shell/DefaultShell.tsx
|
|
4320
|
-
import { Box as
|
|
4368
|
+
import { Box as Box18, Button as Button11, Flex as Flex11, Spacer as Spacer2, Text as Text19 } from "@chakra-ui/react";
|
|
4321
4369
|
import { Outlet } from "react-router-dom";
|
|
4322
4370
|
|
|
4323
4371
|
// src/shell/Sidebar.tsx
|
|
4324
|
-
import { Box as
|
|
4372
|
+
import { Box as Box17, Flex as Flex10, Image, Stack as Stack8, Text as Text18 } from "@chakra-ui/react";
|
|
4325
4373
|
import { NavLink } from "react-router-dom";
|
|
4326
4374
|
import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4327
4375
|
function groupBySection(items) {
|
|
@@ -4337,7 +4385,7 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4337
4385
|
const { hasPermission } = useOonAuth();
|
|
4338
4386
|
const visible = menu.filter((item) => !item.hidden && hasPermission(item.permissions));
|
|
4339
4387
|
return /* @__PURE__ */ jsxs18(
|
|
4340
|
-
|
|
4388
|
+
Box17,
|
|
4341
4389
|
{
|
|
4342
4390
|
as: "nav",
|
|
4343
4391
|
w: { base: "76px", lg: "248px" },
|
|
@@ -4369,14 +4417,14 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4369
4417
|
children: "O"
|
|
4370
4418
|
}
|
|
4371
4419
|
),
|
|
4372
|
-
/* @__PURE__ */ jsxs18(
|
|
4373
|
-
/* @__PURE__ */ jsx26(
|
|
4374
|
-
/* @__PURE__ */ jsx26(
|
|
4420
|
+
/* @__PURE__ */ jsxs18(Box17, { display: { base: "none", lg: "block" }, minW: 0, children: [
|
|
4421
|
+
/* @__PURE__ */ jsx26(Text18, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
|
|
4422
|
+
/* @__PURE__ */ jsx26(Text18, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
|
|
4375
4423
|
] })
|
|
4376
4424
|
] }),
|
|
4377
4425
|
/* @__PURE__ */ jsx26(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs18(Stack8, { gap: 1, children: [
|
|
4378
4426
|
/* @__PURE__ */ jsx26(
|
|
4379
|
-
|
|
4427
|
+
Text18,
|
|
4380
4428
|
{
|
|
4381
4429
|
display: { base: "none", lg: "block" },
|
|
4382
4430
|
fontSize: "10px",
|
|
@@ -4410,8 +4458,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4410
4458
|
transition: "all 0.15s ease",
|
|
4411
4459
|
_hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
|
|
4412
4460
|
children: [
|
|
4413
|
-
item.icon ? /* @__PURE__ */ jsx26(
|
|
4414
|
-
/* @__PURE__ */ jsx26(
|
|
4461
|
+
item.icon ? /* @__PURE__ */ jsx26(Box17, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx26(Box17, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
|
|
4462
|
+
/* @__PURE__ */ jsx26(Text18, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
|
|
4415
4463
|
]
|
|
4416
4464
|
}
|
|
4417
4465
|
) }, item.href);
|
|
@@ -4425,7 +4473,7 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4425
4473
|
// package.json
|
|
4426
4474
|
var package_default = {
|
|
4427
4475
|
name: "@oondemand/oon-core-front",
|
|
4428
|
-
version: "0.3.
|
|
4476
|
+
version: "0.3.55",
|
|
4429
4477
|
repository: {
|
|
4430
4478
|
type: "git",
|
|
4431
4479
|
url: "git+https://github.com/oondemand/oon-platform.git",
|
|
@@ -4583,9 +4631,9 @@ function CoreTopbar({ app }) {
|
|
|
4583
4631
|
top: 0,
|
|
4584
4632
|
zIndex: 10,
|
|
4585
4633
|
children: [
|
|
4586
|
-
/* @__PURE__ */ jsxs19(
|
|
4634
|
+
/* @__PURE__ */ jsxs19(Box18, { minW: 0, title: details, children: [
|
|
4587
4635
|
/* @__PURE__ */ jsx27(
|
|
4588
|
-
|
|
4636
|
+
Text19,
|
|
4589
4637
|
{
|
|
4590
4638
|
fontSize: "xs",
|
|
4591
4639
|
fontWeight: "600",
|
|
@@ -4595,8 +4643,8 @@ function CoreTopbar({ app }) {
|
|
|
4595
4643
|
children: "Central Oon"
|
|
4596
4644
|
}
|
|
4597
4645
|
),
|
|
4598
|
-
/* @__PURE__ */ jsx27(
|
|
4599
|
-
/* @__PURE__ */ jsxs19(
|
|
4646
|
+
/* @__PURE__ */ jsx27(Text19, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name }),
|
|
4647
|
+
/* @__PURE__ */ jsxs19(Text19, { fontSize: "10px", color: "gray.600", lineHeight: "1.35", children: [
|
|
4600
4648
|
"Central ",
|
|
4601
4649
|
centralVersion,
|
|
4602
4650
|
" \xB7 Front ",
|
|
@@ -4604,13 +4652,13 @@ function CoreTopbar({ app }) {
|
|
|
4604
4652
|
" \xB7 Back ",
|
|
4605
4653
|
backendVersion
|
|
4606
4654
|
] }),
|
|
4607
|
-
publicationParts.length ? /* @__PURE__ */ jsx27(
|
|
4655
|
+
publicationParts.length ? /* @__PURE__ */ jsx27(Text19, { fontSize: "10px", color: "gray.500", lineHeight: "1.35", children: publicationParts.join(" \xB7 ") }) : null
|
|
4608
4656
|
] }),
|
|
4609
4657
|
/* @__PURE__ */ jsx27(Spacer2, {}),
|
|
4610
4658
|
user ? /* @__PURE__ */ jsxs19(Flex11, { align: "center", gap: 3, children: [
|
|
4611
|
-
/* @__PURE__ */ jsxs19(
|
|
4612
|
-
/* @__PURE__ */ jsx27(
|
|
4613
|
-
user.email ? /* @__PURE__ */ jsx27(
|
|
4659
|
+
/* @__PURE__ */ jsxs19(Box18, { textAlign: "right", display: { base: "none", md: "block" }, children: [
|
|
4660
|
+
/* @__PURE__ */ jsx27(Text19, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
|
|
4661
|
+
user.email ? /* @__PURE__ */ jsx27(Text19, { fontSize: "xs", color: "gray.500", children: user.email }) : null
|
|
4614
4662
|
] }),
|
|
4615
4663
|
/* @__PURE__ */ jsx27(
|
|
4616
4664
|
Button11,
|
|
@@ -4643,7 +4691,7 @@ function Slot({
|
|
|
4643
4691
|
if (name === "sidebar") return /* @__PURE__ */ jsx27(Sidebar, { app, menu, registry });
|
|
4644
4692
|
if (name === "topbar") return /* @__PURE__ */ jsx27(CoreTopbar, { app });
|
|
4645
4693
|
if (name === "footer" && slot === "core") {
|
|
4646
|
-
return /* @__PURE__ */ jsx27(
|
|
4694
|
+
return /* @__PURE__ */ jsx27(Box18, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
|
|
4647
4695
|
}
|
|
4648
4696
|
return null;
|
|
4649
4697
|
}
|
|
@@ -4678,7 +4726,7 @@ function DefaultShell({
|
|
|
4678
4726
|
}
|
|
4679
4727
|
),
|
|
4680
4728
|
/* @__PURE__ */ jsx27(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
|
|
4681
|
-
/* @__PURE__ */ jsx27(
|
|
4729
|
+
/* @__PURE__ */ jsx27(Box18, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx27(Box18, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx27(Outlet, {}) }) }),
|
|
4682
4730
|
/* @__PURE__ */ jsx27(
|
|
4683
4731
|
Slot,
|
|
4684
4732
|
{
|
|
@@ -4708,7 +4756,7 @@ function AuthenticatedLayout({ app, menu, layout, registry }) {
|
|
|
4708
4756
|
}
|
|
4709
4757
|
|
|
4710
4758
|
// src/security/AccessDeniedPage.tsx
|
|
4711
|
-
import { Box as
|
|
4759
|
+
import { Box as Box19, Button as Button12, Flex as Flex12, Heading as Heading9, Text as Text20, VStack } from "@chakra-ui/react";
|
|
4712
4760
|
import { useNavigate } from "react-router-dom";
|
|
4713
4761
|
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4714
4762
|
function AccessDeniedPage({ app }) {
|
|
@@ -4719,7 +4767,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4719
4767
|
navigate("/login", { replace: true });
|
|
4720
4768
|
}
|
|
4721
4769
|
return /* @__PURE__ */ jsx29(Flex12, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx29(
|
|
4722
|
-
|
|
4770
|
+
Box19,
|
|
4723
4771
|
{
|
|
4724
4772
|
width: "100%",
|
|
4725
4773
|
maxW: "560px",
|
|
@@ -4731,7 +4779,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4731
4779
|
p: { base: 6, md: 10 },
|
|
4732
4780
|
children: /* @__PURE__ */ jsxs20(VStack, { align: "stretch", gap: 6, children: [
|
|
4733
4781
|
/* @__PURE__ */ jsx29(
|
|
4734
|
-
|
|
4782
|
+
Box19,
|
|
4735
4783
|
{
|
|
4736
4784
|
width: "56px",
|
|
4737
4785
|
height: "56px",
|
|
@@ -4747,9 +4795,9 @@ function AccessDeniedPage({ app }) {
|
|
|
4747
4795
|
children: "!"
|
|
4748
4796
|
}
|
|
4749
4797
|
),
|
|
4750
|
-
/* @__PURE__ */ jsxs20(
|
|
4798
|
+
/* @__PURE__ */ jsxs20(Box19, { children: [
|
|
4751
4799
|
/* @__PURE__ */ jsx29(
|
|
4752
|
-
|
|
4800
|
+
Text20,
|
|
4753
4801
|
{
|
|
4754
4802
|
color: "#39BFED",
|
|
4755
4803
|
fontSize: "xs",
|
|
@@ -4760,7 +4808,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4760
4808
|
}
|
|
4761
4809
|
),
|
|
4762
4810
|
/* @__PURE__ */ jsx29(Heading9, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
|
|
4763
|
-
/* @__PURE__ */ jsxs20(
|
|
4811
|
+
/* @__PURE__ */ jsxs20(Text20, { mt: 3, color: "gray.600", children: [
|
|
4764
4812
|
"Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
|
|
4765
4813
|
app.title ?? app.name,
|
|
4766
4814
|
". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
|
|
@@ -4784,7 +4832,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4784
4832
|
|
|
4785
4833
|
// src/security/AppAccessGuard.tsx
|
|
4786
4834
|
import { Navigate, useLocation } from "react-router-dom";
|
|
4787
|
-
import { Fragment as
|
|
4835
|
+
import { Fragment as Fragment4, jsx as jsx30 } from "react/jsx-runtime";
|
|
4788
4836
|
function loginRedirect(pathname, search) {
|
|
4789
4837
|
const destination = `${pathname}${search}`;
|
|
4790
4838
|
return `/login?redirect=${encodeURIComponent(destination)}`;
|
|
@@ -4817,18 +4865,18 @@ function AppAccessGuard({ children }) {
|
|
|
4817
4865
|
}
|
|
4818
4866
|
);
|
|
4819
4867
|
}
|
|
4820
|
-
return /* @__PURE__ */ jsx30(
|
|
4868
|
+
return /* @__PURE__ */ jsx30(Fragment4, { children });
|
|
4821
4869
|
}
|
|
4822
4870
|
|
|
4823
4871
|
// src/security/LoginPage.tsx
|
|
4824
4872
|
import { useState as useState12 } from "react";
|
|
4825
4873
|
import {
|
|
4826
|
-
Box as
|
|
4874
|
+
Box as Box20,
|
|
4827
4875
|
Button as Button13,
|
|
4828
4876
|
Flex as Flex13,
|
|
4829
4877
|
Heading as Heading10,
|
|
4830
|
-
Input as
|
|
4831
|
-
Text as
|
|
4878
|
+
Input as Input6,
|
|
4879
|
+
Text as Text21,
|
|
4832
4880
|
VStack as VStack2
|
|
4833
4881
|
} from "@chakra-ui/react";
|
|
4834
4882
|
import { Navigate as Navigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
@@ -4872,7 +4920,7 @@ function LoginPage({ app }) {
|
|
|
4872
4920
|
}
|
|
4873
4921
|
}
|
|
4874
4922
|
return /* @__PURE__ */ jsx31(Flex13, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx31(
|
|
4875
|
-
|
|
4923
|
+
Box20,
|
|
4876
4924
|
{
|
|
4877
4925
|
width: "100%",
|
|
4878
4926
|
maxW: "440px",
|
|
@@ -4883,9 +4931,9 @@ function LoginPage({ app }) {
|
|
|
4883
4931
|
boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
|
|
4884
4932
|
p: { base: 6, md: 9 },
|
|
4885
4933
|
children: /* @__PURE__ */ jsx31("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 6, children: [
|
|
4886
|
-
/* @__PURE__ */ jsxs21(
|
|
4934
|
+
/* @__PURE__ */ jsxs21(Box20, { children: [
|
|
4887
4935
|
/* @__PURE__ */ jsx31(
|
|
4888
|
-
|
|
4936
|
+
Text21,
|
|
4889
4937
|
{
|
|
4890
4938
|
color: "#39BFED",
|
|
4891
4939
|
fontSize: "xs",
|
|
@@ -4896,13 +4944,13 @@ function LoginPage({ app }) {
|
|
|
4896
4944
|
}
|
|
4897
4945
|
),
|
|
4898
4946
|
/* @__PURE__ */ jsx31(Heading10, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
|
|
4899
|
-
/* @__PURE__ */ jsx31(
|
|
4947
|
+
/* @__PURE__ */ jsx31(Text21, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
|
|
4900
4948
|
] }),
|
|
4901
4949
|
/* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 4, children: [
|
|
4902
|
-
/* @__PURE__ */ jsxs21(
|
|
4903
|
-
/* @__PURE__ */ jsx31(
|
|
4950
|
+
/* @__PURE__ */ jsxs21(Box20, { children: [
|
|
4951
|
+
/* @__PURE__ */ jsx31(Text21, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
|
|
4904
4952
|
/* @__PURE__ */ jsx31(
|
|
4905
|
-
|
|
4953
|
+
Input6,
|
|
4906
4954
|
{
|
|
4907
4955
|
type: "email",
|
|
4908
4956
|
value: email,
|
|
@@ -4913,10 +4961,10 @@ function LoginPage({ app }) {
|
|
|
4913
4961
|
}
|
|
4914
4962
|
)
|
|
4915
4963
|
] }),
|
|
4916
|
-
/* @__PURE__ */ jsxs21(
|
|
4917
|
-
/* @__PURE__ */ jsx31(
|
|
4964
|
+
/* @__PURE__ */ jsxs21(Box20, { children: [
|
|
4965
|
+
/* @__PURE__ */ jsx31(Text21, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
|
|
4918
4966
|
/* @__PURE__ */ jsx31(
|
|
4919
|
-
|
|
4967
|
+
Input6,
|
|
4920
4968
|
{
|
|
4921
4969
|
type: "password",
|
|
4922
4970
|
value: password,
|
|
@@ -4929,7 +4977,7 @@ function LoginPage({ app }) {
|
|
|
4929
4977
|
] })
|
|
4930
4978
|
] }),
|
|
4931
4979
|
message ? /* @__PURE__ */ jsx31(
|
|
4932
|
-
|
|
4980
|
+
Box20,
|
|
4933
4981
|
{
|
|
4934
4982
|
role: "alert",
|
|
4935
4983
|
borderRadius: "10px",
|
|
@@ -4959,8 +5007,8 @@ function LoginPage({ app }) {
|
|
|
4959
5007
|
|
|
4960
5008
|
// src/security/ActivationPage.tsx
|
|
4961
5009
|
import { useEffect as useEffect8, useState as useState13 } from "react";
|
|
4962
|
-
import { Box as
|
|
4963
|
-
import { Fragment as
|
|
5010
|
+
import { Box as Box21, Button as Button14, Heading as Heading11, Input as Input7, Text as Text22, VStack as VStack3 } from "@chakra-ui/react";
|
|
5011
|
+
import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4964
5012
|
function encodeBasicCredentials2(email, password) {
|
|
4965
5013
|
const bytes = new TextEncoder().encode(`${email}:${password}`);
|
|
4966
5014
|
let binary = "";
|
|
@@ -5094,13 +5142,13 @@ function ActivationPage() {
|
|
|
5094
5142
|
}
|
|
5095
5143
|
}
|
|
5096
5144
|
function renderField(field, values, setValues) {
|
|
5097
|
-
return /* @__PURE__ */ jsxs22(
|
|
5098
|
-
/* @__PURE__ */ jsxs22(
|
|
5145
|
+
return /* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5146
|
+
/* @__PURE__ */ jsxs22(Text22, { fontWeight: "medium", children: [
|
|
5099
5147
|
field.label,
|
|
5100
5148
|
field.required ? " *" : ""
|
|
5101
5149
|
] }),
|
|
5102
5150
|
/* @__PURE__ */ jsx32(
|
|
5103
|
-
|
|
5151
|
+
Input7,
|
|
5104
5152
|
{
|
|
5105
5153
|
type: field.type === "password" || field.type === "secret" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : field.type === "number" || field.type === "integer" ? "number" : "text",
|
|
5106
5154
|
value: String(values[field.name] ?? field.defaultValue ?? ""),
|
|
@@ -5111,16 +5159,16 @@ function ActivationPage() {
|
|
|
5111
5159
|
onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
|
|
5112
5160
|
}
|
|
5113
5161
|
),
|
|
5114
|
-
field.helpText ? /* @__PURE__ */ jsx32(
|
|
5162
|
+
field.helpText ? /* @__PURE__ */ jsx32(Text22, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
|
|
5115
5163
|
] }, field.name);
|
|
5116
5164
|
}
|
|
5117
5165
|
function renderDevLocalActivation() {
|
|
5118
|
-
return /* @__PURE__ */ jsxs22(
|
|
5119
|
-
/* @__PURE__ */ jsx32(
|
|
5120
|
-
/* @__PURE__ */ jsxs22(
|
|
5121
|
-
/* @__PURE__ */ jsx32(
|
|
5166
|
+
return /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5167
|
+
/* @__PURE__ */ jsx32(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." }),
|
|
5168
|
+
/* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5169
|
+
/* @__PURE__ */ jsx32(Text22, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
|
|
5122
5170
|
/* @__PURE__ */ jsx32(
|
|
5123
|
-
|
|
5171
|
+
Input7,
|
|
5124
5172
|
{
|
|
5125
5173
|
value: devName,
|
|
5126
5174
|
onChange: (event) => setDevName(event.target.value),
|
|
@@ -5129,10 +5177,10 @@ function ActivationPage() {
|
|
|
5129
5177
|
}
|
|
5130
5178
|
)
|
|
5131
5179
|
] }),
|
|
5132
|
-
/* @__PURE__ */ jsxs22(
|
|
5133
|
-
/* @__PURE__ */ jsx32(
|
|
5180
|
+
/* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5181
|
+
/* @__PURE__ */ jsx32(Text22, { fontWeight: "medium", children: "E-mail *" }),
|
|
5134
5182
|
/* @__PURE__ */ jsx32(
|
|
5135
|
-
|
|
5183
|
+
Input7,
|
|
5136
5184
|
{
|
|
5137
5185
|
type: "email",
|
|
5138
5186
|
value: devEmail,
|
|
@@ -5142,10 +5190,10 @@ function ActivationPage() {
|
|
|
5142
5190
|
}
|
|
5143
5191
|
)
|
|
5144
5192
|
] }),
|
|
5145
|
-
/* @__PURE__ */ jsxs22(
|
|
5146
|
-
/* @__PURE__ */ jsx32(
|
|
5193
|
+
/* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5194
|
+
/* @__PURE__ */ jsx32(Text22, { fontWeight: "medium", children: "Senha *" }),
|
|
5147
5195
|
/* @__PURE__ */ jsx32(
|
|
5148
|
-
|
|
5196
|
+
Input7,
|
|
5149
5197
|
{
|
|
5150
5198
|
type: "password",
|
|
5151
5199
|
value: devPassword,
|
|
@@ -5180,7 +5228,7 @@ function ActivationPage() {
|
|
|
5180
5228
|
const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
|
|
5181
5229
|
const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
|
|
5182
5230
|
if (activation.status === "loading" || !config) {
|
|
5183
|
-
return /* @__PURE__ */ jsx32(
|
|
5231
|
+
return /* @__PURE__ */ jsx32(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
5184
5232
|
VStack3,
|
|
5185
5233
|
{
|
|
5186
5234
|
maxW: "760px",
|
|
@@ -5192,13 +5240,13 @@ function ActivationPage() {
|
|
|
5192
5240
|
gap: 5,
|
|
5193
5241
|
children: [
|
|
5194
5242
|
/* @__PURE__ */ jsx32(Heading11, { children: "Preparando ativa\xE7\xE3o..." }),
|
|
5195
|
-
error ? /* @__PURE__ */ jsx32(
|
|
5243
|
+
error ? /* @__PURE__ */ jsx32(Text22, { color: "red.600", children: error }) : null
|
|
5196
5244
|
]
|
|
5197
5245
|
}
|
|
5198
5246
|
) });
|
|
5199
5247
|
}
|
|
5200
5248
|
if (rootMode) {
|
|
5201
|
-
return /* @__PURE__ */ jsx32(
|
|
5249
|
+
return /* @__PURE__ */ jsx32(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
5202
5250
|
VStack3,
|
|
5203
5251
|
{
|
|
5204
5252
|
maxW: "560px",
|
|
@@ -5210,20 +5258,20 @@ function ActivationPage() {
|
|
|
5210
5258
|
gap: 5,
|
|
5211
5259
|
children: [
|
|
5212
5260
|
/* @__PURE__ */ jsx32(Heading11, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
|
|
5213
|
-
/* @__PURE__ */ jsx32(
|
|
5214
|
-
/* @__PURE__ */ jsxs22(
|
|
5261
|
+
/* @__PURE__ */ jsx32(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." }),
|
|
5262
|
+
/* @__PURE__ */ jsxs22(Text22, { fontSize: "sm", color: "gray.500", children: [
|
|
5215
5263
|
"App: ",
|
|
5216
5264
|
config.technical.appCode,
|
|
5217
5265
|
" \xB7 Ambiente:",
|
|
5218
5266
|
" ",
|
|
5219
5267
|
config.technical.ambiente
|
|
5220
5268
|
] }),
|
|
5221
|
-
error ? /* @__PURE__ */ jsx32(
|
|
5222
|
-
step !== 6 ? /* @__PURE__ */ jsxs22(
|
|
5223
|
-
/* @__PURE__ */ jsxs22(
|
|
5224
|
-
/* @__PURE__ */ jsx32(
|
|
5269
|
+
error ? /* @__PURE__ */ jsx32(Text22, { color: "red.600", children: error }) : null,
|
|
5270
|
+
step !== 6 ? /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5271
|
+
/* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5272
|
+
/* @__PURE__ */ jsx32(Text22, { fontWeight: "medium", children: "E-mail do administrador *" }),
|
|
5225
5273
|
/* @__PURE__ */ jsx32(
|
|
5226
|
-
|
|
5274
|
+
Input7,
|
|
5227
5275
|
{
|
|
5228
5276
|
type: "email",
|
|
5229
5277
|
autoComplete: "email",
|
|
@@ -5233,10 +5281,10 @@ function ActivationPage() {
|
|
|
5233
5281
|
}
|
|
5234
5282
|
)
|
|
5235
5283
|
] }),
|
|
5236
|
-
/* @__PURE__ */ jsxs22(
|
|
5237
|
-
/* @__PURE__ */ jsx32(
|
|
5284
|
+
/* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5285
|
+
/* @__PURE__ */ jsx32(Text22, { fontWeight: "medium", children: "Senha *" }),
|
|
5238
5286
|
/* @__PURE__ */ jsx32(
|
|
5239
|
-
|
|
5287
|
+
Input7,
|
|
5240
5288
|
{
|
|
5241
5289
|
type: "password",
|
|
5242
5290
|
minLength: 8,
|
|
@@ -5257,15 +5305,15 @@ function ActivationPage() {
|
|
|
5257
5305
|
children: "Criar ecossistema e ativar"
|
|
5258
5306
|
}
|
|
5259
5307
|
)
|
|
5260
|
-
] }) : /* @__PURE__ */ jsxs22(
|
|
5308
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5261
5309
|
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
5262
|
-
/* @__PURE__ */ jsx32(
|
|
5310
|
+
/* @__PURE__ */ jsx32(Text22, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
|
|
5263
5311
|
] })
|
|
5264
5312
|
]
|
|
5265
5313
|
}
|
|
5266
5314
|
) });
|
|
5267
5315
|
}
|
|
5268
|
-
return /* @__PURE__ */ jsx32(
|
|
5316
|
+
return /* @__PURE__ */ jsx32(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
5269
5317
|
VStack3,
|
|
5270
5318
|
{
|
|
5271
5319
|
maxW: "760px",
|
|
@@ -5277,7 +5325,7 @@ function ActivationPage() {
|
|
|
5277
5325
|
gap: 5,
|
|
5278
5326
|
children: [
|
|
5279
5327
|
/* @__PURE__ */ jsx32(Heading11, { children: "Ativa\xE7\xE3o da Central Oon" }),
|
|
5280
|
-
/* @__PURE__ */ jsxs22(
|
|
5328
|
+
/* @__PURE__ */ jsxs22(Text22, { children: [
|
|
5281
5329
|
"App: ",
|
|
5282
5330
|
config.technical.appCode,
|
|
5283
5331
|
" \xB7 Ambiente:",
|
|
@@ -5287,12 +5335,12 @@ function ActivationPage() {
|
|
|
5287
5335
|
" ",
|
|
5288
5336
|
config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
|
|
5289
5337
|
] }),
|
|
5290
|
-
error ? /* @__PURE__ */ jsx32(
|
|
5338
|
+
error ? /* @__PURE__ */ jsx32(Text22, { color: "red.600", children: error }) : null,
|
|
5291
5339
|
step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
|
|
5292
|
-
step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs22(
|
|
5293
|
-
/* @__PURE__ */ jsx32(
|
|
5340
|
+
step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5341
|
+
/* @__PURE__ */ jsx32(Text22, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
|
|
5294
5342
|
/* @__PURE__ */ jsx32(
|
|
5295
|
-
|
|
5343
|
+
Input7,
|
|
5296
5344
|
{
|
|
5297
5345
|
"aria-label": "C\xF3digo de ativa\xE7\xE3o",
|
|
5298
5346
|
value: code,
|
|
@@ -5319,23 +5367,23 @@ function ActivationPage() {
|
|
|
5319
5367
|
}
|
|
5320
5368
|
) : null
|
|
5321
5369
|
] }),
|
|
5322
|
-
step === 2 && /* @__PURE__ */ jsxs22(
|
|
5370
|
+
step === 2 && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5323
5371
|
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Confirma\xE7\xE3o" }),
|
|
5324
5372
|
/* @__PURE__ */ jsx32("pre", { children: JSON.stringify(preview, null, 2) }),
|
|
5325
5373
|
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(3), children: "Continuar" })
|
|
5326
5374
|
] }),
|
|
5327
|
-
step === 3 && /* @__PURE__ */ jsxs22(
|
|
5375
|
+
step === 3 && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5328
5376
|
config.globalFields.map(
|
|
5329
5377
|
(field) => renderField(field, global, setGlobal)
|
|
5330
5378
|
),
|
|
5331
5379
|
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(4), children: "Continuar" })
|
|
5332
5380
|
] }),
|
|
5333
|
-
step === 4 && /* @__PURE__ */ jsxs22(
|
|
5334
|
-
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx32(
|
|
5381
|
+
step === 4 && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5382
|
+
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx32(Text22, { children: "Nenhum par\xE2metro adicional declarado." }),
|
|
5335
5383
|
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(5), children: "Revisar" })
|
|
5336
5384
|
] }),
|
|
5337
|
-
step === 5 && /* @__PURE__ */ jsxs22(
|
|
5338
|
-
/* @__PURE__ */ jsx32(
|
|
5385
|
+
step === 5 && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5386
|
+
/* @__PURE__ */ jsx32(Text22, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
|
|
5339
5387
|
/* @__PURE__ */ jsx32(
|
|
5340
5388
|
Button14,
|
|
5341
5389
|
{
|
|
@@ -5347,14 +5395,14 @@ function ActivationPage() {
|
|
|
5347
5395
|
}
|
|
5348
5396
|
)
|
|
5349
5397
|
] }),
|
|
5350
|
-
step === 6 && /* @__PURE__ */ jsxs22(
|
|
5398
|
+
step === 6 && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5351
5399
|
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
5352
|
-
devResult?.appCode ? /* @__PURE__ */ jsxs22(
|
|
5400
|
+
devResult?.appCode ? /* @__PURE__ */ jsxs22(Text22, { children: [
|
|
5353
5401
|
"C\xF3digo do app: ",
|
|
5354
5402
|
devResult.appCode,
|
|
5355
5403
|
". Redirecionando para a Central em desenvolvimento..."
|
|
5356
|
-
] }) : /* @__PURE__ */ jsx32(
|
|
5357
|
-
devResult?.instrucoes?.env ? /* @__PURE__ */ jsx32(
|
|
5404
|
+
] }) : /* @__PURE__ */ jsx32(Text22, { children: "Redirecionando para o login..." }),
|
|
5405
|
+
devResult?.instrucoes?.env ? /* @__PURE__ */ jsx32(Text22, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
|
|
5358
5406
|
] })
|
|
5359
5407
|
]
|
|
5360
5408
|
}
|
|
@@ -5364,14 +5412,14 @@ function InstanceBlockedPage({
|
|
|
5364
5412
|
title,
|
|
5365
5413
|
message
|
|
5366
5414
|
}) {
|
|
5367
|
-
return /* @__PURE__ */ jsxs22(
|
|
5415
|
+
return /* @__PURE__ */ jsxs22(Box21, { p: 8, children: [
|
|
5368
5416
|
/* @__PURE__ */ jsx32(Heading11, { children: title }),
|
|
5369
|
-
/* @__PURE__ */ jsx32(
|
|
5417
|
+
/* @__PURE__ */ jsx32(Text22, { children: message })
|
|
5370
5418
|
] });
|
|
5371
5419
|
}
|
|
5372
5420
|
|
|
5373
5421
|
// src/security/RouteGuard.tsx
|
|
5374
|
-
import { Fragment as
|
|
5422
|
+
import { Fragment as Fragment6, jsx as jsx33 } from "react/jsx-runtime";
|
|
5375
5423
|
function RouteGuard({
|
|
5376
5424
|
permission,
|
|
5377
5425
|
children
|
|
@@ -5382,7 +5430,7 @@ function RouteGuard({
|
|
|
5382
5430
|
if (!hasPermission(permission)) {
|
|
5383
5431
|
return /* @__PURE__ */ jsx33(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
|
|
5384
5432
|
}
|
|
5385
|
-
return /* @__PURE__ */ jsx33(
|
|
5433
|
+
return /* @__PURE__ */ jsx33(Fragment6, { children });
|
|
5386
5434
|
}
|
|
5387
5435
|
|
|
5388
5436
|
// src/security/ActivationGuard.tsx
|
|
@@ -5758,7 +5806,7 @@ function defineOonModule(mod) {
|
|
|
5758
5806
|
}
|
|
5759
5807
|
|
|
5760
5808
|
// src/components/CoreIntegration.tsx
|
|
5761
|
-
import { Badge as Badge5, Box as
|
|
5809
|
+
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
5810
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
5763
5811
|
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5764
5812
|
function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
@@ -5775,8 +5823,8 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
5775
5823
|
/* @__PURE__ */ jsx38(Heading12, { size: "lg", children: label }),
|
|
5776
5824
|
/* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
|
|
5777
5825
|
] }),
|
|
5778
|
-
/* @__PURE__ */ jsx38(Stack9, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx38(
|
|
5779
|
-
|
|
5826
|
+
/* @__PURE__ */ jsx38(Stack9, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx38(Text23, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx38(
|
|
5827
|
+
Box22,
|
|
5780
5828
|
{
|
|
5781
5829
|
borderWidth: "1px",
|
|
5782
5830
|
borderColor: "gray.200",
|
|
@@ -5784,7 +5832,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
5784
5832
|
bg: "white",
|
|
5785
5833
|
p: 4,
|
|
5786
5834
|
children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
|
|
5787
|
-
/* @__PURE__ */ jsx38(
|
|
5835
|
+
/* @__PURE__ */ jsx38(Text23, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
|
|
5788
5836
|
/* @__PURE__ */ jsx38(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
|
|
5789
5837
|
] })
|
|
5790
5838
|
},
|
|
@@ -5794,7 +5842,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
5794
5842
|
}
|
|
5795
5843
|
|
|
5796
5844
|
// src/components/CoreCurrency.tsx
|
|
5797
|
-
import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as
|
|
5845
|
+
import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as Text24 } from "@chakra-ui/react";
|
|
5798
5846
|
import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
5799
5847
|
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5800
5848
|
function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
|
|
@@ -5809,14 +5857,14 @@ function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/mo
|
|
|
5809
5857
|
/* @__PURE__ */ jsx39(Heading13, { size: "lg", children: label }),
|
|
5810
5858
|
/* @__PURE__ */ jsx39(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
|
|
5811
5859
|
] }),
|
|
5812
|
-
updateRates.isError ? /* @__PURE__ */ jsx39(
|
|
5860
|
+
updateRates.isError ? /* @__PURE__ */ jsx39(Text24, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
|
|
5813
5861
|
/* @__PURE__ */ jsx39(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
|
|
5814
5862
|
] });
|
|
5815
5863
|
}
|
|
5816
5864
|
|
|
5817
5865
|
// src/components/CoreAssistant.tsx
|
|
5818
5866
|
import { useState as useState14 } from "react";
|
|
5819
|
-
import { Box as
|
|
5867
|
+
import { Box as Box23, Button as Button17, Flex as Flex16, Heading as Heading14, Input as Input8, Stack as Stack11, Text as Text25 } from "@chakra-ui/react";
|
|
5820
5868
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
5821
5869
|
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5822
5870
|
function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
|
|
@@ -5849,9 +5897,9 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5849
5897
|
};
|
|
5850
5898
|
return /* @__PURE__ */ jsxs25(Stack11, { gap: 4, maxW: "560px", children: [
|
|
5851
5899
|
/* @__PURE__ */ jsx40(Heading14, { size: "md", children: label }),
|
|
5852
|
-
/* @__PURE__ */ jsx40(
|
|
5853
|
-
messages.length === 0 ? /* @__PURE__ */ jsx40(
|
|
5854
|
-
|
|
5900
|
+
/* @__PURE__ */ jsx40(Box23, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs25(Stack11, { gap: 3, children: [
|
|
5901
|
+
messages.length === 0 ? /* @__PURE__ */ jsx40(Text25, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx40(Flex16, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx40(
|
|
5902
|
+
Box23,
|
|
5855
5903
|
{
|
|
5856
5904
|
bg: m.role === "user" ? "brand.500" : "gray.100",
|
|
5857
5905
|
color: m.role === "user" ? "white" : "gray.800",
|
|
@@ -5863,12 +5911,12 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5863
5911
|
children: m.content
|
|
5864
5912
|
}
|
|
5865
5913
|
) }, idx)),
|
|
5866
|
-
ask.isPending ? /* @__PURE__ */ jsx40(
|
|
5867
|
-
ask.isError ? /* @__PURE__ */ jsx40(
|
|
5914
|
+
ask.isPending ? /* @__PURE__ */ jsx40(Text25, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
|
|
5915
|
+
ask.isError ? /* @__PURE__ */ jsx40(Text25, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
|
|
5868
5916
|
] }) }),
|
|
5869
5917
|
/* @__PURE__ */ jsxs25(Flex16, { gap: 2, children: [
|
|
5870
5918
|
/* @__PURE__ */ jsx40(
|
|
5871
|
-
|
|
5919
|
+
Input8,
|
|
5872
5920
|
{
|
|
5873
5921
|
size: "sm",
|
|
5874
5922
|
value: input,
|