@pnkx-lib/ui 1.9.94 → 1.9.96

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.
@@ -12172,13 +12172,11 @@ const Sidebar = ({ children, menu, userInfo }) => {
12172
12172
  router(path);
12173
12173
  };
12174
12174
  const handleOpenSubmenu = (item, hasChildren) => {
12175
- console.log("click", hasChildren);
12176
- const cleanPath = (...segments) => segments.map((s) => s.replace(/^\/+|\/+$/g, "")).filter(Boolean).join("/");
12177
12175
  if (hasChildren) {
12178
- const fullPath = `/${cleanPath(pathUrl, item.path)}`;
12179
- router(fullPath);
12176
+ setOpenSubmenu((prev) => prev === item.name ? null : item.name);
12177
+ return;
12180
12178
  }
12181
- setOpenSubmenu((prev) => prev === item.name ? null : item.name);
12179
+ router(item.path);
12182
12180
  };
12183
12181
  useEffect(() => {
12184
12182
  const filteredMenu = menu.filter((item) => item.isShow).flatMap((menu2) => {
@@ -12188,11 +12186,11 @@ const Sidebar = ({ children, menu, userInfo }) => {
12188
12186
  });
12189
12187
  setNewMenu(filteredMenu);
12190
12188
  }, [searchSidebar]);
12191
- const handleClick = (sub, path) => {
12192
- if (!sub?.path || !activeMainMenu) return;
12193
- const segments = [activeMainMenu, sub.path, path || ""].map((s) => s.replace(/^\/|\/$/g, "")).filter(Boolean);
12194
- const pathRouter = "/" + segments.join("/");
12195
- router(pathRouter);
12189
+ const handleClick = (subPath, itemPath) => {
12190
+ const cleanedSubPath = subPath.replace(/\/$/, "");
12191
+ const cleanedItemPath = itemPath.replace(/^\//, "");
12192
+ const fullPath = `${cleanedSubPath}/${cleanedItemPath}`;
12193
+ router(fullPath);
12196
12194
  };
12197
12195
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex relative h-screen", children: [
12198
12196
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -12230,7 +12228,7 @@ const Sidebar = ({ children, menu, userInfo }) => {
12230
12228
  /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { role: "list", className: twMerge("-mx-2 space-y-1 relative"), children: newMenu.flatMap(
12231
12229
  (item) => {
12232
12230
  const isActive = [activeMainMenu, pathUrl].includes(item.path);
12233
- const isActiveUrl = item.path === activeMainMenu || item.path === pathUrl;
12231
+ const isActiveUrl = activeMainMenu.startsWith(item.path) || pathUrl.startsWith(item.path);
12234
12232
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
12235
12233
  "li",
12236
12234
  {
@@ -12387,14 +12385,16 @@ const Sidebar = ({ children, menu, userInfo }) => {
12387
12385
  ),
12388
12386
  children: activeSubmenu?.map(
12389
12387
  (sub) => {
12388
+ const isActiveSumenu = pathUrl.startsWith(sub.path);
12390
12389
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
12391
12390
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
12392
12391
  "a",
12393
12392
  {
12394
12393
  onClick: () => {
12395
- handleOpenSubmenu(sub, sub?.children?.length === 0);
12394
+ handleOpenSubmenu(sub, sub?.children?.length > 0);
12396
12395
  },
12397
12396
  className: twMerge(
12397
+ isActiveSumenu ? "bg-[#EEEEF0]" : "",
12398
12398
  "group flex gap-x-3 rounded-md p-2 text-gray-700 hover:bg-[#EEEEF0] mr-8 text-sm leading-6 transition-all duration-300 font-semibold items-center"
12399
12399
  ),
12400
12400
  children: [
@@ -12422,12 +12422,16 @@ const Sidebar = ({ children, menu, userInfo }) => {
12422
12422
  ),
12423
12423
  children: sub?.children?.map(
12424
12424
  (item) => {
12425
+ const itemFullPath = `${sub.path.replace(
12426
+ /\/$/,
12427
+ ""
12428
+ )}/${item.path.replace(/^\//, "")}`;
12425
12429
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
12426
12430
  "li",
12427
12431
  {
12428
- onClick: () => handleClick(sub, item.path),
12432
+ onClick: () => handleClick(sub.path, item.path),
12429
12433
  className: twMerge(
12430
- pathUrl.startsWith(item.path) ? "bg-[#EEEEF0] text-black" : "",
12434
+ pathUrl.startsWith(itemFullPath) ? "bg-[#EEEEF0] text-black" : "",
12431
12435
  "text-xs hover:bg-[#EEEEF0] mr-8 transition-all duration-300 mt-2 rounded-md py-2 flex items-center gap-2 p-2"
12432
12436
  ),
12433
12437
  children: [
@@ -12435,7 +12439,7 @@ const Sidebar = ({ children, menu, userInfo }) => {
12435
12439
  item.name
12436
12440
  ]
12437
12441
  },
12438
- item.path
12442
+ `${sub.path}-${item.path}`
12439
12443
  );
12440
12444
  }
12441
12445
  )
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { Z as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, Y as CategoryStatus, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, a0 as PAGE_NUMBER, a1 as PAGE_SIZE, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, a2 as SORT_BY, a3 as SORT_DESC, _ as START_PAGE, $ as START_PAGE_SIZE, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, a4 as TypeActionRowTable, W as Watermark, t as typeColorMap } from './chunks/index-Ze5DnHAV.js';
1
+ export { Z as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, Y as CategoryStatus, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, a0 as PAGE_NUMBER, a1 as PAGE_SIZE, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, a2 as SORT_BY, a3 as SORT_DESC, _ as START_PAGE, $ as START_PAGE_SIZE, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, a4 as TypeActionRowTable, W as Watermark, t as typeColorMap } from './chunks/index-BMH0bSgU.js';
2
2
  export { C as CheckboxField, D as DatePickerField, E as ErrorMessage, I as Input, L as Label, P as PnkxField, R as RangePickerField, a as TINY_API, b as TinyMCE, T as Typography } from './chunks/AntdIcon-sydRpDMU.js';
3
3
  import 'react-router';
4
4
  export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from './chunks/Switch-Ch-t7bqG.js';
package/es/ui/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { Z as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, Y as CategoryStatus, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, a0 as PAGE_NUMBER, a1 as PAGE_SIZE, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, a2 as SORT_BY, a3 as SORT_DESC, _ as START_PAGE, $ as START_PAGE_SIZE, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, a4 as TypeActionRowTable, W as Watermark, t as typeColorMap } from '../chunks/index-Ze5DnHAV.js';
1
+ export { Z as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, Y as CategoryStatus, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, a0 as PAGE_NUMBER, a1 as PAGE_SIZE, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, a2 as SORT_BY, a3 as SORT_DESC, _ as START_PAGE, $ as START_PAGE_SIZE, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, a4 as TypeActionRowTable, W as Watermark, t as typeColorMap } from '../chunks/index-BMH0bSgU.js';
2
2
  export { E as ErrorMessage, L as Label, a as TINY_API, T as Typography } from '../chunks/AntdIcon-sydRpDMU.js';
3
3
  import 'react-router';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.94",
4
+ "version": "1.9.96",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
package/types/index.d.ts CHANGED
@@ -753,7 +753,6 @@ export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "column
753
753
  renderHeadingSearch: () => ReactNode;
754
754
  rightHeadingContent: ReactNode;
755
755
  menu: Array<MenuType>;
756
- renderGroupHeadingButton: ReactNode;
757
756
  groupHeadingButtonItems?: GroupHeadingButtonItem[];
758
757
  showIndexColumn?: boolean;
759
758
  setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;
package/types/ui.d.ts CHANGED
@@ -601,7 +601,6 @@ export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "column
601
601
  renderHeadingSearch: () => ReactNode;
602
602
  rightHeadingContent: ReactNode;
603
603
  menu: Array<MenuType>;
604
- renderGroupHeadingButton: ReactNode;
605
604
  groupHeadingButtonItems?: GroupHeadingButtonItem[];
606
605
  showIndexColumn?: boolean;
607
606
  setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;