@pnkx-lib/ui 1.9.175 → 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,27 +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
- function buildBreadcrumbs(items, currentPath, level = 1) {
493
+ function findBreadcrumbs(items, currentPath, trail = []) {
499
494
  for (const item of items) {
500
495
  if (!item) continue;
501
- const itemPath = item.path;
502
- const matchPath = level === 3 ? removeFirstPathSegment(currentPath) : currentPath;
503
- if (matchPath.startsWith(itemPath) && item.isShowLabel) {
504
- breadcrumbsItem.push({
505
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemPath, children: item.name })
506
- });
507
- }
508
- if (item.children && item.children.length > 0) {
509
- buildBreadcrumbs(item.children, currentPath, level + 1);
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 })
503
+ }
504
+ ];
505
+ }
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
+ }
510
517
  }
511
518
  }
519
+ return null;
520
+ }
521
+ const dynamicBreadcrumbs = findBreadcrumbs(menu, pathUrl);
522
+ if (dynamicBreadcrumbs) {
523
+ breadcrumbsItem.push(...dynamicBreadcrumbs);
512
524
  }
513
- buildBreadcrumbs(menu, pathUrl);
514
525
  //! Function
515
526
  //! Render
516
527
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -1802,27 +1813,38 @@ const BreadcrumbHeading = (props) => {
1802
1813
  const breadcrumbsItem = [
1803
1814
  { title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/", children: "Trang chủ" }) }
1804
1815
  ];
1805
- function removeFirstPathSegment(path) {
1806
- const segments = path.split("/").filter(Boolean);
1807
- segments.shift();
1808
- return "/" + segments.join("/");
1809
- }
1810
- function buildBreadcrumbs(items, currentPath, level = 1) {
1816
+ function findBreadcrumbs(items, currentPath, trail = []) {
1811
1817
  for (const item of items) {
1812
1818
  if (!item) continue;
1813
- const itemPath = item.path;
1814
- const matchPath = level === 3 ? removeFirstPathSegment(currentPath) : currentPath;
1815
- if (matchPath.startsWith(itemPath) && item.isShowLabel) {
1816
- breadcrumbsItem.push({
1817
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: itemPath, children: item.name })
1818
- });
1819
- }
1820
- if (item.children && item.children.length > 0) {
1821
- buildBreadcrumbs(item.children, currentPath, level + 1);
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 })
1826
+ }
1827
+ ];
1828
+ }
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
+ }
1822
1840
  }
1823
1841
  }
1842
+ return null;
1843
+ }
1844
+ const dynamicBreadcrumbs = findBreadcrumbs(menu, pathUrl);
1845
+ if (dynamicBreadcrumbs) {
1846
+ breadcrumbsItem.push(...dynamicBreadcrumbs);
1824
1847
  }
1825
- buildBreadcrumbs(menu, pathUrl);
1826
1848
  const dataBreadcum = [
1827
1849
  ...breadcrumbsItem,
1828
1850
  ...customBreadcum ?? []
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-BQ9J8C12.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-BQ9J8C12.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.175",
4
+ "version": "1.9.176",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",