@cgi-learning-hub/ui 1.5.0-dev.1743520380 → 1.5.0-dev.1743522751
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/components/TreeView/style.cjs.js +1 -1
- package/dist/components/TreeView/style.es.js +23 -20
- package/dist/components/stories/TreeView.stories.cjs.js +3 -3
- package/dist/components/stories/TreeView.stories.d.ts +1 -0
- package/dist/components/stories/TreeView.stories.es.js +382 -204
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@mui/material"),o="50px",r=t.styled(t.Box,{shouldForwardProp:e=>e!=="maxHeight"})(({maxHeight:e})=>({maxHeight:typeof e=="number"?`${e}px`:e,overflowY:"auto"})),n={
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@mui/material"),o="50px",r=t.styled(t.Box,{shouldForwardProp:e=>e!=="maxHeight"})(({maxHeight:e})=>({maxHeight:typeof e=="number"?`${e}px`:e,overflowY:"auto"})),n={display:"flex",flexDirection:"column"},i={display:"flex",alignItems:"center",width:"100%",margin:"4px 0",padding:"8px"},l={display:"flex",marginLeft:"auto"},a={borderLeft:"1px solid var(--theme-palette-divider)",paddingLeft:"15px",marginLeft:"18px"},d={width:"24px",height:"24px"};exports.DEFAULT_CHILDREN_INDENT=o;exports.TreeContainer=r;exports.arrowContainerStyle=l;exports.expandedGroupStyle=a;exports.iconStyle=d;exports.treeContentStyle=i;exports.treeItemRootStyle=n;
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
import { styled as
|
|
2
|
-
const r = "50px",
|
|
3
|
-
shouldForwardProp: (
|
|
4
|
-
})(({ maxHeight:
|
|
5
|
-
maxHeight: typeof
|
|
1
|
+
import { styled as t, Box as o } from "@mui/material";
|
|
2
|
+
const r = "50px", i = t(o, {
|
|
3
|
+
shouldForwardProp: (e) => e !== "maxHeight"
|
|
4
|
+
})(({ maxHeight: e }) => ({
|
|
5
|
+
maxHeight: typeof e == "number" ? `${e}px` : e,
|
|
6
6
|
overflowY: "auto"
|
|
7
|
-
})),
|
|
7
|
+
})), p = {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "column"
|
|
10
|
+
}, l = {
|
|
8
11
|
display: "flex",
|
|
9
12
|
alignItems: "center",
|
|
10
|
-
width: "100%"
|
|
11
|
-
|
|
13
|
+
width: "100%",
|
|
14
|
+
margin: "4px 0",
|
|
15
|
+
padding: "8px"
|
|
16
|
+
}, a = {
|
|
12
17
|
display: "flex",
|
|
13
18
|
marginLeft: "auto"
|
|
19
|
+
}, d = {
|
|
20
|
+
borderLeft: "1px solid var(--theme-palette-divider)",
|
|
21
|
+
paddingLeft: "15px",
|
|
22
|
+
marginLeft: "18px"
|
|
14
23
|
}, x = {
|
|
15
|
-
borderLeft: "1px solid #bdbdbd",
|
|
16
|
-
paddingLeft: "12px",
|
|
17
|
-
marginLeft: "11px",
|
|
18
|
-
marginTop: "8px",
|
|
19
|
-
marginBottom: "8px"
|
|
20
|
-
}, l = {
|
|
21
24
|
width: "24px",
|
|
22
25
|
height: "24px"
|
|
23
26
|
};
|
|
24
27
|
export {
|
|
25
28
|
r as DEFAULT_CHILDREN_INDENT,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
i as TreeContainer,
|
|
30
|
+
a as arrowContainerStyle,
|
|
31
|
+
d as expandedGroupStyle,
|
|
32
|
+
x as iconStyle,
|
|
33
|
+
l as treeContentStyle,
|
|
34
|
+
p as treeItemRootStyle
|
|
32
35
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),O=require("../../createSvgIcon-DjTQ6UHI.cjs"),N=require("../../IconButton-Czd8uNt8.cjs"),B=require("../../Tooltip-arPEgWU6.cjs"),u=require("react"),h=require("../TreeView/TreeView.cjs.js"),t=require("../TreeView/types.cjs.js"),l=require("../../Box-ge7hyt34.cjs"),a=require("../../Typography-Daq_a9_t.cjs"),m=require("../../ListItemText-Yjh9Zoqh.cjs"),I=require("../../Paper-CRHSfFG5.cjs"),g=require("../../Button-BkHaHEAp.cjs"),P=require("../../Divider-D3QqAaaL.cjs"),L=require("../../List-CBdWJkIa.cjs"),_=require("../../ListItem-B2M8rFxh.cjs"),R=O.createSvgIcon(e.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"}),"Bookmark"),D=O.createSvgIcon(e.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"}),"Description"),V=O.createSvgIcon(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),q=O.createSvgIcon(e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"Person"),F={title:"Components/TreeView",component:h,argTypes:{items:{description:"**[Requis]** Liste des éléments à afficher dans le TreeView.",control:"object",table:{required:!0,type:{summary:"CustomTreeViewItem[]"}}},selectedItemId:{description:"**[Requis]** Identifiant de l'élément sélectionné.",control:"text",table:{required:!0,type:{summary:"string"}}},handleSelectedItemChange:{description:"**[Requis]** Fonction appelée lorsqu'un élément est sélectionné.",table:{required:!0,type:{summary:"(event: React.SyntheticEvent, itemIds: string | null) => void"}}},iconColor:{description:"**[Optionnel]** Couleur des icônes.",control:"select",options:["primary","secondary","success","error","info","warning"],defaultValue:"primary",table:{required:!1,type:{summary:"string"},defaultValue:{summary:"primary"}}},maxHeight:{description:"**[Optionnel]** Hauteur du TreeView avec gestion automatique du défilement.",control:"number",table:{required:!1,type:{summary:"number | string"},defaultValue:{summary:"auto"}}}},parameters:{docs:{description:{component:`
|
|
2
2
|
## TreeView
|
|
3
3
|
|
|
4
4
|
Un composant pour afficher des données hiérarchiques sous forme d'arborescence.
|
|
@@ -47,7 +47,7 @@ interface CustomTreeViewItemProps {
|
|
|
47
47
|
|
|
48
48
|
type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
49
49
|
\`\`\`
|
|
50
|
-
`}}}},D=s=>{const r=[],i=n=>{r.push(n),n.children&&n.children.forEach(t=>i(t))};return s.forEach(n=>i(n)),r},H=({items:s,selectedItemId:r,onItemSelect:i})=>{const n=D(s);return e.jsxs(g.Paper,{sx:{width:"100%",maxHeight:300,overflow:"auto"},children:[e.jsx(a.Typography,{variant:"h6",sx:{p:2},children:"Sélection externe"}),e.jsx(O.Divider,{}),e.jsx(Y.List,{children:n.map(t=>e.jsx(N.ListItem,{disablePadding:!0,children:e.jsx(x.ListItemButton,{selected:r===t.internalId,onClick:()=>i(t.internalId),children:e.jsx(x.ListItemText,{primary:t.label})})},t.internalId))})]})},k=({items:s,onRandomSelect:r})=>{const i=D(s),n=()=>{const t=Math.floor(Math.random()*i.length);r(i[t].internalId)};return e.jsx(l.Box,{sx:{mt:2,mb:2},children:e.jsx(v.Button,{variant:"contained",color:"primary",onClick:n,children:"Sélection aléatoire"})})},A=({id:s,label:r})=>e.jsx(l.Box,{draggable:!0,onDragStart:i=>{i.dataTransfer.setData("application/json",JSON.stringify({id:s,label:r}))},sx:{padding:1,margin:1,backgroundColor:"grey.100",borderRadius:1,display:"inline-block",cursor:"grab","&:hover":{backgroundColor:"grey.200"}},children:e.jsxs(a.Typography,{variant:"body2",display:"flex",alignItems:"center",children:[e.jsx(R,{fontSize:"small",sx:{mr:1}}),r]})}),j=[{internalId:"documents",label:"Mes formulaires",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"folder1",label:"Premier dossier",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"subfolder1",label:"Sous-dossier 1",iconType:o.ICON_TYPE.FOLDER},{internalId:"subfolder2",label:"Sous-dossier 2",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"folder2",label:"Deuxième dossier",iconType:o.ICON_TYPE.FOLDER},{internalId:"folder3",label:"Troisième dossier",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"shared",label:"Formulaires partagés avec moi",iconType:o.ICON_TYPE.SHARE},{internalId:"trash",label:"Corbeille",iconType:o.ICON_TYPE.TRASH}],B=[{internalId:"bookmarks",label:"Favoris",iconType:P,children:[{internalId:"important",label:"Important",iconType:o.ICON_TYPE.CUSTOM,customIcon:_}]},...j],S=[{internalId:"documents",label:"Documents",iconType:o.ICON_TYPE.SHARE,children:[{internalId:"reports",label:"Rapports",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"report1",label:"Rapport Janvier",iconType:o.ICON_TYPE.FOLDER},{internalId:"report2",label:"Rapport Février",iconType:o.ICON_TYPE.FOLDER},{internalId:"report3",label:"Rapport Mars",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"invoices",label:"Factures",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"media",label:"Médias",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"images",label:"Images",iconType:o.ICON_TYPE.FOLDER},{internalId:"videos",label:"Vidéos",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"downloads",label:"Téléchargements",iconType:o.ICON_TYPE.FOLDER}],$={render:()=>{const[s,r]=m.useState(""),i=m.useCallback((n,t)=>{console.log(`Élément sélectionné: ${t}`),t&&r(t)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(p,{items:j,selectedItemId:s,handleSelectedItemChange:i})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple de base avec des icônes standard et démonstration de sélection."}}}},z={args:{items:j,selectedItemId:"folder1",handleSelectedItemChange:(s,r)=>{console.log(`Élément sélectionné: ${r}`)},iconColor:"success"},render:s=>e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(p,{...s})}),parameters:{docs:{description:{story:"Cette story permet de contrôler les propriétés du TreeView directement via le panneau de contrôle de Storybook. Essayez de changer la couleur des icônes pour voir l'effet en temps réel."}}}},M={render:()=>{const[s,r]=m.useState("bookmarks"),i=m.useCallback((n,t)=>{console.log(`Élément sélectionné: ${t}`),t&&r(t)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(p,{items:B,selectedItemId:s,handleSelectedItemChange:i})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple utilisant à la fois des icônes prédéfinies et des icônes personnalisées."}}}},G={render:()=>{const[s,r]=m.useState("item1"),i=m.useCallback((n,t)=>{console.log(`Élément sélectionné: ${t}`),t&&r(t)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(p,{items:B,selectedItemId:s,handleSelectedItemChange:i,hasNoIcons:!0})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple d'arborescence sans icônes, utilisant la prop hasNoIcons."}}}},U={render:()=>{const s=[{internalId:"root",label:"Structure imbriquée complexe",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"level1-1",label:"Niveau 1.1",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"level2-1",label:"Niveau 2.1",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"level3-1V",label:"VOUS M'AVEZ TROUVÉ HIHIHI",iconType:o.ICON_TYPE.FOLDER},{internalId:"level3-2",label:"Niveau 3.2",iconType:o.ICON_TYPE.SHARE}]},{internalId:"level2-2",label:"Niveau 2.2",iconType:o.ICON_TYPE.TRASH}]},{internalId:"level1-2",label:"Niveau 1.2",iconType:o.ICON_TYPE.CUSTOM,customIcon:P}]}],[r,i]=m.useState("level2-1"),n=m.useCallback((t,d)=>{console.log(`Élément sélectionné: ${d}`),d&&i(d)},[]);return e.jsx(l.Box,{sx:{maxWidth:400,overflowY:"hidden"},children:e.jsx(p,{items:s,selectedItemId:r,handleSelectedItemChange:n})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple d'une structure profondément imbriquée."}}}},W={render:()=>{const s=["primary","secondary","info"],[r,i]=m.useState({primary:"",secondary:"",info:""});return e.jsx(l.Box,{sx:{display:"flex",flexDirection:"row",gap:3,overflowY:"hidden"},children:s.map(n=>e.jsxs(l.Box,{sx:{maxWidth:250,overflowY:"hidden"},children:[e.jsxs(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:["Icônes ",n]}),e.jsx(p,{items:j,selectedItemId:r[n],handleSelectedItemChange:(t,d)=>{d&&i(u=>({...u,[n]:d}))},iconColor:n})]},n))})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Démonstration des principales options de couleurs disponibles pour les icônes."}}}},J={render:()=>{const s=()=>{var u,T;const d=[];for(let h=1;h<=5;h++){const y={internalId:`main-folder-${h}`,label:`Dossier principal ${h}`,iconType:o.ICON_TYPE.FOLDER,children:[]};for(let c=1;c<=10;c++){const I={internalId:`subfolder-${h}-${c}`,label:`Sous-dossier ${h}.${c}`,iconType:o.ICON_TYPE.FOLDER,children:[]};for(let b=1;b<=5;b++)(u=I.children)==null||u.push({internalId:`item-${h}-${c}-${b}`,label:`Élément ${h}.${c}.${b}`,iconType:o.ICON_TYPE.CUSTOM,customIcon:R});(T=y.children)==null||T.push(I)}d.push(y)}return d},[r,i]=m.useState(""),n=s(),t=m.useCallback((d,u)=>{u&&i(u)},[]);return e.jsxs(l.Box,{children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"TreeView avec hauteur limitée et défilement vertical"}),e.jsxs(x.Grid,{container:!0,spacing:3,children:[e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(g.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Hauteur maximale de 300px avec overflow"}),e.jsxs(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:[e.jsx(p,{items:n,selectedItemId:r,handleSelectedItemChange:t,maxHeight:300}),e.jsx(l.Box,{sx:{p:2,bgcolor:"primary.light",color:"primary.contrastText",borderTop:"1px solid #e0e0e0"},children:e.jsx(a.Typography,{variant:"body2",children:"Cet élément reste collé sous le TreeView, même avec défilement"})})]})]})}),e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(g.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Hauteur maximale de 500px avec overflow"}),e.jsxs(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:[e.jsx(p,{items:n,selectedItemId:r,handleSelectedItemChange:t,maxHeight:500}),e.jsxs(l.Box,{sx:{display:"flex",justifyContent:"space-between",p:1.5,bgcolor:"background.default",borderTop:"1px solid #e0e0e0"},children:[e.jsx(v.Button,{size:"small",variant:"outlined",children:"Annuler"}),e.jsx(v.Button,{size:"small",variant:"contained",children:"Confirmer"})]})]})]})})]}),e.jsx(l.Box,{mt:4,children:e.jsxs(g.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"TreeView expansé manuellement"}),e.jsxs(l.Box,{sx:{display:"flex",mb:2},children:[e.jsx(v.Button,{variant:"outlined",onClick:()=>i("subfolder-1-1"),sx:{mr:1},children:"Sélectionner Sous-dossier 1.1"}),e.jsx(v.Button,{variant:"outlined",onClick:()=>i("item-3-5-2"),children:"Sélectionner Élément 3.5.2"})]}),e.jsxs(l.Box,{sx:{borderRadius:1,border:"1px solid #e0e0e0"},children:[e.jsx(p,{items:n,selectedItemId:r,handleSelectedItemChange:t,maxHeight:400}),e.jsx(O.Divider,{}),e.jsxs(l.Box,{sx:{p:2,display:"flex",alignItems:"center"},children:[e.jsx(a.Typography,{variant:"body2",sx:{flexGrow:1},children:r?`Élément sélectionné: ${r}`:"Aucun élément sélectionné"}),e.jsx(L.Tooltip,{title:"Ce bandeau reste fixé sous l'arborescence",children:e.jsx(V.IconButton,{size:"small",color:"info",children:e.jsx(q,{fontSize:"small"})})})]})]})]})})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story démontre l'utilisation de la prop `maxHeight` pour contrôler la hauteur maximale du TreeView. Elle permet de vérifier le comportement du défilement (overflow) lorsque le contenu dépasse la hauteur définie. Des éléments sont placés en dessous de chaque TreeView pour montrer que ceux-ci restent bien collés, tandis que seul le contenu de l'arborescence défile."}}}},Z={render:()=>{const[s,r]=m.useState("reports"),i=(d,u)=>{console.log("TreeView sélection:",u),u&&r(u)},n=d=>{console.log("Sélection externe:",d),r(d)},t=()=>{const u=D(S).find(T=>T.internalId===s);return u?u.label:"Aucun élément sélectionné"};return e.jsxs(l.Box,{sx:{width:"100%",overflowY:"hidden"},children:[e.jsxs(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:["Élément sélectionné: ",e.jsx("strong",{children:t()})," (ID:"," ",s,")"]}),e.jsx(k,{items:S,onRandomSelect:n}),e.jsxs(x.Grid,{container:!0,spacing:3,sx:{overflowY:"hidden"},children:[e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(g.Paper,{sx:{p:2,overflowY:"hidden"},children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"TreeView"}),e.jsx(p,{items:S,selectedItemId:s,handleSelectedItemChange:i})]})}),e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsx(H,{items:S,selectedItemId:s,onItemSelect:n})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Démonstration de la synchronisation entre le TreeView et d'autres composants. Cette story montre comment le TreeView peut être intégré dans une interface complexe où la sélection peut provenir de différentes sources mais reste synchronisée."}}}},Q={render:()=>{var h,y;const[s,r]=m.useState([...j]),[i,n]=m.useState("folder1"),[t,d]=m.useState(null),u=[{id:"doc1",label:"Document 1"},{id:"doc2",label:"Document 2"},{id:"doc3",label:"Document 3"}],T=c=>{c.preventDefault();const I=c.target,b=I.closest("[data-treeview-item]");let f=null,E=null;b?(f=b.getAttribute("data-treeview-item"),E=b.getAttribute("data-treeview-item-label")):I.closest("[data-treeview-root]")&&(f=null,E="Racine du TreeView");try{const C=JSON.parse(c.dataTransfer.getData("application/json"));d({itemId:f,itemLabel:E,droppedItem:C}),f&&n(f)}catch(C){console.error("Erreur lors de la récupération des données",C)}};return e.jsxs(l.Box,{sx:{maxWidth:700,overflowY:"hidden"},children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"Exemple de Drag & Drop avec le TreeView"}),e.jsx(a.Typography,{variant:"body2",gutterBottom:!0,children:"Glissez-déposez un des documents ci-dessous sur un élément du TreeView."}),e.jsx(l.Box,{sx:{display:"flex",mb:2},children:u.map(c=>e.jsx(A,{id:c.id,label:c.label},c.id))}),e.jsxs(x.Grid,{container:!0,spacing:3,children:[e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(l.Box,{sx:{p:2,border:"1px dashed gray",borderRadius:1,minHeight:300,overflowY:"hidden",backgroundColor:"background.paper"},onDragOver:c=>c.preventDefault(),onDrop:T,children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Zone de drop"}),e.jsx(p,{items:s,selectedItemId:i,handleSelectedItemChange:(c,I)=>{I&&n(I)}})]})}),e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(g.Paper,{sx:{p:2,minHeight:300},children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Informations du dernier drop"}),t?e.jsxs(l.Box,{children:[e.jsxs(a.Typography,{variant:"body2",children:[e.jsx("strong",{children:"Élément cible :"})," ",t.itemLabel," ",t.itemId&&`(ID: ${t.itemId})`]}),e.jsxs(a.Typography,{variant:"body2",children:[e.jsx("strong",{children:"Élément déposé :"})," ",(h=t.droppedItem)==null?void 0:h.label," (ID:"," ",(y=t.droppedItem)==null?void 0:y.id,")"]}),e.jsxs(l.Box,{sx:{mt:2},children:[e.jsx(a.Typography,{variant:"body2",children:e.jsx("strong",{children:"Code pour gérer ce drop :"})}),e.jsx(g.Paper,{sx:{p:1,mt:1,backgroundColor:"grey.100"},children:e.jsx("pre",{style:{margin:0,fontSize:"0.8rem",whiteSpace:"pre-wrap"},children:`// Dans votre gestionnaire d'événements
|
|
50
|
+
`}}}},w=i=>{const n=[],o=s=>{n.push(s),s.children&&s.children.forEach(r=>o(r))};return i.forEach(s=>o(s)),n},k=({items:i,selectedItemId:n,onItemSelect:o})=>{const s=w(i);return e.jsxs(I.Paper,{sx:{width:"100%",maxHeight:300,overflow:"auto"},children:[e.jsx(a.Typography,{variant:"h6",sx:{p:2},children:"Sélection externe"}),e.jsx(P.Divider,{}),e.jsx(L.List,{children:s.map(r=>e.jsx(_.ListItem,{disablePadding:!0,children:e.jsx(m.ListItemButton,{selected:n===r.internalId,onClick:()=>o(r.internalId),children:e.jsx(m.ListItemText,{primary:r.label})})},r.internalId))})]})},H=({items:i,onRandomSelect:n})=>{const o=w(i),s=()=>{const r=Math.floor(Math.random()*o.length);n(o[r].internalId)};return e.jsx(l.Box,{sx:{mt:2,mb:2},children:e.jsx(g.Button,{variant:"contained",color:"primary",onClick:s,children:"Sélection aléatoire"})})},A=({id:i,label:n})=>e.jsx(l.Box,{draggable:!0,onDragStart:o=>{o.dataTransfer.setData("application/json",JSON.stringify({id:i,label:n}))},sx:{padding:1,margin:1,backgroundColor:"grey.100",borderRadius:1,display:"inline-block",cursor:"grab","&:hover":{backgroundColor:"grey.200"}},children:e.jsxs(a.Typography,{variant:"body2",display:"flex",alignItems:"center",children:[e.jsx(D,{fontSize:"small",sx:{mr:1}}),n]})}),j=[{internalId:"documents",label:"Mes formulaires",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"folder1",label:"Premier dossier",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"subfolder1",label:"Sous-dossier 1",iconType:t.ICON_TYPE.FOLDER},{internalId:"subfolder2",label:"Sous-dossier 2",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"folder2",label:"Deuxième dossier",iconType:t.ICON_TYPE.FOLDER},{internalId:"folder3",label:"Troisième dossier",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"shared",label:"Formulaires partagés avec moi",iconType:t.ICON_TYPE.SHARE},{internalId:"trash",label:"Corbeille",iconType:t.ICON_TYPE.TRASH}],Y=[{internalId:"bookmarks",label:"Favoris",iconType:R,children:[{internalId:"important",label:"Important",iconType:t.ICON_TYPE.CUSTOM,customIcon:q}]},...j],S=[{internalId:"documents",label:"Documents",iconType:t.ICON_TYPE.SHARE,children:[{internalId:"reports",label:"Rapports",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"report1",label:"Rapport Janvier",iconType:t.ICON_TYPE.FOLDER},{internalId:"report2",label:"Rapport Février",iconType:t.ICON_TYPE.FOLDER},{internalId:"report3",label:"Rapport Mars",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"invoices",label:"Factures",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"media",label:"Médias",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"images",label:"Images",iconType:t.ICON_TYPE.FOLDER},{internalId:"videos",label:"Vidéos",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"downloads",label:"Téléchargements",iconType:t.ICON_TYPE.FOLDER}],M={render:()=>{const[i,n]=u.useState(""),o=u.useCallback((s,r)=>{console.log(`Élément sélectionné: ${r}`),r&&n(r)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(h,{items:j,selectedItemId:i,handleSelectedItemChange:o})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple de base avec des icônes standard et démonstration de sélection."}}}},z={args:{items:j,selectedItemId:"folder1",handleSelectedItemChange:(i,n)=>{console.log(`Élément sélectionné: ${n}`)},iconColor:"success"},render:i=>e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(h,{...i})}),parameters:{docs:{description:{story:"Cette story permet de contrôler les propriétés du TreeView directement via le panneau de contrôle de Storybook. Essayez de changer la couleur des icônes pour voir l'effet en temps réel."}}}},$={render:()=>{const[i,n]=u.useState("bookmarks"),o=u.useCallback((s,r)=>{console.log(`Élément sélectionné: ${r}`),r&&n(r)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(h,{items:Y,selectedItemId:i,handleSelectedItemChange:o})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple utilisant à la fois des icônes prédéfinies et des icônes personnalisées."}}}},G={render:()=>{const[i,n]=u.useState("item1"),o=u.useCallback((s,r)=>{console.log(`Élément sélectionné: ${r}`),r&&n(r)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(h,{items:Y,selectedItemId:i,handleSelectedItemChange:o,hasNoIcons:!0})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple d'arborescence sans icônes, utilisant la prop hasNoIcons."}}}},U={render:()=>{const i=[{internalId:"root",label:"Structure imbriquée complexe",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"level1-1",label:"Niveau 1.1",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"level2-1",label:"Niveau 2.1",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"level3-1V",label:"VOUS M'AVEZ TROUVÉ HIHIHI",iconType:t.ICON_TYPE.FOLDER},{internalId:"level3-2",label:"Niveau 3.2",iconType:t.ICON_TYPE.SHARE}]},{internalId:"level2-2",label:"Niveau 2.2",iconType:t.ICON_TYPE.TRASH}]},{internalId:"level1-2",label:"Niveau 1.2",iconType:t.ICON_TYPE.CUSTOM,customIcon:R}]}],[n,o]=u.useState("level2-1"),s=u.useCallback((r,d)=>{console.log(`Élément sélectionné: ${d}`),d&&o(d)},[]);return e.jsx(l.Box,{sx:{maxWidth:400,overflowY:"hidden"},children:e.jsx(h,{items:i,selectedItemId:n,handleSelectedItemChange:s})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple d'une structure profondément imbriquée."}}}},W={render:()=>{const i=["primary","secondary","info"],[n,o]=u.useState({primary:"",secondary:"",info:""});return e.jsx(l.Box,{sx:{display:"flex",flexDirection:"row",gap:3,overflowY:"hidden"},children:i.map(s=>e.jsxs(l.Box,{sx:{maxWidth:250,overflowY:"hidden"},children:[e.jsxs(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:["Icônes ",s]}),e.jsx(h,{items:j,selectedItemId:n[s],handleSelectedItemChange:(r,d)=>{d&&o(p=>({...p,[s]:d}))},iconColor:s})]},s))})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Démonstration des principales options de couleurs disponibles pour les icônes."}}}},J={render:()=>{const i=()=>{var p,y;const d=[];for(let x=1;x<=5;x++){const f={internalId:`main-folder-${x}`,label:`Dossier principal ${x}`,iconType:t.ICON_TYPE.FOLDER,children:[]};for(let c=1;c<=10;c++){const T={internalId:`subfolder-${x}-${c}`,label:`Sous-dossier ${x}.${c}`,iconType:t.ICON_TYPE.FOLDER,children:[]};for(let b=1;b<=5;b++)(p=T.children)==null||p.push({internalId:`item-${x}-${c}-${b}`,label:`Élément ${x}.${c}.${b}`,iconType:t.ICON_TYPE.CUSTOM,customIcon:D});(y=f.children)==null||y.push(T)}d.push(f)}return d},[n,o]=u.useState(""),s=i(),r=u.useCallback((d,p)=>{p&&o(p)},[]);return e.jsxs(l.Box,{children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"TreeView avec hauteur limitée et défilement vertical"}),e.jsxs(m.Grid,{container:!0,spacing:3,children:[e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Hauteur maximale de 300px avec overflow"}),e.jsxs(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:[e.jsx(h,{items:s,selectedItemId:n,handleSelectedItemChange:r,maxHeight:300}),e.jsx(l.Box,{sx:{p:2,bgcolor:"primary.light",color:"primary.contrastText",borderTop:"1px solid #e0e0e0"},children:e.jsx(a.Typography,{variant:"body2",children:"Cet élément reste collé sous le TreeView, même avec défilement"})})]})]})}),e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Hauteur maximale de 500px avec overflow"}),e.jsxs(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:[e.jsx(h,{items:s,selectedItemId:n,handleSelectedItemChange:r,maxHeight:500}),e.jsxs(l.Box,{sx:{display:"flex",justifyContent:"space-between",p:1.5,bgcolor:"background.default",borderTop:"1px solid #e0e0e0"},children:[e.jsx(g.Button,{size:"small",variant:"outlined",children:"Annuler"}),e.jsx(g.Button,{size:"small",variant:"contained",children:"Confirmer"})]})]})]})})]}),e.jsx(l.Box,{mt:4,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"TreeView expansé manuellement"}),e.jsxs(l.Box,{sx:{display:"flex",mb:2},children:[e.jsx(g.Button,{variant:"outlined",onClick:()=>o("subfolder-1-1"),sx:{mr:1},children:"Sélectionner Sous-dossier 1.1"}),e.jsx(g.Button,{variant:"outlined",onClick:()=>o("item-3-5-2"),children:"Sélectionner Élément 3.5.2"})]}),e.jsxs(l.Box,{sx:{borderRadius:1,border:"1px solid #e0e0e0"},children:[e.jsx(h,{items:s,selectedItemId:n,handleSelectedItemChange:r,maxHeight:400}),e.jsx(P.Divider,{}),e.jsxs(l.Box,{sx:{p:2,display:"flex",alignItems:"center"},children:[e.jsx(a.Typography,{variant:"body2",sx:{flexGrow:1},children:n?`Élément sélectionné: ${n}`:"Aucun élément sélectionné"}),e.jsx(B.Tooltip,{title:"Ce bandeau reste fixé sous l'arborescence",children:e.jsx(N.IconButton,{size:"small",color:"info",children:e.jsx(V,{fontSize:"small"})})})]})]})]})})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story démontre l'utilisation de la prop `maxHeight` pour contrôler la hauteur maximale du TreeView. Elle permet de vérifier le comportement du défilement (overflow) lorsque le contenu dépasse la hauteur définie. Des éléments sont placés en dessous de chaque TreeView pour montrer que ceux-ci restent bien collés, tandis que seul le contenu de l'arborescence défile."}}}},X={render:()=>{const[i,n]=u.useState("reports"),o=(d,p)=>{console.log("TreeView sélection:",p),p&&n(p)},s=d=>{console.log("Sélection externe:",d),n(d)},r=()=>{const p=w(S).find(y=>y.internalId===i);return p?p.label:"Aucun élément sélectionné"};return e.jsxs(l.Box,{sx:{width:"100%",overflowY:"hidden"},children:[e.jsxs(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:["Élément sélectionné: ",e.jsx("strong",{children:r()})," (ID:"," ",i,")"]}),e.jsx(H,{items:S,onRandomSelect:s}),e.jsxs(m.Grid,{container:!0,spacing:3,sx:{overflowY:"hidden"},children:[e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2,overflowY:"hidden"},children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"TreeView"}),e.jsx(h,{items:S,selectedItemId:i,handleSelectedItemChange:o})]})}),e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsx(k,{items:S,selectedItemId:i,onItemSelect:s})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Démonstration de la synchronisation entre le TreeView et d'autres composants. Cette story montre comment le TreeView peut être intégré dans une interface complexe où la sélection peut provenir de différentes sources mais reste synchronisée."}}}},Z={render:()=>{var x,f;const[i,n]=u.useState([...j]),[o,s]=u.useState("folder1"),[r,d]=u.useState(null),p=[{id:"doc1",label:"Document 1"},{id:"doc2",label:"Document 2"},{id:"doc3",label:"Document 3"}],y=c=>{c.preventDefault();const T=c.target,b=T.closest("[data-treeview-item]");let v=null,E=null;b?(v=b.getAttribute("data-treeview-item"),E=b.getAttribute("data-treeview-item-label")):T.closest("[data-treeview-root]")&&(v=null,E="Racine du TreeView");try{const C=JSON.parse(c.dataTransfer.getData("application/json"));d({itemId:v,itemLabel:E,droppedItem:C}),v&&s(v)}catch(C){console.error("Erreur lors de la récupération des données",C)}};return e.jsxs(l.Box,{sx:{maxWidth:700,overflowY:"hidden"},children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"Exemple de Drag & Drop avec le TreeView"}),e.jsx(a.Typography,{variant:"body2",gutterBottom:!0,children:"Glissez-déposez un des documents ci-dessous sur un élément du TreeView."}),e.jsx(l.Box,{sx:{display:"flex",mb:2},children:p.map(c=>e.jsx(A,{id:c.id,label:c.label},c.id))}),e.jsxs(m.Grid,{container:!0,spacing:3,children:[e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(l.Box,{sx:{p:2,border:"1px dashed gray",borderRadius:1,minHeight:300,overflowY:"hidden",backgroundColor:"background.paper"},onDragOver:c=>c.preventDefault(),onDrop:y,children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Zone de drop"}),e.jsx(h,{items:i,selectedItemId:o,handleSelectedItemChange:(c,T)=>{T&&s(T)}})]})}),e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2,minHeight:300},children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Informations du dernier drop"}),r?e.jsxs(l.Box,{children:[e.jsxs(a.Typography,{variant:"body2",children:[e.jsx("strong",{children:"Élément cible :"})," ",r.itemLabel," ",r.itemId&&`(ID: ${r.itemId})`]}),e.jsxs(a.Typography,{variant:"body2",children:[e.jsx("strong",{children:"Élément déposé :"})," ",(x=r.droppedItem)==null?void 0:x.label," (ID:"," ",(f=r.droppedItem)==null?void 0:f.id,")"]}),e.jsxs(l.Box,{sx:{mt:2},children:[e.jsx(a.Typography,{variant:"body2",children:e.jsx("strong",{children:"Code pour gérer ce drop :"})}),e.jsx(I.Paper,{sx:{p:1,mt:1,backgroundColor:"grey.100"},children:e.jsx("pre",{style:{margin:0,fontSize:"0.8rem",whiteSpace:"pre-wrap"},children:`// Dans votre gestionnaire d'événements
|
|
51
51
|
const handleDrop = (e) => {
|
|
52
52
|
e.preventDefault();
|
|
53
53
|
|
|
@@ -66,4 +66,4 @@ const handleDrop = (e) => {
|
|
|
66
66
|
|
|
67
67
|
// Votre logique pour traiter le drop...
|
|
68
68
|
}
|
|
69
|
-
};`})})]})]}):e.jsx(a.Typography,{variant:"body2",children:"Aucun élément déposé pour le moment. Glissez un document sur le TreeView pour voir les informations ici."})]})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story démontre comment utiliser les attributs `data-` du TreeView pour implémenter une fonctionnalité de drag and drop. Glissez un document sur un élément du TreeView pour voir comment accéder aux informations de l'élément cible."}}}};exports.AvecDragAndDrop=
|
|
69
|
+
};`})})]})]}):e.jsx(a.Typography,{variant:"body2",children:"Aucun élément déposé pour le moment. Glissez un document sur le TreeView pour voir les informations ici."})]})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story démontre comment utiliser les attributs `data-` du TreeView pour implémenter une fonctionnalité de drag and drop. Glissez un document sur un élément du TreeView pour voir comment accéder aux informations de l'élément cible."}}}},Q={render:()=>{const i=[{internalId:"root-1",label:"Dossier principal",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"folder-1-1",label:"Sous-dossier avec un nom très long pour tester",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"file-1-1-1",label:"Document A",iconType:t.ICON_TYPE.CUSTOM,customIcon:D},{internalId:"folder-1-1-2",label:"Sous-sous-dossier",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"file-1-1-2-1",label:"Image.jpg",iconType:t.ICON_TYPE.CUSTOM},{internalId:"file-1-1-2-2",label:"Document.pdf",iconType:t.ICON_TYPE.CUSTOM,children:[{internalId:"file-1-1-2-7",label:"Image.jpg",iconType:t.ICON_TYPE.CUSTOM},{internalId:"file-1-1-2-18",label:"Document.pdf",iconType:t.ICON_TYPE.CUSTOM}]}]}]},{internalId:"folder-1-2",label:"Court",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"file-1-2-1",label:"Fichier",iconType:t.ICON_TYPE.CUSTOM}]}]},{internalId:"root-2",label:"Second dossier principal",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"folder-2-1",label:"Sous-dossier A",iconType:t.ICON_TYPE.FOLDER},{internalId:"folder-2-2",label:"Sous-dossier B",iconType:t.ICON_TYPE.FOLDER,children:[]}]},{internalId:"root-3",label:"Troisième dossier principal",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"folder-3-1",label:"Sous-dossier X",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"file-3-1-1",label:"Fichier X-1",iconType:t.ICON_TYPE.CUSTOM},{internalId:"file-3-1-2",label:"Fichier X-2",iconType:t.ICON_TYPE.CUSTOM}]}]}],[n,o]=u.useState(""),s=u.useCallback((r,d)=>{d&&o(d)},[]);return e.jsxs(l.Box,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"h5",gutterBottom:!0,children:"Test d'alignement des lignes verticales"}),e.jsx(a.Typography,{variant:"body2",color:"text.secondary",paragraph:!0,children:"Cette story permet de vérifier si les lignes verticales s'arrêtent toutes au même niveau, indépendamment de la taille des éléments. Essayez d'expandre et de collapser les différents niveaux."}),e.jsxs(m.Grid,{container:!0,spacing:3,children:[e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"TreeView avec plusieurs niveaux imbriqués"}),e.jsx(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:e.jsx(h,{items:i,selectedItemId:n,handleSelectedItemChange:s,maxHeight:400})})]})}),e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Détails de l'élément sélectionné"}),e.jsx(l.Box,{sx:{p:2,backgroundColor:"#f5f5f5",borderRadius:1,minHeight:100},children:n?e.jsxs(a.Typography,{children:["Élément sélectionné: ",e.jsx("strong",{children:n})]}):e.jsx(a.Typography,{color:"text.secondary",children:"Aucun élément sélectionné. Cliquez sur un élément dans l'arborescence."})}),e.jsxs(l.Box,{sx:{mt:2},children:[e.jsx(g.Button,{variant:"outlined",onClick:()=>o("file-1-1-2-1"),sx:{mr:1},children:'Sélectionner "Image.jpg"'}),e.jsx(g.Button,{variant:"outlined",onClick:()=>o("folder-3-1"),children:'Sélectionner "Sous-dossier X"'})]})]})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story permet de tester si les lignes verticales du TreeView s'alignent correctement. Elle utilise une arborescence à plusieurs niveaux avec des éléments de différentes tailles et labels de différentes longueurs pour mettre en évidence le comportement des lignes. Vérifiez que toutes les lignes verticales s'arrêtent au même niveau, créant ainsi une structure d'arborescence propre et cohérente."}}}};exports.AvecDragAndDrop=Z;exports.AvecIconesPersonnalisees=$;exports.Controlable=z;exports.Default=M;exports.GrandeHauteurLimitee=J;exports.OptionsDeCouleurs=W;exports.SansIcones=G;exports.StructureImbriquee=U;exports.Synchronicite=X;exports.TestAlignementLignes=Q;exports.default=F;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { c as
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { c as O } from "../../createSvgIcon-Dk3n_NBz.js";
|
|
3
3
|
import { I as k } from "../../IconButton-BfOmPY_b.js";
|
|
4
4
|
import { T as B } from "../../Tooltip-UBiscQPm.js";
|
|
5
|
-
import { useState as
|
|
5
|
+
import { useState as b, useCallback as x } from "react";
|
|
6
6
|
import p from "../TreeView/TreeView.es.js";
|
|
7
|
-
import { ICON_TYPE as
|
|
7
|
+
import { ICON_TYPE as t } from "../TreeView/types.es.js";
|
|
8
8
|
import { B as a } from "../../Box--MaxIKbn.js";
|
|
9
9
|
import { T as d } from "../../Typography-BJPk_mTw.js";
|
|
10
|
-
import { G as
|
|
11
|
-
import { P as
|
|
12
|
-
import { B as
|
|
13
|
-
import { D as
|
|
14
|
-
import { L as
|
|
15
|
-
import { L as
|
|
16
|
-
const
|
|
10
|
+
import { G as h, L as A, a as M } from "../../ListItemText-BeWOS4WA.js";
|
|
11
|
+
import { P as f } from "../../Paper-D9hEGUDL.js";
|
|
12
|
+
import { B as y } from "../../Button-kOBqHwsO.js";
|
|
13
|
+
import { D as F } from "../../Divider-Bw612Jal.js";
|
|
14
|
+
import { L as z } from "../../List-CV_4VCwT.js";
|
|
15
|
+
import { L as $ } from "../../ListItem--Hj6zz4n.js";
|
|
16
|
+
const q = O(/* @__PURE__ */ e("path", {
|
|
17
17
|
d: "M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"
|
|
18
|
-
}), "Bookmark"),
|
|
18
|
+
}), "Bookmark"), L = O(/* @__PURE__ */ e("path", {
|
|
19
19
|
d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"
|
|
20
|
-
}), "Description"),
|
|
20
|
+
}), "Description"), U = O(/* @__PURE__ */ e("path", {
|
|
21
21
|
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"
|
|
22
|
-
}), "Info"),
|
|
22
|
+
}), "Info"), P = O(/* @__PURE__ */ e("path", {
|
|
23
23
|
d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"
|
|
24
24
|
}), "Person"), se = {
|
|
25
25
|
title: "Components/TreeView",
|
|
@@ -127,48 +127,48 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
},
|
|
131
|
-
const r = [],
|
|
132
|
-
r.push(
|
|
133
|
-
(
|
|
130
|
+
}, V = (l) => {
|
|
131
|
+
const r = [], o = (s) => {
|
|
132
|
+
r.push(s), s.children && s.children.forEach(
|
|
133
|
+
(n) => o(n)
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
|
-
return
|
|
137
|
-
},
|
|
138
|
-
items:
|
|
136
|
+
return l.forEach((s) => o(s)), r;
|
|
137
|
+
}, Y = ({
|
|
138
|
+
items: l,
|
|
139
139
|
selectedItemId: r,
|
|
140
|
-
onItemSelect:
|
|
140
|
+
onItemSelect: o
|
|
141
141
|
}) => {
|
|
142
|
-
const
|
|
143
|
-
return /* @__PURE__ */
|
|
142
|
+
const s = V(l);
|
|
143
|
+
return /* @__PURE__ */ i(f, { sx: { width: "100%", maxHeight: 300, overflow: "auto" }, children: [
|
|
144
144
|
/* @__PURE__ */ e(d, { variant: "h6", sx: { p: 2 }, children: "Sélection externe" }),
|
|
145
|
-
/* @__PURE__ */ e(
|
|
146
|
-
/* @__PURE__ */ e(
|
|
147
|
-
|
|
145
|
+
/* @__PURE__ */ e(F, {}),
|
|
146
|
+
/* @__PURE__ */ e(z, { children: s.map((n) => /* @__PURE__ */ e($, { disablePadding: !0, children: /* @__PURE__ */ e(
|
|
147
|
+
A,
|
|
148
148
|
{
|
|
149
|
-
selected: r ===
|
|
150
|
-
onClick: () =>
|
|
151
|
-
children: /* @__PURE__ */ e(
|
|
149
|
+
selected: r === n.internalId,
|
|
150
|
+
onClick: () => o(n.internalId),
|
|
151
|
+
children: /* @__PURE__ */ e(M, { primary: n.label })
|
|
152
152
|
}
|
|
153
|
-
) },
|
|
153
|
+
) }, n.internalId)) })
|
|
154
154
|
] });
|
|
155
|
-
},
|
|
156
|
-
items:
|
|
155
|
+
}, N = ({
|
|
156
|
+
items: l,
|
|
157
157
|
onRandomSelect: r
|
|
158
158
|
}) => {
|
|
159
|
-
const
|
|
160
|
-
return /* @__PURE__ */ e(a, { sx: { mt: 2, mb: 2 }, children: /* @__PURE__ */ e(
|
|
161
|
-
const
|
|
162
|
-
r(
|
|
159
|
+
const o = V(l);
|
|
160
|
+
return /* @__PURE__ */ e(a, { sx: { mt: 2, mb: 2 }, children: /* @__PURE__ */ e(y, { variant: "contained", color: "primary", onClick: () => {
|
|
161
|
+
const n = Math.floor(Math.random() * o.length);
|
|
162
|
+
r(o[n].internalId);
|
|
163
163
|
}, children: "Sélection aléatoire" }) });
|
|
164
|
-
},
|
|
164
|
+
}, j = ({ id: l, label: r }) => /* @__PURE__ */ e(
|
|
165
165
|
a,
|
|
166
166
|
{
|
|
167
167
|
draggable: !0,
|
|
168
|
-
onDragStart: (
|
|
169
|
-
|
|
168
|
+
onDragStart: (o) => {
|
|
169
|
+
o.dataTransfer.setData(
|
|
170
170
|
"application/json",
|
|
171
|
-
JSON.stringify({ id:
|
|
171
|
+
JSON.stringify({ id: l, label: r })
|
|
172
172
|
);
|
|
173
173
|
},
|
|
174
174
|
sx: {
|
|
@@ -182,130 +182,130 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
182
182
|
backgroundColor: "grey.200"
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
|
-
children: /* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */ e(
|
|
185
|
+
children: /* @__PURE__ */ i(d, { variant: "body2", display: "flex", alignItems: "center", children: [
|
|
186
|
+
/* @__PURE__ */ e(L, { fontSize: "small", sx: { mr: 1 } }),
|
|
187
187
|
r
|
|
188
188
|
] })
|
|
189
189
|
}
|
|
190
|
-
),
|
|
190
|
+
), w = [
|
|
191
191
|
{
|
|
192
192
|
internalId: "documents",
|
|
193
193
|
label: "Mes formulaires",
|
|
194
|
-
iconType:
|
|
194
|
+
iconType: t.FOLDER,
|
|
195
195
|
children: [
|
|
196
196
|
{
|
|
197
197
|
internalId: "folder1",
|
|
198
198
|
label: "Premier dossier",
|
|
199
|
-
iconType:
|
|
199
|
+
iconType: t.FOLDER,
|
|
200
200
|
children: [
|
|
201
201
|
{
|
|
202
202
|
internalId: "subfolder1",
|
|
203
203
|
label: "Sous-dossier 1",
|
|
204
|
-
iconType:
|
|
204
|
+
iconType: t.FOLDER
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
internalId: "subfolder2",
|
|
208
208
|
label: "Sous-dossier 2",
|
|
209
|
-
iconType:
|
|
209
|
+
iconType: t.FOLDER
|
|
210
210
|
}
|
|
211
211
|
]
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
internalId: "folder2",
|
|
215
215
|
label: "Deuxième dossier",
|
|
216
|
-
iconType:
|
|
216
|
+
iconType: t.FOLDER
|
|
217
217
|
},
|
|
218
218
|
{
|
|
219
219
|
internalId: "folder3",
|
|
220
220
|
label: "Troisième dossier",
|
|
221
|
-
iconType:
|
|
221
|
+
iconType: t.FOLDER
|
|
222
222
|
}
|
|
223
223
|
]
|
|
224
224
|
},
|
|
225
225
|
{
|
|
226
226
|
internalId: "shared",
|
|
227
227
|
label: "Formulaires partagés avec moi",
|
|
228
|
-
iconType:
|
|
228
|
+
iconType: t.SHARE
|
|
229
229
|
},
|
|
230
230
|
{
|
|
231
231
|
internalId: "trash",
|
|
232
232
|
label: "Corbeille",
|
|
233
|
-
iconType:
|
|
233
|
+
iconType: t.TRASH
|
|
234
234
|
}
|
|
235
|
-
],
|
|
235
|
+
], H = [
|
|
236
236
|
{
|
|
237
237
|
internalId: "bookmarks",
|
|
238
238
|
label: "Favoris",
|
|
239
|
-
iconType:
|
|
239
|
+
iconType: q,
|
|
240
240
|
children: [
|
|
241
241
|
{
|
|
242
242
|
internalId: "important",
|
|
243
243
|
label: "Important",
|
|
244
|
-
iconType:
|
|
245
|
-
customIcon:
|
|
244
|
+
iconType: t.CUSTOM,
|
|
245
|
+
customIcon: P
|
|
246
246
|
}
|
|
247
247
|
]
|
|
248
248
|
},
|
|
249
|
-
...
|
|
249
|
+
...w
|
|
250
250
|
], R = [
|
|
251
251
|
{
|
|
252
252
|
internalId: "documents",
|
|
253
253
|
label: "Documents",
|
|
254
|
-
iconType:
|
|
254
|
+
iconType: t.SHARE,
|
|
255
255
|
children: [
|
|
256
256
|
{
|
|
257
257
|
internalId: "reports",
|
|
258
258
|
label: "Rapports",
|
|
259
|
-
iconType:
|
|
259
|
+
iconType: t.FOLDER,
|
|
260
260
|
children: [
|
|
261
261
|
{
|
|
262
262
|
internalId: "report1",
|
|
263
263
|
label: "Rapport Janvier",
|
|
264
|
-
iconType:
|
|
264
|
+
iconType: t.FOLDER
|
|
265
265
|
},
|
|
266
266
|
{
|
|
267
267
|
internalId: "report2",
|
|
268
268
|
label: "Rapport Février",
|
|
269
|
-
iconType:
|
|
269
|
+
iconType: t.FOLDER
|
|
270
270
|
},
|
|
271
271
|
{
|
|
272
272
|
internalId: "report3",
|
|
273
273
|
label: "Rapport Mars",
|
|
274
|
-
iconType:
|
|
274
|
+
iconType: t.FOLDER
|
|
275
275
|
}
|
|
276
276
|
]
|
|
277
277
|
},
|
|
278
|
-
{ internalId: "invoices", label: "Factures", iconType:
|
|
278
|
+
{ internalId: "invoices", label: "Factures", iconType: t.FOLDER }
|
|
279
279
|
]
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
282
|
internalId: "media",
|
|
283
283
|
label: "Médias",
|
|
284
|
-
iconType:
|
|
284
|
+
iconType: t.FOLDER,
|
|
285
285
|
children: [
|
|
286
|
-
{ internalId: "images", label: "Images", iconType:
|
|
287
|
-
{ internalId: "videos", label: "Vidéos", iconType:
|
|
286
|
+
{ internalId: "images", label: "Images", iconType: t.FOLDER },
|
|
287
|
+
{ internalId: "videos", label: "Vidéos", iconType: t.FOLDER }
|
|
288
288
|
]
|
|
289
289
|
},
|
|
290
290
|
{
|
|
291
291
|
internalId: "downloads",
|
|
292
292
|
label: "Téléchargements",
|
|
293
|
-
iconType:
|
|
293
|
+
iconType: t.FOLDER
|
|
294
294
|
}
|
|
295
295
|
], ae = {
|
|
296
296
|
render: () => {
|
|
297
|
-
const [
|
|
298
|
-
(
|
|
299
|
-
console.log(`Élément sélectionné: ${
|
|
297
|
+
const [l, r] = b(""), o = x(
|
|
298
|
+
(s, n) => {
|
|
299
|
+
console.log(`Élément sélectionné: ${n}`), n && r(n);
|
|
300
300
|
},
|
|
301
301
|
[]
|
|
302
302
|
);
|
|
303
303
|
return /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(
|
|
304
304
|
p,
|
|
305
305
|
{
|
|
306
|
-
items:
|
|
307
|
-
selectedItemId:
|
|
308
|
-
handleSelectedItemChange:
|
|
306
|
+
items: w,
|
|
307
|
+
selectedItemId: l,
|
|
308
|
+
handleSelectedItemChange: o
|
|
309
309
|
}
|
|
310
310
|
) });
|
|
311
311
|
},
|
|
@@ -320,14 +320,14 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
320
320
|
}
|
|
321
321
|
}, de = {
|
|
322
322
|
args: {
|
|
323
|
-
items:
|
|
323
|
+
items: w,
|
|
324
324
|
selectedItemId: "folder1",
|
|
325
|
-
handleSelectedItemChange: (
|
|
325
|
+
handleSelectedItemChange: (l, r) => {
|
|
326
326
|
console.log(`Élément sélectionné: ${r}`);
|
|
327
327
|
},
|
|
328
328
|
iconColor: "success"
|
|
329
329
|
},
|
|
330
|
-
render: (
|
|
330
|
+
render: (l) => /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(p, { ...l }) }),
|
|
331
331
|
parameters: {
|
|
332
332
|
docs: {
|
|
333
333
|
description: {
|
|
@@ -337,18 +337,18 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
337
337
|
}
|
|
338
338
|
}, ce = {
|
|
339
339
|
render: () => {
|
|
340
|
-
const [
|
|
341
|
-
(
|
|
342
|
-
console.log(`Élément sélectionné: ${
|
|
340
|
+
const [l, r] = b("bookmarks"), o = x(
|
|
341
|
+
(s, n) => {
|
|
342
|
+
console.log(`Élément sélectionné: ${n}`), n && r(n);
|
|
343
343
|
},
|
|
344
344
|
[]
|
|
345
345
|
);
|
|
346
346
|
return /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(
|
|
347
347
|
p,
|
|
348
348
|
{
|
|
349
|
-
items:
|
|
350
|
-
selectedItemId:
|
|
351
|
-
handleSelectedItemChange:
|
|
349
|
+
items: H,
|
|
350
|
+
selectedItemId: l,
|
|
351
|
+
handleSelectedItemChange: o
|
|
352
352
|
}
|
|
353
353
|
) });
|
|
354
354
|
},
|
|
@@ -363,18 +363,18 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
363
363
|
}
|
|
364
364
|
}, me = {
|
|
365
365
|
render: () => {
|
|
366
|
-
const [
|
|
367
|
-
(
|
|
368
|
-
console.log(`Élément sélectionné: ${
|
|
366
|
+
const [l, r] = b("item1"), o = x(
|
|
367
|
+
(s, n) => {
|
|
368
|
+
console.log(`Élément sélectionné: ${n}`), n && r(n);
|
|
369
369
|
},
|
|
370
370
|
[]
|
|
371
371
|
);
|
|
372
372
|
return /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(
|
|
373
373
|
p,
|
|
374
374
|
{
|
|
375
|
-
items:
|
|
376
|
-
selectedItemId:
|
|
377
|
-
handleSelectedItemChange:
|
|
375
|
+
items: H,
|
|
376
|
+
selectedItemId: l,
|
|
377
|
+
handleSelectedItemChange: o,
|
|
378
378
|
hasNoIcons: !0
|
|
379
379
|
}
|
|
380
380
|
) });
|
|
@@ -390,61 +390,61 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
390
390
|
}
|
|
391
391
|
}, ue = {
|
|
392
392
|
render: () => {
|
|
393
|
-
const
|
|
393
|
+
const l = [
|
|
394
394
|
{
|
|
395
395
|
internalId: "root",
|
|
396
396
|
label: "Structure imbriquée complexe",
|
|
397
|
-
iconType:
|
|
397
|
+
iconType: t.FOLDER,
|
|
398
398
|
children: [
|
|
399
399
|
{
|
|
400
400
|
internalId: "level1-1",
|
|
401
401
|
label: "Niveau 1.1",
|
|
402
|
-
iconType:
|
|
402
|
+
iconType: t.FOLDER,
|
|
403
403
|
children: [
|
|
404
404
|
{
|
|
405
405
|
internalId: "level2-1",
|
|
406
406
|
label: "Niveau 2.1",
|
|
407
|
-
iconType:
|
|
407
|
+
iconType: t.FOLDER,
|
|
408
408
|
children: [
|
|
409
409
|
{
|
|
410
410
|
internalId: "level3-1V",
|
|
411
411
|
label: "VOUS M'AVEZ TROUVÉ HIHIHI",
|
|
412
|
-
iconType:
|
|
412
|
+
iconType: t.FOLDER
|
|
413
413
|
},
|
|
414
414
|
{
|
|
415
415
|
internalId: "level3-2",
|
|
416
416
|
label: "Niveau 3.2",
|
|
417
|
-
iconType:
|
|
417
|
+
iconType: t.SHARE
|
|
418
418
|
}
|
|
419
419
|
]
|
|
420
420
|
},
|
|
421
421
|
{
|
|
422
422
|
internalId: "level2-2",
|
|
423
423
|
label: "Niveau 2.2",
|
|
424
|
-
iconType:
|
|
424
|
+
iconType: t.TRASH
|
|
425
425
|
}
|
|
426
426
|
]
|
|
427
427
|
},
|
|
428
428
|
{
|
|
429
429
|
internalId: "level1-2",
|
|
430
430
|
label: "Niveau 1.2",
|
|
431
|
-
iconType:
|
|
432
|
-
customIcon:
|
|
431
|
+
iconType: t.CUSTOM,
|
|
432
|
+
customIcon: q
|
|
433
433
|
}
|
|
434
434
|
]
|
|
435
435
|
}
|
|
436
|
-
], [r,
|
|
437
|
-
(
|
|
438
|
-
console.log(`Élément sélectionné: ${c}`), c &&
|
|
436
|
+
], [r, o] = b("level2-1"), s = x(
|
|
437
|
+
(n, c) => {
|
|
438
|
+
console.log(`Élément sélectionné: ${c}`), c && o(c);
|
|
439
439
|
},
|
|
440
440
|
[]
|
|
441
441
|
);
|
|
442
442
|
return /* @__PURE__ */ e(a, { sx: { maxWidth: 400, overflowY: "hidden" }, children: /* @__PURE__ */ e(
|
|
443
443
|
p,
|
|
444
444
|
{
|
|
445
|
-
items:
|
|
445
|
+
items: l,
|
|
446
446
|
selectedItemId: r,
|
|
447
|
-
handleSelectedItemChange:
|
|
447
|
+
handleSelectedItemChange: s
|
|
448
448
|
}
|
|
449
449
|
) });
|
|
450
450
|
},
|
|
@@ -459,7 +459,7 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
459
459
|
}
|
|
460
460
|
}, pe = {
|
|
461
461
|
render: () => {
|
|
462
|
-
const
|
|
462
|
+
const l = ["primary", "secondary", "info"], [r, o] = b({
|
|
463
463
|
primary: "",
|
|
464
464
|
secondary: "",
|
|
465
465
|
info: ""
|
|
@@ -473,7 +473,7 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
473
473
|
gap: 3,
|
|
474
474
|
overflowY: "hidden"
|
|
475
475
|
},
|
|
476
|
-
children:
|
|
476
|
+
children: l.map((s) => /* @__PURE__ */ i(
|
|
477
477
|
a,
|
|
478
478
|
{
|
|
479
479
|
sx: {
|
|
@@ -481,24 +481,24 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
481
481
|
overflowY: "hidden"
|
|
482
482
|
},
|
|
483
483
|
children: [
|
|
484
|
-
/* @__PURE__ */
|
|
484
|
+
/* @__PURE__ */ i(d, { variant: "subtitle2", gutterBottom: !0, children: [
|
|
485
485
|
"Icônes ",
|
|
486
|
-
|
|
486
|
+
s
|
|
487
487
|
] }),
|
|
488
488
|
/* @__PURE__ */ e(
|
|
489
489
|
p,
|
|
490
490
|
{
|
|
491
|
-
items:
|
|
492
|
-
selectedItemId: r[
|
|
493
|
-
handleSelectedItemChange: (
|
|
494
|
-
c &&
|
|
491
|
+
items: w,
|
|
492
|
+
selectedItemId: r[s],
|
|
493
|
+
handleSelectedItemChange: (n, c) => {
|
|
494
|
+
c && o((u) => ({ ...u, [s]: c }));
|
|
495
495
|
},
|
|
496
|
-
iconColor:
|
|
496
|
+
iconColor: s
|
|
497
497
|
}
|
|
498
498
|
)
|
|
499
499
|
]
|
|
500
500
|
},
|
|
501
|
-
|
|
501
|
+
s
|
|
502
502
|
))
|
|
503
503
|
}
|
|
504
504
|
);
|
|
@@ -514,53 +514,53 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
514
514
|
}
|
|
515
515
|
}, he = {
|
|
516
516
|
render: () => {
|
|
517
|
-
const
|
|
518
|
-
var u,
|
|
517
|
+
const l = () => {
|
|
518
|
+
var u, T;
|
|
519
519
|
const c = [];
|
|
520
|
-
for (let
|
|
521
|
-
const
|
|
522
|
-
internalId: `main-folder-${
|
|
523
|
-
label: `Dossier principal ${
|
|
524
|
-
iconType:
|
|
520
|
+
for (let I = 1; I <= 5; I++) {
|
|
521
|
+
const S = {
|
|
522
|
+
internalId: `main-folder-${I}`,
|
|
523
|
+
label: `Dossier principal ${I}`,
|
|
524
|
+
iconType: t.FOLDER,
|
|
525
525
|
children: []
|
|
526
526
|
};
|
|
527
527
|
for (let m = 1; m <= 10; m++) {
|
|
528
|
-
const
|
|
529
|
-
internalId: `subfolder-${
|
|
530
|
-
label: `Sous-dossier ${
|
|
531
|
-
iconType:
|
|
528
|
+
const g = {
|
|
529
|
+
internalId: `subfolder-${I}-${m}`,
|
|
530
|
+
label: `Sous-dossier ${I}.${m}`,
|
|
531
|
+
iconType: t.FOLDER,
|
|
532
532
|
children: []
|
|
533
533
|
};
|
|
534
|
-
for (let
|
|
535
|
-
(u =
|
|
536
|
-
internalId: `item-${
|
|
537
|
-
label: `Élément ${
|
|
538
|
-
iconType:
|
|
539
|
-
customIcon:
|
|
534
|
+
for (let v = 1; v <= 5; v++)
|
|
535
|
+
(u = g.children) == null || u.push({
|
|
536
|
+
internalId: `item-${I}-${m}-${v}`,
|
|
537
|
+
label: `Élément ${I}.${m}.${v}`,
|
|
538
|
+
iconType: t.CUSTOM,
|
|
539
|
+
customIcon: L
|
|
540
540
|
});
|
|
541
|
-
(
|
|
541
|
+
(T = S.children) == null || T.push(g);
|
|
542
542
|
}
|
|
543
|
-
c.push(
|
|
543
|
+
c.push(S);
|
|
544
544
|
}
|
|
545
545
|
return c;
|
|
546
|
-
}, [r,
|
|
546
|
+
}, [r, o] = b(""), s = l(), n = x(
|
|
547
547
|
(c, u) => {
|
|
548
|
-
u &&
|
|
548
|
+
u && o(u);
|
|
549
549
|
},
|
|
550
550
|
[]
|
|
551
551
|
);
|
|
552
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ i(a, { children: [
|
|
553
553
|
/* @__PURE__ */ e(d, { variant: "h6", gutterBottom: !0, children: "TreeView avec hauteur limitée et défilement vertical" }),
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */ e(
|
|
554
|
+
/* @__PURE__ */ i(h, { container: !0, spacing: 3, children: [
|
|
555
|
+
/* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
|
|
556
556
|
/* @__PURE__ */ e(d, { variant: "subtitle2", gutterBottom: !0, children: "Hauteur maximale de 300px avec overflow" }),
|
|
557
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ i(a, { sx: { border: "1px solid #e0e0e0", borderRadius: 1 }, children: [
|
|
558
558
|
/* @__PURE__ */ e(
|
|
559
559
|
p,
|
|
560
560
|
{
|
|
561
|
-
items:
|
|
561
|
+
items: s,
|
|
562
562
|
selectedItemId: r,
|
|
563
|
-
handleSelectedItemChange:
|
|
563
|
+
handleSelectedItemChange: n,
|
|
564
564
|
maxHeight: 300
|
|
565
565
|
}
|
|
566
566
|
),
|
|
@@ -578,19 +578,19 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
578
578
|
)
|
|
579
579
|
] })
|
|
580
580
|
] }) }),
|
|
581
|
-
/* @__PURE__ */ e(
|
|
581
|
+
/* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
|
|
582
582
|
/* @__PURE__ */ e(d, { variant: "subtitle2", gutterBottom: !0, children: "Hauteur maximale de 500px avec overflow" }),
|
|
583
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ i(a, { sx: { border: "1px solid #e0e0e0", borderRadius: 1 }, children: [
|
|
584
584
|
/* @__PURE__ */ e(
|
|
585
585
|
p,
|
|
586
586
|
{
|
|
587
|
-
items:
|
|
587
|
+
items: s,
|
|
588
588
|
selectedItemId: r,
|
|
589
|
-
handleSelectedItemChange:
|
|
589
|
+
handleSelectedItemChange: n,
|
|
590
590
|
maxHeight: 500
|
|
591
591
|
}
|
|
592
592
|
),
|
|
593
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ i(
|
|
594
594
|
a,
|
|
595
595
|
{
|
|
596
596
|
sx: {
|
|
@@ -601,49 +601,49 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
601
601
|
borderTop: "1px solid #e0e0e0"
|
|
602
602
|
},
|
|
603
603
|
children: [
|
|
604
|
-
/* @__PURE__ */ e(
|
|
605
|
-
/* @__PURE__ */ e(
|
|
604
|
+
/* @__PURE__ */ e(y, { size: "small", variant: "outlined", children: "Annuler" }),
|
|
605
|
+
/* @__PURE__ */ e(y, { size: "small", variant: "contained", children: "Confirmer" })
|
|
606
606
|
]
|
|
607
607
|
}
|
|
608
608
|
)
|
|
609
609
|
] })
|
|
610
610
|
] }) })
|
|
611
611
|
] }),
|
|
612
|
-
/* @__PURE__ */ e(a, { mt: 4, children: /* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ e(a, { mt: 4, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
|
|
613
613
|
/* @__PURE__ */ e(d, { variant: "subtitle2", gutterBottom: !0, children: "TreeView expansé manuellement" }),
|
|
614
|
-
/* @__PURE__ */
|
|
614
|
+
/* @__PURE__ */ i(a, { sx: { display: "flex", mb: 2 }, children: [
|
|
615
615
|
/* @__PURE__ */ e(
|
|
616
|
-
|
|
616
|
+
y,
|
|
617
617
|
{
|
|
618
618
|
variant: "outlined",
|
|
619
|
-
onClick: () =>
|
|
619
|
+
onClick: () => o("subfolder-1-1"),
|
|
620
620
|
sx: { mr: 1 },
|
|
621
621
|
children: "Sélectionner Sous-dossier 1.1"
|
|
622
622
|
}
|
|
623
623
|
),
|
|
624
624
|
/* @__PURE__ */ e(
|
|
625
|
-
|
|
625
|
+
y,
|
|
626
626
|
{
|
|
627
627
|
variant: "outlined",
|
|
628
|
-
onClick: () =>
|
|
628
|
+
onClick: () => o("item-3-5-2"),
|
|
629
629
|
children: "Sélectionner Élément 3.5.2"
|
|
630
630
|
}
|
|
631
631
|
)
|
|
632
632
|
] }),
|
|
633
|
-
/* @__PURE__ */
|
|
633
|
+
/* @__PURE__ */ i(a, { sx: { borderRadius: 1, border: "1px solid #e0e0e0" }, children: [
|
|
634
634
|
/* @__PURE__ */ e(
|
|
635
635
|
p,
|
|
636
636
|
{
|
|
637
|
-
items:
|
|
637
|
+
items: s,
|
|
638
638
|
selectedItemId: r,
|
|
639
|
-
handleSelectedItemChange:
|
|
639
|
+
handleSelectedItemChange: n,
|
|
640
640
|
maxHeight: 400
|
|
641
641
|
}
|
|
642
642
|
),
|
|
643
|
-
/* @__PURE__ */ e(
|
|
644
|
-
/* @__PURE__ */
|
|
643
|
+
/* @__PURE__ */ e(F, {}),
|
|
644
|
+
/* @__PURE__ */ i(a, { sx: { p: 2, display: "flex", alignItems: "center" }, children: [
|
|
645
645
|
/* @__PURE__ */ e(d, { variant: "body2", sx: { flexGrow: 1 }, children: r ? `Élément sélectionné: ${r}` : "Aucun élément sélectionné" }),
|
|
646
|
-
/* @__PURE__ */ e(B, { title: "Ce bandeau reste fixé sous l'arborescence", children: /* @__PURE__ */ e(k, { size: "small", color: "info", children: /* @__PURE__ */ e(
|
|
646
|
+
/* @__PURE__ */ e(B, { title: "Ce bandeau reste fixé sous l'arborescence", children: /* @__PURE__ */ e(k, { size: "small", color: "info", children: /* @__PURE__ */ e(U, { fontSize: "small" }) }) })
|
|
647
647
|
] })
|
|
648
648
|
] })
|
|
649
649
|
] }) })
|
|
@@ -660,50 +660,50 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
660
660
|
}
|
|
661
661
|
}, Ie = {
|
|
662
662
|
render: () => {
|
|
663
|
-
const [
|
|
663
|
+
const [l, r] = b("reports"), o = (c, u) => {
|
|
664
664
|
console.log("TreeView sélection:", u), u && r(u);
|
|
665
|
-
},
|
|
665
|
+
}, s = (c) => {
|
|
666
666
|
console.log("Sélection externe:", c), r(c);
|
|
667
667
|
};
|
|
668
|
-
return /* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ i(a, { sx: { width: "100%", overflowY: "hidden" }, children: [
|
|
669
|
+
/* @__PURE__ */ i(d, { variant: "subtitle1", gutterBottom: !0, children: [
|
|
670
670
|
"Élément sélectionné: ",
|
|
671
671
|
/* @__PURE__ */ e("strong", { children: (() => {
|
|
672
|
-
const u =
|
|
673
|
-
(
|
|
672
|
+
const u = V(R).find(
|
|
673
|
+
(T) => T.internalId === l
|
|
674
674
|
);
|
|
675
675
|
return u ? u.label : "Aucun élément sélectionné";
|
|
676
676
|
})() }),
|
|
677
677
|
" (ID:",
|
|
678
678
|
" ",
|
|
679
|
-
|
|
679
|
+
l,
|
|
680
680
|
")"
|
|
681
681
|
] }),
|
|
682
682
|
/* @__PURE__ */ e(
|
|
683
|
-
|
|
683
|
+
N,
|
|
684
684
|
{
|
|
685
685
|
items: R,
|
|
686
|
-
onRandomSelect:
|
|
686
|
+
onRandomSelect: s
|
|
687
687
|
}
|
|
688
688
|
),
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */ e(
|
|
689
|
+
/* @__PURE__ */ i(h, { container: !0, spacing: 3, sx: { overflowY: "hidden" }, children: [
|
|
690
|
+
/* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2, overflowY: "hidden" }, children: [
|
|
691
691
|
/* @__PURE__ */ e(d, { variant: "h6", gutterBottom: !0, children: "TreeView" }),
|
|
692
692
|
/* @__PURE__ */ e(
|
|
693
693
|
p,
|
|
694
694
|
{
|
|
695
695
|
items: R,
|
|
696
|
-
selectedItemId:
|
|
697
|
-
handleSelectedItemChange:
|
|
696
|
+
selectedItemId: l,
|
|
697
|
+
handleSelectedItemChange: o
|
|
698
698
|
}
|
|
699
699
|
)
|
|
700
700
|
] }) }),
|
|
701
|
-
/* @__PURE__ */ e(
|
|
702
|
-
|
|
701
|
+
/* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ e(
|
|
702
|
+
Y,
|
|
703
703
|
{
|
|
704
704
|
items: R,
|
|
705
|
-
selectedItemId:
|
|
706
|
-
onItemSelect:
|
|
705
|
+
selectedItemId: l,
|
|
706
|
+
onItemSelect: s
|
|
707
707
|
}
|
|
708
708
|
) })
|
|
709
709
|
] })
|
|
@@ -720,35 +720,35 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
720
720
|
}
|
|
721
721
|
}, be = {
|
|
722
722
|
render: () => {
|
|
723
|
-
var
|
|
724
|
-
const [
|
|
725
|
-
...
|
|
726
|
-
]), [
|
|
723
|
+
var I, S;
|
|
724
|
+
const [l, r] = b([
|
|
725
|
+
...w
|
|
726
|
+
]), [o, s] = b("folder1"), [n, c] = b(null), u = [
|
|
727
727
|
{ id: "doc1", label: "Document 1" },
|
|
728
728
|
{ id: "doc2", label: "Document 2" },
|
|
729
729
|
{ id: "doc3", label: "Document 3" }
|
|
730
|
-
],
|
|
730
|
+
], T = (m) => {
|
|
731
731
|
m.preventDefault();
|
|
732
|
-
const
|
|
733
|
-
let
|
|
734
|
-
|
|
732
|
+
const g = m.target, v = g.closest("[data-treeview-item]");
|
|
733
|
+
let D = null, E = null;
|
|
734
|
+
v ? (D = v.getAttribute("data-treeview-item"), E = v.getAttribute("data-treeview-item-label")) : g.closest("[data-treeview-root]") && (D = null, E = "Racine du TreeView");
|
|
735
735
|
try {
|
|
736
736
|
const C = JSON.parse(m.dataTransfer.getData("application/json"));
|
|
737
737
|
c({
|
|
738
|
-
itemId:
|
|
738
|
+
itemId: D,
|
|
739
739
|
itemLabel: E,
|
|
740
740
|
droppedItem: C
|
|
741
|
-
}),
|
|
741
|
+
}), D && s(D);
|
|
742
742
|
} catch (C) {
|
|
743
743
|
console.error("Erreur lors de la récupération des données", C);
|
|
744
744
|
}
|
|
745
745
|
};
|
|
746
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ i(a, { sx: { maxWidth: 700, overflowY: "hidden" }, children: [
|
|
747
747
|
/* @__PURE__ */ e(d, { variant: "h6", gutterBottom: !0, children: "Exemple de Drag & Drop avec le TreeView" }),
|
|
748
748
|
/* @__PURE__ */ e(d, { variant: "body2", gutterBottom: !0, children: "Glissez-déposez un des documents ci-dessous sur un élément du TreeView." }),
|
|
749
|
-
/* @__PURE__ */ e(a, { sx: { display: "flex", mb: 2 }, children: u.map((m) => /* @__PURE__ */ e(
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */ e(
|
|
749
|
+
/* @__PURE__ */ e(a, { sx: { display: "flex", mb: 2 }, children: u.map((m) => /* @__PURE__ */ e(j, { id: m.id, label: m.label }, m.id)) }),
|
|
750
|
+
/* @__PURE__ */ i(h, { container: !0, spacing: 3, children: [
|
|
751
|
+
/* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(
|
|
752
752
|
a,
|
|
753
753
|
{
|
|
754
754
|
sx: {
|
|
@@ -760,44 +760,44 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
|
|
|
760
760
|
backgroundColor: "background.paper"
|
|
761
761
|
},
|
|
762
762
|
onDragOver: (m) => m.preventDefault(),
|
|
763
|
-
onDrop:
|
|
763
|
+
onDrop: T,
|
|
764
764
|
children: [
|
|
765
765
|
/* @__PURE__ */ e(d, { variant: "subtitle1", gutterBottom: !0, children: "Zone de drop" }),
|
|
766
766
|
/* @__PURE__ */ e(
|
|
767
767
|
p,
|
|
768
768
|
{
|
|
769
|
-
items:
|
|
770
|
-
selectedItemId:
|
|
771
|
-
handleSelectedItemChange: (m,
|
|
772
|
-
|
|
769
|
+
items: l,
|
|
770
|
+
selectedItemId: o,
|
|
771
|
+
handleSelectedItemChange: (m, g) => {
|
|
772
|
+
g && s(g);
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
)
|
|
776
776
|
]
|
|
777
777
|
}
|
|
778
778
|
) }),
|
|
779
|
-
/* @__PURE__ */ e(
|
|
779
|
+
/* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2, minHeight: 300 }, children: [
|
|
780
780
|
/* @__PURE__ */ e(d, { variant: "subtitle1", gutterBottom: !0, children: "Informations du dernier drop" }),
|
|
781
|
-
|
|
782
|
-
/* @__PURE__ */
|
|
781
|
+
n ? /* @__PURE__ */ i(a, { children: [
|
|
782
|
+
/* @__PURE__ */ i(d, { variant: "body2", children: [
|
|
783
783
|
/* @__PURE__ */ e("strong", { children: "Élément cible :" }),
|
|
784
784
|
" ",
|
|
785
|
-
|
|
785
|
+
n.itemLabel,
|
|
786
786
|
" ",
|
|
787
|
-
|
|
787
|
+
n.itemId && `(ID: ${n.itemId})`
|
|
788
788
|
] }),
|
|
789
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ i(d, { variant: "body2", children: [
|
|
790
790
|
/* @__PURE__ */ e("strong", { children: "Élément déposé :" }),
|
|
791
791
|
" ",
|
|
792
|
-
(
|
|
792
|
+
(I = n.droppedItem) == null ? void 0 : I.label,
|
|
793
793
|
" (ID:",
|
|
794
794
|
" ",
|
|
795
|
-
(
|
|
795
|
+
(S = n.droppedItem) == null ? void 0 : S.id,
|
|
796
796
|
")"
|
|
797
797
|
] }),
|
|
798
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ i(a, { sx: { mt: 2 }, children: [
|
|
799
799
|
/* @__PURE__ */ e(d, { variant: "body2", children: /* @__PURE__ */ e("strong", { children: "Code pour gérer ce drop :" }) }),
|
|
800
|
-
/* @__PURE__ */ e(
|
|
800
|
+
/* @__PURE__ */ e(f, { sx: { p: 1, mt: 1, backgroundColor: "grey.100" }, children: /* @__PURE__ */ e(
|
|
801
801
|
"pre",
|
|
802
802
|
{
|
|
803
803
|
style: {
|
|
@@ -842,6 +842,183 @@ const handleDrop = (e) => {
|
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
|
+
}, fe = {
|
|
846
|
+
render: () => {
|
|
847
|
+
const l = [
|
|
848
|
+
{
|
|
849
|
+
internalId: "root-1",
|
|
850
|
+
label: "Dossier principal",
|
|
851
|
+
iconType: t.FOLDER,
|
|
852
|
+
children: [
|
|
853
|
+
{
|
|
854
|
+
internalId: "folder-1-1",
|
|
855
|
+
label: "Sous-dossier avec un nom très long pour tester",
|
|
856
|
+
iconType: t.FOLDER,
|
|
857
|
+
children: [
|
|
858
|
+
{
|
|
859
|
+
internalId: "file-1-1-1",
|
|
860
|
+
label: "Document A",
|
|
861
|
+
iconType: t.CUSTOM,
|
|
862
|
+
customIcon: L
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
internalId: "folder-1-1-2",
|
|
866
|
+
label: "Sous-sous-dossier",
|
|
867
|
+
iconType: t.FOLDER,
|
|
868
|
+
children: [
|
|
869
|
+
{
|
|
870
|
+
internalId: "file-1-1-2-1",
|
|
871
|
+
label: "Image.jpg",
|
|
872
|
+
iconType: t.CUSTOM
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
internalId: "file-1-1-2-2",
|
|
876
|
+
label: "Document.pdf",
|
|
877
|
+
iconType: t.CUSTOM,
|
|
878
|
+
children: [
|
|
879
|
+
{
|
|
880
|
+
internalId: "file-1-1-2-7",
|
|
881
|
+
label: "Image.jpg",
|
|
882
|
+
iconType: t.CUSTOM
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
internalId: "file-1-1-2-18",
|
|
886
|
+
label: "Document.pdf",
|
|
887
|
+
iconType: t.CUSTOM
|
|
888
|
+
}
|
|
889
|
+
]
|
|
890
|
+
}
|
|
891
|
+
]
|
|
892
|
+
}
|
|
893
|
+
]
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
internalId: "folder-1-2",
|
|
897
|
+
label: "Court",
|
|
898
|
+
iconType: t.FOLDER,
|
|
899
|
+
children: [
|
|
900
|
+
{
|
|
901
|
+
internalId: "file-1-2-1",
|
|
902
|
+
label: "Fichier",
|
|
903
|
+
iconType: t.CUSTOM
|
|
904
|
+
}
|
|
905
|
+
]
|
|
906
|
+
}
|
|
907
|
+
]
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
internalId: "root-2",
|
|
911
|
+
label: "Second dossier principal",
|
|
912
|
+
iconType: t.FOLDER,
|
|
913
|
+
children: [
|
|
914
|
+
{
|
|
915
|
+
internalId: "folder-2-1",
|
|
916
|
+
label: "Sous-dossier A",
|
|
917
|
+
iconType: t.FOLDER
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
internalId: "folder-2-2",
|
|
921
|
+
label: "Sous-dossier B",
|
|
922
|
+
iconType: t.FOLDER,
|
|
923
|
+
children: []
|
|
924
|
+
}
|
|
925
|
+
]
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
internalId: "root-3",
|
|
929
|
+
label: "Troisième dossier principal",
|
|
930
|
+
iconType: t.FOLDER,
|
|
931
|
+
children: [
|
|
932
|
+
{
|
|
933
|
+
internalId: "folder-3-1",
|
|
934
|
+
label: "Sous-dossier X",
|
|
935
|
+
iconType: t.FOLDER,
|
|
936
|
+
children: [
|
|
937
|
+
{
|
|
938
|
+
internalId: "file-3-1-1",
|
|
939
|
+
label: "Fichier X-1",
|
|
940
|
+
iconType: t.CUSTOM
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
internalId: "file-3-1-2",
|
|
944
|
+
label: "Fichier X-2",
|
|
945
|
+
iconType: t.CUSTOM
|
|
946
|
+
}
|
|
947
|
+
]
|
|
948
|
+
}
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
], [r, o] = b(""), s = x(
|
|
952
|
+
(n, c) => {
|
|
953
|
+
c && o(c);
|
|
954
|
+
},
|
|
955
|
+
[]
|
|
956
|
+
);
|
|
957
|
+
return /* @__PURE__ */ i(a, { sx: { p: 2 }, children: [
|
|
958
|
+
/* @__PURE__ */ e(d, { variant: "h5", gutterBottom: !0, children: "Test d'alignement des lignes verticales" }),
|
|
959
|
+
/* @__PURE__ */ e(d, { variant: "body2", color: "text.secondary", paragraph: !0, children: "Cette story permet de vérifier si les lignes verticales s'arrêtent toutes au même niveau, indépendamment de la taille des éléments. Essayez d'expandre et de collapser les différents niveaux." }),
|
|
960
|
+
/* @__PURE__ */ i(h, { container: !0, spacing: 3, children: [
|
|
961
|
+
/* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
|
|
962
|
+
/* @__PURE__ */ e(d, { variant: "subtitle1", gutterBottom: !0, children: "TreeView avec plusieurs niveaux imbriqués" }),
|
|
963
|
+
/* @__PURE__ */ e(a, { sx: { border: "1px solid #e0e0e0", borderRadius: 1 }, children: /* @__PURE__ */ e(
|
|
964
|
+
p,
|
|
965
|
+
{
|
|
966
|
+
items: l,
|
|
967
|
+
selectedItemId: r,
|
|
968
|
+
handleSelectedItemChange: s,
|
|
969
|
+
maxHeight: 400
|
|
970
|
+
}
|
|
971
|
+
) })
|
|
972
|
+
] }) }),
|
|
973
|
+
/* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
|
|
974
|
+
/* @__PURE__ */ e(d, { variant: "subtitle1", gutterBottom: !0, children: "Détails de l'élément sélectionné" }),
|
|
975
|
+
/* @__PURE__ */ e(
|
|
976
|
+
a,
|
|
977
|
+
{
|
|
978
|
+
sx: {
|
|
979
|
+
p: 2,
|
|
980
|
+
backgroundColor: "#f5f5f5",
|
|
981
|
+
borderRadius: 1,
|
|
982
|
+
minHeight: 100
|
|
983
|
+
},
|
|
984
|
+
children: r ? /* @__PURE__ */ i(d, { children: [
|
|
985
|
+
"Élément sélectionné: ",
|
|
986
|
+
/* @__PURE__ */ e("strong", { children: r })
|
|
987
|
+
] }) : /* @__PURE__ */ e(d, { color: "text.secondary", children: "Aucun élément sélectionné. Cliquez sur un élément dans l'arborescence." })
|
|
988
|
+
}
|
|
989
|
+
),
|
|
990
|
+
/* @__PURE__ */ i(a, { sx: { mt: 2 }, children: [
|
|
991
|
+
/* @__PURE__ */ e(
|
|
992
|
+
y,
|
|
993
|
+
{
|
|
994
|
+
variant: "outlined",
|
|
995
|
+
onClick: () => o("file-1-1-2-1"),
|
|
996
|
+
sx: { mr: 1 },
|
|
997
|
+
children: 'Sélectionner "Image.jpg"'
|
|
998
|
+
}
|
|
999
|
+
),
|
|
1000
|
+
/* @__PURE__ */ e(
|
|
1001
|
+
y,
|
|
1002
|
+
{
|
|
1003
|
+
variant: "outlined",
|
|
1004
|
+
onClick: () => o("folder-3-1"),
|
|
1005
|
+
children: 'Sélectionner "Sous-dossier X"'
|
|
1006
|
+
}
|
|
1007
|
+
)
|
|
1008
|
+
] })
|
|
1009
|
+
] }) })
|
|
1010
|
+
] })
|
|
1011
|
+
] });
|
|
1012
|
+
},
|
|
1013
|
+
parameters: {
|
|
1014
|
+
controls: { disable: !0 },
|
|
1015
|
+
actions: { disable: !0 },
|
|
1016
|
+
docs: {
|
|
1017
|
+
description: {
|
|
1018
|
+
story: "Cette story permet de tester si les lignes verticales du TreeView s'alignent correctement. Elle utilise une arborescence à plusieurs niveaux avec des éléments de différentes tailles et labels de différentes longueurs pour mettre en évidence le comportement des lignes. Vérifiez que toutes les lignes verticales s'arrêtent au même niveau, créant ainsi une structure d'arborescence propre et cohérente."
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
845
1022
|
};
|
|
846
1023
|
export {
|
|
847
1024
|
be as AvecDragAndDrop,
|
|
@@ -853,5 +1030,6 @@ export {
|
|
|
853
1030
|
me as SansIcones,
|
|
854
1031
|
ue as StructureImbriquee,
|
|
855
1032
|
Ie as Synchronicite,
|
|
1033
|
+
fe as TestAlignementLignes,
|
|
856
1034
|
se as default
|
|
857
1035
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgi-learning-hub/ui",
|
|
3
|
-
"version": "1.5.0-dev.
|
|
3
|
+
"version": "1.5.0-dev.1743522751",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "CGI Learning-hub Team",
|
|
6
6
|
"description": "@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features",
|