@pnkx-lib/ui 1.9.174 → 1.9.176

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.
@@ -490,34 +490,38 @@ const Heading = (props) => {
490
490
  const breadcrumbsItem = [
491
491
  { title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/", children: "Trang chủ" }) }
492
492
  ];
493
- function removeFirstPathSegment(path) {
494
- const segments = path.split("/").filter(Boolean);
495
- segments.shift();
496
- return "/" + segments.join("/");
497
- }
498
- menu.forEach((itemMenu) => {
499
- itemMenu?.children?.forEach((itemModule) => {
500
- if (pathUrl.startsWith(itemModule?.path) && itemModule.isShowLabel) {
501
- breadcrumbsItem.push({
502
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemModule.path, children: itemModule.name })
503
- });
504
- }
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
- });
493
+ function findBreadcrumbs(items, currentPath, trail = []) {
494
+ for (const item of items) {
495
+ if (!item) continue;
496
+ if (currentPath.startsWith(item.path)) {
497
+ let newTrail = [...trail];
498
+ if (!Object.prototype.hasOwnProperty.call(item, "isShowLabel") || item.isShowLabel) {
499
+ newTrail = [
500
+ ...newTrail,
501
+ {
502
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: item.path, children: item.name })
515
503
  }
516
- });
504
+ ];
517
505
  }
518
- });
519
- });
520
- });
506
+ if (item.children && item.children.length > 0) {
507
+ const childTrail = findBreadcrumbs(
508
+ item.children,
509
+ currentPath,
510
+ newTrail
511
+ );
512
+ if (childTrail) return childTrail;
513
+ }
514
+ if (newTrail.length > 0) {
515
+ return newTrail;
516
+ }
517
+ }
518
+ }
519
+ return null;
520
+ }
521
+ const dynamicBreadcrumbs = findBreadcrumbs(menu, pathUrl);
522
+ if (dynamicBreadcrumbs) {
523
+ breadcrumbsItem.push(...dynamicBreadcrumbs);
524
+ }
521
525
  //! Function
522
526
  //! Render
523
527
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -1804,46 +1808,47 @@ const ActionRowTable = ({
1804
1808
 
1805
1809
  const BreadcrumbHeading = (props) => {
1806
1810
  const { menu, customBreadcum } = props;
1807
- //! State
1808
1811
  const location = useLocation();
1809
1812
  const pathUrl = location.pathname;
1810
1813
  const breadcrumbsItem = [
1811
1814
  { title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/", children: "Trang chủ" }) }
1812
1815
  ];
1813
- function removeFirstPathSegment(path) {
1814
- const segments = path.split("/").filter(Boolean);
1815
- segments.shift();
1816
- return "/" + segments.join("/");
1817
- }
1818
- menu.forEach((itemMenu) => {
1819
- itemMenu?.children?.forEach((itemModule) => {
1820
- if (pathUrl.startsWith(itemModule?.path) && itemModule.isShowLabel) {
1821
- breadcrumbsItem.push({
1822
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemModule.path, children: itemModule.name })
1823
- });
1824
- }
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
- });
1816
+ function findBreadcrumbs(items, currentPath, trail = []) {
1817
+ for (const item of items) {
1818
+ if (!item) continue;
1819
+ if (currentPath.startsWith(item.path)) {
1820
+ let newTrail = [...trail];
1821
+ if (!Object.prototype.hasOwnProperty.call(item, "isShowLabel") || item.isShowLabel) {
1822
+ newTrail = [
1823
+ ...newTrail,
1824
+ {
1825
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: item.path, children: item.name })
1835
1826
  }
1836
- });
1827
+ ];
1837
1828
  }
1838
- });
1839
- });
1840
- });
1829
+ if (item.children && item.children.length > 0) {
1830
+ const childTrail = findBreadcrumbs(
1831
+ item.children,
1832
+ currentPath,
1833
+ newTrail
1834
+ );
1835
+ if (childTrail) return childTrail;
1836
+ }
1837
+ if (newTrail.length > 0) {
1838
+ return newTrail;
1839
+ }
1840
+ }
1841
+ }
1842
+ return null;
1843
+ }
1844
+ const dynamicBreadcrumbs = findBreadcrumbs(menu, pathUrl);
1845
+ if (dynamicBreadcrumbs) {
1846
+ breadcrumbsItem.push(...dynamicBreadcrumbs);
1847
+ }
1841
1848
  const dataBreadcum = [
1842
1849
  ...breadcrumbsItem,
1843
1850
  ...customBreadcum ?? []
1844
1851
  ];
1845
- console.log("dataBreadcum", dataBreadcum);
1846
- //! Function
1847
1852
  //! Render
1848
1853
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: className("flex justify-between items-end"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Breadcrumb, { items: dataBreadcum }) });
1849
1854
  };
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-CrIa51MB.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-CrIa51MB.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.176",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",