forlogic-core 1.20.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.note/memory/patterns/alias-url-resolution.md +5 -2
- package/.note/memory/patterns/single-scroll-pattern.md +30 -12
- package/dist/action-plans/components/ActionPlanAttachmentsTab.d.ts +18 -0
- package/dist/action-plans/components/ActionPlanCommentsTab.d.ts +18 -0
- package/dist/action-plans/components/ActionPlanCostTab.d.ts +10 -0
- package/dist/action-plans/components/ActionPlanGeneralTab.d.ts +18 -0
- package/dist/action-plans/components/ActionPlanHistoryTab.d.ts +13 -0
- package/dist/action-plans/components/ActionPlanPage.d.ts +25 -0
- package/dist/action-plans/components/ActionPlanPredecessorsTab.d.ts +10 -0
- package/dist/action-plans/components/ActionPlanProgressDialog.d.ts +13 -0
- package/dist/action-plans/components/ActionPlanProgressTab.d.ts +5 -0
- package/dist/action-plans/components/ActionPlanStatusBadge.d.ts +11 -0
- package/dist/action-plans/constants.d.ts +42 -0
- package/dist/action-plans/hooks/useActionPlan.d.ts +14 -0
- package/dist/action-plans/hooks/useActionPlanProgress.d.ts +15 -0
- package/dist/action-plans/index.d.ts +15 -0
- package/dist/action-plans/types.d.ts +353 -0
- package/dist/action-plans/utils/formatTime.d.ts +15 -0
- package/dist/approval-flow/components/ApprovalSidenav.d.ts +16 -0
- package/dist/approval-flow/components/ApproveDialog.d.ts +13 -0
- package/dist/approval-flow/components/SelectApproverDialog.d.ts +11 -0
- package/dist/approval-flow/index.d.ts +4 -0
- package/dist/approval-flow/types.d.ts +76 -0
- package/dist/assets/index.d.ts +1 -0
- package/dist/audit-trail/components/AuditTrailDetails.d.ts +17 -0
- package/dist/audit-trail/components/AuditTrailFilter.d.ts +19 -0
- package/dist/audit-trail/components/AuditTrailPage.d.ts +30 -0
- package/dist/audit-trail/index.d.ts +9 -0
- package/dist/audit-trail/types.d.ts +151 -0
- package/dist/audit-trail/utils.d.ts +38 -0
- package/dist/components/dashboards/dashboard-form.d.ts +50 -0
- package/dist/components/dashboards/dashboard-general-view.d.ts +109 -0
- package/dist/components/dashboards/dashboard-grid.d.ts +41 -0
- package/dist/components/dashboards/dashboard-list.d.ts +31 -0
- package/dist/components/dashboards/dashboard-panel-renderer.d.ts +21 -0
- package/dist/components/dashboards/dashboard-view.d.ts +38 -0
- package/dist/components/dashboards/helpers.d.ts +47 -0
- package/dist/components/dashboards/index.d.ts +9 -0
- package/dist/components/dashboards/panels/burndown-panel.d.ts +26 -0
- package/dist/components/dashboards/panels/cartesian-panel.d.ts +46 -0
- package/dist/components/dashboards/panels/index.d.ts +14 -0
- package/dist/components/dashboards/panels/list-panel.d.ts +30 -0
- package/dist/components/dashboards/panels/matrix-risk-panel.d.ts +49 -0
- package/dist/components/dashboards/panels/numeric-panel.d.ts +22 -0
- package/dist/components/dashboards/panels/panel-error.d.ts +8 -0
- package/dist/components/dashboards/panels/panel-header.d.ts +17 -0
- package/dist/components/dashboards/panels/panel-loader.d.ts +7 -0
- package/dist/components/dashboards/panels/panel-no-data.d.ts +6 -0
- package/dist/components/dashboards/panels/panel-unavailable.d.ts +6 -0
- package/dist/components/dashboards/panels/pareto-panel.d.ts +20 -0
- package/dist/components/dashboards/panels/performance-panel.d.ts +24 -0
- package/dist/components/dashboards/panels/pie-panel.d.ts +19 -0
- package/dist/components/dashboards/panels/text-panel.d.ts +18 -0
- package/dist/components/dashboards/types.d.ts +525 -0
- package/dist/components/ui/electronic-signature-dialog.d.ts +21 -0
- package/dist/components/ui/export-dialog.d.ts +28 -0
- package/dist/components/ui/iframe-dialog.d.ts +14 -0
- package/dist/components/ui/multiselect-permissions.d.ts +59 -0
- package/dist/components/ui/online-editor-dialog.d.ts +18 -0
- package/dist/components/ui/report-request-list.d.ts +44 -0
- package/dist/components/ui/stimulsoft-viewer.d.ts +20 -0
- package/dist/components/ui/terms-of-use-dialog.d.ts +56 -0
- package/dist/components/ui/timepicker.d.ts +11 -0
- package/dist/components/ui/users-groups-selector.d.ts +44 -0
- package/dist/components/ui/viewer-dialog.d.ts +77 -0
- package/dist/custom-form-fields/components/CustomFormFields.d.ts +8 -0
- package/dist/custom-form-fields/fields/FormDateField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormMultiSelectionField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormNumericField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormQuestionsField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormSingleSelectionField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormTextField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormTimeField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormUrlField.d.ts +6 -0
- package/dist/custom-form-fields/fields/ReadOnlyTextField.d.ts +6 -0
- package/dist/custom-form-fields/index.d.ts +13 -0
- package/dist/custom-form-fields/types.d.ts +143 -0
- package/dist/exports/action-plans.d.ts +16 -0
- package/dist/exports/audit-trail.d.ts +1 -0
- package/dist/exports/custom-form-fields.d.ts +1 -0
- package/dist/exports/file-upload.d.ts +1 -0
- package/dist/exports/ui.d.ts +12 -0
- package/dist/file-upload/components/SingleFileUpload.d.ts +43 -0
- package/dist/file-upload/index.d.ts +6 -0
- package/dist/file-upload/types.d.ts +11 -0
- package/dist/file-upload/utils/formatBytes.d.ts +1 -0
- package/dist/file-upload/utils/getFileExtension.d.ts +1 -0
- package/dist/hooks/useSidebarResize.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/team-selector/components/TeamSelector.d.ts +24 -0
- package/dist/team-selector/index.d.ts +2 -0
- package/dist/team-selector/types.d.ts +10 -0
- package/docs/ICON_MIGRATION_GUIDE.md +177 -0
- package/package.json +1 -1
- package/dist/assets/AccordionDoc-BVPUJk8G.js +0 -31
- package/dist/assets/ActionButtonDoc-DLJ_K9ib.js +0 -47
- package/dist/assets/AlertDoc-CY1ybZeG.js +0 -37
- package/dist/assets/AppHeaderDoc-Crkw4dA9.js +0 -67
- package/dist/assets/AppSidebarDoc-ET-4j6wV.js +0 -204
- package/dist/assets/AuthDoc-B4v4Nci5.js +0 -192
- package/dist/assets/AvatarDoc-BLdMoyJd.js +0 -11
- package/dist/assets/BadgeDoc-CSNM1b6b.js +0 -36
- package/dist/assets/BaseFormDoc-DXiYuN6-.js +0 -169
- package/dist/assets/BodyContentDoc-Bp6YmUWX.js +0 -83
- package/dist/assets/BreadcrumbDoc-D7tqqTvo.js +0 -75
- package/dist/assets/ButtonDoc-C4JwIvU3.js +0 -41
- package/dist/assets/ButtonGroupDoc-QFfjC7Pm.js +0 -7
- package/dist/assets/CalendarDoc-COlEKqmv.js +0 -81
- package/dist/assets/CardDoc-BVhMoC2w.js +0 -49
- package/dist/assets/ChartDoc-BJ14EjI2.js +0 -111
- package/dist/assets/CheckboxDoc-Bcqpln9_.js +0 -55
- package/dist/assets/ColorPickerDoc-CcfmSwyC.js +0 -10
- package/dist/assets/ColorsFoundationDoc-uO6IiJbS.js +0 -13
- package/dist/assets/ComboTreeDoc-R4qE6XwB.js +0 -46
- package/dist/assets/ComboboxDoc-JIo_-gSN.js +0 -134
- package/dist/assets/ComponentDocTemplate-CRbRY-v5.js +0 -1
- package/dist/assets/ContextMenuDoc-C4-_0NLp.js +0 -182
- package/dist/assets/ContextsDoc-Cj9Aaoyo.js +0 -184
- package/dist/assets/CreateCrudPageDoc-D_SnMRJ2.js +0 -106
- package/dist/assets/CrudActionBarDoc-BYqtIabp.js +0 -112
- package/dist/assets/CrudGridDoc-DspxQrq5.js +0 -85
- package/dist/assets/CrudOverviewDoc-DLcOL_HZ.js +0 -14
- package/dist/assets/CrudPrimitivesDoc-BRS86nWg.js +0 -164
- package/dist/assets/CrudTableDoc-Daw8u2G_.js +0 -113
- package/dist/assets/DataListDoc-BrgVNhhR.js +0 -13
- package/dist/assets/DesignSystemHome-BFBNqq1J.js +0 -1
- package/dist/assets/DialogDoc-DCpRy4rg.js +0 -981
- package/dist/assets/DropdownMenuDoc-DT6LBa8Z.js +0 -175
- package/dist/assets/EmptyStateDoc-wydc09gG.js +0 -35
- package/dist/assets/EnvironmentsDoc-amIriwDD.js +0 -96
- package/dist/assets/ErrorBoundaryDoc-BEixy_Gl.js +0 -111
- package/dist/assets/FormDoc-DxoRt6p7.js +0 -81
- package/dist/assets/FoundationOverview-CxSbumIt.js +0 -1
- package/dist/assets/GridDoc-BpQqCMUE.js +0 -28
- package/dist/assets/HooksDoc-JNODhbaF.js +0 -665
- package/dist/assets/HoverCardDoc-CdqiYrIb.js +0 -31
- package/dist/assets/I18nDoc-B6LMXnE3.js +0 -232
- package/dist/assets/IconPickerDoc-BRdy58IC.js +0 -10
- package/dist/assets/IconsFoundationDoc-CrymfxTI.js +0 -33
- package/dist/assets/InputDoc-BK-SdpJ7.js +0 -211
- package/dist/assets/LabelDoc-DHvgzhaJ.js +0 -42
- package/dist/assets/LeadershipDoc-DRiB0spL.js +0 -416
- package/dist/assets/MediaDoc-B_vqnf72.js +0 -459
- package/dist/assets/MenubarDoc-Zvgczxe2.js +0 -165
- package/dist/assets/ModuleAccessDoc-Nuxb4S27.js +0 -153
- package/dist/assets/ModulesDialogDoc-iJWLkOZo.js +0 -46
- package/dist/assets/NavigationMenuDoc-CeWun1VF.js +0 -116
- package/dist/assets/OnboardingDialogDoc-xBL-rXeZ.js +0 -55
- package/dist/assets/PaginationDoc-CfvwxCMe.js +0 -98
- package/dist/assets/PaginationDoc-DqtRgXnF.js +0 -27
- package/dist/assets/PlacesDoc-nckioEzg.js +0 -226
- package/dist/assets/PopoverDoc-C3o2CZCT.js +0 -64
- package/dist/assets/ProgressDoc-BmWBNMPA.js +0 -29
- package/dist/assets/QualiexUserFieldDoc-CE1e4mx6.js +0 -149
- package/dist/assets/RadioGroupDoc-DMZH6NmR.js +0 -57
- package/dist/assets/RadiusDoc-BOZD3gPV.js +0 -7
- package/dist/assets/RequiredFieldsCounterDoc-CG-lmSSy.js +0 -58
- package/dist/assets/ResizableDoc-CqGkv6Cd.js +0 -104
- package/dist/assets/RichTextEditorDoc-m50ll-Od.js +0 -24
- package/dist/assets/ScrollAreaDoc-BzJ-APXo.js +0 -28
- package/dist/assets/SecurityDoc-B34gVeiV.js +0 -204
- package/dist/assets/SelectDoc-DXRv7QHK.js +0 -80
- package/dist/assets/SeparatorDoc-DcNh8k0P.js +0 -4
- package/dist/assets/ServicesDoc-8aXBd6yg.js +0 -308
- package/dist/assets/ShadowsDoc-Brl4hIDI.js +0 -9
- package/dist/assets/SignDoc-BdwerR-2.js +0 -66
- package/dist/assets/SkeletonDoc-BWgqgbDY.js +0 -54
- package/dist/assets/SliderDoc-E-NjbYVk.js +0 -41
- package/dist/assets/SpacingDoc-BzburM-r.js +0 -12
- package/dist/assets/SplitButtonDoc-BYUysmJp.js +0 -53
- package/dist/assets/StepSelectorDoc-PB1k4v7F.js +0 -41
- package/dist/assets/SwitchDoc-BLOG6kfj.js +0 -56
- package/dist/assets/TableDoc-Dwcs-lop.js +0 -128
- package/dist/assets/TabsDoc-Ovkh8ArV.js +0 -42
- package/dist/assets/TextareaDoc-DsBYxmbr.js +0 -46
- package/dist/assets/ToastDoc-BbZaFE_A.js +0 -157
- package/dist/assets/ToggleDoc-C28vbvhp.js +0 -51
- package/dist/assets/TooltipDoc-DL5cnLak.js +0 -58
- package/dist/assets/TruncatedCellDoc-BuDA8QcY.js +0 -12
- package/dist/assets/TypographyFoundationDoc-CPdH4PHa.js +0 -7
- package/dist/assets/UtilitiesDoc-CrQhyEfz.js +0 -145
- package/dist/assets/blocks-DO93nPjs.js +0 -1
- package/dist/assets/calendar-days-cMfwBSZx.js +0 -1
- package/dist/assets/circle-plus-D3NftMzS.js +0 -1
- package/dist/assets/circle-x-BVAVJ_oz.js +0 -1
- package/dist/assets/crown-B2MTZDnM.js +0 -1
- package/dist/assets/date-picker-zhJU-_kM.js +0 -1
- package/dist/assets/disabled-menu-item-C16xsaVs.js +0 -1
- package/dist/assets/drawer-oTqCOtsC.js +0 -3
- package/dist/assets/file-pen-line-CXv-Eye-.js +0 -1
- package/dist/assets/git-branch-V6-h6P9K.js +0 -1
- package/dist/assets/globe-CaUBIJU8.js +0 -1
- package/dist/assets/hash-B4MTXppl.js +0 -1
- package/dist/assets/hover-card-DEuucfxP.js +0 -1
- package/dist/assets/index-CE0k7Rdh.js +0 -312
- package/dist/assets/index-Cx3adT_u.css +0 -1
- package/dist/assets/life-buoy-BRndExxh.js +0 -1
- package/dist/assets/lucide-react-t7dCa4lv.js +0 -1
- package/dist/assets/monitor-Dg3HKTSE.js +0 -1
- package/dist/assets/package-3G45ARQh.js +0 -1
- package/dist/assets/pen-BYSSwjK4.js +0 -1
- package/dist/assets/pin-CMYagNhs.js +0 -1
- package/dist/assets/radio-group-BVun_Tmt.js +0 -1
- package/dist/assets/server-p0Sb0mKI.js +0 -1
- package/dist/assets/share-2-D-ZhCCq2.js +0 -1
- package/dist/assets/shield-x-Q7hAXWsG.js +0 -1
- package/dist/assets/step-selector-DHxgT2FL.js +0 -1
- package/dist/assets/text-align-start-6aYQqbX4.js +0 -1
- package/dist/assets/trash-DveAOiLF.js +0 -1
- package/dist/assets/useMockCrud-GY0KxHXr.js +0 -1
- package/dist/assets/user-check-CoGNBfIk.js +0 -1
- package/dist/assets/user-plus-Bad2xWIT.js +0 -1
- package/dist/index.html +0 -35
- package/dist/leadership/components/LeaderRow.d.ts +0 -9
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import{j as e,aN as b,ar as T,at as O,au as S,av as j,l as p,aw as k,ax as L,a7 as D,h as N,cf as m,r as C,d$ as M,e0 as R,f as o,e1 as B,e2 as I,e3 as z,bU as P,M as U}from"./index-CE0k7Rdh.js";import{C as q}from"./ComponentDocTemplate-CRbRY-v5.js";import{H as _,a as H,b as F}from"./hover-card-DEuucfxP.js";import{U as y}from"./user-plus-Bad2xWIT.js";function A({item:a,level:r,columns:n,nameKey:l,iconComponent:c,expandedIds:u,onToggleExpand:d,onRowClick:t,renderActions:i,rowActionsVariant:h="default"}){const x=u.has(a.id),g=(a.children?.length??0)>0,f=r*24,v=h==="inline";return e.jsxs(e.Fragment,{children:[e.jsxs(S,{className:p(t&&"cursor-pointer",v&&"group"),onClick:t?()=>t(a):void 0,children:[e.jsx(L,{children:e.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${f}px`},children:[g?e.jsx("button",{onClick:s=>{s.stopPropagation(),d(a.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:x?e.jsx(D,{className:"h-4 w-4"}):e.jsx(N,{className:"h-4 w-4"})}):e.jsx("div",{className:"w-6 shrink-0"}),c??e.jsx(b,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("span",{className:"font-medium truncate",children:String(a[l]??a.id)})]})}),n.map(s=>{const w=a[s.key],E=s.render?s.render(a,r):w!=null?String(w):"—";return e.jsx(L,{className:p("text-center",s.className),children:s.hoverContent?e.jsxs(_,{openDelay:200,children:[e.jsx(H,{asChild:!0,children:e.jsx("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:E})}),e.jsx(F,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:s.hoverContent(a)})]}):E},String(s.key))}),i&&e.jsx(L,{className:"text-right",children:e.jsx("div",{onClick:s=>s.stopPropagation(),className:p("flex items-center justify-end gap-1",v&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:i(a)})})]}),g&&x&&a.children.map(s=>e.jsx(A,{item:s,level:r+1,columns:n,nameKey:l,iconComponent:c,expandedIds:u,onToggleExpand:d,onRowClick:t,renderActions:i,rowActionsVariant:h},s.id))]})}function Q({data:a,columns:r,nameKey:n,nameHeader:l="Nome",iconComponent:c,expandedIds:u,onToggleExpand:d,onRowClick:t,renderActions:i,actionsHeader:h="Ações",rowActionsVariant:x="default",isLoading:g,emptyMessage:f="Nenhum registro encontrado.",className:v}){return g?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})}):!a||a.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[e.jsx(b,{className:"h-10 w-10 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:f})]}):e.jsx("div",{className:p("border rounded-lg overflow-hidden",v),children:e.jsxs(T,{children:[e.jsx(O,{children:e.jsxs(S,{children:[e.jsx(j,{className:"text-left",children:l}),r.map(s=>e.jsx(j,{className:p("text-center",s.className),style:s.width?{width:s.width}:void 0,children:s.header},String(s.key))),i&&e.jsx(j,{className:"text-right",children:h})]})}),e.jsx(k,{children:a.map(s=>e.jsx(A,{item:s,level:0,columns:r,nameKey:n,iconComponent:c,expandedIds:u,onToggleExpand:d,onRowClick:t,renderActions:i,rowActionsVariant:x},s.id))})]})})}function te(){return e.jsx(q,{title:"Leadership",description:"Módulo hierárquico de liderança para gerenciar relações de liderança entre usuários do Qualiex. Inclui componentes visuais, hooks de API e utilitários para construção de árvores hierárquicas.",installation:`import {
|
|
2
|
-
LeadershipPage,
|
|
3
|
-
LeadershipDialog,
|
|
4
|
-
LeadershipForm,
|
|
5
|
-
LeaderRow,
|
|
6
|
-
useLeadershipApi,
|
|
7
|
-
useLeadershipMutations,
|
|
8
|
-
buildHierarchy,
|
|
9
|
-
flattenTree
|
|
10
|
-
} from 'forlogic-core';`,component:e.jsx($,{}),usage:`// Página completa de liderança
|
|
11
|
-
import { LeadershipPage } from 'forlogic-core';
|
|
12
|
-
|
|
13
|
-
function MyLeadershipPage() {
|
|
14
|
-
return <LeadershipPage />;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Ou use componentes individuais
|
|
18
|
-
import {
|
|
19
|
-
LeadershipDialog,
|
|
20
|
-
useLeadershipApi
|
|
21
|
-
} from 'forlogic-core';
|
|
22
|
-
|
|
23
|
-
function CustomLeadershipView() {
|
|
24
|
-
const { data: leaders, isLoading } = useLeadershipApi();
|
|
25
|
-
const [dialogOpen, setDialogOpen] = useState(false);
|
|
26
|
-
|
|
27
|
-
if (isLoading) return <div>Carregando...</div>;
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div>
|
|
31
|
-
<Button onClick={() => setDialogOpen(true)}>
|
|
32
|
-
Adicionar Líder
|
|
33
|
-
</Button>
|
|
34
|
-
|
|
35
|
-
<LeadershipDialog
|
|
36
|
-
open={dialogOpen}
|
|
37
|
-
onOpenChange={setDialogOpen}
|
|
38
|
-
title="Novo Líder"
|
|
39
|
-
/>
|
|
40
|
-
|
|
41
|
-
{/* Renderizar hierarquia */}
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}`,examples:[{title:"Estrutura de Tipos",description:"Tipos principais usados no módulo de liderança.",preview:e.jsx(G,{}),code:`// Tipos principais
|
|
45
|
-
interface Leader {
|
|
46
|
-
id: string;
|
|
47
|
-
alias: string;
|
|
48
|
-
id_user: string; // ID do usuário no Qualiex
|
|
49
|
-
id_leader: string | null; // ID do líder superior (null = raiz)
|
|
50
|
-
is_removed: boolean;
|
|
51
|
-
is_active: boolean;
|
|
52
|
-
created_at: string;
|
|
53
|
-
updated_at: string;
|
|
54
|
-
|
|
55
|
-
// Campos enriquecidos do Qualiex (virtuais)
|
|
56
|
-
name?: string;
|
|
57
|
-
email?: string;
|
|
58
|
-
subordinatesCount?: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
interface LeaderNode extends Leader {
|
|
62
|
-
children: LeaderNode[]; // Subordinados diretos
|
|
63
|
-
level: number; // Nível na hierarquia (0 = raiz)
|
|
64
|
-
}`},{title:"Hook useLeadershipApi",description:"Hook para buscar a hierarquia de liderança com dados enriquecidos do Qualiex.",preview:e.jsx(V,{}),code:`import { useLeadershipApi, flattenTree } from 'forlogic-core';
|
|
65
|
-
|
|
66
|
-
function LeadersList() {
|
|
67
|
-
const {
|
|
68
|
-
data: leaders = [], // LeaderNode[] - árvore hierárquica
|
|
69
|
-
isLoading,
|
|
70
|
-
error
|
|
71
|
-
} = useLeadershipApi();
|
|
72
|
-
|
|
73
|
-
if (isLoading) return <div>Carregando...</div>;
|
|
74
|
-
if (error) return <div>Erro: {error.message}</div>;
|
|
75
|
-
|
|
76
|
-
// Achatar a árvore para iteração simples
|
|
77
|
-
const allLeaders = flattenTree(leaders);
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<ul>
|
|
81
|
-
{allLeaders.map(leader => (
|
|
82
|
-
<li key={leader.id} style={{ marginLeft: leader.level * 20 }}>
|
|
83
|
-
{leader.name} ({leader.subordinatesCount} subordinados)
|
|
84
|
-
</li>
|
|
85
|
-
))}
|
|
86
|
-
</ul>
|
|
87
|
-
);
|
|
88
|
-
}`},{title:"LeadershipDialog",description:"Dialog modal para adicionar ou editar um líder.",preview:e.jsx(J,{}),code:`import { useState } from 'react';
|
|
89
|
-
import { LeadershipDialog, Button } from 'forlogic-core';
|
|
90
|
-
|
|
91
|
-
function AddLeaderButton() {
|
|
92
|
-
const [open, setOpen] = useState(false);
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<>
|
|
96
|
-
<Button onClick={() => setOpen(true)}>
|
|
97
|
-
Adicionar Líder
|
|
98
|
-
</Button>
|
|
99
|
-
|
|
100
|
-
<LeadershipDialog
|
|
101
|
-
open={open}
|
|
102
|
-
onOpenChange={setOpen}
|
|
103
|
-
title="Novo Líder"
|
|
104
|
-
// Opcional: pré-selecionar um líder superior
|
|
105
|
-
prefilledLeaderId="user-uuid-do-lider"
|
|
106
|
-
/>
|
|
107
|
-
</>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Editando um líder existente
|
|
112
|
-
function EditLeaderButton({ leader }) {
|
|
113
|
-
const [open, setOpen] = useState(false);
|
|
114
|
-
|
|
115
|
-
return (
|
|
116
|
-
<>
|
|
117
|
-
<Button variant="outline" onClick={() => setOpen(true)}>
|
|
118
|
-
Editar
|
|
119
|
-
</Button>
|
|
120
|
-
|
|
121
|
-
<LeadershipDialog
|
|
122
|
-
open={open}
|
|
123
|
-
onOpenChange={setOpen}
|
|
124
|
-
leader={leader} // Passa o líder para edição
|
|
125
|
-
title="Editar Líder"
|
|
126
|
-
/>
|
|
127
|
-
</>
|
|
128
|
-
);
|
|
129
|
-
}`},{title:"Mutations (useLeadershipMutations)",description:"Hooks de mutação para criar, atualizar e remover líderes.",preview:e.jsx(W,{}),code:`import {
|
|
130
|
-
useCreateMultipleLeadersMutation,
|
|
131
|
-
useUpdateLeaderMutation,
|
|
132
|
-
useRemoveLeaderMutation,
|
|
133
|
-
useSyncSubordinatesMutation
|
|
134
|
-
} from 'forlogic-core';
|
|
135
|
-
|
|
136
|
-
function LeaderActions() {
|
|
137
|
-
// Criar múltiplos liderados de uma vez
|
|
138
|
-
const createMultiple = useCreateMultipleLeadersMutation();
|
|
139
|
-
|
|
140
|
-
// Atualizar líder existente
|
|
141
|
-
const updateLeader = useUpdateLeaderMutation();
|
|
142
|
-
|
|
143
|
-
// Remover líder (soft delete)
|
|
144
|
-
const removeLeader = useRemoveLeaderMutation();
|
|
145
|
-
|
|
146
|
-
// Sincronizar subordinados de um líder
|
|
147
|
-
const syncSubordinates = useSyncSubordinatesMutation();
|
|
148
|
-
|
|
149
|
-
const handleCreateMultiple = async () => {
|
|
150
|
-
await createMultiple.mutateAsync({
|
|
151
|
-
id_leader: 'uuid-do-lider-superior', // null para raiz
|
|
152
|
-
users: [
|
|
153
|
-
{ id_user: 'uuid-usuario-1' },
|
|
154
|
-
{ id_user: 'uuid-usuario-2' }
|
|
155
|
-
]
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const handleUpdate = async () => {
|
|
160
|
-
await updateLeader.mutateAsync({
|
|
161
|
-
id: 'uuid-do-registro-leader',
|
|
162
|
-
id_leader: 'novo-uuid-lider-superior'
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const handleRemove = async () => {
|
|
167
|
-
await removeLeader.mutateAsync('uuid-do-registro-leader');
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const handleSync = async () => {
|
|
171
|
-
await syncSubordinates.mutateAsync({
|
|
172
|
-
leaderUserId: 'uuid-do-lider',
|
|
173
|
-
selectedUsers: [
|
|
174
|
-
{ id_user: 'uuid-subordinado-1' },
|
|
175
|
-
{ id_user: 'uuid-subordinado-2' }
|
|
176
|
-
]
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<div className="space-x-2">
|
|
182
|
-
<Button onClick={handleCreateMultiple}>Criar Múltiplos</Button>
|
|
183
|
-
<Button onClick={handleUpdate}>Atualizar</Button>
|
|
184
|
-
<Button onClick={handleRemove} variant="destructive">Remover</Button>
|
|
185
|
-
<Button onClick={handleSync}>Sincronizar</Button>
|
|
186
|
-
</div>
|
|
187
|
-
);
|
|
188
|
-
}`},{title:"Utilitários (buildHierarchy, flattenTree)",description:"Funções utilitárias para manipular a estrutura hierárquica.",preview:e.jsx(K,{}),code:`import { buildHierarchy, flattenTree } from 'forlogic-core';
|
|
189
|
-
|
|
190
|
-
// buildHierarchy: Converte lista plana em árvore
|
|
191
|
-
const leaders = [
|
|
192
|
-
{ id: '1', id_user: 'user-a', id_leader: null, name: 'CEO' },
|
|
193
|
-
{ id: '2', id_user: 'user-b', id_leader: 'user-a', name: 'Diretor' },
|
|
194
|
-
{ id: '3', id_user: 'user-c', id_leader: 'user-b', name: 'Gerente' }
|
|
195
|
-
];
|
|
196
|
-
|
|
197
|
-
const tree = buildHierarchy(leaders);
|
|
198
|
-
// Resultado:
|
|
199
|
-
// [{
|
|
200
|
-
// id: '1', name: 'CEO', level: 0, children: [
|
|
201
|
-
// { id: '2', name: 'Diretor', level: 1, children: [
|
|
202
|
-
// { id: '3', name: 'Gerente', level: 2, children: [] }
|
|
203
|
-
// ]}
|
|
204
|
-
// ]
|
|
205
|
-
// }]
|
|
206
|
-
|
|
207
|
-
// flattenTree: Achata árvore para lista
|
|
208
|
-
const flatList = flattenTree(tree);
|
|
209
|
-
// Resultado: [CEO, Diretor, Gerente] com níveis preservados
|
|
210
|
-
|
|
211
|
-
// Uso comum: iterar mantendo indentação visual
|
|
212
|
-
flatList.forEach(node => {
|
|
213
|
-
const indent = ' '.repeat(node.level);
|
|
214
|
-
console.log(\`\${indent}\${node.name}\`);
|
|
215
|
-
});`},{title:"LeaderRow (Componente de Linha)",description:"Componente de linha expansível para tabelas de liderança.",preview:e.jsx(X,{}),code:`import { useState } from 'react';
|
|
216
|
-
import { LeaderRow, useLeadershipApi } from 'forlogic-core';
|
|
217
|
-
|
|
218
|
-
function LeadersTable() {
|
|
219
|
-
const { data: leaders = [] } = useLeadershipApi();
|
|
220
|
-
const [expandedIds, setExpandedIds] = useState<Set<string>>(new Set());
|
|
221
|
-
|
|
222
|
-
const handleToggleExpand = (id: string) => {
|
|
223
|
-
setExpandedIds(prev => {
|
|
224
|
-
const next = new Set(prev);
|
|
225
|
-
if (next.has(id)) {
|
|
226
|
-
next.delete(id);
|
|
227
|
-
} else {
|
|
228
|
-
next.add(id);
|
|
229
|
-
}
|
|
230
|
-
return next;
|
|
231
|
-
});
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
const handleEdit = (leader) => {
|
|
235
|
-
console.log('Editar:', leader);
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
return (
|
|
239
|
-
<table className="w-full">
|
|
240
|
-
<thead>
|
|
241
|
-
<tr>
|
|
242
|
-
<th>Nome</th>
|
|
243
|
-
<th>Subordinados</th>
|
|
244
|
-
</tr>
|
|
245
|
-
</thead>
|
|
246
|
-
<tbody>
|
|
247
|
-
{leaders.map(leader => (
|
|
248
|
-
<LeaderRow
|
|
249
|
-
key={leader.id}
|
|
250
|
-
leader={leader}
|
|
251
|
-
expandedIds={expandedIds}
|
|
252
|
-
onToggleExpand={handleToggleExpand}
|
|
253
|
-
onEdit={handleEdit}
|
|
254
|
-
/>
|
|
255
|
-
))}
|
|
256
|
-
</tbody>
|
|
257
|
-
</table>
|
|
258
|
-
);
|
|
259
|
-
}`},{title:"Página Completa (LeadershipPage)",description:"Componente de página completa com todas as funcionalidades integradas.",preview:e.jsx(Y,{}),code:`import { LeadershipPage } from 'forlogic-core';
|
|
260
|
-
|
|
261
|
-
// Uso simples - página completa pronta
|
|
262
|
-
function MyApp() {
|
|
263
|
-
return (
|
|
264
|
-
<Routes>
|
|
265
|
-
<Route path="/leadership" element={<LeadershipPage />} />
|
|
266
|
-
</Routes>
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// A LeadershipPage inclui:
|
|
271
|
-
// - Botão "Adicionar Líder"
|
|
272
|
-
// - Botões "Expandir/Colapsar Todos"
|
|
273
|
-
// - Tabela hierárquica com LeaderRow
|
|
274
|
-
// - LeadershipDialog para criar/editar
|
|
275
|
-
// - Contadores de usuários associados/não associados
|
|
276
|
-
// - Persistência do estado de expansão no localStorage`},{title:"Exemplo Completo Integrado",description:"Implementação customizada com todos os recursos do módulo de liderança.",preview:e.jsx(ee,{}),code:`import { useState, useMemo } from 'react';
|
|
277
|
-
import {
|
|
278
|
-
useLeadershipApi,
|
|
279
|
-
useRemoveLeaderMutation,
|
|
280
|
-
LeadershipDialog,
|
|
281
|
-
LeaderRow,
|
|
282
|
-
flattenTree,
|
|
283
|
-
Button,
|
|
284
|
-
Card,
|
|
285
|
-
toast
|
|
286
|
-
} from 'forlogic-core';
|
|
287
|
-
import { Users, UserPlus, ChevronDown, ChevronUp, Trash2 } from 'lucide-react';
|
|
288
|
-
|
|
289
|
-
function CustomLeadershipPage() {
|
|
290
|
-
const { data: leaders = [], isLoading, error } = useLeadershipApi();
|
|
291
|
-
const removeLeader = useRemoveLeaderMutation();
|
|
292
|
-
|
|
293
|
-
const [dialogOpen, setDialogOpen] = useState(false);
|
|
294
|
-
const [editingLeader, setEditingLeader] = useState<Leader | null>(null);
|
|
295
|
-
const [expandedIds, setExpandedIds] = useState<Set<string>>(new Set());
|
|
296
|
-
|
|
297
|
-
// Achatar árvore para estatísticas
|
|
298
|
-
const flatList = useMemo(() => flattenTree(leaders), [leaders]);
|
|
299
|
-
const totalLeaders = flatList.length;
|
|
300
|
-
const rootLeaders = leaders.length;
|
|
301
|
-
|
|
302
|
-
// Handlers
|
|
303
|
-
const handleToggleExpand = (id: string) => {
|
|
304
|
-
setExpandedIds(prev => {
|
|
305
|
-
const next = new Set(prev);
|
|
306
|
-
next.has(id) ? next.delete(id) : next.add(id);
|
|
307
|
-
return next;
|
|
308
|
-
});
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
const handleExpandAll = () => {
|
|
312
|
-
setExpandedIds(new Set(flatList.map(l => l.id)));
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
const handleCollapseAll = () => {
|
|
316
|
-
setExpandedIds(new Set());
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
const handleEdit = (leader: Leader) => {
|
|
320
|
-
setEditingLeader(leader);
|
|
321
|
-
setDialogOpen(true);
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
const handleAdd = () => {
|
|
325
|
-
setEditingLeader(null);
|
|
326
|
-
setDialogOpen(true);
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
const handleRemove = async (leader: Leader) => {
|
|
330
|
-
try {
|
|
331
|
-
await removeLeader.mutateAsync(leader.id);
|
|
332
|
-
toast.success(\`\${leader.name} removido com sucesso\`);
|
|
333
|
-
} catch (error) {
|
|
334
|
-
toast.error('Erro ao remover líder');
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
const handleDialogClose = () => {
|
|
339
|
-
setDialogOpen(false);
|
|
340
|
-
setEditingLeader(null);
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
if (isLoading) return <div>Carregando hierarquia...</div>;
|
|
344
|
-
if (error) return <div>Erro: {error.message}</div>;
|
|
345
|
-
|
|
346
|
-
return (
|
|
347
|
-
<div className="space-y-6">
|
|
348
|
-
{/* Header com estatísticas e ações */}
|
|
349
|
-
<div className="flex items-center justify-between">
|
|
350
|
-
<div>
|
|
351
|
-
<h1 className="text-2xl font-bold">Hierarquia de Liderança</h1>
|
|
352
|
-
<p className="text-muted-foreground">
|
|
353
|
-
{totalLeaders} líderes • {rootLeaders} níveis raiz
|
|
354
|
-
</p>
|
|
355
|
-
</div>
|
|
356
|
-
|
|
357
|
-
<div className="flex gap-2">
|
|
358
|
-
<Button variant="outline" size="sm" onClick={handleExpandAll}>
|
|
359
|
-
<ChevronDown className="h-4 w-4 mr-1" />
|
|
360
|
-
Expandir
|
|
361
|
-
</Button>
|
|
362
|
-
<Button variant="outline" size="sm" onClick={handleCollapseAll}>
|
|
363
|
-
<ChevronUp className="h-4 w-4 mr-1" />
|
|
364
|
-
Colapsar
|
|
365
|
-
</Button>
|
|
366
|
-
<Button onClick={handleAdd}>
|
|
367
|
-
<UserPlus className="h-4 w-4 mr-1" />
|
|
368
|
-
Adicionar Líder
|
|
369
|
-
</Button>
|
|
370
|
-
</div>
|
|
371
|
-
</div>
|
|
372
|
-
|
|
373
|
-
{/* Tabela hierárquica */}
|
|
374
|
-
<Card>
|
|
375
|
-
<table className="w-full">
|
|
376
|
-
<thead className="bg-muted/50">
|
|
377
|
-
<tr>
|
|
378
|
-
<th className="text-left p-4">Líder</th>
|
|
379
|
-
<th className="text-center p-4">Subordinados</th>
|
|
380
|
-
<th className="text-right p-4">Ações</th>
|
|
381
|
-
</tr>
|
|
382
|
-
</thead>
|
|
383
|
-
<tbody>
|
|
384
|
-
{leaders.map(leader => (
|
|
385
|
-
<LeaderRow
|
|
386
|
-
key={leader.id}
|
|
387
|
-
leader={leader}
|
|
388
|
-
expandedIds={expandedIds}
|
|
389
|
-
onToggleExpand={handleToggleExpand}
|
|
390
|
-
onEdit={handleEdit}
|
|
391
|
-
// Ação extra de remoção
|
|
392
|
-
actions={
|
|
393
|
-
<Button
|
|
394
|
-
variant="ghost"
|
|
395
|
-
size="sm"
|
|
396
|
-
onClick={() => handleRemove(leader)}
|
|
397
|
-
>
|
|
398
|
-
<Trash2 className="h-4 w-4 text-destructive" />
|
|
399
|
-
</Button>
|
|
400
|
-
}
|
|
401
|
-
/>
|
|
402
|
-
))}
|
|
403
|
-
</tbody>
|
|
404
|
-
</table>
|
|
405
|
-
</Card>
|
|
406
|
-
|
|
407
|
-
{/* Dialog para criar/editar */}
|
|
408
|
-
<LeadershipDialog
|
|
409
|
-
open={dialogOpen}
|
|
410
|
-
onOpenChange={handleDialogClose}
|
|
411
|
-
leader={editingLeader}
|
|
412
|
-
title={editingLeader ? 'Editar Líder' : 'Novo Líder'}
|
|
413
|
-
/>
|
|
414
|
-
</div>
|
|
415
|
-
);
|
|
416
|
-
}`}],props:[{name:"LeadershipDialog.open",type:"boolean",description:"Controla a visibilidade do dialog."},{name:"LeadershipDialog.onOpenChange",type:"(open: boolean) => void",description:"Callback quando o estado de abertura muda."},{name:"LeadershipDialog.leader",type:"Leader",description:"Líder a ser editado (se não fornecido, cria novo)."},{name:"LeadershipDialog.prefilledLeaderId",type:"string | null",description:"ID do líder superior pré-selecionado (para criação)."},{name:"LeadershipDialog.title",type:"string",description:"Título do dialog."},{name:"LeaderRow.leader",type:"LeaderNode",description:"Nó do líder a ser renderizado."},{name:"LeaderRow.expandedIds",type:"Set<string>",description:"IDs dos nós atualmente expandidos."},{name:"LeaderRow.onToggleExpand",type:"(id: string) => void",description:"Callback para alternar expansão de um nó."},{name:"LeaderRow.onEdit",type:"(leader: Leader) => void",description:"Callback quando o nome do líder é clicado."},{name:"LeadershipForm.leader",type:"Leader",description:"Líder a ser editado (modo edição)."},{name:"LeadershipForm.prefilledLeaderId",type:"string | null",description:"ID do líder superior pré-selecionado."},{name:"LeadershipForm.onSuccess",type:"() => void",description:"Callback executado após salvar com sucesso."}],accessibility:["Os botões de expandir/colapsar são acessíveis via teclado.",'Os nomes clicáveis têm role="button" implícito.',"O dialog segue padrões WAI-ARIA para modais.","Checkboxes de seleção de usuários são navegáveis via Tab.","Estados de loading são anunciados para leitores de tela."],notes:["O módulo requer autenticação ativa (useAuth) e integração com Qualiex.","Os dados são enriquecidos automaticamente com nomes/emails do Qualiex.",'Líderes "virtuais" são criados automaticamente para referências não cadastradas.',"Validação de ciclos na hierarquia é feita automaticamente.","O estado de expansão é persistido no localStorage por alias.","Soft delete é usado para remoção (is_removed = true)."]})}function $(){return e.jsxs("div",{className:"p-6 border rounded-lg bg-card space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-6 w-6 text-primary"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Módulo de Liderança"})]}),e.jsx("p",{className:"text-muted-foreground",children:"Sistema completo para gerenciar hierarquias de liderança, incluindo:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm",children:[e.jsx("li",{children:"Visualização em árvore hierárquica"}),e.jsx("li",{children:"Criação e edição de líderes"}),e.jsx("li",{children:"Seleção múltipla de subordinados"}),e.jsx("li",{children:"Validação automática de ciclos"}),e.jsx("li",{children:"Integração com usuários do Qualiex"})]})]})}function G(){return e.jsxs("div",{className:"p-4 border rounded-lg bg-muted/30 font-mono text-xs space-y-2",children:[e.jsx("div",{className:"text-primary",children:"Leader"}),e.jsx("div",{className:"pl-4 text-muted-foreground",children:"id, alias, id_user, id_leader, is_removed, is_active"}),e.jsx("div",{className:"text-primary",children:"LeaderNode extends Leader"}),e.jsx("div",{className:"pl-4 text-muted-foreground",children:"children: LeaderNode[], level: number"})]})}function V(){const a=[{name:"CEO",level:0,subordinatesCount:2},{name:"Diretor A",level:1,subordinatesCount:3},{name:"Diretor B",level:1,subordinatesCount:1}];return e.jsxs("div",{className:"p-4 border rounded-lg space-y-2",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Resultado do useLeadershipApi:"}),a.map((r,n)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{paddingLeft:r.level*16},children:[e.jsx(m,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:r.name}),e.jsxs("span",{className:"text-muted-foreground",children:["(",r.subordinatesCount," subordinados)"]})]},n))]})}function J(){const[a,r]=C.useState(!1);return e.jsx("div",{className:"p-4 border rounded-lg",children:e.jsxs(M,{open:a,onOpenChange:r,children:[e.jsx(R,{asChild:!0,children:e.jsxs(o,{children:[e.jsx(y,{className:"h-4 w-4 mr-2"}),"Adicionar Líder"]})}),e.jsxs(B,{children:[e.jsx(I,{children:e.jsx(z,{children:"Novo Líder"})}),e.jsx("div",{className:"py-4 text-center text-muted-foreground",children:"[LeadershipForm seria renderizado aqui]"})]})]})})}function W(){return e.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Mutations disponíveis:"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx("div",{className:"p-2 bg-muted/50 rounded",children:"useCreateMultipleLeadersMutation"}),e.jsx("div",{className:"p-2 bg-muted/50 rounded",children:"useUpdateLeaderMutation"}),e.jsx("div",{className:"p-2 bg-muted/50 rounded",children:"useRemoveLeaderMutation"}),e.jsx("div",{className:"p-2 bg-muted/50 rounded",children:"useSyncSubordinatesMutation"})]})]})}function K(){const a=[{name:"CEO",level:0},{name:"├── Diretor",level:1},{name:"│ └── Gerente",level:2}];return e.jsxs("div",{className:"p-4 border rounded-lg font-mono text-sm space-y-1",children:[e.jsx("div",{className:"text-muted-foreground mb-2",children:"buildHierarchy → flattenTree:"}),a.map((r,n)=>e.jsx("div",{children:r.name},n))]})}function X(){const[a,r]=C.useState(!0);return e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-3",children:"Nome"}),e.jsx("th",{className:"text-center p-3",children:"Subordinados"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-t hover:bg-muted/30",children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>r(!a),className:"p-1 hover:bg-accent rounded",children:a?e.jsx(D,{className:"h-4 w-4"}):e.jsx(N,{className:"h-4 w-4"})}),e.jsx(m,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium hover:text-primary cursor-pointer",children:"CEO"})]})}),e.jsx("td",{className:"text-center p-3",children:"2"})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"border-t hover:bg-muted/30",children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:32},children:[e.jsx("button",{className:"p-1 hover:bg-accent rounded",children:e.jsx(N,{className:"h-4 w-4"})}),e.jsx(m,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium hover:text-primary cursor-pointer",children:"Diretor A"})]})}),e.jsx("td",{className:"text-center p-3",children:"3"})]}),e.jsxs("tr",{className:"border-t hover:bg-muted/30",children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:32},children:[e.jsx("div",{className:"w-6"}),e.jsx(m,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium hover:text-primary cursor-pointer",children:"Diretor B"})]})}),e.jsx("td",{className:"text-center p-3",children:"0"})]})]})]})]})})}function Y(){return e.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-medium",children:"LeadershipPage"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o,{size:"sm",variant:"outline",children:"Expandir Todos"}),e.jsxs(o,{size:"sm",children:[e.jsx(y,{className:"h-4 w-4 mr-1"}),"Adicionar"]})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Inclui tabela hierárquica, dialog de edição, contadores e persistência"})]})}const Z=[{id:"1",name:"Maria Silva (CEO)",email:"maria@empresa.com",subordinatesCount:2,subordinateNames:["João Souza","Ana Costa"],children:[{id:"2",name:"João Souza",email:"joao@empresa.com",subordinatesCount:3,subordinateNames:["Carlos Lima","Fernanda Dias","Ricardo Alves"],children:[{id:"4",name:"Carlos Lima",email:"carlos@empresa.com",subordinatesCount:0,subordinateNames:[],children:[]},{id:"5",name:"Fernanda Dias",email:"fernanda@empresa.com",subordinatesCount:2,subordinateNames:["Paula Rocha","Bruno Santos"],children:[]}]},{id:"3",name:"Ana Costa",email:"ana@empresa.com",subordinatesCount:1,subordinateNames:["Marcos Oliveira"],children:[]}]}];function ee(){const[a,r]=C.useState(new Set(["1","2"])),n=d=>{r(t=>{const i=new Set(t);return i.has(d)?i.delete(d):i.add(d),i})},l=()=>{r(new Set(["1","2","3","4","5"]))},c=()=>{r(new Set)},u=[{key:"subordinatesCount",header:"Subordinados",hoverContent:d=>d.subordinateNames.length>0?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Subordinados diretos:"}),d.subordinateNames.map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{children:t})]},t))]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sem subordinados diretos"})},{key:"email",header:"Email",className:"text-left",render:d=>e.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground text-sm",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),d.email]})}];return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Hierarquia de Liderança"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"5 líderes • 1 nível raiz"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o,{size:"sm",variant:"outline",onClick:l,children:"Expandir"}),e.jsx(o,{size:"sm",variant:"outline",onClick:c,children:"Colapsar"}),e.jsxs(o,{size:"sm",children:[e.jsx(y,{className:"h-4 w-4 mr-1"}),"Adicionar"]})]})]}),e.jsx(Q,{data:Z,columns:u,nameKey:"name",nameHeader:"Líder",expandedIds:a,onToggleExpand:n,iconComponent:e.jsx(m,{className:"h-4 w-4 text-muted-foreground shrink-0"}),rowActionsVariant:"inline",renderActions:d=>e.jsx(o,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(P,{className:"h-4 w-4"})})}),e.jsxs("div",{className:"px-3 py-2 bg-muted/20 border rounded-lg text-xs text-muted-foreground flex justify-between",children:[e.jsx("span",{children:"Usuários associados: 12"}),e.jsx("span",{children:"Usuários não associados: 5"})]})]})}export{te as LeadershipDoc};
|