@pnkx-lib/ui 1.9.127 → 1.9.129

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.
@@ -12239,7 +12239,7 @@ const Sidebar = ({ children, menu, userInfo }) => {
12239
12239
  show: true
12240
12240
  }
12241
12241
  ];
12242
- const router = useNavigate();
12242
+ const navigate = useNavigate();
12243
12243
  const location = useLocation();
12244
12244
  const pathUrl = location.pathname;
12245
12245
  const [activeMainMenu, setActiveMainMenu] = useState("");
@@ -12248,24 +12248,28 @@ const Sidebar = ({ children, menu, userInfo }) => {
12248
12248
  const [openSubCollapse, setOpenSubCollapse] = useState(false);
12249
12249
  const [valueSearch, setValueSearch] = useState("");
12250
12250
  const [newMenu, setNewMenu] = useState(
12251
- menu?.filter((route) => route.isShowModules)?.flatMap(
12251
+ menu?.filter((route) => route?.isShowModules)?.flatMap(
12252
12252
  (route) => route.children
12253
12253
  )
12254
12254
  );
12255
12255
  const searchSidebar = useDebounce(valueSearch, 300);
12256
12256
  const handleActiveMain = (path) => {
12257
12257
  setActiveMainMenu(path);
12258
- router(path);
12258
+ navigate(path);
12259
12259
  };
12260
12260
  const handleOpenSubmenu = (item, hasChildren) => {
12261
12261
  if (hasChildren) {
12262
12262
  setOpenSubmenu((prev) => prev === item.name ? null : item.name);
12263
12263
  return;
12264
12264
  }
12265
- router(item.path);
12265
+ const basePath = location.pathname.split("/").slice(0, 2).join("/");
12266
+ const targetPath = `${basePath}/${item.path}`.replace(/\/+/g, "/");
12267
+ if (location.pathname !== targetPath) {
12268
+ navigate(targetPath);
12269
+ }
12266
12270
  };
12267
12271
  useEffect(() => {
12268
- const filteredMenu = menu.filter((item) => item.isShowModules).flatMap((menu2) => {
12272
+ const filteredMenu = menu.filter((item) => item?.isShowModules).flatMap((menu2) => {
12269
12273
  return menu2.children.filter((subMenu) => {
12270
12274
  return subMenu.name.toLowerCase().includes(searchSidebar.toLowerCase());
12271
12275
  });
@@ -12275,8 +12279,8 @@ const Sidebar = ({ children, menu, userInfo }) => {
12275
12279
  const handleClick = (subPath, itemPath) => {
12276
12280
  const cleanedSubPath = subPath.replace(/\/$/, "");
12277
12281
  const cleanedItemPath = itemPath.replace(/^\//, "");
12278
- const fullPath = `${cleanedSubPath}/${cleanedItemPath}`;
12279
- router(fullPath);
12282
+ const fullPath = `/${cleanedSubPath}/${cleanedItemPath}`;
12283
+ navigate(fullPath);
12280
12284
  };
12281
12285
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex relative h-screen", children: [
12282
12286
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -12462,8 +12466,6 @@ const Sidebar = ({ children, menu, userInfo }) => {
12462
12466
  "-mx-2 space-y-1 cursor-pointer mt-4 ml-[3rem]"
12463
12467
  ),
12464
12468
  children: newMenu?.map((sub) => {
12465
- const isActiveSumenu = pathUrl === sub.path;
12466
- if (!isActiveSumenu) return null;
12467
12469
  return sub.children.map(
12468
12470
  (itemMenuSub) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
12469
12471
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -13,6 +13,7 @@ const Select = (props) => {
13
13
  afterOnChange,
14
14
  classNameContainer,
15
15
  classNameSelect,
16
+ placeholder,
16
17
  ...restProps
17
18
  } = props;
18
19
  const { name, value, onChange, onBlur } = field || {};
@@ -44,8 +45,9 @@ const Select = (props) => {
44
45
  onChange: handleChange,
45
46
  onBlur,
46
47
  value,
47
- optionLabelProp: "label",
48
+ optionFilterProp: "label",
48
49
  status: (isTouched || isSubmitted) && Boolean(errorMessage) ? "error" : void 0,
50
+ placeholder,
49
51
  className: twMerge("w-full", classNameSelect),
50
52
  ...restProps
51
53
  }
@@ -1,2 +1,2 @@
1
1
  export { C as CheckboxField, D as DatePickerField, I as Input, P as PnkxField, R as RangePickerField, b as TinyMCE } from '../chunks/AntdIcon-BS99Z6_t.js';
2
- export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from '../chunks/Switch-vaUhKEAu.js';
2
+ export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from '../chunks/Switch-DHAoXDmV.js';
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { Y as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, a7 as BreadcrumbHeading, a6 as BulkActions, B as Button, a8 as Card, C as CascaderField, X as CategoryStatus, f as Col, a9 as ConfigProvider, U as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, V as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, $ as PAGE_NUMBER, a0 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, a1 as SORT_BY, a2 as SORT_DESC, Z 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, a3 as TypeActionRowTable, a4 as TypeBulkActions, a5 as TypeStatusTable, W as Watermark, t as typeColorMap } from './chunks/ConfigProvider-C0vm_cvc.js';
1
+ export { Y as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, a7 as BreadcrumbHeading, a6 as BulkActions, B as Button, a8 as Card, C as CascaderField, X as CategoryStatus, f as Col, a9 as ConfigProvider, U as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, V as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, $ as PAGE_NUMBER, a0 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, a1 as SORT_BY, a2 as SORT_DESC, Z 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, a3 as TypeActionRowTable, a4 as TypeBulkActions, a5 as TypeStatusTable, W as Watermark, t as typeColorMap } from './chunks/ConfigProvider-McTb9Qv0.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-BS99Z6_t.js';
3
3
  import 'react-router';
4
- export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from './chunks/Switch-vaUhKEAu.js';
4
+ export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from './chunks/Switch-DHAoXDmV.js';
5
5
  export { a as useMessage, u as useToast } from './chunks/useMessage-CUPcOtIS.js';
package/es/ui/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { Y as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, a7 as BreadcrumbHeading, a6 as BulkActions, B as Button, a8 as Card, C as CascaderField, X as CategoryStatus, f as Col, a9 as ConfigProvider, U as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, V as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, $ as PAGE_NUMBER, a0 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, a1 as SORT_BY, a2 as SORT_DESC, Z 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, a3 as TypeActionRowTable, a4 as TypeBulkActions, a5 as TypeStatusTable, W as Watermark, t as typeColorMap } from '../chunks/ConfigProvider-C0vm_cvc.js';
1
+ export { Y as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, a7 as BreadcrumbHeading, a6 as BulkActions, B as Button, a8 as Card, C as CascaderField, X as CategoryStatus, f as Col, a9 as ConfigProvider, U as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, V as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, $ as PAGE_NUMBER, a0 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, a1 as SORT_BY, a2 as SORT_DESC, Z 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, a3 as TypeActionRowTable, a4 as TypeBulkActions, a5 as TypeStatusTable, W as Watermark, t as typeColorMap } from '../chunks/ConfigProvider-McTb9Qv0.js';
2
2
  export { E as ErrorMessage, L as Label, a as TINY_API, T as Typography } from '../chunks/AntdIcon-BS99Z6_t.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.127",
4
+ "version": "1.9.129",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -2,7 +2,7 @@ import { ReactNode, default as React } from 'react';
2
2
  export type MenuType = {
3
3
  name: string;
4
4
  path: string;
5
- isShowModules: boolean;
5
+ isShowModules?: boolean;
6
6
  isPrivateRoute?: boolean;
7
7
  layout?: React.LazyExoticComponent<React.MemoExoticComponent<any>> | React.ExoticComponent<any> | typeof React.Component;
8
8
  children: {