@pnkx-lib/ui 1.9.174 → 1.9.175

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.
@@ -495,29 +495,22 @@ const Heading = (props) => {
495
495
  segments.shift();
496
496
  return "/" + segments.join("/");
497
497
  }
498
- menu.forEach((itemMenu) => {
499
- itemMenu?.children?.forEach((itemModule) => {
500
- if (pathUrl.startsWith(itemModule?.path) && itemModule.isShowLabel) {
498
+ function buildBreadcrumbs(items, currentPath, level = 1) {
499
+ for (const item of items) {
500
+ if (!item) continue;
501
+ const itemPath = item.path;
502
+ const matchPath = level === 3 ? removeFirstPathSegment(currentPath) : currentPath;
503
+ if (matchPath.startsWith(itemPath) && item.isShowLabel) {
501
504
  breadcrumbsItem.push({
502
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemModule.path, children: itemModule.name })
505
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemPath, children: item.name })
503
506
  });
504
507
  }
505
- itemModule?.children?.forEach((itemSubmenu) => {
506
- if (pathUrl.startsWith(itemSubmenu?.path) && itemSubmenu.isShowLabel) {
507
- breadcrumbsItem.push({
508
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemSubmenu.path, children: itemSubmenu.name })
509
- });
510
- itemSubmenu?.children?.forEach((itemChidmenu) => {
511
- if (removeFirstPathSegment(pathUrl).startsWith(itemChidmenu?.path) && itemChidmenu.isShowLabel) {
512
- breadcrumbsItem.push({
513
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "", children: itemChidmenu.name })
514
- });
515
- }
516
- });
517
- }
518
- });
519
- });
520
- });
508
+ if (item.children && item.children.length > 0) {
509
+ buildBreadcrumbs(item.children, currentPath, level + 1);
510
+ }
511
+ }
512
+ }
513
+ buildBreadcrumbs(menu, pathUrl);
521
514
  //! Function
522
515
  //! Render
523
516
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -1804,7 +1797,6 @@ const ActionRowTable = ({
1804
1797
 
1805
1798
  const BreadcrumbHeading = (props) => {
1806
1799
  const { menu, customBreadcum } = props;
1807
- //! State
1808
1800
  const location = useLocation();
1809
1801
  const pathUrl = location.pathname;
1810
1802
  const breadcrumbsItem = [
@@ -1815,35 +1807,26 @@ const BreadcrumbHeading = (props) => {
1815
1807
  segments.shift();
1816
1808
  return "/" + segments.join("/");
1817
1809
  }
1818
- menu.forEach((itemMenu) => {
1819
- itemMenu?.children?.forEach((itemModule) => {
1820
- if (pathUrl.startsWith(itemModule?.path) && itemModule.isShowLabel) {
1810
+ function buildBreadcrumbs(items, currentPath, level = 1) {
1811
+ for (const item of items) {
1812
+ if (!item) continue;
1813
+ const itemPath = item.path;
1814
+ const matchPath = level === 3 ? removeFirstPathSegment(currentPath) : currentPath;
1815
+ if (matchPath.startsWith(itemPath) && item.isShowLabel) {
1821
1816
  breadcrumbsItem.push({
1822
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemModule.path, children: itemModule.name })
1817
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemPath, children: item.name })
1823
1818
  });
1824
1819
  }
1825
- itemModule?.children?.forEach((itemSubmenu) => {
1826
- if (pathUrl.startsWith(itemSubmenu?.path) && itemSubmenu.isShowLabel) {
1827
- breadcrumbsItem.push({
1828
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemSubmenu.path, children: itemSubmenu.name })
1829
- });
1830
- itemSubmenu?.children?.forEach((itemChidmenu) => {
1831
- if (removeFirstPathSegment(pathUrl).startsWith(itemChidmenu?.path) && itemChidmenu.isShowLabel) {
1832
- breadcrumbsItem.push({
1833
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "", children: itemChidmenu.name })
1834
- });
1835
- }
1836
- });
1837
- }
1838
- });
1839
- });
1840
- });
1820
+ if (item.children && item.children.length > 0) {
1821
+ buildBreadcrumbs(item.children, currentPath, level + 1);
1822
+ }
1823
+ }
1824
+ }
1825
+ buildBreadcrumbs(menu, pathUrl);
1841
1826
  const dataBreadcum = [
1842
1827
  ...breadcrumbsItem,
1843
1828
  ...customBreadcum ?? []
1844
1829
  ];
1845
- console.log("dataBreadcum", dataBreadcum);
1846
- //! Function
1847
1830
  //! Render
1848
1831
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: className("flex justify-between items-end"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Breadcrumb, { items: dataBreadcum }) });
1849
1832
  };
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { N as ActionRowTable, A as Alert, u as Anchor, v as Appfix, w as AutoComplete, d as Badge, f as Breadcrumb, a2 as BreadcrumbHeading, a1 as BulkActions, B as Button, J as CATEGORY_LIST_ENUM, a3 as Card, C as CascaderField, L as CategoryStatus, e as Col, x as Collapse, y as ColorPicker, a4 as ConfigProvider, z as ConfirmModal, c as Container, j as Divider, k as Drawer, D as Dropdown, E as Empty, G as ErrorBoundary, F as Flex, H as Heading, I as Image, M as Modal, V as PAGE_NUMBER, X as PAGE_SIZE, a5 as PageNotFound, g as Pagination, l as Popconfirm, P as Popover, Q as QRCode, n as Rate, m as Result, R as Row, Y as SORT_BY, Z as SORT_DESC, O as START_PAGE, U as START_PAGE_SIZE, b as SearchFiltersForm, o as Segmented, h as Sidebar, S as Skeleton, p as Statistic, T as Table, a as Tabs, i as Tag, q as Timeline, r as Tour, s as Tree, _ as TypeActionRowTable, $ as TypeBulkActions, a0 as TypeStatusTable, W as Watermark, K as badgeStatusCategoryConfig, t as typeColorMap } from './chunks/PageNotFound-BJkxNzD2.js';
1
+ export { N as ActionRowTable, A as Alert, u as Anchor, v as Appfix, w as AutoComplete, d as Badge, f as Breadcrumb, a2 as BreadcrumbHeading, a1 as BulkActions, B as Button, J as CATEGORY_LIST_ENUM, a3 as Card, C as CascaderField, L as CategoryStatus, e as Col, x as Collapse, y as ColorPicker, a4 as ConfigProvider, z as ConfirmModal, c as Container, j as Divider, k as Drawer, D as Dropdown, E as Empty, G as ErrorBoundary, F as Flex, H as Heading, I as Image, M as Modal, V as PAGE_NUMBER, X as PAGE_SIZE, a5 as PageNotFound, g as Pagination, l as Popconfirm, P as Popover, Q as QRCode, n as Rate, m as Result, R as Row, Y as SORT_BY, Z as SORT_DESC, O as START_PAGE, U as START_PAGE_SIZE, b as SearchFiltersForm, o as Segmented, h as Sidebar, S as Skeleton, p as Statistic, T as Table, a as Tabs, i as Tag, q as Timeline, r as Tour, s as Tree, _ as TypeActionRowTable, $ as TypeBulkActions, a0 as TypeStatusTable, W as Watermark, K as badgeStatusCategoryConfig, t as typeColorMap } from './chunks/PageNotFound-BQ9J8C12.js';
2
2
  export { C as Checkbox, D as DatePicker, E as ErrorMessage, I as Input, L as Label, b as Layout, M as Menu, P as PnkxField, R as RangePicker, S as Space, e as Spin, c as Splitter, d as Steps, f as TINY_API, h as Textarea, g as TinyMCE, a as Tooltip, T as Typography, U as UploadImage } from './chunks/UploadImage-uMEN6CjN.js';
3
3
  export { R as RadioGroup, S as Select, c as SliderRange, b as SliderSingle, a as Switch, U as UploadField } from './chunks/SliderRanger-DACURCtz.js';
4
4
  export { a as useMessage, u as useToast } from './chunks/useMessage-CUPcOtIS.js';
package/es/ui/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { N as ActionRowTable, A as Alert, u as Anchor, v as Appfix, w as AutoComplete, d as Badge, f as Breadcrumb, a2 as BreadcrumbHeading, a1 as BulkActions, B as Button, J as CATEGORY_LIST_ENUM, a3 as Card, C as CascaderField, L as CategoryStatus, e as Col, x as Collapse, y as ColorPicker, a4 as ConfigProvider, z as ConfirmModal, c as Container, j as Divider, k as Drawer, D as Dropdown, E as Empty, G as ErrorBoundary, F as Flex, H as Heading, I as Image, M as Modal, V as PAGE_NUMBER, X as PAGE_SIZE, a5 as PageNotFound, g as Pagination, l as Popconfirm, P as Popover, Q as QRCode, n as Rate, m as Result, R as Row, Y as SORT_BY, Z as SORT_DESC, O as START_PAGE, U as START_PAGE_SIZE, b as SearchFiltersForm, o as Segmented, h as Sidebar, S as Skeleton, p as Statistic, T as Table, a as Tabs, i as Tag, q as Timeline, r as Tour, s as Tree, _ as TypeActionRowTable, $ as TypeBulkActions, a0 as TypeStatusTable, W as Watermark, K as badgeStatusCategoryConfig, t as typeColorMap } from '../chunks/PageNotFound-BJkxNzD2.js';
1
+ export { N as ActionRowTable, A as Alert, u as Anchor, v as Appfix, w as AutoComplete, d as Badge, f as Breadcrumb, a2 as BreadcrumbHeading, a1 as BulkActions, B as Button, J as CATEGORY_LIST_ENUM, a3 as Card, C as CascaderField, L as CategoryStatus, e as Col, x as Collapse, y as ColorPicker, a4 as ConfigProvider, z as ConfirmModal, c as Container, j as Divider, k as Drawer, D as Dropdown, E as Empty, G as ErrorBoundary, F as Flex, H as Heading, I as Image, M as Modal, V as PAGE_NUMBER, X as PAGE_SIZE, a5 as PageNotFound, g as Pagination, l as Popconfirm, P as Popover, Q as QRCode, n as Rate, m as Result, R as Row, Y as SORT_BY, Z as SORT_DESC, O as START_PAGE, U as START_PAGE_SIZE, b as SearchFiltersForm, o as Segmented, h as Sidebar, S as Skeleton, p as Statistic, T as Table, a as Tabs, i as Tag, q as Timeline, r as Tour, s as Tree, _ as TypeActionRowTable, $ as TypeBulkActions, a0 as TypeStatusTable, W as Watermark, K as badgeStatusCategoryConfig, t as typeColorMap } from '../chunks/PageNotFound-BQ9J8C12.js';
2
2
  export { E as ErrorMessage, L as Label, b as Layout, M as Menu, S as Space, e as Spin, c as Splitter, d as Steps, f as TINY_API, a as Tooltip, T as Typography, U as UploadImage } from '../chunks/UploadImage-uMEN6CjN.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.174",
4
+ "version": "1.9.175",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",