@cgi-learning-hub/ui 1.4.0-dev.1741961819 → 1.4.0-dev.1741972878
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/Delete-CbtdIdDB.js +8 -0
- package/dist/Delete-DmeDAs0n.cjs +1 -0
- package/dist/components/ImagePicker/ImagePicker.cjs.js +1 -1
- package/dist/components/ImagePicker/ImagePicker.es.js +44 -45
- package/dist/components/TreeView/TreeView.cjs.js +9 -9
- package/dist/components/TreeView/TreeView.d.ts +23 -5
- package/dist/components/TreeView/TreeView.es.js +1008 -928
- package/dist/components/TreeView/index.cjs.js +1 -1
- package/dist/components/TreeView/index.es.js +3 -2
- package/dist/components/stories/TreeView.stories.cjs.js +29 -1
- package/dist/components/stories/TreeView.stories.d.ts +2 -2
- package/dist/components/stories/TreeView.stories.es.js +173 -44
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TreeView.cjs.js");exports.TreeView=e;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TreeView.cjs.js");exports.ICON_TYPE=e.ICON_TYPE;exports.TreeView=e.default;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),t=require("../../createSvgIcon-DJMYlO0S.cjs"),e=require("../TreeView/TreeView.cjs.js"),s=t.createSvgIcon(i.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"),r=t.createSvgIcon(i.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"),l={title:"Components/TreeView",component:e.default,argTypes:{items:{description:"Liste des éléments à afficher dans le TreeView.",control:"object",table:{type:{summary:"CustomTreeViewItem[]"}}},onItemSelect:{description:"Fonction appelée lorsqu'un élément est sélectionné.",control:"none",table:{type:{summary:"(event: React.SyntheticEvent, itemId: string) => void"}}}},parameters:{docs:{description:{component:`
|
|
2
|
+
## TreeView
|
|
3
|
+
|
|
4
|
+
Un composant pour afficher des données hiérarchiques sous forme d'arborescence.
|
|
5
|
+
|
|
6
|
+
### Utilisation des icônes
|
|
7
|
+
|
|
8
|
+
Le TreeView permet de personnaliser les icônes selon les types suivants:
|
|
9
|
+
- \`ICON_TYPE.FOLDER\`: Icône de dossier (défaut)
|
|
10
|
+
- \`ICON_TYPE.SHARE\`: Icône de partage
|
|
11
|
+
- \`ICON_TYPE.TRASH\`: Icône de corbeille
|
|
12
|
+
- \`ICON_TYPE.CUSTOM\`: Icône personnalisée (nécessite de définir \`customIcon\`)
|
|
13
|
+
|
|
14
|
+
Vous pouvez également passer directement un composant SvgIcon comme valeur de \`iconType\`.
|
|
15
|
+
|
|
16
|
+
### Structure des données
|
|
17
|
+
|
|
18
|
+
Le composant attend un tableau d'objets \`CustomTreeViewItem\` qui étend l'interface \`TreeViewBaseItem\` de MUI:
|
|
19
|
+
|
|
20
|
+
\`\`\`typescript
|
|
21
|
+
interface CustomTreeViewItem extends TreeViewBaseItem {
|
|
22
|
+
id: string; // Identifiant unique de l'élément (obligatoire)
|
|
23
|
+
label: string; // Libellé à afficher (obligatoire)
|
|
24
|
+
children?: CustomTreeViewItem[]; // Sous-éléments (facultatif)
|
|
25
|
+
iconType?: IconType; // Type d'icône (facultatif)
|
|
26
|
+
customIcon?: SvgIconComponent; // Icône personnalisée si iconType est CUSTOM (facultatif)
|
|
27
|
+
}
|
|
28
|
+
\`\`\`
|
|
29
|
+
`}}}},c=[{id:"documents",label:"Mes formulaires",iconType:e.ICON_TYPE.FOLDER,children:[{id:"folder1",label:"Premier dossier",iconType:e.ICON_TYPE.FOLDER,children:[{id:"subfolder1",label:"Sous-dossier 1",iconType:e.ICON_TYPE.FOLDER},{id:"subfolder2",label:"Sous-dossier 2",iconType:e.ICON_TYPE.FOLDER}]},{id:"folder2",label:"Deuxième dossier",iconType:e.ICON_TYPE.FOLDER},{id:"folder3",label:"Troisième dossier",iconType:e.ICON_TYPE.FOLDER}]},{id:"shared",label:"Formulaires partagés avec moi",iconType:e.ICON_TYPE.SHARE},{id:"trash",label:"Corbeille",iconType:e.ICON_TYPE.TRASH}],a=[{id:"bookmarks",label:"Favoris",iconType:s,children:[{id:"important",label:"Important",iconType:e.ICON_TYPE.CUSTOM,customIcon:r}]},...c],d={args:{items:c,onItemSelect:(n,o)=>{console.log(`Élément sélectionné: ${o}`)}},parameters:{docs:{description:{story:"Exemple de base avec des icônes standard."}}}},m={args:{items:a,onItemSelect:(n,o)=>{console.log(`Élément sélectionné: ${o}`)}},parameters:{docs:{description:{story:"Exemple utilisant à la fois des icônes prédéfinies et des icônes personnalisées."}}}},u={args:{items:[{id:"root",label:"Structure imbriquée complexe",iconType:e.ICON_TYPE.FOLDER,children:[{id:"level1-1",label:"Niveau 1.1",iconType:e.ICON_TYPE.FOLDER,children:[{id:"level2-1",label:"Niveau 2.1",iconType:e.ICON_TYPE.FOLDER,children:[{id:"level3-1",label:"Niveau 3.1",iconType:e.ICON_TYPE.FOLDER},{id:"level3-2",label:"Niveau 3.2",iconType:e.ICON_TYPE.SHARE}]},{id:"level2-2",label:"Niveau 2.2",iconType:e.ICON_TYPE.TRASH}]},{id:"level1-2",label:"Niveau 1.2",iconType:e.ICON_TYPE.CUSTOM,customIcon:s}]}],onItemSelect:(n,o)=>{console.log(`Élément sélectionné: ${o}`)}},parameters:{docs:{description:{story:"Exemple d'une structure profondément imbriquée avec différents types d'icônes à chaque niveau."}}}};exports.AvecIconesPersonnalisees=m;exports.Default=d;exports.StructureImbriquee=u;exports.default=l;
|
|
@@ -4,5 +4,5 @@ declare const meta: Meta<typeof TreeView>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof TreeView>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
7
|
+
export declare const AvecIconesPersonnalisees: Story;
|
|
8
|
+
export declare const StructureImbriquee: Story;
|
|
@@ -1,86 +1,215 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
d: "
|
|
6
|
-
}), "
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { c as s } from "../../createSvgIcon-K1Hd8ryN.js";
|
|
3
|
+
import r, { ICON_TYPE as e } from "../TreeView/TreeView.es.js";
|
|
4
|
+
const t = s(/* @__PURE__ */ n("path", {
|
|
5
|
+
d: "M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"
|
|
6
|
+
}), "Bookmark"), l = s(/* @__PURE__ */ n("path", {
|
|
7
|
+
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"
|
|
8
|
+
}), "Person"), u = {
|
|
7
9
|
title: "Components/TreeView",
|
|
8
|
-
component:
|
|
10
|
+
component: r,
|
|
9
11
|
argTypes: {
|
|
10
12
|
items: {
|
|
11
13
|
description: "Liste des éléments à afficher dans le TreeView.",
|
|
12
14
|
control: "object",
|
|
13
15
|
table: {
|
|
14
|
-
type: { summary: "
|
|
16
|
+
type: { summary: "CustomTreeViewItem[]" }
|
|
15
17
|
}
|
|
16
18
|
},
|
|
17
19
|
onItemSelect: {
|
|
18
20
|
description: "Fonction appelée lorsqu'un élément est sélectionné.",
|
|
21
|
+
control: "none",
|
|
19
22
|
table: {
|
|
20
23
|
type: {
|
|
21
24
|
summary: "(event: React.SyntheticEvent, itemId: string) => void"
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
parameters: {
|
|
30
|
+
docs: {
|
|
31
|
+
description: {
|
|
32
|
+
component: `
|
|
33
|
+
## TreeView
|
|
34
|
+
|
|
35
|
+
Un composant pour afficher des données hiérarchiques sous forme d'arborescence.
|
|
36
|
+
|
|
37
|
+
### Utilisation des icônes
|
|
38
|
+
|
|
39
|
+
Le TreeView permet de personnaliser les icônes selon les types suivants:
|
|
40
|
+
- \`ICON_TYPE.FOLDER\`: Icône de dossier (défaut)
|
|
41
|
+
- \`ICON_TYPE.SHARE\`: Icône de partage
|
|
42
|
+
- \`ICON_TYPE.TRASH\`: Icône de corbeille
|
|
43
|
+
- \`ICON_TYPE.CUSTOM\`: Icône personnalisée (nécessite de définir \`customIcon\`)
|
|
44
|
+
|
|
45
|
+
Vous pouvez également passer directement un composant SvgIcon comme valeur de \`iconType\`.
|
|
46
|
+
|
|
47
|
+
### Structure des données
|
|
48
|
+
|
|
49
|
+
Le composant attend un tableau d'objets \`CustomTreeViewItem\` qui étend l'interface \`TreeViewBaseItem\` de MUI:
|
|
50
|
+
|
|
51
|
+
\`\`\`typescript
|
|
52
|
+
interface CustomTreeViewItem extends TreeViewBaseItem {
|
|
53
|
+
id: string; // Identifiant unique de l'élément (obligatoire)
|
|
54
|
+
label: string; // Libellé à afficher (obligatoire)
|
|
55
|
+
children?: CustomTreeViewItem[]; // Sous-éléments (facultatif)
|
|
56
|
+
iconType?: IconType; // Type d'icône (facultatif)
|
|
57
|
+
customIcon?: SvgIconComponent; // Icône personnalisée si iconType est CUSTOM (facultatif)
|
|
58
|
+
}
|
|
59
|
+
\`\`\`
|
|
60
|
+
`
|
|
30
61
|
}
|
|
31
62
|
}
|
|
32
63
|
}
|
|
33
|
-
},
|
|
64
|
+
}, c = [
|
|
34
65
|
{
|
|
35
|
-
id: "
|
|
36
|
-
label: "
|
|
66
|
+
id: "documents",
|
|
67
|
+
label: "Mes formulaires",
|
|
68
|
+
iconType: e.FOLDER,
|
|
37
69
|
children: [
|
|
38
70
|
{
|
|
39
|
-
id: "
|
|
40
|
-
label: "
|
|
71
|
+
id: "folder1",
|
|
72
|
+
label: "Premier dossier",
|
|
73
|
+
iconType: e.FOLDER,
|
|
41
74
|
children: [
|
|
42
75
|
{
|
|
43
|
-
id: "
|
|
44
|
-
label: "
|
|
76
|
+
id: "subfolder1",
|
|
77
|
+
label: "Sous-dossier 1",
|
|
78
|
+
iconType: e.FOLDER
|
|
45
79
|
},
|
|
46
80
|
{
|
|
47
|
-
id: "
|
|
48
|
-
label: "
|
|
81
|
+
id: "subfolder2",
|
|
82
|
+
label: "Sous-dossier 2",
|
|
83
|
+
iconType: e.FOLDER
|
|
49
84
|
}
|
|
50
85
|
]
|
|
51
86
|
},
|
|
52
87
|
{
|
|
53
|
-
id: "
|
|
54
|
-
label: "
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
id: "folder2",
|
|
89
|
+
label: "Deuxième dossier",
|
|
90
|
+
iconType: e.FOLDER
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "folder3",
|
|
94
|
+
label: "Troisième dossier",
|
|
95
|
+
iconType: e.FOLDER
|
|
61
96
|
}
|
|
62
97
|
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "shared",
|
|
101
|
+
label: "Formulaires partagés avec moi",
|
|
102
|
+
iconType: e.SHARE
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "trash",
|
|
106
|
+
label: "Corbeille",
|
|
107
|
+
iconType: e.TRASH
|
|
63
108
|
}
|
|
64
|
-
], a =
|
|
109
|
+
], a = [
|
|
110
|
+
{
|
|
111
|
+
id: "bookmarks",
|
|
112
|
+
label: "Favoris",
|
|
113
|
+
iconType: t,
|
|
114
|
+
children: [
|
|
115
|
+
{
|
|
116
|
+
id: "important",
|
|
117
|
+
label: "Important",
|
|
118
|
+
iconType: e.CUSTOM,
|
|
119
|
+
customIcon: l
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
...c
|
|
124
|
+
], T = {
|
|
65
125
|
args: {
|
|
66
|
-
items:
|
|
126
|
+
items: c,
|
|
127
|
+
onItemSelect: (i, o) => {
|
|
128
|
+
console.log(`Élément sélectionné: ${o}`);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
parameters: {
|
|
132
|
+
docs: {
|
|
133
|
+
description: {
|
|
134
|
+
story: "Exemple de base avec des icônes standard."
|
|
135
|
+
}
|
|
136
|
+
}
|
|
67
137
|
}
|
|
68
|
-
},
|
|
138
|
+
}, I = {
|
|
69
139
|
args: {
|
|
70
|
-
items:
|
|
71
|
-
|
|
140
|
+
items: a,
|
|
141
|
+
onItemSelect: (i, o) => {
|
|
142
|
+
console.log(`Élément sélectionné: ${o}`);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
parameters: {
|
|
146
|
+
docs: {
|
|
147
|
+
description: {
|
|
148
|
+
story: "Exemple utilisant à la fois des icônes prédéfinies et des icônes personnalisées."
|
|
149
|
+
}
|
|
150
|
+
}
|
|
72
151
|
}
|
|
73
|
-
},
|
|
152
|
+
}, b = {
|
|
74
153
|
args: {
|
|
75
|
-
items:
|
|
76
|
-
|
|
77
|
-
|
|
154
|
+
items: [
|
|
155
|
+
{
|
|
156
|
+
id: "root",
|
|
157
|
+
label: "Structure imbriquée complexe",
|
|
158
|
+
iconType: e.FOLDER,
|
|
159
|
+
children: [
|
|
160
|
+
{
|
|
161
|
+
id: "level1-1",
|
|
162
|
+
label: "Niveau 1.1",
|
|
163
|
+
iconType: e.FOLDER,
|
|
164
|
+
children: [
|
|
165
|
+
{
|
|
166
|
+
id: "level2-1",
|
|
167
|
+
label: "Niveau 2.1",
|
|
168
|
+
iconType: e.FOLDER,
|
|
169
|
+
children: [
|
|
170
|
+
{
|
|
171
|
+
id: "level3-1",
|
|
172
|
+
label: "Niveau 3.1",
|
|
173
|
+
iconType: e.FOLDER
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: "level3-2",
|
|
177
|
+
label: "Niveau 3.2",
|
|
178
|
+
iconType: e.SHARE
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "level2-2",
|
|
184
|
+
label: "Niveau 2.2",
|
|
185
|
+
iconType: e.TRASH
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "level1-2",
|
|
191
|
+
label: "Niveau 1.2",
|
|
192
|
+
iconType: e.CUSTOM,
|
|
193
|
+
customIcon: t
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
onItemSelect: (i, o) => {
|
|
199
|
+
console.log(`Élément sélectionné: ${o}`);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
parameters: {
|
|
203
|
+
docs: {
|
|
204
|
+
description: {
|
|
205
|
+
story: "Exemple d'une structure profondément imbriquée avec différents types d'icônes à chaque niveau."
|
|
206
|
+
}
|
|
78
207
|
}
|
|
79
208
|
}
|
|
80
209
|
};
|
|
81
210
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
211
|
+
I as AvecIconesPersonnalisees,
|
|
212
|
+
T as Default,
|
|
213
|
+
b as StructureImbriquee,
|
|
214
|
+
u as default
|
|
86
215
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgi-learning-hub/ui",
|
|
3
|
-
"version": "1.4.0-dev.
|
|
3
|
+
"version": "1.4.0-dev.1741972878",
|
|
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",
|