@eintrek/erp-shell 0.1.39 → 0.1.41
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.
- package/dist/index.esm.js +31 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +31 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -440,10 +440,22 @@ function SidebarProvider({ children, defaultOpen = true, }) {
|
|
|
440
440
|
localStorage.setItem("sidebar-open", String(open));
|
|
441
441
|
}
|
|
442
442
|
}, [open]);
|
|
443
|
-
// Handle mobile detection
|
|
443
|
+
// Handle mobile detection.
|
|
444
|
+
//
|
|
445
|
+
// Crossing into a narrow viewport closes the sidebar. One `open` state
|
|
446
|
+
// serves both layouts, and on desktop it is remembered as true — so
|
|
447
|
+
// narrowing the window turned that into a drawer covering the whole page,
|
|
448
|
+
// which had to be dismissed before anything underneath could be reached.
|
|
449
|
+
// A remembered desktop preference is not a request to open a drawer.
|
|
444
450
|
useEffect(() => {
|
|
451
|
+
let wasMobile = null;
|
|
445
452
|
const checkMobile = () => {
|
|
446
|
-
|
|
453
|
+
const nowMobile = window.innerWidth < 768;
|
|
454
|
+
setIsMobile(nowMobile);
|
|
455
|
+
if (nowMobile && wasMobile === false) {
|
|
456
|
+
setOpenState(false);
|
|
457
|
+
}
|
|
458
|
+
wasMobile = nowMobile;
|
|
447
459
|
};
|
|
448
460
|
checkMobile();
|
|
449
461
|
window.addEventListener("resize", checkMobile);
|
|
@@ -764,13 +776,27 @@ function AppBreadcrumb({ labels = {}, homeLabel = "แดชบอร์ด", ro
|
|
|
764
776
|
if (segments.length === 0) {
|
|
765
777
|
return jsx("h1", { className: "text-xl font-semibold", children: homeLabel });
|
|
766
778
|
}
|
|
767
|
-
return (jsx(Breadcrumb, { children: jsxs(BreadcrumbList, { children: [jsx(BreadcrumbItem, {
|
|
779
|
+
return (jsx(Breadcrumb, { children: jsxs(BreadcrumbList, { children: [jsx(BreadcrumbItem, { children: jsx(BreadcrumbLink, { asChild: true, children: jsx(Link, { href: "/", className: "font-thai text-[14px] font-normal text-white/80 hover:text-white transition-colors", children: rootLabel }) }) }), segments.map((segment, index) => {
|
|
768
780
|
const href = "/" + segments.slice(0, index + 1).join("/");
|
|
769
781
|
const isLast = index === segments.length - 1;
|
|
770
|
-
|
|
771
|
-
|
|
782
|
+
// A record id is not a place. Falling back to the raw segment put a
|
|
783
|
+
// 36-character uuid in the trail, which pushed everything before it
|
|
784
|
+
// off a phone and told the reader nothing they could use.
|
|
785
|
+
const label = labels[segment] ?? (isRecordID(segment) ? "รายละเอียด" : segment);
|
|
786
|
+
return (jsxs(Fragment, { children: [jsx(BreadcrumbSeparator, { className: "text-white/80", children: jsx(ChevronRight, { strokeWidth: 2, className: "h-4 w-4" }) }), jsx(BreadcrumbItem, { children: isLast ? (jsx(BreadcrumbPage, { className: "font-thai text-[14px] font-normal text-white/95 leading-none", children: decodeURIComponent(label) })) : (jsx(BreadcrumbLink, { asChild: true, children: jsx(Link, { href: href, className: "font-thai text-[14px] font-normal text-white/80 hover:text-white transition-colors leading-none", children: decodeURIComponent(label) }) })) })] }, `${segment}-${index}`));
|
|
772
787
|
})] }) }));
|
|
773
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* Whether a path segment is a record identifier rather than a page.
|
|
791
|
+
*
|
|
792
|
+
* Covers the uuid the APIs issue and the long opaque ids that show up in
|
|
793
|
+
* document routes. Deliberately narrow: a real page called "settings" must
|
|
794
|
+
* never be mistaken for one of these.
|
|
795
|
+
*/
|
|
796
|
+
function isRecordID(segment) {
|
|
797
|
+
return (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(segment) ||
|
|
798
|
+
/^[0-9a-f]{24,}$/i.test(segment));
|
|
799
|
+
}
|
|
774
800
|
|
|
775
801
|
function isExternalHref(href) {
|
|
776
802
|
return /^https?:\/\//i.test(href) || href.startsWith("//");
|