@oondemand/oon-core-front 0.3.54 → 0.3.56
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 +562 -568
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -652,6 +652,49 @@ import { useState as useState10 } from "react";
|
|
|
652
652
|
import { Box as Box11, Heading as Heading4, Stack as Stack4, Text as Text12 } from "@chakra-ui/react";
|
|
653
653
|
import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
654
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
|
+
|
|
655
698
|
// src/components/internal/fieldUtils.ts
|
|
656
699
|
var HIDDEN_FIELDS = /* @__PURE__ */ new Set(["__v", "_id", "createdAt", "updatedAt", "criadoEm", "atualizadoEm"]);
|
|
657
700
|
function isEditableField(meta) {
|
|
@@ -711,6 +754,9 @@ function formFieldsFromMeta(fields) {
|
|
|
711
754
|
}
|
|
712
755
|
function formatCell(value2, kind) {
|
|
713
756
|
if (value2 == null || value2 === "") return "\u2014";
|
|
757
|
+
if (value2 && typeof value2 === "object" && !Array.isArray(value2) && kind !== "date") {
|
|
758
|
+
return referenceOptionLabel(value2);
|
|
759
|
+
}
|
|
714
760
|
switch (kind) {
|
|
715
761
|
case "boolean":
|
|
716
762
|
return value2 ? "Sim" : "N\xE3o";
|
|
@@ -724,10 +770,6 @@ function formatCell(value2, kind) {
|
|
|
724
770
|
case "currencyConverted":
|
|
725
771
|
return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value2));
|
|
726
772
|
case "ref":
|
|
727
|
-
if (value2 && typeof value2 === "object") {
|
|
728
|
-
const object = value2;
|
|
729
|
-
return String(object.nome ?? object.label ?? object.descricao ?? object._id ?? "\u2014");
|
|
730
|
-
}
|
|
731
773
|
return String(value2);
|
|
732
774
|
default:
|
|
733
775
|
return String(value2);
|
|
@@ -1248,51 +1290,6 @@ function buildDomainMutationPayload(fields, values) {
|
|
|
1248
1290
|
import { useEffect as useEffect3, useMemo as useMemo3, useRef, useState as useState4 } from "react";
|
|
1249
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";
|
|
1250
1292
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
1251
|
-
|
|
1252
|
-
// src/components/internal/referenceUtils.ts
|
|
1253
|
-
var COMMON_LABEL_FIELDS = [
|
|
1254
|
-
"nome",
|
|
1255
|
-
"razaoSocial",
|
|
1256
|
-
"razao_social",
|
|
1257
|
-
"descricao",
|
|
1258
|
-
"numero",
|
|
1259
|
-
"codigoIndividual",
|
|
1260
|
-
"codigo_individual",
|
|
1261
|
-
"codigo",
|
|
1262
|
-
"label",
|
|
1263
|
-
"email"
|
|
1264
|
-
];
|
|
1265
|
-
function primitiveText(value2) {
|
|
1266
|
-
if (value2 == null || value2 === "") return null;
|
|
1267
|
-
if (typeof value2 === "string" || typeof value2 === "number") return String(value2);
|
|
1268
|
-
return null;
|
|
1269
|
-
}
|
|
1270
|
-
function referenceOptionLabel(row, searchableFields = []) {
|
|
1271
|
-
const ordered = [...COMMON_LABEL_FIELDS, ...searchableFields];
|
|
1272
|
-
const seenFields = /* @__PURE__ */ new Set();
|
|
1273
|
-
const seenValues = /* @__PURE__ */ new Set();
|
|
1274
|
-
const values = [];
|
|
1275
|
-
for (const field of ordered) {
|
|
1276
|
-
if (seenFields.has(field)) continue;
|
|
1277
|
-
seenFields.add(field);
|
|
1278
|
-
const text = primitiveText(row[field]);
|
|
1279
|
-
if (!text || seenValues.has(text)) continue;
|
|
1280
|
-
seenValues.add(text);
|
|
1281
|
-
values.push(text);
|
|
1282
|
-
if (values.length === 2) break;
|
|
1283
|
-
}
|
|
1284
|
-
if (values.length) return values.join(" \u2014 ");
|
|
1285
|
-
return primitiveText(row._id) ?? primitiveText(row.id) ?? "Registro sem identifica\xE7\xE3o";
|
|
1286
|
-
}
|
|
1287
|
-
function initialReferenceLabel(value2) {
|
|
1288
|
-
if (!value2 || typeof value2 !== "object") return "";
|
|
1289
|
-
return referenceOptionLabel(value2);
|
|
1290
|
-
}
|
|
1291
|
-
function referenceId(row) {
|
|
1292
|
-
return String(row._id ?? row.id ?? "");
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
// src/components/internal/ReferenceSelect.tsx
|
|
1296
1293
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1297
1294
|
function SearchIcon2() {
|
|
1298
1295
|
return /* @__PURE__ */ jsxs4("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
|
|
@@ -2191,12 +2188,12 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
|
|
|
2191
2188
|
|
|
2192
2189
|
// src/components/internal/CoreDetailModal.tsx
|
|
2193
2190
|
import { useEffect as useEffect6, useMemo as useMemo7, useRef as useRef2, useState as useState9 } from "react";
|
|
2194
|
-
import { Box as Box10, Button as Button8, Flex as Flex7, Heading as Heading3, IconButton, Text as Text11 } from "@chakra-ui/react";
|
|
2191
|
+
import { Box as Box10, Button as Button8, Flex as Flex7, Heading as Heading3, IconButton as IconButton2, Text as Text11 } from "@chakra-ui/react";
|
|
2195
2192
|
import { useQuery as useQuery6, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
2196
2193
|
|
|
2197
2194
|
// src/components/internal/CoreTabbedDetail.tsx
|
|
2198
2195
|
import { useEffect as useEffect5, useMemo as useMemo6, useState as useState8 } from "react";
|
|
2199
|
-
import { Box as Box9, Button as Button7, Flex as Flex6, Input 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";
|
|
2200
2197
|
|
|
2201
2198
|
// src/components/internal/CoreSummaryCards.tsx
|
|
2202
2199
|
import { SimpleGrid as SimpleGrid2, Box as Box6, Text as Text7, Badge as Badge2 } from "@chakra-ui/react";
|
|
@@ -2260,54 +2257,9 @@ function CoreSummaryCards({ cards = [], parent, relations }) {
|
|
|
2260
2257
|
|
|
2261
2258
|
// src/components/internal/CoreRelatedGrid.tsx
|
|
2262
2259
|
import { useMemo as useMemo5, useState as useState7 } from "react";
|
|
2263
|
-
import { Badge as Badge3, Box as Box8, Button as Button6, Flex as Flex5, Table as Table2, Text as Text9 } from "@chakra-ui/react";
|
|
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";
|
|
2264
2261
|
import { useMutation, useQuery as useQuery5, useQueryClient } from "@tanstack/react-query";
|
|
2265
2262
|
|
|
2266
|
-
// src/components/internal/CoreInlineEditableCell.tsx
|
|
2267
|
-
import { Input as Input4, NativeSelect as NativeSelect3, Textarea as Textarea2 } from "@chakra-ui/react";
|
|
2268
|
-
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2269
|
-
function CoreInlineEditableCell({ column, meta, value: value2, onChange }) {
|
|
2270
|
-
const kind = column.editor ?? meta?.kind ?? column.kind ?? "string";
|
|
2271
|
-
const plainValue = value2 == null ? "" : String(value2);
|
|
2272
|
-
const common = {
|
|
2273
|
-
size: "xs",
|
|
2274
|
-
fontSize: "11px",
|
|
2275
|
-
value: plainValue,
|
|
2276
|
-
onChange: (event) => onChange(event.currentTarget.value)
|
|
2277
|
-
};
|
|
2278
|
-
if (kind === "boolean") return /* @__PURE__ */ jsxs8(NativeSelect3.Root, { size: "xs", children: [
|
|
2279
|
-
/* @__PURE__ */ jsxs8(NativeSelect3.Field, { ...common, children: [
|
|
2280
|
-
/* @__PURE__ */ jsx12("option", { value: "", children: "\u2014" }),
|
|
2281
|
-
/* @__PURE__ */ jsx12("option", { value: "true", children: "Sim" }),
|
|
2282
|
-
/* @__PURE__ */ jsx12("option", { value: "false", children: "N\xE3o" })
|
|
2283
|
-
] }),
|
|
2284
|
-
/* @__PURE__ */ jsx12(NativeSelect3.Indicator, {})
|
|
2285
|
-
] });
|
|
2286
|
-
if ((kind === "enum" || kind === "select") && meta?.options?.length) return /* @__PURE__ */ jsxs8(NativeSelect3.Root, { size: "xs", children: [
|
|
2287
|
-
/* @__PURE__ */ jsxs8(NativeSelect3.Field, { ...common, children: [
|
|
2288
|
-
/* @__PURE__ */ jsx12("option", { value: "", children: "\u2014" }),
|
|
2289
|
-
meta.options.map((option) => /* @__PURE__ */ jsx12("option", { value: option, children: option }, option))
|
|
2290
|
-
] }),
|
|
2291
|
-
/* @__PURE__ */ jsx12(NativeSelect3.Indicator, {})
|
|
2292
|
-
] });
|
|
2293
|
-
if (kind === "textarea") return /* @__PURE__ */ jsx12(Textarea2, { ...common, rows: 2 });
|
|
2294
|
-
const mask = resolveInputMask({ field: column.field, kind });
|
|
2295
|
-
const type = mask ? "text" : kind === "date" ? "date" : kind === "number" ? "number" : "text";
|
|
2296
|
-
return /* @__PURE__ */ jsx12(
|
|
2297
|
-
Input4,
|
|
2298
|
-
{
|
|
2299
|
-
size: "xs",
|
|
2300
|
-
fontSize: "11px",
|
|
2301
|
-
type,
|
|
2302
|
-
step: type === "number" ? "any" : void 0,
|
|
2303
|
-
inputMode: inputModeForMask(mask),
|
|
2304
|
-
maxLength: maxLengthForMask(mask),
|
|
2305
|
-
value: mask ? formatMaskedValue(plainValue, mask) : plainValue,
|
|
2306
|
-
onChange: (event) => onChange(parseMaskedInput(event.currentTarget.value, mask))
|
|
2307
|
-
}
|
|
2308
|
-
);
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
2263
|
// src/components/internal/CoreRowAction.tsx
|
|
2312
2264
|
import { useState as useState6 } from "react";
|
|
2313
2265
|
import { Box as Box7, Button as Button5, Text as Text8 } from "@chakra-ui/react";
|
|
@@ -2346,14 +2298,14 @@ function interpolateEndpoint(endpoint, row, parent) {
|
|
|
2346
2298
|
|
|
2347
2299
|
// src/components/internal/DetailRecordContext.tsx
|
|
2348
2300
|
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
2349
|
-
import { jsx as
|
|
2301
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2350
2302
|
var DetailRecordContext = createContext4(null);
|
|
2351
2303
|
function DetailRecordProvider({
|
|
2352
2304
|
record,
|
|
2353
2305
|
setRecord,
|
|
2354
2306
|
children
|
|
2355
2307
|
}) {
|
|
2356
|
-
return /* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ jsx12(DetailRecordContext.Provider, { value: { record, setRecord }, children });
|
|
2357
2309
|
}
|
|
2358
2310
|
function useDetailRecord() {
|
|
2359
2311
|
return useContext4(DetailRecordContext);
|
|
@@ -2364,7 +2316,7 @@ function mergeDetailRecord(current, saved, changes = {}) {
|
|
|
2364
2316
|
}
|
|
2365
2317
|
|
|
2366
2318
|
// src/components/internal/CoreRowAction.tsx
|
|
2367
|
-
import { jsx as
|
|
2319
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2368
2320
|
var ACTION_TONES = {
|
|
2369
2321
|
success: { bg: "#DCFCE7", color: "#166534", border: "#BBF7D0", hover: "#D1FAE5" },
|
|
2370
2322
|
danger: { bg: "#FEE2E2", color: "#991B1B", border: "#FECACA", hover: "#FDE2E2" },
|
|
@@ -2374,7 +2326,7 @@ var ACTION_TONES = {
|
|
|
2374
2326
|
};
|
|
2375
2327
|
function ActionErrorMessage({ error }) {
|
|
2376
2328
|
const description = describeActionError(error);
|
|
2377
|
-
return /* @__PURE__ */
|
|
2329
|
+
return /* @__PURE__ */ jsxs8(
|
|
2378
2330
|
Box7,
|
|
2379
2331
|
{
|
|
2380
2332
|
role: "alert",
|
|
@@ -2386,8 +2338,8 @@ function ActionErrorMessage({ error }) {
|
|
|
2386
2338
|
borderColor: "#FECDCA",
|
|
2387
2339
|
borderRadius: "6px",
|
|
2388
2340
|
children: [
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
description.context ? /* @__PURE__ */
|
|
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
|
|
2391
2343
|
]
|
|
2392
2344
|
}
|
|
2393
2345
|
);
|
|
@@ -2488,8 +2440,8 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2488
2440
|
setLoading(false);
|
|
2489
2441
|
}
|
|
2490
2442
|
};
|
|
2491
|
-
return /* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
2443
|
+
return /* @__PURE__ */ jsxs8("span", { style: { display: "inline-flex", flexDirection: "column" }, children: [
|
|
2444
|
+
/* @__PURE__ */ jsxs8(
|
|
2493
2445
|
Button5,
|
|
2494
2446
|
{
|
|
2495
2447
|
type: "button",
|
|
@@ -2512,13 +2464,13 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2512
2464
|
_hover: tone ? { bg: tone.hover, borderColor: tone.border } : void 0,
|
|
2513
2465
|
_disabled: tone ? { opacity: isSelected ? 1 : 0.55, cursor: "not-allowed" } : void 0,
|
|
2514
2466
|
children: [
|
|
2515
|
-
isWorkStatus ? /* @__PURE__ */
|
|
2467
|
+
isWorkStatus ? /* @__PURE__ */ jsx13("span", { "aria-hidden": "true", style: { width: 8, height: 8, display: "inline-block", marginRight: 7, borderRadius: "999px", background: tone?.color ?? "#64748B", boxShadow: isSelected ? "0 0 0 2px rgba(255,255,255,.9)" : "none" } }) : null,
|
|
2516
2468
|
action.label
|
|
2517
2469
|
]
|
|
2518
2470
|
}
|
|
2519
2471
|
),
|
|
2520
|
-
error ? /* @__PURE__ */
|
|
2521
|
-
formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */
|
|
2472
|
+
error ? /* @__PURE__ */ jsx13(ActionErrorMessage, { error }) : null,
|
|
2473
|
+
formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */ jsx13(
|
|
2522
2474
|
DynamicForm,
|
|
2523
2475
|
{
|
|
2524
2476
|
title: pipelineAction.title ?? pipelineAction.label,
|
|
@@ -2553,7 +2505,19 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2553
2505
|
}
|
|
2554
2506
|
|
|
2555
2507
|
// src/components/internal/CoreRelatedGrid.tsx
|
|
2556
|
-
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
|
+
}
|
|
2557
2521
|
function parentValueAt(parent, path) {
|
|
2558
2522
|
return path.split(".").reduce((current, part) => {
|
|
2559
2523
|
if (!current || typeof current !== "object") return void 0;
|
|
@@ -2566,6 +2530,22 @@ function mergeCreateFields(schemaFields, overrides, foreignKey) {
|
|
|
2566
2530
|
const byName = new Map(base.map((field) => [field.field, field]));
|
|
2567
2531
|
return overrides.map((override) => ({ ...byName.get(override.field) ?? {}, ...override }));
|
|
2568
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
|
+
}
|
|
2569
2549
|
function CoreRelatedGrid({
|
|
2570
2550
|
tab: rawTab,
|
|
2571
2551
|
parent,
|
|
@@ -2595,27 +2575,36 @@ function CoreRelatedGrid({
|
|
|
2595
2575
|
() => mergeCreateFields(schemaFormFields, tab.create?.fields, relation?.foreignKey),
|
|
2596
2576
|
[schemaFormFields, tab.create?.fields, relation?.foreignKey]
|
|
2597
2577
|
);
|
|
2578
|
+
const editFields = useMemo5(
|
|
2579
|
+
() => modalEditFields(schemaFormFields, tab, createFields, relation?.foreignKey),
|
|
2580
|
+
[schemaFormFields, tab, createFields, relation?.foreignKey]
|
|
2581
|
+
);
|
|
2598
2582
|
const createInitialValues = useMemo5(() => {
|
|
2599
2583
|
const inherited = Object.fromEntries(
|
|
2600
2584
|
Object.entries(tab.create?.initialValuesFromParent ?? {}).map(([field, path]) => [field, parentValueAt(parent, path)])
|
|
2601
2585
|
);
|
|
2602
2586
|
return { ...tab.create?.initialValues ?? {}, ...inherited };
|
|
2603
2587
|
}, [tab.create?.initialValues, tab.create?.initialValuesFromParent, parent]);
|
|
2604
|
-
const [drafts, setDrafts] = useState7({});
|
|
2605
|
-
const [errors, setErrors] = useState7({});
|
|
2606
2588
|
const [creating, setCreating] = useState7(false);
|
|
2607
2589
|
const [createError, setCreateError] = useState7(null);
|
|
2608
|
-
const
|
|
2590
|
+
const [editing, setEditing] = useState7(null);
|
|
2591
|
+
const [editError, setEditError] = useState7(null);
|
|
2592
|
+
const canEdit = tab.type === "relatedGrid" && tab.editable === true;
|
|
2609
2593
|
const canCreate = tab.type === "relatedGrid" && tab.create?.enabled !== false && !!tab.create;
|
|
2610
2594
|
const canDelete = tab.type === "relatedGrid" && tab.delete?.enabled === true;
|
|
2611
|
-
const hasActions =
|
|
2595
|
+
const hasActions = canEdit || canDelete || !!tab.rowActions?.length;
|
|
2612
2596
|
const invalidate = async () => {
|
|
2613
2597
|
await queryClient.invalidateQueries({ queryKey: key });
|
|
2614
|
-
onRefresh?.(["self"]);
|
|
2598
|
+
onRefresh?.(["self", "parent"]);
|
|
2615
2599
|
};
|
|
2616
2600
|
const updateMutation = useMutation({
|
|
2617
2601
|
mutationFn: ({ id, values }) => resource.update(id, values),
|
|
2618
|
-
onSuccess:
|
|
2602
|
+
onSuccess: async () => {
|
|
2603
|
+
await invalidate();
|
|
2604
|
+
setEditing(null);
|
|
2605
|
+
setEditError(null);
|
|
2606
|
+
},
|
|
2607
|
+
onError: setEditError
|
|
2619
2608
|
});
|
|
2620
2609
|
const createMutation = useMutation({
|
|
2621
2610
|
mutationFn: (values) => resource.create({
|
|
@@ -2634,84 +2623,67 @@ function CoreRelatedGrid({
|
|
|
2634
2623
|
mutationFn: (id) => resource.delete(id),
|
|
2635
2624
|
onSuccess: invalidate
|
|
2636
2625
|
});
|
|
2637
|
-
if (!relation) return /* @__PURE__ */
|
|
2638
|
-
if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */
|
|
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..." });
|
|
2639
2628
|
const rows = query.data?.results ?? [];
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
[id]: { ...current[id] ?? {}, [field]: value2 }
|
|
2643
|
-
}));
|
|
2644
|
-
return /* @__PURE__ */ jsxs10(Box8, { children: [
|
|
2645
|
-
canCreate ? /* @__PURE__ */ jsx15(Flex5, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx15(Button6, { size: "sm", colorPalette: "brand", onClick: () => {
|
|
2629
|
+
return /* @__PURE__ */ jsxs9(Box8, { children: [
|
|
2630
|
+
canCreate ? /* @__PURE__ */ jsx14(Flex5, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx14(Button6, { size: "sm", colorPalette: "brand", onClick: () => {
|
|
2646
2631
|
setCreateError(null);
|
|
2647
2632
|
setCreating(true);
|
|
2648
2633
|
}, children: tab.create?.label ?? "Novo registro" }) }) : null,
|
|
2649
|
-
/* @__PURE__ */
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
columns.map((column) => /* @__PURE__ */
|
|
2652
|
-
hasActions ? /* @__PURE__ */
|
|
2634
|
+
/* @__PURE__ */ jsx14(Box8, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs9(Table2.Root, { size: "sm", minW: "760px", children: [
|
|
2635
|
+
/* @__PURE__ */ jsx14(Table2.Header, { children: /* @__PURE__ */ jsxs9(Table2.Row, { bg: "#F4F7F9", children: [
|
|
2636
|
+
columns.map((column) => /* @__PURE__ */ jsx14(Table2.ColumnHeader, { fontSize: "10px", children: column.label ?? column.field }, column.field)),
|
|
2637
|
+
hasActions ? /* @__PURE__ */ jsx14(Table2.ColumnHeader, { w: "92px", textAlign: "center", children: "A\xE7\xF5es" }) : null
|
|
2653
2638
|
] }) }),
|
|
2654
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsxs9(Table2.Body, { children: [
|
|
2655
2640
|
rows.map((row, index) => {
|
|
2656
2641
|
const id = String(row._id ?? row.id ?? index);
|
|
2657
|
-
|
|
2658
|
-
const dirty = Object.keys(draft).length > 0;
|
|
2659
|
-
return /* @__PURE__ */ jsxs10(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: [
|
|
2660
2643
|
columns.map((column) => {
|
|
2661
|
-
const value2 =
|
|
2662
|
-
|
|
2663
|
-
const canEdit = editable && column.readonly !== true && (column.editable === true || !column.readonly);
|
|
2664
|
-
return /* @__PURE__ */ jsx15(Table2.Cell, { fontSize: "11px", children: canEdit ? /* @__PURE__ */ jsx15(CoreInlineEditableCell, { column, meta, value: value2, onChange: (next) => setDraft(id, column.field, next) }) : column.display === "badgeExists" ? /* @__PURE__ */ jsx15(Badge3, { colorPalette: value2 ? "green" : "gray", children: value2 ? "Sim" : "N\xE3o" }) : formatCell(value2, column.kind) }, column.field);
|
|
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);
|
|
2665
2646
|
}),
|
|
2666
|
-
hasActions ? /* @__PURE__ */
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
Button6,
|
|
2670
|
-
{
|
|
2671
|
-
size: "xs",
|
|
2672
|
-
loading: updateMutation.isPending,
|
|
2673
|
-
onClick: () => {
|
|
2674
|
-
setErrors((current) => ({ ...current, [id]: void 0 }));
|
|
2675
|
-
updateMutation.mutate({ id, values: draft }, {
|
|
2676
|
-
onSuccess: () => setDrafts((current) => {
|
|
2677
|
-
const next = { ...current };
|
|
2678
|
-
delete next[id];
|
|
2679
|
-
return next;
|
|
2680
|
-
}),
|
|
2681
|
-
onError: (error) => setErrors((current) => ({ ...current, [id]: error }))
|
|
2682
|
-
});
|
|
2683
|
-
},
|
|
2684
|
-
children: "Salvar"
|
|
2685
|
-
}
|
|
2686
|
-
),
|
|
2687
|
-
/* @__PURE__ */ jsx15(Button6, { size: "xs", variant: "outline", onClick: () => setDrafts((current) => {
|
|
2688
|
-
const next = { ...current };
|
|
2689
|
-
delete next[id];
|
|
2690
|
-
return next;
|
|
2691
|
-
}), children: "Cancelar" })
|
|
2692
|
-
] }) : null,
|
|
2693
|
-
tab.rowActions?.map((action) => /* @__PURE__ */ jsx15(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
|
|
2694
|
-
canDelete ? /* @__PURE__ */ jsx15(
|
|
2695
|
-
Button6,
|
|
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,
|
|
2696
2650
|
{
|
|
2651
|
+
"aria-label": "Editar registro",
|
|
2652
|
+
title: "Editar",
|
|
2697
2653
|
size: "xs",
|
|
2698
|
-
variant: "
|
|
2654
|
+
variant: "ghost",
|
|
2655
|
+
color: "#0474AF",
|
|
2656
|
+
onClick: () => {
|
|
2657
|
+
setEditError(null);
|
|
2658
|
+
setEditing(row);
|
|
2659
|
+
},
|
|
2660
|
+
children: /* @__PURE__ */ jsx14(EditIcon2, {})
|
|
2661
|
+
}
|
|
2662
|
+
) : null,
|
|
2663
|
+
tab.rowActions?.map((action) => /* @__PURE__ */ jsx14(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
|
|
2664
|
+
canDelete ? /* @__PURE__ */ jsx14(
|
|
2665
|
+
IconButton,
|
|
2666
|
+
{
|
|
2667
|
+
"aria-label": "Excluir registro",
|
|
2668
|
+
title: "Excluir",
|
|
2669
|
+
size: "xs",
|
|
2670
|
+
variant: "ghost",
|
|
2671
|
+
color: "#B42318",
|
|
2699
2672
|
loading: deleteMutation.isPending,
|
|
2700
2673
|
onClick: () => {
|
|
2701
2674
|
const message = tab.delete?.confirm ?? "Excluir este registro relacionado?";
|
|
2702
2675
|
if (window.confirm(message)) deleteMutation.mutate(id);
|
|
2703
2676
|
},
|
|
2704
|
-
children:
|
|
2677
|
+
children: /* @__PURE__ */ jsx14(TrashIcon2, {})
|
|
2705
2678
|
}
|
|
2706
|
-
) : null
|
|
2707
|
-
errors[id] ? /* @__PURE__ */ jsx15(Text9, { color: "#B42318", fontSize: "9px", children: "Erro ao salvar." }) : null
|
|
2679
|
+
) : null
|
|
2708
2680
|
] }) }) : null
|
|
2709
2681
|
] }, id);
|
|
2710
2682
|
}),
|
|
2711
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
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
|
|
2712
2684
|
] })
|
|
2713
2685
|
] }) }),
|
|
2714
|
-
creating ? /* @__PURE__ */
|
|
2686
|
+
creating ? /* @__PURE__ */ jsx14(
|
|
2715
2687
|
DynamicForm,
|
|
2716
2688
|
{
|
|
2717
2689
|
title: tab.create?.label ?? `Novo ${schema?.singular ?? relation.model}`,
|
|
@@ -2726,12 +2698,31 @@ function CoreRelatedGrid({
|
|
|
2726
2698
|
if (!createMutation.isPending) setCreating(false);
|
|
2727
2699
|
}
|
|
2728
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
|
+
}
|
|
2729
2720
|
) : null
|
|
2730
2721
|
] });
|
|
2731
2722
|
}
|
|
2732
2723
|
|
|
2733
2724
|
// src/components/internal/CoreTabbedDetail.tsx
|
|
2734
|
-
import { jsx as
|
|
2725
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2735
2726
|
function toValue2(value2, kind) {
|
|
2736
2727
|
if (value2 == null) return "";
|
|
2737
2728
|
if (kind === "date") {
|
|
@@ -2803,14 +2794,14 @@ function resolveReference2(field, values) {
|
|
|
2803
2794
|
function FieldLabel({ field, htmlFor }) {
|
|
2804
2795
|
const label = fieldLabel({ name: field.field, label: field.label });
|
|
2805
2796
|
const readonly = Boolean(field.readonly || field.computed);
|
|
2806
|
-
return /* @__PURE__ */
|
|
2797
|
+
return /* @__PURE__ */ jsx15("label", { htmlFor, children: /* @__PURE__ */ jsxs10(Text10, { as: "span", display: "block", mb: "5px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
|
|
2807
2798
|
label,
|
|
2808
|
-
field.required && !readonly ? /* @__PURE__ */
|
|
2809
|
-
readonly ? /* @__PURE__ */
|
|
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
|
|
2810
2801
|
] }) });
|
|
2811
2802
|
}
|
|
2812
2803
|
function ErrorText2({ id, message }) {
|
|
2813
|
-
return message ? /* @__PURE__ */
|
|
2804
|
+
return message ? /* @__PURE__ */ jsx15(Text10, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: message }) : null;
|
|
2814
2805
|
}
|
|
2815
2806
|
function FieldControl({
|
|
2816
2807
|
field,
|
|
@@ -2835,8 +2826,8 @@ function FieldControl({
|
|
|
2835
2826
|
const checkedValue = String(field.checkedValue ?? true);
|
|
2836
2827
|
const uncheckedValue = String(field.uncheckedValue ?? false);
|
|
2837
2828
|
const checked = (value2 || uncheckedValue) === checkedValue;
|
|
2838
|
-
return /* @__PURE__ */
|
|
2839
|
-
/* @__PURE__ */
|
|
2829
|
+
return /* @__PURE__ */ jsxs10(Box9, { children: [
|
|
2830
|
+
/* @__PURE__ */ jsxs10(
|
|
2840
2831
|
Box9,
|
|
2841
2832
|
{
|
|
2842
2833
|
as: "label",
|
|
@@ -2852,7 +2843,7 @@ function FieldControl({
|
|
|
2852
2843
|
borderRadius: "7px",
|
|
2853
2844
|
cursor: readonly ? "not-allowed" : "pointer",
|
|
2854
2845
|
children: [
|
|
2855
|
-
/* @__PURE__ */
|
|
2846
|
+
/* @__PURE__ */ jsx15(
|
|
2856
2847
|
"input",
|
|
2857
2848
|
{
|
|
2858
2849
|
id: inputId,
|
|
@@ -2865,18 +2856,18 @@ function FieldControl({
|
|
|
2865
2856
|
onChange: (event) => onChange(event.currentTarget.checked ? checkedValue : uncheckedValue)
|
|
2866
2857
|
}
|
|
2867
2858
|
),
|
|
2868
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ jsx15(Text10, { as: "span", fontSize: "11px", fontWeight: "600", children: label })
|
|
2869
2860
|
]
|
|
2870
2861
|
}
|
|
2871
2862
|
),
|
|
2872
|
-
/* @__PURE__ */
|
|
2863
|
+
/* @__PURE__ */ jsx15(ErrorText2, { id: errorId, message: error })
|
|
2873
2864
|
] });
|
|
2874
2865
|
}
|
|
2875
2866
|
if (field.kind === "ref" && field.ref) {
|
|
2876
2867
|
const reference = resolveReference2(field, values);
|
|
2877
|
-
return /* @__PURE__ */
|
|
2878
|
-
/* @__PURE__ */
|
|
2879
|
-
/* @__PURE__ */
|
|
2868
|
+
return /* @__PURE__ */ jsxs10(Box9, { children: [
|
|
2869
|
+
/* @__PURE__ */ jsx15(FieldLabel, { field, htmlFor: inputId }),
|
|
2870
|
+
/* @__PURE__ */ jsx15(
|
|
2880
2871
|
ReferenceSelect,
|
|
2881
2872
|
{
|
|
2882
2873
|
field: field.field,
|
|
@@ -2899,21 +2890,21 @@ function FieldControl({
|
|
|
2899
2890
|
] });
|
|
2900
2891
|
}
|
|
2901
2892
|
const mask = resolveInputMask(field);
|
|
2902
|
-
const control = field.kind === "enum" && field.options?.length ? /* @__PURE__ */
|
|
2903
|
-
/* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
field.options.map((option) => /* @__PURE__ */
|
|
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: [
|
|
2895
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2896
|
+
field.options.map((option) => /* @__PURE__ */ jsx15("option", { value: option, children: option }, option))
|
|
2906
2897
|
] }),
|
|
2907
|
-
/* @__PURE__ */
|
|
2908
|
-
] }) : field.kind === "boolean" ? /* @__PURE__ */
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
/* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
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: [
|
|
2901
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2902
|
+
/* @__PURE__ */ jsx15("option", { value: "true", children: "Sim" }),
|
|
2903
|
+
/* @__PURE__ */ jsx15("option", { value: "false", children: "N\xE3o" })
|
|
2913
2904
|
] }),
|
|
2914
|
-
/* @__PURE__ */
|
|
2915
|
-
] }) : isMultiline2(field) ? /* @__PURE__ */
|
|
2916
|
-
|
|
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,
|
|
2917
2908
|
{
|
|
2918
2909
|
id: inputId,
|
|
2919
2910
|
size: "sm",
|
|
@@ -2927,10 +2918,10 @@ function FieldControl({
|
|
|
2927
2918
|
onChange: (event) => onChange(parseMaskedInput(event.currentTarget.value, mask))
|
|
2928
2919
|
}
|
|
2929
2920
|
);
|
|
2930
|
-
return /* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
2921
|
+
return /* @__PURE__ */ jsxs10(Box9, { children: [
|
|
2922
|
+
/* @__PURE__ */ jsx15(FieldLabel, { field, htmlFor: inputId }),
|
|
2932
2923
|
control,
|
|
2933
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ jsx15(ErrorText2, { id: errorId, message: error })
|
|
2934
2925
|
] });
|
|
2935
2926
|
}
|
|
2936
2927
|
function GroupSection({
|
|
@@ -2943,10 +2934,10 @@ function GroupSection({
|
|
|
2943
2934
|
}) {
|
|
2944
2935
|
if (!fields.length) return null;
|
|
2945
2936
|
const columns = group.columns ?? 2;
|
|
2946
|
-
return /* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
2948
|
-
group.description ? /* @__PURE__ */
|
|
2949
|
-
/* @__PURE__ */
|
|
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" }),
|
|
2940
|
+
/* @__PURE__ */ jsx15(SimpleGrid3, { columns: { base: 1, md: Math.min(columns, 2), xl: columns }, gapX: "16px", gapY: "14px", children: fields.map((field) => /* @__PURE__ */ jsx15(
|
|
2950
2941
|
FieldControl,
|
|
2951
2942
|
{
|
|
2952
2943
|
field,
|
|
@@ -3034,7 +3025,7 @@ function InlineParentForm({
|
|
|
3034
3025
|
const combinedErrors = { ...formulaErrors, ...fieldErrors };
|
|
3035
3026
|
const renderFields = () => {
|
|
3036
3027
|
if (groups?.length) {
|
|
3037
|
-
return /* @__PURE__ */
|
|
3028
|
+
return /* @__PURE__ */ jsx15(Stack3, { gap: "14px", children: groups.map((group) => /* @__PURE__ */ jsx15(
|
|
3038
3029
|
GroupSection,
|
|
3039
3030
|
{
|
|
3040
3031
|
group,
|
|
@@ -3047,7 +3038,7 @@ function InlineParentForm({
|
|
|
3047
3038
|
`${group.label}-${group.fields.join("-")}`
|
|
3048
3039
|
)) });
|
|
3049
3040
|
}
|
|
3050
|
-
return /* @__PURE__ */
|
|
3041
|
+
return /* @__PURE__ */ jsx15(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: "14px", children: visibleFields.map((field) => /* @__PURE__ */ jsx15(
|
|
3051
3042
|
FieldControl,
|
|
3052
3043
|
{
|
|
3053
3044
|
field,
|
|
@@ -3060,7 +3051,7 @@ function InlineParentForm({
|
|
|
3060
3051
|
field.field
|
|
3061
3052
|
)) });
|
|
3062
3053
|
};
|
|
3063
|
-
return /* @__PURE__ */
|
|
3054
|
+
return /* @__PURE__ */ jsx15(
|
|
3064
3055
|
"form",
|
|
3065
3056
|
{
|
|
3066
3057
|
id: formId,
|
|
@@ -3090,10 +3081,10 @@ function InlineParentForm({
|
|
|
3090
3081
|
setSaving(false);
|
|
3091
3082
|
}
|
|
3092
3083
|
},
|
|
3093
|
-
children: /* @__PURE__ */
|
|
3094
|
-
error ? /* @__PURE__ */
|
|
3084
|
+
children: /* @__PURE__ */ jsxs10(Stack3, { gap: "16px", children: [
|
|
3085
|
+
error ? /* @__PURE__ */ jsx15(CoreErrorAlert, { error }) : null,
|
|
3095
3086
|
renderFields(),
|
|
3096
|
-
!externalSubmit ? /* @__PURE__ */
|
|
3087
|
+
!externalSubmit ? /* @__PURE__ */ jsx15(Flex6, { justify: "flex-end", children: /* @__PURE__ */ jsx15(Button7, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) }) : null
|
|
3097
3088
|
] })
|
|
3098
3089
|
}
|
|
3099
3090
|
);
|
|
@@ -3119,10 +3110,10 @@ function CoreTabbedDetail({
|
|
|
3119
3110
|
const draftFields = useMemo6(() => fieldsForFormTabs(formFields, tabs), [formFields, tabs]);
|
|
3120
3111
|
const formParent = useMemo6(() => parent ?? {}, [parent]);
|
|
3121
3112
|
const hasFormTab = draftFields.length > 0;
|
|
3122
|
-
return /* @__PURE__ */
|
|
3123
|
-
/* @__PURE__ */
|
|
3113
|
+
return /* @__PURE__ */ jsxs10(Stack3, { gap: 4, children: [
|
|
3114
|
+
/* @__PURE__ */ jsx15(Flex6, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
|
|
3124
3115
|
const disabled = !parent?._id && (tab.type === "relatedGrid" || tab.type === "readonlyGrid" || tab.type === "summary");
|
|
3125
|
-
return /* @__PURE__ */
|
|
3116
|
+
return /* @__PURE__ */ jsx15(
|
|
3126
3117
|
Button7,
|
|
3127
3118
|
{
|
|
3128
3119
|
type: "button",
|
|
@@ -3135,8 +3126,8 @@ function CoreTabbedDetail({
|
|
|
3135
3126
|
tab.id
|
|
3136
3127
|
);
|
|
3137
3128
|
}) }),
|
|
3138
|
-
/* @__PURE__ */
|
|
3139
|
-
hasFormTab ? /* @__PURE__ */
|
|
3129
|
+
/* @__PURE__ */ jsxs10(Box9, { children: [
|
|
3130
|
+
hasFormTab ? /* @__PURE__ */ jsx15(Box9, { display: activeForm ? "block" : "none", children: /* @__PURE__ */ jsx15(
|
|
3140
3131
|
InlineParentForm,
|
|
3141
3132
|
{
|
|
3142
3133
|
fields: draftFields,
|
|
@@ -3151,7 +3142,7 @@ function CoreTabbedDetail({
|
|
|
3151
3142
|
externalSubmit
|
|
3152
3143
|
}
|
|
3153
3144
|
) }) : null,
|
|
3154
|
-
!active || active.type === "form" ? null : active.type === "summary" && parent ? /* @__PURE__ */
|
|
3145
|
+
!active || active.type === "form" ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx15(CoreSummaryCards, { cards: active.cards, parent, relations }) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx15(
|
|
3155
3146
|
CoreRelatedGrid,
|
|
3156
3147
|
{
|
|
3157
3148
|
tab: active,
|
|
@@ -3160,16 +3151,16 @@ function CoreTabbedDetail({
|
|
|
3160
3151
|
refreshToken: refreshTokens[active.id],
|
|
3161
3152
|
onRefresh
|
|
3162
3153
|
}
|
|
3163
|
-
) : active.type === "customComponent" ? /* @__PURE__ */
|
|
3154
|
+
) : active.type === "customComponent" ? /* @__PURE__ */ jsxs10(Text10, { color: "#667085", children: [
|
|
3164
3155
|
"Componente customizado: ",
|
|
3165
3156
|
active.component
|
|
3166
|
-
] }) : /* @__PURE__ */
|
|
3157
|
+
] }) : /* @__PURE__ */ jsx15(Text10, { color: "#667085", children: "Salve o registro principal para liberar esta aba." })
|
|
3167
3158
|
] })
|
|
3168
3159
|
] });
|
|
3169
3160
|
}
|
|
3170
3161
|
|
|
3171
3162
|
// src/components/internal/CoreDetailModal.tsx
|
|
3172
|
-
import { jsx as
|
|
3163
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3173
3164
|
function CoreDetailModal({ model, title, config, formFields, recordId, initialRecord, initialTab, relations, topActions, bottomActions, onClose, onSaved }) {
|
|
3174
3165
|
const schemaQuery = useModelSchema(model);
|
|
3175
3166
|
const schema = schemaQuery.data;
|
|
@@ -3214,7 +3205,9 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
|
|
|
3214
3205
|
});
|
|
3215
3206
|
};
|
|
3216
3207
|
const width = config.size === "full" ? "98vw" : config.size === "md" ? "760px" : config.size === "lg" ? "980px" : "1180px";
|
|
3217
|
-
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;
|
|
3218
3211
|
const activeIsForm = (config.tabs.find((tab) => tab.id === activeTab) ?? config.tabs[0])?.type === "form";
|
|
3219
3212
|
const hasFormTab = config.tabs.some((tab) => tab.type === "form");
|
|
3220
3213
|
const formId = `oon-detail-form-${model.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
@@ -3229,19 +3222,19 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
|
|
|
3229
3222
|
setConfirmingClose(false);
|
|
3230
3223
|
form.requestSubmit();
|
|
3231
3224
|
};
|
|
3232
|
-
return /* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3234
|
-
/* @__PURE__ */
|
|
3235
|
-
/* @__PURE__ */
|
|
3236
|
-
/* @__PURE__ */
|
|
3237
|
-
/* @__PURE__ */
|
|
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: [
|
|
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: [
|
|
3227
|
+
/* @__PURE__ */ jsxs11(Flex7, { minH: "72px", px: "20px", py: "10px", align: "center", justify: "space-between", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
|
|
3228
|
+
/* @__PURE__ */ jsxs11(Box10, { minW: "160px", children: [
|
|
3229
|
+
/* @__PURE__ */ jsx16(Text11, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
|
|
3230
|
+
/* @__PURE__ */ jsx16(Heading3, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
|
|
3238
3231
|
] }),
|
|
3239
|
-
/* @__PURE__ */
|
|
3232
|
+
/* @__PURE__ */ jsxs11(Flex7, { flex: "1", align: "center", justify: "flex-end", gap: "8px", wrap: "wrap", children: [
|
|
3240
3233
|
recordId ? topActions : null,
|
|
3241
|
-
/* @__PURE__ */
|
|
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" })
|
|
3242
3235
|
] })
|
|
3243
3236
|
] }),
|
|
3244
|
-
/* @__PURE__ */
|
|
3237
|
+
/* @__PURE__ */ jsx16(Box10, { flex: "1", minH: 0, p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx16(Text11, { children: "Carregando..." }) : /* @__PURE__ */ jsx16(
|
|
3245
3238
|
CoreTabbedDetail,
|
|
3246
3239
|
{
|
|
3247
3240
|
tabs: config.tabs,
|
|
@@ -3271,32 +3264,32 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
|
|
|
3271
3264
|
}
|
|
3272
3265
|
}
|
|
3273
3266
|
) }),
|
|
3274
|
-
/* @__PURE__ */
|
|
3275
|
-
/* @__PURE__ */
|
|
3276
|
-
/* @__PURE__ */
|
|
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: [
|
|
3268
|
+
/* @__PURE__ */ jsx16(Box10, { children: recordId ? bottomActions : null }),
|
|
3269
|
+
/* @__PURE__ */ jsx16(Button8, { type: "submit", form: formId, colorPalette: "brand", disabled: !hasFormTab || !activeIsForm && !dirty || schemaQuery.isLoading || parentQuery.isLoading, children: "Salvar" })
|
|
3277
3270
|
] })
|
|
3278
3271
|
] }),
|
|
3279
|
-
confirmingClose ? /* @__PURE__ */
|
|
3280
|
-
/* @__PURE__ */
|
|
3281
|
-
/* @__PURE__ */
|
|
3282
|
-
/* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
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: [
|
|
3273
|
+
/* @__PURE__ */ jsx16(Heading3, { id: "oon-unsaved-title", size: "md", children: "Altera\xE7\xF5es n\xE3o salvas" }),
|
|
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." }),
|
|
3275
|
+
/* @__PURE__ */ jsxs11(Flex7, { mt: "22px", justify: "flex-end", gap: "10px", wrap: "wrap", children: [
|
|
3276
|
+
/* @__PURE__ */ jsx16(Button8, { variant: "ghost", onClick: () => {
|
|
3284
3277
|
closeAfterSaveRef.current = false;
|
|
3285
3278
|
setConfirmingClose(false);
|
|
3286
3279
|
}, children: "Continuar editando" }),
|
|
3287
|
-
/* @__PURE__ */
|
|
3280
|
+
/* @__PURE__ */ jsx16(Button8, { variant: "outline", colorPalette: "red", onClick: () => {
|
|
3288
3281
|
closeAfterSaveRef.current = false;
|
|
3289
3282
|
setConfirmingClose(false);
|
|
3290
3283
|
onClose();
|
|
3291
3284
|
}, children: "Sair sem salvar" }),
|
|
3292
|
-
/* @__PURE__ */
|
|
3285
|
+
/* @__PURE__ */ jsx16(Button8, { colorPalette: "brand", onClick: saveAndClose, children: "Salvar e sair" })
|
|
3293
3286
|
] })
|
|
3294
3287
|
] }) }) : null
|
|
3295
3288
|
] }) });
|
|
3296
3289
|
}
|
|
3297
3290
|
|
|
3298
3291
|
// src/components/CoreCollection.tsx
|
|
3299
|
-
import { jsx as
|
|
3292
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3300
3293
|
function mergeFormFields(metadataFields, overrides) {
|
|
3301
3294
|
if (!overrides?.length) return metadataFields;
|
|
3302
3295
|
const byField = new Map(overrides.map((field) => [field.field, field]));
|
|
@@ -3338,16 +3331,16 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3338
3331
|
mutationFn: (row) => resource.delete(row._id),
|
|
3339
3332
|
onSuccess: invalidate
|
|
3340
3333
|
});
|
|
3341
|
-
if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */
|
|
3342
|
-
if (needsSchema && schemaQuery.isError) return /* @__PURE__ */
|
|
3334
|
+
if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx17(LoadingScreen, {});
|
|
3335
|
+
if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx17(ErrorState, { error: schemaQuery.error });
|
|
3343
3336
|
const title = label ?? schema?.name ?? model;
|
|
3344
|
-
return /* @__PURE__ */
|
|
3345
|
-
/* @__PURE__ */
|
|
3346
|
-
/* @__PURE__ */
|
|
3347
|
-
/* @__PURE__ */
|
|
3348
|
-
/* @__PURE__ */
|
|
3337
|
+
return /* @__PURE__ */ jsxs12(Stack4, { gap: 5, children: [
|
|
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 }),
|
|
3340
|
+
/* @__PURE__ */ jsx17(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
|
|
3341
|
+
/* @__PURE__ */ jsx17(Text12, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
|
|
3349
3342
|
] }),
|
|
3350
|
-
/* @__PURE__ */
|
|
3343
|
+
/* @__PURE__ */ jsx17(
|
|
3351
3344
|
DataGrid,
|
|
3352
3345
|
{
|
|
3353
3346
|
resource,
|
|
@@ -3368,7 +3361,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3368
3361
|
onDelete: (row) => {
|
|
3369
3362
|
if (window.confirm("Excluir este registro?")) deleteMutation.mutate(row);
|
|
3370
3363
|
},
|
|
3371
|
-
renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */
|
|
3364
|
+
renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx17(
|
|
3372
3365
|
CoreRowAction,
|
|
3373
3366
|
{
|
|
3374
3367
|
action,
|
|
@@ -3380,7 +3373,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3380
3373
|
)) : void 0
|
|
3381
3374
|
}
|
|
3382
3375
|
),
|
|
3383
|
-
formState.open ? /* @__PURE__ */
|
|
3376
|
+
formState.open ? /* @__PURE__ */ jsx17(
|
|
3384
3377
|
DynamicForm,
|
|
3385
3378
|
{
|
|
3386
3379
|
title: formState.row ? `Editar ${title}` : `Novo ${title}`,
|
|
@@ -3401,7 +3394,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3401
3394
|
}
|
|
3402
3395
|
) : null,
|
|
3403
3396
|
importExport ? null : null,
|
|
3404
|
-
detailState.open && detailModal?.enabled ? /* @__PURE__ */
|
|
3397
|
+
detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx17(
|
|
3405
3398
|
CoreDetailModal,
|
|
3406
3399
|
{
|
|
3407
3400
|
model,
|
|
@@ -3420,9 +3413,9 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3420
3413
|
}
|
|
3421
3414
|
|
|
3422
3415
|
// src/components/CoreDocument.tsx
|
|
3423
|
-
import { jsx as
|
|
3416
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3424
3417
|
function CoreDocument({ model, label, endpoint, columns, form }) {
|
|
3425
|
-
return /* @__PURE__ */
|
|
3418
|
+
return /* @__PURE__ */ jsx18(
|
|
3426
3419
|
CoreCollection,
|
|
3427
3420
|
{
|
|
3428
3421
|
model,
|
|
@@ -3437,7 +3430,7 @@ function CoreDocument({ model, label, endpoint, columns, form }) {
|
|
|
3437
3430
|
|
|
3438
3431
|
// src/components/CorePipeline.tsx
|
|
3439
3432
|
import { useEffect as useEffect7, useRef as useRef3, useState as useState11 } from "react";
|
|
3440
|
-
import { Badge as Badge4, Box as Box12, Button as Button9, Flex as Flex8, Heading as Heading5, Input 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";
|
|
3441
3434
|
import { useMutation as useMutation3, useQuery as useQuery7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
3442
3435
|
|
|
3443
3436
|
// src/pipelineTicket.ts
|
|
@@ -3579,7 +3572,7 @@ function pipelineBoardScrollStep(clientWidth) {
|
|
|
3579
3572
|
}
|
|
3580
3573
|
|
|
3581
3574
|
// src/components/CorePipeline.tsx
|
|
3582
|
-
import { jsx as
|
|
3575
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3583
3576
|
function ticketId(row) {
|
|
3584
3577
|
const id = row._id ?? row.id;
|
|
3585
3578
|
return id == null ? void 0 : String(id);
|
|
@@ -3603,7 +3596,7 @@ function workStatusColor(value2) {
|
|
|
3603
3596
|
}
|
|
3604
3597
|
function PipelineArrowIcon({ direction }) {
|
|
3605
3598
|
const path = direction === "left" ? "M12.5 5 7.5 10l5 5" : "m7.5 5 5 5-5 5";
|
|
3606
|
-
return /* @__PURE__ */
|
|
3599
|
+
return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx19("path", { d: path, fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3607
3600
|
}
|
|
3608
3601
|
function PipelineFilterControl({
|
|
3609
3602
|
filter,
|
|
@@ -3612,7 +3605,7 @@ function PipelineFilterControl({
|
|
|
3612
3605
|
onChange
|
|
3613
3606
|
}) {
|
|
3614
3607
|
if (filter.type === "ref" && meta?.ref) {
|
|
3615
|
-
return /* @__PURE__ */
|
|
3608
|
+
return /* @__PURE__ */ jsx19(Box12, { w: "220px", children: /* @__PURE__ */ jsx19(
|
|
3616
3609
|
ReferenceSelect,
|
|
3617
3610
|
{
|
|
3618
3611
|
field: filter.field,
|
|
@@ -3630,13 +3623,13 @@ function PipelineFilterControl({
|
|
|
3630
3623
|
) });
|
|
3631
3624
|
}
|
|
3632
3625
|
if (filter.type === "select") {
|
|
3633
|
-
return /* @__PURE__ */
|
|
3634
|
-
/* @__PURE__ */
|
|
3635
|
-
/* @__PURE__ */
|
|
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, {})
|
|
3636
3629
|
] });
|
|
3637
3630
|
}
|
|
3638
|
-
return /* @__PURE__ */
|
|
3639
|
-
|
|
3631
|
+
return /* @__PURE__ */ jsx19(
|
|
3632
|
+
Input5,
|
|
3640
3633
|
{
|
|
3641
3634
|
w: "190px",
|
|
3642
3635
|
h: "35px",
|
|
@@ -3726,9 +3719,9 @@ function CorePipeline({
|
|
|
3726
3719
|
},
|
|
3727
3720
|
onError: (error) => setFormError(error)
|
|
3728
3721
|
});
|
|
3729
|
-
if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */
|
|
3730
|
-
if (schemaQuery.isError) return /* @__PURE__ */
|
|
3731
|
-
if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */
|
|
3722
|
+
if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */ jsx19(LoadingScreen, {});
|
|
3723
|
+
if (schemaQuery.isError) return /* @__PURE__ */ jsx19(ErrorState, { error: schemaQuery.error });
|
|
3724
|
+
if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */ jsx19(ErrorState, { error: listQuery.error });
|
|
3732
3725
|
const stageFieldMeta = schema?.fields.find((field) => field.name === stageField);
|
|
3733
3726
|
const resolvedStages = stages ?? (stageFieldMeta?.options ?? []).map((option) => ({ id: option, label: option }));
|
|
3734
3727
|
const defaultActionsConfig = defaultActions === false ? void 0 : defaultActions;
|
|
@@ -3743,6 +3736,7 @@ function CorePipeline({
|
|
|
3743
3736
|
});
|
|
3744
3737
|
const groupedTicketActions = groupPipelineActions(resolvedTicketActions);
|
|
3745
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);
|
|
3746
3740
|
const detailFields = (schema?.fields ?? []).filter((field) => field.name !== stageField && field.name !== resolvedTitleField && field.kind !== "raw").slice(0, 3);
|
|
3747
3741
|
const formFields = mergeFormFields2(formFieldsFromMeta(schema?.fields ?? []), form);
|
|
3748
3742
|
const resolvedListColumns = list?.columns?.length ? list.columns.map((column) => normalizeColumn(column, schema)) : columnsFromMeta(schema?.fields ?? []).slice(0, 10);
|
|
@@ -3769,7 +3763,7 @@ function CorePipeline({
|
|
|
3769
3763
|
const step = pipelineBoardScrollStep(board.clientWidth);
|
|
3770
3764
|
board.scrollBy({ left: direction === "left" ? -step : step, behavior: "smooth" });
|
|
3771
3765
|
};
|
|
3772
|
-
const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */
|
|
3766
|
+
const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */ jsx19(
|
|
3773
3767
|
CoreRowAction,
|
|
3774
3768
|
{
|
|
3775
3769
|
action,
|
|
@@ -3788,29 +3782,29 @@ function CorePipeline({
|
|
|
3788
3782
|
},
|
|
3789
3783
|
action.id ?? `${action.label}-${index}`
|
|
3790
3784
|
) : null;
|
|
3791
|
-
const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */
|
|
3792
|
-
const modalBottomActions = selectedTicket && !creating ? /* @__PURE__ */
|
|
3793
|
-
groupedTicketActions.approval.length ? /* @__PURE__ */
|
|
3794
|
-
groupedTicketActions.custom.length ? /* @__PURE__ */
|
|
3785
|
+
const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "Status da atividade", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.workStatus.map(renderModalAction) }) : null;
|
|
3786
|
+
const modalBottomActions = selectedTicket && !creating ? /* @__PURE__ */ jsxs13(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
|
|
3787
|
+
groupedTicketActions.approval.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "Aprova\xE7\xE3o do ticket", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.approval.map(renderModalAction) }) : null,
|
|
3788
|
+
groupedTicketActions.custom.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "A\xE7\xF5es do neg\xF3cio", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.custom.map(renderModalAction) }) : null
|
|
3795
3789
|
] }) : null;
|
|
3796
|
-
return /* @__PURE__ */
|
|
3797
|
-
/* @__PURE__ */
|
|
3798
|
-
/* @__PURE__ */
|
|
3799
|
-
/* @__PURE__ */
|
|
3800
|
-
/* @__PURE__ */
|
|
3801
|
-
/* @__PURE__ */
|
|
3790
|
+
return /* @__PURE__ */ jsxs13(Stack5, { gap: 5, children: [
|
|
3791
|
+
/* @__PURE__ */ jsxs13(Flex8, { align: { base: "stretch", md: "flex-end" }, justify: "space-between", gap: 4, direction: { base: "column", md: "row" }, children: [
|
|
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" }),
|
|
3794
|
+
/* @__PURE__ */ jsx19(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
|
|
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." })
|
|
3802
3796
|
] }),
|
|
3803
|
-
/* @__PURE__ */
|
|
3804
|
-
allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */
|
|
3805
|
-
create?.enabled ? /* @__PURE__ */
|
|
3797
|
+
/* @__PURE__ */ jsxs13(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
|
|
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,
|
|
3799
|
+
create?.enabled ? /* @__PURE__ */ jsx19(Button9, { size: "sm", colorPalette: "brand", onClick: openCreate, children: create.label ?? "Novo ticket" }) : null
|
|
3806
3800
|
] })
|
|
3807
3801
|
] }),
|
|
3808
|
-
filters.length ? /* @__PURE__ */
|
|
3802
|
+
filters.length ? /* @__PURE__ */ jsxs13(Flex8, { p: "12px", gap: "10px", align: "flex-end", wrap: "wrap", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
|
|
3809
3803
|
filters.map((filter) => {
|
|
3810
3804
|
const meta = schema?.fields.find((field) => field.name === filter.field);
|
|
3811
|
-
return /* @__PURE__ */
|
|
3812
|
-
/* @__PURE__ */
|
|
3813
|
-
/* @__PURE__ */
|
|
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 }) }),
|
|
3807
|
+
/* @__PURE__ */ jsx19(
|
|
3814
3808
|
PipelineFilterControl,
|
|
3815
3809
|
{
|
|
3816
3810
|
filter,
|
|
@@ -3821,7 +3815,7 @@ function CorePipeline({
|
|
|
3821
3815
|
)
|
|
3822
3816
|
] }, filter.field);
|
|
3823
3817
|
}),
|
|
3824
|
-
/* @__PURE__ */
|
|
3818
|
+
/* @__PURE__ */ jsx19(
|
|
3825
3819
|
Button9,
|
|
3826
3820
|
{
|
|
3827
3821
|
size: "sm",
|
|
@@ -3831,7 +3825,7 @@ function CorePipeline({
|
|
|
3831
3825
|
}
|
|
3832
3826
|
)
|
|
3833
3827
|
] }) : null,
|
|
3834
|
-
viewMode === "list" ? /* @__PURE__ */
|
|
3828
|
+
viewMode === "list" ? /* @__PURE__ */ jsx19(
|
|
3835
3829
|
DataGrid,
|
|
3836
3830
|
{
|
|
3837
3831
|
resource,
|
|
@@ -3844,8 +3838,8 @@ function CorePipeline({
|
|
|
3844
3838
|
setSelectedTicket(row);
|
|
3845
3839
|
}
|
|
3846
3840
|
}
|
|
3847
|
-
) : /* @__PURE__ */
|
|
3848
|
-
/* @__PURE__ */
|
|
3841
|
+
) : /* @__PURE__ */ jsxs13(Box12, { position: "relative", children: [
|
|
3842
|
+
/* @__PURE__ */ jsx19(
|
|
3849
3843
|
Flex8,
|
|
3850
3844
|
{
|
|
3851
3845
|
ref: boardRef,
|
|
@@ -3863,14 +3857,14 @@ function CorePipeline({
|
|
|
3863
3857
|
overscrollBehaviorX: "contain",
|
|
3864
3858
|
children: Array.from(byStage.entries()).map(([stageId, items]) => {
|
|
3865
3859
|
const stageLabel = resolvedStages.find((stage) => stage.id === stageId)?.label ?? (stageId || "Sem etapa");
|
|
3866
|
-
return /* @__PURE__ */
|
|
3867
|
-
/* @__PURE__ */
|
|
3868
|
-
/* @__PURE__ */
|
|
3869
|
-
/* @__PURE__ */
|
|
3860
|
+
return /* @__PURE__ */ jsxs13(Box12, { minW: "300px", maxW: "340px", flex: "1 0 300px", bg: "#E8ECEF", borderRadius: "12px", p: 3, borderWidth: "1px", borderColor: "#DDE3E7", children: [
|
|
3861
|
+
/* @__PURE__ */ jsxs13(Flex8, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
|
|
3862
|
+
/* @__PURE__ */ jsx19(Text13, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
|
|
3863
|
+
/* @__PURE__ */ jsx19(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
|
|
3870
3864
|
] }),
|
|
3871
|
-
/* @__PURE__ */
|
|
3872
|
-
const ticketTitle = formatCell(row[resolvedTitleField],
|
|
3873
|
-
return /* @__PURE__ */
|
|
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);
|
|
3867
|
+
return /* @__PURE__ */ jsxs13(
|
|
3874
3868
|
Button9,
|
|
3875
3869
|
{
|
|
3876
3870
|
type: "button",
|
|
@@ -3895,9 +3889,9 @@ function CorePipeline({
|
|
|
3895
3889
|
},
|
|
3896
3890
|
_hover: { borderColor: "brand.300", transform: "translateY(-1px)", boxShadow: "0 7px 18px rgba(7, 38, 46, 0.09)" },
|
|
3897
3891
|
children: [
|
|
3898
|
-
/* @__PURE__ */
|
|
3899
|
-
/* @__PURE__ */
|
|
3900
|
-
/* @__PURE__ */
|
|
3892
|
+
/* @__PURE__ */ jsxs13(Flex8, { align: "flex-start", justify: "space-between", gap: "8px", mb: 2, children: [
|
|
3893
|
+
/* @__PURE__ */ jsx19(Text13, { fontSize: "13px", fontWeight: "700", color: "#24323A", lineClamp: 2, children: ticketTitle }),
|
|
3894
|
+
/* @__PURE__ */ jsx19(
|
|
3901
3895
|
Box12,
|
|
3902
3896
|
{
|
|
3903
3897
|
as: "span",
|
|
@@ -3913,9 +3907,9 @@ function CorePipeline({
|
|
|
3913
3907
|
}
|
|
3914
3908
|
)
|
|
3915
3909
|
] }),
|
|
3916
|
-
/* @__PURE__ */
|
|
3917
|
-
/* @__PURE__ */
|
|
3918
|
-
/* @__PURE__ */
|
|
3910
|
+
/* @__PURE__ */ jsx19(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs13(Flex8, { gap: 2, align: "baseline", justify: "space-between", children: [
|
|
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) })
|
|
3919
3913
|
] }, field.name)) })
|
|
3920
3914
|
]
|
|
3921
3915
|
},
|
|
@@ -3926,7 +3920,7 @@ function CorePipeline({
|
|
|
3926
3920
|
})
|
|
3927
3921
|
}
|
|
3928
3922
|
),
|
|
3929
|
-
/* @__PURE__ */
|
|
3923
|
+
/* @__PURE__ */ jsx19(
|
|
3930
3924
|
Button9,
|
|
3931
3925
|
{
|
|
3932
3926
|
type: "button",
|
|
@@ -3950,10 +3944,10 @@ function CorePipeline({
|
|
|
3950
3944
|
onClick: () => scrollBoard("left"),
|
|
3951
3945
|
_hover: { bg: "white", borderColor: "brand.400" },
|
|
3952
3946
|
_disabled: { opacity: 0.25, cursor: "not-allowed" },
|
|
3953
|
-
children: /* @__PURE__ */
|
|
3947
|
+
children: /* @__PURE__ */ jsx19(PipelineArrowIcon, { direction: "left" })
|
|
3954
3948
|
}
|
|
3955
3949
|
),
|
|
3956
|
-
/* @__PURE__ */
|
|
3950
|
+
/* @__PURE__ */ jsx19(
|
|
3957
3951
|
Button9,
|
|
3958
3952
|
{
|
|
3959
3953
|
type: "button",
|
|
@@ -3977,11 +3971,11 @@ function CorePipeline({
|
|
|
3977
3971
|
onClick: () => scrollBoard("right"),
|
|
3978
3972
|
_hover: { bg: "white", borderColor: "brand.400" },
|
|
3979
3973
|
_disabled: { opacity: 0.25, cursor: "not-allowed" },
|
|
3980
|
-
children: /* @__PURE__ */
|
|
3974
|
+
children: /* @__PURE__ */ jsx19(PipelineArrowIcon, { direction: "right" })
|
|
3981
3975
|
}
|
|
3982
3976
|
)
|
|
3983
3977
|
] }),
|
|
3984
|
-
selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */
|
|
3978
|
+
selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */ jsx19(
|
|
3985
3979
|
CoreDetailModal,
|
|
3986
3980
|
{
|
|
3987
3981
|
model,
|
|
@@ -4007,7 +4001,7 @@ function CorePipeline({
|
|
|
4007
4001
|
}
|
|
4008
4002
|
}
|
|
4009
4003
|
}
|
|
4010
|
-
) : selectedTicket ? /* @__PURE__ */
|
|
4004
|
+
) : selectedTicket ? /* @__PURE__ */ jsx19(
|
|
4011
4005
|
DynamicForm,
|
|
4012
4006
|
{
|
|
4013
4007
|
title: `${creating ? "Novo" : "Editar"} ${schema?.singular ?? label ?? model}`,
|
|
@@ -4036,7 +4030,7 @@ function CorePipeline({
|
|
|
4036
4030
|
// src/components/CoreDashboard.tsx
|
|
4037
4031
|
import { Box as Box13, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text14 } from "@chakra-ui/react";
|
|
4038
4032
|
import { useQueries } from "@tanstack/react-query";
|
|
4039
|
-
import { jsx as
|
|
4033
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4040
4034
|
function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
4041
4035
|
const { resource } = useOonApi();
|
|
4042
4036
|
const queries = useQueries({
|
|
@@ -4053,17 +4047,17 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
|
4053
4047
|
}))
|
|
4054
4048
|
});
|
|
4055
4049
|
let queryIdx = 0;
|
|
4056
|
-
return /* @__PURE__ */
|
|
4057
|
-
/* @__PURE__ */
|
|
4058
|
-
/* @__PURE__ */
|
|
4050
|
+
return /* @__PURE__ */ jsxs14(Stack6, { gap: 6, children: [
|
|
4051
|
+
/* @__PURE__ */ jsx20(Heading6, { size: "lg", children: label }),
|
|
4052
|
+
/* @__PURE__ */ jsx20(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
|
|
4059
4053
|
if (w.kind === "custom" && w.render) {
|
|
4060
|
-
return /* @__PURE__ */
|
|
4054
|
+
return /* @__PURE__ */ jsx20(Box13, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
|
|
4061
4055
|
}
|
|
4062
4056
|
const q = queries[queryIdx++];
|
|
4063
4057
|
const value2 = q?.isLoading ? "\u2026" : q?.isError ? "\u2014" : formatWidget(q?.data, w.kind, w.field);
|
|
4064
|
-
return /* @__PURE__ */
|
|
4065
|
-
/* @__PURE__ */
|
|
4066
|
-
/* @__PURE__ */
|
|
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 }),
|
|
4060
|
+
/* @__PURE__ */ jsx20(Heading6, { size: "xl", mt: 1, children: value2 })
|
|
4067
4061
|
] }, w.id);
|
|
4068
4062
|
}) })
|
|
4069
4063
|
] });
|
|
@@ -4080,19 +4074,19 @@ function formatWidget(value2, kind, field) {
|
|
|
4080
4074
|
import { Box as Box16, Heading as Heading8, Stack as Stack7, Text as Text17 } from "@chakra-ui/react";
|
|
4081
4075
|
|
|
4082
4076
|
// src/security/PermissionGate.tsx
|
|
4083
|
-
import { Fragment as
|
|
4077
|
+
import { Fragment as Fragment2, jsx as jsx21 } from "react/jsx-runtime";
|
|
4084
4078
|
function PermissionGate({
|
|
4085
4079
|
permission,
|
|
4086
4080
|
fallback = null,
|
|
4087
4081
|
children
|
|
4088
4082
|
}) {
|
|
4089
4083
|
const { hasPermission } = useOonAuth();
|
|
4090
|
-
return /* @__PURE__ */
|
|
4084
|
+
return /* @__PURE__ */ jsx21(Fragment2, { children: hasPermission(permission) ? children : fallback });
|
|
4091
4085
|
}
|
|
4092
4086
|
|
|
4093
4087
|
// src/app/componentRegistry.tsx
|
|
4094
4088
|
import { Box as Box14, Text as Text15 } from "@chakra-ui/react";
|
|
4095
|
-
import { Fragment as
|
|
4089
|
+
import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4096
4090
|
var PREFIX_BUCKETS = {
|
|
4097
4091
|
"custom": "pageComponents",
|
|
4098
4092
|
"fields": "fieldRenderers",
|
|
@@ -4112,12 +4106,12 @@ function resolveComponent(registry, key, bucket) {
|
|
|
4112
4106
|
return registry?.[targetBucket]?.[normalized2] ?? registry?.[targetBucket]?.[key] ?? null;
|
|
4113
4107
|
}
|
|
4114
4108
|
function MissingRenderer({ renderer, children }) {
|
|
4115
|
-
if (import.meta.env?.MODE === "production") return /* @__PURE__ */
|
|
4116
|
-
return /* @__PURE__ */
|
|
4117
|
-
/* @__PURE__ */
|
|
4118
|
-
/* @__PURE__ */
|
|
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: [
|
|
4119
4113
|
"Registre a chave ",
|
|
4120
|
-
renderer ? /* @__PURE__ */
|
|
4114
|
+
renderer ? /* @__PURE__ */ jsx22("code", { children: renderer }) : "solicitada",
|
|
4121
4115
|
" no registry da UI."
|
|
4122
4116
|
] }),
|
|
4123
4117
|
children
|
|
@@ -4126,60 +4120,60 @@ function MissingRenderer({ renderer, children }) {
|
|
|
4126
4120
|
|
|
4127
4121
|
// src/components/ui-v2/CorePrimitives.tsx
|
|
4128
4122
|
import { Box as Box15, Button as Button10, Flex as Flex9, Heading as Heading7, Spinner as Spinner3, Text as Text16 } from "@chakra-ui/react";
|
|
4129
|
-
import { jsx as
|
|
4123
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4130
4124
|
function CorePage({ children }) {
|
|
4131
|
-
return /* @__PURE__ */
|
|
4125
|
+
return /* @__PURE__ */ jsx23(Box15, { children });
|
|
4132
4126
|
}
|
|
4133
4127
|
function CorePageHeader({ title, description, actions }) {
|
|
4134
|
-
return /* @__PURE__ */
|
|
4135
|
-
/* @__PURE__ */
|
|
4136
|
-
title ? /* @__PURE__ */
|
|
4137
|
-
description ? /* @__PURE__ */
|
|
4128
|
+
return /* @__PURE__ */ jsxs16(Flex9, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
|
|
4129
|
+
/* @__PURE__ */ jsxs16(Box15, { children: [
|
|
4130
|
+
title ? /* @__PURE__ */ jsx23(Heading7, { size: "lg", children: title }) : null,
|
|
4131
|
+
description ? /* @__PURE__ */ jsx23(Text16, { color: "gray.600", mt: 1, children: description }) : null
|
|
4138
4132
|
] }),
|
|
4139
4133
|
actions
|
|
4140
4134
|
] });
|
|
4141
4135
|
}
|
|
4142
4136
|
function CoreToolbar({ children }) {
|
|
4143
|
-
return /* @__PURE__ */
|
|
4137
|
+
return /* @__PURE__ */ jsx23(Flex9, { align: "center", gap: 2, mb: 4, children });
|
|
4144
4138
|
}
|
|
4145
4139
|
function CoreDataGrid(props) {
|
|
4146
|
-
return /* @__PURE__ */
|
|
4140
|
+
return /* @__PURE__ */ jsx23(CoreCollection, { ...props });
|
|
4147
4141
|
}
|
|
4148
4142
|
function CoreCards(props) {
|
|
4149
|
-
return /* @__PURE__ */
|
|
4143
|
+
return /* @__PURE__ */ jsx23(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
|
|
4150
4144
|
}
|
|
4151
4145
|
function CoreForm(props) {
|
|
4152
|
-
return /* @__PURE__ */
|
|
4146
|
+
return /* @__PURE__ */ jsx23(Box15, { children: props.children });
|
|
4153
4147
|
}
|
|
4154
4148
|
function CoreField({ label, children }) {
|
|
4155
|
-
return /* @__PURE__ */
|
|
4156
|
-
/* @__PURE__ */
|
|
4149
|
+
return /* @__PURE__ */ jsxs16(Box15, { children: [
|
|
4150
|
+
/* @__PURE__ */ jsx23(Text16, { fontSize: "sm", fontWeight: "600", children: label }),
|
|
4157
4151
|
children
|
|
4158
4152
|
] });
|
|
4159
4153
|
}
|
|
4160
4154
|
function CoreRelationField(props) {
|
|
4161
|
-
return /* @__PURE__ */
|
|
4155
|
+
return /* @__PURE__ */ jsx23(CoreField, { ...props });
|
|
4162
4156
|
}
|
|
4163
4157
|
function CoreActions({ children }) {
|
|
4164
|
-
return /* @__PURE__ */
|
|
4158
|
+
return /* @__PURE__ */ jsx23(Flex9, { gap: 2, children });
|
|
4165
4159
|
}
|
|
4166
4160
|
function CoreEmptyState({ title = "Nenhum dado encontrado", actionLabel, onAction }) {
|
|
4167
|
-
return /* @__PURE__ */
|
|
4168
|
-
/* @__PURE__ */
|
|
4169
|
-
actionLabel ? /* @__PURE__ */
|
|
4161
|
+
return /* @__PURE__ */ jsxs16(Box15, { textAlign: "center", py: 10, children: [
|
|
4162
|
+
/* @__PURE__ */ jsx23(Text16, { children: title }),
|
|
4163
|
+
actionLabel ? /* @__PURE__ */ jsx23(Button10, { mt: 3, onClick: onAction, children: actionLabel }) : null
|
|
4170
4164
|
] });
|
|
4171
4165
|
}
|
|
4172
4166
|
function CoreLoadingState({ label = "Carregando..." }) {
|
|
4173
|
-
return /* @__PURE__ */
|
|
4174
|
-
/* @__PURE__ */
|
|
4175
|
-
/* @__PURE__ */
|
|
4167
|
+
return /* @__PURE__ */ jsxs16(Flex9, { align: "center", gap: 3, children: [
|
|
4168
|
+
/* @__PURE__ */ jsx23(Spinner3, { size: "sm" }),
|
|
4169
|
+
/* @__PURE__ */ jsx23(Text16, { children: label })
|
|
4176
4170
|
] });
|
|
4177
4171
|
}
|
|
4178
4172
|
|
|
4179
4173
|
// src/components/ui-v2/CorePage.tsx
|
|
4180
|
-
import { jsx as
|
|
4174
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4181
4175
|
function renderMarkdown(content) {
|
|
4182
|
-
return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */
|
|
4176
|
+
return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx24(Text17, { whiteSpace: "pre-wrap", children: paragraph }, index));
|
|
4183
4177
|
}
|
|
4184
4178
|
function requiredAccess(source) {
|
|
4185
4179
|
const values = [...source.permissions ?? [], ...source.capabilities ?? []].filter(Boolean);
|
|
@@ -4191,38 +4185,38 @@ function CoreBlock({ block, registry }) {
|
|
|
4191
4185
|
switch (block.type) {
|
|
4192
4186
|
case "custom": {
|
|
4193
4187
|
const Component = resolveComponent(registry, block.component, "pageComponents");
|
|
4194
|
-
return Component ? /* @__PURE__ */
|
|
4188
|
+
return Component ? /* @__PURE__ */ jsx24(Component, { block, ...block.props }) : /* @__PURE__ */ jsx24(MissingRenderer, { renderer: block.component });
|
|
4195
4189
|
}
|
|
4196
4190
|
case "collection.datagrid":
|
|
4197
|
-
return /* @__PURE__ */
|
|
4191
|
+
return /* @__PURE__ */ jsx24(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
|
|
4198
4192
|
case "collection.cards": {
|
|
4199
4193
|
const Component = resolveComponent(registry, block.renderer, "cardRenderers");
|
|
4200
|
-
return Component ? /* @__PURE__ */
|
|
4194
|
+
return Component ? /* @__PURE__ */ jsx24(Component, { block, model: block.model }) : /* @__PURE__ */ jsx24(CoreCards, { model: block.model, renderer: block.renderer });
|
|
4201
4195
|
}
|
|
4202
4196
|
case "section":
|
|
4203
|
-
return /* @__PURE__ */
|
|
4204
|
-
/* @__PURE__ */
|
|
4205
|
-
block.description ? /* @__PURE__ */
|
|
4206
|
-
/* @__PURE__ */
|
|
4197
|
+
return /* @__PURE__ */ jsxs17(Box16, { children: [
|
|
4198
|
+
/* @__PURE__ */ jsx24(Heading8, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
|
|
4199
|
+
block.description ? /* @__PURE__ */ jsx24(Text17, { color: "gray.600", mb: 4, children: block.description }) : null,
|
|
4200
|
+
/* @__PURE__ */ jsx24(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx24(CoreBlock, { block: child, registry }, child.id ?? index)) })
|
|
4207
4201
|
] });
|
|
4208
4202
|
case "markdown":
|
|
4209
|
-
return /* @__PURE__ */
|
|
4203
|
+
return /* @__PURE__ */ jsx24(Stack7, { gap: 2, children: renderMarkdown(block.content) });
|
|
4210
4204
|
default:
|
|
4211
|
-
return /* @__PURE__ */
|
|
4205
|
+
return /* @__PURE__ */ jsx24(MissingRenderer, { renderer: block.type });
|
|
4212
4206
|
}
|
|
4213
4207
|
})();
|
|
4214
|
-
return /* @__PURE__ */
|
|
4208
|
+
return /* @__PURE__ */ jsx24(PermissionGate, { permission: requiredAccess(block), children: content });
|
|
4215
4209
|
}
|
|
4216
4210
|
function CorePage2({ page, registry }) {
|
|
4217
4211
|
const Component = resolveComponent(registry, page.component, "pageComponents");
|
|
4218
|
-
return /* @__PURE__ */
|
|
4219
|
-
/* @__PURE__ */
|
|
4220
|
-
/* @__PURE__ */
|
|
4212
|
+
return /* @__PURE__ */ jsx24(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx24(Component, { page }) : /* @__PURE__ */ jsxs17(CorePage, { children: [
|
|
4213
|
+
/* @__PURE__ */ jsx24(CorePageHeader, { title: page.title ?? page.label }),
|
|
4214
|
+
/* @__PURE__ */ jsx24(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx24(CoreBlock, { block, registry }, block.id ?? index)) })
|
|
4221
4215
|
] }) });
|
|
4222
4216
|
}
|
|
4223
4217
|
|
|
4224
4218
|
// src/app/moduleRegistry.tsx
|
|
4225
|
-
import { jsx as
|
|
4219
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4226
4220
|
function slug2(value2) {
|
|
4227
4221
|
return value2.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
4228
4222
|
}
|
|
@@ -4249,7 +4243,7 @@ function renderView(view, registry) {
|
|
|
4249
4243
|
switch (view.type) {
|
|
4250
4244
|
case "collection": {
|
|
4251
4245
|
const v = view;
|
|
4252
|
-
return /* @__PURE__ */
|
|
4246
|
+
return /* @__PURE__ */ jsx25(
|
|
4253
4247
|
CoreCollection,
|
|
4254
4248
|
{
|
|
4255
4249
|
model: v.model,
|
|
@@ -4268,11 +4262,11 @@ function renderView(view, registry) {
|
|
|
4268
4262
|
}
|
|
4269
4263
|
case "document": {
|
|
4270
4264
|
const v = view;
|
|
4271
|
-
return /* @__PURE__ */
|
|
4265
|
+
return /* @__PURE__ */ jsx25(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
|
|
4272
4266
|
}
|
|
4273
4267
|
case "pipeline": {
|
|
4274
4268
|
const v = view;
|
|
4275
|
-
return /* @__PURE__ */
|
|
4269
|
+
return /* @__PURE__ */ jsx25(
|
|
4276
4270
|
CorePipeline,
|
|
4277
4271
|
{
|
|
4278
4272
|
model: v.model,
|
|
@@ -4295,7 +4289,7 @@ function renderView(view, registry) {
|
|
|
4295
4289
|
}
|
|
4296
4290
|
case "dashboard": {
|
|
4297
4291
|
const v = view;
|
|
4298
|
-
return /* @__PURE__ */
|
|
4292
|
+
return /* @__PURE__ */ jsx25(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
|
|
4299
4293
|
}
|
|
4300
4294
|
default:
|
|
4301
4295
|
return null;
|
|
@@ -4309,7 +4303,7 @@ function viewToRoute(view, registry) {
|
|
|
4309
4303
|
};
|
|
4310
4304
|
}
|
|
4311
4305
|
function pageToRoute(page, registry) {
|
|
4312
|
-
return { path: page.path, element: /* @__PURE__ */
|
|
4306
|
+
return { path: page.path, element: /* @__PURE__ */ jsx25(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
|
|
4313
4307
|
}
|
|
4314
4308
|
function pageToMenu(page) {
|
|
4315
4309
|
if (page.hidden || !page.label) return null;
|
|
@@ -4377,7 +4371,7 @@ import { Outlet } from "react-router-dom";
|
|
|
4377
4371
|
// src/shell/Sidebar.tsx
|
|
4378
4372
|
import { Box as Box17, Flex as Flex10, Image, Stack as Stack8, Text as Text18 } from "@chakra-ui/react";
|
|
4379
4373
|
import { NavLink } from "react-router-dom";
|
|
4380
|
-
import { jsx as
|
|
4374
|
+
import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4381
4375
|
function groupBySection(items) {
|
|
4382
4376
|
const groups = /* @__PURE__ */ new Map();
|
|
4383
4377
|
for (const item of items) {
|
|
@@ -4390,7 +4384,7 @@ function groupBySection(items) {
|
|
|
4390
4384
|
function Sidebar({ app, menu, registry }) {
|
|
4391
4385
|
const { hasPermission } = useOonAuth();
|
|
4392
4386
|
const visible = menu.filter((item) => !item.hidden && hasPermission(item.permissions));
|
|
4393
|
-
return /* @__PURE__ */
|
|
4387
|
+
return /* @__PURE__ */ jsxs18(
|
|
4394
4388
|
Box17,
|
|
4395
4389
|
{
|
|
4396
4390
|
as: "nav",
|
|
@@ -4406,8 +4400,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4406
4400
|
alignSelf: "flex-start",
|
|
4407
4401
|
overflowY: "auto",
|
|
4408
4402
|
children: [
|
|
4409
|
-
/* @__PURE__ */
|
|
4410
|
-
app.logo ? /* @__PURE__ */
|
|
4403
|
+
/* @__PURE__ */ jsxs18(Flex10, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
|
|
4404
|
+
app.logo ? /* @__PURE__ */ jsx26(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx26(
|
|
4411
4405
|
Flex10,
|
|
4412
4406
|
{
|
|
4413
4407
|
w: "38px",
|
|
@@ -4423,13 +4417,13 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4423
4417
|
children: "O"
|
|
4424
4418
|
}
|
|
4425
4419
|
),
|
|
4426
|
-
/* @__PURE__ */
|
|
4427
|
-
/* @__PURE__ */
|
|
4428
|
-
/* @__PURE__ */
|
|
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" })
|
|
4429
4423
|
] })
|
|
4430
4424
|
] }),
|
|
4431
|
-
/* @__PURE__ */
|
|
4432
|
-
/* @__PURE__ */
|
|
4425
|
+
/* @__PURE__ */ jsx26(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs18(Stack8, { gap: 1, children: [
|
|
4426
|
+
/* @__PURE__ */ jsx26(
|
|
4433
4427
|
Text18,
|
|
4434
4428
|
{
|
|
4435
4429
|
display: { base: "none", lg: "block" },
|
|
@@ -4445,8 +4439,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4445
4439
|
),
|
|
4446
4440
|
items.map((item) => {
|
|
4447
4441
|
const CustomMenuItem = resolveComponent(registry, item.renderer, "menuRenderers");
|
|
4448
|
-
if (CustomMenuItem) return /* @__PURE__ */
|
|
4449
|
-
return /* @__PURE__ */
|
|
4442
|
+
if (CustomMenuItem) return /* @__PURE__ */ jsx26(CustomMenuItem, { item }, item.href);
|
|
4443
|
+
return /* @__PURE__ */ jsx26(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs18(
|
|
4450
4444
|
Flex10,
|
|
4451
4445
|
{
|
|
4452
4446
|
align: "center",
|
|
@@ -4464,8 +4458,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4464
4458
|
transition: "all 0.15s ease",
|
|
4465
4459
|
_hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
|
|
4466
4460
|
children: [
|
|
4467
|
-
item.icon ? /* @__PURE__ */
|
|
4468
|
-
/* @__PURE__ */
|
|
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 })
|
|
4469
4463
|
]
|
|
4470
4464
|
}
|
|
4471
4465
|
) }, item.href);
|
|
@@ -4479,7 +4473,7 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4479
4473
|
// package.json
|
|
4480
4474
|
var package_default = {
|
|
4481
4475
|
name: "@oondemand/oon-core-front",
|
|
4482
|
-
version: "0.3.
|
|
4476
|
+
version: "0.3.56",
|
|
4483
4477
|
repository: {
|
|
4484
4478
|
type: "git",
|
|
4485
4479
|
url: "git+https://github.com/oondemand/oon-platform.git",
|
|
@@ -4598,7 +4592,7 @@ function shortCommit(commit) {
|
|
|
4598
4592
|
}
|
|
4599
4593
|
|
|
4600
4594
|
// src/shell/DefaultShell.tsx
|
|
4601
|
-
import { jsx as
|
|
4595
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4602
4596
|
function CoreTopbar({ app }) {
|
|
4603
4597
|
const { user, logout } = useOonAuth();
|
|
4604
4598
|
const metadataQuery = useCoreMetadata();
|
|
@@ -4621,7 +4615,7 @@ function CoreTopbar({ app }) {
|
|
|
4621
4615
|
runtime.releaseId ? `Release ${runtime.releaseId}` : void 0,
|
|
4622
4616
|
runtime.startedAt ? `Backend iniciado ${formatRuntimeDate(runtime.startedAt)}` : void 0
|
|
4623
4617
|
].filter(Boolean).join(" \xB7 ");
|
|
4624
|
-
return /* @__PURE__ */
|
|
4618
|
+
return /* @__PURE__ */ jsxs19(
|
|
4625
4619
|
Flex11,
|
|
4626
4620
|
{
|
|
4627
4621
|
as: "header",
|
|
@@ -4637,8 +4631,8 @@ function CoreTopbar({ app }) {
|
|
|
4637
4631
|
top: 0,
|
|
4638
4632
|
zIndex: 10,
|
|
4639
4633
|
children: [
|
|
4640
|
-
/* @__PURE__ */
|
|
4641
|
-
/* @__PURE__ */
|
|
4634
|
+
/* @__PURE__ */ jsxs19(Box18, { minW: 0, title: details, children: [
|
|
4635
|
+
/* @__PURE__ */ jsx27(
|
|
4642
4636
|
Text19,
|
|
4643
4637
|
{
|
|
4644
4638
|
fontSize: "xs",
|
|
@@ -4649,8 +4643,8 @@ function CoreTopbar({ app }) {
|
|
|
4649
4643
|
children: "Central Oon"
|
|
4650
4644
|
}
|
|
4651
4645
|
),
|
|
4652
|
-
/* @__PURE__ */
|
|
4653
|
-
/* @__PURE__ */
|
|
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: [
|
|
4654
4648
|
"Central ",
|
|
4655
4649
|
centralVersion,
|
|
4656
4650
|
" \xB7 Front ",
|
|
@@ -4658,15 +4652,15 @@ function CoreTopbar({ app }) {
|
|
|
4658
4652
|
" \xB7 Back ",
|
|
4659
4653
|
backendVersion
|
|
4660
4654
|
] }),
|
|
4661
|
-
publicationParts.length ? /* @__PURE__ */
|
|
4655
|
+
publicationParts.length ? /* @__PURE__ */ jsx27(Text19, { fontSize: "10px", color: "gray.500", lineHeight: "1.35", children: publicationParts.join(" \xB7 ") }) : null
|
|
4662
4656
|
] }),
|
|
4663
|
-
/* @__PURE__ */
|
|
4664
|
-
user ? /* @__PURE__ */
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
user.email ? /* @__PURE__ */
|
|
4657
|
+
/* @__PURE__ */ jsx27(Spacer2, {}),
|
|
4658
|
+
user ? /* @__PURE__ */ jsxs19(Flex11, { align: "center", gap: 3, children: [
|
|
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
|
|
4668
4662
|
] }),
|
|
4669
|
-
/* @__PURE__ */
|
|
4663
|
+
/* @__PURE__ */ jsx27(
|
|
4670
4664
|
Button11,
|
|
4671
4665
|
{
|
|
4672
4666
|
size: "sm",
|
|
@@ -4692,12 +4686,12 @@ function Slot({
|
|
|
4692
4686
|
if (slot === "none") return null;
|
|
4693
4687
|
if (slot?.startsWith("custom:")) {
|
|
4694
4688
|
const Component = resolveComponent(registry, slot, "layoutSlots");
|
|
4695
|
-
return Component ? /* @__PURE__ */
|
|
4689
|
+
return Component ? /* @__PURE__ */ jsx27(Component, { app, menu }) : /* @__PURE__ */ jsx27(MissingRenderer, { renderer: slot });
|
|
4696
4690
|
}
|
|
4697
|
-
if (name === "sidebar") return /* @__PURE__ */
|
|
4698
|
-
if (name === "topbar") return /* @__PURE__ */
|
|
4691
|
+
if (name === "sidebar") return /* @__PURE__ */ jsx27(Sidebar, { app, menu, registry });
|
|
4692
|
+
if (name === "topbar") return /* @__PURE__ */ jsx27(CoreTopbar, { app });
|
|
4699
4693
|
if (name === "footer" && slot === "core") {
|
|
4700
|
-
return /* @__PURE__ */
|
|
4694
|
+
return /* @__PURE__ */ jsx27(Box18, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
|
|
4701
4695
|
}
|
|
4702
4696
|
return null;
|
|
4703
4697
|
}
|
|
@@ -4709,8 +4703,8 @@ function DefaultShell({
|
|
|
4709
4703
|
}) {
|
|
4710
4704
|
const portal = layout?.shell === "portal" || layout?.shell === "content-only";
|
|
4711
4705
|
const mainPadding = portal ? { base: 4, lg: 10 } : { base: 4, lg: 6 };
|
|
4712
|
-
return /* @__PURE__ */
|
|
4713
|
-
/* @__PURE__ */
|
|
4706
|
+
return /* @__PURE__ */ jsxs19(Flex11, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
|
|
4707
|
+
/* @__PURE__ */ jsx27(
|
|
4714
4708
|
Slot,
|
|
4715
4709
|
{
|
|
4716
4710
|
name: "sidebar",
|
|
@@ -4720,8 +4714,8 @@ function DefaultShell({
|
|
|
4720
4714
|
menu
|
|
4721
4715
|
}
|
|
4722
4716
|
),
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
/* @__PURE__ */
|
|
4717
|
+
/* @__PURE__ */ jsxs19(Flex11, { direction: "column", flex: "1", minW: 0, children: [
|
|
4718
|
+
/* @__PURE__ */ jsx27(
|
|
4725
4719
|
Slot,
|
|
4726
4720
|
{
|
|
4727
4721
|
name: "topbar",
|
|
@@ -4731,9 +4725,9 @@ function DefaultShell({
|
|
|
4731
4725
|
menu
|
|
4732
4726
|
}
|
|
4733
4727
|
),
|
|
4734
|
-
/* @__PURE__ */
|
|
4735
|
-
/* @__PURE__ */
|
|
4736
|
-
/* @__PURE__ */
|
|
4728
|
+
/* @__PURE__ */ jsx27(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
|
|
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, {}) }) }),
|
|
4730
|
+
/* @__PURE__ */ jsx27(
|
|
4737
4731
|
Slot,
|
|
4738
4732
|
{
|
|
4739
4733
|
name: "footer",
|
|
@@ -4747,24 +4741,24 @@ function DefaultShell({
|
|
|
4747
4741
|
] });
|
|
4748
4742
|
}
|
|
4749
4743
|
function PortalShell(props) {
|
|
4750
|
-
return /* @__PURE__ */
|
|
4744
|
+
return /* @__PURE__ */ jsx27(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
|
|
4751
4745
|
}
|
|
4752
4746
|
|
|
4753
4747
|
// src/shell/AuthenticatedLayout.tsx
|
|
4754
|
-
import { jsx as
|
|
4748
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4755
4749
|
function AuthenticatedLayout({ app, menu, layout, registry }) {
|
|
4756
4750
|
if (layout?.shell?.startsWith("custom:")) {
|
|
4757
4751
|
const CustomShell = resolveComponent(registry, layout.shell, "layoutSlots");
|
|
4758
|
-
return CustomShell ? /* @__PURE__ */
|
|
4752
|
+
return CustomShell ? /* @__PURE__ */ jsx28(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx28(MissingRenderer, { renderer: layout.shell });
|
|
4759
4753
|
}
|
|
4760
|
-
if (layout?.shell === "portal") return /* @__PURE__ */
|
|
4761
|
-
return /* @__PURE__ */
|
|
4754
|
+
if (layout?.shell === "portal") return /* @__PURE__ */ jsx28(PortalShell, { app, menu, layout, registry });
|
|
4755
|
+
return /* @__PURE__ */ jsx28(DefaultShell, { app, menu, layout, registry });
|
|
4762
4756
|
}
|
|
4763
4757
|
|
|
4764
4758
|
// src/security/AccessDeniedPage.tsx
|
|
4765
4759
|
import { Box as Box19, Button as Button12, Flex as Flex12, Heading as Heading9, Text as Text20, VStack } from "@chakra-ui/react";
|
|
4766
4760
|
import { useNavigate } from "react-router-dom";
|
|
4767
|
-
import { jsx as
|
|
4761
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4768
4762
|
function AccessDeniedPage({ app }) {
|
|
4769
4763
|
const { logout } = useOonAuth();
|
|
4770
4764
|
const navigate = useNavigate();
|
|
@@ -4772,7 +4766,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4772
4766
|
logout();
|
|
4773
4767
|
navigate("/login", { replace: true });
|
|
4774
4768
|
}
|
|
4775
|
-
return /* @__PURE__ */
|
|
4769
|
+
return /* @__PURE__ */ jsx29(Flex12, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx29(
|
|
4776
4770
|
Box19,
|
|
4777
4771
|
{
|
|
4778
4772
|
width: "100%",
|
|
@@ -4783,8 +4777,8 @@ function AccessDeniedPage({ app }) {
|
|
|
4783
4777
|
borderRadius: "18px",
|
|
4784
4778
|
boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
|
|
4785
4779
|
p: { base: 6, md: 10 },
|
|
4786
|
-
children: /* @__PURE__ */
|
|
4787
|
-
/* @__PURE__ */
|
|
4780
|
+
children: /* @__PURE__ */ jsxs20(VStack, { align: "stretch", gap: 6, children: [
|
|
4781
|
+
/* @__PURE__ */ jsx29(
|
|
4788
4782
|
Box19,
|
|
4789
4783
|
{
|
|
4790
4784
|
width: "56px",
|
|
@@ -4801,8 +4795,8 @@ function AccessDeniedPage({ app }) {
|
|
|
4801
4795
|
children: "!"
|
|
4802
4796
|
}
|
|
4803
4797
|
),
|
|
4804
|
-
/* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
4798
|
+
/* @__PURE__ */ jsxs20(Box19, { children: [
|
|
4799
|
+
/* @__PURE__ */ jsx29(
|
|
4806
4800
|
Text20,
|
|
4807
4801
|
{
|
|
4808
4802
|
color: "#39BFED",
|
|
@@ -4813,14 +4807,14 @@ function AccessDeniedPage({ app }) {
|
|
|
4813
4807
|
children: "Acesso negado"
|
|
4814
4808
|
}
|
|
4815
4809
|
),
|
|
4816
|
-
/* @__PURE__ */
|
|
4817
|
-
/* @__PURE__ */
|
|
4810
|
+
/* @__PURE__ */ jsx29(Heading9, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
|
|
4811
|
+
/* @__PURE__ */ jsxs20(Text20, { mt: 3, color: "gray.600", children: [
|
|
4818
4812
|
"Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
|
|
4819
4813
|
app.title ?? app.name,
|
|
4820
4814
|
". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
|
|
4821
4815
|
] })
|
|
4822
4816
|
] }),
|
|
4823
|
-
/* @__PURE__ */
|
|
4817
|
+
/* @__PURE__ */ jsx29(
|
|
4824
4818
|
Button12,
|
|
4825
4819
|
{
|
|
4826
4820
|
alignSelf: "flex-start",
|
|
@@ -4838,7 +4832,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4838
4832
|
|
|
4839
4833
|
// src/security/AppAccessGuard.tsx
|
|
4840
4834
|
import { Navigate, useLocation } from "react-router-dom";
|
|
4841
|
-
import { Fragment as
|
|
4835
|
+
import { Fragment as Fragment4, jsx as jsx30 } from "react/jsx-runtime";
|
|
4842
4836
|
function loginRedirect(pathname, search) {
|
|
4843
4837
|
const destination = `${pathname}${search}`;
|
|
4844
4838
|
return `/login?redirect=${encodeURIComponent(destination)}`;
|
|
@@ -4846,9 +4840,9 @@ function loginRedirect(pathname, search) {
|
|
|
4846
4840
|
function AppAccessGuard({ children }) {
|
|
4847
4841
|
const { status, retry } = useOonAuth();
|
|
4848
4842
|
const location = useLocation();
|
|
4849
|
-
if (status === "loading") return /* @__PURE__ */
|
|
4843
|
+
if (status === "loading") return /* @__PURE__ */ jsx30(LoadingScreen, {});
|
|
4850
4844
|
if (status === "unauthenticated") {
|
|
4851
|
-
return /* @__PURE__ */
|
|
4845
|
+
return /* @__PURE__ */ jsx30(
|
|
4852
4846
|
Navigate,
|
|
4853
4847
|
{
|
|
4854
4848
|
to: loginRedirect(location.pathname, location.search),
|
|
@@ -4857,10 +4851,10 @@ function AppAccessGuard({ children }) {
|
|
|
4857
4851
|
);
|
|
4858
4852
|
}
|
|
4859
4853
|
if (status === "forbidden") {
|
|
4860
|
-
return /* @__PURE__ */
|
|
4854
|
+
return /* @__PURE__ */ jsx30(Navigate, { to: "/acesso-negado", replace: true });
|
|
4861
4855
|
}
|
|
4862
4856
|
if (status === "error") {
|
|
4863
|
-
return /* @__PURE__ */
|
|
4857
|
+
return /* @__PURE__ */ jsx30(
|
|
4864
4858
|
LoadingScreen,
|
|
4865
4859
|
{
|
|
4866
4860
|
message: "N\xE3o foi poss\xEDvel validar seu acesso. Tente novamente.",
|
|
@@ -4871,7 +4865,7 @@ function AppAccessGuard({ children }) {
|
|
|
4871
4865
|
}
|
|
4872
4866
|
);
|
|
4873
4867
|
}
|
|
4874
|
-
return /* @__PURE__ */
|
|
4868
|
+
return /* @__PURE__ */ jsx30(Fragment4, { children });
|
|
4875
4869
|
}
|
|
4876
4870
|
|
|
4877
4871
|
// src/security/LoginPage.tsx
|
|
@@ -4881,12 +4875,12 @@ import {
|
|
|
4881
4875
|
Button as Button13,
|
|
4882
4876
|
Flex as Flex13,
|
|
4883
4877
|
Heading as Heading10,
|
|
4884
|
-
Input as
|
|
4878
|
+
Input as Input6,
|
|
4885
4879
|
Text as Text21,
|
|
4886
4880
|
VStack as VStack2
|
|
4887
4881
|
} from "@chakra-ui/react";
|
|
4888
4882
|
import { Navigate as Navigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
4889
|
-
import { jsx as
|
|
4883
|
+
import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4890
4884
|
function safeRedirect(search) {
|
|
4891
4885
|
const value2 = new URLSearchParams(search).get("redirect") || "/";
|
|
4892
4886
|
if (!value2.startsWith("/") || value2.startsWith("//")) return "/";
|
|
@@ -4904,10 +4898,10 @@ function LoginPage({ app }) {
|
|
|
4904
4898
|
const [message, setMessage] = useState12(null);
|
|
4905
4899
|
const redirect = safeRedirect(location.search);
|
|
4906
4900
|
if (status === "authenticated") {
|
|
4907
|
-
return /* @__PURE__ */
|
|
4901
|
+
return /* @__PURE__ */ jsx31(Navigate2, { to: redirect, replace: true });
|
|
4908
4902
|
}
|
|
4909
4903
|
if (status === "forbidden") {
|
|
4910
|
-
return /* @__PURE__ */
|
|
4904
|
+
return /* @__PURE__ */ jsx31(Navigate2, { to: "/acesso-negado", replace: true });
|
|
4911
4905
|
}
|
|
4912
4906
|
async function handleSubmit(event) {
|
|
4913
4907
|
event.preventDefault();
|
|
@@ -4925,7 +4919,7 @@ function LoginPage({ app }) {
|
|
|
4925
4919
|
setSubmitting(false);
|
|
4926
4920
|
}
|
|
4927
4921
|
}
|
|
4928
|
-
return /* @__PURE__ */
|
|
4922
|
+
return /* @__PURE__ */ jsx31(Flex13, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx31(
|
|
4929
4923
|
Box20,
|
|
4930
4924
|
{
|
|
4931
4925
|
width: "100%",
|
|
@@ -4936,9 +4930,9 @@ function LoginPage({ app }) {
|
|
|
4936
4930
|
borderRadius: "18px",
|
|
4937
4931
|
boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
|
|
4938
4932
|
p: { base: 6, md: 9 },
|
|
4939
|
-
children: /* @__PURE__ */
|
|
4940
|
-
/* @__PURE__ */
|
|
4941
|
-
/* @__PURE__ */
|
|
4933
|
+
children: /* @__PURE__ */ jsx31("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 6, children: [
|
|
4934
|
+
/* @__PURE__ */ jsxs21(Box20, { children: [
|
|
4935
|
+
/* @__PURE__ */ jsx31(
|
|
4942
4936
|
Text21,
|
|
4943
4937
|
{
|
|
4944
4938
|
color: "#39BFED",
|
|
@@ -4949,14 +4943,14 @@ function LoginPage({ app }) {
|
|
|
4949
4943
|
children: "Central Oon"
|
|
4950
4944
|
}
|
|
4951
4945
|
),
|
|
4952
|
-
/* @__PURE__ */
|
|
4953
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsx31(Heading10, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
|
|
4947
|
+
/* @__PURE__ */ jsx31(Text21, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
|
|
4954
4948
|
] }),
|
|
4955
|
-
/* @__PURE__ */
|
|
4956
|
-
/* @__PURE__ */
|
|
4957
|
-
/* @__PURE__ */
|
|
4958
|
-
/* @__PURE__ */
|
|
4959
|
-
|
|
4949
|
+
/* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 4, children: [
|
|
4950
|
+
/* @__PURE__ */ jsxs21(Box20, { children: [
|
|
4951
|
+
/* @__PURE__ */ jsx31(Text21, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
|
|
4952
|
+
/* @__PURE__ */ jsx31(
|
|
4953
|
+
Input6,
|
|
4960
4954
|
{
|
|
4961
4955
|
type: "email",
|
|
4962
4956
|
value: email,
|
|
@@ -4967,10 +4961,10 @@ function LoginPage({ app }) {
|
|
|
4967
4961
|
}
|
|
4968
4962
|
)
|
|
4969
4963
|
] }),
|
|
4970
|
-
/* @__PURE__ */
|
|
4971
|
-
/* @__PURE__ */
|
|
4972
|
-
/* @__PURE__ */
|
|
4973
|
-
|
|
4964
|
+
/* @__PURE__ */ jsxs21(Box20, { children: [
|
|
4965
|
+
/* @__PURE__ */ jsx31(Text21, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
|
|
4966
|
+
/* @__PURE__ */ jsx31(
|
|
4967
|
+
Input6,
|
|
4974
4968
|
{
|
|
4975
4969
|
type: "password",
|
|
4976
4970
|
value: password,
|
|
@@ -4982,7 +4976,7 @@ function LoginPage({ app }) {
|
|
|
4982
4976
|
)
|
|
4983
4977
|
] })
|
|
4984
4978
|
] }),
|
|
4985
|
-
message ? /* @__PURE__ */
|
|
4979
|
+
message ? /* @__PURE__ */ jsx31(
|
|
4986
4980
|
Box20,
|
|
4987
4981
|
{
|
|
4988
4982
|
role: "alert",
|
|
@@ -4995,7 +4989,7 @@ function LoginPage({ app }) {
|
|
|
4995
4989
|
children: message
|
|
4996
4990
|
}
|
|
4997
4991
|
) : null,
|
|
4998
|
-
/* @__PURE__ */
|
|
4992
|
+
/* @__PURE__ */ jsx31(
|
|
4999
4993
|
Button13,
|
|
5000
4994
|
{
|
|
5001
4995
|
type: "submit",
|
|
@@ -5013,8 +5007,8 @@ function LoginPage({ app }) {
|
|
|
5013
5007
|
|
|
5014
5008
|
// src/security/ActivationPage.tsx
|
|
5015
5009
|
import { useEffect as useEffect8, useState as useState13 } from "react";
|
|
5016
|
-
import { Box as Box21, Button as Button14, Heading as Heading11, Input as
|
|
5017
|
-
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";
|
|
5018
5012
|
function encodeBasicCredentials2(email, password) {
|
|
5019
5013
|
const bytes = new TextEncoder().encode(`${email}:${password}`);
|
|
5020
5014
|
let binary = "";
|
|
@@ -5148,13 +5142,13 @@ function ActivationPage() {
|
|
|
5148
5142
|
}
|
|
5149
5143
|
}
|
|
5150
5144
|
function renderField(field, values, setValues) {
|
|
5151
|
-
return /* @__PURE__ */
|
|
5152
|
-
/* @__PURE__ */
|
|
5145
|
+
return /* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5146
|
+
/* @__PURE__ */ jsxs22(Text22, { fontWeight: "medium", children: [
|
|
5153
5147
|
field.label,
|
|
5154
5148
|
field.required ? " *" : ""
|
|
5155
5149
|
] }),
|
|
5156
|
-
/* @__PURE__ */
|
|
5157
|
-
|
|
5150
|
+
/* @__PURE__ */ jsx32(
|
|
5151
|
+
Input7,
|
|
5158
5152
|
{
|
|
5159
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",
|
|
5160
5154
|
value: String(values[field.name] ?? field.defaultValue ?? ""),
|
|
@@ -5165,16 +5159,16 @@ function ActivationPage() {
|
|
|
5165
5159
|
onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
|
|
5166
5160
|
}
|
|
5167
5161
|
),
|
|
5168
|
-
field.helpText ? /* @__PURE__ */
|
|
5162
|
+
field.helpText ? /* @__PURE__ */ jsx32(Text22, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
|
|
5169
5163
|
] }, field.name);
|
|
5170
5164
|
}
|
|
5171
5165
|
function renderDevLocalActivation() {
|
|
5172
|
-
return /* @__PURE__ */
|
|
5173
|
-
/* @__PURE__ */
|
|
5174
|
-
/* @__PURE__ */
|
|
5175
|
-
/* @__PURE__ */
|
|
5176
|
-
/* @__PURE__ */
|
|
5177
|
-
|
|
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" }),
|
|
5170
|
+
/* @__PURE__ */ jsx32(
|
|
5171
|
+
Input7,
|
|
5178
5172
|
{
|
|
5179
5173
|
value: devName,
|
|
5180
5174
|
onChange: (event) => setDevName(event.target.value),
|
|
@@ -5183,10 +5177,10 @@ function ActivationPage() {
|
|
|
5183
5177
|
}
|
|
5184
5178
|
)
|
|
5185
5179
|
] }),
|
|
5186
|
-
/* @__PURE__ */
|
|
5187
|
-
/* @__PURE__ */
|
|
5188
|
-
/* @__PURE__ */
|
|
5189
|
-
|
|
5180
|
+
/* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5181
|
+
/* @__PURE__ */ jsx32(Text22, { fontWeight: "medium", children: "E-mail *" }),
|
|
5182
|
+
/* @__PURE__ */ jsx32(
|
|
5183
|
+
Input7,
|
|
5190
5184
|
{
|
|
5191
5185
|
type: "email",
|
|
5192
5186
|
value: devEmail,
|
|
@@ -5196,10 +5190,10 @@ function ActivationPage() {
|
|
|
5196
5190
|
}
|
|
5197
5191
|
)
|
|
5198
5192
|
] }),
|
|
5199
|
-
/* @__PURE__ */
|
|
5200
|
-
/* @__PURE__ */
|
|
5201
|
-
/* @__PURE__ */
|
|
5202
|
-
|
|
5193
|
+
/* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5194
|
+
/* @__PURE__ */ jsx32(Text22, { fontWeight: "medium", children: "Senha *" }),
|
|
5195
|
+
/* @__PURE__ */ jsx32(
|
|
5196
|
+
Input7,
|
|
5203
5197
|
{
|
|
5204
5198
|
type: "password",
|
|
5205
5199
|
value: devPassword,
|
|
@@ -5210,7 +5204,7 @@ function ActivationPage() {
|
|
|
5210
5204
|
}
|
|
5211
5205
|
)
|
|
5212
5206
|
] }),
|
|
5213
|
-
/* @__PURE__ */
|
|
5207
|
+
/* @__PURE__ */ jsx32(
|
|
5214
5208
|
Button14,
|
|
5215
5209
|
{
|
|
5216
5210
|
colorPalette: "blue",
|
|
@@ -5220,7 +5214,7 @@ function ActivationPage() {
|
|
|
5220
5214
|
children: "Ativar ambiente de desenvolvimento"
|
|
5221
5215
|
}
|
|
5222
5216
|
),
|
|
5223
|
-
/* @__PURE__ */
|
|
5217
|
+
/* @__PURE__ */ jsx32(
|
|
5224
5218
|
Button14,
|
|
5225
5219
|
{
|
|
5226
5220
|
variant: "outline",
|
|
@@ -5234,7 +5228,7 @@ function ActivationPage() {
|
|
|
5234
5228
|
const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
|
|
5235
5229
|
const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
|
|
5236
5230
|
if (activation.status === "loading" || !config) {
|
|
5237
|
-
return /* @__PURE__ */
|
|
5231
|
+
return /* @__PURE__ */ jsx32(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
5238
5232
|
VStack3,
|
|
5239
5233
|
{
|
|
5240
5234
|
maxW: "760px",
|
|
@@ -5245,14 +5239,14 @@ function ActivationPage() {
|
|
|
5245
5239
|
align: "stretch",
|
|
5246
5240
|
gap: 5,
|
|
5247
5241
|
children: [
|
|
5248
|
-
/* @__PURE__ */
|
|
5249
|
-
error ? /* @__PURE__ */
|
|
5242
|
+
/* @__PURE__ */ jsx32(Heading11, { children: "Preparando ativa\xE7\xE3o..." }),
|
|
5243
|
+
error ? /* @__PURE__ */ jsx32(Text22, { color: "red.600", children: error }) : null
|
|
5250
5244
|
]
|
|
5251
5245
|
}
|
|
5252
5246
|
) });
|
|
5253
5247
|
}
|
|
5254
5248
|
if (rootMode) {
|
|
5255
|
-
return /* @__PURE__ */
|
|
5249
|
+
return /* @__PURE__ */ jsx32(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
5256
5250
|
VStack3,
|
|
5257
5251
|
{
|
|
5258
5252
|
maxW: "560px",
|
|
@@ -5263,21 +5257,21 @@ function ActivationPage() {
|
|
|
5263
5257
|
align: "stretch",
|
|
5264
5258
|
gap: 5,
|
|
5265
5259
|
children: [
|
|
5266
|
-
/* @__PURE__ */
|
|
5267
|
-
/* @__PURE__ */
|
|
5268
|
-
/* @__PURE__ */
|
|
5260
|
+
/* @__PURE__ */ jsx32(Heading11, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
|
|
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: [
|
|
5269
5263
|
"App: ",
|
|
5270
5264
|
config.technical.appCode,
|
|
5271
5265
|
" \xB7 Ambiente:",
|
|
5272
5266
|
" ",
|
|
5273
5267
|
config.technical.ambiente
|
|
5274
5268
|
] }),
|
|
5275
|
-
error ? /* @__PURE__ */
|
|
5276
|
-
step !== 6 ? /* @__PURE__ */
|
|
5277
|
-
/* @__PURE__ */
|
|
5278
|
-
/* @__PURE__ */
|
|
5279
|
-
/* @__PURE__ */
|
|
5280
|
-
|
|
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 *" }),
|
|
5273
|
+
/* @__PURE__ */ jsx32(
|
|
5274
|
+
Input7,
|
|
5281
5275
|
{
|
|
5282
5276
|
type: "email",
|
|
5283
5277
|
autoComplete: "email",
|
|
@@ -5287,10 +5281,10 @@ function ActivationPage() {
|
|
|
5287
5281
|
}
|
|
5288
5282
|
)
|
|
5289
5283
|
] }),
|
|
5290
|
-
/* @__PURE__ */
|
|
5291
|
-
/* @__PURE__ */
|
|
5292
|
-
/* @__PURE__ */
|
|
5293
|
-
|
|
5284
|
+
/* @__PURE__ */ jsxs22(Box21, { w: "100%", children: [
|
|
5285
|
+
/* @__PURE__ */ jsx32(Text22, { fontWeight: "medium", children: "Senha *" }),
|
|
5286
|
+
/* @__PURE__ */ jsx32(
|
|
5287
|
+
Input7,
|
|
5294
5288
|
{
|
|
5295
5289
|
type: "password",
|
|
5296
5290
|
minLength: 8,
|
|
@@ -5301,7 +5295,7 @@ function ActivationPage() {
|
|
|
5301
5295
|
}
|
|
5302
5296
|
)
|
|
5303
5297
|
] }),
|
|
5304
|
-
/* @__PURE__ */
|
|
5298
|
+
/* @__PURE__ */ jsx32(
|
|
5305
5299
|
Button14,
|
|
5306
5300
|
{
|
|
5307
5301
|
colorPalette: "blue",
|
|
@@ -5311,15 +5305,15 @@ function ActivationPage() {
|
|
|
5311
5305
|
children: "Criar ecossistema e ativar"
|
|
5312
5306
|
}
|
|
5313
5307
|
)
|
|
5314
|
-
] }) : /* @__PURE__ */
|
|
5315
|
-
/* @__PURE__ */
|
|
5316
|
-
/* @__PURE__ */
|
|
5308
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5309
|
+
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
5310
|
+
/* @__PURE__ */ jsx32(Text22, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
|
|
5317
5311
|
] })
|
|
5318
5312
|
]
|
|
5319
5313
|
}
|
|
5320
5314
|
) });
|
|
5321
5315
|
}
|
|
5322
|
-
return /* @__PURE__ */
|
|
5316
|
+
return /* @__PURE__ */ jsx32(Box21, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
5323
5317
|
VStack3,
|
|
5324
5318
|
{
|
|
5325
5319
|
maxW: "760px",
|
|
@@ -5330,8 +5324,8 @@ function ActivationPage() {
|
|
|
5330
5324
|
align: "stretch",
|
|
5331
5325
|
gap: 5,
|
|
5332
5326
|
children: [
|
|
5333
|
-
/* @__PURE__ */
|
|
5334
|
-
/* @__PURE__ */
|
|
5327
|
+
/* @__PURE__ */ jsx32(Heading11, { children: "Ativa\xE7\xE3o da Central Oon" }),
|
|
5328
|
+
/* @__PURE__ */ jsxs22(Text22, { children: [
|
|
5335
5329
|
"App: ",
|
|
5336
5330
|
config.technical.appCode,
|
|
5337
5331
|
" \xB7 Ambiente:",
|
|
@@ -5341,12 +5335,12 @@ function ActivationPage() {
|
|
|
5341
5335
|
" ",
|
|
5342
5336
|
config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
|
|
5343
5337
|
] }),
|
|
5344
|
-
error ? /* @__PURE__ */
|
|
5338
|
+
error ? /* @__PURE__ */ jsx32(Text22, { color: "red.600", children: error }) : null,
|
|
5345
5339
|
step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
|
|
5346
|
-
step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */
|
|
5347
|
-
/* @__PURE__ */
|
|
5348
|
-
/* @__PURE__ */
|
|
5349
|
-
|
|
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." }),
|
|
5342
|
+
/* @__PURE__ */ jsx32(
|
|
5343
|
+
Input7,
|
|
5350
5344
|
{
|
|
5351
5345
|
"aria-label": "C\xF3digo de ativa\xE7\xE3o",
|
|
5352
5346
|
value: code,
|
|
@@ -5354,7 +5348,7 @@ function ActivationPage() {
|
|
|
5354
5348
|
placeholder: "OON-XXXX"
|
|
5355
5349
|
}
|
|
5356
5350
|
),
|
|
5357
|
-
/* @__PURE__ */
|
|
5351
|
+
/* @__PURE__ */ jsx32(
|
|
5358
5352
|
Button14,
|
|
5359
5353
|
{
|
|
5360
5354
|
onClick: validateCode,
|
|
@@ -5363,7 +5357,7 @@ function ActivationPage() {
|
|
|
5363
5357
|
children: "Validar c\xF3digo"
|
|
5364
5358
|
}
|
|
5365
5359
|
),
|
|
5366
|
-
isDevelopmentMember ? /* @__PURE__ */
|
|
5360
|
+
isDevelopmentMember ? /* @__PURE__ */ jsx32(
|
|
5367
5361
|
Button14,
|
|
5368
5362
|
{
|
|
5369
5363
|
variant: "outline",
|
|
@@ -5373,24 +5367,24 @@ function ActivationPage() {
|
|
|
5373
5367
|
}
|
|
5374
5368
|
) : null
|
|
5375
5369
|
] }),
|
|
5376
|
-
step === 2 && /* @__PURE__ */
|
|
5377
|
-
/* @__PURE__ */
|
|
5378
|
-
/* @__PURE__ */
|
|
5379
|
-
/* @__PURE__ */
|
|
5370
|
+
step === 2 && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5371
|
+
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Confirma\xE7\xE3o" }),
|
|
5372
|
+
/* @__PURE__ */ jsx32("pre", { children: JSON.stringify(preview, null, 2) }),
|
|
5373
|
+
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(3), children: "Continuar" })
|
|
5380
5374
|
] }),
|
|
5381
|
-
step === 3 && /* @__PURE__ */
|
|
5375
|
+
step === 3 && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5382
5376
|
config.globalFields.map(
|
|
5383
5377
|
(field) => renderField(field, global, setGlobal)
|
|
5384
5378
|
),
|
|
5385
|
-
/* @__PURE__ */
|
|
5379
|
+
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(4), children: "Continuar" })
|
|
5386
5380
|
] }),
|
|
5387
|
-
step === 4 && /* @__PURE__ */
|
|
5388
|
-
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */
|
|
5389
|
-
/* @__PURE__ */
|
|
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." }),
|
|
5383
|
+
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(5), children: "Revisar" })
|
|
5390
5384
|
] }),
|
|
5391
|
-
step === 5 && /* @__PURE__ */
|
|
5392
|
-
/* @__PURE__ */
|
|
5393
|
-
/* @__PURE__ */
|
|
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." }),
|
|
5387
|
+
/* @__PURE__ */ jsx32(
|
|
5394
5388
|
Button14,
|
|
5395
5389
|
{
|
|
5396
5390
|
colorPalette: "blue",
|
|
@@ -5401,14 +5395,14 @@ function ActivationPage() {
|
|
|
5401
5395
|
}
|
|
5402
5396
|
)
|
|
5403
5397
|
] }),
|
|
5404
|
-
step === 6 && /* @__PURE__ */
|
|
5405
|
-
/* @__PURE__ */
|
|
5406
|
-
devResult?.appCode ? /* @__PURE__ */
|
|
5398
|
+
step === 6 && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5399
|
+
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
5400
|
+
devResult?.appCode ? /* @__PURE__ */ jsxs22(Text22, { children: [
|
|
5407
5401
|
"C\xF3digo do app: ",
|
|
5408
5402
|
devResult.appCode,
|
|
5409
5403
|
". Redirecionando para a Central em desenvolvimento..."
|
|
5410
|
-
] }) : /* @__PURE__ */
|
|
5411
|
-
devResult?.instrucoes?.env ? /* @__PURE__ */
|
|
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
|
|
5412
5406
|
] })
|
|
5413
5407
|
]
|
|
5414
5408
|
}
|
|
@@ -5418,47 +5412,47 @@ function InstanceBlockedPage({
|
|
|
5418
5412
|
title,
|
|
5419
5413
|
message
|
|
5420
5414
|
}) {
|
|
5421
|
-
return /* @__PURE__ */
|
|
5422
|
-
/* @__PURE__ */
|
|
5423
|
-
/* @__PURE__ */
|
|
5415
|
+
return /* @__PURE__ */ jsxs22(Box21, { p: 8, children: [
|
|
5416
|
+
/* @__PURE__ */ jsx32(Heading11, { children: title }),
|
|
5417
|
+
/* @__PURE__ */ jsx32(Text22, { children: message })
|
|
5424
5418
|
] });
|
|
5425
5419
|
}
|
|
5426
5420
|
|
|
5427
5421
|
// src/security/RouteGuard.tsx
|
|
5428
|
-
import { Fragment as
|
|
5422
|
+
import { Fragment as Fragment6, jsx as jsx33 } from "react/jsx-runtime";
|
|
5429
5423
|
function RouteGuard({
|
|
5430
5424
|
permission,
|
|
5431
5425
|
children
|
|
5432
5426
|
}) {
|
|
5433
5427
|
const { status, hasPermission } = useOonAuth();
|
|
5434
|
-
if (status === "loading") return /* @__PURE__ */
|
|
5435
|
-
if (status === "unauthenticated") return /* @__PURE__ */
|
|
5428
|
+
if (status === "loading") return /* @__PURE__ */ jsx33(LoadingScreen, {});
|
|
5429
|
+
if (status === "unauthenticated") return /* @__PURE__ */ jsx33(LoadingScreen, { message: "Redirecionando para o login..." });
|
|
5436
5430
|
if (!hasPermission(permission)) {
|
|
5437
|
-
return /* @__PURE__ */
|
|
5431
|
+
return /* @__PURE__ */ jsx33(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
|
|
5438
5432
|
}
|
|
5439
|
-
return /* @__PURE__ */
|
|
5433
|
+
return /* @__PURE__ */ jsx33(Fragment6, { children });
|
|
5440
5434
|
}
|
|
5441
5435
|
|
|
5442
5436
|
// src/security/ActivationGuard.tsx
|
|
5443
5437
|
import { Navigate as Navigate3 } from "react-router-dom";
|
|
5444
|
-
import { jsx as
|
|
5438
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5445
5439
|
function ActivationGuard({ children }) {
|
|
5446
5440
|
const { status } = useActivation();
|
|
5447
5441
|
if (status === "loading") return null;
|
|
5448
|
-
if (status === "suspended") return /* @__PURE__ */
|
|
5449
|
-
if (status === "revoked") return /* @__PURE__ */
|
|
5450
|
-
if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */
|
|
5442
|
+
if (status === "suspended") return /* @__PURE__ */ jsx34(Navigate3, { to: "/instancia-suspensa", replace: true });
|
|
5443
|
+
if (status === "revoked") return /* @__PURE__ */ jsx34(Navigate3, { to: "/instancia-revogada", replace: true });
|
|
5444
|
+
if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx34(Navigate3, { to: "/ativacao", replace: true });
|
|
5451
5445
|
return children;
|
|
5452
5446
|
}
|
|
5453
5447
|
|
|
5454
5448
|
// src/app/createOonRouter.tsx
|
|
5455
|
-
import { jsx as
|
|
5449
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5456
5450
|
function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
5457
5451
|
const guardEnabled = security?.enableRouteGuard !== false;
|
|
5458
5452
|
const publicRoutes = routes.filter((route) => route.public).map((route) => ({ path: route.path, element: route.element }));
|
|
5459
5453
|
const privateSource = routes.filter((route) => !route.public);
|
|
5460
5454
|
const privateRoutes = privateSource.map((route) => {
|
|
5461
|
-
const element = guardEnabled ? /* @__PURE__ */
|
|
5455
|
+
const element = guardEnabled ? /* @__PURE__ */ jsx35(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
|
|
5462
5456
|
return route.path === "/" ? { index: true, element } : { path: route.path.replace(/^\//, ""), element };
|
|
5463
5457
|
});
|
|
5464
5458
|
const hasIndexRoute = privateSource.some((route) => route.path === "/");
|
|
@@ -5466,7 +5460,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5466
5460
|
if (!hasIndexRoute && firstRoute) {
|
|
5467
5461
|
privateRoutes.unshift({
|
|
5468
5462
|
index: true,
|
|
5469
|
-
element: /* @__PURE__ */
|
|
5463
|
+
element: /* @__PURE__ */ jsx35(Navigate4, { to: firstRoute.path, replace: true })
|
|
5470
5464
|
});
|
|
5471
5465
|
}
|
|
5472
5466
|
const customPaths = new Set(publicRoutes.map((route) => route.path));
|
|
@@ -5474,19 +5468,19 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5474
5468
|
if (!customPaths.has("/login")) {
|
|
5475
5469
|
builtInPublicRoutes.push({
|
|
5476
5470
|
path: "/login",
|
|
5477
|
-
element: /* @__PURE__ */
|
|
5471
|
+
element: /* @__PURE__ */ jsx35(ActivationGuard, { children: /* @__PURE__ */ jsx35(LoginPage, { app }) })
|
|
5478
5472
|
});
|
|
5479
5473
|
}
|
|
5480
5474
|
if (!customPaths.has("/ativacao")) {
|
|
5481
5475
|
builtInPublicRoutes.push({
|
|
5482
5476
|
path: "/ativacao",
|
|
5483
|
-
element: /* @__PURE__ */
|
|
5477
|
+
element: /* @__PURE__ */ jsx35(ActivationPage, {})
|
|
5484
5478
|
});
|
|
5485
5479
|
}
|
|
5486
5480
|
if (!customPaths.has("/instancia-suspensa")) {
|
|
5487
5481
|
builtInPublicRoutes.push({
|
|
5488
5482
|
path: "/instancia-suspensa",
|
|
5489
|
-
element: /* @__PURE__ */
|
|
5483
|
+
element: /* @__PURE__ */ jsx35(
|
|
5490
5484
|
InstanceBlockedPage,
|
|
5491
5485
|
{
|
|
5492
5486
|
title: "Inst\xE2ncia suspensa",
|
|
@@ -5498,7 +5492,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5498
5492
|
if (!customPaths.has("/instancia-revogada")) {
|
|
5499
5493
|
builtInPublicRoutes.push({
|
|
5500
5494
|
path: "/instancia-revogada",
|
|
5501
|
-
element: /* @__PURE__ */
|
|
5495
|
+
element: /* @__PURE__ */ jsx35(
|
|
5502
5496
|
InstanceBlockedPage,
|
|
5503
5497
|
{
|
|
5504
5498
|
title: "Inst\xE2ncia revogada",
|
|
@@ -5510,7 +5504,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5510
5504
|
if (!customPaths.has("/acesso-negado")) {
|
|
5511
5505
|
builtInPublicRoutes.push({
|
|
5512
5506
|
path: "/acesso-negado",
|
|
5513
|
-
element: /* @__PURE__ */
|
|
5507
|
+
element: /* @__PURE__ */ jsx35(AccessDeniedPage, { app })
|
|
5514
5508
|
});
|
|
5515
5509
|
}
|
|
5516
5510
|
const tree = [
|
|
@@ -5518,7 +5512,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5518
5512
|
...publicRoutes,
|
|
5519
5513
|
{
|
|
5520
5514
|
path: "/",
|
|
5521
|
-
element: /* @__PURE__ */
|
|
5515
|
+
element: /* @__PURE__ */ jsx35(ActivationGuard, { children: /* @__PURE__ */ jsx35(AppAccessGuard, { children: /* @__PURE__ */ jsx35(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
|
|
5522
5516
|
children: privateRoutes
|
|
5523
5517
|
}
|
|
5524
5518
|
];
|
|
@@ -5526,7 +5520,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
5526
5520
|
}
|
|
5527
5521
|
|
|
5528
5522
|
// src/app/OonApp.tsx
|
|
5529
|
-
import { jsx as
|
|
5523
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5530
5524
|
function localLoginUrl() {
|
|
5531
5525
|
const current = `${window.location.pathname}${window.location.search}`;
|
|
5532
5526
|
return `/login?redirect=${encodeURIComponent(current)}`;
|
|
@@ -5561,7 +5555,7 @@ function OonApp({ config }) {
|
|
|
5561
5555
|
});
|
|
5562
5556
|
return { http: http2, storage: storage2, router: router2 };
|
|
5563
5557
|
}, [config]);
|
|
5564
|
-
return /* @__PURE__ */
|
|
5558
|
+
return /* @__PURE__ */ jsx36(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx36(RouterProvider, { router }) });
|
|
5565
5559
|
}
|
|
5566
5560
|
|
|
5567
5561
|
// src/components/internal/pipelineBoardLayout.ts
|
|
@@ -5619,7 +5613,7 @@ function installPipelineBoardLayoutStyles(targetDocument = document) {
|
|
|
5619
5613
|
}
|
|
5620
5614
|
|
|
5621
5615
|
// src/start.tsx
|
|
5622
|
-
import { jsx as
|
|
5616
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
5623
5617
|
function validateConfig(config) {
|
|
5624
5618
|
if (!config?.app?.id) throw new Error("oonCoreFront.start: config.app.id \xE9 obrigat\xF3rio.");
|
|
5625
5619
|
if (!config?.api?.baseUrl) throw new Error("oonCoreFront.start: config.api.baseUrl \xE9 obrigat\xF3rio.");
|
|
@@ -5654,7 +5648,7 @@ function start(config) {
|
|
|
5654
5648
|
const el = document.getElementById(rootId);
|
|
5655
5649
|
if (!el) throw new Error(`oonCoreFront.start: elemento #${rootId} n\xE3o encontrado no DOM.`);
|
|
5656
5650
|
createRoot(el).render(
|
|
5657
|
-
/* @__PURE__ */
|
|
5651
|
+
/* @__PURE__ */ jsx37(StrictMode, { children: /* @__PURE__ */ jsx37(OonApp, { config }) })
|
|
5658
5652
|
);
|
|
5659
5653
|
}
|
|
5660
5654
|
var oonCoreFront = { start };
|
|
@@ -5814,22 +5808,22 @@ function defineOonModule(mod) {
|
|
|
5814
5808
|
// src/components/CoreIntegration.tsx
|
|
5815
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";
|
|
5816
5810
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
5817
|
-
import { jsx as
|
|
5811
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5818
5812
|
function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
5819
5813
|
const { http } = useOonApi();
|
|
5820
5814
|
const metadata = useCoreMetadata();
|
|
5821
5815
|
const reprocess = useMutation4({
|
|
5822
5816
|
mutationFn: () => http.post("/integrations/actions/process-active", {}, { headers: { "x-oon-origin": "integration" } })
|
|
5823
5817
|
});
|
|
5824
|
-
if (metadata.isLoading) return /* @__PURE__ */
|
|
5825
|
-
if (metadata.isError) return /* @__PURE__ */
|
|
5818
|
+
if (metadata.isLoading) return /* @__PURE__ */ jsx38(LoadingScreen, {});
|
|
5819
|
+
if (metadata.isError) return /* @__PURE__ */ jsx38(ErrorState, { error: metadata.error });
|
|
5826
5820
|
const integrations = metadata.data?.integrations ?? [];
|
|
5827
|
-
return /* @__PURE__ */
|
|
5828
|
-
/* @__PURE__ */
|
|
5829
|
-
/* @__PURE__ */
|
|
5830
|
-
/* @__PURE__ */
|
|
5821
|
+
return /* @__PURE__ */ jsxs23(Stack9, { gap: 6, children: [
|
|
5822
|
+
/* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
|
|
5823
|
+
/* @__PURE__ */ jsx38(Heading12, { size: "lg", children: label }),
|
|
5824
|
+
/* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
|
|
5831
5825
|
] }),
|
|
5832
|
-
/* @__PURE__ */
|
|
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(
|
|
5833
5827
|
Box22,
|
|
5834
5828
|
{
|
|
5835
5829
|
borderWidth: "1px",
|
|
@@ -5837,9 +5831,9 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
5837
5831
|
borderRadius: "md",
|
|
5838
5832
|
bg: "white",
|
|
5839
5833
|
p: 4,
|
|
5840
|
-
children: /* @__PURE__ */
|
|
5841
|
-
/* @__PURE__ */
|
|
5842
|
-
/* @__PURE__ */
|
|
5834
|
+
children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
|
|
5835
|
+
/* @__PURE__ */ jsx38(Text23, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
|
|
5836
|
+
/* @__PURE__ */ jsx38(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
|
|
5843
5837
|
] })
|
|
5844
5838
|
},
|
|
5845
5839
|
it.id ?? it.name ?? idx
|
|
@@ -5850,7 +5844,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
5850
5844
|
// src/components/CoreCurrency.tsx
|
|
5851
5845
|
import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as Text24 } from "@chakra-ui/react";
|
|
5852
5846
|
import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
5853
|
-
import { jsx as
|
|
5847
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5854
5848
|
function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
|
|
5855
5849
|
const { http } = useOonApi();
|
|
5856
5850
|
const queryClient = useQueryClient5();
|
|
@@ -5858,21 +5852,21 @@ function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/mo
|
|
|
5858
5852
|
mutationFn: () => http.post(`${endpoint}/actions/update-rates`, {}, { headers: { "x-oon-origin": "integration" } }),
|
|
5859
5853
|
onSuccess: () => queryClient.invalidateQueries({ queryKey: ["oon", "list", endpoint] })
|
|
5860
5854
|
});
|
|
5861
|
-
return /* @__PURE__ */
|
|
5862
|
-
/* @__PURE__ */
|
|
5863
|
-
/* @__PURE__ */
|
|
5864
|
-
/* @__PURE__ */
|
|
5855
|
+
return /* @__PURE__ */ jsxs24(Stack10, { gap: 6, children: [
|
|
5856
|
+
/* @__PURE__ */ jsxs24(Flex15, { align: "center", justify: "space-between", children: [
|
|
5857
|
+
/* @__PURE__ */ jsx39(Heading13, { size: "lg", children: label }),
|
|
5858
|
+
/* @__PURE__ */ jsx39(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
|
|
5865
5859
|
] }),
|
|
5866
|
-
updateRates.isError ? /* @__PURE__ */
|
|
5867
|
-
/* @__PURE__ */
|
|
5860
|
+
updateRates.isError ? /* @__PURE__ */ jsx39(Text24, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
|
|
5861
|
+
/* @__PURE__ */ jsx39(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
|
|
5868
5862
|
] });
|
|
5869
5863
|
}
|
|
5870
5864
|
|
|
5871
5865
|
// src/components/CoreAssistant.tsx
|
|
5872
5866
|
import { useState as useState14 } from "react";
|
|
5873
|
-
import { Box as Box23, Button as Button17, Flex as Flex16, Heading as Heading14, Input 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";
|
|
5874
5868
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
5875
|
-
import { jsx as
|
|
5869
|
+
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5876
5870
|
function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
|
|
5877
5871
|
const { http } = useOonApi();
|
|
5878
5872
|
const [messages, setMessages] = useState14([]);
|
|
@@ -5901,10 +5895,10 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5901
5895
|
setInput("");
|
|
5902
5896
|
ask.mutate(text);
|
|
5903
5897
|
};
|
|
5904
|
-
return /* @__PURE__ */
|
|
5905
|
-
/* @__PURE__ */
|
|
5906
|
-
/* @__PURE__ */
|
|
5907
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
5898
|
+
return /* @__PURE__ */ jsxs25(Stack11, { gap: 4, maxW: "560px", children: [
|
|
5899
|
+
/* @__PURE__ */ jsx40(Heading14, { size: "md", children: label }),
|
|
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(
|
|
5908
5902
|
Box23,
|
|
5909
5903
|
{
|
|
5910
5904
|
bg: m.role === "user" ? "brand.500" : "gray.100",
|
|
@@ -5917,12 +5911,12 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5917
5911
|
children: m.content
|
|
5918
5912
|
}
|
|
5919
5913
|
) }, idx)),
|
|
5920
|
-
ask.isPending ? /* @__PURE__ */
|
|
5921
|
-
ask.isError ? /* @__PURE__ */
|
|
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
|
|
5922
5916
|
] }) }),
|
|
5923
|
-
/* @__PURE__ */
|
|
5924
|
-
/* @__PURE__ */
|
|
5925
|
-
|
|
5917
|
+
/* @__PURE__ */ jsxs25(Flex16, { gap: 2, children: [
|
|
5918
|
+
/* @__PURE__ */ jsx40(
|
|
5919
|
+
Input8,
|
|
5926
5920
|
{
|
|
5927
5921
|
size: "sm",
|
|
5928
5922
|
value: input,
|
|
@@ -5933,7 +5927,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5933
5927
|
}
|
|
5934
5928
|
}
|
|
5935
5929
|
),
|
|
5936
|
-
/* @__PURE__ */
|
|
5930
|
+
/* @__PURE__ */ jsx40(Button17, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
|
|
5937
5931
|
] })
|
|
5938
5932
|
] });
|
|
5939
5933
|
}
|