@pnkx-lib/ui 1.9.434 → 1.9.437
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/style.css +2 -2
- package/es/chunks/{AntdIcon-gUuMvf83.js → AntdIcon-D_ySRKRj.js} +3 -3
- package/es/chunks/{CloseOutlined-D9hb-IcI.js → CloseOutlined-B3y9Maz0.js} +1 -1
- package/es/chunks/{DownOutlined-CkHKgaSi.js → DownOutlined-BlKl-wuu.js} +1 -1
- package/es/chunks/{InboxOutlined-Kgn4qaDi.js → InboxOutlined-CLTSIXAX.js} +1 -1
- package/es/chunks/{index-D7kJLZIi.js → index-t0ynpS_n.js} +2 -2
- package/es/fields/DatePicker.js +2 -2
- package/es/fields/Input.js +47 -47
- package/es/fields/Select.js +24 -24
- package/es/fields/TinyMCE.js +16 -71
- package/es/fields/Upload.js +1 -1
- package/es/index.js +1 -3
- package/es/ui/BreadcrumbHeading.js +2 -2
- package/es/ui/ExportFile.js +1 -1
- package/es/ui/Heading.js +2 -2
- package/es/ui/ImportFile.js +2 -2
- package/es/ui/Layout.js +4927 -1
- package/es/ui/SearchFilterForm.js +1 -1
- package/es/{chunks/logo-header-DG8abRGF.js → ui/Sidebar/index.js} +504 -4
- package/es/ui/UploadComponent.js +1 -1
- package/es/ui/UploadMultiple.js +1 -1
- package/es/ui/index.js +69 -71
- package/package.json +1 -1
- package/types/components/hooks/useBreadcrumb.d.ts +2 -2
- package/types/components/ui/{SidebarV3 → Sidebar}/components/ContentArea.d.ts +1 -1
- package/types/components/ui/{SidebarV3 → Sidebar}/components/MainMenu/EachItem.d.ts +5 -5
- package/types/components/ui/{SidebarV3 → Sidebar}/components/MainMenu/index.d.ts +4 -4
- package/types/components/ui/{SidebarV3 → Sidebar}/components/MainSidebar.d.ts +3 -3
- package/types/components/ui/{SidebarV3/components/SidebarV3.d.ts → Sidebar/components/Sidebar.d.ts} +1 -1
- package/types/components/ui/{SidebarV3 → Sidebar}/hooks.d.ts +3 -3
- package/types/components/ui/Sidebar/index.d.ts +2 -0
- package/types/components/ui/{SidebarV3 → Sidebar}/types.d.ts +3 -3
- package/types/components/ui/Sidebar/utils.d.ts +2 -0
- package/types/components/ui/index.d.ts +1 -3
- package/types/components/utils/routeUtils.d.ts +2 -2
- package/types/constants/table.d.ts +6 -0
- package/types/ui/Sidebar/index.d.ts +2 -0
- package/es/chunks/BellIcon-Bv07EhTB.js +0 -45
- package/es/chunks/layout-C0dbwkpb.js +0 -4929
- package/es/ui/Sidebar.js +0 -412
- package/es/ui/SidebarV2.js +0 -303
- package/es/ui/SidebarV3/index.js +0 -465
- package/types/components/ui/Sidebar.d.ts +0 -23
- package/types/components/ui/SidebarV2.d.ts +0 -20
- package/types/components/ui/SidebarV3/index.d.ts +0 -2
- package/types/components/ui/SidebarV3/utils.d.ts +0 -2
- package/types/ui/Sidebar.d.ts +0 -2
- package/types/ui/SidebarV2.d.ts +0 -2
- package/types/ui/SidebarV3/index.d.ts +0 -2
- /package/types/components/ui/{SidebarV3 → Sidebar}/components/Header.d.ts +0 -0
- /package/types/components/ui/{SidebarV3 → Sidebar}/components/SearchHeader.d.ts +0 -0
- /package/types/components/ui/{SidebarV3 → Sidebar}/components/UserInfoSection.d.ts +0 -0
package/es/ui/SidebarV3/index.js
DELETED
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useMemo, useState } from 'react';
|
|
3
|
-
import { useLocation, useNavigate } from 'react-router';
|
|
4
|
-
import { S as SearchIcon, V as VietNamIcon, D as DownOutlinedIcon, l as logoHeaderText, R as RefIcon$1, u as useDebounce } from '../../chunks/logo-header-DG8abRGF.js';
|
|
5
|
-
import { Flex, AutoComplete, Divider, Dropdown } from 'antd';
|
|
6
|
-
import { Layout } from '../Layout.js';
|
|
7
|
-
import { Input } from '../../fields/Input.js';
|
|
8
|
-
import { t as twMerge } from '../../chunks/bundle-mjs-BBFHkixS.js';
|
|
9
|
-
import { F as ForwardRef, R as RefIcon$2 } from '../../chunks/BellIcon-Bv07EhTB.js';
|
|
10
|
-
import { R as RefIcon } from '../../chunks/DownOutlined-CkHKgaSi.js';
|
|
11
|
-
|
|
12
|
-
const useMenuFilter = (menu) => {
|
|
13
|
-
const sidebarMenu = useMemo(
|
|
14
|
-
() => menu?.filter((route) => route?.isShowChildren)?.flatMap((route) => route?.children)?.filter(Boolean),
|
|
15
|
-
[menu]
|
|
16
|
-
);
|
|
17
|
-
return { sidebarMenu };
|
|
18
|
-
};
|
|
19
|
-
const classNames = (...classes) => {
|
|
20
|
-
return classes.filter(Boolean).join(" ");
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const Title = (props) => /* @__PURE__ */ jsx(Flex, { align: "center", justify: "space-between", children: props.title });
|
|
24
|
-
const renderItem = (title, path) => ({
|
|
25
|
-
value: title,
|
|
26
|
-
label: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "space-between", children: title }),
|
|
27
|
-
path
|
|
28
|
-
});
|
|
29
|
-
const getDataOption = (menu, searchValue) => {
|
|
30
|
-
return menu.reduce((acc, itemMenu) => {
|
|
31
|
-
const groupName = itemMenu.name;
|
|
32
|
-
(itemMenu.children ?? []).forEach((itemChildren) => {
|
|
33
|
-
(itemChildren.children ?? []).forEach(
|
|
34
|
-
(itemSub) => {
|
|
35
|
-
if (!searchValue || itemSub.name.toLowerCase().includes(searchValue.toLowerCase())) {
|
|
36
|
-
let group = acc.find((g) => g.label.props.title === groupName);
|
|
37
|
-
if (!group) {
|
|
38
|
-
group = {
|
|
39
|
-
label: /* @__PURE__ */ jsx(Title, { title: groupName }),
|
|
40
|
-
options: []
|
|
41
|
-
};
|
|
42
|
-
acc.push(group);
|
|
43
|
-
}
|
|
44
|
-
const path = `${itemChildren.path}/${itemSub.path}`;
|
|
45
|
-
group.options.push(renderItem(itemSub.name, path));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
return acc;
|
|
51
|
-
}, []);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const SearchHeader = ({
|
|
55
|
-
dataOption,
|
|
56
|
-
valueSearch,
|
|
57
|
-
onSearchChange,
|
|
58
|
-
onSelect
|
|
59
|
-
}) => {
|
|
60
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-end", children: /* @__PURE__ */ jsx(
|
|
61
|
-
AutoComplete,
|
|
62
|
-
{
|
|
63
|
-
classNames: {
|
|
64
|
-
popup: { root: "certain-category-search-dropdown" }
|
|
65
|
-
},
|
|
66
|
-
popupMatchSelectWidth: 500,
|
|
67
|
-
style: { width: 500 },
|
|
68
|
-
options: dataOption ?? [],
|
|
69
|
-
onSelect,
|
|
70
|
-
onChange: onSearchChange,
|
|
71
|
-
value: valueSearch,
|
|
72
|
-
children: /* @__PURE__ */ jsx(
|
|
73
|
-
Input,
|
|
74
|
-
{
|
|
75
|
-
className: "!placeholder:bg-[#E7F0FF] !bg-[#E7F0FF] !border !border-[#BDE3FF]",
|
|
76
|
-
placeholder: "Tìm kiếm theo chức năng,module của hệ thống",
|
|
77
|
-
iconStartInput: /* @__PURE__ */ jsx("div", { className: "w-5 h-5", children: /* @__PURE__ */ jsx(SearchIcon, { className: "w-5 text-[#116DFF]" }) })
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
) });
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const userInfo = {
|
|
85
|
-
name: "admin",
|
|
86
|
-
avatar: "http://10.1.15.154:9000/image/logo-phenikaa-mec.webp"
|
|
87
|
-
};
|
|
88
|
-
const items = [
|
|
89
|
-
{ key: "1", label: "Hồ sơ" },
|
|
90
|
-
{ key: "4", label: "Cài đặt" },
|
|
91
|
-
{ key: "2", label: "Đăng xuất" }
|
|
92
|
-
];
|
|
93
|
-
const UserInfoSection = ({
|
|
94
|
-
hoverOpenMenu
|
|
95
|
-
}) => {
|
|
96
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
97
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx("li", { className: "list-none cursor-pointer group flex items-center", children: /* @__PURE__ */ jsxs(
|
|
98
|
-
"div",
|
|
99
|
-
{
|
|
100
|
-
className: twMerge(
|
|
101
|
-
hoverOpenMenu ? "" : "justify-center",
|
|
102
|
-
"text-black flex items-center rounded-md gap-2"
|
|
103
|
-
),
|
|
104
|
-
children: [
|
|
105
|
-
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
106
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-4 items-center", children: [
|
|
107
|
-
/* @__PURE__ */ jsx(VietNamIcon, { className: "w-6 h-6" }),
|
|
108
|
-
/* @__PURE__ */ jsx(ForwardRef, { className: "w-6 h-6" })
|
|
109
|
-
] })
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
) }) }),
|
|
113
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center z-[9999]", children: /* @__PURE__ */ jsx("a", { onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("li", { className: "list-none cursor-pointer group flex items-center", children: /* @__PURE__ */ jsxs(
|
|
114
|
-
"div",
|
|
115
|
-
{
|
|
116
|
-
className: twMerge(
|
|
117
|
-
hoverOpenMenu ? "" : "justify-center",
|
|
118
|
-
"text-black flex items-center rounded-md gap-2"
|
|
119
|
-
),
|
|
120
|
-
children: [
|
|
121
|
-
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
122
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-center w-[30px] h-[30px] rounded-full", children: /* @__PURE__ */ jsx("img", { src: userInfo?.avatar, alt: "default_avatar" }) }),
|
|
123
|
-
/* @__PURE__ */ jsx("p", { children: userInfo?.name }),
|
|
124
|
-
/* @__PURE__ */ jsx(Dropdown, { menu: { items }, children: /* @__PURE__ */ jsx(DownOutlinedIcon, { className: "w-6 h-6" }) })
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
) }) }) })
|
|
128
|
-
] });
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const Header = ({
|
|
132
|
-
dataOption,
|
|
133
|
-
valueSearch,
|
|
134
|
-
onSearchChange,
|
|
135
|
-
onSelect,
|
|
136
|
-
hoverOpenMenu
|
|
137
|
-
}) => {
|
|
138
|
-
return /* @__PURE__ */ jsx(
|
|
139
|
-
Layout.Header,
|
|
140
|
-
{
|
|
141
|
-
style: {
|
|
142
|
-
backgroundColor: "#FFFFFF",
|
|
143
|
-
display: "flex",
|
|
144
|
-
width: "100%",
|
|
145
|
-
borderBottom: "1px solid white",
|
|
146
|
-
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.15)",
|
|
147
|
-
height: "56px",
|
|
148
|
-
position: "fixed",
|
|
149
|
-
zIndex: 2e3
|
|
150
|
-
},
|
|
151
|
-
children: /* @__PURE__ */ jsxs("div", { className: "w-full flex items-center justify-between", children: [
|
|
152
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center ml-[-2rem]", children: /* @__PURE__ */ jsx("img", { src: logoHeaderText, alt: "logo", width: 200 }) }),
|
|
153
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
154
|
-
/* @__PURE__ */ jsx(
|
|
155
|
-
SearchHeader,
|
|
156
|
-
{
|
|
157
|
-
dataOption,
|
|
158
|
-
valueSearch,
|
|
159
|
-
onSearchChange,
|
|
160
|
-
onSelect
|
|
161
|
-
}
|
|
162
|
-
),
|
|
163
|
-
/* @__PURE__ */ jsx(UserInfoSection, { hoverOpenMenu })
|
|
164
|
-
] })
|
|
165
|
-
] })
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const MainSidebar = ({
|
|
171
|
-
sidebarMenu,
|
|
172
|
-
hoverOpenMenu,
|
|
173
|
-
onMouseEnter,
|
|
174
|
-
onMouseLeave,
|
|
175
|
-
onNavigateModule
|
|
176
|
-
}) => {
|
|
177
|
-
const location = useLocation();
|
|
178
|
-
const navigate = useNavigate();
|
|
179
|
-
const currentPath = location.pathname;
|
|
180
|
-
const isActiveItem = (item) => {
|
|
181
|
-
if (item.path) {
|
|
182
|
-
if (currentPath.includes(item.path) && item.path !== "/") return true;
|
|
183
|
-
}
|
|
184
|
-
if (item.children) {
|
|
185
|
-
return item.children.some((child) => isActiveItem(child));
|
|
186
|
-
}
|
|
187
|
-
return false;
|
|
188
|
-
};
|
|
189
|
-
const handleNavigateModule = (item) => {
|
|
190
|
-
if (item?.path) {
|
|
191
|
-
return navigate(item?.path);
|
|
192
|
-
}
|
|
193
|
-
if (item?.children && item?.children.length > 0) {
|
|
194
|
-
return onNavigateModule(item);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
return /* @__PURE__ */ jsx(
|
|
198
|
-
"div",
|
|
199
|
-
{
|
|
200
|
-
className: twMerge(
|
|
201
|
-
"fixed inset-y-0 flex h-screen flex-col transition-all duration-300 ease-in-out z-[999]",
|
|
202
|
-
hoverOpenMenu ? "w-[225px]" : "w-[62px]"
|
|
203
|
-
),
|
|
204
|
-
onMouseLeave,
|
|
205
|
-
onMouseEnter,
|
|
206
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex grow flex-col mt-14 gap-y-5 bg-[#001523] px-6 pb-4 relative", children: /* @__PURE__ */ jsx("nav", { className: "flex flex-1 flex-col mt-4", children: /* @__PURE__ */ jsx("ul", { role: "list", className: "-mx-3 space-y-1", children: sidebarMenu.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
207
|
-
"a",
|
|
208
|
-
{
|
|
209
|
-
onClick: () => {
|
|
210
|
-
handleNavigateModule(item);
|
|
211
|
-
},
|
|
212
|
-
className: classNames(
|
|
213
|
-
isActiveItem(item) ? "bg-[#007BE5] text-white" : "text-gray-400 hover:text-white hover:bg-[#007BE5]",
|
|
214
|
-
"group flex items-center gap-x-3 rounded-md px-1.5 py-2 text-sm font-semibold cursor-pointer"
|
|
215
|
-
),
|
|
216
|
-
children: [
|
|
217
|
-
item.icon,
|
|
218
|
-
/* @__PURE__ */ jsx(
|
|
219
|
-
"span",
|
|
220
|
-
{
|
|
221
|
-
className: twMerge(
|
|
222
|
-
"whitespace-nowrap overflow-hidden transition-opacity duration-200",
|
|
223
|
-
hoverOpenMenu && "opacity-100"
|
|
224
|
-
),
|
|
225
|
-
children: item.name
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
) }, item.name)) }) }) })
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const EachItem = ({
|
|
236
|
-
subMenu,
|
|
237
|
-
openDropdownMenu,
|
|
238
|
-
onClickDropdownMenu,
|
|
239
|
-
isDirectlyActive,
|
|
240
|
-
hasActiveChild,
|
|
241
|
-
level = 1
|
|
242
|
-
}) => {
|
|
243
|
-
const isDropdown = subMenu.isShowChildren;
|
|
244
|
-
const isDirectActive = isDirectlyActive(subMenu);
|
|
245
|
-
const hasChildActive = hasActiveChild(subMenu);
|
|
246
|
-
const isParent = !!subMenu?.children && isDropdown;
|
|
247
|
-
const [openItemMenu, setOpenItemMenu] = useState(false);
|
|
248
|
-
const toggleExpand = () => {
|
|
249
|
-
setOpenItemMenu(!openItemMenu);
|
|
250
|
-
};
|
|
251
|
-
const onClickItem = () => {
|
|
252
|
-
if (isParent) {
|
|
253
|
-
toggleExpand();
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
onClickDropdownMenu(isDropdown, subMenu);
|
|
257
|
-
};
|
|
258
|
-
const getPaddingStyle = () => {
|
|
259
|
-
if (level === 1) {
|
|
260
|
-
return { paddingLeft: "16px", paddingRight: "16px" };
|
|
261
|
-
}
|
|
262
|
-
return {
|
|
263
|
-
paddingLeft: `${4 + (level - 1) * 4 * 6}px`,
|
|
264
|
-
// 16px + (level-1) * 16px
|
|
265
|
-
paddingRight: "16px"
|
|
266
|
-
};
|
|
267
|
-
};
|
|
268
|
-
const getItemStyling = () => {
|
|
269
|
-
if (isDirectActive) {
|
|
270
|
-
return "!text-[#007BE5] !bg-[#E5F4FF]";
|
|
271
|
-
}
|
|
272
|
-
if (hasChildActive) {
|
|
273
|
-
return "!text-[#007BE5]";
|
|
274
|
-
}
|
|
275
|
-
return "text-[#1F1F1F]";
|
|
276
|
-
};
|
|
277
|
-
return /* @__PURE__ */ jsxs("li", { children: [
|
|
278
|
-
/* @__PURE__ */ jsxs(
|
|
279
|
-
"div",
|
|
280
|
-
{
|
|
281
|
-
onClick: onClickItem,
|
|
282
|
-
style: getPaddingStyle(),
|
|
283
|
-
className: twMerge(
|
|
284
|
-
"py-2 mt-1 items-center gap-2 cursor-pointer flex text-sm hover:bg-[#E5F4FF] hover:text-[#007BE5]",
|
|
285
|
-
getItemStyling()
|
|
286
|
-
),
|
|
287
|
-
children: [
|
|
288
|
-
subMenu.icon,
|
|
289
|
-
subMenu.name,
|
|
290
|
-
isDropdown && subMenu.children && (openItemMenu ? /* @__PURE__ */ jsx(RefIcon, { className: "w-4 h-4 ml-auto" }) : /* @__PURE__ */ jsx(RefIcon$1, { className: "w-4 h-4 ml-auto" }))
|
|
291
|
-
]
|
|
292
|
-
}
|
|
293
|
-
),
|
|
294
|
-
isDropdown && openItemMenu && subMenu.children?.map((dropdownItem) => {
|
|
295
|
-
return /* @__PURE__ */ jsx(
|
|
296
|
-
EachItem,
|
|
297
|
-
{
|
|
298
|
-
subMenu: dropdownItem,
|
|
299
|
-
openDropdownMenu,
|
|
300
|
-
onClickDropdownMenu,
|
|
301
|
-
isDirectlyActive,
|
|
302
|
-
hasActiveChild,
|
|
303
|
-
level: level + 1
|
|
304
|
-
},
|
|
305
|
-
dropdownItem.name
|
|
306
|
-
);
|
|
307
|
-
})
|
|
308
|
-
] }, subMenu.path);
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
const MainMenu = ({
|
|
312
|
-
sidebarMenu,
|
|
313
|
-
showSubmenu,
|
|
314
|
-
hoverOpenMenu,
|
|
315
|
-
openDropdownMenu,
|
|
316
|
-
onCloseSubmenu,
|
|
317
|
-
onClickDropdownMenu
|
|
318
|
-
}) => {
|
|
319
|
-
const subMenu = sidebarMenu.find((item) => item.id === showSubmenu);
|
|
320
|
-
const location = useLocation();
|
|
321
|
-
const currentPath = location.pathname;
|
|
322
|
-
const isDirectlyActive = (item) => {
|
|
323
|
-
if (!item.path) return false;
|
|
324
|
-
return currentPath.includes(item.path) && item.path !== "/";
|
|
325
|
-
};
|
|
326
|
-
const hasActiveChild = (item) => {
|
|
327
|
-
if (!item.children) return false;
|
|
328
|
-
return item.children.some(
|
|
329
|
-
(child) => isDirectlyActive(child) || hasActiveChild(child)
|
|
330
|
-
);
|
|
331
|
-
};
|
|
332
|
-
return /* @__PURE__ */ jsxs(
|
|
333
|
-
"div",
|
|
334
|
-
{
|
|
335
|
-
className: twMerge(
|
|
336
|
-
"fixed w-[217px] pt-15 left-[62px] h-full bg-[#FFFFFF] z-[50] flex flex-col",
|
|
337
|
-
hoverOpenMenu && "opacity-0"
|
|
338
|
-
),
|
|
339
|
-
children: [
|
|
340
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
341
|
-
/* @__PURE__ */ jsx("span", { className: "block px-4 h-[42px] shadow-[0px_4px_6px_0px_#0006241f] py-2 text-[16px] font-semibold text-[#1F1F1F]", children: subMenu?.name }),
|
|
342
|
-
/* @__PURE__ */ jsx("ul", { className: "mt-4", children: subMenu?.children?.map((subMenuChild) => /* @__PURE__ */ jsx(
|
|
343
|
-
EachItem,
|
|
344
|
-
{
|
|
345
|
-
subMenu: subMenuChild,
|
|
346
|
-
openDropdownMenu,
|
|
347
|
-
onClickDropdownMenu,
|
|
348
|
-
isDirectlyActive,
|
|
349
|
-
hasActiveChild
|
|
350
|
-
},
|
|
351
|
-
subMenuChild.path || subMenuChild.name
|
|
352
|
-
)) })
|
|
353
|
-
] }, subMenu?.id),
|
|
354
|
-
/* @__PURE__ */ jsxs(
|
|
355
|
-
"div",
|
|
356
|
-
{
|
|
357
|
-
className: "mt-auto select-none px-4 py-2 shadow-[0px_0px_12px_0px_#0006241f] flex space-x-2 cursor-pointer",
|
|
358
|
-
onClick: onCloseSubmenu,
|
|
359
|
-
children: [
|
|
360
|
-
/* @__PURE__ */ jsx(RefIcon$2, {}),
|
|
361
|
-
/* @__PURE__ */ jsx("span", { className: "text-[#131313]", children: "Thu gọn menu" })
|
|
362
|
-
]
|
|
363
|
-
}
|
|
364
|
-
)
|
|
365
|
-
]
|
|
366
|
-
}
|
|
367
|
-
);
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
const ContentArea = ({
|
|
371
|
-
children,
|
|
372
|
-
hoverOpenMenu,
|
|
373
|
-
showSubmenu
|
|
374
|
-
}) => {
|
|
375
|
-
const getContentMargin = () => {
|
|
376
|
-
if (hoverOpenMenu) return "ml-[225px]";
|
|
377
|
-
if (showSubmenu) return "ml-[279px]";
|
|
378
|
-
return "ml-[62px]";
|
|
379
|
-
};
|
|
380
|
-
return /* @__PURE__ */ jsx(
|
|
381
|
-
"div",
|
|
382
|
-
{
|
|
383
|
-
className: twMerge(
|
|
384
|
-
"transition-all duration-300 ease-in-out h-screen",
|
|
385
|
-
getContentMargin()
|
|
386
|
-
),
|
|
387
|
-
children
|
|
388
|
-
}
|
|
389
|
-
);
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
const SidebarV3 = ({ menu, children }) => {
|
|
393
|
-
const [hoverOpenMenu, setHoverOpenMenu] = useState(false);
|
|
394
|
-
const [valueSearch, setValueSearch] = useState("");
|
|
395
|
-
const searchSidebar = useDebounce(valueSearch, 300);
|
|
396
|
-
const [showSubmenu, setShowSubmenu] = useState(null);
|
|
397
|
-
const [openDropdownMenu, setOpenDropdownMenu] = useState(null);
|
|
398
|
-
const navigate = useNavigate();
|
|
399
|
-
const { sidebarMenu } = useMenuFilter(menu);
|
|
400
|
-
const dataOption = useMemo(
|
|
401
|
-
() => getDataOption(sidebarMenu, searchSidebar),
|
|
402
|
-
[sidebarMenu, searchSidebar]
|
|
403
|
-
);
|
|
404
|
-
const handleSelect = (_value, path) => {
|
|
405
|
-
navigate(path.path);
|
|
406
|
-
};
|
|
407
|
-
const handleClickDropdownMenu = (isDropdown, item) => {
|
|
408
|
-
if (isDropdown) {
|
|
409
|
-
setOpenDropdownMenu(item?.id);
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
if (item?.path) {
|
|
413
|
-
navigate(item.path);
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
const handleNavigateModule = (item) => {
|
|
417
|
-
setShowSubmenu(item?.id);
|
|
418
|
-
setHoverOpenMenu(false);
|
|
419
|
-
};
|
|
420
|
-
const handleCloseSubmenu = () => {
|
|
421
|
-
setShowSubmenu(null);
|
|
422
|
-
};
|
|
423
|
-
const handleHoverOpenMenu = () => {
|
|
424
|
-
setHoverOpenMenu(true);
|
|
425
|
-
};
|
|
426
|
-
const handleHoverCloseMenu = () => {
|
|
427
|
-
setHoverOpenMenu(false);
|
|
428
|
-
};
|
|
429
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
430
|
-
/* @__PURE__ */ jsx(
|
|
431
|
-
Header,
|
|
432
|
-
{
|
|
433
|
-
dataOption,
|
|
434
|
-
valueSearch,
|
|
435
|
-
onSearchChange: setValueSearch,
|
|
436
|
-
onSelect: handleSelect,
|
|
437
|
-
hoverOpenMenu
|
|
438
|
-
}
|
|
439
|
-
),
|
|
440
|
-
/* @__PURE__ */ jsx(
|
|
441
|
-
MainSidebar,
|
|
442
|
-
{
|
|
443
|
-
sidebarMenu: menu,
|
|
444
|
-
hoverOpenMenu,
|
|
445
|
-
onMouseEnter: handleHoverOpenMenu,
|
|
446
|
-
onMouseLeave: handleHoverCloseMenu,
|
|
447
|
-
onNavigateModule: handleNavigateModule
|
|
448
|
-
}
|
|
449
|
-
),
|
|
450
|
-
showSubmenu && /* @__PURE__ */ jsx(
|
|
451
|
-
MainMenu,
|
|
452
|
-
{
|
|
453
|
-
sidebarMenu: menu,
|
|
454
|
-
showSubmenu,
|
|
455
|
-
hoverOpenMenu,
|
|
456
|
-
openDropdownMenu,
|
|
457
|
-
onCloseSubmenu: handleCloseSubmenu,
|
|
458
|
-
onClickDropdownMenu: handleClickDropdownMenu
|
|
459
|
-
}
|
|
460
|
-
),
|
|
461
|
-
/* @__PURE__ */ jsx(ContentArea, { hoverOpenMenu, showSubmenu, children })
|
|
462
|
-
] });
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
export { SidebarV3 };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ReactNode, default as React } from 'react';
|
|
2
|
-
export type MenuType = {
|
|
3
|
-
name: string;
|
|
4
|
-
path: string;
|
|
5
|
-
isShow?: boolean;
|
|
6
|
-
isPrivateRoute?: boolean;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
code?: string;
|
|
9
|
-
isShowLabel?: boolean;
|
|
10
|
-
component?: React.LazyExoticComponent<React.MemoExoticComponent<any>> | React.ExoticComponent<any> | ReactNode | React.FC;
|
|
11
|
-
componentProps?: Record<string, any>;
|
|
12
|
-
children?: MenuType[];
|
|
13
|
-
};
|
|
14
|
-
export interface SidebarProps {
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
menu: Array<MenuType>;
|
|
17
|
-
userInfo?: {
|
|
18
|
-
avatar: string;
|
|
19
|
-
name: string;
|
|
20
|
-
email?: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export declare const Sidebar: ({ children, menu, userInfo }: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { default as React, ReactNode } from 'react';
|
|
2
|
-
export type MenuTypeV2 = {
|
|
3
|
-
name: string;
|
|
4
|
-
path: string;
|
|
5
|
-
isShow?: boolean;
|
|
6
|
-
isPrivateRoute?: boolean;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
code?: string;
|
|
9
|
-
isShowLabel?: boolean;
|
|
10
|
-
isModule?: boolean;
|
|
11
|
-
component?: React.LazyExoticComponent<React.MemoExoticComponent<any>> | React.ExoticComponent<any> | ReactNode | React.FC;
|
|
12
|
-
componentProps?: Record<string, any>;
|
|
13
|
-
children?: MenuTypeV2[];
|
|
14
|
-
};
|
|
15
|
-
interface SidebarV2Props {
|
|
16
|
-
menu: MenuTypeV2[];
|
|
17
|
-
children: React.ReactNode;
|
|
18
|
-
}
|
|
19
|
-
export declare const SidebarV2: ({ menu, children }: SidebarV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export {};
|
package/types/ui/Sidebar.d.ts
DELETED
package/types/ui/SidebarV2.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|